|
Eduardo Lima (Etrunko) |
493beb |
From 736ef0dcc04348bd478cc69d772a6b44fe660831 Mon Sep 17 00:00:00 2001
|
|
Eduardo Lima (Etrunko) |
493beb |
From: Jonathan Cameron via <qemu-devel@nongnu.org>
|
|
Eduardo Lima (Etrunko) |
493beb |
Date: Thu, 20 Apr 2023 15:27:50 +0100
|
|
Eduardo Lima (Etrunko) |
493beb |
Subject: [PATCH 2/2] hw/pci-bridge: Make PCIe and CXL PXB Devices inherit from
|
|
Eduardo Lima (Etrunko) |
493beb |
TYPE_PXB_DEV
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
Previously, PXB_CXL_DEVICE, PXB_PCIE_DEVICE and PXB_DEVICE all
|
|
Eduardo Lima (Etrunko) |
493beb |
have PCI_DEVICE as their direct parent but share a common state
|
|
Eduardo Lima (Etrunko) |
493beb |
struct PXBDev. convert_to_pxb() is used to get the PXBDev
|
|
Eduardo Lima (Etrunko) |
493beb |
instance from which ever of these types it is called on.
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
This patch switches to an explicit heirarchy based on shared
|
|
Eduardo Lima (Etrunko) |
493beb |
functionality. To allow use of OBJECT_DECLARE_SIMPLE_TYPE()
|
|
Eduardo Lima (Etrunko) |
493beb |
whilst minimizing code changes, all types are renamed to have
|
|
Eduardo Lima (Etrunko) |
493beb |
the postfix _DEV rather than _DEVICE. The new heirarchy
|
|
Eduardo Lima (Etrunko) |
493beb |
has PXB_CXL_DEV with parent PXB_PCIE_DEV which in turn
|
|
Eduardo Lima (Etrunko) |
493beb |
has parent PXB_DEV which continues to have parent PCI_DEVICE.
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
This allows simple use of PXB_DEV() etc rather than a custom function
|
|
Eduardo Lima (Etrunko) |
493beb |
+ removal of duplicated properties and moving the CXL specific
|
|
Eduardo Lima (Etrunko) |
493beb |
elements out of struct PXBDev.
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Eduardo Lima (Etrunko) |
493beb |
---
|
|
Eduardo Lima (Etrunko) |
493beb |
hw/acpi/cxl.c | 11 +++---
|
|
Eduardo Lima (Etrunko) |
493beb |
hw/cxl/cxl-host.c | 4 +-
|
|
Eduardo Lima (Etrunko) |
493beb |
hw/pci-bridge/pci_expander_bridge.c | 59 ++++++++++-------------------
|
|
Eduardo Lima (Etrunko) |
493beb |
include/hw/cxl/cxl.h | 4 +-
|
|
Eduardo Lima (Etrunko) |
493beb |
include/hw/pci/pci_bridge.h | 28 ++++++++++----
|
|
Eduardo Lima (Etrunko) |
493beb |
5 files changed, 49 insertions(+), 57 deletions(-)
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
diff --git a/hw/acpi/cxl.c b/hw/acpi/cxl.c
|
|
Eduardo Lima (Etrunko) |
493beb |
index 2bf8c07993..92b46bc932 100644
|
|
Eduardo Lima (Etrunko) |
493beb |
--- a/hw/acpi/cxl.c
|
|
Eduardo Lima (Etrunko) |
493beb |
+++ b/hw/acpi/cxl.c
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -30,9 +30,10 @@
|
|
Eduardo Lima (Etrunko) |
493beb |
#include "qapi/error.h"
|
|
Eduardo Lima (Etrunko) |
493beb |
#include "qemu/uuid.h"
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
-static void cedt_build_chbs(GArray *table_data, PXBDev *cxl)
|
|
Eduardo Lima (Etrunko) |
493beb |
+static void cedt_build_chbs(GArray *table_data, PXBCXLDev *cxl)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
- SysBusDevice *sbd = SYS_BUS_DEVICE(cxl->cxl.cxl_host_bridge);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBDev *pxb = PXB_DEV(cxl);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ SysBusDevice *sbd = SYS_BUS_DEVICE(cxl->cxl_host_bridge);
|
|
Eduardo Lima (Etrunko) |
493beb |
struct MemoryRegion *mr = sbd->mmio[0].memory;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
/* Type */
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -45,7 +46,7 @@ static void cedt_build_chbs(GArray *table_data, PXBDev *cxl)
|
|
Eduardo Lima (Etrunko) |
493beb |
build_append_int_noprefix(table_data, 32, 2);
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
/* UID - currently equal to bus number */
|
|
Eduardo Lima (Etrunko) |
493beb |
- build_append_int_noprefix(table_data, cxl->bus_nr, 4);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ build_append_int_noprefix(table_data, pxb->bus_nr, 4);
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
/* Version */
|
|
Eduardo Lima (Etrunko) |
493beb |
build_append_int_noprefix(table_data, 1, 4);
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -112,7 +113,7 @@ static void cedt_build_cfmws(GArray *table_data, CXLState *cxls)
|
|
Eduardo Lima (Etrunko) |
493beb |
/* Host Bridge List (list of UIDs - currently bus_nr) */
|
|
Eduardo Lima (Etrunko) |
493beb |
for (i = 0; i < fw->num_targets; i++) {
|
|
Eduardo Lima (Etrunko) |
493beb |
g_assert(fw->target_hbs[i]);
|
|
Eduardo Lima (Etrunko) |
493beb |
- build_append_int_noprefix(table_data, fw->target_hbs[i]->bus_nr, 4);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ build_append_int_noprefix(table_data, PXB_DEV(fw->target_hbs[i])->bus_nr, 4);
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -121,7 +122,7 @@ static int cxl_foreach_pxb_hb(Object *obj, void *opaque)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
Aml *cedt = opaque;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
- if (object_dynamic_cast(obj, TYPE_PXB_CXL_DEVICE)) {
|
|
Eduardo Lima (Etrunko) |
493beb |
+ if (object_dynamic_cast(obj, TYPE_PXB_CXL_DEV)) {
|
|
Eduardo Lima (Etrunko) |
493beb |
cedt_build_chbs(cedt->buf, PXB_CXL_DEV(obj));
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c
|
|
Eduardo Lima (Etrunko) |
493beb |
index 6e923ceeaf..034c7805b3 100644
|
|
Eduardo Lima (Etrunko) |
493beb |
--- a/hw/cxl/cxl-host.c
|
|
Eduardo Lima (Etrunko) |
493beb |
+++ b/hw/cxl/cxl-host.c
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -84,7 +84,7 @@ void cxl_fmws_link_targets(CXLState *cxl_state, Error **errp)
|
|
Eduardo Lima (Etrunko) |
493beb |
bool ambig;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
o = object_resolve_path_type(fw->targets[i],
|
|
Eduardo Lima (Etrunko) |
493beb |
- TYPE_PXB_CXL_DEVICE,
|
|
Eduardo Lima (Etrunko) |
493beb |
+ TYPE_PXB_CXL_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
&ambig);
|
|
Eduardo Lima (Etrunko) |
493beb |
if (!o) {
|
|
Eduardo Lima (Etrunko) |
493beb |
error_setg(errp, "Could not resolve CXLFM target %s",
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -141,7 +141,7 @@ static PCIDevice *cxl_cfmws_find_device(CXLFixedWindow *fw, hwaddr addr)
|
|
Eduardo Lima (Etrunko) |
493beb |
addr += fw->base;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
rb_index = (addr / cxl_decode_ig(fw->enc_int_gran)) % fw->num_targets;
|
|
Eduardo Lima (Etrunko) |
493beb |
- hb = PCI_HOST_BRIDGE(fw->target_hbs[rb_index]->cxl.cxl_host_bridge);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ hb = PCI_HOST_BRIDGE(fw->target_hbs[rb_index]->cxl_host_bridge);
|
|
Eduardo Lima (Etrunko) |
493beb |
if (!hb || !hb->bus || !pci_bus_is_cxl(hb->bus)) {
|
|
Eduardo Lima (Etrunko) |
493beb |
return NULL;
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
|
|
Eduardo Lima (Etrunko) |
493beb |
index a78327b5f2..613857b601 100644
|
|
Eduardo Lima (Etrunko) |
493beb |
--- a/hw/pci-bridge/pci_expander_bridge.c
|
|
Eduardo Lima (Etrunko) |
493beb |
+++ b/hw/pci-bridge/pci_expander_bridge.c
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -50,24 +50,8 @@ struct PXBBus {
|
|
Eduardo Lima (Etrunko) |
493beb |
char bus_path[8];
|
|
Eduardo Lima (Etrunko) |
493beb |
};
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
-#define TYPE_PXB_DEVICE "pxb"
|
|
Eduardo Lima (Etrunko) |
493beb |
-DECLARE_INSTANCE_CHECKER(PXBDev, PXB_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
- TYPE_PXB_DEVICE)
|
|
Eduardo Lima (Etrunko) |
493beb |
-
|
|
Eduardo Lima (Etrunko) |
493beb |
-#define TYPE_PXB_PCIE_DEVICE "pxb-pcie"
|
|
Eduardo Lima (Etrunko) |
493beb |
-DECLARE_INSTANCE_CHECKER(PXBDev, PXB_PCIE_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
- TYPE_PXB_PCIE_DEVICE)
|
|
Eduardo Lima (Etrunko) |
493beb |
-
|
|
Eduardo Lima (Etrunko) |
493beb |
-static PXBDev *convert_to_pxb(PCIDevice *dev)
|
|
Eduardo Lima (Etrunko) |
493beb |
-{
|
|
Eduardo Lima (Etrunko) |
493beb |
- /* A CXL PXB's parent bus is PCIe, so the normal check won't work */
|
|
Eduardo Lima (Etrunko) |
493beb |
- if (object_dynamic_cast(OBJECT(dev), TYPE_PXB_CXL_DEVICE)) {
|
|
Eduardo Lima (Etrunko) |
493beb |
- return PXB_CXL_DEV(dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
- }
|
|
Eduardo Lima (Etrunko) |
493beb |
-
|
|
Eduardo Lima (Etrunko) |
493beb |
- return pci_bus_is_express(pci_get_bus(dev))
|
|
Eduardo Lima (Etrunko) |
493beb |
- ? PXB_PCIE_DEV(dev) : PXB_DEV(dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
-}
|
|
Eduardo Lima (Etrunko) |
493beb |
+#define TYPE_PXB_PCIE_DEV "pxb-pcie"
|
|
Eduardo Lima (Etrunko) |
493beb |
+OBJECT_DECLARE_SIMPLE_TYPE(PXBPCIEDev, PXB_PCIE_DEV)
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static GList *pxb_dev_list;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -89,14 +73,14 @@ bool cxl_get_hb_passthrough(PCIHostState *hb)
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static int pxb_bus_num(PCIBus *bus)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
- PXBDev *pxb = convert_to_pxb(bus->parent_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBDev *pxb = PXB_DEV(bus->parent_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
return pxb->bus_nr;
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static uint16_t pxb_bus_numa_node(PCIBus *bus)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
- PXBDev *pxb = convert_to_pxb(bus->parent_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBDev *pxb = PXB_DEV(bus->parent_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
return pxb->numa_node;
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -154,7 +138,7 @@ static char *pxb_host_ofw_unit_address(const SysBusDevice *dev)
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
pxb_host = PCI_HOST_BRIDGE(dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
pxb_bus = pxb_host->bus;
|
|
Eduardo Lima (Etrunko) |
493beb |
- pxb_dev = convert_to_pxb(pxb_bus->parent_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ pxb_dev = PXB_DEV(pxb_bus->parent_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
position = g_list_index(pxb_dev_list, pxb_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
assert(position >= 0);
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -212,8 +196,8 @@ static void pxb_cxl_realize(DeviceState *dev, Error **errp)
|
|
Eduardo Lima (Etrunko) |
493beb |
*/
|
|
Eduardo Lima (Etrunko) |
493beb |
void pxb_cxl_hook_up_registers(CXLState *cxl_state, PCIBus *bus, Error **errp)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
- PXBDev *pxb = PXB_CXL_DEV(pci_bridge_get_device(bus));
|
|
Eduardo Lima (Etrunko) |
493beb |
- CXLHost *cxl = pxb->cxl.cxl_host_bridge;
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBCXLDev *pxb = PXB_CXL_DEV(pci_bridge_get_device(bus));
|
|
Eduardo Lima (Etrunko) |
493beb |
+ CXLHost *cxl = pxb->cxl_host_bridge;
|
|
Eduardo Lima (Etrunko) |
493beb |
CXLComponentState *cxl_cstate = &cxl->cxl_cstate;
|
|
Eduardo Lima (Etrunko) |
493beb |
struct MemoryRegion *mr = &cxl_cstate->crb.component_registers;
|
|
Eduardo Lima (Etrunko) |
493beb |
hwaddr offset;
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -299,7 +283,7 @@ static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin)
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static void pxb_cxl_dev_reset(DeviceState *dev)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
- CXLHost *cxl = PXB_CXL_DEV(dev)->cxl.cxl_host_bridge;
|
|
Eduardo Lima (Etrunko) |
493beb |
+ CXLHost *cxl = PXB_CXL_DEV(dev)->cxl_host_bridge;
|
|
Eduardo Lima (Etrunko) |
493beb |
CXLComponentState *cxl_cstate = &cxl->cxl_cstate;
|
|
Eduardo Lima (Etrunko) |
493beb |
PCIHostState *hb = PCI_HOST_BRIDGE(cxl);
|
|
Eduardo Lima (Etrunko) |
493beb |
uint32_t *reg_state = cxl_cstate->crb.cache_mem_registers;
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -337,7 +321,7 @@ static gint pxb_compare(gconstpointer a, gconstpointer b)
|
|
Eduardo Lima (Etrunko) |
493beb |
static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type,
|
|
Eduardo Lima (Etrunko) |
493beb |
Error **errp)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
- PXBDev *pxb = convert_to_pxb(dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBDev *pxb = PXB_DEV(dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
DeviceState *ds, *bds = NULL;
|
|
Eduardo Lima (Etrunko) |
493beb |
PCIBus *bus;
|
|
Eduardo Lima (Etrunko) |
493beb |
const char *dev_name = NULL;
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -365,7 +349,7 @@ static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type,
|
|
Eduardo Lima (Etrunko) |
493beb |
} else if (type == CXL) {
|
|
Eduardo Lima (Etrunko) |
493beb |
bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_CXL_BUS);
|
|
Eduardo Lima (Etrunko) |
493beb |
bus->flags |= PCI_BUS_CXL;
|
|
Eduardo Lima (Etrunko) |
493beb |
- PXB_CXL_DEV(dev)->cxl.cxl_host_bridge = PXB_CXL_HOST(ds);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXB_CXL_DEV(dev)->cxl_host_bridge = PXB_CXL_HOST(ds);
|
|
Eduardo Lima (Etrunko) |
493beb |
} else {
|
|
Eduardo Lima (Etrunko) |
493beb |
bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS);
|
|
Eduardo Lima (Etrunko) |
493beb |
bds = qdev_new("pci-bridge");
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -418,7 +402,7 @@ static void pxb_dev_realize(PCIDevice *dev, Error **errp)
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static void pxb_dev_exitfn(PCIDevice *pci_dev)
|
|
Eduardo Lima (Etrunko) |
493beb |
{
|
|
Eduardo Lima (Etrunko) |
493beb |
- PXBDev *pxb = convert_to_pxb(pci_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBDev *pxb = PXB_DEV(pci_dev);
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
pxb_dev_list = g_list_remove(pxb_dev_list, pxb);
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -449,7 +433,7 @@ static void pxb_dev_class_init(ObjectClass *klass, void *data)
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static const TypeInfo pxb_dev_info = {
|
|
Eduardo Lima (Etrunko) |
493beb |
- .name = TYPE_PXB_DEVICE,
|
|
Eduardo Lima (Etrunko) |
493beb |
+ .name = TYPE_PXB_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
.parent = TYPE_PCI_DEVICE,
|
|
Eduardo Lima (Etrunko) |
493beb |
.instance_size = sizeof(PXBDev),
|
|
Eduardo Lima (Etrunko) |
493beb |
.class_init = pxb_dev_class_init,
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -481,15 +465,14 @@ static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data)
|
|
Eduardo Lima (Etrunko) |
493beb |
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
dc->desc = "PCI Express Expander Bridge";
|
|
Eduardo Lima (Etrunko) |
493beb |
- device_class_set_props(dc, pxb_dev_properties);
|
|
Eduardo Lima (Etrunko) |
493beb |
dc->hotpluggable = false;
|
|
Eduardo Lima (Etrunko) |
493beb |
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static const TypeInfo pxb_pcie_dev_info = {
|
|
Eduardo Lima (Etrunko) |
493beb |
- .name = TYPE_PXB_PCIE_DEVICE,
|
|
Eduardo Lima (Etrunko) |
493beb |
- .parent = TYPE_PCI_DEVICE,
|
|
Eduardo Lima (Etrunko) |
493beb |
- .instance_size = sizeof(PXBDev),
|
|
Eduardo Lima (Etrunko) |
493beb |
+ .name = TYPE_PXB_PCIE_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
+ .parent = TYPE_PXB_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
+ .instance_size = sizeof(PXBPCIEDev),
|
|
Eduardo Lima (Etrunko) |
493beb |
.class_init = pxb_pcie_dev_class_init,
|
|
Eduardo Lima (Etrunko) |
493beb |
.interfaces = (InterfaceInfo[]) {
|
|
Eduardo Lima (Etrunko) |
493beb |
{ INTERFACE_CONVENTIONAL_PCI_DEVICE },
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -510,11 +493,7 @@ static void pxb_cxl_dev_realize(PCIDevice *dev, Error **errp)
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static Property pxb_cxl_dev_properties[] = {
|
|
Eduardo Lima (Etrunko) |
493beb |
- /* Note: 0 is not a legal PXB bus number. */
|
|
Eduardo Lima (Etrunko) |
493beb |
- DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0),
|
|
Eduardo Lima (Etrunko) |
493beb |
- DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED),
|
|
Eduardo Lima (Etrunko) |
493beb |
- DEFINE_PROP_BOOL("bypass_iommu", PXBDev, bypass_iommu, false),
|
|
Eduardo Lima (Etrunko) |
493beb |
- DEFINE_PROP_BOOL("hdm_for_passthrough", PXBDev, hdm_for_passthrough, false),
|
|
Eduardo Lima (Etrunko) |
493beb |
+ DEFINE_PROP_BOOL("hdm_for_passthrough", PXBCXLDev, hdm_for_passthrough, false),
|
|
Eduardo Lima (Etrunko) |
493beb |
DEFINE_PROP_END_OF_LIST(),
|
|
Eduardo Lima (Etrunko) |
493beb |
};
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -540,9 +519,9 @@ static void pxb_cxl_dev_class_init(ObjectClass *klass, void *data)
|
|
Eduardo Lima (Etrunko) |
493beb |
}
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
static const TypeInfo pxb_cxl_dev_info = {
|
|
Eduardo Lima (Etrunko) |
493beb |
- .name = TYPE_PXB_CXL_DEVICE,
|
|
Eduardo Lima (Etrunko) |
493beb |
- .parent = TYPE_PCI_DEVICE,
|
|
Eduardo Lima (Etrunko) |
493beb |
- .instance_size = sizeof(PXBDev),
|
|
Eduardo Lima (Etrunko) |
493beb |
+ .name = TYPE_PXB_CXL_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
+ .parent = TYPE_PXB_PCIE_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
+ .instance_size = sizeof(PXBCXLDev),
|
|
Eduardo Lima (Etrunko) |
493beb |
.class_init = pxb_cxl_dev_class_init,
|
|
Eduardo Lima (Etrunko) |
493beb |
.interfaces =
|
|
Eduardo Lima (Etrunko) |
493beb |
(InterfaceInfo[]){
|
|
Eduardo Lima (Etrunko) |
493beb |
diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h
|
|
Eduardo Lima (Etrunko) |
493beb |
index b2cffbb364..c453983e83 100644
|
|
Eduardo Lima (Etrunko) |
493beb |
--- a/include/hw/cxl/cxl.h
|
|
Eduardo Lima (Etrunko) |
493beb |
+++ b/include/hw/cxl/cxl.h
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -23,12 +23,12 @@
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
#define CXL_WINDOW_MAX 10
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
-typedef struct PXBDev PXBDev;
|
|
Eduardo Lima (Etrunko) |
493beb |
+typedef struct PXBCXLDev PXBCXLDev;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
typedef struct CXLFixedWindow {
|
|
Eduardo Lima (Etrunko) |
493beb |
uint64_t size;
|
|
Eduardo Lima (Etrunko) |
493beb |
char **targets;
|
|
Eduardo Lima (Etrunko) |
493beb |
- PXBDev *target_hbs[8];
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBCXLDev *target_hbs[8];
|
|
Eduardo Lima (Etrunko) |
493beb |
uint8_t num_targets;
|
|
Eduardo Lima (Etrunko) |
493beb |
uint8_t enc_int_ways;
|
|
Eduardo Lima (Etrunko) |
493beb |
uint8_t enc_int_gran;
|
|
Eduardo Lima (Etrunko) |
493beb |
diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
|
|
Eduardo Lima (Etrunko) |
493beb |
index 1677176b2a..01670e9e65 100644
|
|
Eduardo Lima (Etrunko) |
493beb |
--- a/include/hw/pci/pci_bridge.h
|
|
Eduardo Lima (Etrunko) |
493beb |
+++ b/include/hw/pci/pci_bridge.h
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -84,7 +84,7 @@ struct PCIBridge {
|
|
Eduardo Lima (Etrunko) |
493beb |
#define PCI_BRIDGE_DEV_PROP_SHPC "shpc"
|
|
Eduardo Lima (Etrunko) |
493beb |
typedef struct CXLHost CXLHost;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
-struct PXBDev {
|
|
Eduardo Lima (Etrunko) |
493beb |
+typedef struct PXBDev {
|
|
Eduardo Lima (Etrunko) |
493beb |
/*< private >*/
|
|
Eduardo Lima (Etrunko) |
493beb |
PCIDevice parent_obj;
|
|
Eduardo Lima (Etrunko) |
493beb |
/*< public >*/
|
|
Eduardo Lima (Etrunko) |
493beb |
@@ -92,15 +92,27 @@ struct PXBDev {
|
|
Eduardo Lima (Etrunko) |
493beb |
uint8_t bus_nr;
|
|
Eduardo Lima (Etrunko) |
493beb |
uint16_t numa_node;
|
|
Eduardo Lima (Etrunko) |
493beb |
bool bypass_iommu;
|
|
Eduardo Lima (Etrunko) |
493beb |
+} PXBDev;
|
|
Eduardo Lima (Etrunko) |
493beb |
+
|
|
Eduardo Lima (Etrunko) |
493beb |
+typedef struct PXBPCIEDev {
|
|
Eduardo Lima (Etrunko) |
493beb |
+ /*< private >*/
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBDev parent_obj;
|
|
Eduardo Lima (Etrunko) |
493beb |
+} PXBPCIEDev;
|
|
Eduardo Lima (Etrunko) |
493beb |
+
|
|
Eduardo Lima (Etrunko) |
493beb |
+#define TYPE_PXB_DEV "pxb"
|
|
Eduardo Lima (Etrunko) |
493beb |
+OBJECT_DECLARE_SIMPLE_TYPE(PXBDev, PXB_DEV)
|
|
Eduardo Lima (Etrunko) |
493beb |
+
|
|
Eduardo Lima (Etrunko) |
493beb |
+typedef struct PXBCXLDev {
|
|
Eduardo Lima (Etrunko) |
493beb |
+ /*< private >*/
|
|
Eduardo Lima (Etrunko) |
493beb |
+ PXBPCIEDev parent_obj;
|
|
Eduardo Lima (Etrunko) |
493beb |
+ /*< public >*/
|
|
Eduardo Lima (Etrunko) |
493beb |
+
|
|
Eduardo Lima (Etrunko) |
493beb |
bool hdm_for_passthrough;
|
|
Eduardo Lima (Etrunko) |
493beb |
- struct cxl_dev {
|
|
Eduardo Lima (Etrunko) |
493beb |
- CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */
|
|
Eduardo Lima (Etrunko) |
493beb |
- } cxl;
|
|
Eduardo Lima (Etrunko) |
493beb |
-};
|
|
Eduardo Lima (Etrunko) |
493beb |
+ CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */
|
|
Eduardo Lima (Etrunko) |
493beb |
+} PXBCXLDev;
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
-#define TYPE_PXB_CXL_DEVICE "pxb-cxl"
|
|
Eduardo Lima (Etrunko) |
493beb |
-DECLARE_INSTANCE_CHECKER(PXBDev, PXB_CXL_DEV,
|
|
Eduardo Lima (Etrunko) |
493beb |
- TYPE_PXB_CXL_DEVICE)
|
|
Eduardo Lima (Etrunko) |
493beb |
+#define TYPE_PXB_CXL_DEV "pxb-cxl"
|
|
Eduardo Lima (Etrunko) |
493beb |
+OBJECT_DECLARE_SIMPLE_TYPE(PXBCXLDev, PXB_CXL_DEV)
|
|
Eduardo Lima (Etrunko) |
493beb |
|
|
Eduardo Lima (Etrunko) |
493beb |
int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset,
|
|
Eduardo Lima (Etrunko) |
493beb |
uint16_t svid, uint16_t ssid,
|
|
Eduardo Lima (Etrunko) |
493beb |
--
|
|
Eduardo Lima (Etrunko) |
493beb |
2.40.0
|
|
Eduardo Lima (Etrunko) |
493beb |
|