qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH 2/6] PCI: Add sysdata to PCI bus


From: Gavin Shan
Subject: [Qemu-ppc] [PATCH 2/6] PCI: Add sysdata to PCI bus
Date: Wed, 14 May 2014 14:27:25 +1000

The problem I have is that VFIO (hw/misc/vfio.c) have to dereference
PHB BUID, which is sPAPR platform specific inforamtion and maintained
in sPAPRPHBState instance. It's not reasonable to refer sPAPRPHBState
in hw/misc/vfio.c which is shared by multiple CPU architectures.

In order to resolve the problem, "sysdata" is introduced to PCI bus
and initialize that to PHB BUID when the root bus is created on sPAPR
platform. Eventually, we can dereference to PHB BUID via the "sysdata"
on root PCI bus.

Signed-off-by: Gavin Shan <address@hidden>
---
 hw/ppc/spapr_pci.c       | 1 +
 include/hw/pci/pci_bus.h | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index a9f307a..815e378 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -608,6 +608,7 @@ static void spapr_phb_realize(DeviceState *dev, Error 
**errp)
                            pci_spapr_set_irq, pci_spapr_map_irq, sphb,
                            &sphb->memspace, &sphb->iospace,
                            PCI_DEVFN(0, 0), PCI_NUM_PINS, TYPE_PCI_BUS);
+    bus->sysdata = sphb->buid;
     phb->bus = bus;
 
     /*
diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
index fabaeee..5bdc033 100644
--- a/include/hw/pci/pci_bus.h
+++ b/include/hw/pci/pci_bus.h
@@ -29,6 +29,9 @@ struct PCIBus {
        Keep a count of the number of devices with raised IRQs.  */
     int nirq;
     int *irq_count;
+
+    /* Sysdata */
+    uint64_t sysdata;
 };
 
 typedef struct PCIBridgeWindows PCIBridgeWindows;
-- 
1.8.3.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]