Skip to contentSkip to conversation

POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

PATCH Superseded Aneesh Kumar K.V 6 participants 19 messages May 4, 2014 – May 6, 2014

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

 arch/powerpc/include/asm/disassemble.h | 34 +++++++++++++++++++++++++++
 arch/powerpc/kernel/align.c            | 34 +--------------------------
 arch/powerpc/kvm/book3s_emulate.c      | 43 ++++------------------------------
 3 files changed, 40 insertions(+), 71 deletions(-)
arch/powerpc/include/asm/disassemble.h +34 -0
index 856f8deb557a..6330a61b875a 100644
@@ -81,4 +81,38 @@ static inline unsigned int get_oc(u32 inst)
 {
 	return (inst >> 11) & 0x7fff;
 }
+
+#define IS_XFORM(inst)	(get_op(inst)  == 31)
+#define IS_DSFORM(inst)	(get_op(inst) >= 56)
+
+/*
+ * Create a DSISR value from the instruction
+ */
+static inline unsigned make_dsisr(unsigned instr)
+{
+	unsigned dsisr;
+
+
+	/* bits  6:15 --> 22:31 */
+	dsisr = (instr & 0x03ff0000) >> 16;
+
+	if (IS_XFORM(instr)) {
+		/* bits 29:30 --> 15:16 */
+		dsisr |= (instr & 0x00000006) << 14;
+		/* bit     25 -->    17 */
+		dsisr |= (instr & 0x00000040) << 8;
+		/* bits 21:24 --> 18:21 */
+		dsisr |= (instr & 0x00000780) << 3;
+	} else {
+		/* bit      5 -->    17 */
+		dsisr |= (instr & 0x04000000) >> 12;
+		/* bits  1: 4 --> 18:21 */
+		dsisr |= (instr & 0x78000000) >> 17;
+		/* bits 30:31 --> 12:13 */
+		if (IS_DSFORM(instr))
+			dsisr |= (instr & 0x00000003) << 18;
+	}
+
+	return dsisr;
+}
 #endif /* __ASM_PPC_DISASSEMBLE_H__ */
arch/powerpc/kernel/align.c +1 -33
index 94908af308d8..34f55524d456 100644
@@ -25,14 +25,13 @@
 #include <asm/cputable.h>
 #include <asm/emulated_ops.h>
 #include <asm/switch_to.h>
+#include <asm/disassemble.h>
 
 struct aligninfo {
 	unsigned char len;
 	unsigned char flags;
 };
 
-#define IS_XFORM(inst)	(((inst) >> 26) == 31)
-#define IS_DSFORM(inst)	(((inst) >> 26) >= 56)
 
 #define INVALID	{ 0, 0 }
 
