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.web08.1215.1648597728598639731 for ; Tue, 29 Mar 2022 16:48:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=QFRDfYi8; 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=1648597728; x=1680133728; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=02j6z5RnZuUPc99a1UAEl/HwXP50xkaxcTFAD5MhOlA=; b=QFRDfYi8/15zpQBg2exLyvyLh7kEDx+H7XIJWdz1JYqVVeQDjZ8pz+Bb vDutWV/aSto7okqZnunvmKJlsJbpLBuBNfU5ydV+YCPSSvkt9sVin1RGY 7XwQTh9RdR8E5eV9tGOFqpScn/vwbaucdls9Z8rGpx4xcK9dbs5uAeQ7x jbhabznQ8Te74RkaZCJG6oN3uxyNcQGRCm9dwGCCe1BKx27HpVYni14i/ W9nQ35xhJB0Y0RCEz/5WCsaEw4QP2HLA4DRqW9iQ2E4jpkDkB0WPRW1C3 CjK/e+uMJrQboPkV14gRw2N044cc60dsoh1jJmFo9xT8jRf5S0NUcg0/l Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10301"; a="259375632" X-IronPort-AV: E=Sophos;i="5.90,220,1643702400"; d="scan'208";a="259375632" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2022 16:48:47 -0700 X-IronPort-AV: E=Sophos;i="5.90,220,1643702400"; d="scan'208";a="521659192" Received: from zhangpen-mobl.ccr.corp.intel.com (HELO mxu9-mobl1.ccr.corp.intel.com) ([10.255.29.230]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2022 16:48:44 -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 V12 35/47] MdeModulePkg: Skip setting IA32_ERER.NXE if it has already been set Date: Wed, 30 Mar 2022 07:46:28 +0800 Message-Id: X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: References: 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