All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: "kvm@vger.kernel.org mailing list" <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Gleb Natapov <gleb@redhat.com>, Paul Mackerras <paulus@samba.org>
Subject: [PULL 12/12] KVM: PPC: Book3S HV: Don't drop low-order page address bits
Date: Wed, 18 Dec 2013 17:01:38 +0100	[thread overview]
Message-ID: <1387382498-19817-13-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1387382498-19817-1-git-send-email-agraf@suse.de>

From: Paul Mackerras <paulus@samba.org>

Commit caaa4c804fae ("KVM: PPC: Book3S HV: Fix physical address
calculations") unfortunately resulted in some low-order address bits
getting dropped in the case where the guest is creating a 4k HPTE
and the host page size is 64k.  By getting the low-order bits from
hva rather than gpa we miss out on bits 12 - 15 in this case, since
hva is at page granularity.  This puts the missing bits back in.

Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/book3s_hv_rm_mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 1931aa3..8689e2e 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -240,6 +240,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
 			is_io = hpte_cache_bits(pte_val(pte));
 			pa = pte_pfn(pte) << PAGE_SHIFT;
 			pa |= hva & (pte_size - 1);
+			pa |= gpa & ~PAGE_MASK;
 		}
 	}
 
-- 
1.8.1.4

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: "kvm@vger.kernel.org mailing list" <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Gleb Natapov <gleb@redhat.com>, Paul Mackerras <paulus@samba.org>
Subject: [PULL 12/12] KVM: PPC: Book3S HV: Don't drop low-order page address bits
Date: Wed, 18 Dec 2013 16:01:38 +0000	[thread overview]
Message-ID: <1387382498-19817-13-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1387382498-19817-1-git-send-email-agraf@suse.de>

From: Paul Mackerras <paulus@samba.org>

Commit caaa4c804fae ("KVM: PPC: Book3S HV: Fix physical address
calculations") unfortunately resulted in some low-order address bits
getting dropped in the case where the guest is creating a 4k HPTE
and the host page size is 64k.  By getting the low-order bits from
hva rather than gpa we miss out on bits 12 - 15 in this case, since
hva is at page granularity.  This puts the missing bits back in.

Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/book3s_hv_rm_mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 1931aa3..8689e2e 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -240,6 +240,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
 			is_io = hpte_cache_bits(pte_val(pte));
 			pa = pte_pfn(pte) << PAGE_SHIFT;
 			pa |= hva & (pte_size - 1);
+			pa |= gpa & ~PAGE_MASK;
 		}
 	}
 
-- 
1.8.1.4


  parent reply	other threads:[~2013-12-18 16:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 16:01 [PULL 00/12] 3.13 patch queue 2013-12-18 for 3.13 Alexander Graf
2013-12-18 16:01 ` Alexander Graf
2013-12-18 16:01 ` [PULL 01/12] KVM: PPC: Book3S HV: Fix physical address calculations Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 02/12] KVM: PPC: Book3S HV: Refine barriers in guest entry/exit Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 03/12] KVM: PPC: Book3S HV: Make tbacct_lock irq-safe Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 04/12] KVM: PPC: Book3S HV: Take SRCU read lock around kvm_read_guest() call Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 05/12] powerpc: kvm: fix rare but potential deadlock scene Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 06/12] KVM: PPC: Book3S: PR: Don't clobber our exit handler id Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 07/12] KVM: PPC: Book3S: PR: Export kvmppc_copy_to|from_svcpu Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 08/12] KVM: PPC: Book3S: PR: Make svcpu -> vcpu store preempt savvy Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 09/12] KVM: PPC: Book3S: PR: Enable interrupts earlier Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 10/12] powerpc/kvm/booke: Fix build break due to stack frame size warning Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` [PULL 11/12] powerpc: book3s: kvm: Don't abuse host r2 in exit path Alexander Graf
2013-12-18 16:01   ` Alexander Graf
2013-12-18 16:01 ` Alexander Graf [this message]
2013-12-18 16:01   ` [PULL 12/12] KVM: PPC: Book3S HV: Don't drop low-order page address bits Alexander Graf
2013-12-20 18:20 ` [PULL 00/12] 3.13 patch queue 2013-12-18 for 3.13 Paolo Bonzini
2013-12-20 18:20   ` 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=1387382498-19817-13-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=gleb@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=pbonzini@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.