@@ -192,37 +191,6 @@ static struct aligninfo aligninfo[128] = {
 };
 
 /*
- * Create a DSISR value from the instruction
- */
-static inline unsigned make_dsisr(unsigned instr)
-{
-	unsigned dsisr;
-
-
-	/* bits  6:15 --> 22:31 */
-	dsisr = (instr & 0x03ff0000) >> 16;
-
-	if (IS_XFORM(instr)) {
-		/* bits 29:30 --> 15:16 */
-		dsisr |= (instr & 0x00000006) << 14;
-		/* bit     25 -->    17 */
-		dsisr |= (instr & 0x00000040) << 8;
-		/* bits 21:24 --> 18:21 */
-		dsisr |= (instr & 0x00000780) << 3;
-	} else {
-		/* bit      5 -->    17 */
-		dsisr |= (instr & 0x04000000) >> 12;
-		/* bits  1: 4 --> 18:21 */
-		dsisr |= (instr & 0x78000000) >> 17;
-		/* bits 30:31 --> 12:13 */
-		if (IS_DSFORM(instr))
-			dsisr |= (instr & 0x00000003) << 18;
-	}
-
-	return dsisr;
-}
-
-/*
  * The dcbz (data cache block zero) instruction
  * gives an alignment fault if used on non-cacheable
  * memory.  We handle the fault mainly for the
arch/powerpc/kvm/book3s_emulate.c +5 -38

57 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 158 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

  arch/powerpc/include/asm/disassemble.h | 34 +++++++++++++++++++++++++++
  arch/powerpc/kernel/align.c            | 34 +--------------------------
  arch/powerpc/kvm/book3s_emulate.c      | 43 ++++------------------------------
  3 files changed, 40 insertions(+), 71 deletions(-)
arch/powerpc/include/asm/disassemble.h +34 -0
index 856f8deb557a..6330a61b875a 100644
@@ -81,4 +81,38 @@ static inline unsigned int get_oc(u32 inst)
  {
  	return (inst >> 11) & 0x7fff;
  }
+
+#define IS_XFORM(inst)	(get_op(inst)  = 31)
+#define IS_DSFORM(inst)	(get_op(inst) >= 56)
+
+/*
+ * Create a DSISR value from the instruction
+ */
+static inline unsigned make_dsisr(unsigned instr)
+{
+	unsigned dsisr;
+
+
+	/* bits  6:15 --> 22:31 */
+	dsisr = (instr & 0x03ff0000) >> 16;
+
+	if (IS_XFORM(instr)) {
+		/* bits 29:30 --> 15:16 */
+		dsisr |= (instr & 0x00000006) << 14;
+		/* bit     25 -->    17 */
+		dsisr |= (instr & 0x00000040) << 8;
+		/* bits 21:24 --> 18:21 */
+		dsisr |= (instr & 0x00000780) << 3;
+	} else {
+		/* bit      5 -->    17 */
+		dsisr |= (instr & 0x04000000) >> 12;
+		/* bits  1: 4 --> 18:21 */
+		dsisr |= (instr & 0x78000000) >> 17;
+		/* bits 30:31 --> 12:13 */
+		if (IS_DSFORM(instr))
+			dsisr |= (instr & 0x00000003) << 18;
+	}
+
+	return dsisr;
+}
  #endif /* __ASM_PPC_DISASSEMBLE_H__ */
arch/powerpc/kernel/align.c +1 -33
index 94908af308d8..34f55524d456 100644
@@ -25,14 +25,13 @@
  #include <asm/cputable.h>
  #include <asm/emulated_ops.h>
  #include <asm/switch_to.h>
+#include <asm/disassemble.h>
 
  struct aligninfo {
  	unsigned char len;
  	unsigned char flags;
  };
 
-#define IS_XFORM(inst)	(((inst) >> 26) = 31)
-#define IS_DSFORM(inst)	(((inst) >> 26) >= 56)
 
  #define INVALID	{ 0, 0 }
 
