[PATCH 4/5] KVM: arm64: Remove CnP usage
Marc Zyngier
maz at kernel.org
Thu Jun 1 07:24:28 PDT 2023
KVM has two main uses of CnP: at stage-2 so that CnP could be honored
for adventurous guests, and at EL2 stage-1, for reasons that I can't
really explain.
Get rid of the whole thing.
Signed-off-by: Marc Zyngier <maz at kernel.org>
---
arch/arm64/include/asm/kvm_mmu.h | 3 +--
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 6 ------
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 27e63c111f78..d81ec81709b5 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -281,12 +281,11 @@ static __always_inline u64 kvm_get_vttbr(struct kvm_s2_mmu *mmu)
{
struct kvm_vmid *vmid = &mmu->vmid;
u64 vmid_field, baddr;
- u64 cnp = system_supports_cnp() ? VTTBR_CNP_BIT : 0;
baddr = mmu->pgd_phys;
vmid_field = atomic64_read(&vmid->id) << VTTBR_VMID_SHIFT;
vmid_field &= VTTBR_VMID_MASK(kvm_arm_vmid_bits);
- return kvm_phys_to_vttbr(baddr) | vmid_field | cnp;
+ return kvm_phys_to_vttbr(baddr) | vmid_field;
}
/*
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-init.S b/arch/arm64/kvm/hyp/nvhe/hyp-init.S
index a6d67c2bb5ae..ffb915a17360 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-init.S
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-init.S
@@ -103,9 +103,6 @@ SYM_CODE_START_LOCAL(___kvm_hyp_init)
ldr x1, [x0, #NVHE_INIT_PGD_PA]
phys_to_ttbr x2, x1
-alternative_if ARM64_HAS_CNP
- orr x2, x2, #TTBR_CNP_BIT
-alternative_else_nop_endif
msr ttbr0_el2, x2
/*
@@ -255,9 +252,6 @@ SYM_FUNC_START(__pkvm_init_switch_pgd)
/* Install the new pgtables */
ldr x3, [x0, #NVHE_INIT_PGD_PA]
phys_to_ttbr x4, x3
-alternative_if ARM64_HAS_CNP
- orr x4, x4, #TTBR_CNP_BIT
-alternative_else_nop_endif
msr ttbr0_el2, x4
/* Set the new stack pointer */
--
2.39.2
More information about the linux-arm-kernel
mailing list