From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by mx.groups.io with SMTP id smtpd.web11.56915.1683806580494699287 for ; Thu, 11 May 2023 05:03:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@freebsd.org header.s=dkim header.b=RA9wcpme; spf=pass (domain: freebsd.org, ip: 96.47.72.81, mailfrom: corvink@freebsd.org) Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4QH9Wl64Tjz3JPY; Thu, 11 May 2023 12:02:59 +0000 (UTC) (envelope-from corvink@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QH9Wl3kzPz43wJ; Thu, 11 May 2023 12:02:59 +0000 (UTC) (envelope-from corvink@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683806579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pgT3+1BL8TUqvFiSLw6N+Nej3J2V4rfa1JWe6U8ruUI=; b=RA9wcpmeBa1tc80ZULPqVrexFurTswEqSzb8u2ApOb6NSN0oan4pgdwupA0OwyAHKCVOY9 LAVS26OpUL7CAlp+/uw318i8ZyZNvY3FUGI7FBGXQcme2FlTEUa0lI2X49hno1NaCLmWZ7 ez34w7+GLRaoZZaYp1XK9E1MZZQorjtmRXUl7kHukk3/LEFgFvVbC+9hj8AlI1wqxBaKMN gDJD0UGw9sV19g4zbo9+4F48KwMOgjlM43Dd38wgyRVF87CF3lv49TQrLsHUUF47BxDWUM KFIf5+0gskbyTFoZ5c/8zMca1aEPVKBS/6EF9d15SGNIlJa264LyujkWUubwUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683806579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pgT3+1BL8TUqvFiSLw6N+Nej3J2V4rfa1JWe6U8ruUI=; b=Q7sxn0qDPWHzszIMYEnxjlKfzb8JeKKIT7IzR9MhDoHWnCCn7hUgQa6mDdUMQYE0TDvCJm Q7bhNZ5L/3ed+JDcGZWYvo81wqOlMN/OvOfUmaUziB/g21V8mkH7i58O9PsYtgHbb4FgsX +x8IkSmqiTraubkAmlPpnBQ7bQzpD8DWxozZ8341iIWiHxz9wFmWMJkSXd03HAo1GHOY1G OmhwWiGLlblt3SIwvPn4+pATHYtt+423N+M8NBdRQ02qDyK7EpoGq64P52KdLM4vdq+mX2 mPuZxS+aT+lr3FLks46ouPTJNsk6hf8SXM9uFtt/pEL7siY76gG7fpHUisqKYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683806579; a=rsa-sha256; cv=none; b=fPz8qt88Dh/Bp9JBRcELAE0oag3rmDLP5VtxPg57JhPcIt3wh2TpjKmdirV63AQlbfEUW7 Lc6RBF4PJKPRbbRDL1XkAixCTNOhoERCky9KI1KZC2iyz/BMAgECHBrTwrEVTpUt8AD2V/ c0Tc8KcO5/BDX5f4Jxbvm/03U5HoOWbhEE7uc6nGrmU3pyj5W9R/unOAPuLG9gJJQpgcv/ c8FCeRO3bz5YlBg6RM+u6tR5XxeY8vdpMgwA7WUPI1XDeAVTng2eqybEeJ9NHAksKjZ/VS 1HmSWYF6Rd1DMGIyOVrfcP/YDVkVMFn/2MkA/IPluda7Q79zGG8jCBT3cX3afQ== Received: from corvink-nb.beckhoff.com (unknown [IPv6:2001:9e8:da76:7b00:9ecd:454c:c57e:cada]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: corvink) by smtp.freebsd.org (Postfix) with ESMTPSA id 4QH9Wk3LFQzHB9; Thu, 11 May 2023 12:02:58 +0000 (UTC) (envelope-from corvink@FreeBSD.org) From: =?UTF-8?B?Q29ydmluIEvDtmhuZQ==?= To: devel@edk2.groups.io Cc: =?UTF-8?q?Corvin=20K=C3=B6hne?= , Rebecca Cran , Peter Grehan , Gerd Hoffmann , Ard Biesheuvel , Jiewen Yao , Jordan Justen Subject: [PATCH v5 3/3] OvmfPkg/Bhyve: install ACPI tables from memory Date: Thu, 11 May 2023 14:02:39 +0200 Message-Id: <20230511120239.695237-3-corvink@FreeBSD.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230511120239.695237-1-corvink@FreeBSD.org> References: <20230511120239.695237-1-corvink@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=C3=B6hne Reviewed-by: Rebecca Cran Acked-by: Peter Grehan Acked-by: Gerd Hoffmann Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen --- 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 =20 [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/UefiMemoryA= llocationLib.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 =20 [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 @@ =20 #include "AcpiPlatform.h" =20 +#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 =3D GetAcpiRsdpFromMemory ( + BHYVE_ACPI_PHYSICAL_ADDRESS, + BHYVE_BIOS_PHYSICAL_END, + &Rsdp + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D InstallAcpiTablesFromRsdp ( + AcpiTable, + Rsdp + ); + if (!EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + if (Status !=3D EFI_NOT_FOUND) { + DEBUG ( + ( + DEBUG_WARN, + "%a: unable to install bhyve's ACPI tables (%r)\n", + __func__, + Status + ) + ); + return Status; + } =20 Status =3D InstallOvmfFvTables (AcpiTable); =20 --=20 2.40.1