Skip to contentSkip to conversation

ppc-for-2.11 queue 20170915

GIT PULL Applied David Gibson 3 participants 22 messages Sep 15, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit 3dabde1128b671f36ac6cb36b97b273139964420:

Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging (2017-09-14 16:33:02 +0100)

are available in the git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-2.11-20170915

for you to fetch changes up to 70a0c19e83aa4c71c879d51e426e89e4b3d4e014:

ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr() (2017-09-15 10:29:48 +1000)

----------------------------------------------------------------
ppc patch queue 2017-09-15

Here's the current batch of accumulated ppc patches. These are all pretty simple bugfixes or cleanups, no big new features here.

----------------------------------------------------------------
Alexey Kardashevskiy (1):
vfio, spapr: Fix levels calculation

Benjamin Herrenschmidt (1):
net: Add SunGEM device emulation as found on Apple UniNorth

Cédric Le Goater (2):
ppc/xive: fix OV5_XIVE_EXPLOIT bits
spapr: fix CAS-generated reset

Daniel Henrique Barboza (1):
hw/ppc/spapr.c: cleaning up qdev_get_machine() calls

Greg Kurz (13):
spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()
spapr_pci: drop useless check in spapr_populate_pci_child_dt()
spapr_pci: use g_strdup_printf()
spapr: only update SDR1 once per-cpu during CAS
spapr_pci: use the common _FDT() helper
spapr_pci: handle FDT creation errors with _FDT()
xics: fix several error leaks
spapr_cpu_core: fail gracefully with non-pseries machine types
spapr_pci: convert sprintf() to g_strdup_printf()
spapr_pci: don't create 64-bit MMIO window if we don't need to
spapr_cpu_core: cleaning up qdev_get_machine() calls
spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events() ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()

 default-configs/ppc-softmmu.mak |    1 +
 hw/intc/xics.c                  |   12 +-
 hw/net/Makefile.objs            |    1 +
 hw/net/sungem.c                 | 1447 +++++++++++++++++++++++++++++++++++++++
 hw/net/trace-events             |   44 ++
 hw/pci/pci.c                    |    2 +
 hw/ppc/spapr.c                  |   21 +-
 hw/ppc/spapr_cpu_core.c         |   11 +-
 hw/ppc/spapr_events.c           |    4 +-
 hw/ppc/spapr_hcall.c            |   21 +-
 hw/ppc/spapr_pci.c              |  106 ++-
 hw/vfio/spapr.c                 |    2 +-
 include/hw/pci/pci_ids.h        |    1 +
 include/hw/ppc/spapr_ovec.h     |    3 +-
 target/ppc/kvm.c                |    2 +-
 15 files changed, 1580 insertions(+), 98 deletions(-)
 create mode 100644 hw/net/sungem.c
#1 lore raw

[Qemu-devel] [PULL 03/18] spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()

From: Greg Kurz <[email protected]>

g_strdup_printf() either returns a non-null pointer, or aborts if it failed to allocate memory.

[dwg: Grammatical fix to commit message]
---
 hw/ppc/spapr_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/spapr_pci.c +2 -2
index d7880f257a..ef982f2ef3 100644
@@ -766,7 +766,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev)
     /* Construct the path of the file that will give us the DT location */
     path = g_strdup_printf("/sys/bus/pci/devices/%s/devspec", host);
     g_free(host);
-    if (!path || !g_file_get_contents(path, &buf, NULL, NULL)) {
+    if (!g_file_get_contents(path, &buf, NULL, NULL)) {
         goto err_out;
     }
     g_free(path);
@@ -774,7 +774,7 @@ static char *spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev)
     /* Construct and read from host device tree the loc-code */
     path = g_strdup_printf("/proc/device-tree%s/ibm,loc-code", buf);
     g_free(buf);
-    if (!path || !g_file_get_contents(path, &buf, NULL, NULL)) {
+    if (!g_file_get_contents(path, &buf, NULL, NULL)) {
         goto err_out;
     }
     return buf;
Signature · 1 line
2.13.5
#2 lore raw

[Qemu-devel] [PULL 09/18] spapr_pci: use the common _FDT() helper

In reply to David Gibson

From: Greg Kurz <[email protected]>

All other users in hw/ppc already consider an error when building the FDT to be fatal, even on hotplug paths. There's no valid reason for spapr_pci to behave differently. So let's used the common _FDT() helper which terminates QEMU when libfdt fails.

---
 hw/ppc/spapr_pci.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
hw/ppc/spapr_pci.c +1 -9
index 6da73fe6bc..abb9f05e7b 100644
@@ -40,7 +40,7 @@
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "qapi/qmp/qerror.h"
-
+#include "hw/ppc/fdt.h"
 #include "hw/pci/pci_bridge.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_ids.h"
@@ -61,14 +61,6 @@
 #define RTAS_TYPE_MSI           1
 #define RTAS_TYPE_MSIX          2
 
-#define _FDT(exp) \
-    do { \
-        int ret = (exp);                                           \
-        if (ret < 0) {                                             \
-            return ret;                                            \
-        }                                                          \
-    } while (0)
-
 sPAPRPHBState *spapr_pci_find_phb(sPAPRMachineState *spapr, uint64_t buid)
 {
     sPAPRPHBState *sphb;
Signature · 1 line
2.13.5
#3 lore raw

[Qemu-devel] [PULL 11/18] vfio, spapr: Fix levels calculation

In reply to David Gibson

From: Alexey Kardashevskiy <[email protected]>

The existing tries to round up the number of pages but @pages is always calculated as the rounded up value minus one which makes ctz64() always return 0 and have create.levels always set 1.

This removes wrong "-1" and allows having more than 1 levels. This becomes handy for >128GB guests with standard 64K pages as this requires blocks with zone order 9 and the popular limit of CONFIG_FORCE_MAX_ZONEORDER=9 means that only blocks up to order 8 are allowed.

---
 hw/vfio/spapr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/spapr.c +1 -1
index 32fd6a9b54..259397c002 100644
@@ -163,7 +163,7 @@ int vfio_spapr_create_window(VFIOContainer *container,
      */
     entries = create.window_size >> create.page_shift;
     pages = MAX((entries * sizeof(uint64_t)) / getpagesize(), 1);
-    pages = MAX(pow2ceil(pages) - 1, 1); /* Round up */
+    pages = MAX(pow2ceil(pages), 1); /* Round up */
     create.levels = ctz64(pages) / 6 + 1;
 
     ret = ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_CREATE, &create);
Signature · 1 line
2.13.5
#4 lore raw

[Qemu-devel] [PULL 15/18] spapr_pci: don't create 64-bit MMIO window if we don't need to

In reply to David Gibson

From: Greg Kurz <[email protected]>

When running a pseries-2.2 or older machine type, we get the following lines in info mtree:

address-space: memory
...
ffffffffffffffff-ffffffffffffffff (prio 0, i/o): alias
[email protected] @[email protected]
ffffffffffffffff-ffffffffffffffff

address-space: cpu-memory
...
ffffffffffffffff-ffffffffffffffff (prio 0, i/o): alias
[email protected] @[email protected]
ffffffffffffffff-ffffffffffffffff

The same thing occurs when running a pseries-2.7 with

    -global spapr-pci-host-bridge.mem_win_size=2147483648

This happens because we always create a 64-bit MMIO window, even if we didn't explicitely requested it (ie, mem64_win_size == 0) and the 32-bit window is below 2GiB. It doesn't seem to have an impact on the guest though because spapr_populate_pci_dt() doesn't advertise the bogus windows when mem64_win_size == 0.

Since these memory regions don't induce any state, we can safely choose to not create them when their address is equal to -1, without breaking migration from existing setups.

---
 hw/ppc/spapr_pci.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
hw/ppc/spapr_pci.c +13 -7
index 7d84b9766e..cf54160526 100644
@@ -1622,13 +1622,19 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
     memory_region_add_subregion(get_system_memory(), sphb->mem_win_addr,
                                 &sphb->mem32window);
 
-    namebuf = g_strdup_printf("%s.mmio64-alias", sphb->dtbusname);
-    memory_region_init_alias(&sphb->mem64window, OBJECT(sphb),
-                             namebuf, &sphb->memspace,
-                             sphb->mem64_win_pciaddr, sphb->mem64_win_size);
-    g_free(namebuf);
-    memory_region_add_subregion(get_system_memory(), sphb->mem64_win_addr,
-                                &sphb->mem64window);
+    if (sphb->mem64_win_pciaddr != (hwaddr)-1) {
+        namebuf = g_strdup_printf("%s.mmio64-alias", sphb->dtbusname);
+        memory_region_init_alias(&sphb->mem64window, OBJECT(sphb),
+                                 namebuf, &sphb->memspace,
+                                 sphb->mem64_win_pciaddr, sphb->mem64_win_size);
+        g_free(namebuf);
+
+        if (sphb->mem64_win_addr != (hwaddr)-1) {
+            memory_region_add_subregion(get_system_memory(),
+                                        sphb->mem64_win_addr,
+                                        &sphb->mem64window);
+        }
+    }
 
     /* Initialize IO regions */
     namebuf = g_strdup_printf("%s.io", sphb->dtbusname);
Signature · 1 line
2.13.5
#5 lore raw

[Qemu-devel] [PULL 02/18] hw/ppc/spapr.c: cleaning up qdev_get_machine() calls

In reply to David Gibson

From: Daniel Henrique Barboza <[email protected]>

This patch removes the qdev_get_machine() calls that are made in spapr.c in situations where we can get an existing pointer for the MachineState by either passing it as an argument to the function or by using other already available pointers.

The following changes were made:

- spapr_node0_size: static function that is called two times:
at spapr_setup_hpt_and_vrma and ppc_spapr_init. In both cases we can pass an existing MachineState pointer to it.

- spapr_build_fdt: MachineState pointer can be retrieved from the existing sPAPRMachineState pointer.

- spapr_boot_set: the opaque in the first arg is a sPAPRMachineState pointer as we can see inside ppc_spapr_init:

    qemu_register_boot_set(spapr_boot_set, spapr);

We can get a MachineState pointer from it.

- spapr_machine_device_plug and spapr_machine_device_unplug_request: the MachineState, sPAPRMachineState, MachineClass and sPAPRMachineClass pointers can all be retrieved from the HotplugHandler pointer.

---
 hw/ppc/spapr.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
hw/ppc/spapr.c +9 -10
index caffa12763..06a008b43c 100644
@@ -391,10 +391,8 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineState *spapr)
     return ret;
 }
 
-static hwaddr spapr_node0_size(void)
+static hwaddr spapr_node0_size(MachineState *machine)
 {
-    MachineState *machine = MACHINE(qdev_get_machine());
-
     if (nb_numa_nodes) {
         int i;
         for (i = 0; i < nb_numa_nodes; ++i) {
@@ -1052,7 +1050,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
                              hwaddr rtas_addr,
                              hwaddr rtas_size)
 {
-    MachineState *machine = MACHINE(qdev_get_machine());
+    MachineState *machine = MACHINE(spapr);
     MachineClass *mc = MACHINE_GET_CLASS(machine);
     sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
     int ret;
@@ -1372,7 +1370,7 @@ void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr)
     spapr_reallocate_hpt(spapr, hpt_shift, &error_fatal);
 
     if (spapr->vrma_adjust) {
-        spapr->rma_size = kvmppc_rma_size(spapr_node0_size(),
+        spapr->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(spapr)),
                                           spapr->htab_shift);
     }
     /* We're setting up a hash table, so that means we're not radix */
@@ -2033,7 +2031,7 @@ static SaveVMHandlers savevm_htab_handlers = {
 static void spapr_boot_set(void *opaque, const char *boot_device,
                            Error **errp)
 {
-    MachineState *machine = MACHINE(qdev_get_machine());
+    MachineState *machine = MACHINE(opaque);
     machine->boot_order = g_strdup(boot_device);
 }
 
@@ -2235,7 +2233,7 @@ static void ppc_spapr_init(MachineState *machine)
     MemoryRegion *rma_region;
     void *rma = NULL;
     hwaddr rma_alloc_size;
-    hwaddr node0_size = spapr_node0_size();
+    hwaddr node0_size = spapr_node0_size(machine);
     long load_limit, fw_size;
     char *filename;
     Error *resize_hpt_err = NULL;
@@ -3298,7 +3296,8 @@ out:
 static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,
                                       DeviceState *dev, Error **errp)
 {
-    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
+    MachineState *ms = MACHINE(hotplug_dev);
+    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(ms);
 
     if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         int node;
@@ -3347,8 +3346,8 @@ static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,
 static void spapr_machine_device_unplug_request(HotplugHandler *hotplug_dev,
                                                 DeviceState *dev, Error **errp)
 {
-    sPAPRMachineState *sms = SPAPR_MACHINE(qdev_get_machine());
-    MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+    sPAPRMachineState *sms = SPAPR_MACHINE(OBJECT(hotplug_dev));
+    MachineClass *mc = MACHINE_GET_CLASS(sms);
 
     if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         if (spapr_ovec_test(sms->ov5_cas, OV5_HP_EVT)) {
Signature · 1 line
2.13.5
#6 lore raw

[Qemu-devel] [PULL 04/18] spapr_pci: drop useless check in spapr_populate_pci_child_dt()

In reply to David Gibson

From: Greg Kurz <[email protected]>

spapr_phb_get_loc_code() either returns a non-null pointer, or aborts if g_strdup_printf() failed to allocate memory.

[dwg: Grammatical fix to commit message]
---
 hw/ppc/spapr_pci.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
hw/ppc/spapr_pci.c +1 -5
index ef982f2ef3..cd8efb1812 100644
@@ -1282,12 +1282,8 @@ static int spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset,
                             pci_find_device_name((ccode >> 16) & 0xff,
                                                  (ccode >> 8) & 0xff,
                                                  ccode & 0xff)));
-    buf = spapr_phb_get_loc_code(sphb, dev);
-    if (!buf) {
-        error_report("Failed setting the ibm,loc-code");
-        return -1;
-    }
 
+    buf = spapr_phb_get_loc_code(sphb, dev);
     err = fdt_setprop_string(fdt, offset, "ibm,loc-code", buf);
     g_free(buf);
     if (err < 0) {
Signature · 1 line
2.13.5
#7 lore raw

[Qemu-devel] [PULL 05/18] spapr_pci: use g_strdup_printf()

In reply to David Gibson

From: Greg Kurz <[email protected]>

Building strings with g_strdup_printf() instead of snprintf() is a QEMU common practice.

---
 hw/ppc/spapr_pci.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
hw/ppc/spapr_pci.c +10 -9
index cd8efb1812..6da73fe6bc 100644
@@ -61,8 +61,6 @@
 #define RTAS_TYPE_MSI           1
 #define RTAS_TYPE_MSIX          2
 
-#define FDT_NAME_MAX          128
-
 #define _FDT(exp) \
     do { \
         int ret = (exp);                                           \
@@ -1194,7 +1192,7 @@ static const char *pci_find_device_name(uint8_t class, uint8_t subclass,
     return name;
 }
 
-static void pci_get_node_name(char *nodename, int len, PCIDevice *dev)
+static gchar *pci_get_node_name(PCIDevice *dev)
 {
     int slot = PCI_SLOT(dev->devfn);
     int func = PCI_FUNC(dev->devfn);
@@ -1205,9 +1203,9 @@ static void pci_get_node_name(char *nodename, int len, PCIDevice *dev)
                                 ccode & 0xff);
 
     if (func != 0) {
-        snprintf(nodename, len, "%s@%x,%x", name, slot, func);
+        return g_strdup_printf("%s@%x,%x", name, slot, func);
     } else {
-        snprintf(nodename, len, "%s@%x", name, slot);
+        return g_strdup_printf("%s@%x", name, slot);
     }
 }
 
@@ -1325,10 +1323,12 @@ static int spapr_create_pci_child_dt(sPAPRPHBState *phb, PCIDevice *dev,
                                      void *fdt, int node_offset)
 {
     int offset, ret;
-    char nodename[FDT_NAME_MAX];
+    gchar *nodename;
 
-    pci_get_node_name(nodename, FDT_NAME_MAX, dev);
+    nodename = pci_get_node_name(dev);
     offset = fdt_add_subnode(fdt, node_offset, nodename);
+    g_free(nodename);
+
     ret = spapr_populate_pci_child_dt(dev, fdt, offset, phb);
 
     g_assert(!ret);
@@ -2072,7 +2072,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
                           void *fdt)
 {
     int bus_off, i, j, ret;
-    char nodename[FDT_NAME_MAX];
+    gchar *nodename;
     uint32_t bus_range[] = { cpu_to_be32(0), cpu_to_be32(0xff) };
     struct {
         uint32_t hi;
@@ -2121,8 +2121,9 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
     sPAPRFDT s_fdt;
 
     /* Start populating the FDT */
-    snprintf(nodename, FDT_NAME_MAX, "pci@%" PRIx64, phb->buid);
+    nodename = g_strdup_printf("pci@%" PRIx64, phb->buid);
     bus_off = fdt_add_subnode(fdt, 0, nodename);
+    g_free(nodename);
     if (bus_off < 0) {
         return bus_off;
     }
Signature · 1 line
2.13.5
#8 lore raw

[Qemu-devel] [PULL 06/18] spapr: only update SDR1 once per-cpu during CAS

In reply to David Gibson

From: Greg Kurz <[email protected]>

Commit b55d295e3ec9 added the possibility to support HPT resizing with KVM. In the case of PR, we need to pass the userspace address of the HPT to KVM using the SDR1 slot.
This is handled by kvmppc_update_sdr1() which uses CPU_FOREACH() to update all CPUs. It is hence not needed to call kvmppc_update_sdr1() for each CPU.

---
 hw/ppc/spapr_hcall.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
hw/ppc/spapr_hcall.c +5 -9
index 8b3c0e17e7..6ab8c188f3 100644
@@ -1559,20 +1559,16 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
         }
 
         if (spapr->htab_shift < maxshift) {
-            CPUState *cs;
-
             /* Guest doesn't know about HPT resizing, so we
              * pre-emptively resize for the maximum permitted RAM.  At
              * the point this is called, nothing should have been
              * entered into the existing HPT */
             spapr_reallocate_hpt(spapr, maxshift, &error_fatal);
-            CPU_FOREACH(cs) {
-                if (kvm_enabled()) {
-                    /* For KVM PR, update the HPT pointer */
-                    target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab
-                        | (spapr->htab_shift - 18);
-                    kvmppc_update_sdr1(sdr1);
-                }
+            if (kvm_enabled()) {
+                /* For KVM PR, update the HPT pointer */
+                target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab
+                    | (spapr->htab_shift - 18);
+                kvmppc_update_sdr1(sdr1);
             }
         }
     }
Signature · 1 line
2.13.5
#9 lore raw

[Qemu-devel] [PULL 07/18] ppc/xive: fix OV5_XIVE_EXPLOIT bits

In reply to David Gibson

From: Cédric Le Goater <[email protected]>

On POWER9, the Client Architecture Support (CAS) negotiation process determines whether the guest operates in XIVE Legacy compatibility or in XIVE exploitation mode. Now that we have initial guest support for the XIVE interrupt controller, let's fix the bits definition which have evolved in the latest specs.

The platform advertises the XIVE Exploitation Mode support using the property "ibm,arch-vec-5-platform-support-vec-5", byte 23 bits 0-1 :

- 0b00 XIVE legacy mode Only
- 0b01 XIVE exploitation mode Only
- 0b10 XIVE legacy or exploitation mode

The OS asks for XIVE Exploitation Mode support using the property "ibm,architecture-vec-5", byte 23 bits 0-1:

- 0b00 XIVE legacy mode Only
- 0b01 XIVE exploitation mode Only

---
 hw/ppc/spapr.c              | 2 +-
 include/hw/ppc/spapr_ovec.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +1 -1
index 06a008b43c..f680f28a15 100644
@@ -937,7 +937,7 @@ static void spapr_dt_ov5_platform_support(void *fdt, int chosen)
     PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu);
 
     char val[2 * 4] = {
-        23, 0x00, /* Xive mode: 0 = legacy (as in ISA 2.7), 1 = Exploitation */
+        23, 0x00, /* Xive mode, filled in below. */
         24, 0x00, /* Hash/Radix, filled in below. */
         25, 0x00, /* Hash options: Segment Tables == no, GTSE == no. */
         26, 0x40, /* Radix options: GTSE == yes. */
include/hw/ppc/spapr_ovec.h +2 -1
index 9edfa5ff75..bf25e5d954 100644
@@ -51,7 +51,8 @@ typedef struct sPAPROptionVector sPAPROptionVector;
 #define OV5_FORM1_AFFINITY      OV_BIT(5, 0)
 #define OV5_HP_EVT              OV_BIT(6, 5)
 #define OV5_HPT_RESIZE          OV_BIT(6, 7)
-#define OV5_XIVE_EXPLOIT        OV_BIT(23, 7)
+#define OV5_XIVE_BOTH           OV_BIT(23, 0)
+#define OV5_XIVE_EXPLOIT        OV_BIT(23, 1) /* 1=exploitation 0=legacy */
 
 /* ISA 3.00 MMU features: */
 #define OV5_MMU_BOTH            OV_BIT(24, 0) /* Radix and hash */
Signature · 1 line
2.13.5
#10 lore raw

[Qemu-devel] [PULL 08/18] spapr: fix CAS-generated reset

In reply to David Gibson

From: Cédric Le Goater <[email protected]>

The OV5_MMU_RADIX_300 requires special handling in the CAS negotiation process. It is cleared from the option vector of the guest before evaluating the changes and re-added later. But, when testing for a possible CAS reset :

    spapr->cas_reboot = spapr_ovec_diff(ov5_updates,
                                        ov5_cas_old, spapr->ov5_cas);

the bit OV5_MMU_RADIX_300 will each time be seen as removed from the previous OV5 set, hence generating a reset loop.

Fix this problem by also clearing the same bit in the ov5_cas_old set.

---
 hw/ppc/spapr_hcall.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/ppc/spapr_hcall.c +7 -0
index 6ab8c188f3..57bb411394 100644
@@ -1581,6 +1581,13 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
      * to worry about this for now.
      */
     ov5_cas_old = spapr_ovec_clone(spapr->ov5_cas);
+
+    /* also clear the radix/hash bit from the current ov5_cas bits to
+     * be in sync with the newly ov5 bits. Else the radix bit will be
+     * seen as being removed and this will generate a reset loop
+     */
+    spapr_ovec_clear(ov5_cas_old, OV5_MMU_RADIX_300);
+
     /* full range of negotiated ov5 capabilities */
     spapr_ovec_intersect(spapr->ov5_cas, spapr->ov5, ov5_guest);
     spapr_ovec_cleanup(ov5_guest);
Signature · 1 line
2.13.5
#11 lore raw

[Qemu-devel] [PULL 10/18] spapr_pci: handle FDT creation errors with _FDT()

In reply to David Gibson

From: Greg Kurz <[email protected]>

libfdt failures when creating the FDT should cause QEMU to terminate.

Let's use the _FDT() macro which does just that instead of propagating the error to the caller. spapr_populate_pci_child_dt() no longer needs to return a value in this case.

Note that, on the way, this get rids of the following nonsensical lines:

    g_assert(!ret);
    if (ret) {
---
 hw/ppc/spapr_pci.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)
hw/ppc/spapr_pci.c +7 -23
index abb9f05e7b..75cd939223 100644
@@ -1204,12 +1204,12 @@ static gchar *pci_get_node_name(PCIDevice *dev)
 static uint32_t spapr_phb_get_pci_drc_index(sPAPRPHBState *phb,
                                             PCIDevice *pdev);
 
-static int spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset,
+static void spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset,
                                        sPAPRPHBState *sphb)
 {
     ResourceProps rp;
     bool is_bridge = false;
-    int pci_status, err;
+    int pci_status;
     char *buf = NULL;
     uint32_t drc_index = spapr_phb_get_pci_drc_index(sphb, dev);
     uint32_t ccode = pci_default_read_config(dev, PCI_CLASS_PROG, 3);
@@ -1274,11 +1274,8 @@ static int spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset,
                                                  ccode & 0xff)));
 
     buf = spapr_phb_get_loc_code(sphb, dev);
-    err = fdt_setprop_string(fdt, offset, "ibm,loc-code", buf);
+    _FDT(fdt_setprop_string(fdt, offset, "ibm,loc-code", buf));
     g_free(buf);
-    if (err < 0) {
-        return err;
-    }
 
     if (drc_index) {
         _FDT(fdt_setprop_cell(fdt, offset, "ibm,my-drc-index", drc_index));
@@ -1306,27 +1303,21 @@ static int spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset,
     if (sphb->pcie_ecs && pci_is_express(dev)) {
         _FDT(fdt_setprop_cell(fdt, offset, "ibm,pci-config-space-type", 0x1));
     }
-
-    return 0;
 }
 
 /* create OF node for pci device and required OF DT properties */
 static int spapr_create_pci_child_dt(sPAPRPHBState *phb, PCIDevice *dev,
                                      void *fdt, int node_offset)
 {
-    int offset, ret;
+    int offset;
     gchar *nodename;
 
     nodename = pci_get_node_name(dev);
-    offset = fdt_add_subnode(fdt, node_offset, nodename);
+    _FDT(offset = fdt_add_subnode(fdt, node_offset, nodename));
     g_free(nodename);
 
-    ret = spapr_populate_pci_child_dt(dev, fdt, offset, phb);
+    spapr_populate_pci_child_dt(dev, fdt, offset, phb);
 
-    g_assert(!ret);
-    if (ret) {
-        return 0;
-    }
     return offset;
 }
 
@@ -1416,10 +1407,6 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,
 
     fdt = create_device_tree(&fdt_size);
     fdt_start_offset = spapr_create_pci_child_dt(phb, pdev, fdt, 0);
-    if (!fdt_start_offset) {
-        error_setg(&local_err, "Failed to create pci child device tree node");
-        goto out;
-    }
 
     spapr_drc_attach(drc, DEVICE(pdev), fdt, fdt_start_offset, &local_err);
     if (local_err) {
@@ -2114,11 +2101,8 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
 
     /* Start populating the FDT */
     nodename = g_strdup_printf("pci@%" PRIx64, phb->buid);
-    bus_off = fdt_add_subnode(fdt, 0, nodename);
+    _FDT(bus_off = fdt_add_subnode(fdt, 0, nodename));
     g_free(nodename);
-    if (bus_off < 0) {
-        return bus_off;
-    }
 
     /* Write PHB properties */
     _FDT(fdt_setprop_string(fdt, bus_off, "device_type", "pci"));
Signature · 1 line
2.13.5
#12 lore raw

[Qemu-devel] [PULL 12/18] xics: fix several error leaks

In reply to David Gibson

From: Greg Kurz <[email protected]>

If object_property_get_link() fails then it allocates an error, which must be freed before returning. The error_get_pretty() function is merely an accessor to the error message and doesn't free anything.

The error.h header indicates how to do it right:

* Pass an existing error to the caller with the message modified:
* error_propagate(errp, err);
* error_prepend(errp, "Could not frobnicate '%s': ", name);

---
 hw/intc/xics.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/intc/xics.c +6 -6
index a84ba51ad8..80c33be02e 100644
@@ -306,8 +306,8 @@ static void icp_realize(DeviceState *dev, Error **errp)
 
     obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err);
     if (!obj) {
-        error_setg(errp, "%s: required link '" ICP_PROP_XICS "' not found: %s",
-                   __func__, error_get_pretty(err));
+        error_propagate(errp, err);
+        error_prepend(errp, "required link '" ICP_PROP_XICS "' not found: ");
         return;
     }
 
@@ -315,8 +315,8 @@ static void icp_realize(DeviceState *dev, Error **errp)
 
     obj = object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err);
     if (!obj) {
-        error_setg(errp, "%s: required link '" ICP_PROP_CPU "' not found: %s",
-                   __func__, error_get_pretty(err));
+        error_propagate(errp, err);
+        error_prepend(errp, "required link '" ICP_PROP_CPU "' not found: ");
         return;
     }
 
