From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 107438046A for ; Mon, 20 Mar 2017 08:23:04 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 20 Mar 2017 08:23:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,194,1486454400"; d="scan'208,217";a="1124908832" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 20 Mar 2017 08:23:03 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 20 Mar 2017 08:23:01 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 20 Mar 2017 08:23:00 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.204]) with mapi id 14.03.0248.002; Mon, 20 Mar 2017 23:22:58 +0800 From: "Yao, Jiewen" To: Ard Biesheuvel , Laszlo Ersek CC: edk2-devel-01 , Michael Zimmermann Thread-Topic: [edk2] SetMemorySpaceAttributes with EFI_MEMORY_XP Thread-Index: AQHSoWnY4ID5OQhDIE+CbMPRmwUUfqGdDgaAgAAA5gCAAAU2gIAAKduAgACaRMA= Date: Mon, 20 Mar 2017 15:22:57 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A907502@shsmsx102.ccr.corp.intel.com> References: <72d13754-5c7d-9734-33a8-bd2dab32b2bb@redhat.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: SetMemorySpaceAttributes with EFI_MEMORY_XP X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Mar 2017 15:23:04 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable We had some internal discussion on using gDS or using mCpu. We decided to choose mCpu purposely at that moment, because we wanted to ke= ep UEFI memory map unchanged to avoid any potential compatibility issue. Thank you Yao Jiewen From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard = Biesheuvel Sent: Monday, March 20, 2017 10:09 PM To: Laszlo Ersek Cc: edk2-devel-01 ; Michael Zimmermann Subject: Re: [edk2] SetMemorySpaceAttributes with EFI_MEMORY_XP On 20 March 2017 at 11:38, Laszlo Ersek > wrote: > On 03/20/17 12:20, Ard Biesheuvel wrote: >> On 20 March 2017 at 11:16, Michael Zimmermann > wrote: >>> Ard, why is SetMSetMemorySpaceAttributes being called in first place? >>> (ignoring the recent NX patch) >>> Looking at the initial GCD, it looks like unused memory usually >>> doesn't have any attributes set anyway. >>> >> >> Originally, we added the new memory with >> EFI_MEMORY_WB|EFI_MEMORY_WT|EFI_MEMORY_WC|EFI_MEMORY_UC capabilities, >> and selected the EFI_MEMORY_WB attribute with the call to >> gDS->SetMemorySpaceAttributes. Later, we removed all capabilities >> expect EFI_MEMORY_WB, since the other ones cannot be supported under >> virtualization with KVM. >> >> Whether that makes the SetMemorySpaceAttributes redundant is not >> entirely clear to me, but it does appear the adding the memory does >> the right thing wrt non-exec permissions if the policy is enabled. So >> perhaps we can simply drop this call? > > Won't that turn off caching for the memory just added? > I think it may not map the memory at all in this case, so we need to do something. It looks like calling mCpu->SetMemoryAttributes() should be sufficient here, and so I wonder whether we violate anything by replacing gDS->SetMemorySpaceAttributes with mCpu->SetMemoryAttributes here. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel