From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.15955.1646015238069348354 for ; Sun, 27 Feb 2022 18:27:18 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ih62mKVb; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: jiewen.yao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646015238; x=1677551238; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VQKFcO0L4zgzayYNfIflZLpRR4/C/fYEhv+r81joeo0=; b=ih62mKVb5d3D9uuLl+/IttE414TNFPceWn/LjmmN6yUK+uf+1g35uXaD U7QcYg3kRPyxnD65zeEOkQ1ih6wiLCeP8rQ0gOARECj5kSnnWjz9x88HH oSYbhez9IBHHUSSEfocNLeQgPAHZmykalYJl4HNM7hGQquBSa0E8oh48l pvoPmeMLPEywAr53L+4On4kkyYXOxXG6jg3tYTIP80M2Qk0RBGjqsGJe1 Z/w53Fb94Bd/jehEFRlZORYm59W0w0uEsnI+JdRd069T9zx7eyT9SDNbD 4uULMpoHTOOPVwm+z+X6gJgJrG0BKl6QTfnFAXU+c3HrOEYTZGAAkMRSF w==; X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="232755973" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="232755973" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2022 18:27:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="544589032" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga007.fm.intel.com with ESMTP; 27 Feb 2022 18:27:16 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 27 Feb 2022 18:27:16 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 27 Feb 2022 18:27:16 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Sun, 27 Feb 2022 18:27:16 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Sun, 27 Feb 2022 18:27:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X+VzrXQoI7ZttKXdaeLS2M+ANIzySbmSNEAXY/sV6DTR2NGsvN6DhCJbyPKtbQF/OZ041+/qKZ9F/efDAeDZmbrmqYmO/PDQjV/HPadOg4yvw3WCBTdyJF1aAbKJePdLsghGPdLCZjJsSkZ2RHWrKrWKAEl7homoo0PqvJHDrVsqyJHBnJbLSWOIebBCvApQmiKGvvRyWPEYSNqrEwwBcd22rMCacrXI4tLKyBiDyDyXqtEy5y7wRLb40iQrqI5lysvGSVNoUP6Jc9ZvH67tk4mhHk5hZi20IckzZci2XPK9d8gFPVosKYSuDyKtXgeTTmkXOxKYhL9042uhwd66lg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=41+T+sHLiIsxf+sgzBX990IVTesTX09aajAl3lpdmAA=; b=PEc0w8QpwpaS/uljVp0QS1eGna68VxKJohtVpLg680GHp7hXX800JFnFWXEQ60wJnjgMotEnco7YfAJ687YhFwxQwO4aveLMXQMnefCkMORlpakPJJC2CDeukQA1PW8/zHh3Fwf/5CTb9oNE75OLcive2YUEsk5DfB0alHHuOp//jaXxxrkHb0kvfU7RxAeA+Pikgc2EpSBn9TDrxacJUr029lJH8RQUiXHVIUiXQIqy7fg2z58cB2b1JuPGEWjYA5g1q1UVjEaK/Vr6k3SH3Puc2WrE/0c6CuFArcOurdU0yYe0xphD/F/QlkCByqaCcqbZgQ3PkCBTXiaQW3f5UQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by MWHPR11MB1504.namprd11.prod.outlook.com (2603:10b6:301:c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Mon, 28 Feb 2022 02:27:12 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::21db:e2fd:b9a3:9292]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::21db:e2fd:b9a3:9292%5]) with mapi id 15.20.5017.026; Mon, 28 Feb 2022 02:27:12 +0000 From: "Yao, Jiewen" To: Brijesh Singh , "devel@edk2.groups.io" CC: James Bottomley , "Xu, Min M" , Tom Lendacky , "Justen, Jordan L" , Ard Biesheuvel , "Aktas, Erdem" , Michael Roth , Gerd Hoffmann , "aaron.young@oracle.com" Subject: Re: [PATCH v2 0/2] SEV BaseMemEncryptLib cleanup Thread-Topic: [PATCH v2 0/2] SEV BaseMemEncryptLib cleanup Thread-Index: AQHYJzOtgQ3h5cqpYECuXYIHpuk87qyoRufA Date: Mon, 28 Feb 2022 02:27:12 +0000 Message-ID: References: <20220221145914.1972322-1-brijesh.singh@amd.com> In-Reply-To: <20220221145914.1972322-1-brijesh.singh@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.401.20 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dccbce35-c587-4da9-6fef-08d9fa61d422 x-ms-traffictypediagnostic: MWHPR11MB1504:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CjKDp/JfePul7mBuPZWVSN7nyeTW33/RSMXmRpkw0Byjj8DouQDa2nP2bKZ1xXm1UmMU/oxw+mic+IVHJ6X8SGdYnu8zr7GMdZkXjYPKEodg1Zvo9Bn1HL0IHL/XmGwhEnCKEvU/WFqg0j+ZpkMChkNAuia7rjrVivjtDPVaXsXW0OwGN41JMkcAQMUigecY6XV4j5swDFrKQkW4wBuIAv2ZycTIZuKhOnf5KtROO9CFrw2G6PvDU9yfC01tTvOAei7H5xWB+JsJirTnPsY03dvjzxRjM+bTF3fo/KpGyWRB0czJwkUAyMPw4hixuJuV9r9vVjnCxJOxbMrkL2iow3la/g+KwVcK6Yo2oGucaMRIOc957nVeyuMtYTxPVtNQRUxd8SzTXAvte7F3cckJGhrPgRE/8cvbQ8wzQNQZa4t9YChE2ahe96kXob9LTnFdNLcvsPyUH0P6pb8BmqEwd8hlsKtLfoKBrivx9Y7cVjhVAUzM5lVE71opjBvUDH6seTsbNmq+3drYRpfaeCUZLYyxsHD47Pk1BMplTU35NAeK5vE/dd5+Mv1Tp9IyxVcaxX5hyUCylLDp7OIu0MOwJ4iVp4tBndNDMV2yT7HF3fpnCw/rVoQOEs8a2KczpDIxYTddoSHY06iLgH8i7unyriWVTT6Hac8ZArdWD2TsgTXiEI9a0eqO3xhSxhoRpMrNB9k4R02bDHwiltustRQ+HyBxxp7EPEo7hcTUTTl8GzoSbTZlAOKB/L0mJlyDjY0YwgtmQ90hN+4RsjasOJ+zcNrlK1lDRfmvwmYAYzd1VA4yqOKx2NdEd7Rfod8rDFnGFH5UzrYdwCuVvjKui+Wuqw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5872.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(83380400001)(122000001)(4326008)(86362001)(55016003)(82960400001)(316002)(19627235002)(110136005)(966005)(54906003)(38070700005)(508600001)(7696005)(66556008)(64756008)(2906002)(26005)(8676002)(6506007)(66446008)(53546011)(186003)(66946007)(66476007)(76116006)(8936002)(38100700002)(33656002)(9686003)(5660300002)(52536014)(71200400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gNKllmiX2fq5djJBX+RhzDtjM5nsl2FITNA92DIMpoyu2FrLH0dQ/IkVb8xe?= =?us-ascii?Q?6gj5x0k+aQaQJjxyexZQnAZw1hqaANJWLSn3UhRXRTEekhcq+4GS/9F6zHFT?= =?us-ascii?Q?HOZtxFKQx5Q1ptl495MtE33tlZYWLW+VJtJvGT/x9roHudeSKCFyB0MNT+qI?= =?us-ascii?Q?kMU0Ex7B+wHULAo4h7qLSqtjXUjym35IxrxfGu+ZaYbswutc6Y+AfCW3oaZf?= =?us-ascii?Q?k7O1NgxsPRRL4joccf+hXdAqI0jQJH1gsW85/RVK1mdWo3TtNkouJm2H5n9e?= =?us-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zO6azf+2sifpCzr4bLNp0tidDK?= =?us-ascii?Q?1UrUrIBYP+h+CgvMN5VVUdIU7nCcpyQGWER33A6MXu+8N1nyUY6NmyCsBqqZ?= =?us-ascii?Q?PpVNZmEjPkd/9FQFvOrzrDNN5e1oxeyTLM3r3S1ntdvL+1O9XAtI8QXxw8lW?= =?us-ascii?Q?gIOMhrxY/Z2R/N8674JjEvnQCvcfsd7u6ofM56Zr7LoocL/gEKRJX8feqVug?= =?us-ascii?Q?T0MWHTQepviD5iAI41cERmKCSqb35DrdFpBrIa9fymgsomjzX4Hxdh8JePdQ?= =?us-ascii?Q?/aN537SX0TWzQwv99vjHghmPUl4wgu1UfTdUfS0Ls2rziud/8QvFlrmIEMWI?= =?us-ascii?Q?Rif+ciPNjIGwTIR//A/yPegriNdyfyxeksIRd3Baa4j5S9vlv9me/6mazb4n?= =?us-ascii?Q?j6BAn47ZR6nuz8TovDjjE/Oa6u0LzOeAVtC0GK2lLOR8XQPIWud7u2zy9g32?= =?us-ascii?Q?27UfzG0sdq7hksffRIzDdhg=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dccbce35-c587-4da9-6fef-08d9fa61d422 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2022 02:27:12.6340 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /NC+i4t/jHsLlW/m02NpJiaDA3LwgP5CZuUDZej5kymEPWEWaCzUM5b9PuC5LCucBkV1hrxy10ejB8zHIveEdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1504 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Acked-by: Jiewen Yao > -----Original Message----- > From: Brijesh Singh > Sent: Monday, February 21, 2022 10:59 PM > To: devel@edk2.groups.io > Cc: James Bottomley ; Xu, Min M ; > Yao, Jiewen ; Tom Lendacky > ; Justen, Jordan L ; > Ard Biesheuvel ; Aktas, Erdem > ; Michael Roth ; Gerd > Hoffmann ; aaron.young@oracle.com; Brijesh Singh > > Subject: [PATCH v2 0/2] SEV BaseMemEncryptLib cleanup >=20 > This is the first of cleanup for SEV MemEncryptLib. The library uses > the CPUID followed by the MSR read to determine whether SEV is enabled. >=20 > Now that we have a workarea concept, the logic can be simplified to > store the msr status in workarea and use that to build PCDs and then > later simply use the PCDs instead of going through the CPUID and RDMSR. >=20 > The complete branch is available at > https://github.com/codomania/edk2/tree/sev-workarea-cleanup >=20 > The series also fixes one of the issue raised in the bug > https://bugzilla.tianocore.org/show_bug.cgi?id=3D3582 >=20 > Changes since v1: > * Cache the PCD reads so that we can avoid reading PCD while performing = the > virtual pointer conversion. >=20 > Brijesh Singh (2): > OvmfPkg/ResetVector: cache the SEV status MSR value in workarea > OvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea >=20 > .../DxeMemEncryptSevLib.inf | 1 + > .../PeiMemEncryptSevLib.inf | 1 + > .../SecMemEncryptSevLib.inf | 1 + > OvmfPkg/Include/WorkArea.h | 12 +- > .../DxeMemEncryptSevLibInternal.c | 145 ++++++++---------- > .../PeiMemEncryptSevLibInternal.c | 139 ++++++----------- > .../SecMemEncryptSevLibInternal.c | 80 +++++----- > OvmfPkg/Sec/AmdSev.c | 2 +- > OvmfPkg/ResetVector/Ia32/AmdSev.asm | 38 +++-- > OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm | 3 +- > OvmfPkg/ResetVector/ResetVector.nasmb | 3 + > 11 files changed, 194 insertions(+), 231 deletions(-) >=20 > -- > 2.25.1