Patchwork [26/30] grackle: remove broken pci device

login
register
mail settings
Submitter Anthony Liguori
Date Jan. 3, 2012, 12:52 a.m.
Message ID <1325551939-24749-27-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/133940/
State New
Headers show

Comments

Anthony Liguori - Jan. 3, 2012, 12:52 a.m.
I have no idea what's going on here, but this is broken and cannot possibly
work because:

 1) It's qdev name conflicts with a device that sits on SysBus

 2) The PCI constructor expects a SysBus device... but's it's a PCIDevice

If you do qdev_create("grackle"), the code expects to get the SysBus version
so drop the mystery PCI version.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/grackle_pci.c |   17 -----------------
 1 files changed, 0 insertions(+), 17 deletions(-)
Aurelien Jarno - Jan. 8, 2012, 1:46 a.m.
On Mon, Jan 02, 2012 at 06:52:15PM -0600, Anthony Liguori wrote:
> I have no idea what's going on here, but this is broken and cannot possibly
> work because:
> 
>  1) It's qdev name conflicts with a device that sits on SysBus
> 
>  2) The PCI constructor expects a SysBus device... but's it's a PCIDevice
> 
> If you do qdev_create("grackle"), the code expects to get the SysBus version
> so drop the mystery PCI version.
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  hw/grackle_pci.c |   17 -----------------
>  1 files changed, 0 insertions(+), 17 deletions(-)

NACK. Maybe the current code is not correct, but it actually works, and
a PCI host device like this one is definitely needed on the system.

Trying to apply this patch, qemu-system-ppc fails to start with:

  qemu: hardware error: Unknown device 'grackle' for bus 'PCI'
Andreas Färber - Jan. 8, 2012, 1:55 a.m.
Am 08.01.2012 02:46, schrieb Aurelien Jarno:
> On Mon, Jan 02, 2012 at 06:52:15PM -0600, Anthony Liguori wrote:
>> I have no idea what's going on here, but this is broken and cannot possibly
>> work because:
>>
>>  1) It's qdev name conflicts with a device that sits on SysBus
>>
>>  2) The PCI constructor expects a SysBus device... but's it's a PCIDevice
>>
>> If you do qdev_create("grackle"), the code expects to get the SysBus version
>> so drop the mystery PCI version.
>>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> ---
>>  hw/grackle_pci.c |   17 -----------------
>>  1 files changed, 0 insertions(+), 17 deletions(-)
> 
> NACK. Maybe the current code is not correct, but it actually works, and
> a PCI host device like this one is definitely needed on the system.
> 
> Trying to apply this patch, qemu-system-ppc fails to start with:
> 
>   qemu: hardware error: Unknown device 'grackle' for bus 'PCI'

Similar for uni-north and qemu-system-ppc64 or -M mac99 (cf. v1).

Now that PReP is somewhat restored on my branch, if Anthony wants, I can
send patches to resolve the name conflicts next week.

Andreas

Patch

diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index 1e529fb..84f1a47 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -115,27 +115,10 @@  static int pci_grackle_init_device(SysBusDevice *dev)
     return 0;
 }
 
-static int grackle_pci_host_init(PCIDevice *d)
-{
-    d->config[0x09] = 0x01;
-    return 0;
-}
-
-static PCIDeviceInfo grackle_pci_host_info = {
-    .qdev.name = "grackle",
-    .qdev.size = sizeof(PCIDevice),
-    .init      = grackle_pci_host_init,
-    .vendor_id = PCI_VENDOR_ID_MOTOROLA,
-    .device_id = PCI_DEVICE_ID_MOTOROLA_MPC106,
-    .revision  = 0x00,
-    .class_id  = PCI_CLASS_BRIDGE_HOST,
-};
-
 static void grackle_register_devices(void)
 {
     sysbus_register_dev("grackle", sizeof(GrackleState),
                         pci_grackle_init_device);
-    pci_qdev_register(&grackle_pci_host_info);
 }
 
 device_init(grackle_register_devices)