All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET)
@ 2020-03-13 14:50 Liran Alon
  2020-03-13 14:50 ` [PATCH v2 1/3] acpi: unit-test: Ignore diff in WAET ACPI table Liran Alon
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Liran Alon @ 2020-03-13 14:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, mst, pbonzini, imammedo, rth

Hi,

This patch-series aims to expose WAET ACPI table to guest. Which
improves performance of Windows guests (since Vista) and ignored by
other guests. This ACPI table is exposed by default by other common
hypervisors such as VMware, Xen (HVM), GCP and AWS.

Regards,
-Liran

v1->v2:
- Update bios-tables-test qtest by the process described at ./tests/qtest/bios-tables-test.c [MST]
- Add to commit message and code better description of the effect of enabling the ACPI PM timer good bit. [MST]
- Remove WAET flags macros and instead use them directly in WAET code generation together with a proper comment. [MST]
- Remove WaetAcpiTable structure and generate table by new coding convention (E.g. Use build_append_int_noprefix()) [Igor]
- Add documentation to build_waet() on specification, spec version and purpose of table. [MST]
- Removed flag that controls if WAET is exposed or not. [Igor]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/3] acpi: unit-test: Ignore diff in WAET ACPI table
  2020-03-13 14:50 [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
@ 2020-03-13 14:50 ` Liran Alon
  2020-03-13 14:50 ` [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Liran Alon @ 2020-03-13 14:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, mst, Liran Alon, pbonzini, imammedo, rth

This is done as a preparation for the following patch to expose WAET
ACPI table to guest.

This patch performs steps 1-3 as describes in
tests/qtest/bios-tables-test.c.

Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 tests/data/acpi/pc/WAET                     | 0
 tests/data/acpi/q35/WAET                    | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 2 ++
 3 files changed, 2 insertions(+)
 create mode 100644 tests/data/acpi/pc/WAET
 create mode 100644 tests/data/acpi/q35/WAET

diff --git a/tests/data/acpi/pc/WAET b/tests/data/acpi/pc/WAET
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tests/data/acpi/q35/WAET b/tests/data/acpi/q35/WAET
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8bf4..b269a1e3e583 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,3 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/pc/WAET",
+"tests/data/acpi/q35/WAET",
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET)
  2020-03-13 14:50 [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
  2020-03-13 14:50 ` [PATCH v2 1/3] acpi: unit-test: Ignore diff in WAET ACPI table Liran Alon
@ 2020-03-13 14:50 ` Liran Alon
  2020-03-16 10:28   ` Igor Mammedov
  2020-03-13 14:50 ` [PATCH v2 3/3] acpi: unit-test: Update WAET ACPI Table expected binaries Liran Alon
  2020-03-13 15:58 ` [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) no-reply
  3 siblings, 1 reply; 10+ messages in thread
From: Liran Alon @ 2020-03-13 14:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, mst, Liran Alon, pbonzini, Elad Gabay, imammedo, rth

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 common hypervisors by default, including:
VMware, GCP and AWS.

This patch adds WAET ACPI Table to QEMU.

We set "ACPI PM timer good" bit in "Emualted Device Flags" field to
indicate that the ACPI PM timer has been enhanced to not require
multiple reads to obtain a reliable value.
This results in improving the performance of Windows guests that use
ACPI PM timer by avoiding unnecessary VMExits caused by these multiple
reads.

Co-developed-by: Elad Gabay <elad.gabay@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 hw/i386/acpi-build.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9c4e46fa7466..1c3a2e8fcb3c 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2512,6 +2512,34 @@ 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);
 }
