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.web10.13333.1683099160133009792 for ; Wed, 03 May 2023 00:32:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@freebsd.org header.s=dkim header.b=FvL7XkY/; spf=pass (domain: freebsd.org, ip: 96.47.72.81, mailfrom: corvink@freebsd.org) Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (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 4QB7vW3NTkz45lv; Wed, 3 May 2023 07:32:39 +0000 (UTC) (envelope-from corvink@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4QB7vW2YD5z4XNP; Wed, 3 May 2023 07:32:39 +0000 (UTC) (envelope-from corvink@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683099159; 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=MUCvgSYs+Q1yuFn361UMhk6FwW/Iz7go8U85Rb9GLMY=; b=FvL7XkY/ek2Qb99jjAtbQnZxPaBF+hsMZ4nBgh9ejm1swX//dpI9Iftiucfd1gAv8o2nSN 7qPTIoftU0RZdQKv1GtqXDS5TdUcPPD3GJi2Yb4oEiLDBX+1qrGdmNeQTx+JLuPgReDDlB GoO5hqwbJ6VtPO36/BuCEBq7lsMtfeLWTL64arMhzbRBq61LzU3RDWnDJSO8BvpRCfCy1u vxpsZQwT6agNql2eb/uuVd5TGjP6BzKtpjolYM7tIDBpRV4lsEHaERi1UXvsCUxRutTivq NjKia6uU1JyX698gxw8Uw+vsDHCVwL+UaXu73KYgNfhxHXJwLyZz93zb4lMkUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683099159; 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=MUCvgSYs+Q1yuFn361UMhk6FwW/Iz7go8U85Rb9GLMY=; b=eQ3zPjcy5TRxdTAzuyqEBcymmeRUOu9+VTrkroDsgwvka3Qt7zeDL54ownjSH/CyZiRSZn Q8h2O7m/mA5NuzikEskWT0XKh3ZQM/McxAhCJTCOqOEkiSEaQP9UPAE7JKBbSoepMiU669 H94KLBlQ4wf5cVSA/7Xm+X1njOReloXKYg5x4o/j6L1AkBSmwhNtPlkerqGazIRgfbCDJg 1fjeL4U5NXOhIUCNr+7EQ30moSWDD2osDawx2aByPGRKaTJQQ+KWvOvQhaAv/gWYGIIiBW QP2EkH7P10KjuIXDub4nB1HN+R1kdjGViFsPZlzQeQSUxgvEjxh3fSOc/wTN5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683099159; a=rsa-sha256; cv=none; b=erGK2VlNal8g7HW9fx1Rzy+NN3ZQ5msnKRGfM8WcUdCVzFB2vVIRpzhVPCPea4AENsKzyy I8VeVhJnXiccDmZm/Xc2fdSHpZHZOhWJInYitmpI3+YeSJnSTQsl+TF8ZbebZz5AFWtFqw cGWr1lMm4T0tsLFsYEuotugIMZ341WToIjOXqC+hqDYiaCOVnmelQV127uqI+PgO4kCamB nNrgUXiTEJ+dTbDND9N0Tj2Rpl1KGWnkVF1bpcv3ZaWb0MH+RHCw7D7+Pykgt3HOXS4CTx 2N6+L/MPalbURveh0u3Ww3U51SW50YeKDyGl3Xm+PfQTClf6TS07edN8ZxMHKA== Received: from corvink-nb.beckhoff.com (unknown [IPv6:2001:9e8:da7b:3000:a559:ee9a:32a4:e1d9]) (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 4QB7vV25mLzZrR; Wed, 3 May 2023 07:32:38 +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?= , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Rebecca Cran , Peter Grehan Subject: [PATCH v3 3/3] OvmfPkg/Bhyve: install ACPI tables from memory Date: Wed, 3 May 2023 09:32:05 +0200 Message-Id: <20230503073205.306090-3-corvink@FreeBSD.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230503073205.306090-1-corvink@FreeBSD.org> References: <20230503073205.306090-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 Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Rebecca Cran Cc: Peter Grehan --- OvmfPkg/Bhyve/BhyveX64.dsc | 1 + .../Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 + OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+) 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..a4498080cf7a 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 ( @@ -243,6 +248,27 @@ InstallAcpiTables ( { EFI_STATUS Status; =20 + Status =3D InstallAcpiTablesFromMemory ( + AcpiTable, + BHYVE_ACPI_PHYSICAL_ADDRESS, + BHYVE_BIOS_PHYSICAL_END + ); + 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; + } + Status =3D InstallOvmfFvTables (AcpiTable); =20 return Status; --=20 2.40.1