public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Suman Prakash <suman.p@samsung.com>
To: edk2-devel@lists.01.org
Cc: feng.tian@intel.com, Suman Prakash <suman.p@samsung.com>
Subject: [PATCH] MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db
Date: Thu, 20 Apr 2017 15:31:42 +0530	[thread overview]
Message-ID: <f112fab77877102fc889f8158638a974253bbd70.1492679224.git.suman.p@samsung.com> (raw)
In-Reply-To: CGME20170420100209epcas5p1839e6395a1399a22ab8f705c52e65eeb@epcas5p1.samsung.com

In case of an async command if updating the submission queue tail
doorbell fails then the command will not be picked up by device and
no completion response will be created. This scenario has to be handled.
Also if we create an AsyncRequest element and insert in the async queue,
it will never receive a completion so in the timer routine this element
won't be freed, resulting in memory leak. Also in case of blocking calls
we should capture the status of updating completion queue head doorbell
register and return it to caller of PassThru.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Suman Prakash <suman.p@samsung.com>
---
 MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
index ef3d772..fb80f39 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
@@ -603,7 +603,7 @@ NvmExpressPassThru (
     Private->SqTdbl[QueueId].Sqt ^= 1;
   }
   Data = ReadUnaligned32 ((UINT32*)&Private->SqTdbl[QueueId]);
-  PciIo->Mem.Write (
+  Status = PciIo->Mem.Write (
                PciIo,
                EfiPciIoWidthUint32,
                NVME_BAR,
@@ -612,6 +612,10 @@ NvmExpressPassThru (
                &Data
                );
 
+  if (EFI_ERROR (Status)) {
+    goto EXIT;
+  }
+
   //
   // For non-blocking requests, return directly if the command is placed
   // in the submission queue.
@@ -695,7 +699,7 @@ NvmExpressPassThru (
   }
 
   Data = ReadUnaligned32 ((UINT32*)&Private->CqHdbl[QueueId]);
-  PciIo->Mem.Write (
+  Status = PciIo->Mem.Write (
                PciIo,
                EfiPciIoWidthUint32,
                NVME_BAR,
-- 
1.9.1



       reply	other threads:[~2017-04-20 10:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170420100209epcas5p1839e6395a1399a22ab8f705c52e65eeb@epcas5p1.samsung.com>
2017-04-20 10:01 ` Suman Prakash [this message]
2017-04-21  1:38   ` [PATCH] MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db Wu, Hao A
2017-04-24  1:07     ` Wu, Hao A

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=f112fab77877102fc889f8158638a974253bbd70.1492679224.git.suman.p@samsung.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