@@ -641,8 +641,8 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
 
     obj = object_property_get_link(OBJECT(dev), ICS_PROP_XICS, &err);
     if (!obj) {
-        error_setg(errp, "%s: required link '" ICS_PROP_XICS "' not found: %s",
-                   __func__, error_get_pretty(err));
+        error_propagate(errp, err);
+        error_prepend(errp, "required link '" ICS_PROP_XICS "' not found: ");
         return;
     }
     ics->xics = XICS_FABRIC(obj);
Signature · 1 line
2.13.5
#13 lore raw

[Qemu-devel] [PULL 13/18] spapr_cpu_core: fail gracefully with non-pseries machine types

In reply to David Gibson

From: Greg Kurz <[email protected]>

Since commit 7cca3e466eb0 ("ppc: spapr: Move VCPU ID calculation into sPAPR"), QEMU aborts when started with a *-spapr-cpu-core device and a non-pseries machine.

Let's rely on the already existing call to object_dynamic_cast() instead of using the SPAPR_MACHINE() macro.

---
 hw/ppc/spapr_cpu_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/ppc/spapr_cpu_core.c +3 -2
index 85037ef71e..3f7ef20910 100644
@@ -213,7 +213,7 @@ error:
 
 static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
 {
-    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
+    sPAPRMachineState *spapr;
     sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
     sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));
     CPUCore *cc = CPU_CORE(OBJECT(dev));
