From nobody Thu May 2 10:55:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1514171493972675.1360330650847; Sun, 24 Dec 2017 19:11:33 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9581821CB87B2; Sun, 24 Dec 2017 19:06:39 -0800 (PST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 02E6F21CB87AC for ; Sun, 24 Dec 2017 19:06:37 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Dec 2017 19:11:30 -0800 Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 24 Dec 2017 19:11:30 -0800 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 24 Dec 2017 19:11:29 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 24 Dec 2017 19:11:23 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by shsmsx102.ccr.corp.intel.com ([169.254.2.189]) with mapi id 14.03.0319.002; Mon, 25 Dec 2017 11:11:21 +0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=binx.song@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,453,1508828400"; d="dat'59?scan'59,208,59";a="4640928" From: "Song, BinX" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] UefiCpuPkg: Update AESNI support checking logic Thread-Index: AdN9LgmUQcPTPg4QQy6jpRa0es7k1A== Date: Mon, 25 Dec 2017 03:11:21 +0000 Message-ID: <559D2DF22BC9A3468B4FA1AA547F0EF1025C9A07@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <559D2DF22BC9A3468B4FA1AA547F0EF1025C9A07@SHSMSX101.ccr.corp.intel.com> dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [edk2] [PATCH] UefiCpuPkg: Update AESNI support checking logic X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "lersek@redhat.com" , "Dong, Eric" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" With correct model CPU, current checking logic will always execute AsmReadMsr64 operation and then check ECX.AESNI[bit 25] =3D 1. Update checking logic to check ECX.AESNI[bit 25] =3D 1 first and then do AsmReadMsr64 operation. Cc: Eric Dong Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bell Song Reviewed-by: Eric Dong --- UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c b/UefiCpuPkg/L= ibrary/CpuCommonFeaturesLib/Aesni.c index 880f092..56b1b55 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c @@ -62,15 +62,17 @@ AesniSupport ( { MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *MsrFeatureConfig; =20 - if (IS_SANDY_BRIDGE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayM= odel) || - IS_SILVERMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayMod= el) || - IS_XEON_5600_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayMode= l) || - IS_XEON_E7_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)= || - IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel= )) { - MsrFeatureConfig =3D (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) Conf= igData; - ASSERT (MsrFeatureConfig !=3D NULL); - MsrFeatureConfig[ProcessorNumber].Uint64 =3D AsmReadMsr64 (MSR_SANDY_B= RIDGE_FEATURE_CONFIG); - return (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI =3D=3D 1); + if (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI =3D=3D 1) { + if (IS_SANDY_BRIDGE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->Displa= yModel) || + IS_SILVERMONT_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayM= odel) || + IS_XEON_5600_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayMo= del) || + IS_XEON_E7_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayMode= l) || + IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayMod= el)) { + MsrFeatureConfig =3D (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) Co= nfigData; + ASSERT (MsrFeatureConfig !=3D NULL); + MsrFeatureConfig[ProcessorNumber].Uint64 =3D AsmReadMsr64 (MSR_SANDY= _BRIDGE_FEATURE_CONFIG); + } + return TRUE; } return FALSE; } --=20 2.10.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel