diff mbox series

[04/13] microvm: add minimal acpi support.

Message ID 20200319080117.7725-5-kraxel@redhat.com
State New, archived
Headers show
Series microvm: add acpi support | expand

Commit Message

Gerd Hoffmann March 19, 2020, 8:01 a.m. UTC
$subject says all.  Can be disabled using the usual -no-acpi switch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/i386/microvm.h |   3 +
 hw/i386/acpi-build.c      | 124 +++++++++++++++++++++++++++++++++++---
 hw/i386/microvm.c         |  14 +++++
 3 files changed, 133 insertions(+), 8 deletions(-)

Comments

Igor Mammedov March 19, 2020, 2 p.m. UTC | #1
On Thu, 19 Mar 2020 09:01:08 +0100
Gerd Hoffmann <kraxel@redhat.com> wrote:

> $subject says all.  Can be disabled using the usual -no-acpi switch.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  include/hw/i386/microvm.h |   3 +
>  hw/i386/acpi-build.c      | 124 +++++++++++++++++++++++++++++++++++---
>  hw/i386/microvm.c         |  14 +++++
>  3 files changed, 133 insertions(+), 8 deletions(-)
> 
> diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
> index ba68d1f22bb3..da2852a70195 100644
> --- a/include/hw/i386/microvm.h
> +++ b/include/hw/i386/microvm.h
> @@ -24,6 +24,7 @@
>  
>  #include "hw/boards.h"
>  #include "hw/i386/x86.h"
> +#include "hw/acpi/acpi_dev_interface.h"
>  
>  /* Platform virtio definitions */
>  #define VIRTIO_MMIO_BASE      0xc0000000
> @@ -58,6 +59,8 @@ typedef struct {
>  
>      /* Machine state */
>      bool kernel_cmdline_fixed;
> +    Notifier machine_done;
> +    AcpiDeviceIf *acpi_dev;
>  } MicrovmMachineState;
>  
>  #define TYPE_MICROVM_MACHINE   MACHINE_TYPE_NAME("microvm")
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 9c98b07116cc..0e45a646af56 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -59,6 +59,7 @@
>  #include "hw/pci/pci_bus.h"
>  #include "hw/pci-host/q35.h"
>  #include "hw/i386/x86-iommu.h"
> +#include "hw/i386/microvm.h"
>  
>  #include "hw/acpi/aml-build.h"
>  #include "hw/acpi/utils.h"
> @@ -2749,12 +2750,103 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
>      return true;
>  }
>  
> +static void
> +build_dsdt_microvm(GArray *table_data, BIOSLinker *linker,
> +                   MicrovmMachineState *mms)
> +{
> +    X86MachineState *x86ms = X86_MACHINE(mms);
> +    Aml *dsdt, *sb_scope, *scope, *pkg;
> +
> +    dsdt = init_aml_allocator();
> +
> +    /* Reserve space for header */
> +    acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));
> +
> +    build_dbg_aml(dsdt);
I'd drop/comment out as it's usually not used and whoever need
to debug aml can enable it when necessary.

> +
> +    sb_scope = aml_scope("_SB");
> +    acpi_dsdt_add_fw_cfg(sb_scope, OBJECT(x86ms->fw_cfg));
> +    aml_append(dsdt, sb_scope);
> +
> +    scope = aml_scope("\\");
> +    pkg = aml_package(4);
> +    aml_append(pkg, aml_int(0)); /* PM1a_CNT.SLP_TYP */
> +    aml_append(pkg, aml_int(0)); /* PM1b_CNT.SLP_TYP not impl. */
> +    aml_append(pkg, aml_int(0)); /* reserved */
> +    aml_append(pkg, aml_int(0)); /* reserved */
> +    aml_append(scope, aml_name_decl("_S5", pkg));
> +    aml_append(dsdt, scope);
> +
> +    /* copy AML table into ACPI tables blob and patch header there */
> +    g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
> +    build_header(linker, table_data,
> +        (void *)(table_data->data + table_data->len - dsdt->buf->len),
> +        "DSDT", dsdt->buf->len, 1, NULL, NULL);

