Pushed via: PR - https://github.com/tianocore/edk2/pull/2592 Commit - https://github.com/tianocore/edk2/commit/79f2734e5a7bc2e5256eb0e599f45407855159c7
Best Regards, Hao Wu > -----Original Message----- > From: [email protected] <[email protected]> On Behalf Of Wu, Hao > A > Sent: Thursday, March 3, 2022 2:43 PM > To: Ma, Hua <[email protected]>; [email protected] > Cc: Wang, Jian J <[email protected]>; Gao, Liming > <[email protected]>; Ni, Ray <[email protected]> > Subject: Re: [edk2-devel] [PATCH v2] MdeModulePkg: Add a check for > metadata size in NvmExpress Driver > > Reviewed-by: Hao A Wu <[email protected]> > > Best Regards, > Hao Wu > > > -----Original Message----- > > From: Ma, Hua <[email protected]> > > Sent: Thursday, March 3, 2022 1:06 PM > > To: [email protected] > > Cc: Wang, Jian J <[email protected]>; Gao, Liming > > <[email protected]>; Wu, Hao A <[email protected]>; Ni, Ray > > <[email protected]>; Ma, Hua <[email protected]> > > Subject: [PATCH v2] MdeModulePkg: Add a check for metadata size in > > NvmExpress Driver > > > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3856 > > > > Currently this NvmeExpress Driver do not support metadata handling. > > According to the NVME specs, metadata may be transferred to the host > > after the logical block data. It can overrun the input buffer which > > may only be the size of logical block data. > > > > Add a check to return not support for the namespaces formatted with > > metadata. > > > > v2 changes: > > - Change debug log level from INFO to ERROR > > - Change to if (NamespaceData->LbaFormat[LbaFmtIdx].Ms != 0) > > > > v1: https://edk2.groups.io/g/devel/message/87242 > > > > Cc: Jian J Wang <[email protected]> > > Cc: Liming Gao <[email protected]> > > Cc: Hao A Wu <[email protected]> > > Cc: Ray Ni <[email protected]> > > > > Signed-off-by: Hua Ma <[email protected]> > > --- > > MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 15 > > +++++++++++++++ > > .../Bus/Pci/NvmExpressPei/NvmExpressPei.c | 15 +++++++++++++++ > > 2 files changed, 30 insertions(+) > > > > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > > b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > > index 5a1eda8e8d..388583e4d5 100644 > > --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > > +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > > @@ -139,6 +139,21 @@ EnumerateNvmeDevNamespace ( > > > > Flbas = NamespaceData->Flbas; > > LbaFmtIdx = Flbas & 0xF; > > + > > + // > > + // Currently this NVME driver only suport Metadata Size == 0 > > + // > > + if (NamespaceData->LbaFormat[LbaFmtIdx].Ms != 0) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "NVME IDENTIFY NAMESPACE [%d] Ms(%d) is not supported.\n", > > + NamespaceId, > > + NamespaceData->LbaFormat[LbaFmtIdx].Ms > > + )); > > + Status = EFI_UNSUPPORTED; > > + goto Exit; > > + } > > + > > Lbads = NamespaceData->LbaFormat[LbaFmtIdx].Lbads; > > Device->Media.BlockSize = (UINT32)1 << Lbads; > > > > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c > > b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c > > index f73053fc3f..e8a29f23c7 100644 > > --- a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c > > +++ b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c > > @@ -104,6 +104,21 @@ EnumerateNvmeDevNamespace ( > > // > > Flbas = NamespaceData->Flbas; > > LbaFmtIdx = Flbas & 0xF; > > + > > + // > > + // Currently this NVME driver only suport Metadata Size == 0 // > > + if (NamespaceData->LbaFormat[LbaFmtIdx].Ms != 0) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "NVME IDENTIFY NAMESPACE [%d] Ms(%d) is not supported.\n", > > + NamespaceId, > > + NamespaceData->LbaFormat[LbaFmtIdx].Ms > > + )); > > + Status = EFI_UNSUPPORTED; > > + goto Exit; > > + } > > + > > Lbads = NamespaceData->LbaFormat[LbaFmtIdx].Lbads; > > > > NamespaceInfo->Media.InterfaceType = MSG_NVME_NAMESPACE_DP; > > -- > > 2.32.0.windows.2 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87304): https://edk2.groups.io/g/devel/message/87304 Mute This Topic: https://groups.io/mt/89519902/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
