All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerhard Pircher <gerhard_pircher@gmx.net>
To: Alexander Graf <agraf@suse.de>
Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org
Subject: [PATCH] powerpc: kvm: Set M flag for KVM PTE depending on CPU_FTR_NEED_COHERENT
Date: Sun, 18 Jan 2015 16:12:30 +0000	[thread overview]
Message-ID: <54BBDB6E.6050808@gmx.net> (raw)

Usually page table entries only have the M (coherence) flag set, if the
kernel is in SMP mode or to avoid data corruption due to CPU bugs (e.g.
some 74xx CPUs). KVM on book3s_32 however always sets the M flag for a
PTE, which locks up machines based on the amigaone platform when running
QEMU or MoL.
Setting the M flag depending on CPU_FTR_NEED_COHERENT also makes KVM work
on this platform and aligns the PTE setup to the rest of the kernel.

Signed-off-by: Gerhard Pircher <gerhard_pircher@gmx.net>
---
With this patch I could successfully run a Debian Wheezy installation
inside QEMU started with --enable-kvm on my AmigaOneG3SE.

 arch/powerpc/kvm/book3s_32_mmu_host.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 2035d16..935c7d0 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -204,7 +204,10 @@ next_pteg:
 
 	pteg0 = ((eaddr & 0x0fffffff) >> 22) | (vsid << 7) | PTE_V |
 		(primary ? 0 : PTE_SEC);
-	pteg1 = hpaddr | PTE_M | PTE_R | PTE_C;
+	pteg1 = hpaddr | PTE_R | PTE_C;
+
+	if (cpu_has_feature(CPU_FTR_NEED_COHERENT))
+		pteg1 |= PTE_M;
 
 	if (orig_pte->may_write && writable) {
 		pteg1 |= PP_RWRW;
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Gerhard Pircher <gerhard_pircher@gmx.net>
To: Alexander Graf <agraf@suse.de>
Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org
Subject: [PATCH] powerpc: kvm: Set M flag for KVM PTE depending on CPU_FTR_NEED_COHERENT
Date: Sun, 18 Jan 2015 17:12:30 +0100	[thread overview]
Message-ID: <54BBDB6E.6050808@gmx.net> (raw)

Usually page table entries only have the M (coherence) flag set, if the
kernel is in SMP mode or to avoid data corruption due to CPU bugs (e.g.
some 74xx CPUs). KVM on book3s_32 however always sets the M flag for a
PTE, which locks up machines based on the amigaone platform when running
QEMU or MoL.
Setting the M flag depending on CPU_FTR_NEED_COHERENT also makes KVM work
on this platform and aligns the PTE setup to the rest of the kernel.

Signed-off-by: Gerhard Pircher <gerhard_pircher@gmx.net>
---
With this patch I could successfully run a Debian Wheezy installation
inside QEMU started with --enable-kvm on my AmigaOneG3SE.

 arch/powerpc/kvm/book3s_32_mmu_host.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 2035d16..935c7d0 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -204,7 +204,10 @@ next_pteg:
 
 	pteg0 = ((eaddr & 0x0fffffff) >> 22) | (vsid << 7) | PTE_V |
 		(primary ? 0 : PTE_SEC);
-	pteg1 = hpaddr | PTE_M | PTE_R | PTE_C;
+	pteg1 = hpaddr | PTE_R | PTE_C;
+
+	if (cpu_has_feature(CPU_FTR_NEED_COHERENT))
+		pteg1 |= PTE_M;
 
 	if (orig_pte->may_write && writable) {
 		pteg1 |= PP_RWRW;
-- 
1.9.1

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18 16:12 Gerhard Pircher [this message]
2015-01-18 16:12 ` [PATCH] powerpc: kvm: Set M flag for KVM PTE depending on CPU_FTR_NEED_COHERENT Gerhard Pircher

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=54BBDB6E.6050808@gmx.net \
    --to=gerhard_pircher@gmx.net \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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 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.