Skip to contentSkip to conversation

ppc patch queue 2014-07-08

GIT PULL Applied Alexander Graf 2 participants 10 messages Jul 8, 2014 Kbuild

lore
Share & tools
lore
#1 lore raw

[Qemu-devel] [PULL 4/8] PPC: Fix booke206 TLB with phys addrs > 32bit

In reply to Alexander Graf

We were truncating physical addresses to 32bit when using qemu-system-ppc with a booke206 TLB implementation. This patch fixes that and makes the full address space available.

---
 target-ppc/mmu_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target-ppc/mmu_helper.c +3 -3
index 4d6b1e2..4a34a73 100644
@@ -897,10 +897,10 @@ static hwaddr booke206_tlb_to_page_size(CPUPPCState *env,
 
 /* TLB check function for MAS based SoftTLBs */
 static int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
-                            hwaddr *raddrp,
-                     target_ulong address, uint32_t pid)
+                            hwaddr *raddrp, target_ulong address,
+                            uint32_t pid)
 {
-    target_ulong mask;
+    hwaddr mask;
     uint32_t tlb_pid;
 
     if (!msr_cm) {
Signature · 1 line
1.8.1.4
#2 lore raw

[Qemu-devel] [PULL 3/8] target-ppc: Fix gdbstub for ppc64le-linux-user

In reply to Alexander Graf

From: Richard Henderson <[email protected]>

The bswap that's needed for system mode isn't required for user mode, and in fact breaks debugging.

[agraf: fix apple gdbstub implementation]
---
 target-ppc/gdbstub.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)
target-ppc/gdbstub.c +15 -19
index 694d303..14675f4 100644
@@ -83,16 +83,24 @@ static int ppc_gdb_register_len(int n)
     }
 }
 
-
-static void ppc_gdb_swap_register(uint8_t *mem_buf, int n, int len)
+/* We need to present the registers to gdb in the "current" memory ordering.
+   For user-only mode we get this for free; TARGET_WORDS_BIGENDIAN is set to
+   the proper ordering for the binary, and cannot be changed.
+   For system mode, TARGET_WORDS_BIGENDIAN is always set, and we must check
+   the current mode of the chip to see if we're running in little-endian.  */
+static void maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len)
 {
-    if (len == 4) {
+#ifndef CONFIG_USER_ONLY
+    if (!msr_le) {
+        /* do nothing */
+    } else if (len == 4) {
         bswap32s((uint32_t *)mem_buf);
     } else if (len == 8) {
         bswap64s((uint64_t *)mem_buf);
     } else {
         g_assert_not_reached();
     }
+#endif
 }
 
 /* Old gdb always expects FP registers.  Newer (xml-aware) gdb only
@@ -150,10 +158,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
             break;
         }
     }
-    if (msr_le) {
-        /* If cpu is in LE mode, convert memory contents to LE. */
-        ppc_gdb_swap_register(mem_buf, n, r);
-    }
+    maybe_bswap_register(env, mem_buf, r);
     return r;
 }
 
@@ -209,10 +214,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, uint8_t *mem_buf, int n)
             break;
         }
     }
-    if (msr_le) {
-        /* If cpu is in LE mode, convert memory contents to LE. */
-        ppc_gdb_swap_register(mem_buf, n, r);
-    }
+    maybe_bswap_register(env, mem_buf, r);
     return r;
 }
 
@@ -225,10 +227,7 @@ int ppc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
     if (!r) {
         return r;
     }
-    if (msr_le) {
-        /* If cpu is in LE mode, convert memory contents to LE. */
-        ppc_gdb_swap_register(mem_buf, n, r);
-    }
+    maybe_bswap_register(env, mem_buf, r);
     if (n < 32) {
         /* gprs */
         env->gpr[n] = ldtul_p(mem_buf);
@@ -278,10 +277,7 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uint8_t *mem_buf, int n)
     if (!r) {
         return r;
     }
-    if (msr_le) {
-        /* If cpu is in LE mode, convert memory contents to LE. */
-        ppc_gdb_swap_register(mem_buf, n, r);
-    }
+    maybe_bswap_register(env, mem_buf, r);
     if (n < 32) {
         /* gprs */
         env->gpr[n] = ldq_p(mem_buf);
Signature · 1 line
1.8.1.4
#0 lore raw

Hi Peter,

This is my latest bugfix queue for ppc for the 2.1 release. Please pull.

Alex

The following changes since commit 128f0e66149afb2dfc325dfd183aac345f417763:

Merge remote-tracking branch 'remotes/afaerber/tags/prep-for-2.1' into staging (2014-07-07 19:06:55 +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 0c6ab8c988830d3fe01c4ee88100a95ea95c49fa:

PPC: e500: Actually install u-boot.e500 (2014-07-08 12:10:37 +0200)

----------------------------------------------------------------
Patch queue for ppc - 2014-07-08

A few bug fixes for 2.1:

- Fix e500* TLB emulation with qemu-system-ppc
- Update SLOF to current upstream (good number of bugfixes)
- Make POWER7 / POWER8 PVR match more agnostic (needed in 2.1 for cmdline compat)
- Fix u-boot.e500 install (how did that happen?)
- Fix H_CAS on LE hosts
- ppc64le-linux-user fixes

----------------------------------------------------------------
Alexander Graf (1):
PPC: Fix booke206 TLB with phys addrs > 32bit

Alexey Kardashevskiy (3):
pseries: Update SLOF firmware image to qemu-slof-20140630
target-ppc: Add pvr_match() callback
target-ppc: Remove POWER7+ and POWER8E families

Cole Robinson (1):

      PPC: e500: Actually install u-boot.e500

Laurent Dufour (1):
target-ppc: KVMPPC_H_CAS fix cpu-version endianess

Richard Henderson (2):
target-ppc: Change default cpu for ppc64le-linux-user
target-ppc: Fix gdbstub for ppc64le-linux-user

 Makefile                    |   3 +-
 hw/ppc/spapr.c              |   3 +-
 linux-user/main.c           |   8 +--
 pc-bios/README              |   2 +-
 pc-bios/slof.bin            | Bin 921720 -> 923896 bytes
 roms/SLOF                   |   2 +-
 target-ppc/cpu-models.c     |   5 +-
 target-ppc/cpu-models.h     |   6 +--
 target-ppc/cpu-qom.h        |   2 +-
 target-ppc/gdbstub.c        |  34 ++++++------
 target-ppc/mmu_helper.c     |   6 +--
 target-ppc/translate_init.c | 122 ++++++++++++++------------------------------
 12 files changed, 70 insertions(+), 123 deletions(-)
#3 lore raw

[Qemu-devel] [PULL 7/8] target-ppc: Remove POWER7+ and POWER8E families

From: Alexey Kardashevskiy <[email protected]>

POWER8E is architecturally equal to POWER8 and POWER7+ is equal to POWER7. Also no user space tool makes any difference for CPU node name in the device tree (such as PowerPC,POWER7@0 vs. PowerPC,POWER7+@0). So there is no point in emulating POWER7+ and POWER8E apart from POWER7 and POWER8. Also, the previos patch implemented multiple PVR mask support per CPU class so POWER7 class now covers both POWER7 and POWER7+ CPUs, same is valid for POWER8/8E.

This removes POWER7+ and POWER8E classes. This replaces references to POWER7P/POWER8E families with POWER7/POWER8 families.

---
 target-ppc/cpu-models.c     |  4 +--
 target-ppc/translate_init.c | 73 ++-------------------------------------------
 2 files changed, 4 insertions(+), 73 deletions(-)
target-ppc/cpu-models.c +2 -2
index c9112e9..52ac6ec 100644
@@ -1135,9 +1135,9 @@
 #endif
     POWERPC_DEF("POWER7_v2.3",   CPU_POWERPC_POWER7_v23,             POWER7,
                 "POWER7 v2.3")
-    POWERPC_DEF("POWER7+_v2.1",  CPU_POWERPC_POWER7P_v21,            POWER7P,
+    POWERPC_DEF("POWER7+_v2.1",  CPU_POWERPC_POWER7P_v21,            POWER7,
                 "POWER7+ v2.1")
-    POWERPC_DEF("POWER8E_v1.0",  CPU_POWERPC_POWER8E_v10,            POWER8E,
+    POWERPC_DEF("POWER8E_v1.0",  CPU_POWERPC_POWER8E_v10,            POWER8,
                 "POWER8E v1.0")
     POWERPC_DEF("POWER8_v1.0",   CPU_POWERPC_POWER8_v10,             POWER8,
                 "POWER8 v1.0")
target-ppc/translate_init.c +2 -71

96 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#4 lore raw

[Qemu-devel] [PULL 6/8] target-ppc: Add pvr_match() callback

In reply to Alexander Graf

From: Alexey Kardashevskiy <[email protected]>

So far it was enough to have a base PVR value and mask per CPU family such as POWER7 or POWER8. However there CPUs which are completely architecturally compatible but have different PVRs such as POWER7/POWER7+ and POWER8/POWER8E. For these CPUs, top 16 bits are CPU family and low 16 bits are the version. The families have PVR base values different enough so defining a mask which would cover both (or potentially more) CPUs within the family is not possible.

This adds a pvr_match() callback to PowerPCCPUClass. The default handler simply compares PVR defined in the class.

This implements ppc_pvr_match_power7/ppc_pvr_match_power8 callbacks for POWER7/8 families. These check for POWER7/POWER7+ and POWER8/POWER8E.

This changes ppc_cpu_compare_class_pvr_mask() not to check masks but use the pvr_match() callback.

Since all server CPUs use the same mask, this defines one mask value - CPU_POWERPC_POWER_SERVER_MASK - which is used everywhere now. This removes other mask definitions.

This removes pvr_mask from PowerPCCPUClass as it is not used anymore. This removes pvr initialization for POWER7/8 families as it is not used to find the class, the pvr_match() callback is used instead.

---
 target-ppc/cpu-models.c     |  1 -
 target-ppc/cpu-models.h     |  6 +-----
 target-ppc/cpu-qom.h        |  2 +-
 target-ppc/translate_init.c | 49 ++++++++++++++++++++++++++++++++-------------
 4 files changed, 37 insertions(+), 21 deletions(-)
target-ppc/cpu-models.c +0 -1
index 9a91af9..c9112e9 100644
@@ -44,7 +44,6 @@
         PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);                       \
                                                                             \
         pcc->pvr          = _pvr;                                           \
-        pcc->pvr_mask     = CPU_POWERPC_DEFAULT_MASK;                       \
         pcc->svr          = _svr;                                           \
         dc->desc          = _desc;                                          \
     }                                                                       \
target-ppc/cpu-models.h +1 -5
index c39d03a..290a759 100644
@@ -39,7 +39,6 @@ extern PowerPCCPUAlias ppc_cpu_aliases[];
 /*****************************************************************************/
 /* PVR definitions for most known PowerPC                                    */
 enum {
-    CPU_POWERPC_DEFAULT_MASK       = 0xFFFFFFFF,
     /* PowerPC 401 family */
     /* Generic PowerPC 401 */
 #define CPU_POWERPC_401              CPU_POWERPC_401G2
@@ -553,17 +552,14 @@ enum {
     CPU_POWERPC_POWER6             = 0x003E0000,
     CPU_POWERPC_POWER6_5           = 0x0F000001, /* POWER6 in POWER5 mode */
     CPU_POWERPC_POWER6A            = 0x0F000002,
+    CPU_POWERPC_POWER_SERVER_MASK  = 0xFFFF0000,
     CPU_POWERPC_POWER7_BASE        = 0x003F0000,
-    CPU_POWERPC_POWER7_MASK        = 0xFFFF0000,
     CPU_POWERPC_POWER7_v23         = 0x003F0203,
     CPU_POWERPC_POWER7P_BASE       = 0x004A0000,
-    CPU_POWERPC_POWER7P_MASK       = 0xFFFF0000,
     CPU_POWERPC_POWER7P_v21        = 0x004A0201,
     CPU_POWERPC_POWER8E_BASE       = 0x004B0000,
-    CPU_POWERPC_POWER8E_MASK       = 0xFFFF0000,
     CPU_POWERPC_POWER8E_v10        = 0x004B0100,
     CPU_POWERPC_POWER8_BASE        = 0x004D0000,
-    CPU_POWERPC_POWER8_MASK        = 0xFFFF0000,
     CPU_POWERPC_POWER8_v10         = 0x004D0100,
     CPU_POWERPC_970                = 0x00390202,
     CPU_POWERPC_970FX_v10          = 0x00391100,
target-ppc/cpu-qom.h +1 -1
index f1f0a52..0fee36f 100644
@@ -56,7 +56,7 @@ typedef struct PowerPCCPUClass {
     void (*parent_reset)(CPUState *cpu);
 
     uint32_t pvr;
-    uint32_t pvr_mask;
+    bool (*pvr_match)(struct PowerPCCPUClass *pcc, uint32_t pvr);
     uint64_t pcr_mask;
     uint32_t svr;
     uint64_t insns_flags;
target-ppc/translate_init.c +35 -14

114 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#5 lore raw

[Qemu-devel] [PULL 8/8] PPC: e500: Actually install u-boot.e500

In reply to Alexander Graf

From: Cole Robinson <[email protected]>

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 1eea0c4..d6b9dc1 100644
@@ -344,7 +344,8 @@ multiboot.bin linuxboot.bin kvmvapic.bin \
 s390-zipl.rom \
 s390-ccw.img \
 spapr-rtas.bin slof.bin \
-palcode-clipper
+palcode-clipper \
+u-boot.e500
 else
 BLOBS=
 endif
Signature · 1 line
1.8.1.4
#6 lore raw

[Qemu-devel] [PULL 2/8] target-ppc: Change default cpu for ppc64le-linux-user

In reply to Alexander Graf

From: Richard Henderson <[email protected]>

The default, 970fx, doesn't support MSR_LE. So even though we set LE in ppc_cpu_reset, it gets cleared again in hreg_store_msr. Error out if a user-selected cpu model doesn't support LE.

[agraf: switch to POWER7 as default for BE and LE]
---
 linux-user/main.c           | 8 ++++----
 target-ppc/translate_init.c | 4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)
linux-user/main.c +4 -4
index 900a17f..b453a39 100644
@@ -3901,11 +3901,11 @@ int main(int argc, char **argv, char **envp)
 #elif defined TARGET_OPENRISC
         cpu_model = "or1200";
 #elif defined(TARGET_PPC)
-#ifdef TARGET_PPC64
-        cpu_model = "970fx";
-#else
+# ifdef TARGET_PPC64
+        cpu_model = "POWER7";
+# else
         cpu_model = "750";
-#endif
+# endif
 #else
         cpu_model = "any";
 #endif
target-ppc/translate_init.c +4 -0
index 2ab2810..7b4d9be 100644
@@ -9551,6 +9551,10 @@ static void ppc_cpu_reset(CPUState *s)
 #endif
 #if !defined(TARGET_WORDS_BIGENDIAN)
     msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */
+    if (!((env->msr_mask >> MSR_LE) & 1)) {
+        fprintf(stderr, "Selected CPU does not support little-endian.\n");
+        exit(1);
+    }
 #endif
 #endif
 
Signature · 1 line
1.8.1.4
#7 lore raw

[Qemu-devel] [PULL 1/8] target-ppc: KVMPPC_H_CAS fix cpu-version endianess

In reply to Alexander Graf

From: Laurent Dufour <[email protected]>

During KVMPPC_H_CAS processing, the cpu-version updated value is stored without taking care of the current endianess. As a consequence, the guest may not switch to the right CPU model, leading to unexpected results.

If needed, the value is now converted.

Fixes 6d9412ea8132 ("target-ppc: Implement "compat" CPU option")
---
 hw/ppc/spapr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/ppc/spapr.c +1 -2
index a8ba916..a23c0f0 100644
@@ -160,8 +160,7 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,
     int index = ppc_get_vcpu_dt_id(cpu);
 
     if (cpu->cpu_version) {
-        ret = fdt_setprop(fdt, offset, "cpu-version",
-                          &cpu->cpu_version, sizeof(cpu->cpu_version));
+        ret = fdt_setprop_cell(fdt, offset, "cpu-version", cpu->cpu_version);
         if (ret < 0) {
             return ret;
         }
Signature · 1 line
1.8.1.4
#8 lore raw

[Qemu-devel] [PULL 5/8] pseries: Update SLOF firmware image to qemu-slof-20140630

In reply to Alexander Graf

From: Alexey Kardashevskiy <[email protected]>

The changelog is:

Quoted 8 lines

Quieten the grub warning
Add boot menu support
boot from disk having chrp-boot file
fat16: fix read and remove debug messages dhcparch define missing in compilation
pci-scan: reserve memory for pci-bridge without devices
pci-bridge: Fix ranges when no device beyond the bridge Set dhcp arch in board-qemu config file

Quoted 8 lines

xhci: fix controller stop
dhcp: support client architecture code 93
virtio-blk: support variable block size
usb: use common pci dma alloc/mapping routines Remove unused SLOF code
pci-bridge: generic bridge needs to support pci dma functions
pci: extract dma functions as separate file
e1000: fix usage of multiple nics

---
 pc-bios/README   |   2 +-
 pc-bios/slof.bin | Bin 921720 -> 923896 bytes
 roms/SLOF        |   2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
index 49cdacf..edfadd7 100644
@@ -17,7 +17,7 @@
 - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware
   implementation for certain IBM POWER hardware.  The sources are at
   https://github.com/aik/SLOF, and the image currently in qemu is
-  built from git tag qemu-slof-20140404.
+  built from git tag qemu-slof-20140630.
 
 - sgabios (the Serial Graphics Adapter option ROM) provides a means for
   legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
index 972e012e51ac61a2e31c9793e6c77c6a95925c3b..69b0a5dbc3ab423528dc10817b37fde720ffd0aa 100644
GIT binary patch
roms/SLOF +1 -1
index c90b50b..f284ab3 160000
@@ -1 +1 @@
-Subproject commit c90b50b5055f976a0da3c032f26fb80157292adc
+Subproject commit f284ab3f03ae69a20e1ae966f6ddf76da33cbf72
Signature · 1 line
1.8.1.4
#9 lore raw
In reply to Alexander Graf
Quoted 16 lines · Alexander Graf

Hi Peter,

This is my latest bugfix queue for ppc for the 2.1 release. Please pull.

Alex

The following changes since commit 128f0e66149afb2dfc325dfd183aac345f417763:

Merge remote-tracking branch 'remotes/afaerber/tags/prep-for-2.1' into staging (2014-07-07 19:06:55 +0100)

are available in the git repository at:

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

Quoted 8 lines

for you to fetch changes up to 0c6ab8c988830d3fe01c4ee88100a95ea95c49fa:

PPC: e500: Actually install u-boot.e500 (2014-07-08 12:10:37 +0200)

----------------------------------------------------------------
Patch queue for ppc - 2014-07-08

A few bug fixes for 2.1:

Applied, thanks.

-- PMM