Skip to contentSkip to conversation

publish etc/acpi/APIC in fw_cfg

PATCH Superseded Laszlo Ersek 1 participant 6 messages Apr 8, 2013

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover publish etc/acpi/APIC in fw_cfg

This series exports the MADT (APIC) ACPI table under the new "etc/acpi/APIC" fw_cfg file. I sought to follow the requirements set forth in [1], the new table is only visible in the patched/patched case. I cross-tested { master, patched } qemu with { master, patched } seabios (the APIC, DSDT and RSDT tables) using guest acpidump and dmesg.

The -acpitable command line option is purposely ignored based on the last paragraph of [2]; the user isn't supposed to pass APIC with that option.

checkpatch.pl complains a little but (as last time) it's a false alarm.

The series is bisectable.

[1] http://thread.gmane.org/gmane.comp.emulators.qemu/202005/focus=202072
[2] http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5960/focus=6008

Laszlo Ersek (5):
refer to FWCfgState explicitly
hw/acpi: extract standard table headers as a standalone structure hw/acpi: export default ACPI headers using the type just introduced hw/acpi: export acpi_checksum()
i386/pc: build ACPI MADT (APIC) for fw_cfg clients

 hw/acpi.h           |   15 +++++
 hw/loader.h         |    3 +-
 hw/multiboot.h      |    4 +-
 hw/pc.h             |   20 ++++---
 hw/acpi.c           |   89 ++++++++++++++-------------
 hw/acpi_piix4.c     |    2 +-
 hw/i386/multiboot.c |    2 +-
 hw/i386/pc.c        |  166 +++++++++++++++++++++++++++++++++++++++++++++++----
 hw/i386/pc_piix.c   |    4 +-
 hw/i386/pc_q35.c    |   10 ++-
 hw/loader.c         |    2 +-
 hw/sparc/sun4m.c    |    6 +-
 hw/sparc64/sun4u.c  |    2 +-
 13 files changed, 248 insertions(+), 77 deletions(-)
#1 lore raw

PATCH 1/5 refer to FWCfgState explicitly

Soon we'll declare a function in "hw/pc.h" that takes a pointer-to-FWCfgState. That would be inconsistent with current usage -- some places use pointer-to-void now even though they mean pointer-to-FWCfgState. Clean them up.

---
 hw/loader.h         |    3 ++-
 hw/multiboot.h      |    4 +++-
 hw/pc.h             |   19 ++++++++++---------
 hw/acpi_piix4.c     |    2 +-
 hw/i386/multiboot.c |    2 +-
 hw/i386/pc.c        |   24 ++++++++++++------------
 hw/i386/pc_piix.c   |    2 +-
 hw/loader.c         |    2 +-
 hw/sparc/sun4m.c    |    6 +++---
 hw/sparc64/sun4u.c  |    2 +-
 10 files changed, 35 insertions(+), 31 deletions(-)
hw/loader.h +2 -1
index 0958f06..6b8b1e1 100644
@@ -1,6 +1,7 @@
 #ifndef LOADER_H
 #define LOADER_H
 #include "qapi/qmp/qdict.h"
+#include "hw/fw_cfg.h"
 
 /* loader.c */
 int get_image_size(const char *filename);
@@ -30,7 +31,7 @@ int rom_add_blob(const char *name, const void *blob, size_t len,
 int rom_add_elf_program(const char *name, void *data, size_t datasize,
                         size_t romsize, hwaddr addr);
 int rom_load_all(void);
-void rom_set_fw(void *f);
+void rom_set_fw(FWCfgState *f);
 int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
 void *rom_ptr(hwaddr addr);
 void do_info_roms(Monitor *mon, const QDict *qdict);
hw/multiboot.h +3 -1
index 98fb1b7..25589e3 100644
@@ -1,7 +1,9 @@
 #ifndef QEMU_MULTIBOOT_H
 #define QEMU_MULTIBOOT_H
 
-int load_multiboot(void *fw_cfg,
+#include "hw/fw_cfg.h"
+
+int load_multiboot(FWCfgState *fw_cfg,
                    FILE *f,
                    const char *kernel_filename,
                    const char *initrd_filename,
hw/pc.h +10 -9
index 55964ce..5e5dd3d 100644
@@ -9,6 +9,7 @@
 #include "net/net.h"
 #include "exec/memory.h"
 #include "hw/ioapic.h"
+#include "hw/fw_cfg.h"
 
 /* PC-style peripherals (also used by other machines).  */
 
@@ -80,14 +81,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
 void pc_cpus_init(const char *cpu_model);
 void pc_acpi_init(const char *default_dsdt);
-void *pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory);
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
+                           const char *kernel_filename,
+                           const char *kernel_cmdline,
+                           const char *initrd_filename,
+                           ram_addr_t below_4g_mem_size,
+                           ram_addr_t above_4g_mem_size,
+                           MemoryRegion *rom_memory,
+                           MemoryRegion **ram_memory);
 qemu_irq *pc_allocate_cpu_irq(void);
 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
 void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
@@ -119,7 +120,7 @@ void acpi_table_add(const QemuOpts *opts, Error **errp);
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, void *fw_cfg);
+                       int kvm_enabled, FWCfgState *fw_cfg);
 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
 
 /* hpet.c */
