From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by mx.groups.io with SMTP id smtpd.web10.32052.1683758859037812973 for ; Wed, 10 May 2023 15:47:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@bsdio.com header.s=fm1 header.b=nBL8VMxz; spf=pass (domain: bsdio.com, ip: 64.147.123.25, mailfrom: rebecca@bsdio.com) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id C029432005CA; Wed, 10 May 2023 18:47:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 10 May 2023 18:47:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdio.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1683758857; x=1683845257; bh=WqYHxwfpJ979HgQHRjl82TJWBhjn+/b5L7j VmuRvd5c=; b=nBL8VMxzZf8LILe59x/SP3TZE6XO69soWAMq7hY8ddSrwoJXOEb PFkNtWHbNi5tPpTI7Xdoe2RQ3SZrotrBC7TjD9eBiK9b8eNPsZlyZPc3lgj6JlzV yQU/afUl5/vgHWc25/dWiolxb/ajrjp3wYdxCkvl6UUEMfbr5IdFw3XvtOjN28aj hcj9ep3+xy2MX1IvWITRgfzOXhXA5hpQ8Ec2Yy3i8mVx6oqGieH1PJ6Iow7kStgf z1/gIrBi8FjfYAHBEM4+Bt13LGOFGJAFEtTjYNurHQHhSwOkMbEByVJXEfk6eKp1 IKP3lT4K3CmlSC5AGa24u6YphXu9XeYFXQQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1683758857; x=1683845257; bh=WqYHxwfpJ979HgQHRjl82TJWBhjn+/b5L7j VmuRvd5c=; b=RcVuDgz4T7UYZ/61fbSvMPuUCJBrqbD0hNQWx9YFvQhwpzM4xbX ifxnlRiQW2aYZqt3PSU0h3gqMxgvTdZXI0NO/pgkyGjoafln7+X4S+EretaURoL4 8AFsCVIJV92TMgdEQJfj+mfNsk2HFL23TOAYcgIz4TbNxeihcfkSdU0rA5xynfOJ A08ima0+l46bXHGMCAmS7bcPayFyd41QUoYYpJqn6BhDC6hBWNILKKj4Gr9iz0Fd lmaj/CjMe6ftHkrbGBRM4CyKky5D9HDSH2eNBGeIbT/TEpVlunb2JL6EKOvDATax 0MWRiik4skKerOLcMOqNsA1WivRvOWKSRig== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeegjedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeftvggs vggttggrucevrhgrnhcuoehrvggsvggttggrsegsshguihhordgtohhmqeenucggtffrrg htthgvrhhnpeegfeegveduheejgfduffefhfehleehiefghfetvdejvdelhfeukefhhfdv geehveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hrvggsvggttggrsegsshguihhordgtohhm X-ME-Proxy: Feedback-ID: i5b994698:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 May 2023 18:47:36 -0400 (EDT) Message-ID: <4bd677fa-88c3-db91-0a41-a87b8ddb9229@bsdio.com> Date: Wed, 10 May 2023 16:47:35 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v4 3/3] OvmfPkg/Bhyve: install ACPI tables from memory To: =?UTF-8?Q?Corvin_K=c3=b6hne?= , devel@edk2.groups.io Cc: Gerd Hoffmann , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Peter Grehan References: <20230510072326.309805-1-corvink@FreeBSD.org> <20230510072326.309805-3-corvink@FreeBSD.org> From: "Rebecca Cran" In-Reply-To: <20230510072326.309805-3-corvink@FreeBSD.org> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Reviewed-by: Rebecca Cran On 5/10/23 01:23, Corvin Köhne wrote: > It's much easier to create configuration dependend ACPI tables for bhyve > than for OVMF. For this reason, don't use the statically created ACPI > tables provided by OVMF. Instead prefer the dynamically created ACPI > tables of bhyve. If bhyve provides no ACPI tables or we are unable to > detect those, fall back to OVMF tables. > > Ideally, we use the qemu fwcfg interface to pass the ACPI tables from > bhyve to OVMF. bhyve will support this in the future. However, current > bhyve executables don't support passing ACPI tables by the qemu fwcfg > interface. They just copy the ACPI into main memory. For that reason, > pick up the ACPI tables from main memory. > > Signed-off-by: Corvin Köhne > Acked-by: Gerd Hoffmann > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Jordan Justen > Cc: Rebecca Cran > Cc: Peter Grehan > --- > OvmfPkg/Bhyve/BhyveX64.dsc | 1 + > .../Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 + > OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c | 37 ++++++++++++++++++- > 3 files changed, 38 insertions(+), 1 deletion(-) > > diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc > index d0d2712c5662..465b81ffcd51 100644 > --- a/OvmfPkg/Bhyve/BhyveX64.dsc > +++ b/OvmfPkg/Bhyve/BhyveX64.dsc > @@ -341,6 +341,7 @@ [LibraryClasses.common.UEFI_DRIVER] > PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf > > [LibraryClasses.common.DXE_DRIVER] > + AcpiPlatformLib|OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf > PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf > HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf > diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf > index 94c65f32dcab..75ed8e4a7deb 100644 > --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf > +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf > @@ -35,6 +35,7 @@ [Packages] > UefiCpuPkg/UefiCpuPkg.dec > > [LibraryClasses] > + AcpiPlatformLib > BaseLib > BaseMemoryLib > BhyveFwCtlLib > diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c > index 999e9f151ebb..1e1c90614ea1 100644 > --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c > +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c > @@ -10,6 +10,11 @@ > > #include "AcpiPlatform.h" > > +#include // InstallAcpiTablesFromMemory() > + > +#define BHYVE_ACPI_PHYSICAL_ADDRESS ((UINTN)0x000F2400) > +#define BHYVE_BIOS_PHYSICAL_END ((UINTN)0x00100000) > + > EFI_STATUS > EFIAPI > InstallAcpiTable ( > @@ -241,7 +246,37 @@ InstallAcpiTables ( > IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable > ) > { > - EFI_STATUS Status; > + EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; > + EFI_STATUS Status; > + > + Status = GetAcpiRsdpFromMemory ( > + BHYVE_ACPI_PHYSICAL_ADDRESS, > + BHYVE_BIOS_PHYSICAL_END, > + &Rsdp > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + Status = InstallAcpiTablesFromRsdp ( > + AcpiTable, > + Rsdp > + ); > + if (!EFI_ERROR (Status)) { > + return EFI_SUCCESS; > + } > + > + if (Status != EFI_NOT_FOUND) { > + DEBUG ( > + ( > + DEBUG_WARN, > + "%a: unable to install bhyve's ACPI tables (%r)\n", > + __func__, > + Status > + ) > + ); > + return Status; > + } > > Status = InstallOvmfFvTables (AcpiTable); >