From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mx.groups.io with SMTP id smtpd.web10.1936.1626722105057416478 for ; Mon, 19 Jul 2021 12:15:05 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=HEZ68uG7; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: dovmurik@linux.ibm.com) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16JJ3DR1009380; Mon, 19 Jul 2021 15:15:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=rJ5sWwZ5R0+y18GV1BrtNC5/DBBLrvseVp+fi0Zk7EM=; b=HEZ68uG7we0SSl2DZtTTw6Ksp190VmebTv0n28TdENTlW/Eoka6SkbZzz1uZrCPMXc2g bapxtvZrr07tXIidPO8XKy4ilfUTBbOByNzDwXi8fqsxGiss1dE8TOjvxT2P0Y1ikoCb ZVB5tgv1KxhlsG6RRNKcfPWissTEPaYPaHJU/j9mgeGTMojuz4cZNwcdWn1iO2VGJahO GqtYM5XQqqseNGtAmh+3M49SblEahyN4ojDd+rRc3HdSvmMIIjxUlC5KFhdppuoidIcc 3LnzmeJt+ww8KT5mQ3BAPdi3Oxo+HUyxv8wEJEUXrKAswQeeol5tsarSDjhLTR7N5ZmN 8A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wepnhbqm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jul 2021 15:15:03 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16JJ3IM8012112; Mon, 19 Jul 2021 15:15:02 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wepnhbpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jul 2021 15:15:02 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16JJDYNE003259; Mon, 19 Jul 2021 19:15:01 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma05wdc.us.ibm.com with ESMTP id 39upuahvqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jul 2021 19:15:01 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16JJF0Ms6488644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Jul 2021 19:15:00 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D45C124054; Mon, 19 Jul 2021 19:15:00 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A5CC0124060; Mon, 19 Jul 2021 19:14:56 +0000 (GMT) Received: from [9.65.195.237] (unknown [9.65.195.237]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 19 Jul 2021 19:14:56 +0000 (GMT) Subject: Re: [PATCH v2 03/11] OvmfPkg: PlatformBootManagerLibGrub: Allow executing kernel via fw_cfg To: Tom Lendacky , devel@edk2.groups.io Cc: Tobin Feldman-Fitzthum , Tobin Feldman-Fitzthum , Jim Cadden , James Bottomley , Hubertus Franke , Laszlo Ersek , Ard Biesheuvel , Jordan Justen , Ashish Kalra , Brijesh Singh , Erdem Aktas , Jiewen Yao , Min Xu , Dov Murik References: <20210706085501.1260662-1-dovmurik@linux.ibm.com> <20210706085501.1260662-4-dovmurik@linux.ibm.com> <869620c9-7eef-2442-282c-447b4e6a3b3b@amd.com> From: "Dov Murik" Message-ID: <579f60db-d8bc-dece-f391-6552ff0e0f9f@linux.ibm.com> Date: Mon, 19 Jul 2021 22:14:55 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: <869620c9-7eef-2442-282c-447b4e6a3b3b@amd.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Jr5pqdNOTr9dtS1F405ire0ynNN2q1Qa X-Proofpoint-GUID: YmDn-RkSdzjI5yWC3zrwKCvGRMBoKAsU X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-19_09:2021-07-19,2021-07-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 adultscore=0 spamscore=0 suspectscore=0 phishscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107190109 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 19/07/2021 18:21, Tom Lendacky wrote: > On 7/6/21 3:54 AM, Dov Murik wrote: >> From: James Bottomley >> >> Support QEMU's -kernel option. >> >> OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c is an exact copy >> of OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c . > > Just a nit, but this confused me initially. Maybe it should say something > along the lines of create a QemuKernel.c for PlatformBootManagerLibGrub > that is an exact copy of the file from PlatformBootManagerLib. > You're right; I'll write it clearer. > Is there any way that the two libraries can use the same file rather than > making an exact copy? I guess it's possible by extracting the file into its own library? I'll need to take a deeper look. -Dov > > Thanks, > Tom > >> >> Cc: Laszlo Ersek >> Cc: Ard Biesheuvel >> Cc: Jordan Justen >> Cc: Ashish Kalra >> Cc: Brijesh Singh >> Cc: Erdem Aktas >> Cc: James Bottomley >> Cc: Jiewen Yao >> Cc: Min Xu >> Cc: Tom Lendacky >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3457 >> Signed-off-by: James Bottomley >> --- >> OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + >> OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf | 2 ++ >> OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h | 11 +++++++++++ >> OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c | 5 +++++ >> OvmfPkg/Library/{PlatformBootManagerLib => PlatformBootManagerLibGrub}/QemuKernel.c | 0 >> 5 files changed, 19 insertions(+) >> >> diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc >> index a2f1324c40a6..aefdcf881c99 100644 >> --- a/OvmfPkg/AmdSev/AmdSevX64.dsc >> +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc >> @@ -281,6 +281,7 @@ [LibraryClasses.common.PEIM] >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf >> MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf >> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/PeiQemuFwCfgS3LibFwCfg.inf >> + QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf >> PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf >> QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf >> >> diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf b/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf >> index 9a806d17ec45..5f6f73d18470 100644 >> --- a/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf >> +++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf >> @@ -23,6 +23,7 @@ [Defines] >> >> [Sources] >> BdsPlatform.c >> + QemuKernel.c >> PlatformData.c >> BdsPlatform.h >> >> @@ -46,6 +47,7 @@ [LibraryClasses] >> BootLogoLib >> DevicePathLib >> PciLib >> + QemuLoadImageLib >> UefiLib >> PlatformBmPrintScLib >> Tcg2PhysicalPresenceLib >> diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h >> index 748c63081920..f1d3a2906c00 100644 >> --- a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h >> +++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h >> @@ -172,4 +172,15 @@ PlatformInitializeConsole ( >> IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole >> ); >> >> +/** >> + Loads and boots UEFI Linux via the FwCfg interface. >> + >> + @retval EFI_NOT_FOUND - The Linux kernel was not found >> + >> +**/ >> +EFI_STATUS >> +TryRunningQemuKernel ( >> + VOID >> + ); >> + >> #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_ >> diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c >> index 5c92d4fc2b09..7cceeea4879c 100644 >> --- a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c >> +++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c >> @@ -1315,6 +1315,11 @@ PlatformBootManagerAfterConsole ( >> // >> Tcg2PhysicalPresenceLibProcessRequest (NULL); >> >> + // >> + // Process QEMU's -kernel command line option >> + // >> + TryRunningQemuKernel (); >> + >> // >> // Perform some platform specific connect sequence >> // >> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c >> similarity index 100% >> copy from OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c >> copy to OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c >>