[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 32/50] spapr/pci: Generate FDT fragment at configure co
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 32/50] spapr/pci: Generate FDT fragment at configure connector time |
Date: |
Tue, 26 Feb 2019 15:52:46 +1100 |
From: Greg Kurz <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_drc.c | 1 +
hw/ppc/spapr_pci.c | 19 ++++++++++++-------
include/hw/pci-host/spapr.h | 4 +++-
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index aa26aa40be..248eb8a93d 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -691,6 +691,7 @@ static void spapr_drc_pci_class_init(ObjectClass *k, void
*data)
drck->typename = "28";
drck->drc_name_prefix = "C";
drck->release = spapr_phb_remove_pci_device_cb;
+ drck->dt_populate = spapr_pci_dt_populate;
}
static void spapr_drc_lmb_class_init(ObjectClass *k, void *data)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 60777b2355..b22c9f57b2 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1408,6 +1408,17 @@ static uint32_t
spapr_phb_get_pci_drc_index(sPAPRPHBState *phb,
return spapr_drc_index(drc);
}
+int spapr_pci_dt_populate(sPAPRDRConnector *drc, sPAPRMachineState *spapr,
+ void *fdt, int *fdt_start_offset, Error **errp)
+{
+ HotplugHandler *plug_handler = qdev_get_hotplug_handler(drc->dev);
+ sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(plug_handler);
+ PCIDevice *pdev = PCI_DEVICE(drc->dev);
+
+ *fdt_start_offset = spapr_create_pci_child_dt(sphb, pdev, fdt, 0);
+ return 0;
+}
+
static void spapr_pci_plug(HotplugHandler *plug_handler,
DeviceState *plugged_dev, Error **errp)
{
@@ -1417,8 +1428,6 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,
Error *local_err = NULL;
PCIBus *bus = PCI_BUS(qdev_get_parent_bus(DEVICE(pdev)));
uint32_t slotnr = PCI_SLOT(pdev->devfn);
- void *fdt = NULL;
- int fdt_start_offset, fdt_size;
/* if DR is disabled we don't need to do anything in the case of
* hotplug or coldplug callbacks
@@ -1448,10 +1457,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,
goto out;
}
- fdt = create_device_tree(&fdt_size);
- fdt_start_offset = spapr_create_pci_child_dt(phb, pdev, fdt, 0);
-
- spapr_drc_attach(drc, DEVICE(pdev), fdt, fdt_start_offset, &local_err);
+ spapr_drc_attach(drc, DEVICE(pdev), NULL, 0, &local_err);
if (local_err) {
goto out;
}
@@ -1483,7 +1489,6 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,
out:
if (local_err) {
error_propagate(errp, local_err);
- g_free(fdt);
}
}
diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
index 51d81c4b7c..f6e43f48fe 100644
--- a/include/hw/pci-host/spapr.h
+++ b/include/hw/pci-host/spapr.h
@@ -121,8 +121,10 @@ sPAPRPHBState *spapr_pci_find_phb(sPAPRMachineState
*spapr, uint64_t buid);
PCIDevice *spapr_pci_find_dev(sPAPRMachineState *spapr, uint64_t buid,
uint32_t config_addr);
-/* PCI release callback. */
+/* DRC callbacks */
void spapr_phb_remove_pci_device_cb(DeviceState *dev);
+int spapr_pci_dt_populate(sPAPRDRConnector *drc, sPAPRMachineState *spapr,
+ void *fdt, int *fdt_start_offset, Error **errp);
/* VFIO EEH hooks */
#ifdef CONFIG_LINUX
--
2.20.1
- [Qemu-ppc] [PULL 29/50] spapr_drc: Allow FDT fragment to be added later, (continued)
- [Qemu-ppc] [PULL 29/50] spapr_drc: Allow FDT fragment to be added later, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 33/50] spapr/drc: Drop spapr_drc_attach() fdt argument, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 38/50] spapr: create DR connectors for PHBs, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 49/50] ppc/pnv: add INITRD_MAX_SIZE constant, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 36/50] spapr_irq: Expose the phandle of the interrupt controller, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 50/50] ppc/pnv: use IEC binary prefixes to represent sizes, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 42/50] spapr_pci: add ibm, my-drc-index property for PHB hotplug, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 40/50] spapr_events: add support for phb hotplug events, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 32/50] spapr/pci: Generate FDT fragment at configure connector time,
David Gibson <=
- [Qemu-ppc] [PULL 34/50] xics: Write source state to KVM at claim time, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 37/50] spapr_pci: add PHB unrealize, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 44/50] spapr: enable PHB hotplug for default pseries machine type, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 45/50] tests/device-plug: Add PHB unplug request test for spapr, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 48/50] ppc/pnv: increase kernel size limit to 256MiB, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 41/50] spapr_pci: provide node start offset via spapr_populate_pci_dt(), David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 43/50] spapr: add hotplug hooks for PHB hotplug, David Gibson, 2019/02/25
- [Qemu-ppc] [PULL 47/50] hw/ppc: Use object_initialize_child for correct reference counting, David Gibson, 2019/02/25
- Re: [Qemu-ppc] [PULL 00/50] ppc-for-4.0 queue 20190226, Peter Maydell, 2019/02/28