Skip to contentSkip to conversation

hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table

PATCH In review Liav Albani 4 participants 32 messages Feb 28, 2022 – Mar 4, 2022

lore
Share & tools
lore
#0 lore raw

v4 cover hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

To allow "flexible" indication, I don't hardcode the bit at location 1 as on in the IA-PC boot flags, but try to search for i8042 on the ISA bus to verify it exists in the system.

Why this is useful you might ask - this patch allows the guest OS to probe and use the i8042 controller without decoding the ACPI AML blob at all. For example, as a developer of the SerenityOS kernel, I might want to allow people to not try to decode the ACPI AML namespace (for now, we still don't support ACPI AML as it's a work in progress), but still to not probe for the i8042 but just use it after looking in the IA-PC boot flags in the ACPI FADT table.

Liav Albani (3):
tests/acpi: i386: allow FACP acpi table changes hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT
table
tests/acpi: i386: update FACP table differences

 hw/acpi/aml-build.c            |  11 ++++++++++-
 hw/i386/acpi-build.c           |   9 +++++++++
 hw/i386/acpi-microvm.c         |   9 +++++++++
 include/hw/acpi/acpi-defs.h    |   1 +
 tests/data/acpi/q35/FACP       | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.nosmm | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.slic  | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.xapic | Bin 244 -> 244 bytes
 8 files changed, 29 insertions(+), 1 deletion(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH v4 1/3 tests/acpi: i386: allow FACP acpi table changes

The FACP table is going to be changed for x86/q35 machines. To be sure the following changes are not breaking any QEMU test this change follows step 2 from the bios-tables-test.c guide on changes that affect ACPI tables.

---
 tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++
 1 file changed, 4 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +4 -0
index dfb8523c8b..7570e39369 100644
@@ -1 +1,5 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/FACP",
+"tests/data/acpi/q35/FACP.nosmm",
+"tests/data/acpi/q35/FACP.slic",
+"tests/data/acpi/q35/FACP.xapic",
Signature · 1 line
2.35.1
Acked-by on v4 1/3
#2 lore raw

Re: [PATCH v4 1/3] tests/acpi: i386: allow FACP acpi table changes

Quoted 4 lines · Liav Albani

The FACP table is going to be changed for x86/q35 machines. To be sure the following changes are not breaking any QEMU test this change follows step 2 from the bios-tables-test.c guide on changes that affect ACPI tables.

Please retain the tags in subsequent versions of the patch.

Quoted 2 lines
Quoted 18 lines
---
 tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++
 1 file changed, 4 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +4 -1
index dfb8523c8b..7570e39369 100644
@@ -1 +1,5 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/FACP",
+"tests/data/acpi/q35/FACP.nosmm",
+"tests/data/acpi/q35/FACP.slic",
+"tests/data/acpi/q35/FACP.xapic",
--

2.35.1

#3 lore raw

PATCH v4 2/3 hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table

In reply to Liav Albani

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++
 include/hw/acpi/acpi-defs.h |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +10 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
     build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
     build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
     build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
     build_append_int_noprefix(tbl, 0, 1); /* Reserved */
     build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +9 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "sysemu/tpm.h"
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
             .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
         },
     };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+
     *data = fadt;
 }
 
hw/i386/acpi-microvm.c +9 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
         .reset_val = ACPI_GED_RESET_VALUE,
     };
 
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
     bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -0
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
     uint16_t plvl2_lat;        /* P_LVL2_LAT */
     uint16_t plvl3_lat;        /* P_LVL3_LAT */
     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
     uint8_t minor_ver;         /* FADT Minor Version */
 
     /*
Signature · 1 line
2.35.1
#4 lore raw
Quoted 23 lines · Liav Albani

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++
 include/hw/acpi/acpi-defs.h |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +0 -0
index 8966e16320..2085905b83 100644

hw/acpi/aml-build.c void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, · line 2157

Quoted 7 lines
hw/acpi/aml-build.c +3 -1
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
     build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
     build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
     build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP

I'd say "this IAPC_BOOT_ARCH register" to be more specific.

Quoted 23 lines
hw/acpi/aml-build.c +7 -0
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
     build_append_int_noprefix(tbl, 0, 1); /* Reserved */
     build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 197

Quoted 5 lines
hw/i386/acpi-build.c +2 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
             .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
         },
     };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence

again typo here.

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 202

Quoted 5 lines
hw/i386/acpi-build.c +5 -0
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;

I thought I said we need to make sure the logic still applied when there are more than one device of this type. Please fix this.

Quoted 17 lines
hw/i386/acpi-build.c +1 -0
+
     *data = fadt;
 }
 
hw/i386/acpi-microvm.c +1 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"

hw/i386/acpi-microvm.c static void acpi_build_microvm(AcpiBuildTables *tables, · line 199

Quoted 10 lines
hw/i386/acpi-microvm.c +7 -0
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
         .reset_val = ACPI_GED_RESET_VALUE,
     };
 
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;

Ditto.

Quoted 20 lines
hw/i386/acpi-microvm.c +1 -0
+
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
     bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -1
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
     uint16_t plvl2_lat;        /* P_LVL2_LAT */
     uint16_t plvl3_lat;        /* P_LVL3_LAT */
     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
     uint8_t minor_ver;         /* FADT Minor Version */
 
     /*
--

2.35.1

#5 lore raw
Quoted 20 lines · On Tue, 1 Mar 2022 08:29:05 +0530 (IST) Ani Sinha <[email protected]> wrote:
Quoted 18 lines · Liav Albani

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++
 include/hw/acpi/acpi-defs.h |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
Quoted 17 lines

hw/acpi/aml-build.c void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, · line 2157

Quoted 12 lines
hw/acpi/aml-build.c +3 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
     build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
     build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
     build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP  

I'd say "this IAPC_BOOT_ARCH register" to be more specific.

Quoted 2 lines
hw/acpi/aml-build.c +2 -0
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */

I'd drop this comment altogether, like it's done with the rest of the fields in this function

Quoted 3 lines

hw/acpi/aml-build.c void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, · line 2162

Quoted 3 lines
hw/acpi/aml-build.c +3 -0
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {

maybe add here
/* Since ACPI 2.0 */

Quoted 87 lines
Quoted 18 lines
hw/acpi/aml-build.c +2 -0
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
     build_append_int_noprefix(tbl, 0, 1); /* Reserved */
     build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 197

Quoted 5 lines
hw/i386/acpi-build.c +2 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
             .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
         },
     };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence  

again typo here.

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 202

Quoted 5 lines
hw/i386/acpi-build.c +5 -0
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;  

I thought I said we need to make sure the logic still applied when there are more than one device of this type. Please fix this.

Quoted 17 lines
hw/i386/acpi-build.c +1 -0
+
     *data = fadt;
 }
 
hw/i386/acpi-microvm.c +1 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"

hw/i386/acpi-microvm.c static void acpi_build_microvm(AcpiBuildTables *tables, · line 199

Quoted 10 lines
hw/i386/acpi-microvm.c +7 -0
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
         .reset_val = ACPI_GED_RESET_VALUE,
     };
 
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;  

Ditto.

Quoted 20 lines
hw/i386/acpi-microvm.c +1 -0
+
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
     bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -1
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
     uint16_t plvl2_lat;        /* P_LVL2_LAT */
     uint16_t plvl3_lat;        /* P_LVL3_LAT */
     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
     uint8_t minor_ver;         /* FADT Minor Version */
 
     /*
--

2.35.1

#6 lore raw
In reply to Liav Albani
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 5 lines
---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Quoted 38 lines
 include/hw/acpi/acpi-defs.h |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +10 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
     build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
     build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
     build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
     build_append_int_noprefix(tbl, 0, 1); /* Reserved */
     build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 199

Quoted 7 lines
hw/i386/acpi-build.c +4 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
             .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
         },
     };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).

/* APCI spec version 2.0, Table 5-10 */

is sufficient, the rest could be read from spec/

Quoted 46 lines
hw/i386/acpi-build.c +4 -0
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+
     *data = fadt;
 }
 
hw/i386/acpi-microvm.c +9 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
         .reset_val = ACPI_GED_RESET_VALUE,
     };
 
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
     bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -0
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
     uint16_t plvl2_lat;        /* P_LVL2_LAT */
     uint16_t plvl3_lat;        /* P_LVL3_LAT */
     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
     uint8_t minor_ver;         /* FADT Minor Version */
 
     /*
#7 lore raw
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 6 lines
Quoted 5 lines
---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Igor is correct. Although I see that currently there are no 8042 devices for microvms, maybe we should be conservative and add the code to detect the device anyway. In that case, the change could affect microvms too when such devices get added in the future.

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine microvm -monitor stdio 2>/dev/null | grep 8042

<empty>

#8 lore raw
Quoted 20 lines · On Tue, 1 Mar 2022 15:22:17 +0530 (IST) Ani Sinha <[email protected]> wrote:
Quoted 18 lines · Igor Mammedov
Quoted 15 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++  
Quoted 6 lines
Quoted 1 line

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Igor is correct. Although I see that currently there are no 8042 devices for microvms, maybe we should be conservative and add the code to detect the device anyway. In that case, the change could affect microvms too when such devices get added in the future.

when that case actually arises implement it then, so I'd say don't generalize that unless it's actually used within series.
Or planned to be used in near future in which case commit message should mention that.

Quoted 6 lines

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine microvm -monitor stdio 2>/dev/null | grep 8042

<empty>

#9 lore raw
In reply to Ani Sinha
Quoted 28 lines · Ani Sinha
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 6 lines
Quoted 5 lines
---
  hw/acpi/aml-build.c         | 11 ++++++++++-
  hw/i386/acpi-build.c        |  9 +++++++++
  hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Igor is correct. Although I see that currently there are no 8042 devices for microvms, maybe we should be conservative and add the code to detect the device anyway. In that case, the change could affect microvms too when such devices get added in the future.

Quoted 4 lines

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine microvm -monitor stdio 2>/dev/null | grep 8042

<empty>

What about this?

echo -e "info qtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

Or this?

echo -e "info mtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

Quoted 1 line
#10 lore raw
Quoted 38 lines · Liav Albani
Quoted 28 lines · Ani Sinha
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 6 lines
Quoted 5 lines
---
  hw/acpi/aml-build.c         | 11 ++++++++++-
  hw/i386/acpi-build.c        |  9 +++++++++
  hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Igor is correct. Although I see that currently there are no 8042 devices for microvms, maybe we should be conservative and add the code to detect the device anyway. In that case, the change could affect microvms too when such devices get added in the future.

Quoted 4 lines

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine microvm -monitor stdio 2>/dev/null | grep 8042

<empty>

What about this?

Quoted 7 lines

echo -e "info qtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

Or this?

echo -e "info mtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

On both occasions you are explicitly adding the device.

#11 lore raw
Quoted 42 lines · Ani Sinha
Quoted 41 lines · Liav Albani
Quoted 28 lines · Ani Sinha
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 6 lines
Quoted 5 lines
---
  hw/acpi/aml-build.c         | 11 ++++++++++-
  hw/i386/acpi-build.c        |  9 +++++++++
  hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Igor is correct. Although I see that currently there are no 8042 devices for microvms, maybe we should be conservative and add the code to detect the device anyway. In that case, the change could affect microvms too when such devices get added in the future.

Quoted 4 lines

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine microvm -monitor stdio 2>/dev/null | grep 8042

<empty>

What about this?

echo -e "info qtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

Quoted 6 lines
Quoted 4 lines

Or this?

echo -e "info mtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

On both occasions you are explicitly adding the device.

Yes of course. It seems a bit cleaner to have -device i8042 -monitor stdio give us the correct ACPI table even if there's no pressing need for this ATM, simply because it's not much more code, and because if we don't we risk guests trying to work around incorrect ACPI tables. Let us however do this in a patch by its own with proper documentation and motivation.

Signature · 1 line
MST
#12 lore raw
Quoted 45 lines · Michael S. Tsirkin
Quoted 36 lines · Ani Sinha
Quoted 35 lines · Liav Albani
Quoted 27 lines · Ani Sinha
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 6 lines
Quoted 5 lines
---
   hw/acpi/aml-build.c         | 11 ++++++++++-
   hw/i386/acpi-build.c        |  9 +++++++++
   hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Igor is correct. Although I see that currently there are no 8042 devices for microvms, maybe we should be conservative and add the code to detect the device anyway. In that case, the change could affect microvms too when such devices get added in the future.

Quoted 4 lines

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine microvm -monitor stdio 2>/dev/null | grep 8042

<empty>

What about this?

Quoted 8 lines
Quoted 7 lines

echo -e "info qtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

Or this?

echo -e "info mtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

On both occasions you are explicitly adding the device.

Quoted 7 lines

Yes of course. It seems a bit cleaner to have -device i8042 -monitor stdio give us the correct ACPI table even if there's no pressing need for this ATM, simply because it's not much more code, and because if we don't we risk guests trying to work around incorrect ACPI tables. Let us however do this in a patch by its own with proper documentation and motivation.

So if I understand how to do this now - I should drop the code for the MicroVM ACPI for now, letting only to change the Q35 FACP table, right? So if that's the case I should send it in a separate patch?

If that's the case, as suggested by you and Ani, I'll not add a separate function to reduce code duplication as there's no such thing in such case...

#13 lore raw
Quoted 65 lines · On Wed, Mar 2, 2022 at 21:13 Liav Albani <[email protected]> wrote:
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Ani Sinha
Quoted 8 lines · Liav Albani
Quoted 6 lines · Ani Sinha
Quoted 4 lines · Igor Mammedov
Quoted 1 line · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042

controller

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is present in the system or not, so it doesn't need to do probing

of the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

controller, but just initialize it immediately, before enumerating

the

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses

FACP

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

ACPI table with revision higher than 1, which should implement at

least

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

ACPI 2.0 features within the table, hence it can also set the IA-PC

boot

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

flags register according to the ACPI 2.0 specification.

---
   hw/acpi/aml-build.c         | 11 ++++++++++-
   hw/i386/acpi-build.c        |  9 +++++++++
   hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc

piix4?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Igor is correct. Although I see that currently there are no 8042

devices

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

for microvms, maybe we should be conservative and add the code to

detect

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the device anyway. In that case, the change could affect microvms too

when

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

such devices get added in the future.

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine

microvm

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

-monitor stdio 2>/dev/null | grep 8042

<empty>

What about this?

Quoted 8 lines
Quoted 7 lines

echo -e "info qtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

Or this?

echo -e "info mtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

On both occasions you are explicitly adding the device.

Quoted 7 lines

Yes of course. It seems a bit cleaner to have -device i8042 -monitor stdio give us the correct ACPI table even if there's no pressing need for this ATM, simply because it's not much more code, and because if we don't we risk guests trying to work around incorrect ACPI tables. Let us however do this in a patch by its own with proper documentation and motivation.

Quoted 2 lines

So if I understand how to do this now - I should drop the code for the MicroVM ACPI for now, letting only to change the Q35 FACP table, right?

Correct. Microvm changes can go in a separate patch.

Quoted 1 line

So if that's the case I should send it in a separate patch?

Yes.

Quoted 4 lines

If that's the case, as suggested by you and Ani, I'll not add a separate function to reduce code duplication as there's no such thing in such case...

Please add the function regardless.

Quoted 2 lines
#14 lore raw
In reply to Michael S. Tsirkin
Quoted 44 lines · Michael S. Tsirkin
Quoted 42 lines · Ani Sinha
Quoted 41 lines · Liav Albani
Quoted 28 lines · Ani Sinha
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 6 lines
Quoted 5 lines
---
  hw/acpi/aml-build.c         | 11 ++++++++++-
  hw/i386/acpi-build.c        |  9 +++++++++
  hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Igor is correct. Although I see that currently there are no 8042 devices for microvms, maybe we should be conservative and add the code to detect the device anyway. In that case, the change could affect microvms too when such devices get added in the future.

Quoted 4 lines

echo -e "info qtree\r\nquit\r\n" | ./qemu-system-x86_64 -machine microvm -monitor stdio 2>/dev/null | grep 8042

<empty>

What about this?

echo -e "info qtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Or this?

echo -e "info mtree\r\nquit\r\n" | qemu-system-x86_64 -machine microvm -device i8042 -monitor stdio 2>/dev/null | grep 8042

On both occasions you are explicitly adding the device.

Yes of course.

OK. I did not think for a "microvm" one would explicitly add more 8042 devices beyond what was added by default in the real life use case.

#15 lore raw
In reply to Igor Mammedov
Quoted 68 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 5 lines
---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Quoted 38 lines
 include/hw/acpi/acpi-defs.h |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +10 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
     build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
     build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
     build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
     build_append_int_noprefix(tbl, 0, 1); /* Reserved */
     build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 199

Quoted 7 lines
hw/i386/acpi-build.c +4 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
             .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
         },
     };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).

/* APCI spec version 2.0, Table 5-10 */

Quoted 1 line

is sufficient, the rest could be read from spec/

ACPI though, not APCI.
The comment can be shorter and more clearer, but I feel quoting spec and including table name is a good idea actually, but pls quote verbatim:

/* ACPI spec version 2.0, Table 5-10: Fixed ACPI Description Table Boot Architecture Flags */
/* Bit offset 1 - port 60 and 64 based keyboard controller, usually implemented as an 8042 or equivalent micro-controller. */

Quoted 4 lines

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 202

Quoted 4 lines
hw/i386/acpi-build.c +3 -0
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;

and make it 0x1 << 1 - clearer that this is bit 1. Leading zeroes are not helpful since compiler does not check there's a correct number of these.

Quoted 20 lines
Quoted 20 lines
hw/i386/acpi-build.c +1 -0
+
     *data = fadt;
 }
 
hw/i386/acpi-microvm.c +1 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
         .reset_val = ACPI_GED_RESET_VALUE,
     };
 
Quoted 8 lines

hw/i386/acpi-microvm.c static void acpi_build_microvm(AcpiBuildTables *tables, · line 200

Quoted 8 lines
hw/i386/acpi-microvm.c +8 -0
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+

let's avoid code duplication pls.

Quoted 15 lines
Quoted 15 lines
hw/i386/acpi-microvm.c +0 -0
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
     bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -0
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
     uint16_t plvl2_lat;        /* P_LVL2_LAT */
     uint16_t plvl3_lat;        /* P_LVL3_LAT */
     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
     uint8_t minor_ver;         /* FADT Minor Version */
 
     /*
#16 lore raw
Quoted 69 lines · On Tue, 1 Mar 2022 06:19:51 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 68 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 5 lines
---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++  

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Quoted 38 lines
 include/hw/acpi/acpi-defs.h |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +10 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
     build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
     build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
     build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
     build_append_int_noprefix(tbl, 0, 1); /* Reserved */
     build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 199

Quoted 7 lines
hw/i386/acpi-build.c +4 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
             .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
         },
     };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).  

/* APCI spec version 2.0, Table 5-10 */

Quoted 7 lines
Quoted 1 line

is sufficient, the rest could be read from spec/

ACPI though, not APCI.
The comment can be shorter and more clearer,

but I feel quoting spec
and including table name is a good idea actually, but pls quote verbatim:

I don't do that and don't ask it from others.

The reason being that pointing where to look in spec and having verbatim copy of field name is sufficient for looking it up and QEMU does not endup with half of spec copied in (+unintentional mistakes). (As reviewer I will check if whatever written in patch actually matches spec anyways)

That's why I typically use
'spec ver, verbatim field name[, chapter/table name]'
policy. The later optional part is usually used for pointing to values description.

Quoted 59 lines

/* ACPI spec version 2.0, Table 5-10: Fixed ACPI Description Table Boot Architecture Flags */
/* Bit offset 1 - port 60 and 64 based keyboard controller, usually implemented as an 8042 or equivalent micro-controller. */

Quoted 4 lines

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 202

Quoted 4 lines
hw/i386/acpi-build.c +3 -0
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;  

and make it 0x1 << 1 - clearer that this is bit 1. Leading zeroes are not helpful since compiler does not check there's a correct number of these.

Quoted 20 lines
Quoted 20 lines
hw/i386/acpi-build.c +1 -0
+
     *data = fadt;
 }
 
hw/i386/acpi-microvm.c +1 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
         .reset_val = ACPI_GED_RESET_VALUE,
     };
 
Quoted 8 lines

hw/i386/acpi-microvm.c static void acpi_build_microvm(AcpiBuildTables *tables, · line 200

Quoted 8 lines
hw/i386/acpi-microvm.c +8 -0
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+  

let's avoid code duplication pls.

Quoted 15 lines
Quoted 15 lines
hw/i386/acpi-microvm.c +0 -0
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
     bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -0
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
     uint16_t plvl2_lat;        /* P_LVL2_LAT */
     uint16_t plvl3_lat;        /* P_LVL3_LAT */
     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
     uint8_t minor_ver;         /* FADT Minor Version */
 
     /*  
#17 lore raw
Quoted 88 lines · Igor Mammedov
Quoted 69 lines · On Tue, 1 Mar 2022 06:19:51 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 68 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 5 lines
---
 hw/acpi/aml-build.c         | 11 ++++++++++-
 hw/i386/acpi-build.c        |  9 +++++++++
 hw/i386/acpi-microvm.c      |  9 +++++++++  

commit message says it's q35 specific, so wy it touched microvm anc piix4?

Quoted 38 lines
 include/hw/acpi/acpi-defs.h |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +10 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
     build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
     build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
     build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
     build_append_int_noprefix(tbl, 0, 1); /* Reserved */
     build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
 #include "hw/block/fdc.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 199

Quoted 7 lines
hw/i386/acpi-build.c +4 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
             .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
         },
     };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).  

/* APCI spec version 2.0, Table 5-10 */

Quoted 7 lines
Quoted 1 line

is sufficient, the rest could be read from spec/

ACPI though, not APCI.
The comment can be shorter and more clearer,

but I feel quoting spec
and including table name is a good idea actually, but pls quote verbatim:

I don't do that and don't ask it from others.

