Skip to content

Commit 9cb0468

Browse files
Fuad TabbaMarc Zyngier
authored andcommitted
KVM: arm64: Optimise away S1POE handling when not supported by host
Although ID register sanitisation prevents guests from seeing the feature, adding this check to the helper allows the compiler to entirely eliminate S1POE-specific code paths (such as context switching POR_EL1) when the host kernel is compiled without support (CONFIG_ARM64_POE is disabled). This aligns with the pattern used for other optional features like SVE (kvm_has_sve()) and FPMR (kvm_has_fpmr()), ensuring no POE logic if the host lacks support, regardless of the guest configuration state. Signed-off-by: Fuad Tabba <tabba@google.com> Link: https://patch.msgid.link/20260213143815.1732675-3-tabba@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent f66857b commit 9cb0468

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/arm64/include/asm/kvm_host.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,8 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val);
16161616
(kvm_has_feat((k), ID_AA64MMFR3_EL1, S1PIE, IMP))
16171617

16181618
#define kvm_has_s1poe(k) \
1619-
(kvm_has_feat((k), ID_AA64MMFR3_EL1, S1POE, IMP))
1619+
(system_supports_poe() && \
1620+
kvm_has_feat((k), ID_AA64MMFR3_EL1, S1POE, IMP))
16201621

16211622
#define kvm_has_ras(k) \
16221623
(kvm_has_feat((k), ID_AA64PFR0_EL1, RAS, IMP))

0 commit comments

Comments
 (0)