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.7131.1650982989467055441 for ; Tue, 26 Apr 2022 07:23:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=DkxeivVw; 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=1650982989; x=1682518989; h=message-id:date:mime-version:from:subject:to:cc: references:in-reply-to:content-transfer-encoding; bh=bO3red4yIRfbJ/nv0KNHaL4tuEG7UyCUMFkLffQ2GDg=; b=DkxeivVwdg4Ytl6Or3ds/DW7fu0cy5r5BCA3wusTrgBFb1qZIXw7yPWf 0rOW19O6fWpca9n/Xo8mDqIqxJ0d+WJYdxk4AV2sW3Q+qOz1jg+nfBDuW KmDUk3flNJGsjqSasUfshSgn+mSpCyIZ0U7PLUrZxDebtDlj7kx70RI0D g=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 26 Apr 2022 07:23:08 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 07:23:06 -0700 Received: from [10.110.126.126] (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; Tue, 26 Apr 2022 07:23:05 -0700 Message-ID: <87eb8fd7-8b7b-01c2-c5bd-5c1013280d1c@quicinc.com> Date: Tue, 26 Apr 2022 08:23:04 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 From: "Rebecca Cran" Subject: Re: [edk2-devel] [PATCH v5] OvmfPkg/Bhyve: add support for QemuFwCfg To: , , =?UTF-8?Q?K=c3=b6hne=2c_Corvin?= CC: Ard Biesheuvel , "Justen, Jordan L" , FreeBSD Virtualization , Gerd Hoffmann , Rebecca Cran , Peter Grehan References: <20220426130817.771-1-c.koehne@beckhoff.com> 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 Specifically: The commit message format is not valid: * 'CC' should be 'Cc' * 'CC' should be 'Cc' * 'CC' should be 'Cc' * 'CC' should be 'Cc' The 'Cc' email address is not valid: * Email format is invalid: devel@edk2.groups.io https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format -- Rebecca Cran On 4/26/22 08:07, Yao, Jiewen wrote: > Hi > CI failed -https://github.com/tianocore/edk2/pull/2829 > > Would you please try CI by yourself before you submit next patch? > It is mandatory process. > > Thank you > Yao Jiewen > >> -----Original Message----- >> From: Corvin Köhne >> Sent: Tuesday, April 26, 2022 9:08 PM >> Cc: Köhne, Corvin; Ard Biesheuvel >> ; Justen, Jordan L; >> devel@edk2.groups.io; FreeBSD Virtualization > virtualization@freebsd.org>; Yao, Jiewen ; Gerd >> Hoffmann; Rebecca Cran; Peter >> Grehan >> Subject: [PATCH v5] OvmfPkg/Bhyve: add support for QemuFwCfg >> >> 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:devel@edk2.groups.io >> 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 5fa08bebd7..14070fd6dd 100644 >> --- a/OvmfPkg/Bhyve/BhyveX64.dsc >> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc >> @@ -163,8 +163,7 @@ >> >> SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/D >> xeSecurityManagementLib.inf >> UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf >> >> SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLi >> b.inf >> - QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf >> - >> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNu >> ll.inf >> + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf >> BhyveFwCtlLib|OvmfPkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf >> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf >> >> MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptS >> evLib.inf >> @@ -355,6 +354,7 @@ >> !endif >> PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf >> MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf >> + >> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwC >> fg.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 >> >> > > >