make revision at least 2 or newer (like copy arm/virt 5th rev)


> +    free_aml_allocator();
> +}
> +
> +static
> +void acpi_build_microvm(AcpiBuildTables *tables, MachineState *machine)
> +{
> +    MicrovmMachineState *mms = MICROVM_MACHINE(machine);
> +    GArray *table_offsets;
> +    GArray *tables_blob = tables->table_data;
> +    AcpiFadtData pmfadt;
> +    unsigned facs, dsdt, rsdt;
> +
> +    init_common_fadt_data(machine, OBJECT(mms->acpi_dev), &pmfadt);
> +    pmfadt.smi_cmd = 0;
> +
> +    table_offsets = g_array_new(false, true /* clear */,
> +                                        sizeof(uint32_t));
> +    bios_linker_loader_alloc(tables->linker,
> +                             ACPI_BUILD_TABLE_FILE, tables_blob,
> +                             64 /* Ensure FACS is aligned */,
> +                             false /* high memory */);
> +
> +    facs = tables_blob->len;
> +    build_facs(tables_blob);
> +
> +    dsdt = tables_blob->len;
> +    build_dsdt_microvm(tables_blob, tables->linker, mms);
> +
> +    pmfadt.facs_tbl_offset = &facs;
> +    pmfadt.dsdt_tbl_offset = &dsdt;
> +    pmfadt.xdsdt_tbl_offset = &dsdt;
> +    acpi_add_table(table_offsets, tables_blob);
> +    build_fadt(tables_blob, tables->linker, &pmfadt, NULL, NULL);
> +
> +    acpi_add_table(table_offsets, tables_blob);
> +    build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
> +               mms->acpi_dev);
> +
> +    rsdt = tables_blob->len;
> +    build_rsdt(tables_blob, tables->linker, table_offsets, NULL, NULL);
> +
> +    /* RSDP is in FSEG memory, so allocate it separately */
> +    {
> +        AcpiRsdpData rsdp_data = {
> +            .revision = 0,
> +            .oem_id = ACPI_BUILD_APPNAME6,
> +            .xsdt_tbl_offset = NULL,
> +            .rsdt_tbl_offset = &rsdt,
are we interested in 32-bit guests?
if not than maybe use xsdt and newer revision like arm/virt does

> +        };
> +        build_rsdp(tables->rsdp, tables->linker, &rsdp_data);
> +    }
> +
> +    acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE);
> +    acpi_align_size(tables->linker->cmd_blob, ACPI_BUILD_ALIGN_SIZE);
> +
> +    /* Cleanup memory that's no longer used. */
> +    g_array_free(table_offsets, true);
> +}
> +
>  static
>  void acpi_build(AcpiBuildTables *tables, MachineState *machine)
>  {
> -    PCMachineState *pcms = PC_MACHINE(machine);
> -    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
>      X86MachineState *x86ms = X86_MACHINE(machine);
> +    PCMachineState *pcms;
> +    PCMachineClass *pcmc;
>      GArray *table_offsets;
>      unsigned facs, dsdt, rsdt, fadt;
>      AcpiPmInfo pm;
> @@ -2767,6 +2859,14 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
>      AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL };
>      Object *vmgenid_dev;
>  
> +    if (strcmp(object_get_typename(OBJECT(x86ms)), TYPE_MICROVM_MACHINE) == 0) {
maybe use object_dynamic_cast(OBJECT(x86ms)), TYPE_MICROVM_MACHINE)

