Skip to contentSkip to conversation

ppc patch queue 2015-09-20

GIT PULL Applied Alexander Graf 2 participants 9 messages Sep 20, 2015 – Sep 21, 2015

lore
Share & tools
lore
#0 lore raw

Hi Peter,

This is my current patch queue for ppc. Please pull.

Alex

CC Aurelien Jarno <[email protected]>
CC David Gibson <[email protected]>

The following changes since commit 18640989a9f5e4d2e84b566c52ff1fccfa0dbf4a:

Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging (2015-09-19 15:59:52 +0100)

are available in the git repository at:

git://github.com/agraf/qemu.git tags/signed-ppc-for-upstream

for you to fetch changes up to 8f60f8e2e574f341709128ff7637e685fd640254:

target-ppc: fix xscmpodp and xscmpudp decoding (2015-09-20 22:48:39 +0200)

----------------------------------------------------------------
Patch queue for ppc - 2015-09-20

Highlights this time around:

- e500: Fix u-boot boot with -M virt by updating to new version
- e500: fix ATMU reads
- book3s: Fixes (unaligned exceptions, vector instructions)
- yet another dbdma ide fix

I'm out taking care of my son for the next 2 months. During that time please consider David Gibson the interim ppc queue maintainer. I'm sure Aurelien will be more than happy to help him review patches as well ;-).

----------------------------------------------------------------
Alexander Graf (1):

      PPC: E500: Update u-boot to commit 79c884d7e4

Anton Blanchard (1):
target-ppc: Fix SRR0 when taking unaligned exceptions

Aurelien Jarno (2):
target-ppc: fix vcipher, vcipherlast, vncipherlast and vpermxor
target-ppc: fix xscmpodp and xscmpudp decoding

Mark Cave-Ayland (1):
mac_dbdma: always clear FLUSH bit once DBDMA channel flush is complete

Paolo Bonzini (1):
kvm_ppc: remove kvmppc_timer_hack

Rudolf Marek (1):
PPC: e500 pci host: Fix ATMUs register reads

 hw/misc/macio/mac_dbdma.c |  12 +++++-------
 hw/pci-host/ppce500.c     |   4 ++--
 hw/ppc/e500.c             |   4 ----
 hw/ppc/ppc440_bamboo.c    |   3 ---
 linux-user/main.c         |   2 +-
 pc-bios/u-boot.e500       | Bin 330260 -> 347788 bytes
 target-ppc/Makefile.objs  |   2 +-
 target-ppc/excp_helper.c  |   2 +-
 target-ppc/int_helper.c   |  19 ++++++++++++++-----
 target-ppc/kvm_ppc.c      |  41 -----------------------------------------
 target-ppc/kvm_ppc.h      |   2 --
 target-ppc/translate.c    |  11 +++++++++--
 12 files changed, 33 insertions(+), 69 deletions(-)
 delete mode 100644 target-ppc/kvm_ppc.c
#1 lore raw

[Qemu-devel] [PULL 2/7] mac_dbdma: always clear FLUSH bit once DBDMA channel flush is complete

From: Mark Cave-Ayland <[email protected]>

The code to flush the DBDMA channel was effectively duplicated in dbdma_control_write(), except for the fact that the copy executed outside of a RUN bit transition was broken by not clearing the FLUSH bit once the flush was complete.

Newer PPC Linux kernels would timeout waiting for the FLUSH bit to clear again after submitting a FLUSH command. Fix this by always clearing the FLUSH bit once the channel flush is complete and removing the repeated code.

---
 hw/misc/macio/mac_dbdma.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
hw/misc/macio/mac_dbdma.c +5 -7
index b25e851..779683c 100644
@@ -590,10 +590,11 @@ dbdma_control_write(DBDMA_channel *ch)
     if ((ch->regs[DBDMA_STATUS] & RUN) && !(status & RUN)) {
         /* RUN is cleared */
         status &= ~(ACTIVE|DEAD);
-        if ((status & FLUSH) && ch->flush) {
-            ch->flush(&ch->io);
-            status &= ~FLUSH;
-        }
+    }
+
+    if ((status & FLUSH) && ch->flush) {
+        ch->flush(&ch->io);
+        status &= ~FLUSH;
     }
 
     DBDMA_DPRINTF("    status 0x%08x\n", status);
@@ -603,9 +604,6 @@ dbdma_control_write(DBDMA_channel *ch)
     if (status & ACTIVE) {
         DBDMA_kick(dbdma_from_ch(ch));
     }
-    if ((status & FLUSH) && ch->flush) {
-        ch->flush(&ch->io);
-    }
 }
 
 static void dbdma_write(void *opaque, hwaddr addr,
Signature · 1 line
1.8.1.4
#2 lore raw

[Qemu-devel] [PULL 3/7] PPC: e500 pci host: Fix ATMUs register reads

In reply to Alexander Graf

From: Rudolf Marek <[email protected]>

There is a bug in the register mask when reading the ATMUs registers. As the result some registers cannot be read, and read is aliased to the other registers. Fix it.

---
 hw/pci-host/ppce500.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/ppce500.c +2 -2
index 613ba73..50add34 100644
@@ -140,7 +140,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr,
     case PPCE500_PCI_OW3:
     case PPCE500_PCI_OW4:
         idx = (addr >> 5) & 0x7;
-        switch (addr & 0xC) {
+        switch (addr & 0x1F) {
         case PCI_POTAR:
             value = pci->pob[idx].potar;
             break;
@@ -162,7 +162,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr,
     case PPCE500_PCI_IW2:
     case PPCE500_PCI_IW1:
         idx = ((addr >> 5) & 0x3) - 1;
-        switch (addr & 0xC) {
+        switch (addr & 0x1F) {
         case PCI_PITAR:
             value = pci->pib[idx].pitar;
             break;
Signature · 1 line
1.8.1.4
#3 lore raw

[Qemu-devel] [PULL 4/7] target-ppc: Fix SRR0 when taking unaligned exceptions

In reply to Alexander Graf

From: Anton Blanchard <[email protected]>

We are setting SRR0 to the instruction before the one causing the unaligned exception. A quick testcase:

. = 0x100
.globl _start
_start:

	/* Cause a 0x600 */
	li	3,0x1
	stwcx.	3,0,3

1: b 1b

. = 0x600
1: b 1b

Built into something we can load as a BIOS image:

gcc -mbig -c test.S
ld -EB -Ttext 0x0 -o test test.o
objcopy -O binary test test.bin

Run with:

qemu-system-ppc64 -nographic -bios test.bin

Shows an incorrect SRR0 (points at the li):

SRR0 0000000000000100

With the patch we get the correct SRR0:

SRR0 0000000000000104

---
 linux-user/main.c        | 2 +-
 target-ppc/excp_helper.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
linux-user/main.c +1 -1
index 782037d..25cf875 100644
@@ -1650,7 +1650,7 @@ void cpu_loop(CPUPPCState *env)
             info.si_signo = TARGET_SIGBUS;
             info.si_errno = 0;
             info.si_code = TARGET_BUS_ADRALN;
-            info._sifields._sigfault._addr = env->nip - 4;
+            info._sifields._sigfault._addr = env->nip;
             queue_signal(env, info.si_signo, &info);
             break;
         case POWERPC_EXCP_PROGRAM:  /* Program exception                     */
target-ppc/excp_helper.c +1 -1
index b803475..4250106 100644
@@ -200,7 +200,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
         /* Get rS/rD and rA from faulting opcode */
         env->spr[SPR_DSISR] |= (cpu_ldl_code(env, (env->nip - 4))
                                 & 0x03FF0000) >> 16;
-        goto store_current;
+        goto store_next;
     case POWERPC_EXCP_PROGRAM:   /* Program exception                        */
         switch (env->error_code & ~0xF) {
         case POWERPC_EXCP_FP:
Signature · 1 line
1.8.1.4
#4 lore raw

[Qemu-devel] [PULL 7/7] target-ppc: fix xscmpodp and xscmpudp decoding

In reply to Alexander Graf

From: Aurelien Jarno <[email protected]>

The xscmpodp and xscmpudp instructions only have the AX, BX bits in there encoding, the lowest bit (usually TX) is marked as an invalid bit. We therefore can't decode them with GEN_XX2FORM, which decodes the two lowest bit.

Introduce a new form GEN_XX2FORM, which decodes AX and BX and mark the lowest bit as invalid.

---
 target-ppc/translate.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
target-ppc/translate.c +9 -2
index 84c5cea..c0eed13 100644
@@ -10670,6 +10670,13 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2), \
 GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 2, opc3, 0, PPC_NONE, fl2), \
 GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 3, opc3, 0, PPC_NONE, fl2)
 
+#undef GEN_XX2IFORM
+#define GEN_XX2IFORM(name, opc2, opc3, fl2)                           \
+GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 1, PPC_NONE, fl2), \
+GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 1, PPC_NONE, fl2), \
+GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 2, opc3, 1, PPC_NONE, fl2), \
+GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 3, opc3, 1, PPC_NONE, fl2)
+
 #undef GEN_XX3_RC_FORM
 #define GEN_XX3_RC_FORM(name, opc2, opc3, fl2)                          \
 GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0x00, opc3 | 0x00, 0, PPC_NONE, fl2), \