+
+/*
+ * Windows ACPI Emulated Devices Table
+ * (Version 1.0 - April 6, 2009)
+ * Spec: http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/WAET.docx
+ *
+ * Helpful to speedup Windows guests and ignored by others.
+ */
+static void
+build_waet(GArray *table_data, BIOSLinker *linker)
+{
+    int waet_start = table_data->len;
+
+    /* WAET header */
+    acpi_data_push(table_data, sizeof(AcpiTableHeader));
+    /*
+     * Set "ACPI PM timer good" flag.
+     *
+     * Tells Windows guests that our ACPI PM timer is reliable in the
+     * sense that guest can read it only once to obtain a reliable value.
+     * Which avoids costly VMExits caused by guest re-reading it unnecessarily.
+     */
+    build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */, 4);
+
+    build_header(linker, table_data, (void *)(table_data->data + waet_start),
+                 "WAET", table_data->len - waet_start, 1, NULL, NULL);
+}
+
 /*
  *   IVRS table as specified in AMD IOMMU Specification v2.62, Section 5.2
  *   accessible here http://support.amd.com/TechDocs/48882_IOMMU.pdf
@@ -2859,6 +2887,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
                           machine->nvdimms_state, machine->ram_slots);
     }
 
+    acpi_add_table(table_offsets, tables_blob);
+    build_waet(tables_blob, tables->linker);
+
     /* Add tables supplied by user (if any) */
     for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
         unsigned len = acpi_table_len(u);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/3] acpi: unit-test: Update WAET ACPI Table expected binaries
  2020-03-13 14:50 [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
  2020-03-13 14:50 ` [PATCH v2 1/3] acpi: unit-test: Ignore diff in WAET ACPI table Liran Alon
  2020-03-13 14:50 ` [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
@ 2020-03-13 14:50 ` Liran Alon
  2020-03-13 15:58 ` [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) no-reply
  3 siblings, 0 replies; 10+ messages in thread
From: Liran Alon @ 2020-03-13 14:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, mst, Liran Alon, pbonzini, imammedo, rth

This is done according to step (6) in the process described at
tests/qtest/bios-tables-test.c.

Expected WAET.dsl:

[000h 0000   4]                    Signature : "WAET"    [Windows ACPI Emulated Devices Table]
[004h 0004   4]                 Table Length : 00000028
[008h 0008   1]                     Revision : 01
[009h 0009   1]                     Checksum : 88
[00Ah 0010   6]                       Oem ID : "BOCHS "
[010h 0016   8]                 Oem Table ID : "BXPCWAET"
[018h 0024   4]                 Oem Revision : 00000001
[01Ch 0028   4]              Asl Compiler ID : "BXPC"
[020h 0032   4]        Asl Compiler Revision : 00000001

[024h 0036   4]        Flags (decoded below) : 00000002
                        RTC needs no INT ack : 0
                     PM timer, one read only : 1

Raw Table Data: Length 40 (0x28)

  0000: 57 41 45 54 28 00 00 00 01 88 42 4F 43 48 53 20  // WAET(.....BOCHS
  0010: 42 58 50 43 57 41 45 54 01 00 00 00 42 58 50 43  // BXPCWAET....BXPC
  0020: 01 00 00 00 02 00 00 00                          // ........

Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 tests/data/acpi/pc/WAET                     | Bin 0 -> 40 bytes
 tests/data/acpi/q35/WAET                    | Bin 0 -> 40 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   2 --
 3 files changed, 2 deletions(-)

diff --git a/tests/data/acpi/pc/WAET b/tests/data/acpi/pc/WAET
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2240f58dff6b2f765386b5a2e506fda4800be3e 100644
GIT binary patch
literal 40
mcmWG{bPds9U|?YEaPoKd2v%^42yhMuiZKGkKx`1r1jGQWX$JuS

literal 0
HcmV?d00001

diff --git a/tests/data/acpi/q35/WAET b/tests/data/acpi/q35/WAET
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2240f58dff6b2f765386b5a2e506fda4800be3e 100644
GIT binary patch
literal 40
mcmWG{bPds9U|?YEaPoKd2v%^42yhMuiZKGkKx`1r1jGQWX$JuS

literal 0
HcmV?d00001

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index b269a1e3e583..dfb8523c8bf4 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,3 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/pc/WAET",
-"tests/data/acpi/q35/WAET",
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET)
  2020-03-13 14:50 [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
                   ` (2 preceding siblings ...)
  2020-03-13 14:50 ` [PATCH v2 3/3] acpi: unit-test: Update WAET ACPI Table expected binaries Liran Alon
@ 2020-03-13 15:58 ` no-reply
  2020-03-13 16:22   ` Liran Alon
  2020-03-14 18:27   ` Michael S. Tsirkin
  3 siblings, 2 replies; 10+ messages in thread
From: no-reply @ 2020-03-13 15:58 UTC (permalink / raw)
  To: liran.alon; +Cc: ehabkost, mst, qemu-devel, imammedo, pbonzini, rth

Patchew URL: https://patchew.org/QEMU/20200313145009.144820-1-liran.alon@oracle.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET)
Message-id: 20200313145009.144820-1-liran.alon@oracle.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
e9129fb acpi: unit-test: Update WAET ACPI Table expected binaries
76eaa7a acpi: Add Windows ACPI Emulated Device Table (WAET)
041dfae acpi: unit-test: Ignore diff in WAET ACPI table

=== OUTPUT BEGIN ===
1/3 Checking commit 041dfaefd37e (acpi: unit-test: Ignore diff in WAET ACPI table)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#17: 
new file mode 100644

total: 0 errors, 1 warnings, 3 lines checked

Patch 1/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
2/3 Checking commit 76eaa7ac6ef4 (acpi: Add Windows ACPI Emulated Device Table (WAET))
ERROR: line over 90 characters
#43: FILE: hw/i386/acpi-build.c:2520:
+ * Spec: http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/WAET.docx

WARNING: Block comments use a leading /* on a separate line
#61: FILE: hw/i386/acpi-build.c:2538:
+    build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */, 4);

total: 1 errors, 1 warnings, 43 lines checked

Patch 2/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

3/3 Checking commit e9129fbd5cf2 (acpi: unit-test: Update WAET ACPI Table expected binaries)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20200313145009.144820-1-liran.alon@oracle.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET)
  2020-03-13 15:58 ` [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) no-reply
@ 2020-03-13 16:22   ` Liran Alon
  2020-03-14 18:27   ` Michael S. Tsirkin
  1 sibling, 0 replies; 10+ messages in thread
From: Liran Alon @ 2020-03-13 16:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, imammedo, rth, ehabkost, mst


On 13/03/2020 17:58, no-reply@patchew.org wrote:
> Patchew URL: https://urldefense.com/v3/__https://patchew.org/QEMU/20200313145009.144820-1-liran.alon@oracle.com/__;!!GqivPVa7Brio!MCIj6t775fgVLQyuc_7yakcjRzbRpb0QfWeBkZaMwb72--7RvXHTCgm_18diSyk$
>
>
>
> Hi,
>
> This series seems to have some coding style problems. See output below for
> more information:
>
> Subject: [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET)
> Message-id: 20200313145009.144820-1-liran.alon@oracle.com
> Type: series
>
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> git rev-parse base > /dev/null || exit 0
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> git config --local diff.algorithm histogram
> ./scripts/checkpatch.pl --mailback base..
> === TEST SCRIPT END ===
>
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> Switched to a new branch 'test'
> e9129fb acpi: unit-test: Update WAET ACPI Table expected binaries
> 76eaa7a acpi: Add Windows ACPI Emulated Device Table (WAET)
> 041dfae acpi: unit-test: Ignore diff in WAET ACPI table
>
> === OUTPUT BEGIN ===
> 1/3 Checking commit 041dfaefd37e (acpi: unit-test: Ignore diff in WAET ACPI table)
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #17:
> new file mode 100644
>
> total: 0 errors, 1 warnings, 3 lines checked
>
> Patch 1/3 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 2/3 Checking commit 76eaa7ac6ef4 (acpi: Add Windows ACPI Emulated Device Table (WAET))
> ERROR: line over 90 characters
> #43: FILE: hw/i386/acpi-build.c:2520:
> + * Spec: https://urldefense.com/v3/__http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/WAET.docx__;!!GqivPVa7Brio!MCIj6t775fgVLQyuc_7yakcjRzbRpb0QfWeBkZaMwb72--7RvXHTCgm_RmMn38k$
Just wanted to note that this is intentional. I didn't want to break the 
URL to multiple lines.
>
> WARNING: Block comments use a leading /* on a separate line
> #61: FILE: hw/i386/acpi-build.c:2538:
> +    build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */, 4);
Same here. Intentional. Seems to match the coding convention of other 
places in acpi-build.c.
>
> total: 1 errors, 1 warnings, 43 lines checked
>
> Patch 2/3 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
>
> 3/3 Checking commit e9129fbd5cf2 (acpi: unit-test: Update WAET ACPI Table expected binaries)
> === OUTPUT END ===
>
> Test command exited with code: 1
>
>
> The full log is available at
> https://urldefense.com/v3/__http://patchew.org/logs/20200313145009.144820-1-liran.alon@oracle.com/testing.checkpatch/?type=message__;!!GqivPVa7Brio!MCIj6t775fgVLQyuc_7yakcjRzbRpb0QfWeBkZaMwb72--7RvXHTCgm_VGFnBLg$ .
> ---
> Email generated automatically by Patchew [https://urldefense.com/v3/__https://patchew.org/__;!!GqivPVa7Brio!MCIj6t775fgVLQyuc_7yakcjRzbRpb0QfWeBkZaMwb72--7RvXHTCgm_RlK35c8$ ].
> Please send your feedback to patchew-devel@redhat.com


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET)
  2020-03-13 15:58 ` [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) no-reply
  2020-03-13 16:22   ` Liran Alon
@ 2020-03-14 18:27   ` Michael S. Tsirkin
  1 sibling, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2020-03-14 18:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, rth, liran.alon, ehabkost, imammedo

On Fri, Mar 13, 2020 at 08:58:30AM -0700, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/20200313145009.144820-1-liran.alon@oracle.com/
> 
> 
> 
> Hi,
> 
> This series seems to have some coding style problems. See output below for
> more information:
> 
> Subject: [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET)
> Message-id: 20200313145009.144820-1-liran.alon@oracle.com
> Type: series
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> git rev-parse base > /dev/null || exit 0
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> git config --local diff.algorithm histogram
> ./scripts/checkpatch.pl --mailback base..
> === TEST SCRIPT END ===
> 
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> Switched to a new branch 'test'
> e9129fb acpi: unit-test: Update WAET ACPI Table expected binaries
> 76eaa7a acpi: Add Windows ACPI Emulated Device Table (WAET)
> 041dfae acpi: unit-test: Ignore diff in WAET ACPI table
> 
> === OUTPUT BEGIN ===
> 1/3 Checking commit 041dfaefd37e (acpi: unit-test: Ignore diff in WAET ACPI table)
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #17: 
> new file mode 100644
> 
> total: 0 errors, 1 warnings, 3 lines checked
> 
> Patch 1/3 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 2/3 Checking commit 76eaa7ac6ef4 (acpi: Add Windows ACPI Emulated Device Table (WAET))
> ERROR: line over 90 characters
> #43: FILE: hw/i386/acpi-build.c:2520:
> + * Spec: http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/WAET.docx
> 
> WARNING: Block comments use a leading /* on a separate line
> #61: FILE: hw/i386/acpi-build.c:2538:
> +    build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */, 4);

Looks like a false positive - this is not a block comment.
What's going on?


> total: 1 errors, 1 warnings, 43 lines checked
> 
> Patch 2/3 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
> 3/3 Checking commit e9129fbd5cf2 (acpi: unit-test: Update WAET ACPI Table expected binaries)
> === OUTPUT END ===
> 
> Test command exited with code: 1
> 
> 
> The full log is available at
> http://patchew.org/logs/20200313145009.144820-1-liran.alon@oracle.com/testing.checkpatch/?type=message.
> ---
> Email generated automatically by Patchew [https://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET)
  2020-03-13 14:50 ` [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
@ 2020-03-16 10:28   ` Igor Mammedov
  2020-03-27 15:14     ` Liran Alon
  0 siblings, 1 reply; 10+ messages in thread
From: Igor Mammedov @ 2020-03-16 10:28 UTC (permalink / raw)
  To: Liran Alon; +Cc: ehabkost, mst, qemu-devel, Elad Gabay, pbonzini, rth

On Fri, 13 Mar 2020 16:50:08 +0200
Liran Alon <liran.alon@oracle.com> wrote:

> 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 common hypervisors by default, including:
> VMware, GCP and AWS.
> 
> This patch adds WAET ACPI Table to QEMU.
> 
> We set "ACPI PM timer good" bit in "Emualted Device Flags" field to
> indicate that the ACPI PM timer has been enhanced to not require
> multiple reads to obtain a reliable value.
> This results in improving the performance of Windows guests that use
> ACPI PM timer by avoiding unnecessary VMExits caused by these multiple
> reads.
> 
> Co-developed-by: Elad Gabay <elad.gabay@oracle.com>
> Signed-off-by: Liran Alon <liran.alon@oracle.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/i386/acpi-build.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 9c4e46fa7466..1c3a2e8fcb3c 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2512,6 +2512,34 @@ 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);
>  }
> +
> +/*
> + * Windows ACPI Emulated Devices Table
> + * (Version 1.0 - April 6, 2009)
> + * Spec: http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/WAET.docx
> + *
> + * Helpful to speedup Windows guests and ignored by others.
> + */
> +static void
> +build_waet(GArray *table_data, BIOSLinker *linker)
> +{
> +    int waet_start = table_data->len;
> +
> +    /* WAET header */
> +    acpi_data_push(table_data, sizeof(AcpiTableHeader));
> +    /*
> +     * Set "ACPI PM timer good" flag.
> +     *
> +     * Tells Windows guests that our ACPI PM timer is reliable in the
> +     * sense that guest can read it only once to obtain a reliable value.
> +     * Which avoids costly VMExits caused by guest re-reading it unnecessarily.
> +     */
> +    build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */, 4);
this should work but, I'd use (1UL << 1) if you'll need to respin


> +
> +    build_header(linker, table_data, (void *)(table_data->data + waet_start),
> +                 "WAET", table_data->len - waet_start, 1, NULL, NULL);
> +}
> +
>  /*
>   *   IVRS table as specified in AMD IOMMU Specification v2.62, Section 5.2
>   *   accessible here http://support.amd.com/TechDocs/48882_IOMMU.pdf
> @@ -2859,6 +2887,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
>                            machine->nvdimms_state, machine->ram_slots);
>      }
>  
> +    acpi_add_table(table_offsets, tables_blob);
> +    build_waet(tables_blob, tables->linker);
> +
>      /* Add tables supplied by user (if any) */
>      for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
>          unsigned len = acpi_table_len(u);



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET)
  2020-03-16 10:28   ` Igor Mammedov
@ 2020-03-27 15:14     ` Liran Alon
  2020-03-29 11:29       ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Liran Alon @ 2020-03-27 15:14 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: ehabkost, mst, qemu-devel, Elad Gabay, pbonzini, rth

