[PATCH v2 2/2] KVM: arm64: Move FGT value configuration to vCPU state

Mark Brown broonie at kernel.org
Thu Mar 23 15:08:44 PDT 2023


On Thu, Mar 23, 2023 at 07:34:08PM +0000, Marc Zyngier wrote:
> Mark Brown <broonie at kernel.org> wrote:

> > +++ b/arch/arm64/include/asm/kvm_host.h
> > @@ -365,6 +365,8 @@ enum vcpu_sysreg {
> >  	TPIDR_EL2,	/* EL2 Software Thread ID Register */
> >  	CNTHCTL_EL2,	/* Counter-timer Hypervisor Control register */
> >  	SP_EL2,		/* EL2 Stack Pointer */
> > +	HFGRTR_EL2,	/* Fine Grained Read Traps */
> > +	HFGWTR_EL2,	/* Fine Grained Write Traps */

> No, this is the wrong spot. These registers describe the *guest*
> state. Not the state that KVM sets for its own use. These registers
> would be used by a guest hypervisor to manage traps it uses for its
> own guests.

Ah, sorry, I misinterpreted what you meant when you said to put them in
kvm_vcpu_context - the sys_regs array in there seemed to be the place
where data for sysregs is stored.  The large set of EL2 registers in
there already stopped alarm bells going off, as did the fact that with
the patch above we were loading a copy from there for the guest.

To clarify, place just regular member variables in kvm_vcpu_context then
save host state to the percpu host context (I guess while activating
traps) and load the guest state from vcpu->arch.ctxt.hfgxtr_el2?  I've
got that testing locally just now.
-------------- 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/20230323/3ffb44e2/attachment.sig>


More information about the linux-arm-kernel mailing list