Skip to contentSkip to conversation

ppc-for-2.11 queue 20171108

GIT PULL Applied David Gibson 2 participants 5 messages Nov 8, 2017 – Nov 10, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842:

Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000)

are available in the git repository at:

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

for you to fetch changes up to c91c187f715aded9e1ac28412bba41fd3cbaf010:

e500: ppce500_init_mpic() return device instead of IRQ array (2017-11-08 13:21:37 +1100)

----------------------------------------------------------------
ppc patch queue 2017-11-08

Here's the current set of accumulated ppc patches for qemu-2.11. Since we're now in hard freeze these are all bugfixes (although some fix a bug by way of a cleanup).

----------------------------------------------------------------
Greg Kurz (1):
ppc: fix setting of compat mode

Michael Davidsaver (1):
e500: ppce500_init_mpic() return device instead of IRQ array

Thomas Huth (1):
hw/display/sm501: Fix comment in sm501_sysbus_class_init()

 hw/display/sm501.c  |  2 +-
 hw/ppc/e500.c       | 32 +++++++++++++-------------------
 target/ppc/compat.c |  2 +-
 3 files changed, 15 insertions(+), 21 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 2/3] hw/display/sm501: Fix comment in sm501_sysbus_class_init()

From: Thomas Huth <[email protected]>

The "cannot_instantiate_with_device_add_yet" flag has been renamed to "user_creatable" a while ago.

---
 hw/display/sm501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/sm501.c +1 -1
index 6eddac911e..7f1822421a 100644
@@ -1758,7 +1758,7 @@ static void sm501_sysbus_class_init(ObjectClass *klass, void *data)
     dc->reset = sm501_reset_sysbus;
     dc->vmsd = &vmstate_sm501_sysbus;
     /* Note: pointer property "chr-state" may remain null, thus
-     * no need for dc->cannot_instantiate_with_device_add_yet = true;
+     * no need for dc->user_creatable = false;
      */
 }
 
Signature · 1 line
2.13.6
#2 lore raw

[Qemu-devel] [PULL 1/3] ppc: fix setting of compat mode

In reply to David Gibson

From: Greg Kurz <[email protected]>

While trying to make KVM PR usable again, commit 5dfaa532ae introduced a
regression: the current compat_pvr value is passed to KVM instead of the new one. This means that we always pass 0 instead of the max-cpu-compat PVR during the initial machine reset. And at CAS time, we either pass the PVR from the command line or even don't call kvmppc_set_compat() at all, ie, the PCR will not be set as expected.

For example if we start a big endian fedora26 guest in power7 compat mode on a POWER8 host, we get this in the guest:

$ cat /proc/cpuinfo
processor       : 0
cpu             : POWER7 (architected), altivec supported
clock           : 4024.000000MHz
revision        : 2.0 (pvr 004d 0200)

timebase : 512000000
platform : pSeries
model : IBM pSeries (emulated by qemu)
machine : CHRP IBM pSeries (emulated by qemu)
MMU : Hash

but the guest can still execute POWER8 instructions, and the following program succeeds:

int main()

{
        asm("vncipher 0,0,0"); // ISA 2.07 instruction
}

Let's pass the new compat_pvr to kvmppc_set_compat() and the program fails with SIGILL as expected.

---
 target/ppc/compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/compat.c +1 -1
index f8729fe46d..ad8f93c064 100644
@@ -141,7 +141,7 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp)
     cpu_synchronize_state(CPU(cpu));
 
     if (kvm_enabled() && cpu->compat_pvr != compat_pvr) {
-        int ret = kvmppc_set_compat(cpu, cpu->compat_pvr);
+        int ret = kvmppc_set_compat(cpu, compat_pvr);
         if (ret < 0) {
             error_setg_errno(errp, -ret,
                              "Unable to set CPU compatibility mode in KVM");
Signature · 1 line
2.13.6
#3 lore raw

[Qemu-devel] [PULL 3/3] e500: ppce500_init_mpic() return device instead of IRQ array

In reply to David Gibson

From: Michael Davidsaver <[email protected]>

Actual number of interrupt pins isn't known in ppce500_init_mpic() so a hardcoded number was used, which causes a crash with older openpic.

Instead, return the DeviceState* and change ppce500_init() to call qdev_get_gpio_in() to get only the irq pins which are needed.

---
 hw/ppc/e500.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)
hw/ppc/e500.c +13 -19
index 9178e70132..5cf0dabef3 100644
@@ -729,15 +729,13 @@ static DeviceState *ppce500_init_mpic_kvm(PPCE500Params *params,
     return dev;
 }
 
-static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,
-                                   MemoryRegion *ccsr, qemu_irq **irqs)
+static DeviceState *ppce500_init_mpic(MachineState *machine,
+                                      PPCE500Params *params,
+                                      MemoryRegion *ccsr,
+                                      qemu_irq **irqs)
 {
-    qemu_irq *mpic;
     DeviceState *dev = NULL;
     SysBusDevice *s;
-    int i;
-
-    mpic = g_new0(qemu_irq, 256);
 
     if (kvm_enabled()) {
         Error *err = NULL;
@@ -756,15 +754,11 @@ static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,
         dev = ppce500_init_mpic_qemu(params, irqs);
     }
 
-    for (i = 0; i < 256; i++) {
-        mpic[i] = qdev_get_gpio_in(dev, i);
-    }
-
     s = SYS_BUS_DEVICE(dev);
     memory_region_add_subregion(ccsr, MPC8544_MPIC_REGS_OFFSET,
                                 s->mmio[0].memory);
 
-    return mpic;
+    return dev;
 }
 
 static void ppce500_power_off(void *opaque, int line, int on)
@@ -796,8 +790,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
     /* irq num for pin INTA, INTB, INTC and INTD is 1, 2, 3 and
      * 4 respectively */
     unsigned int pci_irq_nrs[PCI_NUM_PINS] = {1, 2, 3, 4};
-    qemu_irq **irqs, *mpic;
-    DeviceState *dev;
+    qemu_irq **irqs;
+    DeviceState *dev, *mpicdev;
     CPUPPCState *firstenv = NULL;
     MemoryRegion *ccsr_addr_space;
     SysBusDevice *s;
@@ -866,18 +860,18 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
     memory_region_add_subregion(address_space_mem, params->ccsrbar_base,
                                 ccsr_addr_space);
 
-    mpic = ppce500_init_mpic(machine, params, ccsr_addr_space, irqs);
+    mpicdev = ppce500_init_mpic(machine, params, ccsr_addr_space, irqs);
 
     /* Serial */
     if (serial_hds[0]) {
         serial_mm_init(ccsr_addr_space, MPC8544_SERIAL0_REGS_OFFSET,
-                       0, mpic[42], 399193,
+                       0, qdev_get_gpio_in(mpicdev, 42), 399193,
                        serial_hds[0], DEVICE_BIG_ENDIAN);
     }
 
     if (serial_hds[1]) {
         serial_mm_init(ccsr_addr_space, MPC8544_SERIAL1_REGS_OFFSET,
-                       0, mpic[42], 399193,
+                       0, qdev_get_gpio_in(mpicdev, 42), 399193,
                        serial_hds[1], DEVICE_BIG_ENDIAN);
     }
 
@@ -895,7 +889,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
     qdev_init_nofail(dev);
     s = SYS_BUS_DEVICE(dev);
     for (i = 0; i < PCI_NUM_PINS; i++) {
-        sysbus_connect_irq(s, i, mpic[pci_irq_nrs[i]]);
+        sysbus_connect_irq(s, i, qdev_get_gpio_in(mpicdev, pci_irq_nrs[i]));
     }
 
     memory_region_add_subregion(ccsr_addr_space, MPC8544_PCI_REGS_OFFSET,
@@ -926,7 +920,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
         dev = qdev_create(NULL, "mpc8xxx_gpio");
         s = SYS_BUS_DEVICE(dev);
         qdev_init_nofail(dev);
-        sysbus_connect_irq(s, 0, mpic[MPC8XXX_GPIO_IRQ]);
+        sysbus_connect_irq(s, 0, qdev_get_gpio_in(mpicdev, MPC8XXX_GPIO_IRQ));
         memory_region_add_subregion(ccsr_addr_space, MPC8XXX_GPIO_OFFSET,
                                     sysbus_mmio_get_region(s, 0));
 
@@ -946,7 +940,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
 
         for (i = 0; i < params->platform_bus_num_irqs; i++) {
             int irqn = params->platform_bus_first_irq + i;
-            sysbus_connect_irq(s, i, mpic[irqn]);
+            sysbus_connect_irq(s, i, qdev_get_gpio_in(mpicdev, irqn));
         }
 
         memory_region_add_subregion(address_space_mem,
Signature · 1 line
2.13.6
#4 lore raw
In reply to David Gibson
Quoted 10 lines · David Gibson

The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842:

Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000)

are available in the git repository at:

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

for you to fetch changes up to c91c187f715aded9e1ac28412bba41fd3cbaf010:

Quoted 9 lines

e500: ppce500_init_mpic() return device instead of IRQ array (2017-11-08 13:21:37 +1100)

----------------------------------------------------------------
ppc patch queue 2017-11-08

Here's the current set of accumulated ppc patches for qemu-2.11. Since we're now in hard freeze these are all bugfixes (although some fix a bug by way of a cleanup).

Applied, thanks.

-- PMM