On Thu, Aug 01, 2024 at 10:19:51AM +0100, Marc Zyngier wrote: > index 6af179c6356d..2466dd231362 100644 > --- a/arch/arm64/kvm/hyp/nvhe/switch.c > +++ b/arch/arm64/kvm/hyp/nvhe/switch.c > @@ -198,6 +198,15 @@ static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu) > } else { > __fpsimd_save_state(*host_data_ptr(fpsimd_state)); > } > + > + if (kvm_has_fpmr(vcpu->kvm)) { nVHE is faulting for me, apparently on the kvm_has_fpmr() check though I ran out of time to actually figure out where exactly it is going wrong. I'll have a further poke tomorrow. Backtrace below. > + u64 fpmr = read_sysreg_s(SYS_FPMR); > + > + if (unlikely(is_protected_kvm_enabled())) > + *host_data_ptr(fpmr) = fpmr; That looks wrong until you remember what host_data_ptr() does but but it's actually fine. host_data_ptr() is looking inside the struct kvm_host_data for the CPU rather than referencing the locally defined variable fpmr here. I do think it's worth avoiding the name collision though, perhaps just avoid the temporary variable? [ 1610.219274][ T247] kvm [247]: nVHE hyp panic at: [<ffffffc080ce3fc8>] __kvm_ nvhe_$x.262+0x24/0x38! [ 1610.219435][ T247] kvm [247]: nVHE call trace: [ 1610.219509][ T247] kvm [247]: [<ffffffc080ce3c2c>] __kvm_nvhe_hyp_panic+0xb 4/0xf8 [ 1610.219657][ T247] kvm [247]: [<ffffffc080ce3df4>] __kvm_nvhe_$x.238+0x14/0x60 [ 1610.219803][ T247] kvm [247]: [<ffffffc080ce33f8>] __kvm_nvhe_$x.88+0x24/0x23c [ 1610.219942][ T247] kvm [247]: [<ffffffc080ce64b4>] __kvm_nvhe_$x.26+0x8/0x2c [ 1610.220080][ T247] kvm [247]: [<ffffffc080ce617c>] __kvm_nvhe_$x.1+0x9c/0xa4 [ 1610.220216][ T247] kvm [247]: [<ffffffc080ce50fc>] __kvm_nvhe___skip_pauth_save+0x4/0x4 [ 1610.220356][ T247] kvm [247]: ---[ end nVHE call trace ]--- [ 1610.220435][ T247] kvm [247]: Hyp Offset: 0xffffff807fe00000 [ 1610.220566][ T247] Kernel panic - not syncing: HYP panic: [ 1610.220566][ T247] PS:1624023c9 PC:0000004000ee3fc8 ESR:0000000096000004 [ 1610.220566][ T247] FAR:ffffff880115cd1c HPFAR:0000000000000000 PAR:1d00007edbadc8de [ 1610.220566][ T247] VCPU:0000004801e88000 [ 1610.220743][ T247] CPU: 0 UID: 0 PID: 247 Comm: kvm-vcpu-0 Not tainted 6.11.0-rc1+ #247 [ 1610.220878][ T247] Hardware name: FVP Base RevC (DT) [ 1610.220958][ T247] Call trace: [ 1610.221023][ T247] dump_backtrace+0xfc/0x140 [ 1610.221132][ T247] show_stack+0x24/0x38 [ 1610.221239][ T247] dump_stack_lvl+0x3c/0x118 [ 1610.221358][ T247] dump_stack+0x18/0x40 [ 1610.221474][ T247] panic+0x134/0x368 [ 1610.221609][ T247] nvhe_hyp_panic_handler+0x114/0x1a0 [ 1610.221758][ T247] kvm_arm_vcpu_enter_exit+0x54/0xc0 [ 1610.221895][ T247] kvm_arch_vcpu_ioctl_run+0x494/0xa28
Attachment:
signature.asc
Description: PGP signature