Star, This commit breaks Vlv2TbltDevicePkg.
On this platform, there are 2 calls to gDS->SetMemorySpaceAttributes() for an MMIO range to set only the EFI_MEMORY_RUNTIME bit. With this commit, ConverToCpuArchAttributes()returns 0, and 0 is passed to gCpu->SetMemoryAttributes()that returns EFI_INVALID_PARAMETER on Vlv2TbltDevicePkg. Before this commit, ConverToCpuArchAttributes() returns INVALID_CPU_ARCH_ATTRIBUTES which causes the call to gCpu->SetMemoryAttributes()to be skipped so no error is generated. I think the right fix is to skip the call to gCpu->SetMemoryAttributes() if CpuArchAttributes is 0 so a call that only sets the RUNTIME attribute can be supported along with call the set both the RUNTIME bit and other cache related bits. I will send a patch soon with the proposed fix. Mike > -----Original Message----- > From: Zeng, Star > Sent: Sunday, April 1, 2018 10:59 PM > To: Heyi Guo <heyi....@linaro.org>; edk2- > de...@lists.01.org > Cc: Yi Li <phoenix.l...@huawei.com>; Renhao Liang > <liangren...@huawei.com>; Dong, Eric > <eric.d...@intel.com>; Kinney, Michael D > <michael.d.kin...@intel.com>; Gao, Liming > <liming....@intel.com>; Wang, Jian J > <jian.j.w...@intel.com>; Ni, Ruiyu <ruiyu...@intel.com>; > Zeng, Star <star.z...@intel.com> > Subject: RE: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of > attribute conversion > > Pushed at 5b91bf82c67b586b9588cbe4bbffa1588f6b5926. > > Thanks, > Star > -----Original Message----- > From: Heyi Guo [mailto:heyi....@linaro.org] > Sent: Thursday, March 29, 2018 4:20 PM > To: edk2-devel@lists.01.org > Cc: Heyi Guo <heyi....@linaro.org>; Yi Li > <phoenix.l...@huawei.com>; Renhao Liang > <liangren...@huawei.com>; Zeng, Star > <star.z...@intel.com>; Dong, Eric <eric.d...@intel.com>; > Kinney, Michael D <michael.d.kin...@intel.com>; Gao, > Liming <liming....@intel.com>; Wang, Jian J > <jian.j.w...@intel.com>; Ni, Ruiyu <ruiyu...@intel.com> > Subject: [PATCH 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 remove the check code > in ConverToCpuArchAttributes(); the remaining code is > enough to grab the interested bits for > Cpu->SetMemoryAttributes(). > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Heyi Guo <heyi....@linaro.org> > Signed-off-by: Yi Li <phoenix.l...@huawei.com> > Signed-off-by: Renhao Liang <liangren...@huawei.com> > Cc: Star Zeng <star.z...@intel.com> > Cc: Eric Dong <eric.d...@intel.com> > Cc: Michael D Kinney <michael.d.kin...@intel.com> > Cc: Liming Gao <liming....@intel.com> > Cc: Jian J Wang <jian.j.w...@intel.com> > Cc: Ruiyu Ni <ruiyu...@intel.com> > --- > MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index > 77f4adb4bc01..907245a3f512 100644 > --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > @@ -673,11 +673,6 @@ ConverToCpuArchAttributes ( { > UINT64 CpuArchAttributes; > > - if ((Attributes & ~(EXCLUSIVE_MEMORY_ATTRIBUTES | > - NONEXCLUSIVE_MEMORY_ATTRIBUTES)) > != 0) { > - return INVALID_CPU_ARCH_ATTRIBUTES; > - } > - > CpuArchAttributes = Attributes & > NONEXCLUSIVE_MEMORY_ATTRIBUTES; > > if ( (Attributes & EFI_MEMORY_UC) == EFI_MEMORY_UC) { > -- > 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel