All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Ani Sinha <ani@anisinha.ca>
Cc: mst@redhat.com, shentey@gmail.com,
	Liav Albani <liavalb@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v4 2/3] hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table
Date: Tue, 1 Mar 2022 09:48:32 +0100	[thread overview]
Message-ID: <20220301094832.59fe2772@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2203010826360.1505325@anisinha-lenovo>

On Tue, 1 Mar 2022 08:29:05 +0530 (IST)
Ani Sinha <ani@anisinha.ca> wrote:

> On Mon, 28 Feb 2022, Liav Albani 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.
> >
> > Signed-off-by: Liav Albani <liavalb@gmail.com>
> > ---
> >  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(-)
> >
> > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > index 8966e16320..2085905b83 100644
> > --- a/hw/acpi/aml-build.c
> > +++ b/hw/acpi/aml-build.c
> > @@ -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.
> 
> > +     * 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

> > +    if (f->rev == 1) {
> > +        build_append_int_noprefix(tbl, 0, 2);
> > +    } else {
maybe add here
/* Since ACPI 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 */
> >
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index ebd47aa26f..c72c7bb9bb 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -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  
> 
> again typo here.
> 
> > +     * 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.
> 
> > +
> >      *data = fadt;
> >  }
> >
> > diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
> > index 68ca7e7fc2..4bc72b1672 100644
> > --- a/hw/i386/acpi-microvm.c
> > +++ b/hw/i386/acpi-microvm.c
> > @@ -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;  
> 
> 
> Ditto.
> 
> > +
> >      table_offsets = g_array_new(false, true /* clear */,
> >                                          sizeof(uint32_t));
> >      bios_linker_loader_alloc(tables->linker,
> > diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
> > index c97e8633ad..2b42e4192b 100644
> > --- a/include/hw/acpi/acpi-defs.h
> > +++ b/include/hw/acpi/acpi-defs.h
> > @@ -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
> >
> >  
> 



  reply	other threads:[~2022-03-01  9:51 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 20:17 [PATCH v4 0/3] hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table Liav Albani
2022-02-28 20:17 ` [PATCH v4 1/3] tests/acpi: i386: allow FACP acpi table changes Liav Albani
2022-03-01  2:55   ` Ani Sinha
2022-02-28 20:17 ` [PATCH v4 2/3] hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table Liav Albani
2022-03-01  2:59   ` Ani Sinha
2022-03-01  8:48     ` Igor Mammedov [this message]
2022-03-01  8:43   ` Igor Mammedov
2022-03-01  9:52     ` Ani Sinha
2022-03-01 11:51       ` Igor Mammedov
2022-03-01 19:20       ` Liav Albani
2022-03-02  5:14         ` Ani Sinha
2022-03-02 12:42           ` Michael S. Tsirkin
2022-03-02 15:43             ` Liav Albani
2022-03-02 15:51               ` Ani Sinha
2022-03-02 15:58             ` Ani Sinha
2022-03-01 11:19     ` Michael S. Tsirkin
2022-03-01 11:47       ` Igor Mammedov
2022-03-01 12:18         ` Michael S. Tsirkin
2022-03-02 15:45           ` Liav Albani
2022-03-04 10:58             ` Igor Mammedov
2022-03-01 19:11       ` Liav Albani
2022-03-02  5:12         ` Ani Sinha
2022-03-02  8:47         ` Michael S. Tsirkin
2022-02-28 20:17 ` [PATCH v4 3/3] tests/acpi: i386: update FACP table differences Liav Albani
2022-03-01  2:59   ` Ani Sinha
2022-03-01 11:21     ` Michael S. Tsirkin
2022-03-01 19:13       ` Liav Albani
2022-03-02  5:05         ` Ani Sinha
2022-03-02  8:48         ` Michael S. Tsirkin
2022-03-04 10:26 ` [PATCH v4 0/3] hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table Michael S. Tsirkin
2022-03-04 10:34   ` Ani Sinha
2022-03-04 10:39     ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220301094832.59fe2772@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=liavalb@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shentey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.