The reason being that pointing where to look in spec and having verbatim copy of field name is sufficient
for looking it up and
QEMU does not endup with half of spec copied in (+unintentional mistakes). (As reviewer I will check if whatever written in patch actually matches spec anyways)

Quoted 4 lines

That's why I typically use
'spec ver, verbatim field name[, chapter/table name]'
policy. The later optional part is usually used for pointing to values description.

Ok but here the field name was not listed verbatim, and table name is missing. It is actually 8042 and table name is Fixed ACPI Description Table Boot Architecture Flags.

Quoted 60 lines
Quoted 60 lines

/* ACPI spec version 2.0, Table 5-10: Fixed ACPI Description Table Boot Architecture Flags */
/* Bit offset 1 - port 60 and 64 based keyboard controller, usually implemented as an 8042 or equivalent micro-controller. */

Quoted 4 lines

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 202

Quoted 4 lines
hw/i386/acpi-build.c +3 -0
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;  

and make it 0x1 << 1 - clearer that this is bit 1. Leading zeroes are not helpful since compiler does not check there's a correct number of these.

Quoted 20 lines
Quoted 20 lines
hw/i386/acpi-build.c +1 -0
+
     *data = fadt;
 }
 
hw/i386/acpi-microvm.c +1 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
 #include "hw/acpi/generic_event_device.h"
 #include "hw/acpi/utils.h"
 #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/microvm.h"
 #include "hw/pci/pci.h"
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
         .reset_val = ACPI_GED_RESET_VALUE,
     };
 
Quoted 8 lines

hw/i386/acpi-microvm.c static void acpi_build_microvm(AcpiBuildTables *tables, · line 200

Quoted 8 lines
hw/i386/acpi-microvm.c +8 -0
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+  

let's avoid code duplication pls.

Quoted 15 lines
Quoted 15 lines
hw/i386/acpi-microvm.c +0 -0
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
     bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -0
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
     uint16_t plvl2_lat;        /* P_LVL2_LAT */
     uint16_t plvl3_lat;        /* P_LVL3_LAT */
     uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
     uint8_t minor_ver;         /* FADT Minor Version */
 
     /*  
#18 lore raw
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

but I feel quoting spec
and including table name is a good idea actually, but pls quote verbatim:

I don't do that and don't ask it from others.

The reason being that pointing where to look in spec and having verbatim copy of field name is sufficient
for looking it up and
QEMU does not endup with half of spec copied in (+unintentional mistakes). (As reviewer I will check if whatever written in patch actually matches spec anyways)

Quoted 8 lines
Quoted 4 lines

That's why I typically use
'spec ver, verbatim field name[, chapter/table name]'
policy. The later optional part is usually used for pointing to values description.

Ok but here the field name was not listed verbatim, and table name is missing. It is actually 8042 and table name is Fixed ACPI Description Table Boot Architecture Flags.

So, in which route should I go with this? I could add a reference to the ACPI spec, but can write and explain more if you want me to.

#19 lore raw
Quoted 16 lines · On Wed, 2 Mar 2022 17:45:58 +0200 Liav Albani <[email protected]> wrote:
Quoted 16 lines
Quoted 15 lines
Quoted 2 lines

but I feel quoting spec
and including table name is a good idea actually, but pls quote verbatim:

I don't do that and don't ask it from others.

The reason being that pointing where to look in spec and having verbatim copy of field name is sufficient
for looking it up and
QEMU does not endup with half of spec copied in (+unintentional mistakes). (As reviewer I will check if whatever written in patch actually matches spec anyways)

That's why I typically use
'spec ver, verbatim field name[, chapter/table name]'
policy. The later optional part is usually used for pointing to values description.

Quoted 5 lines
Quoted 3 lines

Ok but here the field name was not listed verbatim, and table name is missing. It is actually 8042 and table name is Fixed ACPI Description Table Boot Architecture Flags.

So, in which route should I go with this? I could add a reference to the ACPI spec, but can write and explain more if you want me to.

A reference to spec is sufficient, as long as it is unambiguous and lets a reviewer easily find it within the spec

#20 lore raw
In reply to Michael S. Tsirkin
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
---
  hw/acpi/aml-build.c         | 11 ++++++++++-
  hw/i386/acpi-build.c        |  9 +++++++++
  hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

This affect only q35 machine type for now, but what happens if the MicroVM ACPI FACP table is updated to use a revision that supports IA-PC boot flags?

Quoted 47 lines
Quoted 47 lines
Quoted 38 lines
  include/hw/acpi/acpi-defs.h |  1 +
  4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +10 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
      build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
      build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
      build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
      build_append_int_noprefix(tbl, 0, 1); /* Reserved */
      build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
 
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
  #include "hw/nvram/fw_cfg.h"
  #include "hw/acpi/bios-linker-loader.h"
  #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
  #include "hw/block/fdc.h"
  #include "hw/acpi/memory_hotplug.h"
  #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 199

Quoted 7 lines
hw/i386/acpi-build.c +4 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
              .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
          },
      };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).

/* APCI spec version 2.0, Table 5-10 */

Quoted 2 lines
Quoted 1 line

is sufficient, the rest could be read from spec/

ACPI though, not APCI.

It will be fixed in version 5.

Quoted 6 lines

The comment can be shorter and more clearer, but I feel quoting spec and including table name is a good idea actually, but pls quote verbatim:

/* ACPI spec version 2.0, Table 5-10: Fixed ACPI Description Table Boot Architecture Flags */
/* Bit offset 1 - port 60 and 64 based keyboard controller, usually implemented as an 8042 or equivalent micro-controller. */

Quoted 6 lines
Quoted 3 lines

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 202

Quoted 3 lines
hw/i386/acpi-build.c +3 -0
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;

and make it 0x1 << 1 - clearer that this is bit 1. Leading zeroes are not helpful since compiler does not check there's a correct number of these.

It will be fixed in version 5.

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
hw/i386/acpi-build.c +1 -0
+
      *data = fadt;
  }
 
hw/i386/acpi-microvm.c +1 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
  #include "hw/acpi/generic_event_device.h"
  #include "hw/acpi/utils.h"
  #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
  #include "hw/i386/fw_cfg.h"
  #include "hw/i386/microvm.h"
  #include "hw/pci/pci.h"
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
          .reset_val = ACPI_GED_RESET_VALUE,
      };
 
Quoted 10 lines
Quoted 8 lines

hw/i386/acpi-microvm.c static void acpi_build_microvm(AcpiBuildTables *tables, · line 200

Quoted 8 lines
hw/i386/acpi-microvm.c +8 -0
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+

let's avoid code duplication pls.

What do you suggest to do with this? Creating a separate function to do this for us so we can call it from both locations?

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
hw/i386/acpi-microvm.c +0 -0
      table_offsets = g_array_new(false, true /* clear */,
                                          sizeof(uint32_t));
      bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -0
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
      uint16_t plvl2_lat;        /* P_LVL2_LAT */
      uint16_t plvl3_lat;        /* P_LVL3_LAT */
      uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
      uint8_t minor_ver;         /* FADT Minor Version */
 
      /*
#21 lore raw
Quoted 22 lines · Liav Albani
Quoted 19 lines · Michael S. Tsirkin
Quoted 18 lines · Igor Mammedov
Quoted 15 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

---
  hw/acpi/aml-build.c         | 11 ++++++++++-
  hw/i386/acpi-build.c        |  9 +++++++++
  hw/i386/acpi-microvm.c      |  9 +++++++++
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

commit message says it's q35 specific, so wy it touched microvm anc piix4?

This affect only q35 machine type for now, but what happens if the MicroVM ACPI FACP table is updated to use a revision that supports IA-PC boot flags?

microvm FACP table uses version 5. See function acpi_build_microvm(). It supports that flag already. What Igor was trying to say (and he can correct me if I am wrong) is that lets address microvm when the need arises, unless we already envision today that we would need IA-PC boot flag update even for microvms in the near future. In other words, lets not touch microvms if we do not have to, at present.

#22 lore raw
In reply to Liav Albani
Quoted 115 lines · Liav Albani
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Igor Mammedov
Quoted 10 lines · On Mon, 28 Feb 2022 22:17:32 +0200 Liav Albani <[email protected]> wrote:

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

This change only applies to the x86/q35 machine type, as it uses FACP ACPI table with revision higher than 1, which should implement at least ACPI 2.0 features within the table, hence it can also set the IA-PC boot flags register according to the ACPI 2.0 specification.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
---
  hw/acpi/aml-build.c         | 11 ++++++++++-
  hw/i386/acpi-build.c        |  9 +++++++++
  hw/i386/acpi-microvm.c      |  9 +++++++++

commit message says it's q35 specific, so wy it touched microvm anc piix4?

This affect only q35 machine type for now, but what happens if the MicroVM ACPI FACP table is updated to use a revision that supports IA-PC boot flags?

Quoted 46 lines
Quoted 46 lines
Quoted 37 lines
  include/hw/acpi/acpi-defs.h |  1 +
  4 files changed, 29 insertions(+), 1 deletion(-)
hw/acpi/aml-build.c +10 -1
index 8966e16320..2085905b83 100644
@@ -2152,7 +2152,16 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
      build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
      build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
      build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
-    build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
+    /* IAPC_BOOT_ARCH */
+    /*
+     * This register is not defined in ACPI spec version 1.0, where the FACP
+     * revision == 1 also applies. Therefore, just ignore setting this register.
+     */
+    if (f->rev == 1) {
+        build_append_int_noprefix(tbl, 0, 2);
+    } else {
+        build_append_int_noprefix(tbl, f->iapc_boot_arch, 2);
+    }
      build_append_int_noprefix(tbl, 0, 1); /* Reserved */
      build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
hw/i386/acpi-build.c +1 -0
index ebd47aa26f..c72c7bb9bb 100644
@@ -38,6 +38,7 @@
  #include "hw/nvram/fw_cfg.h"
  #include "hw/acpi/bios-linker-loader.h"
  #include "hw/isa/isa.h"
+#include "hw/input/i8042.h"
  #include "hw/block/fdc.h"
  #include "hw/acpi/memory_hotplug.h"
  #include "sysemu/tpm.h"

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 199

Quoted 7 lines
hw/i386/acpi-build.c +4 -0
@@ -192,6 +193,14 @@ static void init_common_fadt_data(MachineState *ms, Object *o,
              .address = object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK, NULL)
          },
      };
+    /*
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).

/* APCI spec version 2.0, Table 5-10 */

Quoted 2 lines
Quoted 1 line

is sufficient, the rest could be read from spec/

ACPI though, not APCI.

It will be fixed in version 5.

Quoted 6 lines

The comment can be shorter and more clearer, but I feel quoting spec and including table name is a good idea actually, but pls quote verbatim:

/* ACPI spec version 2.0, Table 5-10: Fixed ACPI Description Table Boot Architecture Flags */
/* Bit offset 1 - port 60 and 64 based keyboard controller, usually implemented as an 8042 or equivalent micro-controller. */

Quoted 6 lines
Quoted 3 lines

