diff options
author | Yongji Xie <xyjxie@linux.vnet.ibm.com> | 2016-11-04 13:55:11 +0800 |
---|---|---|
committer | Paul Mackerras <paulus@ozlabs.org> | 2016-11-21 15:17:55 +1100 |
commit | f05859827d28bde311a92e0bb5c1b6a92c305442 (patch) | |
tree | 43a09c5fa04ef8d2128a34dda160df08bd94bf01 /arch/powerpc/kvm/book3s_hv_rm_mmu.c | |
parent | 28d057c8970d394fe048f0b2b9f203889110f165 (diff) | |
download | linux-f05859827d28bde311a92e0bb5c1b6a92c305442.tar.gz linux-f05859827d28bde311a92e0bb5c1b6a92c305442.tar.bz2 linux-f05859827d28bde311a92e0bb5c1b6a92c305442.zip |
KVM: PPC: Book3S HV: Clear the key field of HPTE when the page is paged out
Currently we mark a HPTE for emulated MMIO with HPTE_V_ABSENT bit
set as well as key 0x1f. However, those HPTEs may be conflicted with
the HPTE for real guest RAM page HPTE with key 0x1f when the page
get paged out.
This patch clears the key field of HPTE when the page is paged out,
then recover it when HPTE is re-established.
Signed-off-by: Yongji Xie <xyjxie@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/powerpc/kvm/book3s_hv_rm_mmu.c')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rm_mmu.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index 6b3d01b024d7..e960c831fd15 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c @@ -265,8 +265,10 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, if (pa) pteh |= HPTE_V_VALID; - else + else { pteh |= HPTE_V_ABSENT; + ptel &= ~(HPTE_R_KEY_HI | HPTE_R_KEY_LO); + } /*If we had host pte mapping then Check WIMG */ if (ptep && !hpte_cache_flags_ok(ptel, is_ci)) { @@ -352,6 +354,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, /* inval in progress, write a non-present HPTE */ pteh |= HPTE_V_ABSENT; pteh &= ~HPTE_V_VALID; + ptel &= ~(HPTE_R_KEY_HI | HPTE_R_KEY_LO); unlock_rmap(rmap); } else { kvmppc_add_revmap_chain(kvm, rev, rmap, pte_index, |