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=jian.j.wang@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 746EF224DD123 for ; Wed, 28 Mar 2018 21:33:58 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 21:40:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,375,1517904000"; d="scan'208";a="29813939" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga006.jf.intel.com with ESMTP; 28 Mar 2018 21:40:37 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Mar 2018 21:40:36 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Mar 2018 21:40:36 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.129]) with mapi id 14.03.0319.002; Thu, 29 Mar 2018 12:40:34 +0800 From: "Wang, Jian J" To: "Zeng, Star" , Heyi Guo , "edk2-devel@lists.01.org" CC: Yi Li , Renhao Liang , "Dong, Eric" , "Kinney, Michael D" , "Gao, Liming" Thread-Topic: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion Thread-Index: AQHTxwzDX6aFZbtwWUen2n2xFZTNPKPmn+XQ Date: Thu, 29 Mar 2018 04:40:33 +0000 Message-ID: References: <1522290692-99585-1-git-send-email-heyi.guo@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103BA744FE@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BA744FE@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDM3ZGM0MWEtOTFiMS00MTIzLTg0ODItMTAyZjJmMGZjZjEwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ6RWhVUzViMzg4dDBBendLUGtCUlwvSURPNTQzcDdcL3pPZHB6XC9cL2JRdk9tVzl2dnllTXlvRFN1TEdHa3ErdEVIOSJ9 x-ctpclassification: CTP_NT 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 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 04:33:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I agree. The only issue here is that case "Attributes =3D=3D 0" is also exc= luded 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 >=20 > 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. >=20 > Jian, will you please provide the special case you are awared? >=20 >=20 > 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 ; Renh= ao > Liang ; Zeng, Star ; Dong, > Eric ; Kinney, Michael D ; > Gao, Liming > Subject: [RFC 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion >=20 > 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. >=20 > We don't see any reason to forbid combining CPU arch attributes and non-C= PU- > arch attributes when calling gDS->SetMemorySpaceAttributes(), so we chang= e > ConverToCpuArchAttributes() to only check if there is valid CPU arch attr= ibutes in > the input "Attribute" parameter and just ignore other attributes. >=20 > 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(-) >=20 > 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; >=20 > - 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; > } >=20 > -- > 2.7.4