From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.16761.1680146474740044497 for ; Wed, 29 Mar 2023 20:21:15 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=XD0Se8Kx; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: ted.kuo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680146474; x=1711682474; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=/OTAaEeA+7pUazoRJOFaKjH9F50TyZJBURbaSYEy260=; b=XD0Se8Kx9cW7QIKcBOtnNnpDqQZ/KVNOokW/NdMiivcj3ZfDjGLWJg13 S5W0j9vSmmT9MTKt/9yh+pA95yEDZEg7f6RIGBP94Tm5x5B3zEIsqZrmv AJOKTMTpWnkq3TQmIIMyvlYEpQ4O3ck8i2y+TXInZxLnghZt5gZ63RyYc Qpp3wkPazOmouFR9XcGqTbN61zQE4gQtM7eqIvqVm2bi4vLUx1MEdCJky UV6DQFN3e55QHF9CXRRdfXBVyjNcVL8J1c/cocJdep5NJGQIv24CmV+Ae TQFIp+P0LEjYTWUQrYsFuCUTSmn1jbsINpkdrBbrI16k3NgsIsutyIWLr Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="338558054" X-IronPort-AV: E=Sophos;i="5.98,301,1673942400"; d="scan'208";a="338558054" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2023 20:21:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="858741494" X-IronPort-AV: E=Sophos;i="5.98,301,1673942400"; d="scan'208";a="858741494" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga005.jf.intel.com with ESMTP; 29 Mar 2023 20:21:13 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) 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.2507.21; Wed, 29 Mar 2023 20:21:13 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) 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.2507.21; Wed, 29 Mar 2023 20:21:13 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Wed, 29 Mar 2023 20:21:13 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.42) 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.2507.21; Wed, 29 Mar 2023 20:21:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nbsi9cvR7WOJzR46wjlY7iQoRZI+aJ8Mg7loO8X/zVvVmNh7RUPTvIyrceGgS6P2o2vsGzC2bwIR2QLEbmxIQvgGrz5p3cOqQ2sZAn8MWib5K9fSXiOXtT5elgux9llTR2Y48jSnoHFQO1I5F7IuBZl5x/vgFN4WLVOLfcvxzcawakKxq2mAKhcOxYxeS2ttGn7lg8dAjdLNmIpMXNZgsTyApnvhPDiI+6u2KfwUTNrn751hsEkejzBBmnp3/IGzwBlTqFzvibs9KqFSO/AmDO/M8vkaXNVlusqMuvoMt8Kx7nfInVJfrnoeIQAK0bniW2JqlTKPNKz6s2/dOqhRvA== 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=NTBLVJt8KD6IvJR228d5NF9qTzoJVvJlZRVxJqeCWmE=; b=YswKBU6UC4+BRXEakExUPu57PmKShRjzs5UVzqj98UGACy8S9IfInbHcUbLGfm0+eoquPwrgCwISwYNIgnhlXaS8wJBE8uzuq94rsCdHMpuo/7okNRjfkcWKpbF4ZZQMH9TAxImGn6HyiJ3gj1jgm00GzlYtKyFQiueDI0OhKkAasy3vUxxT5QiFxHE6KBb+sQzt7WULukXz8XLPlaHoARZ54gtO5GWc2r1uphaD78umJsJ0PQNN7cU9eOUxlInWKTJOJvvJy/rh6A110PKFosUssKwOvhyCCYZtVsNvVg/M1Purxi6nKkgMLsn1SXzcFiwo7SWQufNM2PQail5mLQ== 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 DM5PR11MB1929.namprd11.prod.outlook.com (2603:10b6:3:10a::22) by SA0PR11MB4752.namprd11.prod.outlook.com (2603:10b6:806:99::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.28; Thu, 30 Mar 2023 03:21:10 +0000 Received: from DM5PR11MB1929.namprd11.prod.outlook.com ([fe80::b282:8305:2797:2a94]) by DM5PR11MB1929.namprd11.prod.outlook.com ([fe80::b282:8305:2797:2a94%11]) with mapi id 15.20.6254.022; Thu, 30 Mar 2023 03:21:10 +0000 From: "Kuo, Ted" To: "devel@edk2.groups.io" , "Chiu, Chasel" CC: "Desimone, Nathaniel L" , "Zeng, Star" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causing unnecessary delay. Thread-Topic: [edk2-devel] [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causing unnecessary delay. Thread-Index: AQHZYlWOhQf6tUVwIk+99loaP9oL868SqFAQ Date: Thu, 30 Mar 2023 03:21:10 +0000 Message-ID: References: <20230329154352.1092-1-chasel.chiu@intel.com> In-Reply-To: <20230329154352.1092-1-chasel.chiu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM5PR11MB1929:EE_|SA0PR11MB4752:EE_ x-ms-office365-filtering-correlation-id: a7ae46d7-1fc2-4428-b996-08db30cdcf09 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: W+V26xE5govKHgRqQBpmc1Z5vEX2Pq0bcItiQuspYQRHzJQjhdyxcIlRw1LscuDA0kE64YkcfSjEDrxDAVOjNI7dPv81YRGH7WJCE/oFqk7Cn3TJbwBLVMnaW0FcgSOGjaGIENUW+zLhPBjmP1oDCx57+iCi0qxObikyB9Eog5cofH03+ZVZKw7yqycHt+BpL1W6CJ06gnrcFVUlwrQHhZPdjOoHmpNfbJ/nF8NVTnAi2IERf7aRF/9IlgG/V4WgKBK0Qt/wEqaanENJpgsE9dbNbWaRCHwMLBFvS8GMt357HntJHKkKcvALs3cagdMz1SdC+K0V0MWAWzfWPybEDHP8hmuJugXalUkGmYcw9fQpKSuWXwTNEO1ADgaDve1YQocmscoGsTyGihwtcrGVAfgTbvzs0IGlXx91AK9EPZAMHveK8lJqQHuKTDyu4bsTiQfuAk76njNGeavucrFijq0X6XBfgvr1kri//A+tmv32C2h2Md4co50XRV8wScsGwtNG3TjkNTzt19wtKOdsw1RWcjw++KDB09AkgipovnfegS1O8bKsH78P2JKdD5G3FBY1RUo6dScxe2tUdwSvO3e+jR1Tc1Hfb7zUTQpdaA2pAOuofJYA2RvRvW32evRZ7zbxVxZ36bOhSqHIqXFRZOxkENvY2QPXRpoRkjxWH64= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR11MB1929.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(136003)(366004)(346002)(39860400002)(451199021)(2906002)(83380400001)(76116006)(54906003)(64756008)(66946007)(8676002)(66476007)(4326008)(966005)(7696005)(66556008)(71200400001)(478600001)(38070700005)(53546011)(26005)(316002)(110136005)(6636002)(9686003)(55016003)(6506007)(107886003)(19627235002)(186003)(38100700002)(52536014)(86362001)(66446008)(122000001)(5660300002)(82960400001)(33656002)(41300700001)(66899021)(8936002)(11716005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ciGLZVQFzfO7o2DWViUJ2On5UV8xdpWa+oq4rTdcy2NGubw7snxURkUzJ48J?= =?us-ascii?Q?Q6pGhJMkIHdsHoxbm+tZNWr5+gtOz1Z/Qsrh9hpwwTQ1sHpCOcmsJxpxCTK9?= =?us-ascii?Q?HmCuyG3H+JwAhDqwyjcp4n1jWwChZn1WhdFmZmiYgJZKvS0ndT+0Ps/orcgK?= =?us-ascii?Q?DF6XCOslYQCDmY1aAqE8h1lGRyNpHfgcmTLhyLJ3kciYUmSrvBLADTnBxSoJ?= =?us-ascii?Q?yKFuM9lkLh8nP9nexIyGY4qi+Mjw9iNkekpxUGQVapGzzVqylBwC9CFxQzM/?= =?us-ascii?Q?arPMQ5MwPIls1AdAjOR+o0NO2aw7ZTHmsjq76YQKb/Fe86oe/H9dXhzlfCcl?= =?us-ascii?Q?FE+f6l1OTaNR4SbUA5hzdX5LYt0/9favEUEFQE8k8CN2Slj6ahLqQKjNwGqm?= =?us-ascii?Q?kB3CqD9Rz0FGSfk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ascii?Q?iu9XnZkeYqjvrGLVoFqJ3wJP9FYOpUvHwq4Urd6yvo0gAY2gGrAHvqUUb32R?= =?us-ascii?Q?lTko4Beg6sIYc+NiYzIPZHNFhDZLOqU3l25iYuZfF92idGTN2xMJ1K+mmcHs?= =?us-ascii?Q?Sk/9gLGQgSCYIgujiO1uZFb/3l+ptCV2SsrwwTZlqbES3UJUxRv/Z3dmJeIp?= =?us-ascii?Q?WRy088c0bYY1gEiFAEJ1ssqr2Yekjte0fsOunyWIM+3MUBl+uj52/sNdRtVU?= =?us-ascii?Q?gwjn83+MLPtf1kpYycw=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7ae46d7-1fc2-4428-b996-08db30cdcf09 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2023 03:21:10.2651 (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: AWtQXstkHJFABPhdgDvw442NNwZbRpGBNQu54hAzHJUVuHKADzkOhV5aNosmHyz/bb2pZPj02jKJwsgwPqO6Kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4752 Return-Path: ted.kuo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ted Kuo -----Original Message----- From: devel@edk2.groups.io On Behalf Of Chiu, Chasel Sent: Wednesday, March 29, 2023 11:44 PM To: devel@edk2.groups.io Cc: Chiu, Chasel ; Desimone, Nathaniel L ; Zeng, Star ; Ni, Ray Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causi= ng unnecessary delay. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4391 FSP should support the scenario that CPU microcode already loaded before ca= lling LoadMicrocodeDefault(), in this case it should return directly withou= t spending more time. Also the LoadMicrocodeDefault() should only attempt to load one version of = the microcode for current CPU and return. Cc: Nate DeSimone Cc: Star Zeng Cc: Ray Ni Signed-off-by: Chasel Chiu --- IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm | 18 ++++++++++++++---- In= telFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm | 16 ++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm b/IntelFsp2Pkg/= FspSecCore/Ia32/FspApiEntryT.nasm index 2cff8b3643..b902d017ee 100644 --- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm +++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm @@ -245,6 +245,19 @@ ASM_PFX(LoadMicrocodeDefault): cmp esp, 0 jz ParamError + ;+ ; If microcode already load= ed before this function, exit this function with SUCCESS.+ ;+ mov eax= , 1+ cpuid+ mov ecx, MSR_IA32_BIOS_SIGN_ID+ rdmsr = ; Get current microcode signature+ xor eax, eax+ test edx, ed= x+ jnz Exit2+++ ; skip loading Microcode if the MicrocodeCodeSize is= zero ; and report error if size is less than 2k ; first check UPD he= ader revision@@ -450,7 +463,7 @@ LoadCheck: ; Verify this microcode update is not already loaded cmp dword [e= si + MicrocodeHdr.MicrocodeHdrRevision], edx- je Continue+ je Don= e ; if already one version microcode loaded, go to done LoadMicrocode: = ; EAX contains the linear address of the start of the Update Data@@ -465,9 = +478,6 @@ LoadMicrocode: mov eax, 1 cpuid -Continue:- jmp NextMicrocode- Done: mov = eax, 1 cpuiddiff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm = b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm index b32fa32a89..2a23c33c9b 100644 --- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm +++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm @@ -141,6 +141,17 @@ ASM_PFX(LoadMicrocodeDefault): jz ParamError mov rsp, rcx + ;+ ; If microcode already lo= aded before this function, exit this function with SUCCESS.+ ;+ mov e= ax, 1+ cpuid+ mov ecx, MSR_IA32_BIOS_SIGN_ID+ rdmsr = ; Get current microcode signature+ xor rax, rax+ test edx, = edx+ jnz Exit2+ ; skip loading Microcode if the MicrocodeCodeSize is= zero ; and report error if size is less than 2k ; first check UPD he= ader revision@@ -291,7 +302,7 @@ LoadCheck: ; Verify this microcode update is not already loaded cmp dword [e= si + MicrocodeHdr.MicrocodeHdrRevision], edx- je Continue+ je Don= e ; if already one version microcode loaded, go to done LoadMicrocode: = ; EAX contains the linear address of the start of the Update Data@@ -306,9 = +317,6 @@ LoadMicrocode: mov eax, 1 cpuid -Continue:- jmp NextMicrocode- Done: mov = eax, 1 cpuid--=20 2.35.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#102124): https://edk2.groups.io/g/devel/message/102124 Mute This Topic: https://groups.io/mt/97931383/1862468 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [ted.kuo@intel.com] -=3D-= =3D-=3D-=3D-=3D-=3D