[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 36/36] hw/pci-host/pnv_phb3_msi: Convert TYPE_PHB3_MSI to 3-phase
From: |
Peter Maydell |
Subject: |
[PULL 36/36] hw/pci-host/pnv_phb3_msi: Convert TYPE_PHB3_MSI to 3-phase reset |
Date: |
Fri, 16 Dec 2022 21:42:44 +0000 |
Convert the TYPE_PHB3_MSI class to 3-phase reset, so we can
avoid using the device_class_set_parent_reset() function.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20221125115240.3005559-8-peter.maydell@linaro.org
---
include/hw/ppc/xics.h | 2 +-
hw/pci-host/pnv_phb3_msi.c | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 00b80b08c27..95ead0dd7c9 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -95,7 +95,7 @@ struct ICSStateClass {
DeviceClass parent_class;
DeviceRealize parent_realize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
void (*reject)(ICSState *s, uint32_t irq);
void (*resend)(ICSState *s);
diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c
index ae908fd9e41..41e63b066f9 100644
--- a/hw/pci-host/pnv_phb3_msi.c
+++ b/hw/pci-host/pnv_phb3_msi.c
@@ -228,12 +228,14 @@ static void phb3_msi_resend(ICSState *ics)
}
}
-static void phb3_msi_reset(DeviceState *dev)
+static void phb3_msi_reset_hold(Object *obj)
{
- Phb3MsiState *msi = PHB3_MSI(dev);
- ICSStateClass *icsc = ICS_GET_CLASS(dev);
+ Phb3MsiState *msi = PHB3_MSI(obj);
+ ICSStateClass *icsc = ICS_GET_CLASS(obj);
- icsc->parent_reset(dev);
+ if (icsc->parent_phases.hold) {
+ icsc->parent_phases.hold(obj);
+ }
memset(msi->rba, 0, sizeof(msi->rba));
msi->rba_sum = 0;
@@ -287,11 +289,12 @@ static void phb3_msi_class_init(ObjectClass *klass, void
*data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
ICSStateClass *isc = ICS_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
device_class_set_parent_realize(dc, phb3_msi_realize,
&isc->parent_realize);
- device_class_set_parent_reset(dc, phb3_msi_reset,
- &isc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, phb3_msi_reset_hold, NULL,
+ &isc->parent_phases);
isc->reject = phb3_msi_reject;
isc->resend = phb3_msi_resend;
--
2.25.1
- [PULL 32/36] pci: Convert TYPE_PCIE_ROOT_PORT to 3-phase reset, (continued)
- [PULL 32/36] pci: Convert TYPE_PCIE_ROOT_PORT to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 33/36] pci: Convert child classes of TYPE_PCIE_ROOT_PORT to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 23/36] target/ppc: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 27/36] target/sparc: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 29/36] target/xtensa: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 35/36] hw/intc/xics: Convert TYPE_ICS to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 30/36] hw/virtio: Convert TYPE_VIRTIO_PCI to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 28/36] target/tricore: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 31/36] hw/display/virtio-vga: Convert TYPE_VIRTIO_VGA_BASE to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 34/36] hw/intc/xics: Reset TYPE_ICS objects with device_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 36/36] hw/pci-host/pnv_phb3_msi: Convert TYPE_PHB3_MSI to 3-phase reset,
Peter Maydell <=
- Re: [PULL 00/36] reset refactoring patches, Peter Maydell, 2022/12/17