From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web08.8181.1646289775381933954 for ; Wed, 02 Mar 2022 22:42:55 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=AZB+y7q/; spf=pass (domain: intel.com, ip: 134.134.136.31, 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=1646289775; x=1677825775; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=4MtN2XL8cJS3Fv2qXkYJW326+jNbhzpxvSuZNrLhDP4=; b=AZB+y7q/1WrR6W9ulYS5GZ+WP+tlHRYTsWvU5DiEzyCEW4tJdOTBuRKo qZHzmdENxJoKmCYVXLCGqOilS6sfMgTBkDvDRxJy+JeYHiOnd85shRLKK MJziki+L7GO68yCmVlToNu0OWYo7RlG3ef7iK2K9Q+XZ5rR3KXPRzs84r mCZXTVy8zoLvJmGgQrDy4H5ZH4y24jtjv35t1LxhlVN/+CgtGJu3H8A01 zBVRKBeUMGM13kVNkeliRGyjW0QfFtGcSrOJOX6JOBgXlBVPjXdYHCcqZ yrcGLWDyAeNYose0KPKWW9PJbvvSp9UDwJ35H12RKsjzOsBh6qbN6hA3F g==; X-IronPort-AV: E=McAfee;i="6200,9189,10274"; a="314310587" X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="314310587" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 22:42:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="511305078" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga006.jf.intel.com with ESMTP; 02 Mar 2022 22:42:54 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 2 Mar 2022 22:42:53 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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 via Frontend Transport; Wed, 2 Mar 2022 22:42:53 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.47) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Wed, 2 Mar 2022 22:42:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehXxWE7nZw2XgtlPCKSg+9VPDHgJUPAPfpiJ8Yl/NUCzfpVZtvB97pQpuUV9jLRivknewyqepgHyxIrYHdNn5oY5cWicoUNTH5A/EDgX+IB9HWySmCrvVhOoN/dzEeXKj+oiAJXU7bgCVX8W16xrPybzd75zKmRR5dLIo1DD9tGwZ9ewkQAw3CeIgsSxP8YlQfJeKKTz+XH54BIYoNZruDqC17EvNtUrV721m+oEB8iCRYRMh2A1bhy4w4Xmmsa6opb/GXLD5ME1e3wRy+N5gJ0twymfz2TaY97B1SQnqYUgHt8+0Jukm3XilrM8h/vpr5MnOV/CbZFWBYmLkh+4Ow== 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=7fypSjAUHF8F00a6qliIpwXRAx78AV6B69pnpuGLnrg=; b=T7ZKQeHva3qiZV7oG8mbiFPhtSt+crzwq7EW3p2xbLI+ZHnQy9O51bRePnbxtewFvW0AQpNxgiQD0P3kzsCKCb7PA1rcegdfQYkEh0aCSu3zdWMSN4gwEE+Hs6bUr/DQBcgTMT/HSJUgk8VI+rRLL7T9ELa/ydVID3sibbRDBuPmOgymw6udBvfR8D6qpqc5cyh9+yNXkyJqf6ldDU9OF1RdU4k6VzH5FXhL5HqxayCchpLW8bLMgCMlZcrBJ9kncxYlCcSCEppgyQ2sW39TD3qqKjfrPtqPkDnSbqOhTV9qNosroCdEkTERx3zKMOzC6kK8e4Ng2MdR05qjVwsg+A== 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 SA1PR11MB5803.namprd11.prod.outlook.com (2603:10b6:806:236::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Thu, 3 Mar 2022 06:42:48 +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.5017.027; Thu, 3 Mar 2022 06:42:48 +0000 From: "Wu, Hao A" To: "Ma, Hua" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Gao, Liming" , "Ni, Ray" Subject: Re: [PATCH v2] MdeModulePkg: Add a check for metadata size in NvmExpress Driver Thread-Topic: [PATCH v2] MdeModulePkg: Add a check for metadata size in NvmExpress Driver Thread-Index: AQHYLrxzF56ygUUwa02Il8/pXcmejaytKhSw Date: Thu, 3 Mar 2022 06:42:48 +0000 Message-ID: References: <71f2bca338cef51bf250616c684f2b8bab8694f5.1646276422.git.hua.ma@intel.com> In-Reply-To: <71f2bca338cef51bf250616c684f2b8bab8694f5.1646276422.git.hua.ma@intel.com> 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: 62cf4c37-5117-4a7c-4577-08d9fce1086e x-ms-traffictypediagnostic: SA1PR11MB5803: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: KyGOJBOmVocnFzrskxxyN8BYBsOVYMocLjk8NHa1mAm51CuwHYvXDSBy/icO4BdNsznHJEXmT/xEgUJL+XNJaGEWvkMtqsy01gL3rXNbGGyCJmvv7Suwz5w12SrhbtQlzUkV0eIp5sFqejSdScM21vs90AMHK5IXyaemn47AZNKuIZx69izLhUlpBXTV/YAVvztro1/OG0gxCjtsjHski17QrDT9vbT0dXhrCqvw+thr+AeGpvh6/sukARUgftqm8pDYfmcK4S1ShpfhN0STX1zbjMYYnJkOdCwk4z5BHwx+tdq4UGx3a+BPZPrPtGdeM0tK/JJgtL2pt8mM5264XHNtkqzLvgU4Btq/zqaLGY3tdx05AFpwGZny+q7lvyhKI8Xfxnf+j2dyTpNDzOMbPFtZy7FvUOlvE+XrKi2D0jaclNjaIAnx3LbsP96cNwfeimojJc1dAPZJKqj9P2gWfowta8MT14ZTwd09MsVAqU4/qlo6hnH0tbKoQvvL18j0ZTqxGxjkvqdZnrFJq+W4jf1z/F+MKbDGbu4KfV4CH73sgf96jGnm3yhtr48Tlww8T6e2I4koFIMQBYMHMG7VMdlJI3hOYBtTOA/E5pzXofITaQ7KsjDDqdW6qkQ44uL7MJ8dUJfm5X80EJMEzIPSa9erk77gkpFDC02sUcNKcJirxIFu9tJmJ+xT7Aq+SH9NGqqa9fXdvdpE0NiFbYYFWVOs7m+5oOIPAJWpATLoZBMjlJxzLtQwh0EJ46+s/pB4WGrwu+v2snB6CPs8v136nbeX0DphDAR5vOeAsC0VQhSDmu3Fq4LluzTVAVKfA4BqQkAyZNCcICKwXaIVA1pPrA== 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)(508600001)(9686003)(53546011)(7696005)(6506007)(966005)(5660300002)(186003)(26005)(86362001)(38100700002)(71200400001)(122000001)(38070700005)(83380400001)(82960400001)(107886003)(33656002)(76116006)(66946007)(66556008)(66476007)(64756008)(66446008)(4326008)(52536014)(2906002)(316002)(8676002)(8936002)(54906003)(110136005)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?C7yDKqBQDxvC5tvb2Ttk/unogeUYJ/jBax4EAs2KGvzWP8IoXvwmyFmO9pji?= =?us-ascii?Q?iexjoukmEjXwG7oXhkumeZil6RjVA7uc0M4Bnc0OMy4XyAde5Yf6l3ZtEaOX?= =?us-ascii?Q?ONV0cEcVP7TRiczcxeIu8jCmA0x1zEX5FT0TzdBzf8VzFhUyxmrt7WwD0vNv?= =?us-ascii?Q?9I9UqM/MeeWua4gwKKuKW/Y8+u/QwUtMjRF16SpfvpGXePh70Fq/dnw9/nHQ?= =?us-ascii?Q?DKIxm3Y1/Efr3UlHoUXj+b3Gtff74x7ppa3OnvA4+/5Ns/5/RyFi1zW5Qgae?= =?us-ascii?Q?GE2qxrrT/QLB2lYF0HxCUoK+UYAAQfkBD8bijPWF5Wxne/UEUO2Kf3nLNgB3?= =?us-ascii?Q?RpS23H0x4FxOyJY2Kd9Vm7eNoDt37raYfWsQx6xgPr3O0xfs9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pr6yWzhC1Gjs2tA7tBo2Qe/f6m10uS3?= =?us-ascii?Q?1rr7XFWx2LsBOgWkIy5suyjQU0wA8Ip39d4FEMSXuzMOXA2Nyh4Ub8AxmJH6?= =?us-ascii?Q?9j/QlyAcqiriyYk1h/rzlHg9Zn0x6CcC0/SaORlxuEIQyGNuVZvyDXBMQYjb?= =?us-ascii?Q?uo+VR99LvfH+kjsipjpcxiD6HYd0yazEsupa5KeBVMpvgDjlQmPhaumuLDeb?= =?us-ascii?Q?yyTpGzm2WbWt4iZoyO6Vu6UERwTVdFamI7FWx6EJpF+Hz7W7pCJssF26i+Ua?= =?us-ascii?Q?aPBXZIHoowtFEMBzSTOxEFzYGbMigaSH7JgbFqj3Y9qjm00M3i4HFA/l3+tc?= =?us-ascii?Q?nzSGXtmKNdQXcOcB7cL2+pU=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: 62cf4c37-5117-4a7c-4577-08d9fce1086e X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2022 06:42:48.7515 (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: qYESCIx3EKVw5JmeeEEgc5e3jyAEWtmw6PULFiYdA5wZnl49DOgvrnweA7AH5tpcNBQnVMFGwvwR2C3BT2x9iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB5803 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 Reviewed-by: Hao A Wu Best Regards, Hao Wu > -----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 >=20 > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3856 >=20 > Currently this NvmeExpress Driver do not support metadata handling. > According to the NVME specs, metadata may be transferred to the host afte= r > the logical block data. It can overrun the input buffer which may only > be the size of logical block data. >=20 > Add a check to return not support for the namespaces formatted with > metadata. >=20 > v2 changes: > - Change debug log level from INFO to ERROR > - Change to if (NamespaceData->LbaFormat[LbaFmtIdx].Ms !=3D 0) >=20 > v1: https://edk2.groups.io/g/devel/message/87242 >=20 > Cc: Jian J Wang > Cc: Liming Gao > Cc: Hao A Wu > Cc: Ray Ni >=20 > Signed-off-by: Hua Ma > --- > MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 15 > +++++++++++++++ > .../Bus/Pci/NvmExpressPei/NvmExpressPei.c | 15 +++++++++++++++ > 2 files changed, 30 insertions(+) >=20 > 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 ( >=20 > 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].Lbad= s; > Device->Media.BlockSize =3D (UINT32)1 << Lbads; >=20 > 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; >=20 > NamespaceInfo->Media.InterfaceType =3D MSG_NVME_NAMESPACE_DP; > -- > 2.32.0.windows.2