From: Igor Mammedov <imammedo@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: ehabkost@redhat.com, qemu-devel@nongnu.org,
Liran Alon <liran.alon@oracle.com>,
Elad Gabay <elad.gabay@oracle.com>,
pbonzini@redhat.com, rth@twiddle.net
Subject: Re: [PATCH] acpi: Add Windows ACPI Emulated Device Table (WAET)
Date: Mon, 16 Mar 2020 14:26:09 +0100 [thread overview]
Message-ID: <20200316142609.5b73a0ca@redhat.com> (raw)
In-Reply-To: <20200313110940-mutt-send-email-mst@kernel.org>
On Fri, 13 Mar 2020 11:26:45 -0400
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Fri, Mar 13, 2020 at 10:36:56AM +0100, Igor Mammedov wrote:
> > On Thu, 12 Mar 2020 13:09:51 -0400
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> >
> > > On Thu, Mar 12, 2020 at 05:27:45PM +0100, Igor Mammedov wrote:
> > > > On Wed, 11 Mar 2020 19:08:26 +0200
> > > > Liran Alon <liran.alon@oracle.com> wrote:
> > > >
> > > > > From: Elad Gabay <elad.gabay@oracle.com>
> > > > >
> > > > > Microsoft introduced this ACPI table to avoid Windows guests performing
> > > > > various workarounds for device erratas. As the virtual device emulated
> > > > > by VMM may not have the errata.
> > > > >
> > > > > Currently, WAET allows hypervisor to inform guest about two
> > > > > specific behaviors: One for RTC and the other for ACPI PM Timer.
> > > > >
> > > > > Support for WAET have been introduced since Windows Vista. This ACPI
> > > > > table is also exposed by other hypervisors, such as VMware, by default.
> > > > >
> > > > > This patch adds WAET ACPI Table to QEMU. It also makes sure to introduce
> > > > > the new ACPI table only for new machine-types.
> > > >
> > > > in addition to comments made by Michael ...
> > > >
> > > > >
> > > > > Signed-off-by: Elad Gabay <elad.gabay@oracle.com>
> > > > > Co-developed-by: Liran Alon <liran.alon@oracle.com>
> > > > > Signed-off-by: Liran Alon <liran.alon@oracle.com>
> > > > > ---
> > > > > hw/i386/acpi-build.c | 18 ++++++++++++++++++
> > > > > hw/i386/pc_piix.c | 2 ++
> > > > > hw/i386/pc_q35.c | 2 ++
> > > > > include/hw/acpi/acpi-defs.h | 25 +++++++++++++++++++++++++
> > > > > include/hw/i386/pc.h | 1 +
> > > > > 5 files changed, 48 insertions(+)
> > > > >
> > > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > > > index 9c4e46fa7466..29f70741cd96 100644
> > > > > --- a/hw/i386/acpi-build.c
> > > > > +++ b/hw/i386/acpi-build.c
> > > > > @@ -2512,6 +2512,19 @@ build_dmar_q35(GArray *table_data, BIOSLinker *linker)
> > > > > build_header(linker, table_data, (void *)(table_data->data + dmar_start),
> > > > > "DMAR", table_data->len - dmar_start, 1, NULL, NULL);
> > > > > }
> > > > > +
> > > > > +static void
> > > > > +build_waet(GArray *table_data, BIOSLinker *linker)
> > > > see build_hmat_lb() for example how to doc comment for such function
> > > > should look like. Use earliest spec version where table was introduced.
> > > >
> > > > > +{
> > > > > + AcpiTableWaet *waet;
> > > > > +
> > > > > + waet = acpi_data_push(table_data, sizeof(*waet));
> > > > > + waet->emulated_device_flags = cpu_to_le32(ACPI_WAET_PM_TIMER_GOOD);
> > > >
> > > > we don't use packed structures for building ACPI tables anymore (there is
> > > > old code that still does but that's being converted when we touch it)
> > > >
> > > > pls use build_append_int_noprefix() api instead, see build_amd_iommu() as
> > > > an example how to build binary tables using it and how to use comments
> > > > to document fields.
> > > > Basic idea is that api makes function building a table match table's
> > > > description in spec (each call represents a row in spec) and comment
> > > > belonging to a row should contain verbatim field name as used by spec
> > > > so reader could copy/past and grep it easily.
> > >
> > >
> > > BTW how about a better name for this function?
> >
> > how about [aml|acpi]_int_raw
> > [...]
>
> I'm not sure how this helps. I think the main problems are
> 1- very long name
> 2- only makes sense if you know that ACPI has a special integer prefix
> 3- easy to confuse which is the value which is the length
> 4- length is in bytes (typical documentation is in bits)
in acpi spec, they use bytes mostly (with occasional bits deviation)
>
> Your suggestion only fixes issue 1.
that's what I don't like the most about current name, it's way too long.
> Having listed it all out, I suggest the following for the purpose of
> building structures:
>
> acpi/aml/build_append_u8
> acpi/aml/build_append_u16
> acpi/aml/build_append_u32
> acpi/aml/build_append_u64
I prefer having length argument, so when I'm reviewing code, I'm basically
comparing it with value in the table.
The same applies to function name, having a bunch of different
names would be distracting, at least where it comes to composing
tables.
So I prefer keeping current list of arguments.
> and maybe
> acpi/aml/build_append_pad( length)
>
> I'm not sure what the best prefix is. I guess we can have them all
> with the slightly different arguments.
next prev parent reply other threads:[~2020-03-16 15:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 17:08 [PATCH] acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
2020-03-11 18:59 ` no-reply
2020-03-11 19:08 ` Liran Alon
2020-03-11 20:24 ` Michael S. Tsirkin
2020-03-12 1:31 ` Liran Alon
2020-03-12 6:27 ` Michael S. Tsirkin
2020-03-11 19:00 ` no-reply
2020-03-11 20:36 ` Michael S. Tsirkin
2020-03-11 23:20 ` Liran Alon
2020-03-12 6:12 ` Michael S. Tsirkin
2020-03-12 11:30 ` Liran Alon
2020-03-12 12:19 ` Michael S. Tsirkin
2020-03-12 12:55 ` Liran Alon
2020-03-12 16:35 ` Igor Mammedov
2020-03-12 18:48 ` Liran Alon
2020-03-13 9:35 ` Igor Mammedov
2020-03-12 16:27 ` Igor Mammedov
2020-03-12 17:09 ` Michael S. Tsirkin
2020-03-13 9:36 ` Igor Mammedov
2020-03-13 15:26 ` Michael S. Tsirkin
2020-03-16 13:26 ` Igor Mammedov [this message]
2020-03-12 17:28 ` Liran Alon
2020-03-12 19:47 ` Michael S. Tsirkin
2020-03-12 21:17 ` Liran Alon
2020-03-13 10:05 ` Igor Mammedov
2020-03-13 14:23 ` Liran Alon
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=20200316142609.5b73a0ca@redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=elad.gabay@oracle.com \
--cc=liran.alon@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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.