> +        acpi_build_microvm(tables, machine);
> +        return;
> +    } else {
> +        pcms = PC_MACHINE(machine);
> +        pcmc = PC_MACHINE_GET_CLASS(pcms);
> +    }
> +
>      acpi_get_pm_info(machine, &pm);
>      acpi_get_misc_info(&misc);
>      acpi_get_pci_holes(&pci_hole, &pci_hole64);
> @@ -3009,21 +3109,29 @@ static const VMStateDescription vmstate_acpi_build = {
>  
>  void acpi_setup(void)
>  {
> -    PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
> -    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
> -    X86MachineState *x86ms = X86_MACHINE(pcms);
> +    X86MachineState *x86ms = X86_MACHINE(qdev_get_machine());
> +    PCMachineState *pcms;
> +    PCMachineClass *pcmc;
>      AcpiBuildTables tables;
>      AcpiBuildState *build_state;
>      Object *vmgenid_dev;
>      TPMIf *tpm;
>      static FwCfgTPMConfig tpm_config;
>  
> +    if (strcmp(object_get_typename(OBJECT(x86ms)), TYPE_MICROVM_MACHINE) == 0) {
> +        pcms = NULL;
> +        pcmc = NULL;
> +    } else {
> +        pcms = PC_MACHINE(x86ms);
> +        pcmc = PC_MACHINE_GET_CLASS(pcms);
> +    }
> +
>      if (!x86ms->fw_cfg) {
>          ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n");
>          return;
>      }
>  
> -    if (!pcms->acpi_build_enabled) {
> +    if (pcms && !pcms->acpi_build_enabled) {
>          ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n");
>          return;
>      }
> @@ -3036,7 +3144,7 @@ void acpi_setup(void)
>      build_state = g_malloc0(sizeof *build_state);
>  
>      acpi_build_tables_init(&tables);
> -    acpi_build(&tables, MACHINE(pcms));
> +    acpi_build(&tables, MACHINE(x86ms));
>  
>      /* Now expose it all to Guest */
>      build_state->table_mr = acpi_add_rom_blob(acpi_build_update,
> @@ -3069,7 +3177,7 @@ void acpi_setup(void)
>                             tables.vmgenid);
>      }
>  
> -    if (!pcmc->rsdp_in_ram) {
> +    if (pcmc && !pcmc->rsdp_in_ram) {
>          /*
>           * Keep for compatibility with old machine types.
>           * Though RSDP is small, its contents isn't immutable, so
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index 38d8e5170323..362d513f38e1 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -26,6 +26,7 @@
>  #include "sysemu/cpus.h"
>  #include "sysemu/numa.h"
>  #include "sysemu/reset.h"
> +#include "acpi-build.h"
>  
>  #include "hw/loader.h"
>  #include "hw/irq.h"
> @@ -41,6 +42,7 @@
>  #include "hw/i386/e820_memory_layout.h"
>  #include "hw/i386/fw_cfg.h"
>  #include "hw/virtio/virtio-mmio.h"
> +#include "hw/acpi/acpi.h"
>  
>  #include "cpu.h"
>  #include "elf.h"
> @@ -128,6 +130,10 @@ static void microvm_devices_init(MicrovmMachineState *mms)
>      }
>  
>      /* Optional and legacy devices */
> +    if (acpi_enabled) {
> +        ISADevice *acpi = isa_create_simple(isa_bus, "isa-acpi" /* FIXME */);
> +        mms->acpi_dev = ACPI_DEVICE_IF(acpi);
> +    }
>  
>      if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) {
>          qemu_irq *i8259;
> @@ -468,6 +474,11 @@ static void microvm_machine_set_auto_kernel_cmdline(Object *obj, bool value,
>      mms->auto_kernel_cmdline = value;
>  }
>  
> +static void microvm_machine_done(Notifier *notifier, void *data)
> +{
> +    acpi_setup();
> +}
> +
>  static void microvm_machine_initfn(Object *obj)
>  {
>      MicrovmMachineState *mms = MICROVM_MACHINE(obj);
> @@ -482,6 +493,9 @@ static void microvm_machine_initfn(Object *obj)
>  
>      /* State */
>      mms->kernel_cmdline_fixed = false;
> +
> +    mms->machine_done.notify = microvm_machine_done;
> +    qemu_add_machine_init_done_notifier(&mms->machine_done);
>  }
>  
>  static void microvm_class_init(ObjectClass *oc, void *data)
Gerd Hoffmann March 25, 2020, 9:04 a.m. UTC | #2
Hi,

> > +    {
> > +        AcpiRsdpData rsdp_data = {
> > +            .revision = 0,
> > +            .oem_id = ACPI_BUILD_APPNAME6,
> > +            .xsdt_tbl_offset = NULL,
> > +            .rsdt_tbl_offset = &rsdt,
> are we interested in 32-bit guests?

Well, sort-of.  seabios runs in 32bit mode.

> if not than maybe use xsdt and newer revision like arm/virt does

Point being?  It's not like we can place the tables above 4G then.

cheers,
  Gerd
Igor Mammedov March 25, 2020, 6:59 p.m. UTC | #3
On Wed, 25 Mar 2020 10:04:29 +0100
Gerd Hoffmann <kraxel@redhat.com> wrote:

>   Hi,
> 
> > > +    {
> > > +        AcpiRsdpData rsdp_data = {
> > > +            .revision = 0,
> > > +            .oem_id = ACPI_BUILD_APPNAME6,
> > > +            .xsdt_tbl_offset = NULL,
> > > +            .rsdt_tbl_offset = &rsdt,  
> > are we interested in 32-bit guests?  
> 
> Well, sort-of.  seabios runs in 32bit mode.
seabios isn't consumer of it though, so as far as being loaded kernel
is able to deal with xsdt it should be fine.

> > if not than maybe use xsdt and newer revision like arm/virt does  
> 
> Point being?  It's not like we can place the tables above 4G then.
point is to use current standard vs legacy one on new machine
> 
> cheers,
>   Gerd
>
diff mbox series

Patch

diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
index ba68d1f22bb3..da2852a70195 100644
--- a/include/hw/i386/microvm.h
+++ b/include/hw/i386/microvm.h
@@ -24,6 +24,7 @@ 
 
 #include "hw/boards.h"
 #include "hw/i386/x86.h"
+#include "hw/acpi/acpi_dev_interface.h"
 
 /* Platform virtio definitions */
 #define VIRTIO_MMIO_BASE      0xc0000000
@@ -58,6 +59,8 @@  typedef struct {
 
     /* Machine state */
     bool kernel_cmdline_fixed;
+    Notifier machine_done;
+    AcpiDeviceIf *acpi_dev;
 } MicrovmMachineState;
 
 #define TYPE_MICROVM_MACHINE   MACHINE_TYPE_NAME("microvm")
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9c98b07116cc..0e45a646af56 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -59,6 +59,7 @@ 
 #include "hw/pci/pci_bus.h"
 #include "hw/pci-host/q35.h"
 #include "hw/i386/x86-iommu.h"
+#include "hw/i386/microvm.h"
 
 #include "hw/acpi/aml-build.h"
 #include "hw/acpi/utils.h"
@@ -2749,12 +2750,103 @@  static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
     return true;
 }
 
+static void
+build_dsdt_microvm(GArray *table_data, BIOSLinker *linker,
+                   MicrovmMachineState *mms)
+{
+    X86MachineState *x86ms = X86_MACHINE(mms);
+    Aml *dsdt, *sb_scope, *scope, *pkg;
+
+    dsdt = init_aml_allocator();
+
+    /* Reserve space for header */
+    acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));
+
+    build_dbg_aml(dsdt);
+
+    sb_scope = aml_scope("_SB");
+    acpi_dsdt_add_fw_cfg(sb_scope, OBJECT(x86ms->fw_cfg));
+    aml_append(dsdt, sb_scope);
+
+    scope = aml_scope("\\");
+    pkg = aml_package(4);
+    aml_append(pkg, aml_int(0)); /* PM1a_CNT.SLP_TYP */
+    aml_append(pkg, aml_int(0)); /* PM1b_CNT.SLP_TYP not impl. */
+    aml_append(pkg, aml_int(0)); /* reserved */
+    aml_append(pkg, aml_int(0)); /* reserved */
+    aml_append(scope, aml_name_decl("_S5", pkg));
+    aml_append(dsdt, scope);
+
+    /* copy AML table into ACPI tables blob and patch header there */
+    g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
+    build_header(linker, table_data,
+        (void *)(table_data->data + table_data->len - dsdt->buf->len),
+        "DSDT", dsdt->buf->len, 1, NULL, NULL);
+    free_aml_allocator();
+}
+
+static
+void acpi_build_microvm(AcpiBuildTables *tables, MachineState *machine)
+{
+    MicrovmMachineState *mms = MICROVM_MACHINE(machine);
+    GArray *table_offsets;
+    GArray *tables_blob = tables->table_data;
+    AcpiFadtData pmfadt;
+    unsigned facs, dsdt, rsdt;
+
+    init_common_fadt_data(machine, OBJECT(mms->acpi_dev), &pmfadt);
+    pmfadt.smi_cmd = 0;
+
+    table_offsets = g_array_new(false, true /* clear */,
+                                        sizeof(uint32_t));
+    bios_linker_loader_alloc(tables->linker,
+                             ACPI_BUILD_TABLE_FILE, tables_blob,
+                             64 /* Ensure FACS is aligned */,
+                             false /* high memory */);
+
+    facs = tables_blob->len;
+    build_facs(tables_blob);
+
+    dsdt = tables_blob->len;
+    build_dsdt_microvm(tables_blob, tables->linker, mms);
+
+    pmfadt.facs_tbl_offset = &facs;
+    pmfadt.dsdt_tbl_offset = &dsdt;
+    pmfadt.xdsdt_tbl_offset = &dsdt;
+    acpi_add_table(table_offsets, tables_blob);
+    build_fadt(tables_blob, tables->linker, &pmfadt, NULL, NULL);
+
+    acpi_add_table(table_offsets, tables_blob);
+    build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
+               mms->acpi_dev);
+
+    rsdt = tables_blob->len;
+    build_rsdt(tables_blob, tables->linker, table_offsets, NULL, NULL);
+
+    /* RSDP is in FSEG memory, so allocate it separately */
+    {
+        AcpiRsdpData rsdp_data = {
+            .revision = 0,
+            .oem_id = ACPI_BUILD_APPNAME6,
+            .xsdt_tbl_offset = NULL,
+            .rsdt_tbl_offset = &rsdt,
+        };
+        build_rsdp(tables->rsdp, tables->linker, &rsdp_data);
+    }
+
+    acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE);
+    acpi_align_size(tables->linker->cmd_blob, ACPI_BUILD_ALIGN_SIZE);
+
+    /* Cleanup memory that's no longer used. */
+    g_array_free(table_offsets, true);
+}
+
 static
 void acpi_build(AcpiBuildTables *tables, MachineState *machine)
 {
-    PCMachineState *pcms = PC_MACHINE(machine);
-    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
     X86MachineState *x86ms = X86_MACHINE(machine);
+    PCMachineState *pcms;
+    PCMachineClass *pcmc;
     GArray *table_offsets;
     unsigned facs, dsdt, rsdt, fadt;
     AcpiPmInfo pm;
@@ -2767,6 +2859,14 @@  void acpi_build(AcpiBuildTables *tables, MachineState *machine)
     AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL };
     Object *vmgenid_dev;
 
+    if (strcmp(object_get_typename(OBJECT(x86ms)), TYPE_MICROVM_MACHINE) == 0) {
+        acpi_build_microvm(tables, machine);
+        return;
+    } else {
+        pcms = PC_MACHINE(machine);
+        pcmc = PC_MACHINE_GET_CLASS(pcms);
+    }
+
     acpi_get_pm_info(machine, &pm);
     acpi_get_misc_info(&misc);
     acpi_get_pci_holes(&pci_hole, &pci_hole64);
@@ -3009,21 +3109,29 @@  static const VMStateDescription vmstate_acpi_build = {
 
 void acpi_setup(void)
 {
-    PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
-    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
-    X86MachineState *x86ms = X86_MACHINE(pcms);
+    X86MachineState *x86ms = X86_MACHINE(qdev_get_machine());
+    PCMachineState *pcms;
+    PCMachineClass *pcmc;
     AcpiBuildTables tables;
     AcpiBuildState *build_state;
     Object *vmgenid_dev;
     TPMIf *tpm;
     static FwCfgTPMConfig tpm_config;
 
+    if (strcmp(object_get_typename(OBJECT(x86ms)), TYPE_MICROVM_MACHINE) == 0) {
+        pcms = NULL;
+        pcmc = NULL;
+    } else {
+        pcms = PC_MACHINE(x86ms);
+        pcmc = PC_MACHINE_GET_CLASS(pcms);
+    }
+
     if (!x86ms->fw_cfg) {
         ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n");
         return;
     }
 
-    if (!pcms->acpi_build_enabled) {
+    if (pcms && !pcms->acpi_build_enabled) {
         ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n");
         return;
     }
@@ -3036,7 +3144,7 @@  void acpi_setup(void)
     build_state = g_malloc0(sizeof *build_state);
 
     acpi_build_tables_init(&tables);
-    acpi_build(&tables, MACHINE(pcms));
+    acpi_build(&tables, MACHINE(x86ms));
 
     /* Now expose it all to Guest */
     build_state->table_mr = acpi_add_rom_blob(acpi_build_update,
@@ -3069,7 +3177,7 @@  void acpi_setup(void)
                            tables.vmgenid);
     }
 
-    if (!pcmc->rsdp_in_ram) {
+    if (pcmc && !pcmc->rsdp_in_ram) {
         /*
          * Keep for compatibility with old machine types.
          * Though RSDP is small, its contents isn't immutable, so
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 38d8e5170323..362d513f38e1 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -26,6 +26,7 @@ 
 #include "sysemu/cpus.h"
 #include "sysemu/numa.h"
 #include "sysemu/reset.h"
+#include "acpi-build.h"
 
 #include "hw/loader.h"
 #include "hw/irq.h"
@@ -41,6 +42,7 @@ 
 #include "hw/i386/e820_memory_layout.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/virtio/virtio-mmio.h"
+#include "hw/acpi/acpi.h"
 
 #include "cpu.h"
 #include "elf.h"
@@ -128,6 +130,10 @@  static void microvm_devices_init(MicrovmMachineState *mms)
     }
 
     /* Optional and legacy devices */
+    if (acpi_enabled) {
+        ISADevice *acpi = isa_create_simple(isa_bus, "isa-acpi" /* FIXME */);
+        mms->acpi_dev = ACPI_DEVICE_IF(acpi);
+    }
 
     if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) {
         qemu_irq *i8259;
@@ -468,6 +474,11 @@  static void microvm_machine_set_auto_kernel_cmdline(Object *obj, bool value,
     mms->auto_kernel_cmdline = value;
 }
 
+static void microvm_machine_done(Notifier *notifier, void *data)
+{
+    acpi_setup();
+}
+
 static void microvm_machine_initfn(Object *obj)
 {
     MicrovmMachineState *mms = MICROVM_MACHINE(obj);
@@ -482,6 +493,9 @@  static void microvm_machine_initfn(Object *obj)
 
     /* State */
     mms->kernel_cmdline_fixed = false;
+
+    mms->machine_done.notify = microvm_machine_done;
+    qemu_add_machine_init_done_notifier(&mms->machine_done);
 }
 
 static void microvm_class_init(ObjectClass *oc, void *data)