From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from epoutp02.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 8F8E321954084 for ; Thu, 20 Apr 2017 03:02:16 -0700 (PDT) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by epoutp02.samsung.com (KnoxPortal) with ESMTP id 20170420100214epoutp02c332e4a26f08ba09287be51d7173d799~3Ets0TBz10086300863epoutp02b; Thu, 20 Apr 2017 10:02:14 +0000 (GMT) Received: from epsmges5p5.samsung.com (unknown [182.195.42.89]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20170420100213epcas5p495668a8ce00574c0dca3470fd8612469~3EtsAJs121423714237epcas5p4g; Thu, 20 Apr 2017 10:02:13 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p5.samsung.com (EPCPMTA) with SMTP id 2A.3C.06094.12788F85; Thu, 20 Apr 2017 19:02:09 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20170420100209epcas5p1839e6395a1399a22ab8f705c52e65eeb~3EtoTZ8Y12595525955epcas5p1e; Thu, 20 Apr 2017 10:02:09 +0000 (GMT) X-AuditID: b6c32a59-f79166d0000017ce-06-58f887212be2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id BA.6A.05013.12788F85; Thu, 20 Apr 2017 19:02:09 +0900 (KST) Received: from amit.kp-ubuntu.sisodomain.com ([107.108.221.253]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OOP002Q9D7DKT90@mmp1.samsung.com>; Thu, 20 Apr 2017 19:02:09 +0900 (KST) From: Suman Prakash To: edk2-devel@lists.01.org Cc: feng.tian@intel.com, Suman Prakash Date: Thu, 20 Apr 2017 15:31:42 +0530 Message-id: X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRmVeSWpSXmKPExsWy7bCmuq5i+48Ig/nf5Sz2HDrKbDFpN7vF +1/n2R2YPRbvecnk0T37H4tH35ZVjAHMUVw2Kak5mWWpRfp2CVwZExe9Yiz4xFdxumEtYwPj Pu4uRk4OCQETidPHPjJC2GISF+6tZ+ti5OIQEljKKLHvQhcrSEJIoJ1J4vgzNZiGpkNXmCGK ljNKzD3fxA7hNDFJTP52gQ2kik1AU2Jxdw9Yt4iAtMSGq+vZQWxmARuJSStbwdYJC4RLLHj0 DKyGRUBVom3VTbBeXoFoif1TZ7NDbJOTOHlsMiuEvYZN4tn68C5GDiBbVmLTAWaIsIvE18UL 2SBsYYlXx7dAtUpL/F16ixHkNgmBbkaJ9o/XmSCcKYwSq5Y0MkIMspc48rAK4jY+id7fT5gg wrwSHW1CEHM8JL59PgkNIUeJZXf3MEECJVZi5ZzZTBMYpRcwMqxiFEstKM5NTy02LTDVK07M LS7NS9dLzs/dxAiONq3IHYxXZgYdYhTgYFTi4X1w93uEEGtiWXFl7iFGCQ5mJRFexfIfEUK8 KYmVValF+fFFpTmpxYcYpTlYlMR5NVZeixASSE8sSc1OTS1ILYLJMnFwSjUwFm+e9yWVX32h 7c3FJdNXX1D3TZi678q6dintzZ/KVm+3c50ZuH3ZkjCB0GW+PCWH9rFesGqsVPcJW/Uy6EZg mqd8dGi8SKfxkq31O0vzp9yWreJ4VrA8tm3W9MSast8Sx87dOMVe4XHwrdXtB3KezaeP/z+1 KXXNo7e3/4X3fxC/POevKmeQmRJLcUaioRZzUXEiAGKM4TeyAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOLMWRmVeSWpSXmKPExsVy+t9jAV3F9h8RBnuvC1nsOXSU2WLSbnaL 97/Oszsweyze85LJo3v2PxaPvi2rGAOYo9xsMlITU1KLFFLzkvNTMvPSbZVCQ9x0LZQU8hJz U22VInR9Q4KUFMoSc0qBPCMDNODgHOAerKRvl+CWMXHRK8aCT3wVpxvWMjYw7uPuYuTkkBAw kWg6dIUZwhaTuHBvPVsXIxeHkMBSRokNt36zQzgtTBJ/Hk1lB6liE9CUWNzdwwpiiwhIS2y4 uh4szixgIzFpZSsjiC0sEC5xYNd3FhCbRUBVom3VTTYQm1cgWuLwxBlsENvkJE4em8w6gZF7 ASPDKkaJ1ILkguKk9FyjvNRyveLE3OLSvHS95PzcTYzgQHsmvYPx8C73Q4wCHIxKPLwbMr5H CLEmlhVX5h5ilOBgVhLhVSz/ESHEm5JYWZValB9fVJqTWnyI0RTogInMUqLJ+cAoyCuJNzQx NzE3NrAwt7Q0MVIS522c/SxcSCA9sSQ1OzW1ILUIpo+Jg1OqgZFT42SGxXSWzNWZ5vyXffp9 f24z71lRKy2Rmv777NKzqtrWkt+POBlWXs+XOneKr8iaLeDINZmgDI0fDgU++W+OGR17pMHm 9eXPVdPQ9xcmz/395fzd5jOPlc0yrs1Z5Fuw3GNVns11u9bVBSF/v7zc3aTpLf62Pj7PtiKq oTR8f9ZZFvXfq5RYijMSDbWYi4oTAdg6woBKAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170420100209epcas5p1839e6395a1399a22ab8f705c52e65eeb X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?U1VNQU4gUFJBS0FTSCBCG1NTSVItU1NEIFNvbHV0aW9ucxs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBDaGllZiBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?U1VNQU4gUFJBS0FTSCBCG1NTSVItU1NEIFNvbHV0aW9ucxtT?= =?UTF-8?B?YW1zdW5nwqBFbGVjdHJvbmljcxtTZW5pb3IgQ2hpZWYgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElEMDdJRDAxMTAxMg==?= CMS-TYPE: 105P X-CMS-RootMailID: 20170420100209epcas5p1839e6395a1399a22ab8f705c52e65eeb X-RootMTR: 20170420100209epcas5p1839e6395a1399a22ab8f705c52e65eeb References: Subject: [PATCH] MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2017 10:02:16 -0000 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 --- 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