@@ -10731,8 +10738,8 @@ GEN_XX3FORM(xsnmaddadp, 0x04, 0x14, PPC2_VSX),
 GEN_XX3FORM(xsnmaddmdp, 0x04, 0x15, PPC2_VSX),
 GEN_XX3FORM(xsnmsubadp, 0x04, 0x16, PPC2_VSX),
 GEN_XX3FORM(xsnmsubmdp, 0x04, 0x17, PPC2_VSX),
-GEN_XX2FORM(xscmpodp,  0x0C, 0x05, PPC2_VSX),
-GEN_XX2FORM(xscmpudp,  0x0C, 0x04, PPC2_VSX),
+GEN_XX2IFORM(xscmpodp,  0x0C, 0x05, PPC2_VSX),
+GEN_XX2IFORM(xscmpudp,  0x0C, 0x04, PPC2_VSX),
 GEN_XX3FORM(xsmaxdp, 0x00, 0x14, PPC2_VSX),
 GEN_XX3FORM(xsmindp, 0x00, 0x15, PPC2_VSX),
 GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX),
Signature · 1 line
1.8.1.4
#5 lore raw

[Qemu-devel] [PULL 1/7] kvm_ppc: remove kvmppc_timer_hack

In reply to Alexander Graf

From: Paolo Bonzini <[email protected]>

QEMU does have an I/O thread now, that can be interrupted at any time because the VCPU thread runs outside the iothread mutex.

Therefore, the kvmppc_timer_hack is obsolete. Remove it.

---
 hw/ppc/e500.c            |  4 ----
 hw/ppc/ppc440_bamboo.c   |  3 ---
 target-ppc/Makefile.objs |  2 +-
 target-ppc/kvm_ppc.c     | 41 -----------------------------------------
 target-ppc/kvm_ppc.h     |  2 --
 5 files changed, 1 insertion(+), 51 deletions(-)
 delete mode 100644 target-ppc/kvm_ppc.c
hw/ppc/e500.c +0 -4
index d300846..e968386 100644
@@ -1048,10 +1048,6 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
     boot_info->entry = bios_entry;
     boot_info->dt_base = dt_base;
     boot_info->dt_size = dt_size;
-
-    if (kvm_enabled()) {
-        kvmppc_init();
-    }
 }
 
 static int e500_ccsr_initfn(SysBusDevice *dev)
hw/ppc/ppc440_bamboo.c +0 -3
index 4726832..ada676c 100644
@@ -288,9 +288,6 @@ static void bamboo_init(MachineState *machine)
             exit(1);
         }
     }
-
-    if (kvm_enabled())
-        kvmppc_init();
 }
 
 static void bamboo_machine_init(MachineClass *mc)
target-ppc/Makefile.objs +1 -1
index 47a3e98..e667e69 100644
@@ -4,7 +4,7 @@ ifeq ($(CONFIG_SOFTMMU),y)
 obj-y += machine.o mmu_helper.o mmu-hash32.o monitor.o
 obj-$(TARGET_PPC64) += mmu-hash64.o arch_dump.o
 endif
-obj-$(CONFIG_KVM) += kvm.o kvm_ppc.o
+obj-$(CONFIG_KVM) += kvm.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
 obj-y += dfp_helper.o
 obj-y += excp_helper.o
target-ppc/kvm_ppc.c deleted +0 -41

41 lines not on this page · raw message

target-ppc/kvm_ppc.h +0 -2
index 4d30e27..5c1d334 100644
@@ -11,8 +11,6 @@
 
 #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
 
-void kvmppc_init(void);
-
 #ifdef CONFIG_KVM
 
 uint32_t kvmppc_get_tbfreq(void);
Signature · 1 line
1.8.1.4
#6 lore raw

[Qemu-devel] [PULL 6/7] target-ppc: fix vcipher, vcipherlast, vncipherlast and vpermxor

In reply to Alexander Graf

From: Aurelien Jarno <[email protected]>

For vector instructions, the helpers get pointers to the vector register in arguments. Some operands might point to the same register, including the operand holding the result.

When emulating instructions which access the vector elements in a non-linear way, we need to store the result in an temporary variable.

This fixes openssl when emulating a POWER8 CPU.

---
 target-ppc/int_helper.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
