From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1A6D52034A8AB for ; Tue, 23 Jan 2018 00:33:39 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2018 00:39:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,400,1511856000"; d="scan'208";a="197870541" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 23 Jan 2018 00:39:06 -0800 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 23 Jan 2018 00:39:06 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 23 Jan 2018 00:39:05 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Tue, 23 Jan 2018 16:39:03 +0800 From: "Wu, Hao A" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , "Tian, Feng" Thread-Topic: [PATCH] MdeModulePkg/NvmExpressDxe: Fix data buffer not mapped for Write cmd Thread-Index: AQHTlAeXnSUzPVI56E62G0z2V2T/xaOAj2oAgACTgyA= Date: Tue, 23 Jan 2018 08:39:02 +0000 Message-ID: References: <20180123050358.17840-1-hao.a.wu@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BA00EE3@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BA00EE3@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/NvmExpressDxe: Fix data buffer not mapped for Write cmd X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jan 2018 08:33:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sure, I will perform the sct test and make sure there's no failure before pushing this change. Best Regards, Hao Wu > -----Original Message----- > From: Zeng, Star > Sent: Tuesday, January 23, 2018 3:50 PM > To: Wu, Hao A; edk2-devel@lists.01.org > Cc: Ni, Ruiyu; Tian, Feng; Zeng, Star > Subject: RE: [PATCH] MdeModulePkg/NvmExpressDxe: Fix data buffer not > mapped for Write cmd >=20 > Reviewed-by: Star Zeng >=20 > Is it ok to do more test, for example with SCT? >=20 >=20 > Thanks, > Star > -----Original Message----- > From: Wu, Hao A > Sent: Tuesday, January 23, 2018 1:04 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Zeng, Star ; Ni, > Ruiyu ; Tian, Feng > Subject: [PATCH] MdeModulePkg/NvmExpressDxe: Fix data buffer not mapped > for Write cmd >=20 > Within function NvmExpressPassThru(): >=20 > The data buffer for the below 2 Admin command: > Create I/O Completion Queue command (Opcode 01h) Create I/O Submission > Queue command (Opcode 05h) >=20 > are not mapped to the PCI controller specific addresses. >=20 > But the current code logic also prevents the below NVM command: > Write (Opcode 01h) >=20 > from mapping its data buffer. >=20 > Hence, this commit refine the logics to resolve this issue. >=20 > Cc: Star Zeng > Cc: Ruiyu Ni > Cc: Feng Tian > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > index 7356c1d673..302cfdcd8d 100644 > --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > @@ -3,7 +3,7 @@ > NVM Express specification. >=20 > (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
> - Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
> + Copyright (c) 2013 - 2018, Intel Corporation. All rights > + reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be found > at @@ -593,7 +593,8 @@ NvmExpressPassThru ( > // these two cmds are special which requires their data buffer must su= pport > simultaneous access by both the > // processor and a PCI Bus Master. It's caller's responsbility to ensu= re this. > // > - if (((Sq->Opc & (BIT0 | BIT1)) !=3D 0) && (Sq->Opc !=3D > NVME_ADMIN_CRIOCQ_CMD) && (Sq->Opc !=3D NVME_ADMIN_CRIOSQ_CMD)) > { > + if (((Sq->Opc & (BIT0 | BIT1)) !=3D 0) && > + !((Packet->QueueType =3D=3D NVME_ADMIN_QUEUE) && ((Sq->Opc =3D=3D > + NVME_ADMIN_CRIOCQ_CMD) || (Sq->Opc =3D=3D > NVME_ADMIN_CRIOSQ_CMD)))) { > if ((Packet->TransferLength =3D=3D 0) || (Packet->TransferBuffer =3D= =3D NULL)) { > return EFI_INVALID_PARAMETER; > } > -- > 2.12.0.windows.1