@@ -223,7 +223,8 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
     void *obj;
     int i, j;
 
-    if (!object_dynamic_cast(qdev_get_machine(), TYPE_SPAPR_MACHINE)) {
+    spapr = (sPAPRMachineState *) qdev_get_machine();
+    if (!object_dynamic_cast((Object *) spapr, TYPE_SPAPR_MACHINE)) {
         error_setg(errp, "spapr-cpu-core needs a pseries machine");
         return;
     }
Signature · 1 line
2.13.5
#14 lore raw

[Qemu-devel] [PULL 17/18] spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()

In reply to David Gibson

From: Greg Kurz <[email protected]>

QTAILQ_FOREACH_SAFE() must be used when removing the current element inside the loop block.

This fixes a user-after-free error introduced by commit 56258174238eb and reported by Coverity (CID 1381017).

---
 hw/ppc/spapr_events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/spapr_events.c +2 -2
index 66b8164f30..e377fc7dde 100644
@@ -702,9 +702,9 @@ static void event_scan(PowerPCCPU *cpu, sPAPRMachineState *spapr,
 
 void spapr_clear_pending_events(sPAPRMachineState *spapr)
 {
-    sPAPREventLogEntry *entry = NULL;
+    sPAPREventLogEntry *entry = NULL, *next_entry;
 
-    QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
+    QTAILQ_FOREACH_SAFE(entry, &spapr->pending_events, next, next_entry) {
         QTAILQ_REMOVE(&spapr->pending_events, entry, next);
         g_free(entry->extended_log);
         g_free(entry);
Signature · 1 line
2.13.5
#15 lore raw

[Qemu-devel] [PULL 16/18] spapr_cpu_core: cleaning up qdev_get_machine() calls

In reply to David Gibson

From: Greg Kurz <[email protected]>

This patch removes the qdev_get_machine() calls that are made in spapr_cpu_core.c in situations where we can get an existing pointer for the MachineState by either passing it as an argument to the function or by using other already available pointers.

Credits to Daniel Henrique Barboza for the idea and the changelog text.

---
 hw/ppc/spapr_cpu_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/ppc/spapr_cpu_core.c +3 -3
index 3f7ef20910..c08ee7571a 100644
@@ -174,10 +174,10 @@ static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)
     g_free(sc->threads);
 }
 
-static void spapr_cpu_core_realize_child(Object *child, Error **errp)
+static void spapr_cpu_core_realize_child(Object *child,
+                                         sPAPRMachineState *spapr, Error **errp)
 {
     Error *local_err = NULL;
-    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
     CPUState *cs = CPU(child);
     PowerPCCPU *cpu = POWERPC_CPU(cs);
     Object *obj;
@@ -266,7 +266,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
     for (j = 0; j < cc->nr_threads; j++) {
         obj = sc->threads + j * size;
 
-        spapr_cpu_core_realize_child(obj, &local_err);
+        spapr_cpu_core_realize_child(obj, spapr, &local_err);
         if (local_err) {
             goto err;
         }
Signature · 1 line
2.13.5
#16 lore raw

[Qemu-devel] [PULL 18/18] ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()

In reply to David Gibson

From: Greg Kurz <[email protected]>

If the host has both KVM PR and KVM HV loaded and we pass:

-machine pseries,accel=kvm,kvm-type=PR

the kvmppc_is_pr() returns false instead of true. Since the helper is mostly used as fallback, it doesn't have any real impact with recent kernels. A notable exception is the workaround to allow migration between compatible hosts with different PVRs (eg, POWER8 and POWER8E), since KVM still doesn't provide a way to check if a specific PVR is supported (see commit c363a37a450f for details).

According to the official KVM API documentation [1], KVM_PPC_GET_PVINFO is "vm ioctl", but we check it as a global ioctl. The following function in KVM is hence called with kvm == NULL and considers we're in HV mode.

int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)

{
	int r;
	/* Assume we're using HV mode when the HV module is loaded */
	int hv_enabled = kvmppc_hv_ops ? 1 : 0;

	if (kvm) {
		/*
		 * Hooray - we know which VM type we're running on. Depend on
		 * that rather than the guess above.
		 */
		hv_enabled = is_kvmppc_hv_enabled(kvm);
	}

Let's use kvm_vm_check_extension() to fix the issue.

[1] https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt

---
 target/ppc/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/kvm.c +1 -1
index 6442dfcb95..1deaf106d2 100644
@@ -120,7 +120,7 @@ static void kvm_kick_cpu(void *opaque)
 static bool kvmppc_is_pr(KVMState *ks)
 {
     /* Assume KVM-PR if the GET_PVINFO capability is available */
-    return kvm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
+    return kvm_vm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
 }
 
 static int kvm_ppc_register_host_cpu_type(void);
Signature · 1 line
2.13.5
#17 lore raw

[Qemu-devel] [PULL 14/18] spapr_pci: convert sprintf() to g_strdup_printf()

In reply to David Gibson

From: Greg Kurz <[email protected]>

In order to follow a QEMU common practice.

---
 hw/ppc/spapr_pci.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
hw/ppc/spapr_pci.c +12 -9
index 75cd939223..7d84b9766e 100644
@@ -1609,34 +1609,37 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
 
     sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid);
 
-    namebuf = alloca(strlen(sphb->dtbusname) + 32);
-
     /* Initialize memory regions */
-    sprintf(namebuf, "%s.mmio", sphb->dtbusname);
+    namebuf = g_strdup_printf("%s.mmio", sphb->dtbusname);
     memory_region_init(&sphb->memspace, OBJECT(sphb), namebuf, UINT64_MAX);
+    g_free(namebuf);
 
-    sprintf(namebuf, "%s.mmio32-alias", sphb->dtbusname);
+    namebuf = g_strdup_printf("%s.mmio32-alias", sphb->dtbusname);
     memory_region_init_alias(&sphb->mem32window, OBJECT(sphb),
                              namebuf, &sphb->memspace,
                              SPAPR_PCI_MEM_WIN_BUS_OFFSET, sphb->mem_win_size);
+    g_free(namebuf);
     memory_region_add_subregion(get_system_memory(), sphb->mem_win_addr,
                                 &sphb->mem32window);
 
-    sprintf(namebuf, "%s.mmio64-alias", sphb->dtbusname);
+    namebuf = g_strdup_printf("%s.mmio64-alias", sphb->dtbusname);
     memory_region_init_alias(&sphb->mem64window, OBJECT(sphb),
                              namebuf, &sphb->memspace,
                              sphb->mem64_win_pciaddr, sphb->mem64_win_size);
+    g_free(namebuf);
     memory_region_add_subregion(get_system_memory(), sphb->mem64_win_addr,
                                 &sphb->mem64window);
 
     /* Initialize IO regions */
-    sprintf(namebuf, "%s.io", sphb->dtbusname);
+    namebuf = g_strdup_printf("%s.io", sphb->dtbusname);
     memory_region_init(&sphb->iospace, OBJECT(sphb),
                        namebuf, SPAPR_PCI_IO_WIN_SIZE);
+    g_free(namebuf);
 
-    sprintf(namebuf, "%s.io-alias", sphb->dtbusname);
+    namebuf = g_strdup_printf("%s.io-alias", sphb->dtbusname);
     memory_region_init_alias(&sphb->iowindow, OBJECT(sphb), namebuf,
                              &sphb->iospace, 0, SPAPR_PCI_IO_WIN_SIZE);
+    g_free(namebuf);
     memory_region_add_subregion(get_system_memory(), sphb->io_win_addr,
                                 &sphb->iowindow);
 
@@ -1654,10 +1657,10 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
      * Later the guest might want to create another DMA window
      * which will become another memory subregion.
      */
-    sprintf(namebuf, "%s.iommu-root", sphb->dtbusname);
-
+    namebuf = g_strdup_printf("%s.iommu-root", sphb->dtbusname);
     memory_region_init(&sphb->iommu_root, OBJECT(sphb),
                        namebuf, UINT64_MAX);
+    g_free(namebuf);
     address_space_init(&sphb->iommu_as, &sphb->iommu_root,
                        sphb->dtbusname);
 
Signature · 1 line
2.13.5
#18 lore raw

[Qemu-devel] [PULL 01/18] net: Add SunGEM device emulation as found on Apple UniNorth

In reply to David Gibson

From: Benjamin Herrenschmidt <[email protected]>

This adds a simplistic emulation of the Sun GEM ethernet controller found in Apple ASICs.

Currently we only support the Apple UniNorth 1.x variant, but the other Apple or Sun variants should mostly be a matter of adding PCI IDs options.

We have a very primitive emulation of a single Broadcom 5201 PHY which is supported by the MacOS driver.

This model brings out-of-the-box networking to MacOS 9, and all versions of OS X I tried with the mac99 platform.

Further improvements from Mark:
- Remove sungem.h file, moving constants into sungem.c as required
- Switch to using tracepoints for debugging
- Split register blocks into separate memory regions
- Use arrays in SunGEMState to hold register values
- Add state-saving support

---
 default-configs/ppc-softmmu.mak |    1 +
 hw/net/Makefile.objs            |    1 +
 hw/net/sungem.c                 | 1447 +++++++++++++++++++++++++++++++++++++++
 hw/net/trace-events             |   44 ++
 hw/pci/pci.c                    |    2 +
 include/hw/pci/pci_ids.h        |    1 +
 6 files changed, 1496 insertions(+)
 create mode 100644 hw/net/sungem.c
default-configs/ppc-softmmu.mak +1 -0
index d4d44eb66b..a3972c55fe 100644
@@ -18,6 +18,7 @@ CONFIG_PREP_PCI=y
 CONFIG_I82378=y
 CONFIG_PC87312=y
 CONFIG_MACIO=y
+CONFIG_SUNGEM=y
 CONFIG_PCSPK=y
 CONFIG_CS4231A=y
 CONFIG_CUDA=y
hw/net/Makefile.objs +1 -0
index 5ddaffe63a..7e87d0176b 100644
@@ -27,6 +27,7 @@ common-obj-$(CONFIG_CADENCE) += cadence_gem.o
 common-obj-$(CONFIG_STELLARIS_ENET) += stellaris_enet.o
 common-obj-$(CONFIG_LANCE) += lance.o
 common-obj-$(CONFIG_FTGMAC100) += ftgmac100.o
+common-obj-$(CONFIG_SUNGEM) += sungem.o
 
 obj-$(CONFIG_ETRAXFS) += etraxfs_eth.o
 obj-$(CONFIG_COLDFIRE) += mcf_fec.o
hw/net/sungem.c new file +1447 -0

1,447 lines not on this page · raw message

hw/net/trace-events +44 -0

47 lines not on this page · raw message

hw/pci/pci.c +2 -0
index 21e203b056..1e6fb88eba 100644
@@ -1821,6 +1821,7 @@ static const char * const pci_nic_models[] = {
     "e1000",
     "pcnet",
     "virtio",
+    "sungem",
     NULL
 };
 
@@ -1833,6 +1834,7 @@ static const char * const pci_nic_names[] = {
     "e1000",
     "pcnet",
     "virtio-net-pci",
+    "sungem",
     NULL
 };
 
include/hw/pci/pci_ids.h +1 -0
index 3752ddc93a..b9c2bad851 100644
@@ -183,6 +183,7 @@
 #define PCI_VENDOR_ID_APPLE              0x106b
 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP    0x0020
 #define PCI_DEVICE_ID_APPLE_U3_AGP       0x004b
+#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC   0x0021
 
 #define PCI_VENDOR_ID_SUN                0x108e
 #define PCI_DEVICE_ID_SUN_EBUS           0x1000
Signature · 1 line
2.13.5
#19 lore raw
In reply to David Gibson
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL 00/18] ppc-for-2.11 queue 20170915
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
872afb4d17 ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr() 7a25c28fcc spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events() 925177495a spapr_cpu_core: cleaning up qdev_get_machine() calls e0a96b5c4d spapr_pci: don't create 64-bit MMIO window if we don't need to 1851b264d5 spapr_pci: convert sprintf() to g_strdup_printf() e62bfeb753 spapr_cpu_core: fail gracefully with non-pseries machine types d68c815c09 xics: fix several error leaks
165724544b vfio, spapr: Fix levels calculation
e0d3f60741 spapr_pci: handle FDT creation errors with _FDT() 9d82d580aa spapr_pci: use the common _FDT() helper
fe74e07d9f spapr: fix CAS-generated reset
53b3f63411 ppc/xive: fix OV5_XIVE_EXPLOIT bits
48ced9b1af spapr: only update SDR1 once per-cpu during CAS
868444ad8c spapr_pci: use g_strdup_printf()
dbfa7f0124 spapr_pci: drop useless check in spapr_populate_pci_child_dt() 2d5463163b spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code() 0d760c3eed hw/ppc/spapr.c: cleaning up qdev_get_machine() calls 2add13654e net: Add SunGEM device emulation as found on Apple UniNorth

=== OUTPUT BEGIN ===
Checking PATCH 1/18: net: Add SunGEM device emulation as found on Apple UniNorth... Checking PATCH 2/18: hw/ppc/spapr.c: cleaning up qdev_get_machine() calls... Checking PATCH 3/18: spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()... Checking PATCH 4/18: spapr_pci: drop useless check in spapr_populate_pci_child_dt()... Checking PATCH 5/18: spapr_pci: use g_strdup_printf()...
Checking PATCH 6/18: spapr: only update SDR1 once per-cpu during CAS... Checking PATCH 7/18: ppc/xive: fix OV5_XIVE_EXPLOIT bits...
Checking PATCH 8/18: spapr: fix CAS-generated reset...
Checking PATCH 9/18: spapr_pci: use the common _FDT() helper...
Checking PATCH 10/18: spapr_pci: handle FDT creation errors with _FDT()... Checking PATCH 11/18: vfio, spapr: Fix levels calculation...
Checking PATCH 12/18: xics: fix several error leaks...
Checking PATCH 13/18: spapr_cpu_core: fail gracefully with non-pseries machine types... Checking PATCH 14/18: spapr_pci: convert sprintf() to g_strdup_printf()... Checking PATCH 15/18: spapr_pci: don't create 64-bit MMIO window if we don't need to...
ERROR: spaces required around that '-' (ctx:VxV)
#55: FILE: hw/ppc/spapr_pci.c:1625:

+    if (sphb->mem64_win_pciaddr != (hwaddr)-1) {
                                            ^

ERROR: spaces required around that '-' (ctx:VxV)
#62: FILE: hw/ppc/spapr_pci.c:1632:

+        if (sphb->mem64_win_addr != (hwaddr)-1) {
                                             ^

total: 2 errors, 0 warnings, 26 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 16/18: spapr_cpu_core: cleaning up qdev_get_machine() calls... Checking PATCH 17/18: spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()... Checking PATCH 18/18: ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#20 lore raw
Quoted 72 lines · On Thu, Sep 14, 2017 at 09:26:49PM -0700, [email protected] wrote:

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL 00/18] ppc-for-2.11 queue 20170915
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
872afb4d17 ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr() 7a25c28fcc spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events() 925177495a spapr_cpu_core: cleaning up qdev_get_machine() calls e0a96b5c4d spapr_pci: don't create 64-bit MMIO window if we don't need to 1851b264d5 spapr_pci: convert sprintf() to g_strdup_printf() e62bfeb753 spapr_cpu_core: fail gracefully with non-pseries machine types d68c815c09 xics: fix several error leaks
165724544b vfio, spapr: Fix levels calculation
e0d3f60741 spapr_pci: handle FDT creation errors with _FDT() 9d82d580aa spapr_pci: use the common _FDT() helper
fe74e07d9f spapr: fix CAS-generated reset
53b3f63411 ppc/xive: fix OV5_XIVE_EXPLOIT bits
48ced9b1af spapr: only update SDR1 once per-cpu during CAS
868444ad8c spapr_pci: use g_strdup_printf()
dbfa7f0124 spapr_pci: drop useless check in spapr_populate_pci_child_dt() 2d5463163b spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code() 0d760c3eed hw/ppc/spapr.c: cleaning up qdev_get_machine() calls 2add13654e net: Add SunGEM device emulation as found on Apple UniNorth

=== OUTPUT BEGIN ===
Checking PATCH 1/18: net: Add SunGEM device emulation as found on Apple UniNorth... Checking PATCH 2/18: hw/ppc/spapr.c: cleaning up qdev_get_machine() calls... Checking PATCH 3/18: spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()... Checking PATCH 4/18: spapr_pci: drop useless check in spapr_populate_pci_child_dt()... Checking PATCH 5/18: spapr_pci: use g_strdup_printf()...
Checking PATCH 6/18: spapr: only update SDR1 once per-cpu during CAS... Checking PATCH 7/18: ppc/xive: fix OV5_XIVE_EXPLOIT bits...
Checking PATCH 8/18: spapr: fix CAS-generated reset...
Checking PATCH 9/18: spapr_pci: use the common _FDT() helper...
Checking PATCH 10/18: spapr_pci: handle FDT creation errors with _FDT()... Checking PATCH 11/18: vfio, spapr: Fix levels calculation...
Checking PATCH 12/18: xics: fix several error leaks...
Checking PATCH 13/18: spapr_cpu_core: fail gracefully with non-pseries machine types... Checking PATCH 14/18: spapr_pci: convert sprintf() to g_strdup_printf()... Checking PATCH 15/18: spapr_pci: don't create 64-bit MMIO window if we don't need to...
ERROR: spaces required around that '-' (ctx:VxV)
#55: FILE: hw/ppc/spapr_pci.c:1625:

Quoted 8 lines
+    if (sphb->mem64_win_pciaddr != (hwaddr)-1) {
                                            ^

ERROR: spaces required around that '-' (ctx:VxV)
#62: FILE: hw/ppc/spapr_pci.c:1632:

+        if (sphb->mem64_win_addr != (hwaddr)-1) {
                                             ^

These are false positives, a patch for checkpatch.pl is in the works.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#21 lore raw
In reply to David Gibson
Quoted 10 lines · David Gibson

The following changes since commit 3dabde1128b671f36ac6cb36b97b273139964420:

Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging (2017-09-14 16:33:02 +0100)

are available in the git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-2.11-20170915

for you to fetch changes up to 70a0c19e83aa4c71c879d51e426e89e4b3d4e014:

Quoted 8 lines

ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr() (2017-09-15 10:29:48 +1000)

----------------------------------------------------------------
ppc patch queue 2017-09-15

Here's the current batch of accumulated ppc patches. These are all pretty simple bugfixes or cleanups, no big new features here.

Applied, thanks.

-- PMM