From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.44]) by mx.groups.io with SMTP id smtpd.web09.29241.1626708117940636697 for ; Mon, 19 Jul 2021 08:21:58 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=nrDYTn/8; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.93.44, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XkOzuXzHumg6/OBuB0nQ8XRt+LyAfX5RjUnisU7r21cf1/O81GwrWiOd0i2w60LiMjEuNnnu95B8XLq1Q3JQMTVc1DNBFv1B+mCYx2EqyEldbnUoS1Rp/xTUylufVSQH006VIHqsrIf1JPq6KP8N5J21+RiLl6IurQdJSZdxQI9dxEtCbSYOZ/D6ASsuqwZs63Te9y91pXgQtzdSbqc8HA30qqAgWD+grusTS12IZZhIZjEuXxYHw+IBF6y3e4A+7R6C3M4QKzryuLsYitF856znJ8eXZpaTuMxEHtyRCKvw1sm0AtyeFtSQJFUzmhOBIrJtEn8yTRtJ8am5vGgkcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JiW1J5FIoT0DFHnTol3uQ2hCNztqEIZHXigLROFRinw=; b=O7bXdr1afT9h+hV30XkLc7JLDlyscofnh2snJzoxWQXPxWjNHXeTiK1dR/uNJMO+d6J89MBFbPgshsiVo+Clq1HIT2Bc6ZhBlnI2C7BlDq9lPSzAtJxAKsIIAMa0+XGw1s7YWgPL6BEX76ZB+dnsAJydRuTifCgiKAB9X94It/84UUwZKsudGORoiLjHSqky3kO9Wby+iU2AL/UFcwIQY6g5tfPb9jfp9komufGN4x4sdfPIk7kl0zJJblD1KDd8DvGvxbDIWhKoZjqoIBEzAIS/nxN0gbgZfApjIdgyq1LCH+RQJqiptLDhP+yFoopFPcpK5cKNQLDPtSaNYZLWvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JiW1J5FIoT0DFHnTol3uQ2hCNztqEIZHXigLROFRinw=; b=nrDYTn/8cFXzigIrDGA96Z2YVuWA+lWiIuME1dw+DPsdRHqUa5FkwOVAiwDWz2dMyUKA9/OoYyQ2oL7MYrPCZIql49wESB/uo1AAOq76mvAPlTfZH0ep7yGgENktVlsRIMYIfPutgsZgbEoC+feQt/9NKo2WiUoo8MWz3NcTMe4= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM4PR12MB5039.namprd12.prod.outlook.com (2603:10b6:5:38a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Mon, 19 Jul 2021 15:21:56 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208%3]) with mapi id 15.20.4331.032; Mon, 19 Jul 2021 15:21:56 +0000 Subject: Re: [PATCH v2 03/11] OvmfPkg: PlatformBootManagerLibGrub: Allow executing kernel via fw_cfg To: Dov Murik , 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 References: <20210706085501.1260662-1-dovmurik@linux.ibm.com> <20210706085501.1260662-4-dovmurik@linux.ibm.com> From: "Lendacky, Thomas" Message-ID: <869620c9-7eef-2442-282c-447b4e6a3b3b@amd.com> Date: Mon, 19 Jul 2021 10:21:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <20210706085501.1260662-4-dovmurik@linux.ibm.com> X-ClientProxiedBy: SA0PR11CA0085.namprd11.prod.outlook.com (2603:10b6:806:d2::30) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.236.30.241] (165.204.77.1) by SA0PR11CA0085.namprd11.prod.outlook.com (2603:10b6:806:d2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 15:21:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8710254-e15c-49dd-b0f0-08d94ac8f20f X-MS-TrafficTypeDiagnostic: DM4PR12MB5039: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4C0K+6qQAwSLInrKxwJy3qU/VJf08v+Nm3hEks+63Lhe/CHkYYrXJOiNlC4XXh/2YElvQLVsc9R7omUgb0YSAcw482qXNeTJfGFJ9O3Jwof9sXF5l/8uoRZEujudpJq0CfS3iirxDbpTN1+fAj8bCLeQw1UyMjYIVpvX/1CiHe7ok/dbnooKweHmJRNxV3cPknO1Ipx3hcn1fzZrVPmbaSnDAQjpeMkVgBGfe5vh6AWJAeEdxO9AERKbwcKNJ8CNWm1d0ZKMB33PqFFQaHI21kVaFlGNP88npL1xG63h8st17/GcKJXF4NcIMjIShJe8VdouvrT1OuO7y/yKMIpqdZtsHBcPTCHsTMZshQVkqSDfYtvvWmKJGrpx10At5hibdCEleAKuaZVxZ5WmRDVNU4j87EVFxzh1aEZOW0aWgp+Tjs+ywzyKszLOr0vT/c3hT2Visb/ZS/SnQnA4GKL6uNkd8MKo2mIAcOdSBA9iMrXuBPzHa3UR+RAqjq2e023QDYXlXv0krkUMqBb0TytfbJJlAyu2gt4OlTcLkBMTPWVV4Ur4J2vpRK0Rxyhbimo7lu+ug2qb2MdaL0yt1cXDJ51Gi6WnuvE9e5QGCE/l+Q36Sn1mGdetvJT95l4JKMelHQ2K98F9HIC1r8iyCFnwPqHDZnFpB8ECaMUcInmNLz2Uc3GPwpL+B5K2bqiSO/GqOjqlGFqm9IybaztQM1bSicvdqqQQocejgd0tczw3zq/3VHxFsWtgADBVhlfoF0eUeeUTjrk1eSzrEU3ow6rS+z7RfU8F/OHG1yUMtGqCeP84t0GS0PQVhhupF/pKRdh40jXL0EoPuIUSTd0XDvUAcvy9ZTninVkaB6ufCqXSRCo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39860400002)(136003)(396003)(346002)(366004)(53546011)(16576012)(54906003)(186003)(26005)(478600001)(316002)(31686004)(5660300002)(2616005)(38100700002)(7416002)(36756003)(4326008)(83380400001)(8936002)(66476007)(66556008)(966005)(19627235002)(86362001)(956004)(31696002)(66946007)(6486002)(8676002)(2906002)(213903007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?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orOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8710254-e15c-49dd-b0f0-08d94ac8f20f X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 15:21:56.5421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jKFOsHiftgoSY9bppg7lojlzQ6YAqDMGB3j/PJD+g7cyojVk+isIlEE22YDkotgU2U/Z4PtWGNauqZsJS4+IFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5039 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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. Is there any way that the two libraries can use the same file rather than making an exact copy? 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 >