hw/i386/acpi-build.c static void init_common_fadt_data(MachineState *ms, Object *o, · line 202

Quoted 3 lines
hw/i386/acpi-build.c +3 -0
+     */
+    fadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;

and make it 0x1 << 1 - clearer that this is bit 1. Leading zeroes are not helpful since compiler does not check there's a correct number of these.

It will be fixed in version 5.

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
hw/i386/acpi-build.c +1 -0
+
      *data = fadt;
  }
hw/i386/acpi-microvm.c +2 -0
index 68ca7e7fc2..4bc72b1672 100644
@@ -31,6 +31,7 @@
  #include "hw/acpi/generic_event_device.h"
  #include "hw/acpi/utils.h"
  #include "hw/acpi/erst.h"
+#include "hw/input/i8042.h"
  #include "hw/i386/fw_cfg.h"
  #include "hw/i386/microvm.h"
  #include "hw/pci/pci.h"
@@ -189,6 +190,14 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
          .reset_val = ACPI_GED_RESET_VALUE,
      };
+    /*
Quoted 9 lines
Quoted 7 lines

hw/i386/acpi-microvm.c static void acpi_build_microvm(AcpiBuildTables *tables, · line 200

Quoted 7 lines
hw/i386/acpi-microvm.c +7 -0
+     * second bit of 16 of the IAPC_BOOT_ARCH register indicates i8042 presence
+     * or equivalent micro controller. See table 5-10 of APCI spec version 2.0
+     * (the earliest acpi revision that supports this).
+     */
+    pmfadt.iapc_boot_arch = object_resolve_path_type("", TYPE_I8042, NULL) ?
+                            0x0002 : 0x0000;
+

let's avoid code duplication pls.

Quoted 2 lines

What do you suggest to do with this? Creating a separate function to do this for us so we can call it from both locations?

Sounds reasonable.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
hw/i386/acpi-microvm.c +0 -0
      table_offsets = g_array_new(false, true /* clear */,
                                          sizeof(uint32_t));
      bios_linker_loader_alloc(tables->linker,
include/hw/acpi/acpi-defs.h +1 -0
index c97e8633ad..2b42e4192b 100644
@@ -77,6 +77,7 @@ typedef struct AcpiFadtData {
      uint16_t plvl2_lat;        /* P_LVL2_LAT */
      uint16_t plvl3_lat;        /* P_LVL3_LAT */
      uint16_t arm_boot_arch;    /* ARM_BOOT_ARCH */
+    uint16_t iapc_boot_arch;   /* IAPC_BOOT_ARCH */
      uint8_t minor_ver;         /* FADT Minor Version */
      /*
#23 lore raw

PATCH v4 3/3 tests/acpi: i386: update FACP table differences

In reply to Liav Albani

After changing the IAPC boot flags register to indicate support of i8042 in the machine chipset to help the guest OS to determine its existence "faster", we need to have the updated FACP ACPI binary images in tree.

@@ -1,32 +1,32 @@
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20211217 (64-bit version)
* Copyright (c) 2000 - 2021 Intel Corporation
*
- * Disassembly of tests/data/acpi/q35/FACP, Wed Feb 23 22:37:39 2022
+ * Disassembly of /tmp/aml-BBFBI1, Wed Feb 23 22:37:39 2022
*
* ACPI Data Table [FACP]
*
* Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue (in hex) */

 [000h 0000   4]                    Signature : "FACP"    [Fixed ACPI Description Table (FADT)]
 [004h 0004   4]                 Table Length : 000000F4
 [008h 0008   1]                     Revision : 03
-[009h 0009   1]                     Checksum : B9
+[009h 0009   1]                     Checksum : B7
 [00Ah 0010   6]                       Oem ID : "BOCHS "
 [010h 0016   8]                 Oem Table ID : "BXPC    "
 [018h 0024   4]                 Oem Revision : 00000001
 [01Ch 0028   4]              Asl Compiler ID : "BXPC"
 [020h 0032   4]        Asl Compiler Revision : 00000001
 [024h 0036   4]                 FACS Address : 00000000
 [028h 0040   4]                 DSDT Address : 00000000
 [02Ch 0044   1]                        Model : 01
 [02Dh 0045   1]                   PM Profile : 00 [Unspecified]
 [02Eh 0046   2]                SCI Interrupt : 0009
 [030h 0048   4]             SMI Command Port : 000000B2
 [034h 0052   1]            ACPI Enable Value : 02
 [035h 0053   1]           ACPI Disable Value : 03
 [036h 0054   1]               S4BIOS Command : 00
 [037h 0055   1]              P-State Control : 00
@@ -42,35 +42,35 @@
 [059h 0089   1]     PM1 Control Block Length : 02
 [05Ah 0090   1]     PM2 Control Block Length : 00
 [05Bh 0091   1]        PM Timer Block Length : 04
 [05Ch 0092   1]            GPE0 Block Length : 10
 [05Dh 0093   1]            GPE1 Block Length : 00
 [05Eh 0094   1]             GPE1 Base Offset : 00
 [05Fh 0095   1]                 _CST Support : 00
 [060h 0096   2]                   C2 Latency : 0FFF
 [062h 0098   2]                   C3 Latency : 0FFF
 [064h 0100   2]               CPU Cache Size : 0000
 [066h 0102   2]           Cache Flush Stride : 0000
 [068h 0104   1]            Duty Cycle Offset : 00
 [069h 0105   1]             Duty Cycle Width : 00
 [06Ah 0106   1]          RTC Day Alarm Index : 00
 [06Bh 0107   1]        RTC Month Alarm Index : 00
 [06Ch 0108   1]            RTC Century Index : 32
-[06Dh 0109   2]   Boot Flags (decoded below) : 0000
+[06Dh 0109   2]   Boot Flags (decoded below) : 0002

Legacy Devices Supported (V2) : 0
- 8042 Present on ports 60/64 (V2) : 0
+ 8042 Present on ports 60/64 (V2) : 1
VGA Not Present (V4) : 0
MSI Not Supported (V4) : 0
PCIe ASPM Not Supported (V4) : 0
CMOS RTC Not Present (V5) : 0
[06Fh 0111 1] Reserved : 00
[070h 0112 4] Flags (decoded below) : 000084A5
WBINVD instruction is operational (V1) : 1
WBINVD flushes all caches (V1) : 0
All CPUs support C1 (V1) : 1
C2 works on MP system (V1) : 0
Control Method Power Button (V1) : 0
Control Method Sleep Button (V1) : 1
RTC wake not in fixed reg space (V1) : 0
RTC can wake system from S4 (V1) : 1
32-bit PM Timer (V1) : 0
Docking Supported (V1) : 0
@@ -148,32 +148,32 @@

 [0DCh 0220   1]                     Space ID : 01 [SystemIO]
 [0DDh 0221   1]                    Bit Width : 80
 [0DEh 0222   1]                   Bit Offset : 00
 [0DFh 0223   1]         Encoded Access Width : 00 [Undefined/Legacy]
 [0E0h 0224   8]                      Address : 0000000000000620

[0E8h 0232 12] GPE1 Block : [Generic Address Structure]

 [0E8h 0232   1]                     Space ID : 00 [SystemMemory]
 [0E9h 0233   1]                    Bit Width : 00
 [0EAh 0234   1]                   Bit Offset : 00
 [0EBh 0235   1]         Encoded Access Width : 00 [Undefined/Legacy]
 [0ECh 0236   8]                      Address : 0000000000000000

Raw Table Data: Length 244 (0xF4)

-    0000: 46 41 43 50 F4 00 00 00 03 B9 42 4F 43 48 53 20  // FACP......BOCHS
+    0000: 46 41 43 50 F4 00 00 00 03 B7 42 4F 43 48 53 20  // FACP......BOCHS
     0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
     0020: 01 00 00 00 00 00 00 00 00 00 00 00 01 00 09 00  // ................
     0030: B2 00 00 00 02 03 00 00 00 06 00 00 00 00 00 00  // ................
     0040: 04 06 00 00 00 00 00 00 00 00 00 00 08 06 00 00  // ................
     0050: 20 06 00 00 00 00 00 00 04 02 00 04 10 00 00 00  //  ...............
-    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 00 00 00  // ............2...
+    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 02 00 00  // ............2...
     0070: A5 84 00 00 01 08 00 00 F9 0C 00 00 00 00 00 00  // ................
     0080: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     0090: 00 00 00 00 01 20 00 00 00 06 00 00 00 00 00 00  // ..... ..........
     00A0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  // ................
     00B0: 04 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     00D0: 01 20 00 00 08 06 00 00 00 00 00 00 01 80 00 00  // . ..............
     00E0: 20 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  //  ...............
     00F0: 00 00 00 00                                      // ....

**

---
 tests/data/acpi/q35/FACP                    | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.nosmm              | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.slic               | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.xapic              | Bin 244 -> 244 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   4 ----
 5 files changed, 4 deletions(-)
tests/data/acpi/q35/FACP binary +0 -0
index f6a864cc863c7763f6c09d3814ad184a658fa0a0..a8f6a8961109d01059aceef9f1869cde09a2f10c 100644
GIT binary patch
tests/data/acpi/q35/FACP.nosmm binary +0 -0
index 6a9aa5f370eb9af6a03dc739d8a159be58fdee01..c4e6d18ee5fc64159160d4589aa96b4d648c913a 100644
GIT binary patch
tests/data/acpi/q35/FACP.slic binary +0 -0
index 15986e095cf2db7ee92f7ce113c1d46d54018c62..48bbb1cf5ad0ceda1d2f6d56edf5c1e207bd1a04 100644
GIT binary patch
tests/data/acpi/q35/FACP.xapic binary +0 -0
index 2d3659c9c6753d07c3d48742343cb8e8cc034de7..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
index 7570e39369..dfb8523c8b 100644
@@ -1,5 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/FACP",
-"tests/data/acpi/q35/FACP.nosmm",
-"tests/data/acpi/q35/FACP.slic",
-"tests/data/acpi/q35/FACP.xapic",
Signature · 1 line
2.35.1
Acked-by on v4 3/3
#24 lore raw

Re: [PATCH v4 3/3] tests/acpi: i386: update FACP table differences

Quoted 102 lines · Liav Albani

After changing the IAPC boot flags register to indicate support of i8042 in the machine chipset to help the guest OS to determine its existence "faster", we need to have the updated FACP ACPI binary images in tree.

(quoted diff) +6 -6
@@ -1,32 +1,32 @@
 /*
  * Intel ACPI Component Architecture
  * AML/ASL+ Disassembler version 20211217 (64-bit version)
  * Copyright (c) 2000 - 2021 Intel Corporation
  *
- * Disassembly of tests/data/acpi/q35/FACP, Wed Feb 23 22:37:39 2022
+ * Disassembly of /tmp/aml-BBFBI1, Wed Feb 23 22:37:39 2022
  *
  * ACPI Data Table [FACP]
  *
  * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue (in hex)
  */
 
 [000h 0000   4]                    Signature : "FACP"    [Fixed ACPI Description Table (FADT)]
 [004h 0004   4]                 Table Length : 000000F4
 [008h 0008   1]                     Revision : 03
-[009h 0009   1]                     Checksum : B9
+[009h 0009   1]                     Checksum : B7
 [00Ah 0010   6]                       Oem ID : "BOCHS "
 [010h 0016   8]                 Oem Table ID : "BXPC    "
 [018h 0024   4]                 Oem Revision : 00000001
 [01Ch 0028   4]              Asl Compiler ID : "BXPC"
 [020h 0032   4]        Asl Compiler Revision : 00000001
 
 [024h 0036   4]                 FACS Address : 00000000
 [028h 0040   4]                 DSDT Address : 00000000
 [02Ch 0044   1]                        Model : 01
 [02Dh 0045   1]                   PM Profile : 00 [Unspecified]
 [02Eh 0046   2]                SCI Interrupt : 0009
 [030h 0048   4]             SMI Command Port : 000000B2
 [034h 0052   1]            ACPI Enable Value : 02
 [035h 0053   1]           ACPI Disable Value : 03
 [036h 0054   1]               S4BIOS Command : 00
 [037h 0055   1]              P-State Control : 00
@@ -42,35 +42,35 @@
 [059h 0089   1]     PM1 Control Block Length : 02
 [05Ah 0090   1]     PM2 Control Block Length : 00
 [05Bh 0091   1]        PM Timer Block Length : 04
 [05Ch 0092   1]            GPE0 Block Length : 10
 [05Dh 0093   1]            GPE1 Block Length : 00
 [05Eh 0094   1]             GPE1 Base Offset : 00
 [05Fh 0095   1]                 _CST Support : 00
 [060h 0096   2]                   C2 Latency : 0FFF
 [062h 0098   2]                   C3 Latency : 0FFF
 [064h 0100   2]               CPU Cache Size : 0000
 [066h 0102   2]           Cache Flush Stride : 0000
 [068h 0104   1]            Duty Cycle Offset : 00
 [069h 0105   1]             Duty Cycle Width : 00
 [06Ah 0106   1]          RTC Day Alarm Index : 00
 [06Bh 0107   1]        RTC Month Alarm Index : 00
 [06Ch 0108   1]            RTC Century Index : 32
-[06Dh 0109   2]   Boot Flags (decoded below) : 0000
+[06Dh 0109   2]   Boot Flags (decoded below) : 0002
                Legacy Devices Supported (V2) : 0
-            8042 Present on ports 60/64 (V2) : 0
+            8042 Present on ports 60/64 (V2) : 1
                         VGA Not Present (V4) : 0
                       MSI Not Supported (V4) : 0
                 PCIe ASPM Not Supported (V4) : 0
                    CMOS RTC Not Present (V5) : 0
 [06Fh 0111   1]                     Reserved : 00
 [070h 0112   4]        Flags (decoded below) : 000084A5
       WBINVD instruction is operational (V1) : 1
               WBINVD flushes all caches (V1) : 0
                     All CPUs support C1 (V1) : 1
                   C2 works on MP system (V1) : 0
             Control Method Power Button (V1) : 0
             Control Method Sleep Button (V1) : 1
         RTC wake not in fixed reg space (V1) : 0
             RTC can wake system from S4 (V1) : 1
                         32-bit PM Timer (V1) : 0
                       Docking Supported (V1) : 0
@@ -148,32 +148,32 @@
 [0DCh 0220   1]                     Space ID : 01 [SystemIO]
 [0DDh 0221   1]                    Bit Width : 80
 [0DEh 0222   1]                   Bit Offset : 00
 [0DFh 0223   1]         Encoded Access Width : 00 [Undefined/Legacy]
 [0E0h 0224   8]                      Address : 0000000000000620
 
 [0E8h 0232  12]                   GPE1 Block : [Generic Address Structure]
 [0E8h 0232   1]                     Space ID : 00 [SystemMemory]
 [0E9h 0233   1]                    Bit Width : 00
 [0EAh 0234   1]                   Bit Offset : 00
 [0EBh 0235   1]         Encoded Access Width : 00 [Undefined/Legacy]
 [0ECh 0236   8]                      Address : 0000000000000000
 
 Raw Table Data: Length 244 (0xF4)
 
-    0000: 46 41 43 50 F4 00 00 00 03 B9 42 4F 43 48 53 20  // FACP......BOCHS
+    0000: 46 41 43 50 F4 00 00 00 03 B7 42 4F 43 48 53 20  // FACP......BOCHS
     0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
     0020: 01 00 00 00 00 00 00 00 00 00 00 00 01 00 09 00  // ................
     0030: B2 00 00 00 02 03 00 00 00 06 00 00 00 00 00 00  // ................
     0040: 04 06 00 00 00 00 00 00 00 00 00 00 08 06 00 00  // ................
     0050: 20 06 00 00 00 00 00 00 04 02 00 04 10 00 00 00  //  ...............
-    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 00 00 00  // ............2...
+    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 02 00 00  // ............2...

Review line 179

Quoted 10 lines
(quoted diff) +0 -0
     0070: A5 84 00 00 01 08 00 00 F9 0C 00 00 00 00 00 00  // ................
     0080: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     0090: 00 00 00 00 01 20 00 00 00 06 00 00 00 00 00 00  // ..... ..........
     00A0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  // ................
     00B0: 04 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     00D0: 01 20 00 00 08 06 00 00 00 00 00 00 01 80 00 00  // . ..............
     00E0: 20 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  //  ...............
     00F0: 00 00 00 00                                      // ....
 **

Please retain tags from earlier revisions of the patch.

Quoted 2 lines
Quoted 58 lines
---
 tests/data/acpi/q35/FACP                    | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.nosmm              | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.slic               | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.xapic              | Bin 244 -> 244 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   4 ----
 5 files changed, 4 deletions(-)
tests/data/acpi/q35/FACP binary +0 -0
index f6a864cc863c7763f6c09d3814ad184a658fa0a0..a8f6a8961109d01059aceef9f1869cde09a2f10c 100644
GIT binary patch
tests/data/acpi/q35/FACP.nosmm binary +0 -0
index 6a9aa5f370eb9af6a03dc739d8a159be58fdee01..c4e6d18ee5fc64159160d4589aa96b4d648c913a 100644
GIT binary patch
tests/data/acpi/q35/FACP.slic binary +0 -0
index 15986e095cf2db7ee92f7ce113c1d46d54018c62..48bbb1cf5ad0ceda1d2f6d56edf5c1e207bd1a04 100644
GIT binary patch
tests/data/acpi/q35/FACP.xapic binary +0 -0
index 2d3659c9c6753d07c3d48742343cb8e8cc034de7..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -5
index 7570e39369..dfb8523c8b 100644
@@ -1,5 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/FACP",
-"tests/data/acpi/q35/FACP.nosmm",
-"tests/data/acpi/q35/FACP.slic",
-"tests/data/acpi/q35/FACP.xapic",
--

2.35.1

#25 lore raw

Re: [PATCH v4 3/3] tests/acpi: i386: update FACP table differences

Quoted 8 lines · Ani Sinha
Quoted 4 lines · Liav Albani

After changing the IAPC boot flags register to indicate support of i8042 in the machine chipset to help the guest OS to determine its existence "faster", we need to have the updated FACP ACPI binary images in tree.

Quoted 8 lines

Review line 6

Quoted 8 lines
(quoted diff) +1 -1
@@ -1,32 +1,32 @@
 /*
  * Intel ACPI Component Architecture
  * AML/ASL+ Disassembler version 20211217 (64-bit version)
  * Copyright (c) 2000 - 2021 Intel Corporation
  *
- * Disassembly of tests/data/acpi/q35/FACP, Wed Feb 23 22:37:39 2022
+ * Disassembly of /tmp/aml-BBFBI1, Wed Feb 23 22:37:39 2022

cut this out pls

Quoted 11 lines

Review line 16

Quoted 11 lines
(quoted diff) +1 -1
  *
  * ACPI Data Table [FACP]
  *
  * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue (in hex)
  */
 
 [000h 0000   4]                    Signature : "FACP"    [Fixed ACPI Description Table (FADT)]
 [004h 0004   4]                 Table Length : 000000F4
 [008h 0008   1]                     Revision : 03
-[009h 0009   1]                     Checksum : B9
+[009h 0009   1]                     Checksum : B7

and this

Quoted 34 lines
Quoted 34 lines
(quoted diff) +0 -1
 [00Ah 0010   6]                       Oem ID : "BOCHS "
 [010h 0016   8]                 Oem Table ID : "BXPC    "
 [018h 0024   4]                 Oem Revision : 00000001
 [01Ch 0028   4]              Asl Compiler ID : "BXPC"
 [020h 0032   4]        Asl Compiler Revision : 00000001
 
 [024h 0036   4]                 FACS Address : 00000000
 [028h 0040   4]                 DSDT Address : 00000000
 [02Ch 0044   1]                        Model : 01
 [02Dh 0045   1]                   PM Profile : 00 [Unspecified]
 [02Eh 0046   2]                SCI Interrupt : 0009
 [030h 0048   4]             SMI Command Port : 000000B2
 [034h 0052   1]            ACPI Enable Value : 02
 [035h 0053   1]           ACPI Disable Value : 03
 [036h 0054   1]               S4BIOS Command : 00
 [037h 0055   1]              P-State Control : 00
@@ -42,35 +42,35 @@
 [059h 0089   1]     PM1 Control Block Length : 02
 [05Ah 0090   1]     PM2 Control Block Length : 00
 [05Bh 0091   1]        PM Timer Block Length : 04
 [05Ch 0092   1]            GPE0 Block Length : 10
 [05Dh 0093   1]            GPE1 Block Length : 00
 [05Eh 0094   1]             GPE1 Base Offset : 00
 [05Fh 0095   1]                 _CST Support : 00
 [060h 0096   2]                   C2 Latency : 0FFF
 [062h 0098   2]                   C3 Latency : 0FFF
 [064h 0100   2]               CPU Cache Size : 0000
 [066h 0102   2]           Cache Flush Stride : 0000
 [068h 0104   1]            Duty Cycle Offset : 00
 [069h 0105   1]             Duty Cycle Width : 00
 [06Ah 0106   1]          RTC Day Alarm Index : 00
 [06Bh 0107   1]        RTC Month Alarm Index : 00
 [06Ch 0108   1]            RTC Century Index : 32
-[06Dh 0109   2]   Boot Flags (decoded below) : 0000
Quoted 8 lines

Review line 64

Quoted 8 lines
(quoted diff) +2 -1
+[06Dh 0109   2]   Boot Flags (decoded below) : 0002
                Legacy Devices Supported (V2) : 0
-            8042 Present on ports 60/64 (V2) : 0
+            8042 Present on ports 60/64 (V2) : 1
                         VGA Not Present (V4) : 0
                       MSI Not Supported (V4) : 0
                 PCIe ASPM Not Supported (V4) : 0
                    CMOS RTC Not Present (V5) : 0

leaving just this

Quoted 38 lines
Quoted 38 lines
(quoted diff) +2 -2
 [06Fh 0111   1]                     Reserved : 00
 [070h 0112   4]        Flags (decoded below) : 000084A5
       WBINVD instruction is operational (V1) : 1
               WBINVD flushes all caches (V1) : 0
                     All CPUs support C1 (V1) : 1
                   C2 works on MP system (V1) : 0
             Control Method Power Button (V1) : 0
             Control Method Sleep Button (V1) : 1
         RTC wake not in fixed reg space (V1) : 0
             RTC can wake system from S4 (V1) : 1
                         32-bit PM Timer (V1) : 0
                       Docking Supported (V1) : 0
@@ -148,32 +148,32 @@
 [0DCh 0220   1]                     Space ID : 01 [SystemIO]
 [0DDh 0221   1]                    Bit Width : 80
 [0DEh 0222   1]                   Bit Offset : 00
 [0DFh 0223   1]         Encoded Access Width : 00 [Undefined/Legacy]
 [0E0h 0224   8]                      Address : 0000000000000620
 
 [0E8h 0232  12]                   GPE1 Block : [Generic Address Structure]
 [0E8h 0232   1]                     Space ID : 00 [SystemMemory]
 [0E9h 0233   1]                    Bit Width : 00
 [0EAh 0234   1]                   Bit Offset : 00
 [0EBh 0235   1]         Encoded Access Width : 00 [Undefined/Legacy]
 [0ECh 0236   8]                      Address : 0000000000000000
 
 Raw Table Data: Length 244 (0xF4)
 
-    0000: 46 41 43 50 F4 00 00 00 03 B9 42 4F 43 48 53 20  // FACP......BOCHS
+    0000: 46 41 43 50 F4 00 00 00 03 B7 42 4F 43 48 53 20  // FACP......BOCHS
     0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
     0020: 01 00 00 00 00 00 00 00 00 00 00 00 01 00 09 00  // ................
     0030: B2 00 00 00 02 03 00 00 00 06 00 00 00 00 00 00  // ................
     0040: 04 06 00 00 00 00 00 00 00 00 00 00 08 06 00 00  // ................
     0050: 20 06 00 00 00 00 00 00 04 02 00 04 10 00 00 00  //  ...............
-    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 00 00 00  // ............2...
+    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 02 00 00  // ............2...
     0070: A5 84 00 00 01 08 00 00 F9 0C 00 00 00 00 00 00  // ................
Quoted 8 lines

Review line 178

Quoted 8 lines
(quoted diff) +0 -0
     0080: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     0090: 00 00 00 00 01 20 00 00 00 06 00 00 00 00 00 00  // ..... ..........
     00A0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  // ................
     00B0: 04 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     00D0: 01 20 00 00 08 06 00 00 00 00 00 00 01 80 00 00  // . ..............
     00E0: 20 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  //  ...............
     00F0: 00 00 00 00                                      // ....

this isn't helpful either and will be wrong if cherry picked.

Quoted 67 lines

Review line 179

Quoted 1 line
(quoted diff) +0 -0
 **

Please retain tags from earlier revisions of the patch.

Quoted 2 lines
Quoted 58 lines
---
 tests/data/acpi/q35/FACP                    | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.nosmm              | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.slic               | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.xapic              | Bin 244 -> 244 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   4 ----
 5 files changed, 4 deletions(-)
tests/data/acpi/q35/FACP binary +0 -0
index f6a864cc863c7763f6c09d3814ad184a658fa0a0..a8f6a8961109d01059aceef9f1869cde09a2f10c 100644
GIT binary patch
tests/data/acpi/q35/FACP.nosmm binary +0 -0
index 6a9aa5f370eb9af6a03dc739d8a159be58fdee01..c4e6d18ee5fc64159160d4589aa96b4d648c913a 100644
GIT binary patch
tests/data/acpi/q35/FACP.slic binary +0 -0
index 15986e095cf2db7ee92f7ce113c1d46d54018c62..48bbb1cf5ad0ceda1d2f6d56edf5c1e207bd1a04 100644
GIT binary patch
tests/data/acpi/q35/FACP.xapic binary +0 -0
index 2d3659c9c6753d07c3d48742343cb8e8cc034de7..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -5
index 7570e39369..dfb8523c8b 100644
@@ -1,5 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/FACP",
-"tests/data/acpi/q35/FACP.nosmm",
-"tests/data/acpi/q35/FACP.slic",
-"tests/data/acpi/q35/FACP.xapic",
--

2.35.1

#26 lore raw

Re: [PATCH v4 3/3] tests/acpi: i386: update FACP table differences

Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Ani Sinha
Quoted 4 lines · Liav Albani

After changing the IAPC boot flags register to indicate support of i8042 in the machine chipset to help the guest OS to determine its existence "faster", we need to have the updated FACP ACPI binary images in tree.

Quoted 9 lines
Quoted 8 lines

Review line 6

Quoted 8 lines
(quoted diff) +1 -1
@@ -1,32 +1,32 @@
  /*
   * Intel ACPI Component Architecture
   * AML/ASL+ Disassembler version 20211217 (64-bit version)
   * Copyright (c) 2000 - 2021 Intel Corporation
   *
- * Disassembly of tests/data/acpi/q35/FACP, Wed Feb 23 22:37:39 2022
+ * Disassembly of /tmp/aml-BBFBI1, Wed Feb 23 22:37:39 2022

cut this out pls

I see, this is indeed not very useful...

Quoted 49 lines
Quoted 11 lines

Review line 16

Quoted 11 lines
(quoted diff) +1 -1
   *
   * ACPI Data Table [FACP]
   *
   * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue (in hex)
   */
 
  [000h 0000   4]                    Signature : "FACP"    [Fixed ACPI Description Table (FADT)]
  [004h 0004   4]                 Table Length : 000000F4
  [008h 0008   1]                     Revision : 03
-[009h 0009   1]                     Checksum : B9
+[009h 0009   1]                     Checksum : B7

and this

Quoted 36 lines
Quoted 36 lines
(quoted diff) +1 -1
  [00Ah 0010   6]                       Oem ID : "BOCHS "
  [010h 0016   8]                 Oem Table ID : "BXPC    "
  [018h 0024   4]                 Oem Revision : 00000001
  [01Ch 0028   4]              Asl Compiler ID : "BXPC"
  [020h 0032   4]        Asl Compiler Revision : 00000001
 
  [024h 0036   4]                 FACS Address : 00000000
  [028h 0040   4]                 DSDT Address : 00000000
  [02Ch 0044   1]                        Model : 01
  [02Dh 0045   1]                   PM Profile : 00 [Unspecified]
  [02Eh 0046   2]                SCI Interrupt : 0009
  [030h 0048   4]             SMI Command Port : 000000B2
  [034h 0052   1]            ACPI Enable Value : 02
  [035h 0053   1]           ACPI Disable Value : 03
  [036h 0054   1]               S4BIOS Command : 00
  [037h 0055   1]              P-State Control : 00
@@ -42,35 +42,35 @@
  [059h 0089   1]     PM1 Control Block Length : 02
  [05Ah 0090   1]     PM2 Control Block Length : 00
  [05Bh 0091   1]        PM Timer Block Length : 04
  [05Ch 0092   1]            GPE0 Block Length : 10
  [05Dh 0093   1]            GPE1 Block Length : 00
  [05Eh 0094   1]             GPE1 Base Offset : 00
  [05Fh 0095   1]                 _CST Support : 00
  [060h 0096   2]                   C2 Latency : 0FFF
  [062h 0098   2]                   C3 Latency : 0FFF
  [064h 0100   2]               CPU Cache Size : 0000
  [066h 0102   2]           Cache Flush Stride : 0000
  [068h 0104   1]            Duty Cycle Offset : 00
  [069h 0105   1]             Duty Cycle Width : 00
  [06Ah 0106   1]          RTC Day Alarm Index : 00
  [06Bh 0107   1]        RTC Month Alarm Index : 00
  [06Ch 0108   1]            RTC Century Index : 32
-[06Dh 0109   2]   Boot Flags (decoded below) : 0000
+[06Dh 0109   2]   Boot Flags (decoded below) : 0002
                 Legacy Devices Supported (V2) : 0
Quoted 9 lines
Quoted 6 lines

Review line 64

Quoted 6 lines
(quoted diff) +1 -1
-            8042 Present on ports 60/64 (V2) : 0
+            8042 Present on ports 60/64 (V2) : 1
                          VGA Not Present (V4) : 0
                        MSI Not Supported (V4) : 0
                  PCIe ASPM Not Supported (V4) : 0
                     CMOS RTC Not Present (V5) : 0

leaving just this

It will be fixed in version 5.

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
(quoted diff) +2 -2
  [06Fh 0111   1]                     Reserved : 00
  [070h 0112   4]        Flags (decoded below) : 000084A5
        WBINVD instruction is operational (V1) : 1
                WBINVD flushes all caches (V1) : 0
                      All CPUs support C1 (V1) : 1
                    C2 works on MP system (V1) : 0
              Control Method Power Button (V1) : 0
              Control Method Sleep Button (V1) : 1
          RTC wake not in fixed reg space (V1) : 0
              RTC can wake system from S4 (V1) : 1
                          32-bit PM Timer (V1) : 0
                        Docking Supported (V1) : 0
@@ -148,32 +148,32 @@
  [0DCh 0220   1]                     Space ID : 01 [SystemIO]
  [0DDh 0221   1]                    Bit Width : 80
  [0DEh 0222   1]                   Bit Offset : 00
  [0DFh 0223   1]         Encoded Access Width : 00 [Undefined/Legacy]
  [0E0h 0224   8]                      Address : 0000000000000620
 
  [0E8h 0232  12]                   GPE1 Block : [Generic Address Structure]
  [0E8h 0232   1]                     Space ID : 00 [SystemMemory]
  [0E9h 0233   1]                    Bit Width : 00
  [0EAh 0234   1]                   Bit Offset : 00
  [0EBh 0235   1]         Encoded Access Width : 00 [Undefined/Legacy]
  [0ECh 0236   8]                      Address : 0000000000000000
 
  Raw Table Data: Length 244 (0xF4)
 
-    0000: 46 41 43 50 F4 00 00 00 03 B9 42 4F 43 48 53 20  // FACP......BOCHS
+    0000: 46 41 43 50 F4 00 00 00 03 B7 42 4F 43 48 53 20  // FACP......BOCHS
      0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
      0020: 01 00 00 00 00 00 00 00 00 00 00 00 01 00 09 00  // ................
      0030: B2 00 00 00 02 03 00 00 00 06 00 00 00 00 00 00  // ................
      0040: 04 06 00 00 00 00 00 00 00 00 00 00 08 06 00 00  // ................
      0050: 20 06 00 00 00 00 00 00 04 02 00 04 10 00 00 00  //  ...............
-    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 00 00 00  // ............2...
+    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 02 00 00  // ............2...
      0070: A5 84 00 00 01 08 00 00 F9 0C 00 00 00 00 00 00  // ................
      0080: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
Quoted 8 lines
Quoted 7 lines

Review line 178

Quoted 7 lines
(quoted diff) +0 -0
      0090: 00 00 00 00 01 20 00 00 00 06 00 00 00 00 00 00  // ..... ..........
      00A0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  // ................
      00B0: 04 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
      00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
      00D0: 01 20 00 00 08 06 00 00 00 00 00 00 01 80 00 00  // . ..............
      00E0: 20 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  //  ...............
      00F0: 00 00 00 00                                      // ....

this isn't helpful either and will be wrong if cherry picked.

It will be fixed in version 5 :)

I'll have to not retain the Ack sign of Ani, right?

Quoted 65 lines
Quoted 65 lines

Review line 179

Quoted 2 lines
(quoted diff) +0 -0
 **

Please retain tags from earlier revisions of the patch.

Quoted 1 line
Quoted 58 lines
---
  tests/data/acpi/q35/FACP                    | Bin 244 -> 244 bytes
  tests/data/acpi/q35/FACP.nosmm              | Bin 244 -> 244 bytes
  tests/data/acpi/q35/FACP.slic               | Bin 244 -> 244 bytes
  tests/data/acpi/q35/FACP.xapic              | Bin 244 -> 244 bytes
  tests/qtest/bios-tables-test-allowed-diff.h |   4 ----
  5 files changed, 4 deletions(-)
tests/data/acpi/q35/FACP binary +0 -0
index f6a864cc863c7763f6c09d3814ad184a658fa0a0..a8f6a8961109d01059aceef9f1869cde09a2f10c 100644
GIT binary patch
tests/data/acpi/q35/FACP.nosmm binary +0 -0
index 6a9aa5f370eb9af6a03dc739d8a159be58fdee01..c4e6d18ee5fc64159160d4589aa96b4d648c913a 100644
GIT binary patch
tests/data/acpi/q35/FACP.slic binary +0 -0
index 15986e095cf2db7ee92f7ce113c1d46d54018c62..48bbb1cf5ad0ceda1d2f6d56edf5c1e207bd1a04 100644
GIT binary patch
tests/data/acpi/q35/FACP.xapic binary +0 -0
index 2d3659c9c6753d07c3d48742343cb8e8cc034de7..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -5
index 7570e39369..dfb8523c8b 100644
@@ -1,5 +1 @@
  /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/FACP",
-"tests/data/acpi/q35/FACP.nosmm",
-"tests/data/acpi/q35/FACP.slic",
-"tests/data/acpi/q35/FACP.xapic",
--

2.35.1

#27 lore raw

Re: [PATCH v4 3/3] tests/acpi: i386: update FACP table differences

Quoted 128 lines · Liav Albani
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Ani Sinha
Quoted 4 lines · Liav Albani

After changing the IAPC boot flags register to indicate support of i8042 in the machine chipset to help the guest OS to determine its existence "faster", we need to have the updated FACP ACPI binary images in tree.

Quoted 9 lines
Quoted 8 lines

Review line 6

Quoted 8 lines
(quoted diff) +1 -1
@@ -1,32 +1,32 @@
  /*
   * Intel ACPI Component Architecture
   * AML/ASL+ Disassembler version 20211217 (64-bit version)
   * Copyright (c) 2000 - 2021 Intel Corporation
   *
- * Disassembly of tests/data/acpi/q35/FACP, Wed Feb 23 22:37:39 2022
+ * Disassembly of /tmp/aml-BBFBI1, Wed Feb 23 22:37:39 2022

cut this out pls

I see, this is indeed not very useful...

Quoted 49 lines
Quoted 11 lines

Review line 16

Quoted 11 lines
(quoted diff) +1 -1
   *
   * ACPI Data Table [FACP]
   *
   * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue (in hex)
   */
 
  [000h 0000   4]                    Signature : "FACP"    [Fixed ACPI Description Table (FADT)]
  [004h 0004   4]                 Table Length : 000000F4
  [008h 0008   1]                     Revision : 03
-[009h 0009   1]                     Checksum : B9
+[009h 0009   1]                     Checksum : B7

and this

Quoted 36 lines
Quoted 36 lines
(quoted diff) +1 -1
  [00Ah 0010   6]                       Oem ID : "BOCHS "
  [010h 0016   8]                 Oem Table ID : "BXPC    "
  [018h 0024   4]                 Oem Revision : 00000001
  [01Ch 0028   4]              Asl Compiler ID : "BXPC"
  [020h 0032   4]        Asl Compiler Revision : 00000001
 
  [024h 0036   4]                 FACS Address : 00000000
  [028h 0040   4]                 DSDT Address : 00000000
  [02Ch 0044   1]                        Model : 01
  [02Dh 0045   1]                   PM Profile : 00 [Unspecified]
  [02Eh 0046   2]                SCI Interrupt : 0009
  [030h 0048   4]             SMI Command Port : 000000B2
  [034h 0052   1]            ACPI Enable Value : 02
  [035h 0053   1]           ACPI Disable Value : 03
  [036h 0054   1]               S4BIOS Command : 00
  [037h 0055   1]              P-State Control : 00
@@ -42,35 +42,35 @@
  [059h 0089   1]     PM1 Control Block Length : 02
  [05Ah 0090   1]     PM2 Control Block Length : 00
  [05Bh 0091   1]        PM Timer Block Length : 04
  [05Ch 0092   1]            GPE0 Block Length : 10
  [05Dh 0093   1]            GPE1 Block Length : 00
  [05Eh 0094   1]             GPE1 Base Offset : 00
  [05Fh 0095   1]                 _CST Support : 00
  [060h 0096   2]                   C2 Latency : 0FFF
  [062h 0098   2]                   C3 Latency : 0FFF
  [064h 0100   2]               CPU Cache Size : 0000
  [066h 0102   2]           Cache Flush Stride : 0000
  [068h 0104   1]            Duty Cycle Offset : 00
  [069h 0105   1]             Duty Cycle Width : 00
  [06Ah 0106   1]          RTC Day Alarm Index : 00
  [06Bh 0107   1]        RTC Month Alarm Index : 00
  [06Ch 0108   1]            RTC Century Index : 32
-[06Dh 0109   2]   Boot Flags (decoded below) : 0000
+[06Dh 0109   2]   Boot Flags (decoded below) : 0002
                 Legacy Devices Supported (V2) : 0
Quoted 9 lines
Quoted 6 lines

Review line 64

Quoted 6 lines
(quoted diff) +1 -1
-            8042 Present on ports 60/64 (V2) : 0
+            8042 Present on ports 60/64 (V2) : 1
                          VGA Not Present (V4) : 0
                        MSI Not Supported (V4) : 0
                  PCIe ASPM Not Supported (V4) : 0
                     CMOS RTC Not Present (V5) : 0

leaving just this

It will be fixed in version 5.

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
(quoted diff) +2 -2
  [06Fh 0111   1]                     Reserved : 00
  [070h 0112   4]        Flags (decoded below) : 000084A5
        WBINVD instruction is operational (V1) : 1
                WBINVD flushes all caches (V1) : 0
                      All CPUs support C1 (V1) : 1
                    C2 works on MP system (V1) : 0
              Control Method Power Button (V1) : 0
              Control Method Sleep Button (V1) : 1
          RTC wake not in fixed reg space (V1) : 0
              RTC can wake system from S4 (V1) : 1
                          32-bit PM Timer (V1) : 0
                        Docking Supported (V1) : 0
@@ -148,32 +148,32 @@
  [0DCh 0220   1]                     Space ID : 01 [SystemIO]
  [0DDh 0221   1]                    Bit Width : 80
  [0DEh 0222   1]                   Bit Offset : 00
  [0DFh 0223   1]         Encoded Access Width : 00 [Undefined/Legacy]
  [0E0h 0224   8]                      Address : 0000000000000620
 
  [0E8h 0232  12]                   GPE1 Block : [Generic Address Structure]
  [0E8h 0232   1]                     Space ID : 00 [SystemMemory]
  [0E9h 0233   1]                    Bit Width : 00
  [0EAh 0234   1]                   Bit Offset : 00
  [0EBh 0235   1]         Encoded Access Width : 00 [Undefined/Legacy]
  [0ECh 0236   8]                      Address : 0000000000000000
 
  Raw Table Data: Length 244 (0xF4)
 
-    0000: 46 41 43 50 F4 00 00 00 03 B9 42 4F 43 48 53 20  // FACP......BOCHS
+    0000: 46 41 43 50 F4 00 00 00 03 B7 42 4F 43 48 53 20  // FACP......BOCHS
      0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
      0020: 01 00 00 00 00 00 00 00 00 00 00 00 01 00 09 00  // ................
      0030: B2 00 00 00 02 03 00 00 00 06 00 00 00 00 00 00  // ................
      0040: 04 06 00 00 00 00 00 00 00 00 00 00 08 06 00 00  // ................
      0050: 20 06 00 00 00 00 00 00 04 02 00 04 10 00 00 00  //  ...............
-    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 00 00 00  // ............2...
+    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 02 00 00  // ............2...
      0070: A5 84 00 00 01 08 00 00 F9 0C 00 00 00 00 00 00  // ................
      0080: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
Quoted 8 lines
Quoted 7 lines

Review line 178

Quoted 7 lines
(quoted diff) +0 -0
      0090: 00 00 00 00 01 20 00 00 00 06 00 00 00 00 00 00  // ..... ..........
      00A0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  // ................
      00B0: 04 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
      00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
      00D0: 01 20 00 00 08 06 00 00 00 00 00 00 01 80 00 00  // . ..............
      00E0: 20 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  //  ...............
      00F0: 00 00 00 00                                      // ....

this isn't helpful either and will be wrong if cherry picked.

Quoted 3 lines

It will be fixed in version 5 :)

I'll have to not retain the Ack sign of Ani, right?

No you do but you should still address Michael's comments. Different reviewers look for different things and they can ack/tag reviewed-by if they were satisfied. Others can raise further concerns or comments thereafter also. It does not mean previous tags needs removal. They stand on their own merit.

#28 lore raw

Re: [PATCH v4 3/3] tests/acpi: i386: update FACP table differences

In reply to Liav Albani
Quoted 127 lines · Liav Albani
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Ani Sinha
Quoted 4 lines · Liav Albani

After changing the IAPC boot flags register to indicate support of i8042 in the machine chipset to help the guest OS to determine its existence "faster", we need to have the updated FACP ACPI binary images in tree.

Quoted 9 lines
Quoted 8 lines

Review line 6

Quoted 8 lines
(quoted diff) +1 -1
@@ -1,32 +1,32 @@
  /*
   * Intel ACPI Component Architecture
   * AML/ASL+ Disassembler version 20211217 (64-bit version)
   * Copyright (c) 2000 - 2021 Intel Corporation
   *
- * Disassembly of tests/data/acpi/q35/FACP, Wed Feb 23 22:37:39 2022
+ * Disassembly of /tmp/aml-BBFBI1, Wed Feb 23 22:37:39 2022

cut this out pls

I see, this is indeed not very useful...

Quoted 49 lines
Quoted 11 lines

Review line 16

Quoted 11 lines
(quoted diff) +1 -1
   *
   * ACPI Data Table [FACP]
   *
   * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue (in hex)
   */
 
  [000h 0000   4]                    Signature : "FACP"    [Fixed ACPI Description Table (FADT)]
  [004h 0004   4]                 Table Length : 000000F4
  [008h 0008   1]                     Revision : 03
