PCI root buses can be attached to a specific NUMA node. PCI buses are not attached be default to a NUMA node.
Signed-off-by: Marcel Apfelbaum marcel@redhat.com --- hw/pci/pci_bus.c | 7 +++++++ include/hw/pci/pci_bus.h | 6 ++++++ include/sysemu/sysemu.h | 1 + 3 files changed, 14 insertions(+)
diff --git a/hw/pci/pci_bus.c b/hw/pci/pci_bus.c index ed99208..15882a7 100644 --- a/hw/pci/pci_bus.c +++ b/hw/pci/pci_bus.c @@ -13,6 +13,7 @@ #include "hw/pci/pci_bus.h" #include "hw/pci/pci_bridge.h" #include "monitor/monitor.h" +#include "sysemu/sysemu.h"
typedef struct { uint16_t class; @@ -478,6 +479,11 @@ static int pcibus_num(PCIBus *bus) return bus->parent_dev->config[PCI_SECONDARY_BUS]; }
+static uint16_t pcibus_numa_node(PCIBus *bus) +{ + return NUMA_NODE_UNASSIGNED; +} + static void pci_bus_class_init(ObjectClass *klass, void *data) { BusClass *k = BUS_CLASS(klass); @@ -492,6 +498,7 @@ static void pci_bus_class_init(ObjectClass *klass, void *data)
pbc->is_root = pcibus_is_root; pbc->bus_num = pcibus_num; + pbc->numa_node = pcibus_numa_node; }
static const TypeInfo pci_bus_info = { diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h index 553814e..75cd1fa 100644 --- a/include/hw/pci/pci_bus.h +++ b/include/hw/pci/pci_bus.h @@ -25,6 +25,7 @@ typedef struct PCIBusClass {
bool (*is_root)(PCIBus *bus); int (*bus_num)(PCIBus *bus); + uint16_t (*numa_node)(PCIBus *bus); } PCIBusClass;
struct PCIBus { @@ -60,6 +61,11 @@ static inline int pci_bus_num(PCIBus *bus) return PCI_BUS_GET_CLASS(bus)->bus_num(bus); }
+static inline int pci_bus_numa_node(PCIBus *bus) +{ + return PCI_BUS_GET_CLASS(bus)->numa_node(bus); +} + typedef struct PCIBridgeWindows PCIBridgeWindows;
/* diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index e7135e1..934eb5d 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -136,6 +136,7 @@ extern const char *mem_path; extern int mem_prealloc;
#define MAX_NODES 128 +#define NUMA_NODE_UNASSIGNED MAX_NODES
/* The following shall be true for all CPUs: * cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS