From nobody Thu Mar 28 22:18:12 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=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1685056775; cv=none; d=zohomail.com; s=zohoarc; b=HxpmxbkwQCPoQYUtTGIvIMEKeQBNeNvEOYLZ+hu18FXpRmFqhCdiA1AZxfjT+clNyDsHoLwzXyqPyy4QLzNJF8nwYGChl339HqiD0JxAqtDaDvLL9IBju0GsQ6yKAUcjfPAeP7/kdYoeepz1DGGcSc4JT75NbwfJ3UcpIvTchNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685056775; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=900fZQ26vS/MDFDmIqn9aW2Bh99+0p5xyygwSgRi6ag=; b=GBEhE7WxxQ/2iuW59ELtWeOY/tHvh6n3h2XpskXTNGuHWSP0n9RbTd4ZRQBxfgVR4+mYqNEIMMpVL4J/f4aEO6YHK/6XykAkCpkrfYkjQZEHvci2u91RptLOY68zU6ItQA/uOTnT1nUKPynBPn7m0ci25qE16ZLpY/1koch4SHw= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1685056775364408.4138943099224; Thu, 25 May 2023 16:19:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.539904.841236 (Exim 4.92) (envelope-from ) id 1q2KEV-0007I4-N9; Thu, 25 May 2023 23:18:59 +0000 Received: by outflank-mailman (output) from mailman id 539904.841236; Thu, 25 May 2023 23:18:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q2KEV-0007Hx-Jq; Thu, 25 May 2023 23:18:59 +0000 Received: by outflank-mailman (input) for mailman id 539904; Thu, 25 May 2023 23:18:58 +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 1q2KEU-0007Hr-6w for xen-devel@lists.xenproject.org; Thu, 25 May 2023 23:18:58 +0000 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 84dd478f-fb52-11ed-b230-6b7b168915f2; Fri, 26 May 2023 01:18:56 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1A0E60B97; Thu, 25 May 2023 23:18:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55C29C433D2; Thu, 25 May 2023 23:18:53 +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: 84dd478f-fb52-11ed-b230-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685056734; bh=En/PW37VhNrHjZx8SCC8JoA7W2AGgRTtjGtgFDrtiYk=; h=From:To:Cc:Subject:Date:From; b=hPtQ2y5IDzTlekGESTgzGnfNKZ+ChPKwBC7nztZUi6SK6OfScobvpDtHS5DNB69nP jl15k7FfLaROdDaVGjc39IPNIxrjDo+hFA9anzskY1VlhJbnr8VfB8FAAE284KY3vy 9pHScrkzEmVpbtdvTX9MA0A+5PCRBvuLf2M6S8rUmL6CADtlEOw7C3FWwAj8/cQmfI 5HMl0RdhX4bieIg7R8Soc9ZK2l0l59yrvlsCXW6Hgw038yvSwFY1JZxSwbhpE2iS6M +luSkV/AjdvrmjcTy16M2puTtCb4IzRI3M7OVvLV9R4nwz2Q3L3dwd5MI64IGBTHc6 XsxGfISFmcfpQ== From: Stefano Stabellini To: roger.pau@citrix.com, jbeulich@suse.com Cc: andrew.cooper3@citrix.com, sstabellini@kernel.org, xen-devel@lists.xenproject.org, Xenia.Ragiadakou@amd.com, Stefano Stabellini Subject: [PATCH v2] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build Date: Thu, 25 May 2023 16:18:51 -0700 Message-Id: <20230525231851.700750-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1685056777624100001 From: Stefano Stabellini Xen always generates a XSDT table even if the firmware provided a RSDT table. Copy the RSDT header from the firmware table when the XSDT table is missing. Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables') Suggested-by: Roger Pau Monn=C3=A9 Signed-off-by: Stefano Stabellini --- Note that this patch is sufficient to get Xen and Dom0 PVH to boot on QEMU. It turns out that dom0-iommu=3Dnone is not needed because QEMU can actually emulate an AMD IOMMU. I just needed to use the right command line arguments. Without dom0-iommu=3Dnone, the error fixed by the second patch in v1 doesn't manifest, so I dropped patch 2/2. FYI this is the QEMU command line to use: qemu-system-x86_64 \ -machine q35 \ -device amd-iommu \ -m 2G -smp 2 \ -monitor none -serial stdio \ -nographic \ -device virtio-net-pci,netdev=3Dn0 \ -netdev user,id=3Dn0,tftp=3Dbinaries,bootfile=3D/pxelinux.0 This is pxelinux.0: kernel xen console=3Dcom1 dom0=3Dpvh dom0_mem=3D1G noreboot module bzImage console=3Dhvc0 module xen-rootfs.cpio.gz boot I'll work on adding a gitlab-ci test for this next. --- xen/arch/x86/hvm/dom0_build.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index fd2cbf68bc..e1043e40d2 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -966,7 +966,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 ) --=20 2.25.1