From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by mx.groups.io with SMTP id smtpd.web10.10583.1651241174949394050 for ; Fri, 29 Apr 2022 07:06:15 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@quicinc.com header.s=qcdkim header.b=eDC7caFb; spf=pass (domain: quicinc.com, ip: 199.106.114.38, mailfrom: quic_rcran@quicinc.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1651241174; x=1682777174; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=/iVEnmj1qBl84wOwx45SybSNqCAhaOAOA3VMqsdebCc=; b=eDC7caFbZhNlO3F7uuN7vJ0kHWDaj5b+F6pDg5dPa/a63xJNa5FtBQFr q+XvmAx5Y8JY4AvwWkCNLh/ARRS/xptL2lygMe8RYzg4dpmSUZD34DWWI yvi5W8p5mJuib+T/qCc9vNUnPhIJPGjlAFVOwQvTLNLH8LQLz4WcyMS+b I=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 29 Apr 2022 07:06:14 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 07:06:14 -0700 Received: from [10.110.46.113] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 29 Apr 2022 07:06:13 -0700 Message-ID: <62288162-149e-f281-943c-c59de75ddce8@quicinc.com> Date: Fri, 29 Apr 2022 08:06:12 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [edk2-devel] [PATCH v6] OvmfPkg/Bhyve: add support for QemuFwCfg To: , , =?UTF-8?Q?Corvin_K=c3=b6hne?= , Sean Brogan , Michael Kinney CC: Ard Biesheuvel , Jordan Justen , FreeBSD Virtualization , Jiewen Yao , Gerd Hoffmann , Rebecca Cran , Peter Grehan References: <20220427100708.15277-1-c.koehne@beckhoff.com> From: "Rebecca Cran" In-Reply-To: Return-Path: quic_rcran@quicinc.com X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) Content-Language: en-US Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit The Standard_Error_Output.log file isn't even really useful (it should show a diff), but there's something wrong with the coding style in Bhyve.c: Files with formatting errors:  Formatting errors in Bhyve/AcpiPlatformDxe/Bhyve.c -- Rebecca Cran On 4/29/22 07:55, Ard Biesheuvel wrote: > (+ sean, mike) > > I tried to merge this but it is rejected by CI, and I got lost in the > maze of CI status and report pages. Could someone please figure out > what's wrong? > > https://github.com/tianocore/edk2/pull/2841 > > On Wed, 27 Apr 2022 at 12:07, Corvin Köhne wrote: >> QemuFwCfg is much more powerful than BhyveFwCtl. Sadly, BhyveFwCtl >> decided to use the same IO ports as QemuFwCfg. It's not possible to use >> both interfaces simultaneously. So, prefer QemuFwCfg over BhyveFwCtl. >> >> Signed-off-by: Corvin Köhne >> Reviewed-by: Rebecca Cran >> Acked-by: Gerd Hoffmann >> Acked-by: Peter Grehan >> Acked-by: Jiewen Yao >> Cc: Ard Biesheuvel >> Cc: Jordan Justen >> Cc: EDKII devel group >> Cc: FreeBSD Virtualization >> --- >> OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 + >> OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c | 41 ++++++++++++++++++++--- >> OvmfPkg/Bhyve/BhyveX64.dsc | 4 +-- >> 3 files changed, 40 insertions(+), 6 deletions(-) >> >> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf >> index 595fd055f9..94c65f32dc 100644 >> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf >> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf >> @@ -43,6 +43,7 @@ >> MemoryAllocationLib >> OrderedCollectionLib >> PcdLib >> + QemuFwCfgLib >> UefiBootServicesTableLib >> UefiDriverEntryPoint >> UefiLib >> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c >> index 8e80aa33e1..e216a21bfa 100644 >> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c >> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c >> @@ -11,6 +11,41 @@ >> #include >> #include >> #include >> +#include // QemuFwCfgFindFile() >> + >> +STATIC >> +EFI_STATUS >> +EFIAPI >> +BhyveGetCpuCount ( >> + OUT UINT32 *CpuCount >> + ) >> +{ >> + FIRMWARE_CONFIG_ITEM Item; >> + UINTN Size; >> + >> + if (QemuFwCfgIsAvailable ()) { >> + if (EFI_ERROR (QemuFwCfgFindFile ("opt/bhyve/hw.ncpu", &Item, &Size))) { >> + return EFI_NOT_FOUND; >> + } else if (Size != sizeof (*CpuCount)) { >> + return EFI_BAD_BUFFER_SIZE; >> + } >> + >> + QemuFwCfgSelectItem (Item); >> + QemuFwCfgReadBytes (Size, CpuCount); >> + >> + return EFI_SUCCESS; >> + } >> + >> + // >> + // QemuFwCfg not available, try BhyveFwCtl. >> + // >> + Size = sizeof (*CpuCount); >> + if (BhyveFwCtlGet ("hw.ncpu", CpuCount, &Size) == RETURN_SUCCESS) { >> + return EFI_SUCCESS; >> + } >> + >> + return EFI_UNSUPPORTED; >> +} >> >> STATIC >> EFI_STATUS >> @@ -23,7 +58,6 @@ BhyveInstallAcpiMadtTable ( >> ) >> { >> UINT32 CpuCount; >> - UINTN cSize; >> UINTN NewBufferSize; >> EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt; >> EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *LocalApic; >> @@ -36,9 +70,8 @@ BhyveInstallAcpiMadtTable ( >> ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER)); >> >> // Query the host for the number of vCPUs >> - CpuCount = 0; >> - cSize = sizeof (CpuCount); >> - if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) { >> + Status = BhyveGetCpuCount (&CpuCount); >> + if (!EFI_ERROR (Status)) { >> DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount)); >> ASSERT (CpuCount >= 1); >> } else { >> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc >> index a8fa4d38ab..002cef32a3 100644 >> --- a/OvmfPkg/Bhyve/BhyveX64.dsc >> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc >> @@ -164,8 +164,7 @@ >> SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf >> UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf >> SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf >> - QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf >> - QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf >> + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf >> BhyveFwCtlLib|OvmfPkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf >> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf >> MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf >> @@ -358,6 +357,7 @@ >> !endif >> PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf >> MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf >> + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf >> >> [LibraryClasses.common.UEFI_APPLICATION] >> PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >> -- >> 2.11.0 >> >> Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff >> Registered office: Verl, Germany | Register court: Guetersloh HRA 7075 >> >> >> > > > >