From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 9FAFE21F0DB06 for ; Thu, 29 Mar 2018 00:05:41 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2018 00:12:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,375,1517904000"; d="scan'208";a="28511098" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 29 Mar 2018 00:12:20 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 29 Mar 2018 00:12:19 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 29 Mar 2018 00:12:19 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.226]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.235]) with mapi id 14.03.0319.002; Thu, 29 Mar 2018 15:12:17 +0800 From: "Ni, Ruiyu" To: "Wang, Jian J" , Guo Heyi CC: "Zeng, Star" , "edk2-devel@lists.01.org" , Yi Li , Renhao Liang , "Dong, Eric" , "Kinney, Michael D" , "Gao, Liming" , "Yao, Jiewen" Thread-Topic: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion Thread-Index: AQHTxyT9zRjoFfi3p0a36FXNFbmhiaPmy/5g Date: Thu, 29 Mar 2018 07:12:16 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BC15378@SHSMSX104.ccr.corp.intel.com> References: <1522290692-99585-1-git-send-email-heyi.guo@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103BA744FE@shsmsx102.ccr.corp.intel.com> <20180329050926.GC97590@SZX1000114654> <20180329055453.GD97590@SZX1000114654> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2018 07:05:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I agree to remove the check. Code only grabs the interested bit and calls Cpu->SetMemoryAttributes(). Thanks/Ray > -----Original Message----- > From: Wang, Jian J > Sent: Thursday, March 29, 2018 2:13 PM > To: Guo Heyi > Cc: Zeng, Star ; edk2-devel@lists.01.org; Yi Li > ; Renhao Liang ; > Dong, Eric ; Kinney, Michael D > ; Gao, Liming ; Yao, > Jiewen ; Ni, Ruiyu > Subject: RE: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion >=20 > I think you can simply remove the check. >=20 > Jiewen and Ruiyu, do you have any different thoughts? >=20 > Regards, > Jian >=20 >=20 > > -----Original Message----- > > From: Guo Heyi [mailto:heyi.guo@linaro.org] > > Sent: Thursday, March 29, 2018 1:55 PM > > To: Wang, Jian J > > Cc: Guo Heyi ; Zeng, Star ; > > edk2- devel@lists.01.org; Yi Li ; Renhao > > Liang ; Dong, Eric ; > > Kinney, Michael D ; Gao, Liming > > > > Subject: Re: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute > > conversion > > > > Agree. > > > > And what's your suggestion to fix the current issue? > > > > Regards, > > Heyi > > > > > > On Thu, Mar 29, 2018 at 05:44:16AM +0000, Wang, Jian J wrote: > > > Hi Heyi, > > > > > > Yeah, you're probably right. Page attributes are allowed to be > > > cleared but we have no separate parameter or interface to differentia= te > such situation. > > > I think there's flaw in the interface design. But it's hard to change= it now. > > > > > > Regards, > > > Jian > > > > > > > > > > -----Original Message----- > > > > From: Guo Heyi [mailto:heyi.guo@linaro.org] > > > > Sent: Thursday, March 29, 2018 1:09 PM > > > > To: Wang, Jian J > > > > Cc: Zeng, Star ; Heyi Guo > > > > ; > > edk2- > > > > devel@lists.01.org; Yi Li ; Renhao Liang > > > > ; Dong, Eric ; > > > > Kinney, Michael D ; Gao, Liming > > > > > > Subject: Re: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute > > > > conversion > > > > > > > > Hi Jian, > > > > > > > > I excluded CpuArchAttributes =3D=3D 0 on purpose, for I don't know = the > > > > expected behaviour of gCpu->SetMemoryAttributes() if > > > > CpuArchAttributes =3D=3D 0. Does > > that > > > > mean we need to keep the cache attribute and remove memory > > > > protection attributes? > > > > > > > > If so, then it seems we don't need the check at all. > > > > > > > > Thanks, > > > > > > > > Heyi > > > > > > > > On Thu, Mar 29, 2018 at 04:40:33AM +0000, Wang, Jian J wrote: > > > > > I agree. The only issue here is that case "Attributes =3D=3D 0" i= s > > > > > also excluded in > > this > > > > patch. > > > > > I think 0 should be CPU arch supported attributes. > > > > > > > > > > Regards, > > > > > Jian > > > > > > > > > > > -----Original Message----- > > > > > > From: Zeng, Star > > > > > > Sent: Thursday, March 29, 2018 11:20 AM > > > > > > To: Heyi Guo ; edk2-devel@lists.01.org > > > > > > Cc: Yi Li ; Renhao Liang > > > > > > ; Dong, Eric ; > > > > > > Kinney, Michael D ; Gao, Liming > > > > ; > > > > > > Wang, Jian J ; Zeng, Star > > > > > > > > > > > > Subject: RE: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute > > conversion > > > > > > > > > > > > The code before 14dde9e903bb9a719ebb8f3381da72b19509bc36 > can > > allow > > > > the > > > > > > attribute to be a combination of CPU arch attribute and other > > > > > > attributes, > > for > > > > > > example, UC + RUNTIME. > > > > > > But current code could not allow the case, that seems a > > > > > > regression in the > > > > code. > > > > > > So, I agree the statement. > > > > > > > > > > > > Jian, will you please provide the special case you are awared? > > > > > > > > > > > > > > > > > > Thanks, > > > > > > Star > > > > > > -----Original Message----- > > > > > > From: Heyi Guo [mailto:heyi.guo@linaro.org] > > > > > > Sent: Thursday, March 29, 2018 10:32 AM > > > > > > To: edk2-devel@lists.01.org > > > > > > Cc: Heyi Guo ; Yi Li > > > > > > ; > > > > Renhao > > > > > > Liang ; Zeng, Star > > > > > > ; > > Dong, > > > > > > Eric ; Kinney, Michael D > > > > ; > > > > > > Gao, Liming > > > > > > Subject: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute > > > > > > conversion > > > > > > > > > > > > For gDS->SetMemorySpaceAttributes(), when user passes a > > > > > > combined > > > > memory > > > > > > attribute including CPU arch attribute and other attributes, > > > > > > like EFI_MEMORY_RUNTIME, ConverToCpuArchAttributes() will > > > > > > return INVALID_CPU_ARCH_ATTRIBUTES and skip setting > page/cache > > > > > > attribute > > for > > > > the > > > > > > specified memory space. > > > > > > > > > > > > We don't see any reason to forbid combining CPU arch > > > > > > attributes and > > non- > > > > CPU- > > > > > > arch attributes when calling gDS->SetMemorySpaceAttributes(), > > > > > > so we > > > > change > > > > > > ConverToCpuArchAttributes() to only check if there is valid > > > > > > CPU arch > > > > attributes in > > > > > > the input "Attribute" parameter and just ignore other attribute= s. > > > > > > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > > > Signed-off-by: Heyi Guo > > > > > > Signed-off-by: Yi Li > > > > > > Signed-off-by: Renhao Liang > > > > > > Cc: Star Zeng > > > > > > Cc: Eric Dong > > > > > > Cc: Michael D Kinney > > > > > > Cc: Liming Gao > > > > > > --- > > > > > > MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++-- > > > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > > > > > diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > > > > > > b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index > > 77f4adb4bc01..2ababdd14cc6 > > > > > > 100644 > > > > > > --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > > > > > > +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > > > > > > @@ -673,8 +673,8 @@ ConverToCpuArchAttributes ( { > > > > > > UINT64 CpuArchAttributes; > > > > > > > > > > > > - if ((Attributes & ~(EXCLUSIVE_MEMORY_ATTRIBUTES | > > > > > > - NONEXCLUSIVE_MEMORY_ATTRIBUTES)) !=3D 0)= { > > > > > > + if ((Attributes & (EXCLUSIVE_MEMORY_ATTRIBUTES | > > > > > > + NONEXCLUSIVE_MEMORY_ATTRIBUTES)) =3D=3D 0= ) { > > > > > > return INVALID_CPU_ARCH_ATTRIBUTES; > > > > > > } > > > > > > > > > > > > -- > > > > > > 2.7.4 > > > > >