From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>, "Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH v2 3/3] MdeModulePkg/NvmExpressDxe: Refine PassThru IO queue creation behavior
Date: Wed, 24 Oct 2018 04:08:13 +0000 [thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BED0261@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20181024011952.20404-4-hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Thanks/Ray
> -----Original Message-----
> From: Wu, Hao A
> Sent: Wednesday, October 24, 2018 9:20 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Ni, Ruiyu <ruiyu.ni@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [PATCH v2 3/3] MdeModulePkg/NvmExpressDxe: Refine PassThru
> IO queue creation behavior
>
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1260
>
> For the PassThru() service of NVM Express Pass Through Protocol, the
> current implementation (function NvmExpressPassThru()) will only use the
> IO Completion/Submission queues created internally by this driver during the
> controller initialization process. Any other IO queues created will not be
> consumed.
>
> So the value is little to accept external IO Completion/Submission queue
> creation request. This commit will refine the behavior of function
> NvmExpressPassThru(), it will only accept driver internal IO queue creation
> commands and will return "EFI_UNSUPPORTED" for external ones.
>
> Cc: Jiewen Yao <Jiewen.yao@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
> MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h | 7 +++++-
> MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 6 +++++
> MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 25
> +++++++++++++-------
> 3 files changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h
> b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h
> index ad0d9b8966..fe7d37c118 100644
> --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h
> +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h
> @@ -3,7 +3,7 @@
> NVM Express specification.
>
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
> - Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2013 - 2018, Intel Corporation. All rights
> + reserved.<BR>
> 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 @@ -147,6 +147,11 @@ struct
> _NVME_CONTROLLER_PRIVATE_DATA {
> NVME_CQHDBL CqHdbl[NVME_MAX_QUEUES];
> UINT16 AsyncSqHead;
>
> + //
> + // Flag to indicate internal IO queue creation.
> + //
> + BOOLEAN CreateIoQueue;
> +
> UINT8 Pt[NVME_MAX_QUEUES];
> UINT16 Cid[NVME_MAX_QUEUES];
>
> diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> index 421561f16d..4a070f3f13 100644
> --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
> @@ -584,6 +584,7 @@ NvmeCreateIoCompletionQueue (
> UINT16 QueueSize;
>
> Status = EFI_SUCCESS;
> + Private->CreateIoQueue = TRUE;
>
> for (Index = 1; Index < NVME_MAX_QUEUES; Index++) {
> ZeroMem (&CommandPacket,
> sizeof(EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
> @@ -627,6 +628,8 @@ NvmeCreateIoCompletionQueue (
> }
> }
>
> + Private->CreateIoQueue = FALSE;
> +
> return Status;
> }
>
> @@ -653,6 +656,7 @@ NvmeCreateIoSubmissionQueue (
> UINT16 QueueSize;
>
> Status = EFI_SUCCESS;
> + Private->CreateIoQueue = TRUE;
>
> for (Index = 1; Index < NVME_MAX_QUEUES; Index++) {
> ZeroMem (&CommandPacket,
> sizeof(EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
> @@ -698,6 +702,8 @@ NvmeCreateIoSubmissionQueue (
> }
> }
>
> + Private->CreateIoQueue = FALSE;
> +
> return Status;
> }
>
> diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> index c52e960771..78464ff422 100644
> --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
> @@ -587,14 +587,23 @@ NvmExpressPassThru (
> }
>
> Sq->Prp[0] = (UINT64)(UINTN)Packet->TransferBuffer;
> - //
> - // If the NVMe cmd has data in or out, then mapping the user buffer to the
> PCI controller specific addresses.
> - // Note here we don't handle data buffer for CreateIOSubmitionQueue
> and CreateIOCompletionQueue cmds because
> - // these two cmds are special which requires their data buffer must
> support simultaneous access by both the
> - // processor and a PCI Bus Master. It's caller's responsbility to ensure this.
> - //
> - if (((Sq->Opc & (BIT0 | BIT1)) != 0) &&
> - !((Packet->QueueType == NVME_ADMIN_QUEUE) && ((Sq->Opc ==
> NVME_ADMIN_CRIOCQ_CMD) || (Sq->Opc ==
> NVME_ADMIN_CRIOSQ_CMD)))) {
> + if ((Packet->QueueType == NVME_ADMIN_QUEUE) &&
> + ((Sq->Opc == NVME_ADMIN_CRIOCQ_CMD) || (Sq->Opc ==
> NVME_ADMIN_CRIOSQ_CMD))) {
> + //
> + // Currently, we only use the IO Completion/Submission queues created
> internally
> + // by this driver during controller initialization. Any other IO queues
> created
> + // will not be consumed here. The value is little to accept external IO
> queue
> + // creation requests, so here we will return EFI_UNSUPPORTED for
> external IO
> + // queue creation request.
> + //
> + if (!Private->CreateIoQueue) {
> + DEBUG ((DEBUG_ERROR, "NvmExpressPassThru: Does not support
> external IO queues creation request.\n"));
> + return EFI_UNSUPPORTED;
> + }
> + } else if ((Sq->Opc & (BIT0 | BIT1)) != 0) {
> + //
> + // If the NVMe cmd has data in or out, then mapping the user buffer to
> the PCI controller specific addresses.
> + //
> if (((Packet->TransferLength != 0) && (Packet->TransferBuffer == NULL))
> ||
> ((Packet->TransferLength == 0) && (Packet->TransferBuffer != NULL))) {
> return EFI_INVALID_PARAMETER;
> --
> 2.12.0.windows.1
prev parent reply other threads:[~2018-10-24 4:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 1:19 [PATCH v2 0/3] NvmExpressDxe: Bug fixes within NvmExpressPassThru() Hao Wu
2018-10-24 1:19 ` [PATCH v2 1/3] MdeModulePkg/NvmExpressDxe: Refine data buffer & len check in PassThru Hao Wu
2018-10-24 1:19 ` [PATCH v2 2/3] MdeModulePkg/NvmExpressDxe: Always copy CQ entry to PassThru packet Hao Wu
2018-10-24 1:19 ` [PATCH v2 3/3] MdeModulePkg/NvmExpressDxe: Refine PassThru IO queue creation behavior Hao Wu
2018-10-24 4:08 ` Ni, Ruiyu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=734D49CCEBEEF84792F5B80ED585239D5BED0261@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox