Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1474059pxb; Sat, 16 Oct 2021 10:50:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHFZFCTeOqj5KDs6B57b7ufV0vcbWD7nBV9ZGxzXskv8GPR0XyigZsTps++jc3A/KguvTW X-Received: by 2002:a17:906:1815:: with SMTP id v21mr16657403eje.218.1634406603846; Sat, 16 Oct 2021 10:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634406603; cv=none; d=google.com; s=arc-20160816; b=yzDupynKb7CYMEeBBxCBhb5/CbRfgo9e9jx0e71Wb0OD7VDS1dFl884aTBM2txMFUJ GfdicI1Jp6NFd7da9Rq4MTRbIUuq0o44USC0C/dmf5Iitc5OFCFLvv/HmrFHOtj+gfbo B2KunuKHCcB7MXldN/pN8aZPMOqSI+7xz2/Hd/e0m7XU8c9/33X4+pM1wIO6LLcH2M5m w/mPveUKlxeULaaESuMk5KFltkOTDzSSNcZoe2V7lge6ee3u6o+tcOUoKicIWkWK/RBN Eu0l6RJ4SuPEMJyfpDqOcc0/Pg8foIIWo9IUIhBJY3lbkz2HeqwbaouHCv9YLH6+y4Eu Tfqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tHENHhkpkZLornjDw8P+cbQvSFGcu3v2lE8jdyEkvRc=; b=PYDAcDdotiLZ5KZQaxtA+zfMf1ifZavoqaQspaP7sN1UE1HhjgXOs8WVG+i2NkeQK8 JUARgWisqQhfsptGFSYt5ITi6LFHvv084Itk9zjt0+P/riQ96BciWGyVobheLyNqfXVj 7S0F8R26tIelor5uZyTlpjrrd/Wa0s7v53R0FheEO0DUxFe2HeuHMOnCARz5CPC85xcF Bdqjmx34Tz3HLaWRNqNxckYZfKRv90L9H/oRskQMIAMZRa0pS+hAf4d80vmopix6c5Sq M244xwJtL2JHz9vm04NKLjISMZdgZUqB5hJsvkqTcyZO25iu1wTj8PdL/Wjq3//C8DvU p3cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jvM5FjUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si12862131ejc.441.2021.10.16.10.49.24; Sat, 16 Oct 2021 10:50:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jvM5FjUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240605AbhJOOsm (ORCPT + 99 others); Fri, 15 Oct 2021 10:48:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240919AbhJOOsa (ORCPT ); Fri, 15 Oct 2021 10:48:30 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 832E6C061570; Fri, 15 Oct 2021 07:46:24 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id pi19-20020a17090b1e5300b0019fdd3557d3so7409414pjb.5; Fri, 15 Oct 2021 07:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tHENHhkpkZLornjDw8P+cbQvSFGcu3v2lE8jdyEkvRc=; b=jvM5FjUOHTW4ZreWTNBrvcABxHTLtUwWgRZDjd0whn9aFrDhCENr73DWOHCxS5Fdkd qYr3Gcg+spaxksfjJrdlRHZsUccCng6zSdQRFt/mxs62ScyVAXmUaje7lK6uScfmUDsT lGbps+qki+QJGnSsqPGbnqpMb6m4fBQUHeHd/EswL3xnKPEESAf+zq58QLLatwmqqQXH n0zftEEaVPt+TW6yHN/5ySBqBmB/hW5lKXfPJr+DXYlPyb76LOjYCmNf5Q86iHIr4cN3 6dwSlsKu7/hPuTC2UYJ8NE6goJaJKxUeHJGcDJCi9Z2MR77/3lEPZ+2usS0Ix1qA5Y1T rUXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tHENHhkpkZLornjDw8P+cbQvSFGcu3v2lE8jdyEkvRc=; b=qFfiUnzVRxESQcSpYujY6SFwXaJWgatS+3Lv2gW164NZhpwSue1xGwUg6RZqBRwn9B 41Um819setErjcFFnFkSb/3F9IXEY8ShHxTfhLknnKNs9hHlvBEez5l2/xcJPiVj+EFG enYK0pAsATAoJjng11kaV2jcDX4Kt81w2rmucAwnciVvk92obn9DaV6g+j61b8fwUz86 21xP/Il71frj2Rgqhvi38MrBMm2r7oOkegEK9kBweO/XJ4RTdIoU68UpWm9TUkrd/c08 bYuECos/M9U1qr+Es9fblbn1gd+LaFkVsZmGfmwpWHuds0ts4G2iFi0gTzZIYb2gc0Z/ 6q4g== X-Gm-Message-State: AOAM530EManM6yrCgiDS1gTamUj4lm4Ar8+CMNPCK6K3DH0GndmrQa23 yTfw2BFYVmUEj8yGM4F2r8Q= X-Received: by 2002:a17:90a:4b4d:: with SMTP id o13mr28221614pjl.236.1634309183942; Fri, 15 Oct 2021 07:46:23 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:4806:9a51:7f4b:9b5c:337a]) by smtp.gmail.com with ESMTPSA id f18sm5293491pfa.60.2021.10.15.07.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:23 -0700 (PDT) From: Naveen Naidu To: bhelgaas@google.com Cc: Naveen Naidu , linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Russell Currey , "Oliver O'Halloran" , linuxppc-dev@lists.ozlabs.org (open list:PCI ENHANCED ERROR HANDLING (EEH) FOR POWERPC) Subject: [PATCH v2 19/24] PCI/DPC: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:09:00 +0530 Message-Id: <26d5188e961b91eca52b97f8d8107348538d1401.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An MMIO read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. Use RESPONSE_IS_PCI_ERROR() to check the response we get when we read data from hardware. This helps unify PCI error response checking and make error checks consistent and easier to find. Compile tested only. Signed-off-by: Naveen Naidu --- drivers/pci/pcie/dpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c index c556e7beafe3..561c44d9429c 100644 --- a/drivers/pci/pcie/dpc.c +++ b/drivers/pci/pcie/dpc.c @@ -79,7 +79,7 @@ static bool dpc_completed(struct pci_dev *pdev) u16 status; pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_STATUS, &status); - if ((status != 0xffff) && (status & PCI_EXP_DPC_STATUS_TRIGGER)) + if ((!RESPONSE_IS_PCI_ERROR(&status)) && (status & PCI_EXP_DPC_STATUS_TRIGGER)) return false; if (test_bit(PCI_DPC_RECOVERING, &pdev->priv_flags)) @@ -312,7 +312,7 @@ static irqreturn_t dpc_irq(int irq, void *context) pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status); - if (!(status & PCI_EXP_DPC_STATUS_INTERRUPT) || status == (u16)(~0)) + if (!(status & PCI_EXP_DPC_STATUS_INTERRUPT) || RESPONSE_IS_PCI_ERROR(&status)) return IRQ_NONE; pci_write_config_word(pdev, cap + PCI_EXP_DPC_STATUS, -- 2.25.1