hw/acpi_piix4.c +1 -1
index 48a32b5..e168d0d 100644
@@ -435,7 +435,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, void *fw_cfg)
+                       int kvm_enabled, FWCfgState *fw_cfg)
 {
     PCIDevice *dev;
     PIIX4PMState *s;
hw/i386/multiboot.c +1 -1
index 3cb228f..b4ce1fc 100644
@@ -124,7 +124,7 @@ static void mb_add_mod(MultibootState *s,
     s->mb_mods_count++;
 }
 
-int load_multiboot(void *fw_cfg,
+int load_multiboot(FWCfgState *fw_cfg,
                    FILE *f,
                    const char *kernel_filename,
                    const char *initrd_filename,
hw/i386/pc.c +12 -12
index ebbf059..e7c88c4 100644
@@ -568,9 +568,9 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus)
     return x86_cpu_apic_id_from_index(max_cpus - 1) + 1;
 }
 
-static void *bochs_bios_init(void)
+static FWCfgState *bochs_bios_init(void)
 {
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     uint8_t *smbios_table;
     size_t smbios_len;
     uint64_t *numa_fw_cfg;
@@ -647,7 +647,7 @@ static long get_file_size(FILE *f)
     return size;
 }
 
-static void load_linux(void *fw_cfg,
+static void load_linux(FWCfgState *fw_cfg,
                        const char *kernel_filename,
                        const char *initrd_filename,
                        const char *kernel_cmdline,
@@ -923,19 +923,19 @@ void pc_acpi_init(const char *default_dsdt)
     }
 }
 
-void *pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory)
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
+                           const char *kernel_filename,
+                           const char *kernel_cmdline,
+                           const char *initrd_filename,
+                           ram_addr_t below_4g_mem_size,
+                           ram_addr_t above_4g_mem_size,
+                           MemoryRegion *rom_memory,
+                           MemoryRegion **ram_memory)
 {
     int linux_boot, i;
     MemoryRegion *ram, *option_rom_mr;
     MemoryRegion *ram_below_4g, *ram_above_4g;
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
 
     linux_boot = (kernel_filename != NULL);
 
hw/i386/pc_piix.c +1 -1
index 0abc9f1..7761077 100644
@@ -84,7 +84,7 @@ static void pc_init1(MemoryRegion *system_memory,
     MemoryRegion *ram_memory;
     MemoryRegion *pci_memory;
     MemoryRegion *rom_memory;
-    void *fw_cfg = NULL;
+    FWCfgState *fw_cfg = NULL;
 
     pc_cpus_init(cpu_model);
     pc_acpi_init("acpi-dsdt.aml");
hw/loader.c +1 -1
index 6ce66fb..16bb8f4 100644
@@ -733,7 +733,7 @@ int rom_load_all(void)
     return 0;
 }
 
-void rom_set_fw(void *f)
+void rom_set_fw(FWCfgState *f)
 {
     fw_cfg = f;
 }
hw/sparc/sun4m.c +3 -3
index 9ebda02..ef72f0c 100644
@@ -874,7 +874,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq *cpu_halt;
     unsigned long kernel_size;
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     unsigned int num_vsimms;
 
     /* init CPUs */
@@ -1592,7 +1592,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
         espdma_irq, ledma_irq;
     qemu_irq esp_reset, dma_enable;
     unsigned long kernel_size;
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     DeviceState *dev;
 
     /* init CPUs */
@@ -1793,7 +1793,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq fdc_tc;
     unsigned long kernel_size;
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     DeviceState *dev;
     unsigned int i;
 
hw/sparc64/sun4u.c +1 -1
index 4c39cf6..08a0ffe 100644
@@ -818,7 +818,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     qemu_irq *ivec_irqs, *pbm_irqs;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
 
     /* init CPUs */
     cpu = cpu_devinit(cpu_model, hwdef);
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/5 hw/acpi: extract standard table headers as a standalone structure

In reply to Laszlo Ersek

This enables reuse when preparing per-table fw_cfg blobs later.

---
 hw/acpi.h |   11 +++++++++++
 hw/acpi.c |   48 +++++++++++++++++++++---------------------------
 2 files changed, 32 insertions(+), 27 deletions(-)
hw/acpi.h +11 -0
index e18ef28..d69b6ef 100644
@@ -154,4 +154,15 @@ void acpi_gpe_reset(ACPIREGS *ar);
 void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val);
 uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr);
 
