From nobody Thu Apr 25 11:31:08 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=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1610340877; cv=none; d=zohomail.com; s=zohoarc; b=ULQ/toswrhfhjg0SLYi82/u4KDLiaszPBZ9MSSgpBEswgwYiPk/eUjNcBEyxJQewBb0k1XbolPY3cdeIkqNVC/vZR8TyvrxvXPJURwS17deEeZjjSRceT47blbsKsf9dwjAlfSYA4rHyXVx+1ShCbuVvfHUD/7IRpI5MxeOGuxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610340877; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=dNIUfEmS59iIq6jDgCeVycu3TZTRMQGwzTNqb2D+0R8=; b=gcmBjeIj45m+NfIFP5aURoh7aCqmnHisJdu+qoIBNTF7P9pto5oyvQhnkGllmNaiOmVLr7UM/IeJcTrmfXRUaul1uXOpd1PvoxEXtMP26tf+b9+tZsbkcvI6SWAB8Q6lilps7EP/eiJVmOeDCmc6glMhKoq3rMjQxcN7YsjA6PE= 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=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1610340877633717.2107700873188; Sun, 10 Jan 2021 20:54:37 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.64569.114063 (Exim 4.92) (envelope-from ) id 1kypDG-00016q-FU; Mon, 11 Jan 2021 04:53:54 +0000 Received: by outflank-mailman (output) from mailman id 64569.114063; Mon, 11 Jan 2021 04:53:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kypDG-00016j-CK; Mon, 11 Jan 2021 04:53:54 +0000 Received: by outflank-mailman (input) for mailman id 64569; Mon, 11 Jan 2021 04:53:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kypDE-00016e-Bh for xen-devel@lists.xenproject.org; Mon, 11 Jan 2021 04:53:52 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1d6ef1af-05ef-4027-b1d3-4a01652ee805; Mon, 11 Jan 2021 04:53:50 +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: 1d6ef1af-05ef-4027-b1d3-4a01652ee805 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1610340830; h=from:to:cc:subject:date:message-id:mime-version; bh=4xaMTGPKnMA4X76XrghfKZsFvxhiqTp3/+83cpgVziE=; b=dbfy1cmLId8LB0ZxNLn4B4evUcD+DelyWNsqr8KA3zGiRfiQTS2KooXG oY0IkYXkh/Yc+QBICdrwHmuj+aNkFTtEDngdYGhRdDuBudBwQFrEWb4JP VCMd8gRyq7dhiKc3iYMe9VTVu1b4yr6Q0U41pr5MP0XWJdrJubhgGjmuP I=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: xWU/WsM2W6TTxGZMyY8JQ4DDuv2YiQCjHNzPgd1S+BGt4uYc1Uc3mo58ZirAjGTsDBlXXX1eVN vMjQJU8RzlSYV9N5sNdIqK2IeVsj3igKg39D/1ydvTkD0A9IUaMSjmyNjs/dqBHkCO52yZMoJM YjqHodOwiLq1Thov9nsLa6t0hBKZ9xd/ODtdCre5n8GjToVCCFSDvauqEZryZK1dRRmJd45s5P gE9zmXZfyKQGHb9ipYk8/6sPjhxDtB7vs2nxJzmRengbVsgD4UOKF6BQtXOXp1kOGUbm9WdVf7 Pgw= X-SBRS: 5.2 X-MesageID: 35163712 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.79,337,1602561600"; d="scan'208";a="35163712" From: Igor Druzhinin To: CC: , , , , , , "Igor Druzhinin" Subject: [PATCH] hvmloader: pass PCI MMIO layout to OVMF as an info table Date: Mon, 11 Jan 2021 04:53:31 +0000 Message-ID: <1610340812-24397-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @citrix.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We faced a problem with passing through a PCI device with 64GB BAR to UEFI guest. The BAR is expectedly programmed into 64-bit PCI aperture at 64G address which pushes physical address space to 37 bits. OVMF uses address width early in PEI phase to make DXE identity pages covering the whole addressable space so it needs to know the last address it needs to cover but at the same time not overdo the mappings. As there is seemingly no other way to pass or get this information in OVMF at this early phase (ACPI is not yet available, PCI is not yet enumera= ted, xenstore is not yet initialized) - extend the info structure with a new table. Since the structure was initially created to be extendable - the change is backward compatible. Signed-off-by: Igor Druzhinin --- Companion change in OVMF: https://lists.xenproject.org/archives/html/xen-devel/2021-01/msg00516.html --- tools/firmware/hvmloader/ovmf.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovm= f.c index 23610a0..9bfe274 100644 --- a/tools/firmware/hvmloader/ovmf.c +++ b/tools/firmware/hvmloader/ovmf.c @@ -61,6 +61,14 @@ struct ovmf_info { uint32_t e820_nr; } __attribute__ ((packed)); =20 +#define OVMF_INFO_PCI_TABLE 0 +struct ovmf_pci_info { + uint64_t low_start; + uint64_t low_end; + uint64_t hi_start; + uint64_t hi_end; +} __attribute__ ((packed)); + static void ovmf_setup_bios_info(void) { struct ovmf_info *info =3D (void *)OVMF_INFO_PHYSICAL_ADDRESS; @@ -74,9 +82,21 @@ static void ovmf_setup_bios_info(void) static void ovmf_finish_bios_info(void) { struct ovmf_info *info =3D (void *)OVMF_INFO_PHYSICAL_ADDRESS; + struct ovmf_pci_info *pci_info; + uint64_t *tables =3D scratch_alloc(sizeof(uint64_t)*OVMF_INFO_MAX_TABL= ES, 0); uint32_t i; uint8_t checksum; =20 + pci_info =3D scratch_alloc(sizeof(struct ovmf_pci_info), 0); + pci_info->low_start =3D pci_mem_start; + pci_info->low_end =3D pci_mem_end; + pci_info->hi_start =3D pci_hi_mem_start; + pci_info->hi_end =3D pci_hi_mem_end; + + tables[OVMF_INFO_PCI_TABLE] =3D (uint32_t)pci_info; + info->tables =3D (uint32_t)tables; + info->tables_nr =3D 1; + checksum =3D 0; for ( i =3D 0; i < info->length; i++ ) checksum +=3D ((uint8_t *)(info))[i]; --=20 2.7.4