@@ -192,37 +191,6 @@ static struct aligninfo aligninfo[128] = {
  };
 
  /*
- * Create a DSISR value from the instruction
- */
-static inline unsigned make_dsisr(unsigned instr)
-{
-	unsigned dsisr;
-
-
-	/* bits  6:15 --> 22:31 */
-	dsisr = (instr & 0x03ff0000) >> 16;
-
-	if (IS_XFORM(instr)) {
-		/* bits 29:30 --> 15:16 */
-		dsisr |= (instr & 0x00000006) << 14;
-		/* bit     25 -->    17 */
-		dsisr |= (instr & 0x00000040) << 8;
-		/* bits 21:24 --> 18:21 */
-		dsisr |= (instr & 0x00000780) << 3;
-	} else {
-		/* bit      5 -->    17 */
-		dsisr |= (instr & 0x04000000) >> 12;
-		/* bits  1: 4 --> 18:21 */
-		dsisr |= (instr & 0x78000000) >> 17;
-		/* bits 30:31 --> 12:13 */
-		if (IS_DSFORM(instr))
-			dsisr |= (instr & 0x00000003) << 18;
-	}
-
-	return dsisr;
-}
-
-/*
   * The dcbz (data cache block zero) instruction
   * gives an alignment fault if used on non-cacheable
   * memory.  We handle the fault mainly for the
arch/powerpc/kvm/book3s_emulate.c +0 -35
index 99d40f8977e8..04c38f049dfd 100644
@@ -569,48 +569,14 @@ unprivileged:
 
  u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst)
  {
-	u32 dsisr = 0;
-
-	/*
-	 * This is what the spec says about DSISR bits (not mentioned = 0):
-	 *
-	 * 12:13		[DS]	Set to bits 30:31
-	 * 15:16		[X]	Set to bits 29:30
-	 * 17			[X]	Set to bit 25
-	 *			[D/DS]	Set to bit 5
-	 * 18:21		[X]	Set to bits 21:24
-	 *			[D/DS]	Set to bits 1:4
-	 * 22:26			Set to bits 6:10 (RT/RS/FRT/FRS)
-	 * 27:31			Set to bits 11:15 (RA)
-	 */
-
-	switch (get_op(inst)) {
-	/* D-form */
-	case OP_LFS:
-	case OP_LFD:
-	case OP_STFD:
-	case OP_STFS:
-		dsisr |= (inst >> 12) & 0x4000;	/* bit 17 */
-		dsisr |= (inst >> 17) & 0x3c00; /* bits 18:21 */
-		break;
-	/* X-form */
-	case 31:
-		dsisr |= (inst << 14) & 0x18000; /* bits 15:16 */
-		dsisr |= (inst << 8)  & 0x04000; /* bit 17 */
-		dsisr |= (inst << 3)  & 0x03c00; /* bits 18:21 */
-		break;
-	default:
-		printk(KERN_INFO "KVM: Unaligned instruction 0x%x\n", inst);
-		break;
-	}
-

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 10 lines
arch/powerpc/kvm/book3s_emulate.c +3 -3
-	dsisr |= (inst >> 16) & 0x03ff; /* bits 22:31 */
-
-	return dsisr;
+	return make_dsisr(inst);
  }
 
  ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
  {
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

Alex

#2 lore raw
Quoted 10 lines · Alexander Graf
Quoted 9 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

....

Quoted 8 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines
  ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
  {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

-aneesh

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#3 lore raw
Quoted 21 lines · Aneesh Kumar K.V
Quoted 10 lines · Alexander Graf
Quoted 9 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

....

Quoted 7 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines
   ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
   {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

Quoted 5 lines

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

Alex

#4 lore raw
Quoted 28 lines · Alexander Graf
Quoted 21 lines · Aneesh Kumar K.V
Quoted 10 lines · Alexander Graf
Quoted 9 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

....

Quoted 7 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines
   ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
   {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

Quoted 5 lines

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Quoted 4 lines

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

I will have to defer to Paul on that question. But that should not prevent this patch from going upstream right ?

-aneesh

#5 lore raw
Quoted 31 lines

Am 05.05.2014 um 16:50 schrieb "Aneesh Kumar K.V" <[email protected]>:

Quoted 25 lines · Alexander Graf
Quoted 24 lines · Aneesh Kumar K.V
Quoted 9 lines · Alexander Graf
Quoted 9 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

....

Quoted 5 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines
  ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
  {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+    return vcpu->arch.fault_dar;

How about PA6T and G5s?

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Quoted 7 lines
Quoted 4 lines

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

I will have to defer to Paul on that question. But that should not prevent this patch from going upstream right ?

Regressions are big no-gos.

Alex

Quoted 3 lines

-aneesh

#6 lore raw
In reply to Alexander Graf

2014-05-05 7:43 GMT-07:00 Alexander Graf <[email protected]>:

Quoted 33 lines · Aneesh Kumar K.V
Quoted 22 lines

Alexander Graf <[email protected]> writes:

Quoted 4 lines · Aneesh Kumar K.V
Quoted 4 lines

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

Quoted 8 lines
Quoted 8 lines

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use
saved dsisr or not

....

ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)

Quoted 4 lines
Quoted 4 lines
   {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+       return vcpu->arch.fault_dar;
Quoted 9 lines
Quoted 4 lines

How about PA6T and G5s?

Paul mentioned that BOOK3S always had DAR value set on alignment

interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Quoted 6 lines

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

Thanks for looking out for us, obviously IBM doesn't (based on the reply a minute ago).

In the end, since there's been no work to enable KVM on PA6T, I'm not too worried. I guess it's one more thing to sort out (and check for) whenever someone does that.

I definitely don't have cycles to deal with that myself at this time. I can help find hardware for someone who wants to, but even then I'm guessing the interest is pretty limited.

-Olof

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#7 lore raw
Quoted 35 lines · Olof Johansson

2014-05-05 7:43 GMT-07:00 Alexander Graf <[email protected]>:

Quoted 33 lines · Aneesh Kumar K.V
Quoted 31 lines

Alexander Graf <[email protected]> writes:

Quoted 4 lines · Aneesh Kumar K.V
Quoted 4 lines

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

Quoted 8 lines
Quoted 8 lines

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use
saved dsisr or not

....

ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)

Quoted 8 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines
   {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+       return vcpu->arch.fault_dar;

How about PA6T and G5s?

Paul mentioned that BOOK3S always had DAR value set on alignment

interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Quoted 8 lines
Quoted 6 lines

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

Thanks for looking out for us, obviously IBM doesn't (based on the reply a minute ago).

The reason I deferred the question to Paul is really because I don't know enough about PA6T and G5 to comment. I intentionally restricted the changes to BOOK3S_64 because I wanted to make sure I don't break anything else. It is in no way to hint that others don't care.

-aneesh

#8 lore raw

2014-05-05 8:03 GMT-07:00 Aneesh Kumar K.V <[email protected]>:

Quoted 43 lines
Quoted 41 lines · Olof Johansson

2014-05-05 7:43 GMT-07:00 Alexander Graf <[email protected]>:

Quoted 39 lines · Aneesh Kumar K.V
Quoted 22 lines

Alexander Graf <[email protected]> writes:

Quoted 4 lines · Aneesh Kumar K.V
Quoted 4 lines

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

Quoted 8 lines
Quoted 8 lines

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use
saved dsisr or not

....

ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)

Quoted 4 lines
Quoted 4 lines
   {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+       return vcpu->arch.fault_dar;
Quoted 9 lines
Quoted 4 lines

How about PA6T and G5s?

Paul mentioned that BOOK3S always had DAR value set on alignment

interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

Quoted 7 lines
Quoted 2 lines

Thanks for looking out for us, obviously IBM doesn't (based on the reply a minute ago).

The reason I deferred the question to Paul is really because I don't know enough about PA6T and G5 to comment. I intentionally restricted the changes to BOOK3S_64 because I wanted to make sure I don't break anything else. It is in no way to hint that others don't care.

Ah, I see -- the disconnect is that you don't think PA6T and 970 are 64-bit book3s CPUs. They are.

-Olof
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#9 lore raw
In reply to Alexander Graf

[Now without HTML email -- it's what you get for cc:ing me at work instead of my upstream email :)]

2014-05-05 7:43 GMT-07:00 Alexander Graf <[email protected]>:

Quoted 26 lines · Aneesh Kumar K.V
Quoted 24 lines
Quoted 11 lines · Alexander Graf
Quoted 10 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

....

Quoted 8 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines
   ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
   {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+       return vcpu->arch.fault_dar;

How about PA6T and G5s?

Quoted 9 lines
Quoted 5 lines

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

Thanks for looking out for us, obviously IBM doesn't (based on the reply a minute ago).

In the end, since there's been no work to enable KVM on PA6T, I'm not too worried. I guess it's one more thing to sort out (and check for) whenever someone does that.

I definitely don't have cycles to deal with that myself at this time. I can help find hardware for someone who wants to, but even then I'm guessing the interest is pretty limited.

-Olof

#10 lore raw
Quoted 43 lines

Am 05.05.2014 um 16:57 schrieb Olof Johansson <[email protected]>:

[Now without HTML email -- it's what you get for cc:ing me at work instead of my upstream email :)]

2014-05-05 7:43 GMT-07:00 Alexander Graf <[email protected]>:

Quoted 23 lines
Quoted 23 lines · Aneesh Kumar K.V
Quoted 10 lines · Alexander Graf
Quoted 10 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

....

Quoted 6 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines
  ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst)
  {
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+       return vcpu->arch.fault_dar;

How about PA6T and G5s?

Quoted 8 lines
Quoted 5 lines

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

Thanks for looking out for us, obviously IBM doesn't (based on the reply a minute ago).

Quoted 7 lines

In the end, since there's been no work to enable KVM on PA6T, I'm not too worried. I guess it's one more thing to sort out (and check for) whenever someone does that.

I definitely don't have cycles to deal with that myself at this time. I can help find hardware for someone who wants to, but even then I'm guessing the interest is pretty limited.

I know of at least 1 person who successfully runs PR KVM on a PA6T, so it's neither neglected nor non-working.

If you can get me access to a pa6t system I can easily check whether alignment interrupts generate dar and dsisr properly :).

Alex

#11 lore raw
In reply to Olof Johansson

Am 05.05.14 16:57, schrieb Olof Johansson:

Quoted 46 lines

[Now without HTML email -- it's what you get for cc:ing me at work instead of my upstream email :)]

2014-05-05 7:43 GMT-07:00 Alexander Graf <[email protected]>:

Quoted 22 lines · Aneesh Kumar K.V
Quoted 21 lines
Quoted 10 lines · Alexander Graf
Quoted 9 lines · Aneesh Kumar K.V

Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values.

---
Changes from V3:
* Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not

....

Quoted 7 lines

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 4 lines

ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst) {

arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+       return vcpu->arch.fault_dar;

How about PA6T and G5s?

Quoted 8 lines
Quoted 5 lines

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

Thanks for looking out for us, obviously IBM doesn't (based on the reply a minute ago).

In the end, since there's been no work to enable KVM on PA6T, I'm not too worried. I guess it's one more thing to sort out (and check for) whenever someone does that.

I definitely don't have cycles to deal with that myself at this time. I can help find hardware for someone who wants to, but even then I'm guessing the interest is pretty limited.

Quoted 6 lines

-Olof
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Just for info: "PR" KVM works great on my PA6T machine. I booted the Lubuntu 14.04 PowerPC live DVD on a QEMU virtual machine with "PR" KVM successfully. But Mac OS X Jaguar, Panther, and Tiger don't boot with KVM on Mac-on-Linux and QEMU. See http://forum.hyperion-entertainment.biz/viewtopic.php?f=35&t=1747.

-- Christian
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#12 lore raw
In reply to Alexander Graf
Quoted 10 lines · Alexander Graf
Quoted 5 lines

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Yes, and I'm asking whether we know that this statement holds true for PA6T and G5 chips which I wouldn't consider IBM POWER. Since the G5 is at least developed by IBM, I'd assume its semantics here are similar to POWER4, but for PA6T I wouldn't be so sure.

I am not aware of any PowerPC processor that does not set DAR on alignment interrupts. Paul, are you ?

Cheers,
Ben.

#13 lore raw
In reply to Aneesh Kumar K.V
Quoted 6 lines · Aneesh Kumar K.V

Paul mentioned that BOOK3S always had DAR value set on alignment interrupt. And the patch is to enable/collect correct DAR value when running with Little Endian PR guest. Now to limit the impact and to enable Little Endian PR guest, I ended up doing the conditional code only for book3s 64 for which we know for sure that we set DAR value.

Only BookS ? Afaik, the kernel align.c unconditionally uses DAR on every processor type. It's DSISR that may or may not be populated but afaik DAR always is.

Cheers,
Ben.

#14 lore raw
In reply to Alexander Graf
Quoted 5 lines · Alexander Graf

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 2 lines · Aneesh Kumar K.V
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

G5 sets DAR on an alignment interrupt.

As for PA6T, I don't know for sure, but if it doesn't, ordinary alignment interrupts wouldn't be handled properly, since the code in arch/powerpc/kernel/align.c assumes DAR contains the address being accessed on all PowerPC CPUs.

Did PA Semi ever publish a user manual for the PA6T, I wonder?

Paul.

#15 lore raw
Quoted 11 lines · Paul Mackerras
Quoted 4 lines · Alexander Graf

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 2 lines · Aneesh Kumar K.V
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

G5 sets DAR on an alignment interrupt.

As for PA6T, I don't know for sure, but if it doesn't, ordinary alignment interrupts wouldn't be handled properly, since the code in arch/powerpc/kernel/align.c assumes DAR contains the address being accessed on all PowerPC CPUs.

Now that's a good point. If we simply behave like Linux, I'm fine. This definitely deserves a comment on the #ifdef in the code.

Alex

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#16 lore raw
Quoted 8 lines · Alexander Graf
Quoted 7 lines · Paul Mackerras
Quoted 4 lines · Alexander Graf

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 2 lines · Aneesh Kumar K.V
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

G5 sets DAR on an alignment interrupt.

Quoted 8 lines
Quoted 4 lines

As for PA6T, I don't know for sure, but if it doesn't, ordinary alignment interrupts wouldn't be handled properly, since the code in arch/powerpc/kernel/align.c assumes DAR contains the address being accessed on all PowerPC CPUs.

Now that's a good point. If we simply behave like Linux, I'm fine. This definitely deserves a comment on the #ifdef in the code.

Will update and send V5

-aneesh

#17 lore raw
In reply to Alexander Graf
Quoted 8 lines · Alexander Graf
Quoted 7 lines · Paul Mackerras
Quoted 4 lines · Alexander Graf

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 2 lines · Aneesh Kumar K.V
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

G5 sets DAR on an alignment interrupt.

Quoted 7 lines
Quoted 4 lines

As for PA6T, I don't know for sure, but if it doesn't, ordinary alignment interrupts wouldn't be handled properly, since the code in arch/powerpc/kernel/align.c assumes DAR contains the address being accessed on all PowerPC CPUs.

Now that's a good point. If we simply behave like Linux, I'm fine. This definitely deserves a comment on the #ifdef in the code.

How about ?

#ifdef CONFIG_PPC_BOOK3S_64
/*
* Linux always expect a valid dar as per alignment
* interrupt handling code (fix_alignment()). Don't compute the dar
* value here, instead used the saved dar value. Right now we restrict
* this only for BOOK3S-64.
*/
return vcpu->arch.fault_dar;
#else

-aneesh

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#18 lore raw
Quoted 19 lines · Aneesh Kumar K.V
Quoted 6 lines · Alexander Graf
Quoted 5 lines · Paul Mackerras
Quoted 4 lines · Alexander Graf

arch/powerpc/kvm/book3s_emulate.c unprivileged: · line 578

Quoted 2 lines · Aneesh Kumar K.V
arch/powerpc/kvm/book3s_emulate.c +2 -0
+#ifdef CONFIG_PPC_BOOK3S_64
+	return vcpu->arch.fault_dar;

How about PA6T and G5s?

Quoted 8 lines
Quoted 6 lines

G5 sets DAR on an alignment interrupt.

As for PA6T, I don't know for sure, but if it doesn't, ordinary alignment interrupts wouldn't be handled properly, since the code in arch/powerpc/kernel/align.c assumes DAR contains the address being accessed on all PowerPC CPUs.

Now that's a good point. If we simply behave like Linux, I'm fine. This definitely deserves a comment on the #ifdef in the code.

How about ?

Quoted 7 lines

#ifdef CONFIG_PPC_BOOK3S_64
/*
* Linux always expect a valid dar as per alignment
* interrupt handling code (fix_alignment()). Don't compute the dar
* value here, instead used the saved dar value. Right now we restrict
* this only for BOOK3S-64.
*/

/* Linux's fix_alignment() assumes that DAR is valid, so can we */

Alex

Quoted 6 lines
	return vcpu->arch.fault_dar;

#else

-aneesh