-[009h 0009   1]                     Checksum : B9
+[009h 0009   1]                     Checksum : B7

and this

Quoted 36 lines
Quoted 36 lines
(quoted diff) +1 -1
  [00Ah 0010   6]                       Oem ID : "BOCHS "
  [010h 0016   8]                 Oem Table ID : "BXPC    "
  [018h 0024   4]                 Oem Revision : 00000001
  [01Ch 0028   4]              Asl Compiler ID : "BXPC"
  [020h 0032   4]        Asl Compiler Revision : 00000001
 
  [024h 0036   4]                 FACS Address : 00000000
  [028h 0040   4]                 DSDT Address : 00000000
  [02Ch 0044   1]                        Model : 01
  [02Dh 0045   1]                   PM Profile : 00 [Unspecified]
  [02Eh 0046   2]                SCI Interrupt : 0009
  [030h 0048   4]             SMI Command Port : 000000B2
  [034h 0052   1]            ACPI Enable Value : 02
  [035h 0053   1]           ACPI Disable Value : 03
  [036h 0054   1]               S4BIOS Command : 00
  [037h 0055   1]              P-State Control : 00
@@ -42,35 +42,35 @@
  [059h 0089   1]     PM1 Control Block Length : 02
  [05Ah 0090   1]     PM2 Control Block Length : 00
  [05Bh 0091   1]        PM Timer Block Length : 04
  [05Ch 0092   1]            GPE0 Block Length : 10
  [05Dh 0093   1]            GPE1 Block Length : 00
  [05Eh 0094   1]             GPE1 Base Offset : 00
  [05Fh 0095   1]                 _CST Support : 00
  [060h 0096   2]                   C2 Latency : 0FFF
  [062h 0098   2]                   C3 Latency : 0FFF
  [064h 0100   2]               CPU Cache Size : 0000
  [066h 0102   2]           Cache Flush Stride : 0000
  [068h 0104   1]            Duty Cycle Offset : 00
  [069h 0105   1]             Duty Cycle Width : 00
  [06Ah 0106   1]          RTC Day Alarm Index : 00
  [06Bh 0107   1]        RTC Month Alarm Index : 00
  [06Ch 0108   1]            RTC Century Index : 32
-[06Dh 0109   2]   Boot Flags (decoded below) : 0000
+[06Dh 0109   2]   Boot Flags (decoded below) : 0002
                 Legacy Devices Supported (V2) : 0
Quoted 9 lines
Quoted 6 lines

Review line 64

Quoted 6 lines
(quoted diff) +1 -1
-            8042 Present on ports 60/64 (V2) : 0
+            8042 Present on ports 60/64 (V2) : 1
                          VGA Not Present (V4) : 0
                        MSI Not Supported (V4) : 0
                  PCIe ASPM Not Supported (V4) : 0
                     CMOS RTC Not Present (V5) : 0

leaving just this

It will be fixed in version 5.

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
(quoted diff) +2 -2
  [06Fh 0111   1]                     Reserved : 00
  [070h 0112   4]        Flags (decoded below) : 000084A5
        WBINVD instruction is operational (V1) : 1
                WBINVD flushes all caches (V1) : 0
                      All CPUs support C1 (V1) : 1
                    C2 works on MP system (V1) : 0
              Control Method Power Button (V1) : 0
              Control Method Sleep Button (V1) : 1
          RTC wake not in fixed reg space (V1) : 0
              RTC can wake system from S4 (V1) : 1
                          32-bit PM Timer (V1) : 0
                        Docking Supported (V1) : 0
@@ -148,32 +148,32 @@
  [0DCh 0220   1]                     Space ID : 01 [SystemIO]
  [0DDh 0221   1]                    Bit Width : 80
  [0DEh 0222   1]                   Bit Offset : 00
  [0DFh 0223   1]         Encoded Access Width : 00 [Undefined/Legacy]
  [0E0h 0224   8]                      Address : 0000000000000620
 
  [0E8h 0232  12]                   GPE1 Block : [Generic Address Structure]
  [0E8h 0232   1]                     Space ID : 00 [SystemMemory]
  [0E9h 0233   1]                    Bit Width : 00
  [0EAh 0234   1]                   Bit Offset : 00
  [0EBh 0235   1]         Encoded Access Width : 00 [Undefined/Legacy]
  [0ECh 0236   8]                      Address : 0000000000000000
 
  Raw Table Data: Length 244 (0xF4)
 
-    0000: 46 41 43 50 F4 00 00 00 03 B9 42 4F 43 48 53 20  // FACP......BOCHS
+    0000: 46 41 43 50 F4 00 00 00 03 B7 42 4F 43 48 53 20  // FACP......BOCHS
      0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
      0020: 01 00 00 00 00 00 00 00 00 00 00 00 01 00 09 00  // ................
      0030: B2 00 00 00 02 03 00 00 00 06 00 00 00 00 00 00  // ................
      0040: 04 06 00 00 00 00 00 00 00 00 00 00 08 06 00 00  // ................
      0050: 20 06 00 00 00 00 00 00 04 02 00 04 10 00 00 00  //  ...............
-    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 00 00 00  // ............2...
+    0060: FF 0F FF 0F 00 00 00 00 00 00 00 00 32 02 00 00  // ............2...
      0070: A5 84 00 00 01 08 00 00 F9 0C 00 00 00 00 00 00  // ................
      0080: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
Quoted 8 lines
Quoted 7 lines

Review line 178

Quoted 7 lines
(quoted diff) +0 -0
      0090: 00 00 00 00 01 20 00 00 00 06 00 00 00 00 00 00  // ..... ..........
      00A0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  // ................
      00B0: 04 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
      00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
      00D0: 01 20 00 00 08 06 00 00 00 00 00 00 01 80 00 00  // . ..............
      00E0: 20 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00  //  ...............
      00F0: 00 00 00 00                                      // ....

this isn't helpful either and will be wrong if cherry picked.

Quoted 3 lines

It will be fixed in version 5 :)

I'll have to not retain the Ack sign of Ani, right?

if all you change is commit log, acks normally stand.

Quoted 65 lines
Quoted 65 lines
Quoted 65 lines

Review line 179

Quoted 2 lines
(quoted diff) +0 -0
 **

Please retain tags from earlier revisions of the patch.

Quoted 1 line
Quoted 58 lines
---
  tests/data/acpi/q35/FACP                    | Bin 244 -> 244 bytes
  tests/data/acpi/q35/FACP.nosmm              | Bin 244 -> 244 bytes
  tests/data/acpi/q35/FACP.slic               | Bin 244 -> 244 bytes
  tests/data/acpi/q35/FACP.xapic              | Bin 244 -> 244 bytes
  tests/qtest/bios-tables-test-allowed-diff.h |   4 ----
  5 files changed, 4 deletions(-)
tests/data/acpi/q35/FACP binary +0 -0
index f6a864cc863c7763f6c09d3814ad184a658fa0a0..a8f6a8961109d01059aceef9f1869cde09a2f10c 100644
GIT binary patch
tests/data/acpi/q35/FACP.nosmm binary +0 -0
index 6a9aa5f370eb9af6a03dc739d8a159be58fdee01..c4e6d18ee5fc64159160d4589aa96b4d648c913a 100644
GIT binary patch
tests/data/acpi/q35/FACP.slic binary +0 -0
index 15986e095cf2db7ee92f7ce113c1d46d54018c62..48bbb1cf5ad0ceda1d2f6d56edf5c1e207bd1a04 100644
GIT binary patch
tests/data/acpi/q35/FACP.xapic binary +0 -0
index 2d3659c9c6753d07c3d48742343cb8e8cc034de7..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -5
index 7570e39369..dfb8523c8b 100644
@@ -1,5 +1 @@
  /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/FACP",
-"tests/data/acpi/q35/FACP.nosmm",
-"tests/data/acpi/q35/FACP.slic",
-"tests/data/acpi/q35/FACP.xapic",
--

2.35.1

#29 lore raw
In reply to Liav Albani
Quoted 9 lines · Liav Albani

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

To allow "flexible" indication, I don't hardcode the bit at location 1 as on in the IA-PC boot flags, but try to search for i8042 on the ISA bus to verify it exists in the system.

Quoted 7 lines

Why this is useful you might ask - this patch allows the guest OS to probe and use the i8042 controller without decoding the ACPI AML blob at all. For example, as a developer of the SerenityOS kernel, I might want to allow people to not try to decode the ACPI AML namespace (for now, we still don't support ACPI AML as it's a work in progress), but still to not probe for the i8042 but just use it after looking in the IA-PC boot flags in the ACPI FADT table.

OK still waiting for v5.

Quoted 18 lines

Liav Albani (3):
tests/acpi: i386: allow FACP acpi table changes hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT
table
tests/acpi: i386: update FACP table differences

 hw/acpi/aml-build.c            |  11 ++++++++++-
 hw/i386/acpi-build.c           |   9 +++++++++
 hw/i386/acpi-microvm.c         |   9 +++++++++
 include/hw/acpi/acpi-defs.h    |   1 +
 tests/data/acpi/q35/FACP       | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.nosmm | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.slic  | Bin 244 -> 244 bytes
 tests/data/acpi/q35/FACP.xapic | Bin 244 -> 244 bytes
 8 files changed, 29 insertions(+), 1 deletion(-)
Signature · 1 line
2.35.1
#30 lore raw
Quoted 19 lines · Michael S. Tsirkin
Quoted 9 lines · Liav Albani

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

To allow "flexible" indication, I don't hardcode the bit at location 1 as on in the IA-PC boot flags, but try to search for i8042 on the ISA bus to verify it exists in the system.

Quoted 7 lines

Why this is useful you might ask - this patch allows the guest OS to probe and use the i8042 controller without decoding the ACPI AML blob at all. For example, as a developer of the SerenityOS kernel, I might want to allow people to not try to decode the ACPI AML namespace (for now, we still don't support ACPI AML as it's a work in progress), but still to not probe for the i8042 but just use it after looking in the IA-PC boot flags in the ACPI FADT table.

Quoted 1 line

OK still waiting for v5.

Since the time is tight, I could quickly make the changes in patch 2 and send it over. I believe 8th is the last date for new changes.

#31 lore raw
Quoted 20 lines · Ani Sinha
Quoted 19 lines · Michael S. Tsirkin
Quoted 16 lines · Liav Albani

This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace.

To allow "flexible" indication, I don't hardcode the bit at location 1 as on in the IA-PC boot flags, but try to search for i8042 on the ISA bus to verify it exists in the system.

Why this is useful you might ask - this patch allows the guest OS to probe and use the i8042 controller without decoding the ACPI AML blob at all. For example, as a developer of the SerenityOS kernel, I might want to allow people to not try to decode the ACPI AML namespace (for now, we still don't support ACPI AML as it's a work in progress), but still to not probe for the i8042 but just use it after looking in the IA-PC boot flags in the ACPI FADT table.

Quoted 4 lines
Quoted 1 line

OK still waiting for v5.

Since the time is tight, I could quickly make the changes in patch 2 and send it over.

Sure.

Quoted 1 line

I believe 8th is the last date for new changes.

Yes.

Signature · 1 line
MST