From nobody Sat May 18 23:23:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1713986351; cv=pass; d=zohomail.com; s=zohoarc; b=ESqW4n3Top6lsrvjd9IKPshG2AF1Ru1Jgt49GGgFfLaA4FCImyeTvhIupMTwcp69/J47ZLM08nTsB10oLijzANSvepsGjw6od6Mlor3IqLL7JFMon5wvX7eXz0Jl91VVUT6Zq0u4HsYYGSWRwnlMfGh+u9uSHIVDKxtHYDnzock= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713986351; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zsHXuWCfw2B6RyFVe1ZZYclnQ2RG44VTa61HMRC0aJQ=; b=MRXh0MgGxCHmoIx6LpokisvlWc/okG4VhUnOZivl9sS9XstFUUVeFOixaAtYS8HtiPxgmFOCATXfkgDOPTPH5xywCJYp/Ol7rX+dHsNtM99TKUk5vhG4MQT6I3pqwQ4XNLU5Up3sohzmwx52V6LnJZIoD5Bc1YoYUADlYFqj3Sk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1713986351541863.3723824872623; Wed, 24 Apr 2024 12:19:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711637.1111753 (Exim 4.92) (envelope-from ) id 1rzi8q-000677-LF; Wed, 24 Apr 2024 19:18:52 +0000 Received: by outflank-mailman (output) from mailman id 711637.1111753; Wed, 24 Apr 2024 19:18:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzi8q-000670-Hl; Wed, 24 Apr 2024 19:18:52 +0000 Received: by outflank-mailman (input) for mailman id 711637; Wed, 24 Apr 2024 19:18:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzi8o-00066u-Io for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 19:18:50 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 78c5c62b-026f-11ef-b4bb-af5377834399; Wed, 24 Apr 2024 21:18:47 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1713986316503101.01606128243566; Wed, 24 Apr 2024 12:18:36 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 78c5c62b-026f-11ef-b4bb-af5377834399 ARC-Seal: i=1; a=rsa-sha256; t=1713986320; cv=none; d=zohomail.com; s=zohoarc; b=k00y0KNmamhlstad9CkgCB3LCtmgQYbp1rjXav2lqV3elVkfQmdo+QbDXHqIxci5bbzVqkT+KDgpMzZuiEooCPJTu5f29yuoDmuogEnVunmpxnWEzLkRJ46irRNPQKhyreEM3lpAkL00jOvMYCtOpG2P1IdT9C5OXfPPLfLQeVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713986320; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=zsHXuWCfw2B6RyFVe1ZZYclnQ2RG44VTa61HMRC0aJQ=; b=MwZukq4pkk/UFH/iew9lVwwXxCu/KguGFjxdpcnDgvvRA/aReUXLBZwBNdeRc1yTndtPpIX3/H40wvyCoQsvQdDJct8DnHRKsxGIjibrsFeQhx9mk+UX7iSLYq5cwqZKds+ECGe04QiW019sVqi3cUMryZNCNB6jabUG+KdUyKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1713986320; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding:Reply-To; bh=zsHXuWCfw2B6RyFVe1ZZYclnQ2RG44VTa61HMRC0aJQ=; b=ot5w+NPKTLNSOUoevnJtUB4yteLFzHI2tms8OpqChx5wyS5CFk3W04loPstw2sal Gg4oLYH3cnN33wY05RPD7GUcHDGiZOAxxzaZawS84UeVbNBLMh5l6xtnqGNF5/BAdEL W35naNVJxfZATsSGfGC5Uxv3CHNC6WT2hOdwGTt8= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P . Smith" , Jan Beulich , Andrew Cooper Subject: [PATCH v3] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build Date: Wed, 24 Apr 2024 15:18:26 -0400 Message-Id: <20240424191826.23656-1-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1713986352399100001 From: Stefano Stabellini Xen always generates as XSDT table even if the firmware provided an RSDT ta= ble. Copy the RSDT header from the firmware table, adjusting the signature, for = the XSDT table when not provided by the firmware. Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables') Suggested-by: Roger Pau Monn=C3=A9 Signed-off-by: Stefano Stabellini Signed-off-by: Daniel P. Smith Reviewed-by: Roger Pau Monn=C3=A9 --- This patch is used for development and testing of hyperlaunch using the QEMU emulator. After dicussiong with Stefano, he was okay with me addressing Jan= 's comment regarding the table signature and reposting for acceptance. Changes in v3: - ensure the constructed XSDT table always has the correct signature --- xen/arch/x86/hvm/dom0_build.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index ac71d43a6b3f..781aac00fe72 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -1077,7 +1077,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain = *d, paddr_t madt_addr, rc =3D -EINVAL; goto out; } - xsdt_paddr =3D rsdp->xsdt_physical_address; + /* + * Note the header is the same for both RSDT and XSDT, so it's fine to + * copy the native RSDT header to the Xen crafted XSDT if no native + * XSDT is available. + */ + if ( rsdp->revision > 1 && rsdp->xsdt_physical_address ) + xsdt_paddr =3D rsdp->xsdt_physical_address; + else + xsdt_paddr =3D rsdp->rsdt_physical_address; + acpi_os_unmap_memory(rsdp, sizeof(*rsdp)); table =3D acpi_os_map_memory(xsdt_paddr, sizeof(*table)); if ( !table ) @@ -1089,6 +1098,9 @@ static int __init pvh_setup_acpi_xsdt(struct domain *= d, paddr_t madt_addr, xsdt->header =3D *table; acpi_os_unmap_memory(table, sizeof(*table)); =20 + /* In case the header is an RSDT copy, blindly ensure it has an XSDT s= ig */ + xsdt->header.signature[0] =3D 'X'; + /* Add the custom MADT. */ xsdt->table_offset_entry[0] =3D madt_addr; =20 --=20 2.30.2