Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: Correct test for ICH_HCR_EL2_TDIR cap for GICv5 hosts

The original order of checks in the ICH_HCR_EL2_TDIR test returned
with false early in the case where the native GICv3 CPUIF was not
present. The result was that on GICv5 hosts with legacy support -
which do not have the GICv3 CPUIF - the test always returned false.

Reshuffle the checks such that support for GICv5 legacy is checked
prior to checking for the native GICv3 CPUIF.

Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Fixes: 2a28810cbb8b2 ("KVM: arm64: GICv3: Detect and work around the lack of ICV_DIR_EL1 trapping")
Link: https://patch.msgid.link/20251208152724.3637157-4-sascha.bischoff@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>

authored by

Sascha Bischoff and committed by
Marc Zyngier
28e505d8 da63758c

+4 -4
+4 -4
arch/arm64/kernel/cpufeature.c
··· 2326 2326 2327 2327 BUILD_BUG_ON(ARM64_HAS_ICH_HCR_EL2_TDIR <= ARM64_HAS_GICV3_CPUIF); 2328 2328 BUILD_BUG_ON(ARM64_HAS_ICH_HCR_EL2_TDIR <= ARM64_HAS_GICV5_LEGACY); 2329 - if (!this_cpu_has_cap(ARM64_HAS_GICV3_CPUIF) && 2330 - !is_midr_in_range_list(has_vgic_v3)) 2331 - return false; 2332 - 2333 2329 if (!is_hyp_mode_available()) 2334 2330 return false; 2335 2331 2336 2332 if (this_cpu_has_cap(ARM64_HAS_GICV5_LEGACY)) 2337 2333 return true; 2334 + 2335 + if (!this_cpu_has_cap(ARM64_HAS_GICV3_CPUIF) && 2336 + !is_midr_in_range_list(has_vgic_v3)) 2337 + return false; 2338 2338 2339 2339 if (is_kernel_in_hyp_mode()) 2340 2340 res.a1 = read_sysreg_s(SYS_ICH_VTR_EL2);