OSDN Git Service

hw/pci-bridge: Make PCIe and CXL PXB Devices inherit from TYPE_PXB_DEV
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 20 Apr 2023 14:27:50 +0000 (15:27 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 25 Apr 2023 02:56:55 +0000 (22:56 -0400)
commitc28db9e0002df2abf88283b41dce0be17e8b0888
treea5fe41a5ad2012353044035bcc3048f629278cd8
parent9136f661c7277777a2f85a7e98438f4fe6472fdc
hw/pci-bridge: Make PCIe and CXL PXB Devices inherit from TYPE_PXB_DEV

Previously, PXB_CXL_DEVICE, PXB_PCIE_DEVICE and PXB_DEVICE all
have PCI_DEVICE as their direct parent but share a common state
struct PXBDev. convert_to_pxb() is used to get the PXBDev
instance from which ever of these types it is called on.

This patch switches to an explicit hierarchy based on shared
functionality.  To allow use of OBJECT_DECLARE_SIMPLE_TYPE()
whilst minimizing code changes, all types are renamed to have
the postfix _DEV rather than _DEVICE.  The new heirarchy
has PXB_CXL_DEV with parent PXB_PCIE_DEV which in turn
has parent PXB_DEV which continues to have parent PCI_DEVICE.

This allows simple use of PXB_DEV() etc rather than a custom function
+ removal of duplicated properties and moving the CXL specific
elements out of struct PXBDev.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20230420142750.6950-3-Jonathan.Cameron@huawei.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/acpi/cxl.c
hw/cxl/cxl-host.c
hw/pci-bridge/pci_expander_bridge.c
include/hw/cxl/cxl.h
include/hw/pci/pci_bridge.h