From patchwork Fri Oct 15 14:38:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562139 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9FDAC433F5 for ; Fri, 15 Oct 2021 14:40:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9920061073 for ; Fri, 15 Oct 2021 14:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233133AbhJOOmm (ORCPT ); Fri, 15 Oct 2021 10:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232124AbhJOOml (ORCPT ); Fri, 15 Oct 2021 10:42:41 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AAA6C061570; Fri, 15 Oct 2021 07:40:35 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id e65so6405751pgc.5; Fri, 15 Oct 2021 07:40:35 -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=hguH+4h8WJZAQBX6bFk6OLcEE3ensFHbc7yyj62NPUU=; b=UZsKQuYMXgZnOPY6/63KM7U41g68pmtEWjrEE4tpt357waPxLydOwrnypYJEaKRGuo M42jcPkZuQiKIGmjB3Bf57gNRwXQk5LGwM0w+2D1NHkw8JI1nbuFaA96hEFQJY+3uWAo gjALKCDUKhbRgSXCU3D62aG1T45oBE5PivX0G34X+7990sxrTAKReDPSF+IvihVNttLD WHKI6bGHVpJ959fLrnmN34o94DpH1P4qnoaYYmhXjlfIRWqiSfJAZ0Z7ERFQHfvDIjE8 X56PjFySwjbeYg0KiA3GA2t+wI5v71ZRvNbKTE8v/VIofU3hsNTIUkDMvv7yDdBhTjUB TCbA== 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=hguH+4h8WJZAQBX6bFk6OLcEE3ensFHbc7yyj62NPUU=; b=vMjvBGUcvWbJk9PS5WkMZbjFnaSh/KDvAU7vXWj1+2Wrryoe3VqagZ7aiEIO7lABcf WRj2Dyz5XF7sbYi3QM7vvRPXxzbz72jaUNWBtnciO/P/QDLW3ixYojgppr2R9gWiUwFT F0Pzf/+PccEh/LSNeaqSU079neukNmHu2ysPLJX2VtvfIlrRMnfpfZSi8ZEmeRI5agkR XoazSdW5a5amhqCm4AwRM8d2BXSthr02Z1h53NQlO6IC2mUTP9UQoB/RtT7H1uJqTSsq NHuhowTcn3vv8GiS8DdyZbRpcABUGb/q3nIWlsDeSsQhpus42O4IPkHRi+k5YiIAPvCv fqfg== X-Gm-Message-State: AOAM532OZTVgzmGYTj3imMx8JR5sEuLeVCo6yDJ2YYDgGEKHZ47JDR6B IkpblPYFLQVHhKzieo+lT+z7hQDo04EfPPuP X-Google-Smtp-Source: ABdhPJwCXWgoqc04OqC3Fg9GRl74v/rvPzegKA4beG0/OZmUoAxuGOVBOx/Kgl4WgCs0NKvY8Oqaig== X-Received: by 2002:a63:cd09:: with SMTP id i9mr9644131pgg.129.1634308834766; Fri, 15 Oct 2021 07:40:34 -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.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:40:34 -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 Subject: [PATCH v2 03/24] PCI: Unify PCI error response checking Date: Fri, 15 Oct 2021 20:08:44 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 SET_PCI_ERROR_RESPONSE() to set the error response and RESPONSE_IS_PCI_ERROR() to check the error response during hardware read. These definitions make error checks consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/access.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pci/access.c b/drivers/pci/access.c index b3b2006ed1d2..03712866c818 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c @@ -417,10 +417,10 @@ int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val) ret = pci_read_config_word(dev, pci_pcie_cap(dev) + pos, val); /* * Reset *val to 0 if pci_read_config_word() fails, it may - * have been written as 0xFFFF if hardware error happens - * during pci_read_config_word(). + * have been written as 0xFFFF (PCI_ERROR_RESPONSE) if hardware error + * happens during pci_read_config_word(). */ - if (ret) + if (RESPONSE_IS_PCI_ERROR(val)) *val = 0; return ret; } @@ -452,10 +452,10 @@ int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val) ret = pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, val); /* * Reset *val to 0 if pci_read_config_dword() fails, it may - * have been written as 0xFFFFFFFF if hardware error happens - * during pci_read_config_dword(). + * have been written as 0xFFFFFFFF (PCI_ERROR_RESPONSE) if hardware + * error happens during pci_read_config_dword(). */ - if (ret) + if (RESPONSE_IS_PCI_ERROR(val)) *val = 0; return ret; } @@ -529,7 +529,7 @@ EXPORT_SYMBOL(pcie_capability_clear_and_set_dword); int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) { if (pci_dev_is_disconnected(dev)) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); @@ -539,7 +539,7 @@ EXPORT_SYMBOL(pci_read_config_byte); int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) { if (pci_dev_is_disconnected(dev)) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); @@ -550,7 +550,7 @@ int pci_read_config_dword(const struct pci_dev *dev, int where, u32 *val) { if (pci_dev_is_disconnected(dev)) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); From patchwork Fri Oct 15 14:38:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562141 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B281C433EF for ; Fri, 15 Oct 2021 14:41:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 358616120A for ; Fri, 15 Oct 2021 14:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235141AbhJOOnd (ORCPT ); Fri, 15 Oct 2021 10:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240569AbhJOOnJ (ORCPT ); Fri, 15 Oct 2021 10:43:09 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7928AC061570; Fri, 15 Oct 2021 07:41:03 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id s1so4709925plg.12; Fri, 15 Oct 2021 07:41:03 -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=bPWEij9k//B/evooKOYyCZIPd/p9FY3S9h0pgeJmYgg=; b=Km2uZRbeyHWl3vxa8aRDCInxBvpIiEO3AmVBHztRFk5ZgfFd9olaTl+rbmu/oydeHZ IHppOUEVjxxJAKHEUkTeol51wrxuZ/+gk1GvVDXnURGpLXtpzKXmvLKoe/ud9GKDAyJY yMG2uH8n6nvR39i1GvU3pAGyGjYQiRj/kql9GxDZmH+99/bzsytsRFc6JMjh4Hvdnqtn I0SjfHPWfnqyMn8ZmPaXDRb1FQmpMIcxcVZj3Pk8ucWVMt6H1NPJS+b/AI2g8ySsYJVb f4UYJnd895UJZ/T138mEoKyMJvpDePiztdDGdkWqs4bAT4w1sQVf26mBkq6kWxVDd88M J30A== 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=bPWEij9k//B/evooKOYyCZIPd/p9FY3S9h0pgeJmYgg=; b=2LbHODbylrvca+GboksU5Nx8ZkKw6bqYXFH1CFcTarz59Stm34vUA61TTyEe0J61dK cwvZpGdvqS4N5q2SuKES878llmy7xf6zep6HZ5SW8jB7WFuG+uopzNn3GYLIKiamaAw4 y6pjntgkJj0WUwyexiyW5g2d3wECxKYVOzrMWfovr/yf6QIrDih1ntoa0p1w1FPlvGSd a8ugox1zwK1wTQUCHw/0AKxyX7ukBE2YHuJ3mL4vxgG15F9fqf/gM1QVS1c2/WS7J5Mq Z7iUySzsPrfFFx+CDt535Tv4oYdVmsSjhPvcrhy38rUy8jgAZxNn9nmXqb41f6SOGZva T07w== X-Gm-Message-State: AOAM531VmfELhtkLINJPIGXJG9Bn2wbQAB7EvcFRU8/z8rnTKUIhpncS NT81M2Xu9P2C8MAZZBLCDNE= X-Google-Smtp-Source: ABdhPJyTJ3ugONhH6RB4ceOPoJUQ+a63FyARtrIhRgXhx4d18rG8SOm2ceSMB0F2tFyOUKh6jodFzg== X-Received: by 2002:a17:902:7c10:b0:13e:e11e:8d1c with SMTP id x16-20020a1709027c1000b0013ee11e8d1cmr11418268pll.55.1634308862978; Fri, 15 Oct 2021 07:41:02 -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.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:41:02 -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 Subject: [PATCH v2 04/24] PCI: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:45 +0530 Message-Id: <0114a4a44ceacfbd6a7859d8613ca5942f5b35d7.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu Reviewed-by: Rob Herring --- drivers/pci/access.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 03712866c818..37258af87b0e 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c @@ -83,10 +83,8 @@ int pci_generic_config_read(struct pci_bus *bus, unsigned int devfn, void __iomem *addr; addr = bus->ops->map_bus(bus, devfn, where); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } if (size == 1) *val = readb(addr); @@ -125,10 +123,8 @@ int pci_generic_config_read32(struct pci_bus *bus, unsigned int devfn, void __iomem *addr; addr = bus->ops->map_bus(bus, devfn, where & ~0x3); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } *val = readl(addr); From patchwork Fri Oct 15 14:38:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562143 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4F07C433F5 for ; Fri, 15 Oct 2021 14:42:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F373611C1 for ; Fri, 15 Oct 2021 14:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240622AbhJOOor (ORCPT ); Fri, 15 Oct 2021 10:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236502AbhJOOoh (ORCPT ); Fri, 15 Oct 2021 10:44:37 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F508C061570; Fri, 15 Oct 2021 07:42:30 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id e5-20020a17090a804500b001a116ad95caso1870684pjw.2; Fri, 15 Oct 2021 07:42:30 -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=wdvW0++TQSaLpnlhn3di6k88yfCHb1cy15TmRrFrgvg=; b=Q18vQqndGcurLweRXYc1rzDMAduk8Vh9PTeJJjtfKAvQvmRdB6pW9hy/672gEz9DsG z5BeuhxE2+leaaUsJWppbQwR+IC53u/d+AvdY5VDVi8dRRS4f+Ewdl6Hx6VnOK4c/n37 cE4NFm5dStTlASwg8E1aNNOpftWM0Y5KkWUXrhMtiyOA8PkoYuoTfqW3UjsBTjTVv7uJ QLFJn70tRncaKqPvEq8FlDvRzc5TaV+bleHI9gE6pSq8VOzYP2vIlc9OS+LAOy7zUT0F TUGfzErI2rpr6gOXaZwKxWMI5zTgPqMMmcTEnmDgAT6qQpWcvnbsx/QsuOW/JqzXApIq cJPA== 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=wdvW0++TQSaLpnlhn3di6k88yfCHb1cy15TmRrFrgvg=; b=XO9RYv4t9cxRFnZqvWU7/IoW1P/udGhHpxYDM8X9ukOXGct10I/FKDqPfeBRdgEQpW 9kBp9Gwe/4++EcSe65mVH2Jy9PTVD7zJvn2A3nmjpqooC1Oxduhel9onw9IBc4+LPUz7 HUg3smrQRC0SDseENcLAXM5gKzaQvyz5iHUgU6wApKDFC2NOO60Y+JoCC0cpGfrisTF2 IOW8hPXdLLKbmH8L0TmJrXPLRKjof2nP4Rs5s+sbtKcmlXkUeNmsQLk0QjZ/nEiBevoa n5Fj0pvz9II+KzbMWrEGMH/YWuU2NxlKuRl4mh9aHpsjZc1JRQaCRxBjDr2S3bhuFUq6 Fq8w== X-Gm-Message-State: AOAM530dj2TplGQGIAATJswnO1ORf0SLEoo14pLxT0IEE+TnDmyilw2l uNpWFRAGrX8xjU4TS7vjDIHLHGokfnGhc/e1 X-Google-Smtp-Source: ABdhPJxeQ84ojnBBZu2zIQtH1rovbyQgwZWEUn/qQwp5b8CaOXNo2u2bECDDMoMgvIu15OLAyskkig== X-Received: by 2002:a17:90b:1d0d:: with SMTP id on13mr17112610pjb.36.1634308949575; Fri, 15 Oct 2021 07:42:29 -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.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:42:29 -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, Robert Richter , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-arm-kernel@lists.infradead.org (moderated list:PCIE DRIVER FOR CAVIUM THUNDERX) Subject: [PATCH v2 05/24] PCI: thunder: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:46 +0530 Message-Id: <2d825f341b95c2fd91aa749a3901f9c0912a2372.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pci-thunder-ecam.c | 46 ++++++++--------------- drivers/pci/controller/pci-thunder-pem.c | 4 +- 2 files changed, 17 insertions(+), 33 deletions(-) diff --git a/drivers/pci/controller/pci-thunder-ecam.c b/drivers/pci/controller/pci-thunder-ecam.c index ffd84656544f..a95bb58afd52 100644 --- a/drivers/pci/controller/pci-thunder-ecam.c +++ b/drivers/pci/controller/pci-thunder-ecam.c @@ -41,10 +41,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, } if (where_a == 0x4) { addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */ - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } + v = readl(addr); v &= ~0xf; v |= 2; /* EA entry-1. Base-L */ @@ -56,10 +55,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, u32 barl_rb; addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */ - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } + barl_orig = readl(addr + 0); writel(0xffffffff, addr + 0); barl_rb = readl(addr + 0); @@ -72,10 +70,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, } if (where_a == 0xc) { addr = bus->ops->map_bus(bus, devfn, bar + 4); /* BAR 1 */ - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } + v = readl(addr); /* EA entry-3. Base-H */ set_val(v, where, size, val); return PCIBIOS_SUCCESSFUL; @@ -104,10 +101,8 @@ static int thunder_ecam_p2_config_read(struct pci_bus *bus, unsigned int devfn, } addr = bus->ops->map_bus(bus, devfn, where_a); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } v = readl(addr); @@ -135,10 +130,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, int where_a = where & ~3; addr = bus->ops->map_bus(bus, devfn, 0xc); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } v = readl(addr); @@ -146,10 +139,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, cfg_type = (v >> 16) & 0x7f; addr = bus->ops->map_bus(bus, devfn, 8); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } class_rev = readl(addr); if (class_rev == 0xffffffff) @@ -176,10 +167,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, } addr = bus->ops->map_bus(bus, devfn, 0); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } vendor_device = readl(addr); if (vendor_device == 0xffffffff) @@ -196,10 +185,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, bool is_tns = (vendor_device == 0xa01f177d); addr = bus->ops->map_bus(bus, devfn, 0x70); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } + /* E_CAP */ v = readl(addr); has_msix = (v & 0xff00) != 0; @@ -211,10 +199,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, } if (where_a == 0xb0) { addr = bus->ops->map_bus(bus, devfn, where_a); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } + v = readl(addr); if (v & 0xff00) pr_err("Bad MSIX cap header: %08x\n", v); @@ -268,10 +255,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, if (where_a == 0x70) { addr = bus->ops->map_bus(bus, devfn, where_a); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } + v = readl(addr); if (v & 0xff00) pr_err("Bad PCIe cap header: %08x\n", v); diff --git a/drivers/pci/controller/pci-thunder-pem.c b/drivers/pci/controller/pci-thunder-pem.c index 0660b9da204f..06a9855cb431 100644 --- a/drivers/pci/controller/pci-thunder-pem.c +++ b/drivers/pci/controller/pci-thunder-pem.c @@ -41,10 +41,8 @@ static int thunder_pem_bridge_read(struct pci_bus *bus, unsigned int devfn, struct pci_config_window *cfg = bus->sysdata; struct thunder_pem_pci *pem_pci = (struct thunder_pem_pci *)cfg->priv; - if (devfn != 0 || where >= 2048) { - *val = ~0; + if (devfn != 0 || where >= 2048) return PCIBIOS_DEVICE_NOT_FOUND; - } /* * 32-bit accesses only. Write the address to the low order From patchwork Fri Oct 15 14:38:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562151 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA66EC433F5 for ; Fri, 15 Oct 2021 14:43:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DD1561041 for ; Fri, 15 Oct 2021 14:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237195AbhJOOpR (ORCPT ); Fri, 15 Oct 2021 10:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236502AbhJOOpR (ORCPT ); Fri, 15 Oct 2021 10:45:17 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5A18C061570; Fri, 15 Oct 2021 07:43:10 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id s1so4713247plg.12; Fri, 15 Oct 2021 07:43:10 -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=r3o5gBqF0m60j/685v1gCV+85CWmYdPsbI4M53MCV74=; b=i6fqth5uZU8VCAy4RPMnbl7AIp+Tdvs11/vzA7yll5FwjxTWdkRv88xIyhz0rk2t9u d4AiJSDP9CeHws6FKjuMBjxyhe3oEKOlHBeRvXqqSONxYvGaf/uu/y8kCDk7Z6bc4uW5 WrvJWL+UYcG1TwCL22/zI+7Y27VKBRtvBou8+Mxw+Buv+EtieEQ5ZlJLDA+ryKzQv7tM GVcKbxBrGR/WZOyeKmiDwtFpl0kCPqLy5BzU+2dkv32Q9ciLg3lI1SEDECWR9dA4q9Vb t3SUiEXFtf2kXoqI+thdO7iaXuabp1MfEWNiLcGvQ84iWwAbAw22BL5ZTmVth5ZnWwiD qTUA== 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=r3o5gBqF0m60j/685v1gCV+85CWmYdPsbI4M53MCV74=; b=XlHOkX0/dW2yD4DsMQYYOjMSL6MMfqvRjh38xyYu/M0dnOff5rzr6W/QzIDxTtxZWx 9WrEeyVdQwj5hRz/XYIqfQtyUN47VszFlwT22+HFVE7N9jdZtEwdV2YAeNIWxIgwOM6v QbHrEpmQVNrpCLXVXcW7CWHkIUrB7JS/X0P8S+6TZPfQIX74IdAwwWqDUfvWYUorTLAI MOrcKvvYQRwvo9nRrDSHwmJG+tHPiqkGzfUYHUu2sexguA5gHvMZB5K/heNlwCvLRXnP EoCKimvrqWmrtNIj4KCTisNbXMOIAyPKGej34MaBr3b245yZLj2nINlagqvjK/FJiCth jxTA== X-Gm-Message-State: AOAM531XfkJUhtiHwH4s2anFzceHQvC/0CwQYmSvfgfTIbdf/GqHRxIG M6jKJdfteiX0p1lwn2MNg+c= X-Google-Smtp-Source: ABdhPJzkMtVHGIdaTQNm5//+Jby5D/TcsxlUwCEhyb9oKSRH7DSUsXLOHVItXyEfjnr7nGsywbcjyw== X-Received: by 2002:a17:90b:390d:: with SMTP id ob13mr13887102pjb.49.1634308990354; Fri, 15 Oct 2021 07:43:10 -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.43.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:43:09 -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, Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM IPROC ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM IPROC ARM ARCHITECTURE) Subject: [PATCH v2 06/24] PCI: iproc: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:47 +0530 Message-Id: <71757601a719e2ff6ca27615183e322a7709ff65.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pcie-iproc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c index 30ac5fbefbbf..e3d86416a4fb 100644 --- a/drivers/pci/controller/pcie-iproc.c +++ b/drivers/pci/controller/pcie-iproc.c @@ -659,10 +659,8 @@ static int iproc_pci_raw_config_read32(struct iproc_pcie *pcie, void __iomem *addr; addr = iproc_pcie_map_cfg_bus(pcie, 0, devfn, where & ~0x3); - if (!addr) { - *val = ~0; + if (!addr) return PCIBIOS_DEVICE_NOT_FOUND; - } *val = readl(addr); From patchwork Fri Oct 15 14:38:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562153 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D98CC433F5 for ; Fri, 15 Oct 2021 14:43:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAE06611C1 for ; Fri, 15 Oct 2021 14:43:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240535AbhJOOpb (ORCPT ); Fri, 15 Oct 2021 10:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236502AbhJOOpb (ORCPT ); Fri, 15 Oct 2021 10:45:31 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB711C061762; Fri, 15 Oct 2021 07:43:24 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id s136so5566766pgs.4; Fri, 15 Oct 2021 07:43: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=E2kMW7De0WUTFR8R6pbmw+v+DfoEFjJfFZEPmx6TpIo=; b=eMtI6REOFWix9KtW5tFZKnYJASMZfWRLSZnk5Z3YHrAZfJHAzvFnr8ylXwPFqc2a/a sSZ8UvQq1tqytMA7xvcnnsiLWefZHtOIvyR4w48y0+/FL2UKgIHln+v2qE2m/w+JTFM1 5/mXXW1NrvfbNEM0Kxme6uJJEBTs38ZYlbTHW6Re7rHSajvVurS8Uq1V2v4NCeWCfPhp 0AMJSPYYm2sBLxJatPIFmiVJT/Oh5NHr53JmOewoMKlOnjkfBC7TBlY4MypeOeGa17pJ HGEAOs0d5LPR7Euvw8ZGAQvAt0r8Wbzm43Xw5FKSEaUKTN3vn6bLTxu6DfAsFds4nbK0 6Xag== 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=E2kMW7De0WUTFR8R6pbmw+v+DfoEFjJfFZEPmx6TpIo=; b=abcCKJ862rC3oxYZKPlpeogY3LHRU2KmvCQ5GGuOznL8frk1aDYPY8ctqrhDw73leE tVWdevuXeDkFRlasrJWbyw/kDJWltmM4z9fV4xMg4OI0652Vnmel++1w+a0hV1i6yyFn Rvk/mvJ0ofnbeX2ksOSNV6bGT2y6oHwIXXWdYC2ZhqSra5tozFF06JwG0T7Zp4HAJSd+ eWdiA69B6gctj8MbHPPWvirwmWxUBpT+Ohl31Ew5GMMWm1hWjRJyeFxZb36sVu5gJOPp prYzXyZrE7qQegIFuzzY6MzKSVBdmTtcNWmkY7RTPBhVv9C5d+4CmblLJVTVmYBAsNnC 8N7w== X-Gm-Message-State: AOAM532jijJFWIhQjl/h+0JJ2/K0XYOWnsAaKu4oatljkZreCYF4/cS4 z74ulerp4HXtCjUeZILsPtE= X-Google-Smtp-Source: ABdhPJznv5Me0M33f8HkD/iBEPi7jNhXlMeZY3pyG0z8AuGV93euaOSAW3r29nVl5vtoWE0qzOFOmg== X-Received: by 2002:a62:2f81:0:b0:44b:b390:956b with SMTP id v123-20020a622f81000000b0044bb390956bmr12110659pfv.30.1634309004189; Fri, 15 Oct 2021 07:43:24 -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.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:43: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, Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Matthias Brugger , linux-mediatek@lists.infradead.org (open list:PCIE DRIVER FOR MEDIATEK), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v2 07/24] PCI: mediatek: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:48 +0530 Message-Id: <4aa74ccd31c42b108b61f2ad274bae59a1d25114.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pcie-mediatek.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index 2f3f974977a3..a19f8ec5d392 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -365,19 +365,12 @@ static int mtk_pcie_config_read(struct pci_bus *bus, unsigned int devfn, { struct mtk_pcie_port *port; u32 bn = bus->number; - int ret; port = mtk_pcie_find_port(bus, devfn); - if (!port) { - *val = ~0; + if (!port) return PCIBIOS_DEVICE_NOT_FOUND; - } - - ret = mtk_pcie_hw_rd_cfg(port, bn, devfn, where, size, val); - if (ret) - *val = ~0; - return ret; + return mtk_pcie_hw_rd_cfg(port, bn, devfn, where, size, val); } static int mtk_pcie_config_write(struct pci_bus *bus, unsigned int devfn, From patchwork Fri Oct 15 14:38:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562155 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CA41C433F5 for ; Fri, 15 Oct 2021 14:44:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 040F56121E for ; Fri, 15 Oct 2021 14:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240643AbhJOOqM (ORCPT ); Fri, 15 Oct 2021 10:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240633AbhJOOqJ (ORCPT ); Fri, 15 Oct 2021 10:46:09 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACAD2C061762; Fri, 15 Oct 2021 07:44:02 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id d13-20020a17090ad3cd00b0019e746f7bd4so9521546pjw.0; Fri, 15 Oct 2021 07:44:02 -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=MJKYZ0DmEpP1c+Cyc4zstBHahVie6foEwa+j6qM9UhA=; b=PB5yktV/ub7HqC20LufS0j08yKPnVALPVgzyvDwsxvrVrVcQixB/EB6YPc+JIMu+ar yoENAo4stX/Y6X2yBLrRWo9YWjJo+AQ/CGhVh88rXCrlyusLG8mADi0TLW37tnEKWKXV ZDZPwyHP+DjuY+La534/Rdb5RXEzZbdjDEIm+dCCMLyFbDYkAIgwBL5eMIPKLynktEv+ MdPiMm9RTNI6/inp3ScRrGDXxmyNbkqwmS+l0+X2OrlW716XPJ1Hjxx7rdbjEFzyAwk9 HI20wPgr7JmeLpb5drVfenrAS1th9QPRhhpk/XKcsO9mRK0pM5FXtTrqOBdZAKk1cSjy tm1A== 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=MJKYZ0DmEpP1c+Cyc4zstBHahVie6foEwa+j6qM9UhA=; b=sXYq5jAEG1uPt0p3VPm6eJ/7OokPp/agOpPud5D1eY/21gQVPTxAJZiRc0ISfRpW6I Q4SXrNyZ8Cd8rwvcSo/R7sZN7upyR5+UYJt20hpYdqU1lQRC4qJ9C0Ixtj5+YEqMBFkr mX+6CrUKOLjoswoYNLJVyG2OXeg8emBIgZs5ehHsjBLseU8zEytFFMZ/f2a/1+9YWQz0 NIKhbnb0+T7/Gf3f0L+EFjAlAZ4EX/uKZerMg08KDNsIW9p7fdHXnp/rB94eXMKYH72j ESmmTVh7kA0bjd92fjvVVNQzbRqme3lCDVAebHUPh+4F4MpI/GNbn7D59Bo/mTPV7Yw5 i48w== X-Gm-Message-State: AOAM531PNFXw8/te6ZTN77QolRK/BfqYVDUL2s6wyFQ3zi+WEat9vEmI e9opM/j0lQQMujulZR/sz48= X-Google-Smtp-Source: ABdhPJwFF4cjJO6JehPcfRawKHCZyqAMPX+66Ii/ds5YGW7OM7k+bLu2mTJzx+lW8crVIAUkT/oqmg== X-Received: by 2002:a17:90b:1644:: with SMTP id il4mr28408623pjb.179.1634309042196; Fri, 15 Oct 2021 07:44:02 -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.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:44:01 -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, Jingoo Han , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org (moderated list:PCI DRIVER FOR SAMSUNG EXYNOS), linux-samsung-soc@vger.kernel.org (open list:PCI DRIVER FOR SAMSUNG EXYNOS) Subject: [PATCH v2 08/24] PCI: exynos: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:49 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/dwc/pci-exynos.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c index c24dab383654..f9526d6de160 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -216,10 +216,8 @@ static int exynos_pcie_rd_own_conf(struct pci_bus *bus, unsigned int devfn, { struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata); - if (PCI_SLOT(devfn)) { - *val = ~0; + if (PCI_SLOT(devfn)) return PCIBIOS_DEVICE_NOT_FOUND; - } *val = dw_pcie_read_dbi(pci, where, size); return PCIBIOS_SUCCESSFUL; From patchwork Fri Oct 15 14:38:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562157 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8389DC433F5 for ; Fri, 15 Oct 2021 14:44:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61A85611C3 for ; Fri, 15 Oct 2021 14:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240633AbhJOOqW (ORCPT ); Fri, 15 Oct 2021 10:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbhJOOqV (ORCPT ); Fri, 15 Oct 2021 10:46:21 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31AB3C061570; Fri, 15 Oct 2021 07:44:15 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id m26so8556643pff.3; Fri, 15 Oct 2021 07:44:15 -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=FA4eEA0vKwb58YOkbLP9K2NVmJYtwGLqPjb+iaCxg5k=; b=WRjdWN38D6pmIz2/eZS7kZpgxON4LRg1nj1/L5q1P46XY1xU9gmCLz7v3Z1dom5rzl +WQEdkj/O22XjHY6DAWhTFUhRU12KIbbRjefhHurp4DhcVlL1TlElgkS5Gx2fgUw9t4Q hQS9VLRLx+DJvw/Agp6G1JvNmT43lWpoGtuhQoy5cAw9KDLRNtAlP99Z4ETNvMHBD9Hg vc30U0TeuXD+spXiWoWOiGWeFjPKGiPZvriG3s9bNY6Tn1A/NWF0/tkrQJxAuxAc+Le9 oemYmYUCjs51o8j/mNARaXeUstnlx3pDVfKdltZbHEuJLjmub2e6DdPdVYBnDdLBhA1Q zeIA== 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=FA4eEA0vKwb58YOkbLP9K2NVmJYtwGLqPjb+iaCxg5k=; b=ovROcr4uo+WR83wAVJCdNGJ/4jRhxaPCwzDZb0huGqLMH/Agtj8oRiAxN9n8cmPp8j ov4sjJk6uPr7j9lXv280QDolUm/1wYmPvg/FqKt9fnRfWiIvyZcUHDD38gP7TPQ4Mzs2 9dP0LNi1vmXXyeZQJk90k6Ry6XVO5qSpD4ek9aBam2AGMR/jeyNAXCaV6fD5GmK6n5Zh Joy1S+In3pZ4W3yPHASijv+VaU6UpejJjamu5VeLVh3SrhBb4ZYiPCIfAQIfC9+D67nW A2+Fso7urSw7rUq0Mcla+plm4G0KqWV9sSS5eiUsgJkXx0FqbzyMAh9jRCK4msOFwFmg Cc/g== X-Gm-Message-State: AOAM533jFrnPz81cJoL8Sl/UZ+vqbXIJXVkchNUAPgqvBXYSf2//uss0 Bbv8zswqQfyZJV+vedhq3Mw= X-Google-Smtp-Source: ABdhPJy9gAeFO1KCBbB9jEMGT9fOvRLbnY90aYjBiUI8stEFqE4IDvUss1uiWo/zNMza2tzsWujscQ== X-Received: by 2002:a63:e243:: with SMTP id y3mr9615900pgj.101.1634309054683; Fri, 15 Oct 2021 07:44:14 -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.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:44:14 -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, Shawn Guo , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Subject: [PATCH v2 09/24] PCI: histb: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:50 +0530 Message-Id: <42d789c39ff42b123f67f330e6e15ce26047ea3c.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/dwc/pcie-histb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c index 86f9d16c50d7..410555dccb6d 100644 --- a/drivers/pci/controller/dwc/pcie-histb.c +++ b/drivers/pci/controller/dwc/pcie-histb.c @@ -127,10 +127,8 @@ static int histb_pcie_rd_own_conf(struct pci_bus *bus, unsigned int devfn, { struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata); - if (PCI_SLOT(devfn)) { - *val = ~0; + if (PCI_SLOT(devfn)) return PCIBIOS_DEVICE_NOT_FOUND; - } *val = dw_pcie_read_dbi(pci, where, size); return PCIBIOS_SUCCESSFUL; From patchwork Fri Oct 15 14:38:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562159 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BDBC433EF for ; Fri, 15 Oct 2021 14:44:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 264C561216 for ; Fri, 15 Oct 2021 14:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240641AbhJOOq0 (ORCPT ); Fri, 15 Oct 2021 10:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbhJOOq0 (ORCPT ); Fri, 15 Oct 2021 10:46:26 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFD8EC061570; Fri, 15 Oct 2021 07:44:19 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id ls14-20020a17090b350e00b001a00e2251c8so7410207pjb.4; Fri, 15 Oct 2021 07:44:19 -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=ldCoPF9oxZH7/MigxipjFPAj1P91oCyhQC/cTDGjKcc=; b=OouScJo8ja/pvkJtRdlEZQtihBai8aqlCVtV47g3ith2pLVFv5EggIkWjSQWXjBLiy bR69cFniJIc7JI+EN7zvxDMqjH/wbKmOYW1/ir5pvriC6V7njh5I9OPvIL5ioktJbzlH nzNOREwfyuzcCPSkEHB4vY+kVvH7aeG7MGiC2upZxQeYtJTrT8INkJbYhzm7x1JqU0AU +c9lMyAhN1HtAvEnyk0sKpqvlJ1PaVFxM+6hK6+INVKviS7s5nUuKJDLMOvqhDq0rM2x N9kHtFZgO1ChtjMAz4XLU1nM0VZHmvwZURWHw8W3/8YdPGAI8H2MOo69KwX0vCgytfH3 G5dg== 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=ldCoPF9oxZH7/MigxipjFPAj1P91oCyhQC/cTDGjKcc=; b=zeAMN6Iz2DllqtHnWWRMB3hQK0hftYdY2nX/xyP8XNTSSeizmaYIQ8pwnr0Wa8RGvS vG2DzoVaqt9LHKMvxyfdNmywn7Q0Kzut7GSnRjDL0Kby8Qm0z6wr07i3gn7RjXd49Kzs q8zsEZH07913pGiXoIzXCIZ73gN5ID40QSAJSgqjzRSnJKPzbbdCTSNGXfEJH/LQB51v Aup2ueRSW4B4D9y8cutydXsTk2hJ2GLFYtuBlQHsXAJ+h4M1B1buxMst8IXbtX8UXf9R TfZtwxYvS5UPEiSnO+0hNaAcA+NyGAJJtxQdsuMaXAhmCHPAWaND5vgQbwRYrSJ4jxLH 7mXw== X-Gm-Message-State: AOAM532PtjGlAn4H/wLsskOIwWt+wyZrEXXK3yNbcAOSR9gFt8dg+W/T gAPykx+ggmtlCi19OlIbENA= X-Google-Smtp-Source: ABdhPJylYSfUH39Cu58cA3v3pK4Gdo2oUhIIxs2gB4VD/e/TOz3AGlV3Zo1+dcCeHy8mhbkvVa2lDA== X-Received: by 2002:a17:90a:e7c8:: with SMTP id kb8mr13809594pjb.95.1634309059387; Fri, 15 Oct 2021 07:44:19 -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.44.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:44:19 -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, Xiaowei Song , Binghui Wang , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Subject: [PATCH v2 10/24] PCI: kirin: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:51 +0530 Message-Id: <9ccf6dd66a61b3889eddb36b0713ad5d65bf4744.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/dwc/pcie-kirin.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index 026fd1e42a55..56ccc5ceee50 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -330,10 +330,8 @@ static int kirin_pcie_rd_own_conf(struct pci_bus *bus, unsigned int devfn, { struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata); - if (PCI_SLOT(devfn)) { - *val = ~0; + if (PCI_SLOT(devfn)) return PCIBIOS_DEVICE_NOT_FOUND; - } *val = dw_pcie_read_dbi(pci, where, size); return PCIBIOS_SUCCESSFUL; From patchwork Fri Oct 15 14:38:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562161 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5AB9C433EF for ; Fri, 15 Oct 2021 14:44:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF096611C1 for ; Fri, 15 Oct 2021 14:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240654AbhJOOqd (ORCPT ); Fri, 15 Oct 2021 10:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240659AbhJOOqb (ORCPT ); Fri, 15 Oct 2021 10:46:31 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7164AC061570; Fri, 15 Oct 2021 07:44:25 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id lk8-20020a17090b33c800b001a0a284fcc2so9502942pjb.2; Fri, 15 Oct 2021 07:44:25 -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=3zEq2AfHmzmiP6iMn6OVsjvfYEnKpi8akIlRzP+t4I8=; b=dyAZT/p0dT9PasizXG2QMLWP9+YuqIWP99M5ACtaPFSadZhI9m8GHHkk/R4W7hP/5M +DNZp8rf5DzYFVHmNz6KFZCw4c7mbbAj9hvFDbEd6rifpLj/XHlbJ0t3iEx/Vi7lia6o wtxQwipx6zSrA3RauqaZM5GjsrkJaKrFH4zW4tv7gjYRhV4ePeatlUr2d64wt1+IrTwK MPtfpVvhV3iipgHqHHOOLXFg34TM8uHMn4KHgb96uTeftw23YinyaP+JWZ+3IjI3XLpI iy2mvee0AmgSDet/bU1TeLGQTGO9upb3jd6JhLmmLfN/I7jqkB7U/URY0+iLAe57JUY7 Du6g== 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=3zEq2AfHmzmiP6iMn6OVsjvfYEnKpi8akIlRzP+t4I8=; b=iGk2N68NAlAEty/YU568gK4qq61y/3G/v4ufeppvA3/83Z3uwsOvMSGwOyckI+cgeC 674DBSGpXM3KDTmAOyk7reEfZjZ22Kai4bCvyMzn7sO+UpHy0b+sV15Hc8hAu5AHk+GW my6kSUzuXjXX5j5BQKVdEK/SlNLu97OUWfg9G/eX6+OMEClTTLw5EijyV8/XuKlsnHOt 7sLH03Xm3pyf4DANYqw+d/nOd62KiaiBaB0RJHYr9GUs/YFORGPq9rT3ASuLtRcP/y0X z/p4GS1wIDDAXC5HzyZNz6IRKLkAFW8ZHzzpk+1GvJuJynf4OlfZP3IskDvrq5++7P0g zUdQ== X-Gm-Message-State: AOAM532DLMHNG9hD7Pt90KcJ8V7bkYV0fa1esRbpVdLUTaLUYa4LXiuT BcDiPhvJCXawDHeAnCy48p65XALHHpPO61Yo X-Google-Smtp-Source: ABdhPJwN5vVjjcYaPoWE1cazSNXn7TZ2gWNzDqGt6lze4Za97JUo8BXigAYTP3PVi53Z4LxVs6VtIQ== X-Received: by 2002:a17:90a:191a:: with SMTP id 26mr28519019pjg.118.1634309064982; Fri, 15 Oct 2021 07:44:24 -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.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:44:24 -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, Thomas Petazzoni , =?utf-8?q?Pali_Roh=C3=A1r?= , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-arm-kernel@lists.infradead.org (moderated list:PCI DRIVER FOR AARDVARK (Marvell Armada 3700)) Subject: [PATCH v2 11/24] PCI: aardvark: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:52 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pci-aardvark.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 596ebcfcc82d..1af772c76d06 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -893,10 +893,8 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, u32 reg; int ret; - if (!advk_pcie_valid_device(pcie, bus, devfn)) { - *val = 0xffffffff; + if (!advk_pcie_valid_device(pcie, bus, devfn)) return PCIBIOS_DEVICE_NOT_FOUND; - } if (pci_is_root_bus(bus)) return pci_bridge_emul_conf_read(&pcie->bridge, where, @@ -920,7 +918,6 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, *val = CFG_RD_CRS_VAL; return PCIBIOS_SUCCESSFUL; } - *val = 0xffffffff; return PCIBIOS_SET_FAILED; } @@ -955,16 +952,13 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, *val = CFG_RD_CRS_VAL; return PCIBIOS_SUCCESSFUL; } - *val = 0xffffffff; return PCIBIOS_SET_FAILED; } /* Check PIO status and get the read result */ ret = advk_pcie_check_pio_status(pcie, allow_crs, val); - if (ret < 0) { - *val = 0xffffffff; + if (ret < 0) return PCIBIOS_SET_FAILED; - } if (size == 1) *val = (*val >> (8 * (where & 3))) & 0xff; From patchwork Fri Oct 15 14:38:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562163 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF220C433EF for ; Fri, 15 Oct 2021 14:45:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4C8461041 for ; Fri, 15 Oct 2021 14:45:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235357AbhJOOrS (ORCPT ); Fri, 15 Oct 2021 10:47:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240680AbhJOOrQ (ORCPT ); Fri, 15 Oct 2021 10:47:16 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0972C061765; Fri, 15 Oct 2021 07:45:09 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id g13-20020a17090a3c8d00b00196286963b9so9492091pjc.3; Fri, 15 Oct 2021 07:45:09 -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=j6PFmrQZfsZKbN43caoyPHUp+nOh1/rI/bPUZ2uC0hc=; b=nGikGQ9yK7YQbbTiDAZTKAQWSsgNQckh4RY8XQhGoaHkcigKBYQY2KHF0qvQic/nLu HfVplvAxNgmCVh7h2rARubH+bh3ouSbu9d5OxLS0JXDzPEoEc/IVvBaRDS9cVuRMi8O/ ZHXXxMQ81BZpguTrosbAkvo/7HdvmNco2zoCXMSBHRImbrj/B+/P0Xd3xa5bxW+8Tuhc dpjlahkygD3lnVFrzemLItYDD9cWMY5OSbTo9ySaULEcDvkUXAyYLkdU1KWIP1Y8qJeO ytsG1qXrrCK/WmotzKXOHUMtVGbcHnWebuTQWggz99VPx8/Qx7fuLdjSggU/4SjRL7nR 2hwg== 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=j6PFmrQZfsZKbN43caoyPHUp+nOh1/rI/bPUZ2uC0hc=; b=krPHEVvQBCnkucqqoOPO6FWckEQWAHN302sFngo4fkt9vg7STfYCL5tR++NoouOj/v A3R3b6GtF5LR1+vfQ4sLd6yB5a7G5TDQ23Cp7nxGVr66Bfjmcid1kkIrnp4qLMkaEejK UZfCWYNEwNdyJDTjXCNCy+rVZEtBKZ2zOkDxbv7aLhAeMQpnq7gEZRGBg9m/HmSEkifr ImaA0i++81KH+riW/kiZBp9J4YeZ/j9G3mNNqMnEHOgg+rY0+Wtqsk8fd3s6pxOD6F6s tbkL4YEKLlMv3yzrZrO72guwgfsByBu2mkiBZ213+uu6TQ52yEp//xHGlIO9iOosycaU 9AfQ== X-Gm-Message-State: AOAM530OyfkHs3dazKr4n3pXqnxddst/GiTInnKyO3gmgOv2nieD0MZR ZFKfrUCgQFVBeN6awubGbQyeeXW1tilp17pc X-Google-Smtp-Source: ABdhPJzHSLLbZkANpEOmJJt9ZjgNl/FuqEkna0HiGHGREYtwtMfcmNXWKWFJV4RAIPngKcmcRn/n6g== X-Received: by 2002:a17:90a:e552:: with SMTP id ei18mr28228052pjb.239.1634309109171; Fri, 15 Oct 2021 07:45:09 -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.45.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:45:08 -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, linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Subject: [PATCH v2 12/24] PCI: mvebu: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:53 +0530 Message-Id: <3d1ade234a33d6140497b396ca6d02eba06ba235.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pci-mvebu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index ed13e81cd691..70a96af8cd2f 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -653,20 +653,16 @@ static int mvebu_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, int ret; port = mvebu_pcie_find_port(pcie, bus, devfn); - if (!port) { - *val = 0xffffffff; + if (!port) return PCIBIOS_DEVICE_NOT_FOUND; - } /* Access the emulated PCI-to-PCI bridge */ if (bus->number == 0) return pci_bridge_emul_conf_read(&port->bridge, where, size, val); - if (!mvebu_pcie_link_up(port)) { - *val = 0xffffffff; + if (!mvebu_pcie_link_up(port)) return PCIBIOS_DEVICE_NOT_FOUND; - } /* Access the real PCIe interface */ ret = mvebu_pcie_hw_rd_conf(port, bus, devfn, From patchwork Fri Oct 15 14:38:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562165 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53749C433F5 for ; Fri, 15 Oct 2021 14:45:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3735D61041 for ; Fri, 15 Oct 2021 14:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240689AbhJOOrX (ORCPT ); Fri, 15 Oct 2021 10:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240681AbhJOOrW (ORCPT ); Fri, 15 Oct 2021 10:47:22 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6916EC061764; Fri, 15 Oct 2021 07:45:16 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id f5so8792711pgc.12; Fri, 15 Oct 2021 07:45:16 -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=oxis35XdZSIgJr6mklaAXMEQHUEVDMfz+GZuoz2m4I8=; b=bHF3MVmMD4KZ3VipJ6gbsgTAs58lBf7KZekNmTmtHSVziT8Bj5Q4nj6WoGR4JJh1X9 ptoYV/uKzVs7KLN79M4K1dzreOtUNb3OmhKFeQMusup3PG8bmgu8CiNw3FPEYJaSgecw F5KNxdHmHmbQmrDwWHdIJMc7EQMypxSo+ZckstpfprL10QAqD5Wu4hVtllulE6qOjIsU Gre2jphM64b+ETzcdr5HAuHIgCP1bUlletjTOtO96cvW+D60ab9ERHcl8PWksUIWxawH WdMcMIrisLQeK8YuWhXYZGSySNUvCWKsXceWP6SViEtyTw1woJ5paAWojSijJnSA54OM FpUA== 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=oxis35XdZSIgJr6mklaAXMEQHUEVDMfz+GZuoz2m4I8=; b=J9tnTqElRf49xt2KiCAWCSocULQy6ihZtjRmkkndM3TvpsPB/USr5zzzvVAfnm1BaR vraTa58kT91qa39Jg93jLU+ks6elBKoFap3jQRGGlpyyQknaPoz0H4i8XSIBk4qhDMLY dOLeFRgdvZoSogLEtRCvWdgmAhRyuSZZbiOTF+AxTjM/y+L+wMr4ubmR89yysC4gXa+k i/Gg64pNE7yoZqmeII4TlvHsmdGqyyDxJB5gvSHdntt+FzLdlIaJZvK50cAOcOmMyssk G89UeVjT54d/oqLh1SKg3wysAJvi2A7iL8mBAgQdj1QYyDWvPCuzUTU9eer0B6334D6D Qang== X-Gm-Message-State: AOAM532FBJ2wEYhbN1fpUpHMiBuimZcmJSKlkLj1PwPmvY/0UdtIMbch PMZKPlFUYGgUwUGZlBVj4Yg= X-Google-Smtp-Source: ABdhPJyRQZ0uhDDsgFuUWNaw1Mmhj5b/guuZItbpnQb9Eb1O9szMMGggSfvh5Z8HkGi9Z+VXPCBt6g== X-Received: by 2002:a63:f346:: with SMTP id t6mr9505513pgj.345.1634309115853; Fri, 15 Oct 2021 07:45:15 -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.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:45:15 -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, Joyce Ooi , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Subject: [PATCH v2 13/24] PCI: altera: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:54 +0530 Message-Id: <178022540498862f4d16e5738b5d5c1fac008afe.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pcie-altera.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c index 2513e9363236..a6bdf9aff833 100644 --- a/drivers/pci/controller/pcie-altera.c +++ b/drivers/pci/controller/pcie-altera.c @@ -510,10 +510,8 @@ static int altera_pcie_cfg_read(struct pci_bus *bus, unsigned int devfn, if (altera_pcie_hide_rc_bar(bus, devfn, where)) return PCIBIOS_BAD_REGISTER_NUMBER; - if (!altera_pcie_valid_device(pcie, bus, PCI_SLOT(devfn))) { - *value = 0xffffffff; + if (!altera_pcie_valid_device(pcie, bus, PCI_SLOT(devfn))) return PCIBIOS_DEVICE_NOT_FOUND; - } return _altera_pcie_cfg_read(pcie, bus->number, devfn, where, size, value); From patchwork Fri Oct 15 14:38:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562167 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F2C8C433F5 for ; Fri, 15 Oct 2021 14:45:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 268DF61041 for ; Fri, 15 Oct 2021 14:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234575AbhJOOrf (ORCPT ); Fri, 15 Oct 2021 10:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240697AbhJOOre (ORCPT ); Fri, 15 Oct 2021 10:47:34 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F5EC061570; Fri, 15 Oct 2021 07:45:28 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id kk10so7364886pjb.1; Fri, 15 Oct 2021 07:45:28 -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=RSO8fMw2XXEulSijQBNzsaO/mKtFViudcJrPIwPiUa8=; b=VpeS/amvYUMgnN+vcfj6j8ChB1pwWoO6uMGWOuOMw3t5zmBHwzJtCs9quAgWX82zzr D/DOYmnPRH3/zvIoD/chwGm/OTZmGKh7UDc5sla+AWQUDxnltegMOxxaLJ+BY+bb3DEi kUxKxjW7VBspT9igA7St5CiXuMYxgm1Q6RD6ymtQ98l75Bc4vY+OSN63d5ch8/fKy4od Y4qhkPaVGXRe7krQX38Y92Xy9pC/0uz1/ZdQjlWbnPXRMTZeXYN11L4yhHy00f8NQJJF VoeYU4l+491rXplUi+pwwyOq9jrtGmS4bd6qdAYxZIONa0If5nnCBE+VVpXitLj0RfDD adPQ== 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=RSO8fMw2XXEulSijQBNzsaO/mKtFViudcJrPIwPiUa8=; b=mDZa4SIYV0jZmYEkfkH9myPwW76MdmRc7QOlRypZF6PqEdzyHHr3kZBMzkAVUsUCXT jpk+2Q3vwLBIXdjQ6KNvctw7/wIyJn0ZhSCKG/quDfSaNtPzKFaOH3Q+wby7NZsxUA5m OSdwW1ob2eQfJHSQaaQfOppwUldOKkj3VXs/oWS5ba/eSbKNu2lFulSkrtrC4WOXwECo Zr0yJ5JaIujhyQubUssZswvUbwoBEQh40Rat+iRqhLTg10mLCw3B+GM4vGYhoMuT+qdK mSqdSeOYLsVhzbKqX9T3XTpIE7ttSxQSOQTNzIOaPf32GyR/5PsqQ6Tb7+24YvoPbwBk E95A== X-Gm-Message-State: AOAM531npeN2eczBXYBkBJoBc0F/dc0HRNVwpWsZMKiQBuSYSQ4BMvdN HIRnnE6mIAGSkKR3Am7BvCk= X-Google-Smtp-Source: ABdhPJwTbPdY3g2bOp7CoNi8n3DnxaNqHB7MsT+VZH6Djl1EnJi3JSClC4QlhR0Wg/UTCn6Kg2YgNg== X-Received: by 2002:a17:90a:e547:: with SMTP id ei7mr28994508pjb.169.1634309127749; Fri, 15 Oct 2021 07:45:27 -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.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:45:27 -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, Marek Vasut , Yoshihiro Shimoda , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-renesas-soc@vger.kernel.org (open list:PCI DRIVER FOR RENESAS R-CAR) Subject: [PATCH v2 14/24] PCI: rcar: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:55 +0530 Message-Id: <2544a93bf8725eecbea510e7ddbff6b5a5593c84.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu Reviewed-by: Geert Uytterhoeven --- drivers/pci/controller/pcie-rcar-host.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c index 8f3131844e77..1324cb984ed5 100644 --- a/drivers/pci/controller/pcie-rcar-host.c +++ b/drivers/pci/controller/pcie-rcar-host.c @@ -161,10 +161,8 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, ret = rcar_pcie_config_access(host, RCAR_PCI_ACCESS_READ, bus, devfn, where, val); - if (ret != PCIBIOS_SUCCESSFUL) { - *val = 0xffffffff; + if (ret != PCIBIOS_SUCCESSFUL) return ret; - } if (size == 1) *val = (*val >> (BITS_PER_BYTE * (where & 3))) & 0xff; From patchwork Fri Oct 15 14:38:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562169 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 695DFC433EF for ; Fri, 15 Oct 2021 14:45:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F0A061041 for ; Fri, 15 Oct 2021 14:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240708AbhJOOrt (ORCPT ); Fri, 15 Oct 2021 10:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240718AbhJOOrm (ORCPT ); Fri, 15 Oct 2021 10:47:42 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88430C061570; Fri, 15 Oct 2021 07:45:35 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id q2-20020a17090a2e0200b001a0fd4efd49so2937109pjd.1; Fri, 15 Oct 2021 07:45:35 -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=g4G4Yffk64HxtbjZzw9/E8PSnsLTvUujtQvSwE3J4gU=; b=flHW2Jb/AbysBVvJNNr6JwH4MLrEHqIfdfTJWIOUpBUFJwLO86Ww3lJYUN7rYZqGJh I/lLA1GbwqNXEqeL89Z3FnLGzNne+/JrIebWPKmh9G+HFumicXJhgPMP/FcWxH3Qo12+ Q0ZxbrKvgId5wRbJMk7X2tyZjOWKJ1dQkwD56X7y0ajeoKXdAStXPcstCBSbsF4aWum2 zF22ZFS6E/jaZgCPFP68wJmWfS9nwNR3Mf74lov/0SXtOEeA6Pe3kS0PlgMvknpXbjei UoH4eIy6X67PmTd7h87bfKgIgkE3H+Tq1rJ5p5b5NVrQLGDERDaJut6pmY8fSOHCLf0a bQWA== 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=g4G4Yffk64HxtbjZzw9/E8PSnsLTvUujtQvSwE3J4gU=; b=bZhTXKMr2vF2KPemwXwEnx60GZ0GZo6ANFimsApScv1EhVAhqSkm6dBTTDfxRcHz+v YYkq6IyJjbr5wJKQg2EVrKBeHzL7j1KESvdTg+hs+wy9h08QlVilBK0txNFrYfy/RMXW xF6bXSxVXoKZU6PH0+1wYgNVcb0hAPa2YgH2YHMBVpVNi+1WkLdyHby9LE3XPGIq6VXq lo84DVIYQYCOOp5MnGHySwv2HzCt5/ZUZYuw2LIn8vL9wFaWsYgrrAd0rDf22kWXySlo QPxVzV32ECbIeDpN1cweKT1rDVksWDx9agX+TL2GDmnVmBYBdyk/Ye9Ddr6LMw9p5omu IZ7g== X-Gm-Message-State: AOAM532qd4OOv0Ua/ccQTLoiADplMq6jrmmhShJguwYjG4K6mo5UyAYS 6IMJzy7Or1H7Pv4HW9OfwKbht3CJwoX//KYk X-Google-Smtp-Source: ABdhPJzyBRhAH58hfG57hRWt1brI24x/g9MveoCJoOB1DDAWMEjJsf6dfeFJ3flcCuWG22yuJmFJEg== X-Received: by 2002:a17:90b:38c6:: with SMTP id nn6mr13976286pjb.206.1634309134963; Fri, 15 Oct 2021 07:45:34 -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.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:45:34 -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, Shawn Lin , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Heiko Stuebner , linux-rockchip@lists.infradead.org (open list:PCIE DRIVER FOR ROCKCHIP), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support) Subject: [PATCH v2 15/24] PCI: rockchip: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:56 +0530 Message-Id: <4fe27c1af8b43e87c2eaf31fced8015b81478c8f.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pcie-rockchip-host.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c index c52316d0bfd2..45a28880f322 100644 --- a/drivers/pci/controller/pcie-rockchip-host.c +++ b/drivers/pci/controller/pcie-rockchip-host.c @@ -221,10 +221,8 @@ static int rockchip_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, { struct rockchip_pcie *rockchip = bus->sysdata; - if (!rockchip_pcie_valid_device(rockchip, bus, PCI_SLOT(devfn))) { - *val = 0xffffffff; + if (!rockchip_pcie_valid_device(rockchip, bus, PCI_SLOT(devfn))) return PCIBIOS_DEVICE_NOT_FOUND; - } if (pci_is_root_bus(bus)) return rockchip_pcie_rd_own_conf(rockchip, where, size, val); From patchwork Fri Oct 15 14:38:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562171 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93987C4332F for ; Fri, 15 Oct 2021 14:45:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F06561181 for ; Fri, 15 Oct 2021 14:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240728AbhJOOru (ORCPT ); Fri, 15 Oct 2021 10:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240736AbhJOOrp (ORCPT ); Fri, 15 Oct 2021 10:47:45 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C514C061762; Fri, 15 Oct 2021 07:45:39 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id v8so4408854pfu.11; Fri, 15 Oct 2021 07:45:39 -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=Wg9CIjlvFpQ0mVyLruVXTyXRfH69nmtxShZyyO67k10=; b=O4C9zYJL9l7EbrlGSDp0OOYmbfrQI/mk7hKB2KetLAfTJkrzFPw/c64gcGjsOAg/gS XisYpdLBtUdscG4+zLFIqn84JjKco6cDb3F70hnPwsx4kPYC84CdTP6IGTuXohsBXQn6 gM8iJy7Qdmuy3rI16l9MgKjozQXgOxJepwN9ZHaDjPSmwyX2mfK/CnxNmWqc0nYK1+Gw Vionef2tPDP17XYMqXM2N2ATJwtpPWgr1nGPNBkW0HT0ecGB3nObThlDWfpb/8sWHyVU yrFOp0FpZgJcuwXofxQ+qSkUD/OLZ1nfxhte3aeIdRCmGwHQa8I4M3Ba3Lm8PCBKisx2 L35A== 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=Wg9CIjlvFpQ0mVyLruVXTyXRfH69nmtxShZyyO67k10=; b=PltK+d3QdTwzDYyfqJSMJHvYHdRj8l6ihzLJZc5X68DoMUPt8oJxUskrophHWQ7Mq+ GmQEkCQuq72rmdST5QBzz2ldglfIE7yTCyNA7jgc4J8nRKPWWfpZQAgXIjo2nqptbsOM HAjbGtu8685LLdI0/PJatFbgzBk+eYUs7Y2Li9pKVaX3B5LJv8Cjkm8mU8ZcLl14fyHi 4OPfnnSmg7zZQIWYvAaR91nvj3+KW9XH0M1ip/cDAKcLeWuNSB6HDKXeSRFCv2ZUvEFY LPidVSKHjdTizvUPKq4MS02C9tEzRvdGW5Mmr/EtrRm6QZxyIrxYttnJrF3MHgCjdJRV HasA== X-Gm-Message-State: AOAM531IZMMWMTK1Z1J7nYFShg/euy9ER9O5SOV9IKThXGGybyzwjPWI 2UuP9+PH3EkNk188P8KMScY= X-Google-Smtp-Source: ABdhPJzVsujjyhtu4qdgTMOPdGHq2Omqc8DYqIdFvZ6lxYZhtdKrpABl9i6841s5RVRY23eQjwq/QA== X-Received: by 2002:aa7:8d86:0:b0:44c:9006:1b44 with SMTP id i6-20020aa78d86000000b0044c90061b44mr12215663pfr.36.1634309139012; Fri, 15 Oct 2021 07:45:39 -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.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:45:38 -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 Subject: [PATCH v2 16/24] PCI/ERR: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:08:57 +0530 Message-Id: <69fed7552be7c516bc92ce1e3bbb3249dfb74860.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 unifies PCI error response checking and make error checks consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/pci.c | 10 +++++----- drivers/pci/probe.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index ce2ab62b64cf..c1575364d1ce 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1077,7 +1077,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) return -EIO; pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); - if (pmcsr == (u16) ~0) { + if (RESPONSE_IS_PCI_ERROR(&pmcsr)) { pci_err(dev, "can't change power state from %s to %s (config space inaccessible)\n", pci_power_name(dev->current_state), pci_power_name(state)); @@ -1239,16 +1239,16 @@ static int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout) * After reset, the device should not silently discard config * requests, but it may still indicate that it needs more time by * responding to them with CRS completions. The Root Port will - * generally synthesize ~0 data to complete the read (except when - * CRS SV is enabled and the read was for the Vendor ID; in that - * case it synthesizes 0x0001 data). + * generally synthesize ~0 (PCI_ERROR_RESPONSE) data to complete + * the read (except when CRS SV is enabled and the read was for the + * Vendor ID; in that case it synthesizes 0x0001 data). * * Wait for the device to return a non-CRS completion. Read the * Command register instead of Vendor ID so we don't have to * contend with the CRS SV value. */ pci_read_config_dword(dev, PCI_COMMAND, &id); - while (id == ~0) { + while (RESPONSE_IS_PCI_ERROR(&id)) { if (delay > timeout) { pci_warn(dev, "not ready %dms after %s; giving up\n", delay - 1, reset_type); diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index d9fc02a71baa..55b94d689eca 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -206,14 +206,14 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit * 1 must be clear. */ - if (sz == 0xffffffff) + if (RESPONSE_IS_PCI_ERROR(&sz)) sz = 0; /* * I don't know how l can have all bits set. Copied from old code. * Maybe it fixes a bug on some ancient platform. */ - if (l == 0xffffffff) + if (RESPONSE_IS_PCI_ERROR(&l)) l = 0; if (type == pci_bar_unknown) { @@ -1660,7 +1660,7 @@ static int pci_cfg_space_size_ext(struct pci_dev *dev) if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL) return PCI_CFG_SPACE_SIZE; - if (status == 0xffffffff || pci_ext_cfg_is_aliased(dev)) + if (RESPONSE_IS_PCI_ERROR(&status) || pci_ext_cfg_is_aliased(dev)) return PCI_CFG_SPACE_SIZE; return PCI_CFG_SPACE_EXP_SIZE; @@ -2336,8 +2336,8 @@ bool pci_bus_generic_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l)) return false; - /* Some broken boards return 0 or ~0 if a slot is empty: */ - if (*l == 0xffffffff || *l == 0x00000000 || + /* Some broken boards return 0 or ~0 (PCI_ERROR_RESPONSE) if a slot is empty: */ + if (RESPONSE_IS_PCI_ERROR(l) || *l == 0x00000000 || *l == 0x0000ffff || *l == 0xffff0000) return false; From patchwork Fri Oct 15 14:38:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562173 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33DE5C433FE for ; Fri, 15 Oct 2021 14:46:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2372961041 for ; Fri, 15 Oct 2021 14:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240573AbhJOOsH (ORCPT ); Fri, 15 Oct 2021 10:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235318AbhJOOsH (ORCPT ); Fri, 15 Oct 2021 10:48:07 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEBAC061570; Fri, 15 Oct 2021 07:46:00 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id l6so6526298plh.9; Fri, 15 Oct 2021 07:46:00 -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=jZJX9CbLMezPavdAEsrkOsiHPTmHr09QIspE6IFIFVc=; b=iXTG7MgruvfoISzQMeRGbBt2ad6/7BSmR4i1c1wy+VVD8k+y+QFQjDpVRGodJJARaB rDa5mBuKvLkuaNAjwKzsRKp/jZ9BQCX3vfmu9UO49PwTu4nE3j4cv9boiPNIZnNf4FM5 JcLFF7SwagmeuTdanyYGIqRaR5J9yFyDF8fwB7mDdZ+lR8jk08ccNse8poo8n/XK5kvH Sa7wc7IhrlhwJhRdzMn6SvMGIAwfg27LrzHpI49DK2knMHVg0AMavrixa5bAsmrGNK4+ 4DVqk+mlk721j7YqlN/+l94CASLZG3nsHLorK+dwEOjBIMBiQjsge9pJxrpovAzXUhdM Az/Q== 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=jZJX9CbLMezPavdAEsrkOsiHPTmHr09QIspE6IFIFVc=; b=67iIKZIKHNUycfYWKtwdsZyi1JtCOBE9hQne2F1THNH+sDb6AFoi/NpRtwPffyGEGR XzMbhgYHka+KTr03uVpCLgameHn+vkgiWRtMaLJIFutYz5EWurkS9InjZRlUQCdEJHFw eXTWAAE4DQ4RtjR2CBGHPfH69tOBTxVEz7m6HjblsXAI6PG9BVqpp9qcqB/4WfkUqRTh lFSlK69pGyjNP4mzb4NE2yOeK9fNFUppptdnU/kzWZUi+sd1MHojDPEpPR2TT2dh4Fmx GUzm3dKDsTZFLb93J6V2nMNyFAW3PcfoCVxQwWvCVBtt3MF9iCAG806311m3CjSz0qFK InNw== X-Gm-Message-State: AOAM530VMeWZ3rTAJlNn7QBYoSEn6REo833gnSQBDYM+lX0Y9XusKhcN 0x357Z1aSwZuIgS2VEqLdVw= X-Google-Smtp-Source: ABdhPJzd2mU9TMFIg5GGMN/W6stxEp3fblwUqADMrcyM6e2uYsbW/4c/MWtkdNzq2Zv0qomNn3Tv0A== X-Received: by 2002:a17:902:6544:b0:13e:dd16:bd5b with SMTP id d4-20020a170902654400b0013edd16bd5bmr11591581pln.61.1634309160465; Fri, 15 Oct 2021 07:46:00 -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.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:00 -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, Jonathan Derrick , Nirmal Patel , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Subject: [PATCH v2 17/24] PCI: vmd: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:08:58 +0530 Message-Id: <0da4dfe7642bf89d954c7062a40566bf28d94da1.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. Reviewed-by: Jonathan Derrick Signed-off-by: Naveen Naidu --- drivers/pci/controller/vmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index a5987e52700e..db81bc4cfe8c 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -538,7 +538,7 @@ static int vmd_get_phys_offsets(struct vmd_dev *vmd, bool native_hint, int ret; ret = pci_read_config_dword(dev, PCI_REG_VMLOCK, &vmlock); - if (ret || vmlock == ~0) + if (ret || RESPONSE_IS_PCI_ERROR(&vmlock)) return -ENODEV; if (MB2_SHADOW_EN(vmlock)) { From patchwork Fri Oct 15 14:38:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562175 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3754BC433F5 for ; Fri, 15 Oct 2021 14:46:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1CE0761041 for ; Fri, 15 Oct 2021 14:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240758AbhJOOsf (ORCPT ); Fri, 15 Oct 2021 10:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240766AbhJOOsN (ORCPT ); Fri, 15 Oct 2021 10:48:13 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80ED9C061764; Fri, 15 Oct 2021 07:46:07 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id oa12-20020a17090b1bcc00b0019f715462a8so7418609pjb.3; Fri, 15 Oct 2021 07:46:07 -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=EXqQzO1oSewfqo9sAbFeLWFXnz/W3EVi0EQdPEI6sRE=; b=K53e7Oe+f9+7D7WpNDUco3qWePYRLXAYCersP6n2gPnyhNdVyIE3Wu1/0wXNvCeD4h GQwrZ1Ch9tnNznJLjY2BCfcuNx29Ntzjkp1QpG5TUU7MSzTzCmUOq1NHcaxBCGoxZxyy zIfAW+IH/LqvtfiGH23oImVF4unRFwnBN9vExy/ehbxrgFRX7YYyzxkVcc9KuA+iIEVN x8UujC0F/DA4KmjgsLX7BCsyrLN09joYUMjO/XpoZHl2nnyh0BtSo/Ujt9fhazeGrq2+ bwvDDRhHpWmQtgwA4fSn8mw4uZYf066PvrVj1XtJxZlAJNneDe5bOTB1mzHAalmdDjLy q8LQ== 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=EXqQzO1oSewfqo9sAbFeLWFXnz/W3EVi0EQdPEI6sRE=; b=01+P60Eow/pN6alrf/0o6wBS/SLdvZmCowG2rMCvcuh/cg8GwavzyR3/5k0R7buI2p 1GIWbH/tJROgn/p08NbL9Bt6xiSXb4w4OZFdDPjv5JhlA1WrQxt9pbITnwITO46CYfbM 5O9O3MsnYWP7tHiPYHmkifkNM4N0I4Xhs99tdS0UzrWq4h8EVugaI858ZAYeUnzuTMbR ZF3OYpyhdPvwSyGc+yUKsgqOUJuVUDQG46xfXUv5J8KeLyYx40LkW2DnrLnsKUceQD8n Z0u8SukGCjIfbGjLQAEFtEzqMocLnYqkIIkJ9oJuVTLPovHu2dPDtbznFtH+Vapw8q1x mtpg== X-Gm-Message-State: AOAM530k0SJk6gxOi1MX4mmdsO9OTByqx8miQyZSd7X658foufacWI+1 mDhnOXEulPM3xwnujNWKVRc= X-Google-Smtp-Source: ABdhPJzsMZqm+frY+X1rHzGEJNsNKsVIy7dntkjRCaKaKKSNaCGslbffodRrOi1845tZSOiFoJhUTA== X-Received: by 2002:a17:90a:bb82:: with SMTP id v2mr28357103pjr.57.1634309167032; Fri, 15 Oct 2021 07:46:07 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:06 -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, Lukas Wunner , Kuppuswamy Sathyanarayanan , Amey Narkhede Subject: [PATCH v2 18/24] PCI: pciehp: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:08:59 +0530 Message-Id: <2bc987dc1dfb753c37a65b6c8c98c32e66a4d2a0.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. Acked-by: Lukas Wunner Signed-off-by: Naveen Naidu --- drivers/pci/hotplug/pciehp_hpc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 3024d7e85e6a..8a2f6bb643b5 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -89,7 +89,7 @@ static int pcie_poll_cmd(struct controller *ctrl, int timeout) do { pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); - if (slot_status == (u16) ~0) { + if (RESPONSE_IS_PCI_ERROR(&slot_status)) { ctrl_info(ctrl, "%s: no response from device\n", __func__); return 0; @@ -165,7 +165,7 @@ static void pcie_do_write_cmd(struct controller *ctrl, u16 cmd, pcie_wait_cmd(ctrl); pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &slot_ctrl); - if (slot_ctrl == (u16) ~0) { + if (RESPONSE_IS_PCI_ERROR(&slot_ctrl)) { ctrl_info(ctrl, "%s: no response from device\n", __func__); goto out; } @@ -236,7 +236,7 @@ int pciehp_check_link_active(struct controller *ctrl) int ret; ret = pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); - if (ret == PCIBIOS_DEVICE_NOT_FOUND || lnk_status == (u16)~0) + if (ret == PCIBIOS_DEVICE_NOT_FOUND || RESPONSE_IS_PCI_ERROR(&lnk_status)) return -ENODEV; ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); @@ -443,7 +443,7 @@ int pciehp_card_present(struct controller *ctrl) int ret; ret = pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); - if (ret == PCIBIOS_DEVICE_NOT_FOUND || slot_status == (u16)~0) + if (ret == PCIBIOS_DEVICE_NOT_FOUND || RESPONSE_IS_PCI_ERROR(&slot_status)) return -ENODEV; return !!(slot_status & PCI_EXP_SLTSTA_PDS); @@ -621,7 +621,7 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id) read_status: pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &status); - if (status == (u16) ~0) { + if (RESPONSE_IS_PCI_ERROR(&status)) { ctrl_info(ctrl, "%s: no response from device\n", __func__); if (parent) pm_runtime_put(parent); From patchwork Fri Oct 15 14:39:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562177 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79C7AC43217 for ; Fri, 15 Oct 2021 14:46:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D92061248 for ; Fri, 15 Oct 2021 14:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240785AbhJOOsf (ORCPT ); Fri, 15 Oct 2021 10:48:35 -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-Google-Smtp-Source: ABdhPJz6Gwr1+vYiSF57ZmI6jf24pGsKXmwV6yIHG2L6BRqU1OKaExlx4wVky+9XnlcXwmw/z3FEuA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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, From patchwork Fri Oct 15 14:39:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562179 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B19AC433FE for ; Fri, 15 Oct 2021 14:46:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1885E611CE for ; Fri, 15 Oct 2021 14:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240835AbhJOOsj (ORCPT ); Fri, 15 Oct 2021 10:48:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240904AbhJOOsi (ORCPT ); Fri, 15 Oct 2021 10:48:38 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A58C061764; Fri, 15 Oct 2021 07:46:31 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id e5-20020a17090a804500b001a116ad95caso1880070pjw.2; Fri, 15 Oct 2021 07:46:31 -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=hOpzKqtZkl4vpPBZR8uQl2s3BPZXOsp3vKlUaVIS/Mo=; b=lGnDCLP8y6cK8sv7p2OZlrGk97vBTKAG2qRs3qpGUCsOeOSA+8Eg6eKhbQ9Ur8G4AK QL3e95caq6ledLj+vqpKoKy9JEpKMfivJ1341LnWux3fnFzCNGsYnGJanxZqaFkVwBR6 bX13DDXre68T7KAPeSVanJN4EiAbGsgROJ11EyNQ2/KLuwki3eHUwn5AP76wFBU5WEkM 2VhnhGfiFSiJrau7UAG3h9p7aDnKvjDNFj3ZMcovitC/Bfx0XzA6blFPC0jZQ9w133yj 80Ru/QQuyuIjxeebyzEja50/QqoI0u2KuJXOdJVBfI14y67dSZVOCqpcI2652vEuwLYK V88A== 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=hOpzKqtZkl4vpPBZR8uQl2s3BPZXOsp3vKlUaVIS/Mo=; b=LthU5isMu6WBLuihMahCAi7LcgxQF2/sZgibK7V+GNcb+obtBtl1C2H4G/xYagtg/O ISruySwd0sfaJiuqQLm69HWy87dn15vazZHiToS/WZG5Nmob8sKt7Y0d67DX5aW3T/yK fNa6/BxLg1urVEhN5ALYTLOoDznt5Py1Yu5eunwKuZFKrEdErbPxO7Es9+ElJ0YlOrdG vptecSN0CTzbvlX/YZf6nK8E8aDGuXltJIPM8Gq+vMx+CkzLpCOTgKZPYB3265ac7G5i LkWj7AQ9QN/Mo6DR9jnAYw7ffqvKkOvcK3FW3tF7fGMuv8prFc5sKYiYhAYleTv0pD0U 0jHQ== X-Gm-Message-State: AOAM531MfUNVR42ouS9rCkbh/ogOJbXQTdBala+RrN9STHSurWPyyr+t sEYr3IKGgOb9m/vRudZj2Hg= X-Google-Smtp-Source: ABdhPJyYyqfcsJzI243JmXVG3+21XjY11IqHy3sc/D6aNXGZkvJA2D+wvBQJSu7RAMcZHo+4OnX3Ug== X-Received: by 2002:a17:90a:5d89:: with SMTP id t9mr5623662pji.21.1634309191523; Fri, 15 Oct 2021 07:46:31 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:31 -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, =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Qiuxu Zhuo , Sean V Kelley Subject: [PATCH v2 20/24] PCI/PME: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:09:01 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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/pme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c index 1d0dd77fed3a..24588d0b581f 100644 --- a/drivers/pci/pcie/pme.c +++ b/drivers/pci/pcie/pme.c @@ -224,7 +224,7 @@ static void pcie_pme_work_fn(struct work_struct *work) break; pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta); - if (rtsta == (u32) ~0) + if (RESPONSE_IS_PCI_ERROR(&rtsta)) break; if (rtsta & PCI_EXP_RTSTA_PME) { @@ -274,7 +274,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context) spin_lock_irqsave(&data->lock, flags); pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta); - if (rtsta == (u32) ~0 || !(rtsta & PCI_EXP_RTSTA_PME)) { + if (RESPONSE_IS_PCI_ERROR(&rtsta) || !(rtsta & PCI_EXP_RTSTA_PME)) { spin_unlock_irqrestore(&data->lock, flags); return IRQ_NONE; } From patchwork Fri Oct 15 14:39:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562181 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42141C43217 for ; Fri, 15 Oct 2021 14:46:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D95461212 for ; Fri, 15 Oct 2021 14:46:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240780AbhJOOst (ORCPT ); Fri, 15 Oct 2021 10:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240620AbhJOOso (ORCPT ); Fri, 15 Oct 2021 10:48:44 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7282C061767; Fri, 15 Oct 2021 07:46:37 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id g184so8814972pgc.6; Fri, 15 Oct 2021 07:46:37 -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=F90TVLLbkkjlFTZkt/NbI81qyTfS7mybpJeR5bN32UQ=; b=l5ELkb75e7o0WqRg7nGZ9P1QoeNbxsEGVGFrefZQ/ppVbqiJYC1+5+OpX+KkPqFvDw aLGb7yL88woVFnJUuNdXLXM7/DxVZSEr3pByuWd9EGz3SqrwAmcg4h7rmKL/gbbcU0zp uoZZHfztxBoQquCz1RWFxPrkPirdb0uzbp761KgtQfLB2JNySaD7mQrZb/q63HLuptZQ JhXsY4Ao8rLTq8UORVBZmUs3ULDA+EZXHAvFjKbAho7UaV76oaiIW+HqibjGA/wtr5hc xcrfviYyAtIJbjobyVBkN/6OhUP05e6UwqOO42UDz+MHh8hLguqcHg/lLcyMMeEG6cOM LZag== 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=F90TVLLbkkjlFTZkt/NbI81qyTfS7mybpJeR5bN32UQ=; b=LmG/tLotS1IuNunINvyYBV7b3/ep14HjjpCHhh9qdS/jFejKHFJrwSXuX2Xmh2zRF3 gxqCCekKSXOsygopBeMvGYWcqeraeEiasTeG5eYFxXmwUnvH26CnZG5jwI0hUJzs5Q1c MwUe3ksaJ/asucthZYbp9eq4iGSmIuxQ8r67Vm2urnh5BZ3IoRtSQDoX7ThvWB/VUrad ZYJ0EXh/QAyeK+9IEbQyFt3tN6gKFWKql8GcxY1gTY94eb5/E3N6Ld95Vjsa5p+QSOoZ 4dAPOKpHXleEG3NR5/3U+UVE0Ds7rstH0BCzcg9Wfn5XVPonnEtxzMnwrkVNRoWymx+F sEig== X-Gm-Message-State: AOAM533SojuL0VHg8E5V0oGFyCdfT6OlCPlJQ1whyVLDazEAXogj8yZp fIPHRULUa9W842phI8m1dXA= X-Google-Smtp-Source: ABdhPJz6U9ZR5U059i2Q3FPT+1FmSwYKHMAJz8o9+XAViweLN28SbAcTm8y742+h3/UXopkv6XeChw== X-Received: by 2002:a63:590e:: with SMTP id n14mr9425002pgb.434.1634309197420; Fri, 15 Oct 2021 07:46:37 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:37 -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, =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Subject: [PATCH v2 21/24] PCI: cpqphp: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:09:02 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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. Signed-off-by: Naveen Naidu --- drivers/pci/hotplug/cpqphp_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 1b26ca0b3701..d5274b9b06a5 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -2273,7 +2273,7 @@ static u32 configure_new_device(struct controller *ctrl, struct pci_func *func while ((function < max_functions) && (!stop_it)) { pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); - if (ID == 0xFFFFFFFF) { + if (RESPONSE_IS_PCI_ERROR(&ID)) { function++; } else { /* Setup slot structure. */ @@ -2517,7 +2517,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0), 0x00, &ID); pci_bus->number = func->bus; - if (ID != 0xFFFFFFFF) { /* device present */ + if (!RESPONSE_IS_PCI_ERROR(&ID)) { /* device present */ /* Setup slot structure. */ new_slot = cpqhp_slot_create(hold_bus_node->base); From patchwork Fri Oct 15 14:39:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562183 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5203DC433EF for ; Fri, 15 Oct 2021 14:47:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3635460EE5 for ; Fri, 15 Oct 2021 14:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240856AbhJOOtd (ORCPT ); Fri, 15 Oct 2021 10:49:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240967AbhJOOsu (ORCPT ); Fri, 15 Oct 2021 10:48:50 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285FAC061762; Fri, 15 Oct 2021 07:46:44 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id t11so6526734plq.11; Fri, 15 Oct 2021 07:46:44 -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=iKrtrnYSDksMWdgmUznUR/Q64gwdi8mvvQO4UVqOm9E=; b=Inc1Q7qKweM0tGJP+CWhPMXm+v1Axi75stMnqo37FnW41/u8uhJxSram8OfhxWJmx7 ingaTUh91Stnkx0O8obZeD0ODKeAEBTvLoxyuFRrCsHd8M66Gg9ny36i7KlXtQxFB34I bu13sSJTRQ+p1DB2XGXPOl23hHG9V93RWK/KXQc8Q+KMejYlj1Nj0VaMOdSAfrGUZvhi iIujdDQUwH2Ev7bP2bKX4VAELQlWe/tMlrj6FSetMmjSJRxYctzqpkO9jeE8voBVMUx5 O+EjlmJhNBiUt0b7PGFLNmO6W5v4ZYluSBFJonLeVVk7BM3MtPWUX/bBkdQaGdPiqtKZ FnAw== 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=iKrtrnYSDksMWdgmUznUR/Q64gwdi8mvvQO4UVqOm9E=; b=A16bMRT8OeARl4TEYflkaun/Dgs9n+nZfC0FIUb/ZuB9m8Za5IerJbLSv6kpTa4dso m12Ml61rnhZ0Jc9WiTvetuMBmflmXdoSNy645nF41LdVfRn2B4xm6cTEh+K6o/UOzEBA 1Wm2DDeX/+F6WqEYD/ozHAYuzQJcFkVYUbvPrnx3Mpd9xaPT0PqwLicsPivjLBg3E+tX hXVyPDjA7ScAqePinl53iqqymc8a4zY/A+/wLjAPsu1hXVg6SeSfP2ukJzHJh9RPKlA8 0/XHyzKoDFVpDQVta0dx9kppKw/KpPaxzhvuJlCWsF+3b7aOYsHVtPq4EUhVM7IM73/j 9lGA== X-Gm-Message-State: AOAM5304oUnBC2Cmq7ZXxlPiK3NmEbRWwDNBu0906M1H0jo7ceA4RRHE JOM/mtKCL9LvA4GehhGREmI= X-Google-Smtp-Source: ABdhPJyJ8FQ16vD47i4rGFglTPo9H74I0SPwjWN0ikhEg5awUxLojaILYXXw4ixmXnGPJB0ufC3kUw== X-Received: by 2002:a17:90a:c6:: with SMTP id v6mr28477261pjd.172.1634309203633; Fri, 15 Oct 2021 07:46:43 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:43 -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, Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Jingoo Han , Marc Zyngier , Kishon Vijay Abraham I Subject: [PATCH v2 22/24] PCI: keystone: Use PCI_ERROR_RESPONSE to specify hardware error Date: Fri, 15 Oct 2021 20:09:03 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Include PCI_ERROR_RESPONSE along with 0xffffffff in the comment to specify a hardware error. This helps finding where MMIO read error occurs easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/dwc/pci-keystone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 865258d8c53c..25b11610b500 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -748,8 +748,8 @@ static int ks_pcie_config_legacy_irq(struct keystone_pcie *ks_pcie) #ifdef CONFIG_ARM /* * When a PCI device does not exist during config cycles, keystone host gets a - * bus error instead of returning 0xffffffff. This handler always returns 0 - * for this kind of faults. + * bus error instead of returning 0xffffffff (PCI_ERROR_RESPONSE). + * This handler always returns 0 for this kind of faults. */ static int ks_pcie_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) From patchwork Fri Oct 15 14:39:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562185 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E1F4C433F5 for ; Fri, 15 Oct 2021 14:47:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7388E6120D for ; Fri, 15 Oct 2021 14:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240770AbhJOOtp (ORCPT ); Fri, 15 Oct 2021 10:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240775AbhJOOtV (ORCPT ); Fri, 15 Oct 2021 10:49:21 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F11C061772; Fri, 15 Oct 2021 07:46:59 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id c4so1773864pgv.11; Fri, 15 Oct 2021 07:46:58 -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=8H47ocDcATCEcdvQX+LbcVgPZyzX/fIx4WAwDOmGCq4=; b=Eux3ZNBeFFId+XHdQkRmLauqE8OAFj38AteET+UOhB3y9JaX2mZ7iVNlfIRKDRY1aP Sp6zIyqe0Ud1BseDpkT60FafTSrwY/J9mVtI9j6Pk1rVWEoMjamuFbMeteGMPDAKudik KArKNn2zwwdCjIBZxpW+uWOakhRB/U92FAHfnx0pAl51m7jn0v3JUQIo9+fDoLeLyZKS q0hJnBIuY49zyJLy2wo5UiUb6ZZzxCY797QfKS3vghg+AJsL7XwnTQgVY1AndynWaiH9 9oOFzKwhP8B7SoA28FaVuvv5gwLhB9aFLGJY09bJemOUk4tbqCKVAHfYulxYfufqA4Sj LRXg== 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=8H47ocDcATCEcdvQX+LbcVgPZyzX/fIx4WAwDOmGCq4=; b=Z8EUUSJA4FOCZpUGkHdzjnus+12FB2QDHdeYFfsFJKRsi+ZrufJ3yuNb6o/ANrGycq 5TAZB18VkEqYOmvwZG0LpOe0H6sp+OYkr8CarlBAl7IfWKCAiNDkA3IQdpGKdbWXS8Wy BszdP8NypWW82jNSi/zZlM5UmhmYPlV3EDeJ3tGnqxVZVYyBdgJuu2JSjmnokfAOZY7l t/+xeogqwcRaXqxdULSdBpmjZaZeOcIEiXAwCu4ExN/B669Jp2k561KABGbYf995z6vV MLOUpW+BlVoj4Izm52eQ2eb6Zd4ONBlsaRV8IwTxd7/KgwSyQFUXxj3UgDu4vwgXfSs+ b3wA== X-Gm-Message-State: AOAM533w6CKI//XWSPTSdw4zbMKKgRI37uud1jhiPDrC3i050vlRT8bH woUk4j/mJb8mokix6fXgTk2r0M0YCqhsajd7 X-Google-Smtp-Source: ABdhPJzGttIeZ/ecyBn9FSKHW/aoF+vyF/yYttrHn5sYxfqT3TXKV4dkEub6bv1LydtAneYLLoxtPQ== X-Received: by 2002:a63:f155:: with SMTP id o21mr9408255pgk.218.1634309218506; Fri, 15 Oct 2021 07:46:58 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:58 -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, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-hyperv@vger.kernel.org (open list:Hyper-V/Azure CORE AND DRIVERS) Subject: [PATCH v2 23/24] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error Date: Fri, 15 Oct 2021 20:09:04 +0530 Message-Id: <9b72268025063f0094880f32f391e2f626f62487.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Include PCI_ERROR_RESPONSE along with 0xFFFFFFFF in the comment to specify a hardware error. This helps finding where MMIO read error occurs easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pci-hyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 67c46e52c0dc..7e1102e3d7c6 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1774,7 +1774,7 @@ static void prepopulate_bars(struct hv_pcibus_device *hbus) * If the memory enable bit is already set, Hyper-V silently ignores * the below BAR updates, and the related PCI device driver can not * work, because reading from the device register(s) always returns - * 0xFFFFFFFF. + * 0xFFFFFFFF (PCI_ERROR_RESPONSE). */ list_for_each_entry(hpdev, &hbus->children, list_entry) { _hv_pcifront_read_config(hpdev, PCI_COMMAND, 2, &command); From patchwork Fri Oct 15 14:39:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Naidu X-Patchwork-Id: 12562187 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27989C433FE for ; Fri, 15 Oct 2021 14:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09C3061215 for ; Fri, 15 Oct 2021 14:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240801AbhJOOtq (ORCPT ); Fri, 15 Oct 2021 10:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240811AbhJOOtZ (ORCPT ); Fri, 15 Oct 2021 10:49:25 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51922C061774; Fri, 15 Oct 2021 07:47:05 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id e65so6421752pgc.5; Fri, 15 Oct 2021 07:47:05 -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=+xcssxkZTlEueyseAvWLLQTd3E+oYkVw7Pd99PMykLI=; b=Iy+AonqojkrW8rKIV3iaCTVCXCGDTy7haLOxTS468QgbAhuk81NQIp7kYWZHskLo6s v8sCPrmS67ugEEigbj1fwjQdlU8RKGwOO/eUToxWh16fJjtH/QhnDiUGh0FhHudjtVx/ coEpyt11LgRWe1SNGFFBvYZWHHPjeQjG5hOnqzu3Cr4OetheCAwq0JtAuDiWWAVj94tI uOjJnJyPXMyHjlxrzw/eNa6/zMYBiDOQ1GZaF0cBSSMAyJhDdFjnXvawtpTM/tYzX3Lh beQ3GoX5EjQwIB64IWMv93LWrndytwEQtQwba9QMabTYbWyrF0rHqfuGQlg1WEpBo22L X6Fw== 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=+xcssxkZTlEueyseAvWLLQTd3E+oYkVw7Pd99PMykLI=; b=rYDS4HrYpSYW5uEI+yy9eCuB2R5VYPFSaaHpm8MZZy98YdKZteqvL+DGQ+a/HQ3cIJ 6VQtuX1pePvDPtkkYF7Adk+sMKuO91uyHwBc807k86C64iESMHsuWWPQcWSs7vLjoR+w q3g+Gzznq4nR9MauRZSHD6Kjs2Zlefv6WS4PojStifGf04pClfbf54aoekNM1it29Z8x 5P1hW+hVWznCUWjf6zRULy81AOblFGYqh5MLJMY1FhCGN+Vh/DeF4W5z6ZPeEJGUsFPN ECW01HdgYbHeRzNK5MlR5yaHCI6a3WeHIA1welLUoBoBRf7dNkc2g5wRa5xPRxbfubIQ wY+w== X-Gm-Message-State: AOAM530iQ67C2+QwqFLEQsnhEgqq2BiizN6O1b8KLLuowYDi1CX1fohB Vggmkbz24OJvj2V7jxO9s5a0Fz9rR2Eui/Yl X-Google-Smtp-Source: ABdhPJwi/McjAR5PneaBPmW4CRufrgJrhsRVQ8oeQWMqZvCjg+NqlGDu+MFUmairIcko2zay8NCKPw== X-Received: by 2002:a63:e516:: with SMTP id r22mr9610343pgh.197.1634309224790; Fri, 15 Oct 2021 07:47:04 -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.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:47:04 -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, Toan Le , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-arm-kernel@lists.infradead.org (moderated list:PCI DRIVER FOR APPLIEDMICRO XGENE) Subject: [PATCH v2 24/24] PCI: xgene: Use PCI_ERROR_RESPONSE to specify hardware error Date: Fri, 15 Oct 2021 20:09:05 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Include PCI_ERROR_RESPONSE along with 0xffffffff in the comment to specify a hardware error. This makes finding where MMIO read error occurs easier. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pci-xgene.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c index e64536047b65..4b10794e1ba1 100644 --- a/drivers/pci/controller/pci-xgene.c +++ b/drivers/pci/controller/pci-xgene.c @@ -176,10 +176,10 @@ static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn, * Retry Status (CRS) logic: when CRS Software Visibility is * enabled and we read the Vendor and Device ID of a non-existent * device, the controller fabricates return data of 0xFFFF0001 - * ("device exists but is not ready") instead of 0xFFFFFFFF - * ("device does not exist"). This causes the PCI core to retry - * the read until it times out. Avoid this by not claiming to - * support CRS SV. + * ("device exists but is not ready") instead of + * 0xFFFFFFFF (PCI_ERROR_RESPONSE) ("device does not exist"). This causes + * the PCI core to retry the read until it times out. + * Avoid this by not claiming to support CRS SV. */ if (pci_is_root_bus(bus) && (port->version == XGENE_PCIE_IP_VER_1) && ((where & ~0x3) == XGENE_V1_PCI_EXP_CAP + PCI_EXP_RTCTL))