From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web08.22116.1646618263886794431 for ; Sun, 06 Mar 2022 17:57:44 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=l2fwLdlt; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: hao.a.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646618263; x=1678154263; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=jtRveMJOR84w2eToxHtxuKDtGCwTW38Cyx/mqfaGQb8=; b=l2fwLdltPOAB2VGFoOiTcCWx62oQEazoGAOlEYuqbHZ8s/vnYz+L2Jud IuvmSu9QHnGwoWH5CPKPztzJFlN1xtqmKDy8cRUHYFyT/Ym13DrPJgXp5 zHAfr0uE40ZN8Ax5guhUypeOWhuI3j/ipXjMuTHPg7I4W6ibW/KkGs5ha 4reZz1Zx/KbO9LNZHk7AXl1mXjVD3doKbasJ9aynEp7p/FOXuD3fa6XEq OJWPoocxUpDR/dLY2wedBaDcPTuTybvmwtQRD2vrJ2tZCoO9XrwkuWv34 APsMtAGC4UC6G40mnFTXbqizRmLW73Qdzi0RFlq5Z0HpFr0mA0NuNGIg6 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10278"; a="253108529" X-IronPort-AV: E=Sophos;i="5.90,160,1643702400"; d="scan'208";a="253108529" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2022 17:57:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,160,1643702400"; d="scan'208";a="552940952" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga008.jf.intel.com with ESMTP; 06 Mar 2022 17:57:25 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 6 Mar 2022 17:57:24 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 6 Mar 2022 17:57:24 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Sun, 6 Mar 2022 17:57:24 -0800 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.43) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Sun, 6 Mar 2022 17:57:23 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8HNUy6hP536Qv6nAinDph8hr9smJhi4+Y+fjKSrq7WuxSiujQO4CtHaKUoh+hd1KyGJQupXuDsx50pf64duFS345xySXOM6sFnyhYfyfnH9QM/U9fUuy/gUf/64OpX0cCXLLSrE+/Snc2lo/sztVTj5qayL5gDC5xbiKw5F5IS0+2FijLeIStaSY0IqrxV2X8j1j33LdAVLUl+gIk5KKeuZPcNq2YwyE0Myhi6+ehuvjaxHhDuS7khD0gLphijZxHFo+d22PMI3sCU9rGKpjwndtg8LYGrQWjRCV1MWdnC7PDGl88UKgwnlu3tzXqCXeM+IiRkUKK0wayyr7kl35w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kYChhkRqAcfP3C+Tl4ueQWqGlL8yhhnTel9XVeXQy4Q=; b=W+gJN9U+GHA9I3R5rvxLUOHt2hU7q0ie9z6K0ekOnQbC41B2SYEGvdsZ7LIL21/pZ3ECm9kuJvfkPNcWaKTznYzENnxVL/cPYliDYzMX04UAMcP1Et77OEbJvXtYcTUH+XsrHzZILpQFWfYqD/rDXWrkFJ6r35na2EoNGYFvIuZgrGv8OZLvtsDQ3EpwCGeNrQnnGhT9kxK18X7UK4NOD1BoCwtkdpQMs+Oo4Ul7wmygLntOgWnPzzFk5Z0JslmCGMUoV+s3jzKdFiDoNVFqSN2M9qFRF0TtvizruUcshQP8Ij11e05eyyPgwqEGBV1gM7xHtCol4YvqD4Lj6e1INA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4025.namprd11.prod.outlook.com (2603:10b6:5:197::31) by DM6PR11MB3162.namprd11.prod.outlook.com (2603:10b6:5:55::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.21; Mon, 7 Mar 2022 01:57:20 +0000 Received: from DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::2dd0:9ba8:a8c:fc96]) by DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::2dd0:9ba8:a8c:fc96%3]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 01:57:20 +0000 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Wu, Hao A" , "Ma, Hua" CC: "Wang, Jian J" , "Gao, Liming" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH v2] MdeModulePkg: Add a check for metadata size in NvmExpress Driver Thread-Topic: [edk2-devel] [PATCH v2] MdeModulePkg: Add a check for metadata size in NvmExpress Driver Thread-Index: AQHYLrxzF56ygUUwa02Il8/pXcmejaytKhSwgAYFqhA= Date: Mon, 7 Mar 2022 01:57:20 +0000 Message-ID: References: <71f2bca338cef51bf250616c684f2b8bab8694f5.1646276422.git.hua.ma@intel.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: af77a52a-4b43-4acb-14c8-08d9ffddd0e2 x-ms-traffictypediagnostic: DM6PR11MB3162:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: giByslGb7ng7E50C7DTF9qHMBYjFVQ4d+KZhlZ4J5gnGNAp36Mc2r0K4oe+gXacEzOcLYAG6djf+D+zWnCZ4jhtfj8LIDeGmOkIPOlX8qB6kmv1NHcyxqTuFjFEtwgAmZZho2AZJ4kDgI7bM4xg048MGJevF0RO2MQawuU/nVB+l8z39RKs5U8tRgJPX1aSNXtpViPi7BnoPxJDNiK+pzzhfj/mlZyBYqZeTZpyr3aJcPfuveND8SytVl9JyQlpjFeO/LlHJPo9AsuS1cufPOzB3CVQ0RdSbwMYsI8vYVTo0m0jMuDiUMWiJ96vvB92C2abIRFvSiidagIz3UeAtWuBd2StH0kvXb6ht5Qmi2xE9XME+grUCu9YD7EE7/pWe6ivi3cmU8BT9ZT2UiFAZTQYaYpQGcG+UCbdI96+fCAMr70p4y0OpyK02ElDjyMwowj9B9h02zW8k715DUZ0N8jF8uXDZKMv6n5BNs5tuUyrAfW96cZzuqbzxEcwTET3sw6h5zcWLZ9OFODMxXLXJ6GsKC/GrS/jzh1fOlY8REtszgLMZ0z/sa1xSMXS3gPbx1OmwheeKS9PIev2Z98sp1RwYje8ns0Rqj6pHdhCDbyk+mPF9w8GKAU7DnKEq1ts+QTF0+uR3JvLGRVcgM4uVQT3hUXrIQAbA8kKvyOD27iX/4panOgInGnHgXS/o9WcdmZ0M6D6pzh+FmikM5m3JlI58fpE90by4bw75LKDbfREZfrLurz94O2AYdspO3FCzqnXJt/8HcMqfsA2YClb0gUdJV+Ek2QEc4z4nxnVL3cDm70wZkuYGodoUI9C2wsOK3ykelnx30GN4Zwni5cpHGw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4025.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6636002)(66556008)(71200400001)(66946007)(66446008)(8676002)(4326008)(186003)(110136005)(54906003)(5660300002)(316002)(508600001)(83380400001)(9686003)(2906002)(26005)(76116006)(66476007)(64756008)(107886003)(966005)(52536014)(8936002)(7696005)(53546011)(6506007)(38100700002)(122000001)(38070700005)(82960400001)(55016003)(86362001)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?uAroKZW6gmLXQcAWl3iBvWrIUtuayPOxV3hv7yv5u7Sz0mm/qrqAj4avjW25?= =?us-ascii?Q?1xnbLuBVxnW674js8h5MPaFZPBeZMRiIZXAM/2NQiTbT6N5IoYR0w2GPlBR4?= =?us-ascii?Q?PN5eu6/iOVUj9iHr472vVqPZLZGxceZqP2eRjQ4oFpFauGLRLAPLek1h2y1K?= =?us-ascii?Q?NxKcmp6+yUCAvc2pxF5R0XJBeNFf3I5GBNxxGf4dFTo1SRqghfFk9wuZuruf?= =?us-ascii?Q?yfAS+7HIu6OJ67xR+z8rTjXa/DTiOi7cxriGWnJRUQtOYVgb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FPHsgCmVRGNBGf4MJQFnPTuCCR3W5M85XhmarO?= =?us-ascii?Q?l48WzHgOIGkoqKErRgxjBb2T4Y6jtQFbdvNrcNFBltv/TtSHzuy610pD8Erl?= =?us-ascii?Q?UrCRcED5UPCQC+3vETPoeW+3UQLQBzm2bbBe6ZCVBzaN5MbyPBzG8WlzTePq?= =?us-ascii?Q?ypYsEyGhiSJepUSEgA/Ui2HOT6Db8IKuJgFIlBKI+dxj+PcfZoKaWiGsLbQq?= =?us-ascii?Q?i65MegaJLfJEY6+27dgptbzcORN9puCg4Cfq+CTwZe43cvyyfAWJVEwvEpDz?= =?us-ascii?Q?qcffgTYn34CFqIXufPgmhRKtyJBxYpHqMD726wV3eea3eUkUdBjvXGyvbWbq?= =?us-ascii?Q?0HoPjAl5rxQ5HLD70JTM6UGtFmI3QG6B54Kujc/N0JsThTsCIQgBL5TE/7Ca?= =?us-ascii?Q?EVTbYkA8h0V35eugCCh4bIep/okvYmbTTJvwhwcS3ZEXj2PjAb+OjZSmgnDc?= =?us-ascii?Q?MlcgfpsJnq62Z1tq7JXNfvU=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4025.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: af77a52a-4b43-4acb-14c8-08d9ffddd0e2 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2022 01:57:20.5406 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cnviokCACvegXTPQh7OW7V+qtuWysqM/QiPKZFkdCjMl5UwDf0gRwkgh5gHGfHNSAQsDutgH6yHc+38mFKw8Dw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3162 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed via: PR - https://github.com/tianocore/edk2/pull/2592 Commit - https://github.com/tianocore/edk2/commit/79f2734e5a7bc2e5256eb0e59= 9f45407855159c7 Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Wu, Hao > A > Sent: Thursday, March 3, 2022 2:43 PM > To: Ma, Hua ; devel@edk2.groups.io > Cc: Wang, Jian J ; Gao, Liming > ; Ni, Ray > Subject: Re: [edk2-devel] [PATCH v2] MdeModulePkg: Add a check for > metadata size in NvmExpress Driver >=20 > Reviewed-by: Hao A Wu >=20 > Best Regards, > Hao Wu >=20 > > -----Original Message----- > > From: Ma, Hua > > Sent: Thursday, March 3, 2022 1:06 PM > > To: devel@edk2.groups.io > > Cc: Wang, Jian J ; Gao, Liming > > ; Wu, Hao A ; Ni, Ray > > ; Ma, Hua > > Subject: [PATCH v2] MdeModulePkg: Add a check for metadata size in > > NvmExpress Driver > > > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3856 > > > > 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 !=3D 0) > > > > v1: https://edk2.groups.io/g/devel/message/87242 > > > > Cc: Jian J Wang > > Cc: Liming Gao > > Cc: Hao A Wu > > Cc: Ray Ni > > > > Signed-off-by: Hua Ma > > --- > > 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 =3D NamespaceData->Flbas; > > LbaFmtIdx =3D Flbas & 0xF; > > + > > + // > > + // Currently this NVME driver only suport Metadata Size =3D=3D 0 > > + // > > + if (NamespaceData->LbaFormat[LbaFmtIdx].Ms !=3D 0) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "NVME IDENTIFY NAMESPACE [%d] Ms(%d) is not supported.\n", > > + NamespaceId, > > + NamespaceData->LbaFormat[LbaFmtIdx].Ms > > + )); > > + Status =3D EFI_UNSUPPORTED; > > + goto Exit; > > + } > > + > > Lbads =3D NamespaceData->LbaFormat[LbaFmtIdx].Lb= ads; > > Device->Media.BlockSize =3D (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 =3D NamespaceData->Flbas; > > LbaFmtIdx =3D Flbas & 0xF; > > + > > + // > > + // Currently this NVME driver only suport Metadata Size =3D=3D 0 // > > + if (NamespaceData->LbaFormat[LbaFmtIdx].Ms !=3D 0) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "NVME IDENTIFY NAMESPACE [%d] Ms(%d) is not supported.\n", > > + NamespaceId, > > + NamespaceData->LbaFormat[LbaFmtIdx].Ms > > + )); > > + Status =3D EFI_UNSUPPORTED; > > + goto Exit; > > + } > > + > > Lbads =3D NamespaceData->LbaFormat[LbaFmtIdx].Lbads; > > > > NamespaceInfo->Media.InterfaceType =3D MSG_NVME_NAMESPACE_DP; > > -- > > 2.32.0.windows.2 >=20 >=20 >=20 >=20 >=20