From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::241; helo=mail-it0-x241.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E1C2F21F0DB14 for ; Thu, 29 Mar 2018 00:47:07 -0700 (PDT) Received: by mail-it0-x241.google.com with SMTP id 19-v6so6805866itw.3 for ; Thu, 29 Mar 2018 00:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mkLPDJgyiJvjuKhgW8+ulUUCrxVDNbND3/vDlMt3FDk=; b=SiQsDTXk88C/E7OS/VvNHmoz5zLr32VXSbFaPVlocIlsrvMYrFglPjBPx7KtYt4Vc6 FN8ZhSVPSAr76ecbvB61vWaFv7QlFz3r1NG4rX3qnaD9hKqOcq6VxMa5TAPiqNIyuwdI B/khrD/TBfRRHcgFSlzBWhtqIgQ7RcIW5xlHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mkLPDJgyiJvjuKhgW8+ulUUCrxVDNbND3/vDlMt3FDk=; b=Hrgp9uKtGLZzFckqJi1j6UeZmnL0/kv6jqkY/KLD6O2fWa0un5BiHjYIdpeXJOznP1 tCPyQLze0ctgP3f4hsjb5Je4fPNQi4pKYouIViC1uFXvMo+jVPRkPwn0cJX9CaXSQQlT kX0YogHIpxoqfccvjOUIcbuxuhfl+PibeIlBgtv75aaphWCPAy21Slh16Rh4b5O4bELH iYdaLp8dygK1RKJMHYyvSlr5+1wAUpR63fO7VCWHb+fhCiAGo90gTCWpVMtPbjN7P0Wj nK1/lbE0eoZqf1mcly4SNE0MmKV8ARFCOq/7ECJW66FmIymgJ+lefHJTarSi25si8G/x HUog== X-Gm-Message-State: AElRT7H94ggTOGQDbH0ldCX9M0bkvJ3Ii20cQ+UsvbIMxBiiP5JkWvE2 5lK+9xplGfRQgxEP17ASkcV0tA== X-Google-Smtp-Source: AIpwx4/vOKgjA319rdESyIhVekAllIOT08mOGxVVFUcobPopabI4IUbjPrMwbclrVV9h1NUJC7AN+A== X-Received: by 2002:a24:80c7:: with SMTP id g190-v6mr6437458itd.129.1522310026141; Thu, 29 Mar 2018 00:53:46 -0700 (PDT) Received: from SZX1000114654 ([104.237.91.79]) by smtp.gmail.com with ESMTPSA id y23-v6sm837476itc.6.2018.03.29.00.53.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 00:53:45 -0700 (PDT) From: Guo Heyi X-Google-Original-From: Guo Heyi Date: Thu, 29 Mar 2018 15:53:40 +0800 To: "Ni, Ruiyu" Cc: "Wang, Jian J" , Guo Heyi , "Zeng, Star" , "edk2-devel@lists.01.org" , Yi Li , Renhao Liang , "Dong, Eric" , "Kinney, Michael D" , "Gao, Liming" , "Yao, Jiewen" Message-ID: <20180329075340.GE97590@SZX1000114654> References: <1522290692-99585-1-git-send-email-heyi.guo@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103BA744FE@shsmsx102.ccr.corp.intel.com> <20180329050926.GC97590@SZX1000114654> <20180329055453.GD97590@SZX1000114654> <734D49CCEBEEF84792F5B80ED585239D5BC15378@SHSMSX104.ccr.corp.intel.com> MIME-Version: 1.0 In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BC15378@SHSMSX104.ccr.corp.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) 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:47:08 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline That makes sense to me; I'll send a patch to make the change. Thanks, Heyi On Thu, Mar 29, 2018 at 07:12:16AM +0000, Ni, Ruiyu wrote: > 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 > > > > I think you can simply remove the check. > > > > Jiewen and Ruiyu, do you have any different thoughts? > > > > Regards, > > Jian > > > > > > > -----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 differentiate > > 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 == 0 on purpose, for I don't know the > > > > > expected behaviour of gCpu->SetMemoryAttributes() if > > > > > CpuArchAttributes == 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 == 0" is > > > > > > 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 attributes. > > > > > > > > > > > > > > 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)) != 0) { > > > > > > > + if ((Attributes & (EXCLUSIVE_MEMORY_ATTRIBUTES | > > > > > > > + NONEXCLUSIVE_MEMORY_ATTRIBUTES)) == 0) { > > > > > > > return INVALID_CPU_ARCH_ATTRIBUTES; > > > > > > > } > > > > > > > > > > > > > > -- > > > > > > > 2.7.4 > > > > > >