[PATCH v19 03/14] KVM: arm64: Manage GCS access and registers for guests

Mark Brown broonie at kernel.org
Fri Aug 21 05:30:42 PDT 2026


On Fri, Aug 21, 2026 at 12:39:08AM +0100, Wei-Lin Chang wrote:

> Hey I feel the question wasn't answered completely :)

> Here is the reason for the asymmetric save restore (besides the tcr2
> part):

...

> Quite a few other registers are saved only if guest E2H == 1 because of
> the same reason.

There's a big comment in the code about saving in the E2H case only in
the existing code FWIW:

	/*
	 * In VHE mode those registers are compatible between EL1 and EL2,
	 * and the guest uses the _EL1 versions on the CPU naturally.
	 * So we save them into their _EL2 versions here.
	 * For nVHE mode we trap accesses to those registers, so our
	 * _EL2 copy in sys_regs[] is always up-to-date and we don't need
	 * to save anything here.
	 */
	if (vcpu_el2_e2h_is_set(vcpu)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260821/6d700895/attachment.sig>


More information about the linux-arm-kernel mailing list