linux-loongson/arch/arm64/kvm/hyp/vhe
Marc Zyngier 303084ad12 KVM: arm64: Filter out HCR_EL2 bits when running in hypervisor context
Most HCR_EL2 bits are not supposed to affect EL2 at all, but only
the guest. However, we gladly merge these bits with the host's
HCR_EL2 configuration, irrespective of entering L1 or L2.

This leads to some funky behaviour, such as L1 trying to inject
a virtual SError for L2, and getting a taste of its own medecine.
Not quite what the architecture anticipated.

In the end, the only bits that matter are those we have defined as
invariants, either because we've made them RESx (E2H, HCD...), or
that we actively refuse to merge because the mess with KVM's own
logic.

Use the sanitisation infrastructure to get the RES1 bits, and let
things rip in a safer way.

Fixes: 04ab519bb8 ("KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250721101955.535159-3-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
2025-07-21 09:35:57 -07:00
..
debug-sr.c KVM: arm64: Get rid of __kvm_get_mdcr_el2() and related warts 2024-12-20 08:49:08 +00:00
Makefile KVM: arm64: fix override-init warnings in W=1 builds 2024-08-02 18:58:03 +00:00
switch.c KVM: arm64: Filter out HCR_EL2 bits when running in hypervisor context 2025-07-21 09:35:57 -07:00
sysreg-sr.c KVM: arm64: Context switch SCTLR2_ELx when advertised to the guest 2025-07-08 11:36:35 -07:00
timer-sr.c KVM: arm64: Duplicate hyp/timer-sr.c for VHE/nVHE 2020-07-05 18:38:38 +01:00
tlb.c arm64: errata: Work around AmpereOne's erratum AC04_CPU_23 2025-05-19 12:46:26 +01:00