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

From: Mark Brown

Date: Fri Aug 21 2026 - 08:33:58 EST


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)) {

Attachment: signature.asc
Description: PGP signature