diff options
| author | Vincent Donnefort <vdonnefort@google.com> | 2026-10-26 16:39:36 +0000 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-11-03 11:27:34 +0000 |
| commit | 91e496a1e474d56e296f3997ed2a34185e9a1c0c (patch) | |
| tree | 373df10adb40604beb58fdd553fe9259951d559d /tools/perf/scripts/python/bin | |
| parent | a511905b3c0d6e73afcc4016b2eddc159703060e (diff) | |
KVM: arm64: pkvm: Fix missing reset of GICv3 LRs
The vGIC LRs are architecturally UNKNOWN when the CPU boots or resumes.
However, in protected mode, only the used ones are reset, because the
HVC __vgic_v3_init_lrs() is never called:
* During boot, vgic_present is only set in init_subsystems(), after
cpu_hyp_init() was called.
* During CPU hotplug, kvm_arch_enable_virtualization_cpu() never calls
it either because kvm_hyp_initialized is always set.
* During CPU resume, no notifier is registered for pKVM.
If left uninitialised, those registers may inject spurious interrupts or
worse, if EOI is set, livelock the vCPU, since no one is in position to
clear it.
First, return the error of __hyp_reset_vectors(). On an error, we know
the hypervisor doesn't allow a reset. Only re-init what the host has
access to, no matter the KVM configuration, which is the vGIC LRs.
Then, cpu_hyp_init() is only called from init_subsystems() and
kvm_arch_enable_virtualization_cpu(). Remove the kvm_hyp_initialized
gate. It is possible because when pKVM is enabled, a CPU may already be
initialised but then cpu_hyp_reset() simply returns an error, so we know
we can skip the full init, while for the other modes, we know for sure
it is never initialised when it hits this path.
Finally, enable the PM notifiers for pKVM, it is now safe to do so. It
will ensure the host properly configures the vGIC LRs regardless of the
KVM configuration.
Fixes: fa8c3d65538a ("KVM: arm64: Keep nVHE EL2 vector installed")
Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Link: https://patch.msgid.link/20261026163937.963087-3-vdonnefort@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