target-ppc/int_helper.c +14 -5
index 0a55d5e..b122868 100644
@@ -2327,24 +2327,28 @@ void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a)
 
 void helper_vcipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
 {
+    ppc_avr_t result;
     int i;
 
     VECTOR_FOR_INORDER_I(i, u32) {
-        r->AVRW(i) = b->AVRW(i) ^
+        result.AVRW(i) = b->AVRW(i) ^
             (AES_Te0[a->AVRB(AES_shifts[4*i + 0])] ^
              AES_Te1[a->AVRB(AES_shifts[4*i + 1])] ^
              AES_Te2[a->AVRB(AES_shifts[4*i + 2])] ^
              AES_Te3[a->AVRB(AES_shifts[4*i + 3])]);
     }
+    *r = result;
 }
 
 void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
 {
+    ppc_avr_t result;
     int i;
 
     VECTOR_FOR_INORDER_I(i, u8) {
-        r->AVRB(i) = b->AVRB(i) ^ (AES_sbox[a->AVRB(AES_shifts[i])]);
+        result.AVRB(i) = b->AVRB(i) ^ (AES_sbox[a->AVRB(AES_shifts[i])]);
     }
+    *r = result;
 }
 
 void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
@@ -2369,11 +2373,13 @@ void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
 
 void helper_vncipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
 {
+    ppc_avr_t result;
     int i;
 
     VECTOR_FOR_INORDER_I(i, u8) {
-        r->AVRB(i) = b->AVRB(i) ^ (AES_isbox[a->AVRB(AES_ishifts[i])]);
+        result.AVRB(i) = b->AVRB(i) ^ (AES_isbox[a->AVRB(AES_ishifts[i])]);
     }
+    *r = result;
 }
 
 #define ROTRu32(v, n) (((v) >> (n)) | ((v) << (32-n)))
@@ -2460,16 +2466,19 @@ void helper_vshasigmad(ppc_avr_t *r,  ppc_avr_t *a, uint32_t st_six)
 
 void helper_vpermxor(ppc_avr_t *r,  ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
 {
+    ppc_avr_t result;
     int i;
+
     VECTOR_FOR_INORDER_I(i, u8) {
         int indexA = c->u8[i] >> 4;
         int indexB = c->u8[i] & 0xF;
 #if defined(HOST_WORDS_BIGENDIAN)
-        r->u8[i] = a->u8[indexA] ^ b->u8[indexB];
+        result.u8[i] = a->u8[indexA] ^ b->u8[indexB];
 #else
-        r->u8[i] = a->u8[15-indexA] ^ b->u8[15-indexB];
+        result.u8[i] = a->u8[15-indexA] ^ b->u8[15-indexB];
 #endif
     }
+    *r = result;
 }
 
 #undef VECTOR_FOR_INORDER_I
Signature · 1 line
1.8.1.4
#7 lore raw

[Qemu-devel] [PULL 5/7] PPC: E500: Update u-boot to commit 79c884d7e4

In reply to Alexander Graf

The current U-Boot binary in QEMU has a bug where it fails to support dynamic CCSR addressing. Without this support, u-boot can not boot the ppce500 machine anymore. This has been fixed upstream in u-boot commit e834975b.

Update the u-boot blob we carry in QEMU to the latest u-boot upstream, so that we can successfully run u-boot with the ppce500 machine again.

---
 pc-bios/u-boot.e500 | Bin 330260 -> 347788 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/u-boot.e500 binary +0 -0
index bdb2a5e6f7cb6775d8d7de65fafcef54c4a03967..6e547de6f9bb393588ec2a1bb38f0ae1061938bb 100755
GIT binary patch
Signature · 1 line
1.8.1.4
#8 lore raw
In reply to Alexander Graf
Quoted 27 lines · Alexander Graf

Hi Peter,

This is my current patch queue for ppc. Please pull.

Alex

CC Aurelien Jarno <[email protected]>
CC David Gibson <[email protected]>

The following changes since commit 18640989a9f5e4d2e84b566c52ff1fccfa0dbf4a:

Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging (2015-09-19 15:59:52 +0100)

are available in the git repository at:

git://github.com/agraf/qemu.git tags/signed-ppc-for-upstream

for you to fetch changes up to 8f60f8e2e574f341709128ff7637e685fd640254:

target-ppc: fix xscmpodp and xscmpudp decoding (2015-09-20 22:48:39 +0200)

----------------------------------------------------------------
Patch queue for ppc - 2015-09-20

Highlights this time around:

Quoted 9 lines

- e500: Fix u-boot boot with -M virt by updating to new version
- e500: fix ATMU reads
- book3s: Fixes (unaligned exceptions, vector instructions)
- yet another dbdma ide fix

I'm out taking care of my son for the next 2 months. During that time please consider David Gibson the interim ppc queue maintainer. I'm sure Aurelien will be more than happy to help him review patches as well ;-).

Applied, thanks. Have a good paternity leave...

-- PMM