Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1371334pxb; Sat, 16 Oct 2021 08:17:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX14Iy6gY2qV+y0jYzF2/USgL5PbTFfLYxkl8tblORyrA2ihVaa7gz4EH76ScTRzU67+rH X-Received: by 2002:a17:902:b205:b0:13d:b0a1:da90 with SMTP id t5-20020a170902b20500b0013db0a1da90mr17422707plr.26.1634397468995; Sat, 16 Oct 2021 08:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634397468; cv=none; d=google.com; s=arc-20160816; b=gUysm1FUG1H4aNoh6OJiL2BQtK4W9A12hbjA7vCRrC72xyuOUQ0w/0IyrQXLhwPWcb oMdUpWLNtwt0MRg8JUa5rItc9641yMz+HxrKJuA1obn4j9umpwl8+eJRczcWyx99dS0A t4LmyslHmQbaERLl7OHdncB0kN/Qo0BNX3uFiwXkS6AO/rU1xZk43pfbE+7ieEGpWn/y cvj0WVoAvwvUgUMXDUn1mMN0STitj2lKO2ofBuk6AoDgfXONAHRdedzWcvpjBwZLesoj iF9NdATLAO5W6dkSlVy80TVL0tHd7u9cNBan2O86n1ytVMxsT44hMUruxK0HTRNPAA7m k4mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bPWEij9k//B/evooKOYyCZIPd/p9FY3S9h0pgeJmYgg=; b=eEEXXXC+MhE53FdENY6L7hgzCM6kC7iKSb3Su5y8O5KimGv0XClRbcp4LWTQUCjQwf fKYbEm1DKiYz71I/J9JGGzRD6kfZYVSt/cVZ4TomFNmsYyyOMIk0flPbie+kd4uLWJEd 51M8yRXd4zw23FfVFpaPITR5Ex/Ylaa4y9qKnLpNxCnAHd/sATsrxOC4yKiGgUn8pxkk Hps8adhFI7zSrys0TRFppDcZWL6t4zJgQVZygt5lHtqCKUgI17t83RVZ49TaR/IFe4gY NH8m/KFwOIiyBCgga9IDew2dxA4IhsxJRK+JIt0rqovwnUEmKfbNBRbzZcIYk0lyBT7J 8IPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Km2uZRbe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si10625369plr.110.2021.10.16.08.17.19; Sat, 16 Oct 2021 08:17:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Km2uZRbe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237032AbhJOOne (ORCPT + 99 others); Fri, 15 Oct 2021 10:43:34 -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-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An MMIO read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. 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/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); -- 2.25.1