On 28/9/26 11:56, Daniel P. Berrangé wrote:
If CONFIG_CXL=n is added to the Kconfig, the build fails to link
the PXB device:

/usr/bin/ld.bfd: libsystem.a.p/hw_pci-bridge_pci_expander_bridge.c.o: in 
function `pxb_cxl_realize':
/home/berrange/src/virt/qemu/build/../hw/pci-bridge/pci_expander_bridge.c:202:(.text+0x330):
 undefined reference to `cxl_component_register_block_init'
/usr/bin/ld.bfd: libsystem.a.p/hw_pci-bridge_pci_expander_bridge.c.o: in 
function `pxb_cxl_dev_reset':
/home/berrange/src/virt/qemu/build/../hw/pci-bridge/pci_expander_bridge.c:309:(.text+0x768):
 undefined reference to `cxl_component_register_init_common'

We cannot use CONFIG_CXL in pci_expander_bridge.c because the
identifier is poisoned. Instead the CXL pieces must be split
off into a separate source file which can be conditionally
built.

With this change, the stubs file is no longer required, since
the code referencing the stub was already protected by CONFIG_CXL.

Fixes: 6e4e3ae936 (hw/cxl/component: Implement host bridge MMIO (8.2.5, table 
142))
Signed-off-by: Daniel P. Berrangé <[email protected]>
---
  hw/cxl/cxl-host.c                             |   2 +-
  hw/pci-bridge/meson.build                     |   4 +-
  hw/pci-bridge/pci_expander_bridge.c           | 194 +----------------
  hw/pci-bridge/pci_expander_bridge_common.h    |  29 +++
  hw/pci-bridge/pci_expander_bridge_cxl.c       | 201 ++++++++++++++++++
  hw/pci-bridge/pci_expander_bridge_stubs.c     |  14 --
  ...der_bridge.h => pci_expander_bridge_cxl.h} |   0
  7 files changed, 242 insertions(+), 202 deletions(-)
  create mode 100644 hw/pci-bridge/pci_expander_bridge_common.h
  create mode 100644 hw/pci-bridge/pci_expander_bridge_cxl.c
  delete mode 100644 hw/pci-bridge/pci_expander_bridge_stubs.c
  rename include/hw/pci-bridge/{pci_expander_bridge.h => 
pci_expander_bridge_cxl.h} (100%)


diff --git a/hw/pci-bridge/pci_expander_bridge_common.h 
b/hw/pci-bridge/pci_expander_bridge_common.h
new file mode 100644
index 00000000000..fc5d1ac8691
--- /dev/null
+++ b/hw/pci-bridge/pci_expander_bridge_common.h
@@ -0,0 +1,29 @@
+/*
+ * PCI Expander Bridge Device Emulation Common Code
+ *
+ * Copyright (C) 2015 Red Hat Inc
+ *
+ * Authors:
+ *   Marcel Apfelbaum <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+enum BusType { PCI, PCIE, CXL };
+
+typedef struct PXBBus PXBBus;
+
+struct PXBBus {
+    /*< private >*/
+    PCIBus parent_obj;
+    /*< public >*/

We updated our coding style to not use these private/public comments
anymore. I can remove them if MST is OK to merge via hw-misc tree.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>

+
+    char bus_path[8];
+};


Reply via email to