As almost two weeks have passed since this Reviewed-By comment, can I 
assume this series is done from my perspective and ready to be merged?
As I haven't seen a Reviewed-By for the rest of the patches of this series.

Thanks,
-Liran

On 16/03/2020 12:28, Igor Mammedov wrote:
> On Fri, 13 Mar 2020 16:50:08 +0200
> Liran Alon <liran.alon@oracle.com> wrote:
>
>> 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 common hypervisors by default, including:
>> VMware, GCP and AWS.
>>
>> This patch adds WAET ACPI Table to QEMU.
>>
>> We set "ACPI PM timer good" bit in "Emualted Device Flags" field to
>> indicate that the ACPI PM timer has been enhanced to not require
>> multiple reads to obtain a reliable value.
>> This results in improving the performance of Windows guests that use
>> ACPI PM timer by avoiding unnecessary VMExits caused by these multiple
>> reads.
>>
>> Co-developed-by: Elad Gabay <elad.gabay@oracle.com>
>> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
>
>> ---
>>   hw/i386/acpi-build.c | 31 +++++++++++++++++++++++++++++++
>>   1 file changed, 31 insertions(+)
>>
>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>> index 9c4e46fa7466..1c3a2e8fcb3c 100644
>> --- a/hw/i386/acpi-build.c
>> +++ b/hw/i386/acpi-build.c
>> @@ -2512,6 +2512,34 @@ 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);
>>   }
>> +
>> +/*
>> + * Windows ACPI Emulated Devices Table
>> + * (Version 1.0 - April 6, 2009)
>> + * Spec: https://urldefense.com/v3/__http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/WAET.docx__;!!GqivPVa7Brio!MpZ69-947P6dY4Rnd8Cvj0z_9yJ1QdS-SED39RJ5JvT7Rry_rwDpcLlUDJ_ZU7U$
>> + *
>> + * Helpful to speedup Windows guests and ignored by others.
>> + */
>> +static void
>> +build_waet(GArray *table_data, BIOSLinker *linker)
>> +{
>> +    int waet_start = table_data->len;
>> +
>> +    /* WAET header */
>> +    acpi_data_push(table_data, sizeof(AcpiTableHeader));
>> +    /*
>> +     * Set "ACPI PM timer good" flag.
>> +     *
>> +     * Tells Windows guests that our ACPI PM timer is reliable in the
>> +     * sense that guest can read it only once to obtain a reliable value.
>> +     * Which avoids costly VMExits caused by guest re-reading it unnecessarily.
>> +     */
>> +    build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */, 4);
> this should work but, I'd use (1UL << 1) if you'll need to respin
>
>
>> +
>> +    build_header(linker, table_data, (void *)(table_data->data + waet_start),
>> +                 "WAET", table_data->len - waet_start, 1, NULL, NULL);
>> +}
>> +
>>   /*
>>    *   IVRS table as specified in AMD IOMMU Specification v2.62, Section 5.2
>>    *   accessible here https://urldefense.com/v3/__http://support.amd.com/TechDocs/48882_IOMMU.pdf__;!!GqivPVa7Brio!MpZ69-947P6dY4Rnd8Cvj0z_9yJ1QdS-SED39RJ5JvT7Rry_rwDpcLlUNZTUAnw$
>> @@ -2859,6 +2887,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
>>                             machine->nvdimms_state, machine->ram_slots);
>>       }
>>   
>> +    acpi_add_table(table_offsets, tables_blob);
>> +    build_waet(tables_blob, tables->linker);
>> +
>>       /* Add tables supplied by user (if any) */
>>       for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
>>           unsigned len = acpi_table_len(u);


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET)
  2020-03-27 15:14     ` Liran Alon
@ 2020-03-29 11:29       ` Michael S. Tsirkin
  0 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2020-03-29 11:29 UTC (permalink / raw)
  To: Liran Alon; +Cc: ehabkost, qemu-devel, pbonzini, Elad Gabay, Igor Mammedov, rth


On Fri, Mar 27, 2020 at 06:14:26PM +0300, Liran Alon wrote:
> As almost two weeks have passed since this Reviewed-By comment, can I assume
> this series is done from my perspective and ready to be merged?
> As I haven't seen a Reviewed-By for the rest of the patches of this series.
> 
> Thanks,
> -Liran

I'll queue it for merge after the release. If possible please ping me
after the release to help make sure it didn't get dropped.

Thanks!

-- 
MST



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-29 11:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 14:50 [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
2020-03-13 14:50 ` [PATCH v2 1/3] acpi: unit-test: Ignore diff in WAET ACPI table Liran Alon
2020-03-13 14:50 ` [PATCH v2 2/3] acpi: Add Windows ACPI Emulated Device Table (WAET) Liran Alon
2020-03-16 10:28   ` Igor Mammedov
2020-03-27 15:14     ` Liran Alon
2020-03-29 11:29       ` Michael S. Tsirkin
2020-03-13 14:50 ` [PATCH v2 3/3] acpi: unit-test: Update WAET ACPI Table expected binaries Liran Alon
2020-03-13 15:58 ` [PATCH v2 0/3]: acpi: Add Windows ACPI Emulated Device Table (WAET) no-reply
2020-03-13 16:22   ` Liran Alon
2020-03-14 18:27   ` Michael S. Tsirkin

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.