+typedef struct acpi_table_std_header {
+    char sig[4];              /* ACPI signature (4 ASCII characters) */
+    uint32_t length;          /* Length of table, in bytes, including header */
+    uint8_t revision;         /* ACPI Specification minor version # */
+    uint8_t checksum;         /* To make sum of entire table == 0 */
+    char oem_id[6];           /* OEM identification */
+    char oem_table_id[8];     /* OEM table identification */
+    uint32_t oem_revision;    /* OEM revision number */
+    char asl_compiler_id[4];  /* ASL compiler vendor ID */
+    uint32_t asl_compiler_revision; /* ASL compiler revision number */
+} QEMU_PACKED AcpiTableStdHdr;
 #endif /* !QEMU_HW_ACPI_H */
hw/acpi.c +21 -27

102 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/5 hw/acpi: export default ACPI headers using the type just introduced

In reply to Laszlo Ersek

This enables reuse when preparing per-table fw_cfg blobs later.

---
 hw/acpi.h |    2 ++
 hw/acpi.c |   39 ++++++++++++++++++++++++---------------
 2 files changed, 26 insertions(+), 15 deletions(-)
hw/acpi.h +2 -0
index d69b6ef..e3e17e9 100644
@@ -165,4 +165,6 @@ typedef struct acpi_table_std_header {
     char asl_compiler_id[4];  /* ASL compiler vendor ID */
     uint32_t asl_compiler_revision; /* ASL compiler revision number */
 } QEMU_PACKED AcpiTableStdHdr;
+
+extern const AcpiTableStdHdr acpi_dfl_hdr;
 #endif /* !QEMU_HW_ACPI_H */
