diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2018-05-25 13:23:11 +0200 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-07-09 12:37:42 +0200 |
commit | 88dc25e8ea7c968bbf76d033431e2d7e1418bcd7 (patch) | |
tree | 78581102d167da491f21f0110666a050d696b473 /virt | |
parent | arm64: KVM: Avoid marking pages as XN in Stage-2 if CTR_EL0.DIC is set (diff) | |
download | linux-88dc25e8ea7c968bbf76d033431e2d7e1418bcd7.tar.xz linux-88dc25e8ea7c968bbf76d033431e2d7e1418bcd7.zip |
KVM: arm/arm64: Consolidate page-table accessors
The arm and arm64 KVM page tables accessors are pointlessly different
between the two architectures, and likely both wrong one way or another:
arm64 lacks a dsb(), and arm doesn't use WRITE_ONCE.
Let's unify them.
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/mmu.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index ea7314296ad1..a6bdbed1903a 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -177,6 +177,18 @@ static void clear_stage2_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr put_page(virt_to_page(pmd)); } +static inline void kvm_set_pte(pte_t *ptep, pte_t new_pte) +{ + WRITE_ONCE(*ptep, new_pte); + dsb(ishst); +} + +static inline void kvm_set_pmd(pmd_t *pmdp, pmd_t new_pmd) +{ + WRITE_ONCE(*pmdp, new_pmd); + dsb(ishst); +} + /* * Unmapping vs dcache management: * |