From patchwork Sat Dec 2 09:22:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 120412 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2178373qgn; Sat, 2 Dec 2017 01:37:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMYwzIYEUEb69taYTjZQV5RhFcR5gAghvK2lE79/onVX+TA8yM+SKo7CcwGbAIWxExOyzTBv X-Received: by 10.99.103.70 with SMTP id b67mr8531335pgc.211.1512207449088; Sat, 02 Dec 2017 01:37:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512207449; cv=none; d=google.com; s=arc-20160816; b=k5Xts36l0d9oAVvaZpv9ouseXscQK7MDqpil0Ft/ll/HcN2EjXLNZrQGH997CzpGhw gqVJONk6Dw3J3SLrZ09Y/KE0SnO/ALgFYTjtgrv7xXXiuFwTOmuTAD2uMig9k8aMuJGR stWbUCsWGKnIFWpWoLOYUkjs/5hNjwF+W+TPlFt92A5UsqlvxXAJ9m1EGigX4OwkHX5I DPe7has+G8Uc89iiZllN/AzjpwhdHAzxYIc/5Vrc59bLhmACGIcuYw8nRwnjhMJ/Yg9K 9HiBdId/vLR2LNXcjkBE5NSskzRYkI64P1h43QjCitvjl3294EaKw4dfgYdqsL0JdoSO mVKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=F6rPf3meUqL6KS/+AGSSfLv3qU3vXIMopMtMGoQPkRc=; b=Uy1bwfWUqd4qB4faWsc+/q9lNxpehq93hTPclXEQ/H8gQV7xQQqO58bKqqDe7c/lu2 5Yv6I+Uc0DRQ8SatY6rbZQgea47bM2Pcj1pYn1ZlI/pQ8Cs8J6qT7kkAwnwMb719rFR6 hVIsE7n3PFU8ee14Cew+JQ7QXBPJv8NnT/chTJ5spMELqwTMuQ+qvIRKBpMj1RHHUviw utPsw4B2ttkazXjAg7K+aFaFdygW/oaGYPtTFAB1+bgr9Qz/Zu5P7xxRtIoVLjg6GD+U ru3qpLI84dV28Spfj9JThPRwr57q87DBrEKOd9JnKebvKJxeYE+zEErjqkSEKJal2TaV Z8Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BWhbUxuB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id p124si6172286pga.20.2017.12.02.01.37.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Dec 2017 01:37:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BWhbUxuB; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 13D7821A10987; Sat, 2 Dec 2017 01:33:00 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6922E21A10986 for ; Sat, 2 Dec 2017 01:32:57 -0800 (PST) Received: by mail-pf0-x244.google.com with SMTP id n6so5732648pfa.4 for ; Sat, 02 Dec 2017 01:37:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=irbh8ByYxdb9IffvPek/u6u+tKyqNBijVoihJ/db4d4=; b=BWhbUxuBgp1QSnWT4G5ReQTpGy+E5KtxzGgfma+ZHlLZxwn68wBiUTui5TQ4MSCgGg 80esAf5jT+OR6Itk3pri52RBn/bEq397CXP/WSc+CBCxNGgeA0byZDGUjDXzd/oQpVHu tUphoxr1G2d1QPW2e+1ieOVA6DKnBWhewwOy4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=irbh8ByYxdb9IffvPek/u6u+tKyqNBijVoihJ/db4d4=; b=JP79+qiV7aPSL9lax6/mEs3bS6sbBgUwrJiYkzcdZ3f3cnhaZs7UMdiP1j6ZPVjnDl kN2oVIGe9Y2+5dJLO6s3GG2gZ9kukavW6CKdwrL1m+ilVbVtSwO95/miO5qchJfxIn7C UM77647i3EzVb/yj+6gbrNf6x1xuG5jAchU7Tyxq5B6EGMTOO7Wx9yQqJRy1NNDsetW+ 64InlgVSNBYSggqIsOaqJqbRhLgVeJr32kcbsFj1ucO6rs4gc/TOjdl+N4XAA0z0cgg1 Ouez2haxsT36vih4qRLOoUEgWRZT56hh0Volt0BvJw/zCUAlHjfbBGtmd9Jj88kCoVsT IQ9Q== X-Gm-Message-State: AJaThX5eJUzFLi8mY7dF2T4qmcoMBamjoxbIOhj61UpDDl0F1mrhfl87 kZh8x7v/BKQlMmd8+KtSpErRjQ== X-Received: by 10.101.90.8 with SMTP id y8mr8461115pgs.21.1512207444925; Sat, 02 Dec 2017 01:37:24 -0800 (PST) Received: from szxbz956.huaweiobz.com ([45.56.152.86]) by smtp.gmail.com with ESMTPSA id c28sm15961652pfe.69.2017.12.02.01.37.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Dec 2017 01:37:24 -0800 (PST) From: Heyi Guo To: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org Date: Sat, 2 Dec 2017 17:22:16 +0800 Message-Id: <1512206536-39536-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.2.windows.1 Subject: [edk2] [PATCH] MdeModulePkg/NvmExpressDxe: fix error status override 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: , Cc: Heyi Guo , Heyi Guo , Eric Dong , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Commit f6b139b added return status handling to PciIo->Mem.Write. However, the second status handling will override EFI_DEVICE_ERROR returned in this branch: // // Check the NVMe cmd execution result // if (Status != EFI_TIMEOUT) { if ((Cq->Sct == 0) && (Cq->Sc == 0)) { Status = EFI_SUCCESS; } else { Status = EFI_DEVICE_ERROR; ^^^^^^^^^^^^^^^^ Since PciIo->Mem.Write will probably return SUCCESS, it causes NvmExpressPassThru to return SUCCESS even when DEVICE_ERROR occurs. Callers of NvmExpressPassThru will then continue executing which may cause further unexpected results, e.g. DiscoverAllNamespaces couldn't break out the loop. So we add a | (bit-or) to combine the return status together. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Cc: Star Zeng Cc: Eric Dong --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Signed-off-by: Heyi Guo diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c index c33038f..2698b27 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c @@ -831,7 +831,7 @@ NvmExpressPassThru ( } Data = ReadUnaligned32 ((UINT32*)&Private->CqHdbl[QueueId]); - Status = PciIo->Mem.Write ( + Status |= PciIo->Mem.Write ( PciIo, EfiPciIoWidthUint32, NVME_BAR,