hw/acpi.c +24 -15
index 73af4bd..f24be53 100644
@@ -37,11 +37,20 @@ struct acpi_table_header {
 /* size of the extra prefix */
 #define ACPI_TABLE_PFX_SIZE offsetof(struct acpi_table_header, std)
 
-static const char unsigned dfl_hdr[sizeof(AcpiTableStdHdr)] =
-    "QEMU\0\0\0\0\1\0"       /* sig (4), len(4), revno (1), csum (1) */
-    "QEMUQEQEMUQEMU\1\0\0\0" /* OEM id (6), table (8), revno (4) */
-    "QEMU\1\0\0\0"           /* ASL compiler ID (4), version (4) */
-    ;
+const AcpiTableStdHdr acpi_dfl_hdr = {
+    .sig = "QEMU",
+    .revision = 1,
+    .oem_id = "QEMUQE",
+    .oem_table_id = "QEMUQEMU",
+    .asl_compiler_id = "QEMU",
+#ifdef HOST_WORDS_BIGENDIAN
+    .oem_revision = 0x01000000,
+    .asl_compiler_revision = 0x01000000
+#else
+    .oem_revision = 1,
+    .asl_compiler_revision = 1
+#endif
+};
 
 char unsigned *acpi_tables;
 size_t acpi_tables_len;
@@ -74,8 +83,8 @@ static int acpi_checksum(const uint8_t *data, int len)
 /* Install a copy of the ACPI table specified in @blob.
  *
  * If @has_header is set, @blob starts with the System Description Table Header
- * structure. Otherwise, "dfl_hdr" is prepended. In any case, each header field
- * is optionally overwritten from @hdrs.
+ * structure. Otherwise, "acpi_dfl_hdr" is prepended. In any case, each header
+ * field is optionally overwritten from @hdrs.
  *
  * It is valid to call this function with
  * (@blob == NULL && bloblen == 0 && !has_header).
@@ -105,13 +114,13 @@ static void acpi_table_install(const char unsigned *blob, size_t bloblen,
     if (has_header) {
         /*   _length             | ACPI header in blob | blob body
          *   ^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^
-         *   ACPI_TABLE_PFX_SIZE     sizeof dfl_hdr      body_size
+         *   ACPI_TABLE_PFX_SIZE   sizeof acpi_dfl_hdr   body_size
          *                           == body_start
          *
          *                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          *                           acpi_payload_size == bloblen
          */
-        body_start = sizeof dfl_hdr;
+        body_start = sizeof acpi_dfl_hdr;
 
         if (bloblen < body_start) {
             error_setg(errp, "ACPI table claiming to have header is too "
@@ -123,17 +132,17 @@ static void acpi_table_install(const char unsigned *blob, size_t bloblen,
     } else {
         /*   _length             | ACPI header in template | blob body
          *   ^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^
-         *   ACPI_TABLE_PFX_SIZE       sizeof dfl_hdr        body_size
+         *   ACPI_TABLE_PFX_SIZE     sizeof acpi_dfl_hdr     body_size
          *                                                   == bloblen
          *
          *                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          *                                  acpi_payload_size
          */
         body_start = 0;
-        hdr_src = dfl_hdr;
+        hdr_src = (const char unsigned *)&acpi_dfl_hdr;
     }
     body_size = bloblen - body_start;
-    acpi_payload_size = sizeof dfl_hdr + body_size;
+    acpi_payload_size = sizeof acpi_dfl_hdr + body_size;
 
     if (acpi_payload_size > UINT16_MAX) {
         error_setg(errp, "ACPI table too big, requested: %zu, max: %u",
@@ -149,13 +158,13 @@ static void acpi_table_install(const char unsigned *blob, size_t bloblen,
 
     acpi_tables = g_realloc(acpi_tables, acpi_tables_len +
                                          ACPI_TABLE_PFX_SIZE +
-                                         sizeof dfl_hdr + body_size);
+                                         sizeof acpi_dfl_hdr + body_size);
 
     ext_hdr = (struct acpi_table_header *)(acpi_tables + acpi_tables_len);
     acpi_tables_len += ACPI_TABLE_PFX_SIZE;
 
-    memcpy(acpi_tables + acpi_tables_len, hdr_src, sizeof dfl_hdr);
-    acpi_tables_len += sizeof dfl_hdr;
+    memcpy(acpi_tables + acpi_tables_len, hdr_src, sizeof acpi_dfl_hdr);
+    acpi_tables_len += sizeof acpi_dfl_hdr;
 
     if (blob != NULL) {
         memcpy(acpi_tables + acpi_tables_len, blob + body_start, body_size);
Signature · 1 line
1.7.1
#4 lore raw

PATCH 4/5 hw/acpi: export acpi_checksum()

In reply to Laszlo Ersek

Again, this enables reuse when preparing per-table fw_cfg blobs later.

---
 hw/acpi.h |    2 ++
 hw/acpi.c |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)
hw/acpi.h +2 -0
index e3e17e9..2c89e59 100644
@@ -167,4 +167,6 @@ typedef struct acpi_table_std_header {
 } QEMU_PACKED AcpiTableStdHdr;
 
 extern const AcpiTableStdHdr acpi_dfl_hdr;
+
+int acpi_checksum(const uint8_t *data, int len);
 #endif /* !QEMU_HW_ACPI_H */
hw/acpi.c +1 -1
index f24be53..07634e1 100644
@@ -69,7 +69,7 @@ static void acpi_register_config(void)
 
 machine_init(acpi_register_config);
 
-static int acpi_checksum(const uint8_t *data, int len)
+int acpi_checksum(const uint8_t *data, int len)
 {
     int sum, i;
     sum = 0;
Signature · 1 line
1.7.1
#5 lore raw

PATCH 5/5 i386/pc: build ACPI MADT (APIC) for fw_cfg clients

In reply to Laszlo Ersek

The set of per-table fw_cfg files is installed with the new function pc_acpi_fw_cfg_init().

This function is called at the end of pc_init1() and pc_q35_init():

pc_init1() or pc_q35_init()

    pc_acpi_init()             <---- very early
    /* bunch of setup code */
    pc_acpi_fw_cfg_init()      <---- added now

rather than from within pc_acpi_init() for two reasons:

(1) In general, calculation of ACPI tables could logically depend on machine data set up by pc_init1() / pc_q35_init() *after* their respective calls to pc_acpi_init().

(2) pc_acpi_fw_cfg_init() obviously depends on the FWCfgState object, which is not available when pc_acpi_init() is called:

pc_init1() and pc_q35_init()

    pc_acpi_init()
    ...
    pc_memory_init()
      bochs_bios_init()
        fw_cfg_init()          <---- FWCfgState object set up here
          sysbus_mmio_map()
        fw_cfg_add_bytes(..., acpi_tables, ...);
    ...
    pc_acpi_fw_cfg_init()      <---- added now, depends on FWCfgState

The following movements have been considered and rejected:

(2a) Pushing pc_acpi_init() below pc_memory_init(), and sinking the call to the new function pc_acpi_fw_cfg_init() into pc_acpi_init():

pc_init1() and pc_q35_init()

    ...
    pc_memory_init()
      bochs_bios_init()
        fw_cfg_init()
          sysbus_mmio_map()
        fw_cfg_add_bytes(..., acpi_tables, ...);
    ...
    pc_acpi_init()             <---- ordered after rest of setup code
      pc_acpi_fw_cfg_init()    <---- added now

Unfortunately, "acpi_tables" is modified by pc_acpi_init(), hence this move would violate a data dependency in pc_memory_init().

(2b) Alternatively, based on (2), hoisting the fw_cfg_init() call to just before pc_acpi_init(), and again sinking the call to the new function pc_acpi_fw_cfg_init() into pc_acpi_init():

  pc_init1() and pc_q35_init()
    fw_cfg_init()              <---- pulled up from bochs_bios_init()
      sysbus_mmio_map()
    pc_acpi_init()
      pc_acpi_fw_cfg_init()    <---- added now
    ...
    pc_memory_init()
      bochs_bios_init()
        fw_cfg_add_bytes(..., acpi_tables, ...);

Alas, sysbus_mmio_map() in fw_cfg_init() depends on the memory layout prepared by pc_memory_init().

Ultimately we have the following dependencies:
- pc_acpi_fw_cfg_init() depends on fw_cfg_init() [2],
- fw_cfg_init() depends on pc_memory_init() [2b],
- pc_memory_init() depends on pc_acpi_init() [2a]

This yields the total ordering visible in the patch.

---
 hw/pc.h           |    1 +
 hw/i386/pc.c      |  142 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/pc_piix.c |    2 +
 hw/i386/pc_q35.c  |   10 +++-
 4 files changed, 152 insertions(+), 3 deletions(-)
hw/pc.h +1 -0
index 5e5dd3d..0718d8f 100644
@@ -107,6 +107,7 @@ typedef void (*cpu_set_smm_t)(int smm, void *arg);
 void cpu_smm_register(cpu_set_smm_t callback, void *arg);
 
 void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
+void pc_acpi_fw_cfg_init(FWCfgState *fw_cfg);
 
 /* acpi.c */
 extern int acpi_enabled;
hw/i386/pc.c +142 -0

151 lines not on this page · raw message

hw/i386/pc_piix.c +2 -0
index 7761077..c261d50 100644
@@ -217,6 +217,8 @@ static void pc_init1(MemoryRegion *system_memory,
     if (pci_enabled) {
         pc_pci_device_init(pci_bus);
     }
+
+    pc_acpi_fw_cfg_init(fw_cfg);
 }
 
 static void pc_init_pci(QEMUMachineInitArgs *args)
hw/i386/pc_q35.c +7 -3
index 4f5f347..c852a90 100644
@@ -85,6 +85,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
     ICH9LPCState *ich9_lpc;
     PCIDevice *ahci;
     qemu_irq *cmos_s3;
+    FWCfgState *fw_cfg = NULL;
 
     pc_cpus_init(cpu_model);
     pc_acpi_init("q35-acpi-dsdt.aml");
@@ -111,9 +112,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
-        pc_memory_init(get_system_memory(), kernel_filename, kernel_cmdline,
-                       initrd_filename, below_4g_mem_size, above_4g_mem_size,
-                       rom_memory, &ram_memory);
+        fw_cfg = pc_memory_init(get_system_memory(), kernel_filename,
+                                kernel_cmdline, initrd_filename,
+                                below_4g_mem_size, above_4g_mem_size,
+                                rom_memory, &ram_memory);
     }
 
     /* irq lines */
@@ -207,6 +209,8 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
     if (pci_enabled) {
         pc_pci_device_init(host_bus);
     }
+
+    pc_acpi_fw_cfg_init(fw_cfg);
 }
 
 static QEMUMachine pc_q35_machine_v1_5 = {
Signature · 1 line
1.7.1