From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.4791.1648080751988371354 for ; Wed, 23 Mar 2022 17:12:32 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=D7RFqUBq; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648080752; x=1679616752; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=02j6z5RnZuUPc99a1UAEl/HwXP50xkaxcTFAD5MhOlA=; b=D7RFqUBqIy2CfpQpbJ1cInU9auWgIq837nzqWuJQhN07efl/1GVvjpSW qLlLyTUyj5y6XoDmwIKF9ptEuaAvu5Oh2nIaDUp6G0nWH4VNk8Q5F2gFZ ocTQr8MhFb4M4cD7uo4IysuK/KgD1Z1vWtHzEPOlLCitnGX54liNlAIiy 8TGMXj+BMboPBX4jJxgJNVioAc/rGv7ugOsHfDH14w5Ty15+dx1HGmtet I5AK1lqiFTyMJJn85kMu1dRK6tAvdvb+x1c5WcQZ2PFqgnaZu9kgx04cz vOGVHRy7liS4legVPVdGBMB5s3paY/4knBdlykZFMQywuwgidK8rYZYyo g==; X-IronPort-AV: E=McAfee;i="6200,9189,10295"; a="258207746" X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="258207746" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:12:31 -0700 X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="649651481" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.31.90]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:12:29 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Jian J Wang , Hao A Wu , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [PATCH V10 35/47] MdeModulePkg: Skip setting IA32_ERER.NXE if it has already been set Date: Thu, 24 Mar 2022 08:10:21 +0800 Message-Id: <20220324001033.1169-36-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: <20220324001033.1169-1-min.m.xu@intel.com> References: <20220324001033.1169-1-min.m.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 If IA32_ERER.NXE has already been set, skip setting it again. Cc: Jian J Wang Cc: Hao A Wu Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Acked-by: Gerd Hoffmann Reviewed-by: Jian J Wang Signed-off-by: Min Xu --- MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c index 1ebab2782010..a451ca160408 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c @@ -179,9 +179,11 @@ EnableExecuteDisableBit ( { UINT64 MsrRegisters; - MsrRegisters = AsmReadMsr64 (0xC0000080); - MsrRegisters |= BIT11; - AsmWriteMsr64 (0xC0000080, MsrRegisters); + MsrRegisters = AsmReadMsr64 (0xC0000080); + if ((MsrRegisters & BIT11) == 0) { + MsrRegisters |= BIT11; + AsmWriteMsr64 (0xC0000080, MsrRegisters); + } } /** -- 2.29.2.windows.2