Skip to contentSkip to conversation

[7212] sending NUMA topology to BIOS (Andre Przywara)

Qemu-devel Anthony Liguori 1 participant 1 message Apr 21, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 7212

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7212
Author:   aliguori
Date:     2009-04-21 22:31:41 +0000 (Tue, 21 Apr 2009)

Log Message:
-----------
sending NUMA topology to BIOS (Andre Przywara)

uses the QEMU firmware configuration interfacce to send the NUMA topology to the BIOS, which has to setup the tables. Only one firmware configuration channel is used.

Modified Paths:
--------------
trunk/hw/fw_cfg.h
trunk/hw/pc.c
trunk/pc-bios/bios-pq/series
trunk/pc-bios/bios.bin

Added Paths:
-----------
trunk/pc-bios/bios-pq/0014_add-srat-acpi-table-support.patch

Modified: trunk/hw/fw_cfg.h
===================================================================

hw/fw_cfg.h +1 -0
@@ -14,6 +14,7 @@
 #define FW_CFG_INITRD_ADDR      0x0a
 #define FW_CFG_INITRD_SIZE      0x0b
 #define FW_CFG_BOOT_DEVICE      0x0c
+#define FW_CFG_NUMA             0x0d
 #define FW_CFG_MAX_ENTRY        0x10
 
 #define FW_CFG_WRITE_CHANNEL    0x4000

Modified: trunk/hw/pc.c
===================================================================

hw/pc.c +24 -0
@@ -424,11 +424,15 @@
     }
 }
 
+extern uint64_t node_cpumask[MAX_NODES];
+
 static void bochs_bios_init(void)
 {
     void *fw_cfg;
     uint8_t *smbios_table;
     size_t smbios_len;
+    uint64_t *numa_fw_cfg;
+    int i, j;
 
     register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL);
     register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL);
@@ -451,6 +455,26 @@
     if (smbios_table)
         fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
                          smbios_table, smbios_len);
+
+    /* allocate memory for the NUMA channel: one (64bit) word for the number
+     * of nodes, one word for each VCPU->node and one word for each node to
+     * hold the amount of memory.
+     */
+    numa_fw_cfg = qemu_mallocz((1 + smp_cpus + nb_numa_nodes) * 8);
+    numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes);
+    for (i = 0; i < smp_cpus; i++) {
+        for (j = 0; j < nb_numa_nodes; j++) {
+            if (node_cpumask[j] & (1 << i)) {
+                numa_fw_cfg[i + 1] = cpu_to_le64(j);
+                break;
+            }
+        }
+    }
+    for (i = 0; i < nb_numa_nodes; i++) {
+        numa_fw_cfg[smp_cpus + 1 + i] = cpu_to_le64(node_mem[i]);
+    }
+    fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg,
+                     (1 + smp_cpus + nb_numa_nodes) * 8);
 }
 
 /* Generate an initial boot sector which sets state and jump to

Added: trunk/pc-bios/bios-pq/0014_add-srat-acpi-table-support.patch
===================================================================

pc-bios/bios-pq/0014_add-srat-acpi-table-support.patch +305 -0

305 lines not on this page · raw message

Modified: trunk/pc-bios/bios-pq/series
===================================================================

pc-bios/bios-pq/series +1 -0
@@ -11,3 +11,4 @@
 0011_read-additional-acpi-tables-from-a-vm.patch
 0012-load-smbios-entries-and-files-from-qemu.patch
 0013_fix-non-acpi-timer-interrupt-routing.patch
+0014_add-srat-acpi-table-support.patch

Modified: trunk/pc-bios/bios.bin
===================================================================
(Binary files differ)