From nobody Fri Nov 22 19:48:59 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; 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; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1726104134; cv=none; d=zohomail.com; s=zohoarc; b=XAHv2oABaaVi3ubQbUW+0bFvnE+X++9ccCdkcG1Iq9fBgWJoA09yWOECAS8vQBF9oBDkQNlHFsfkd0SmgCAZEQXivQdMHzsjl3/toBOS0I2SwlGV8InMPxjt3HK1VvCLcx0+KmWmwsYKXmbkCdVHEGX5uEEDtG2IQrqUWtcjru4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726104134; h=Content-ID:Content-Type: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=HYl/sDLNyi16R84pg1zZ1u2P+humvhLhbfPZ+Orltio=; b=Tid6k+AXdbEaFALl4jhtCqmHfUcJwVupyY8Fe0BxLy+vxlkA3mo/VZW1mA54zwVm8ihX5qmD9KMy9Lei6sV6xXzqd0jQZnDHxj4t2eDyg8azNH5V2+BRhvOOO0S/gGRseT1kNxc4wDtISRivnic26PE0MsRWgF5+mZ5OW6Pourk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 172610413476034.43447980487372; Wed, 11 Sep 2024 18:22:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.796964.1206715 (Exim 4.92) (envelope-from ) id 1soYWg-0007sm-AN; Thu, 12 Sep 2024 01:21:38 +0000 Received: by outflank-mailman (output) from mailman id 796964.1206715; Thu, 12 Sep 2024 01:21:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1soYWg-0007sf-7t; Thu, 12 Sep 2024 01:21:38 +0000 Received: by outflank-mailman (input) for mailman id 796964; Thu, 12 Sep 2024 01:21:37 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1soYWf-0007sZ-9N for xen-devel@lists.xenproject.org; Thu, 12 Sep 2024 01:21:37 +0000 Received: from nyc.source.kernel.org (nyc.source.kernel.org [2604:1380:45d1:ec00::3]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 59f02819-70a5-11ef-a0b5-8be0dac302b0; Thu, 12 Sep 2024 03:21:35 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 33DB4A41694; Thu, 12 Sep 2024 01:21:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABF04C4CEC0; Thu, 12 Sep 2024 01:21:33 +0000 (UTC) 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: 59f02819-70a5-11ef-a0b5-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726104094; bh=esQ0Ma+7mrdG47i3xpwx1ZVSmO3p1LWObgosh1TkcIQ=; h=Date:From:To:cc:Subject:From; b=X3yfu+7zJPqOLwq7r+YuwM8sNWSgobUTUoI/TmQrAXqsyZqZQkbpA4M0prlneVbKZ wzc0sHZShC/Y9irOfEWJKtB0ccEgTmWo2YRNCpN/Tblhr8T2uqeUCPv/afAjQB1Y9S Zs/9h8cwLVaOW6n6lMIviQVQAomenjJUBdPVOMALTHh9QFv0unrUmxStTF1LEsygqU 2ZmxV5Jh3dqkyaxmY+9IhEb1jSge6n6mVVeXLs04qidfUO/LBDYBje4Gg/7pbbNw/S 7sAskgGXtR+m0yFH6gWpnC38CSwLsWsF8bgxPqR+MplbrJlVyQKlZ5GFM4RpsaITz5 8K2ohgRcN+wyw== Date: Wed, 11 Sep 2024 18:21:32 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: xen-devel@lists.xenproject.org cc: sstabellini@kernel.org, roger.pau@citrix.com, dpsmith@apertussolutions.com, Andrew Cooper , Jan Beulich Subject: [PATCH v4] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-711094187-1726104082=:611587" Content-ID: X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1726104135243116600 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-711094187-1726104082=:611587 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-ID: MIME-Version: 1.0 Xen always generates as XSDT table even if the firmware only provided an RSDT table. Copy the RSDT header from the firmware table, adjusting the signature, for the XSDT table when not provided by the firmware. This is necessary to run Xen on QEMU. 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 --- Changes in v4: - improve commit message - improve in-code comment - add Roger's reviewed-by --- xen/arch/x86/hvm/dom0_build.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index f3eddb6846..3dd913bdb0 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -1078,7 +1078,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 ) @@ -1090,6 +1099,12 @@ 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, unconditionally ensure it has + * an XSDT sig. + */ + xsdt->header.signature[0] =3D 'X'; + /* Add the custom MADT. */ xsdt->table_offset_entry[0] =3D madt_addr; =20 --=20 2.25.1 --8323329-711094187-1726104082=:611587--