Re: [PATCH 03/11] KVM: arm64: nv: Load guest FP state for ZCR_EL2 trap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 01, 2024 at 10:47:47AM +0100, Marc Zyngier wrote:
> On Sat, 01 Jun 2024 00:13:50 +0100, Oliver Upton <oliver.upton@xxxxxxxxx> wrote:
> > +static bool kvm_hyp_handle_zcr(struct kvm_vcpu *vcpu, u64 *exit_code)
> > +{
> > +	u32 sysreg = esr_sys64_to_sysreg(kvm_vcpu_get_esr(vcpu));
> > +
> > +	if (!vcpu_has_nv(vcpu))
> > +		return false;
> > +
> > +	if (sysreg != SYS_ZCR_EL2)
> > +		return false;
> > +
> > +	if (guest_owns_fp_regs())
> > +		return false;
> > +
> > +	return kvm_hyp_handle_fpsimd(vcpu, exit_code);
> 
> For my own understanding of the flow: let's say the L1 guest accesses
> ZCR_EL2 while the host own the FP regs:
> 
> - ZCR_EL2 traps
> - we restore the guest's state, enable SVE
> - ZCR_EL2 traps again
> - emulate the access on the slow path
> 
> In contrast, the same thing using ZCR_EL1 in L1 results in:
> 
> - ZCR_EL1 traps
> - we restore the guest's state, enable SVE
> 
> and we're done.
> 
> Is that correct? If so, a comment would help... ;-)

Yeah, and I agree having a comment for this would be a good idea. Now
that I'm looking at this code again, I had wanted to avoid the second
trap on ZCR_EL2, so I'll probably fold in a change to bounce out to the
slow path after loading SVE state.

-- 
Thanks,
Oliver




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux