mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
hw/pci/cxl: Create a CXL bus type
The easiest way to differentiate a CXL bus, and a PCIE bus is using a flag. A CXL bus, in hardware, is backward compatible with PCIE, and therefore the code tries pretty hard to keep them in sync as much as possible. The other way to implement this would be to try to cast the bus to the correct type. This is less code and useful for debugging via simply looking at the flags. Signed-off-by: Ben Widawsky <ben.widawsky@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220429144110.25167-13-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
25a2e524e3
commit
9dccb1216b
2 changed files with 15 additions and 1 deletions
|
@ -24,7 +24,7 @@
|
|||
#include "hw/boards.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
enum BusType { PCI, PCIE };
|
||||
enum BusType { PCI, PCIE, CXL };
|
||||
|
||||
#define TYPE_PXB_BUS "pxb-bus"
|
||||
typedef struct PXBBus PXBBus;
|
||||
|
@ -35,6 +35,10 @@ DECLARE_INSTANCE_CHECKER(PXBBus, PXB_BUS,
|
|||
DECLARE_INSTANCE_CHECKER(PXBBus, PXB_PCIE_BUS,
|
||||
TYPE_PXB_PCIE_BUS)
|
||||
|
||||
#define TYPE_PXB_CXL_BUS "pxb-cxl-bus"
|
||||
DECLARE_INSTANCE_CHECKER(PXBBus, PXB_CXL_BUS,
|
||||
TYPE_PXB_CXL_BUS)
|
||||
|
||||
struct PXBBus {
|
||||
/*< private >*/
|
||||
PCIBus parent_obj;
|
||||
|
@ -251,6 +255,9 @@ static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type,
|
|||
ds = qdev_new(TYPE_PXB_HOST);
|
||||
if (type == PCIE) {
|
||||
bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS);
|
||||
} else if (type == CXL) {
|
||||
bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_CXL_BUS);
|
||||
bus->flags |= PCI_BUS_CXL;
|
||||
} else {
|
||||
bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS);
|
||||
bds = qdev_new("pci-bridge");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue