From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: "kvm@vger.kernel.org mailing list" <kvm@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>
Subject: [PATCH 6/7] KVM: PPC: Book3S PR: Invalidate SLB entries properly
Date: Sun, 30 Jun 2013 03:38:47 +0200 [thread overview]
Message-ID: <1372556328-18617-7-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1372556328-18617-1-git-send-email-agraf@suse.de>
From: Paul Mackerras <paulus@samba.org>
At present, if the guest creates a valid SLB (segment lookaside buffer)
entry with the slbmte instruction, then invalidates it with the slbie
instruction, then reads the entry with the slbmfee/slbmfev instructions,
the result of the slbmfee will have the valid bit set, even though the
entry is not actually considered valid by the host. This is confusing,
if not worse. This fixes it by zeroing out the orige and origv fields
of the SLB entry structure when the entry is invalidated.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/kvm/book3s_64_mmu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index ee435ba..739bfba 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -397,6 +397,8 @@ static void kvmppc_mmu_book3s_64_slbie(struct kvm_vcpu *vcpu, u64 ea)
dprintk("KVM MMU: slbie(0x%llx, 0x%llx)\n", ea, slbe->esid);
slbe->valid = false;
+ slbe->orige = 0;
+ slbe->origv = 0;
seg_size = 1ull << kvmppc_slb_sid_shift(slbe);
kvmppc_mmu_flush_segment(vcpu, ea & ~(seg_size - 1), seg_size);
@@ -408,8 +410,11 @@ static void kvmppc_mmu_book3s_64_slbia(struct kvm_vcpu *vcpu)
dprintk("KVM MMU: slbia()\n");
- for (i = 1; i < vcpu->arch.slb_nr; i++)
+ for (i = 1; i < vcpu->arch.slb_nr; i++) {
vcpu->arch.slb[i].valid = false;
+ vcpu->arch.slb[i].orige = 0;
+ vcpu->arch.slb[i].origv = 0;
+ }
if (vcpu->arch.shared->msr & MSR_IR) {
kvmppc_mmu_flush_segments(vcpu);
--
1.8.1.4
next prev parent reply other threads:[~2013-06-30 1:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-30 1:38 [PULL 0/7] ppc patch queue 2013-06-30 Alexander Graf
2013-06-30 1:38 ` [PATCH 1/7] KVM: PPC: Guard doorbell exception with CONFIG_PPC_DOORBELL Alexander Graf
2013-06-30 1:38 ` [PATCH 2/7] KVM: PPC: Book3S PR: Fix proto-VSID calculations Alexander Graf
2013-06-30 1:38 ` [PATCH 3/7] KVM: PPC: Book3S PR: Fix invalidation of SLB entry 0 on guest entry Alexander Graf
2013-06-30 1:38 ` [PATCH 4/7] KVM: PPC: Book3S PR: Don't keep scanning HPTEG after we find a match Alexander Graf
2013-06-30 1:38 ` [PATCH 5/7] KVM: PPC: Book3S PR: Allow guest to use 1TB segments Alexander Graf
2013-06-30 1:38 ` Alexander Graf [this message]
2013-06-30 1:38 ` [PATCH 7/7] KVM: PPC: Ignore PIR writes Alexander Graf
2013-06-30 1:59 ` [PULL 0/7] ppc patch queue 2013-06-30 Alexander Graf
2013-07-02 7:47 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372556328-18617-7-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox