From nobody Mon Feb 9 14:37:52 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588603648; cv=none; d=zohomail.com; s=zohoarc; b=SdeM9wSts+RX5ycjHhet6nS64L8Di5jFTI/nzroRlB/ZmMRipcDJjfaYKaxXwCCMzDwpn7IOtbaHUYp0zfcwKHeXUswuJVefYj21kUbQUHdWQWw6GOCXzPAG7aUEsBp00PfJgF/ZtqTTEbPgRHCS7HhYMxIVwQFO1iMYWMjQueY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588603648; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=K14BES+WMFIbn9g8gN8psPne12nk195ussOGSNV/KSs=; b=k7qhlf0k9n5zjhT8eKQCSZClCsUsXPnhgLiXSijbdimmf9KgfX2fGuM6TQra1OlvLS1ftulvq7fMLHxBmz6q7PZFNfhhAp3tjETgsnWyoA5847/HOv85iZDpt+q++B4yMkl49eMFTWVtdt6TMxdXYjjB9wz4pBbEfLGB/ZENk74= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158860364801217.26286382792898; Mon, 4 May 2020 07:47:28 -0700 (PDT) Received: from localhost ([::1]:37138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVcNS-0002UD-JH for importer@patchew.org; Mon, 04 May 2020 10:47:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVc7M-0007cH-Q2 for qemu-devel@nongnu.org; Mon, 04 May 2020 10:30:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:52501 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVc7L-0007BT-42 for qemu-devel@nongnu.org; Mon, 04 May 2020 10:30:48 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-6rNV01IwNXmtjoii3MQVgQ-1; Mon, 04 May 2020 10:30:14 -0400 Received: by mail-wr1-f69.google.com with SMTP id 30so365194wrp.22 for ; Mon, 04 May 2020 07:30:14 -0700 (PDT) Received: from redhat.com (bzq-109-66-7-121.red.bezeqint.net. [109.66.7.121]) by smtp.gmail.com with ESMTPSA id x16sm12527456wrn.76.2020.05.04.07.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 07:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588602646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K14BES+WMFIbn9g8gN8psPne12nk195ussOGSNV/KSs=; b=BLmeD/hhazn0h1daFvgH7NrBVdTpq/6zYgxpYFPgY2n+wT9KDVVzXMfkU0CRg5eM3E+1D7 8FP3EaCA3iFfkXWKjw/AdA6vAEcDiID42FxEeGJ5JUTydzkFTQUEIhdfFbSjSpUA3bxE56 m/pcEmfDfqHH1m+uAI7+WM6ma3qR1Ho= X-MC-Unique: 6rNV01IwNXmtjoii3MQVgQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SvK/mML0hz5y1ob99KnJXcmnCwrQAmI3Al2Kedz9fuQ=; b=RcLBIEabmJ1qDjSGmMSqFFeTRAk/an2Sjz/h5jvPM9bL8q1qsdvARV7XF/yRRjJLON AwdqJ2Rktl5JJdxolp93Fx9Sbl69YMhveuljNRdNm4ETrxHnn4w+zJc3XcvhqZNaTeoA 9kWFdAxLfh3V0TcU749Vu54g4vzhOKgBMMVgiHMIGQHMfEhQBqxn8L/wMzWi0VRg47aU ggKTeklZo9kH/5daLFBcVoqPJBoWdx7tHMPkYp/BQhpSxa6OQgkMxcXlCh6NXxpisFoM hNVbHbz2TW0E7EoSStnCEYgJnOHTX8Svwp4005nds78zoEFe8JEfJTDZwZuafEk9FLTl pxgw== X-Gm-Message-State: AGi0PuaX+gIJT2wmR65hB3N5JEx+QkQ/6/uwxYiWQOzUyRYHqV6fHDHR V8PtCI9LDKKTm+qePZWTe+95m+w6QgDuxXKKbOxbwYKLHmH2ZGtutfR6pETeUsp95JaXGhrUmTF tUzW8C9+OrdI9NKE= X-Received: by 2002:a1c:1b0b:: with SMTP id b11mr15741597wmb.182.1588602613290; Mon, 04 May 2020 07:30:13 -0700 (PDT) X-Google-Smtp-Source: APiQypL5/gC6OcLO6h+1lQ7Gh9SSFJ70lKElmnKKcHPTPeKmjofiV0X6uJ/caoKIyA2OF6b8tFrvRg== X-Received: by 2002:a1c:1b0b:: with SMTP id b11mr15741564wmb.182.1588602613044; Mon, 04 May 2020 07:30:13 -0700 (PDT) Date: Mon, 4 May 2020 10:30:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 24/29] acpi: Add Windows ACPI Emulated Device Table (WAET) Message-ID: <20200504142814.157589-25-mst@redhat.com> References: <20200504142814.157589-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200504142814.157589-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 04:24:57 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Liran Alon , Igor Mammedov , Elad Gabay , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Liran Alon 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 Signed-off-by: Liran Alon Message-Id: <20200313145009.144820-3-liran.alon@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov --- 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 7d880bec4a..2e15f6848e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2512,6 +2512,34 @@ build_dmar_q35(GArray *table_data, BIOSLinker *linke= r) build_header(linker, table_data, (void *)(table_data->data + dmar_star= t), "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-A= 97E-CE7CE0D98DC2/WAET.docx + * + * Helpful to speedup Windows guests and ignored by others. + */ +static void +build_waet(GArray *table_data, BIOSLinker *linker) +{ + int waet_start =3D 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 unnecessa= rily. + */ + build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */,= 4); + + build_header(linker, table_data, (void *)(table_data->data + waet_star= t), + "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); } =20 + acpi_add_table(table_offsets, tables_blob); + build_waet(tables_blob, tables->linker); + /* Add tables supplied by user (if any) */ for (u =3D acpi_table_first(); u; u =3D acpi_table_next(u)) { unsigned len =3D acpi_table_len(u); --=20 MST