* [PATCH] hw/acpi/microvm: turn on 8042 bit in FADT boot architecture flags if present
@ 2022-03-04 13:17 Ani Sinha
2022-03-04 13:20 ` Michael S. Tsirkin
0 siblings, 1 reply; 2+ messages in thread
From: Ani Sinha @ 2022-03-04 13:17 UTC (permalink / raw)
To: qemu-devel, Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
Richard Henderson, Eduardo Habkost
Cc: Ani Sinha, imammedo, liavalb
The second bit of IAPC_BOOT_ARCH in FADT table indicates the presence of
keyboard controller implemented as 8042 or equivalent micro controller. This
change enables this flag for microvms if such a device exists (for example,
when added explicitly from the QEMU commandline). Change
1f810294bb31bf6ac ("hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table")
enabled this flag for i386 q35 based machines. The reason for doing the same
for micro-vms is to make sure we provide the correct tables to the guest OS
uniformly in all cases when an i8042 device is present. When this bit is not
enabled, guest OSes has to find other indirect methods to detect the device
which we would like to avoid.
Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
hw/i386/acpi-microvm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
index 68ca7e7fc2..12452cb2e5 100644
--- a/hw/i386/acpi-microvm.c
+++ b/hw/i386/acpi-microvm.c
@@ -37,6 +37,7 @@
#include "hw/pci/pcie_host.h"
#include "hw/usb/xhci.h"
#include "hw/virtio/virtio-mmio.h"
+#include "hw/input/i8042.h"
#include "acpi-common.h"
#include "acpi-microvm.h"
@@ -187,6 +188,11 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
.address = GED_MMIO_BASE_REGS + ACPI_GED_REG_RESET,
},
.reset_val = ACPI_GED_RESET_VALUE,
+ /*
+ * ACPI v2, Table 5-10 - Fixed ACPI Description Table Boot Architecture
+ * Flags, bit offset 1 - 8042.
+ */
+ .iapc_boot_arch = i8042_present() ? 0x1 << 1 : 0x0,
};
table_offsets = g_array_new(false, true /* clear */,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hw/acpi/microvm: turn on 8042 bit in FADT boot architecture flags if present
2022-03-04 13:17 [PATCH] hw/acpi/microvm: turn on 8042 bit in FADT boot architecture flags if present Ani Sinha
@ 2022-03-04 13:20 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2022-03-04 13:20 UTC (permalink / raw)
To: Ani Sinha
Cc: Eduardo Habkost, Richard Henderson, qemu-devel, liavalb, imammedo,
Paolo Bonzini
On Fri, Mar 04, 2022 at 06:47:41PM +0530, Ani Sinha wrote:
> The second bit of IAPC_BOOT_ARCH in FADT table indicates the presence of
> keyboard controller implemented as 8042 or equivalent micro controller. This
> change enables this flag for microvms if such a device exists (for example,
> when added explicitly from the QEMU commandline). Change
> 1f810294bb31bf6ac ("hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table")
> enabled this flag for i386 q35 based machines. The reason for doing the same
> for micro-vms is to make sure we provide the correct tables to the guest OS
> uniformly in all cases when an i8042 device is present. When this bit is not
> enabled, guest OSes has to find other indirect methods to detect the device
> which we would like to avoid.
>
> Signed-off-by: Ani Sinha <ani@anisinha.ca>
> ---
> hw/i386/acpi-microvm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
> index 68ca7e7fc2..12452cb2e5 100644
> --- a/hw/i386/acpi-microvm.c
> +++ b/hw/i386/acpi-microvm.c
> @@ -37,6 +37,7 @@
> #include "hw/pci/pcie_host.h"
> #include "hw/usb/xhci.h"
> #include "hw/virtio/virtio-mmio.h"
> +#include "hw/input/i8042.h"
>
> #include "acpi-common.h"
> #include "acpi-microvm.h"
> @@ -187,6 +188,11 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
> .address = GED_MMIO_BASE_REGS + ACPI_GED_REG_RESET,
> },
> .reset_val = ACPI_GED_RESET_VALUE,
> + /*
> + * ACPI v2, Table 5-10 - Fixed ACPI Description Table Boot Architecture
> + * Flags, bit offset 1 - 8042.
> + */
> + .iapc_boot_arch = i8042_present() ? 0x1 << 1 : 0x0,
Please, move this logic to a function, do not duplicate it.
> };
>
> table_offsets = g_array_new(false, true /* clear */,
> --
> 2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-04 13:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-04 13:17 [PATCH] hw/acpi/microvm: turn on 8042 bit in FADT boot architecture flags if present Ani Sinha
2022-03-04 13:20 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).