Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp718638pxb; Thu, 21 Oct 2021 08:12:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDtM4/zXq4w+7JHjzxKyyOxv5lll5a+WygquD3hiz5rKLRGPtcp7V/f8BbfS+g+RD5eVdh X-Received: by 2002:a62:1c52:0:b0:44c:f1c3:9cb5 with SMTP id c79-20020a621c52000000b0044cf1c39cb5mr6762883pfc.14.1634829150273; Thu, 21 Oct 2021 08:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634829150; cv=none; d=google.com; s=arc-20160816; b=IPyCku66Vv/LYBEAt9/dwXnwUDcF5WQimIybQk11WMwKC34AG2OKgOdZXAYGtAKy5F yuG7mr4JrQuDatmtweYS4sgI3wZ2inU38K3UaMkGm7I3x1uTQkJhiVm3TRdKCw1I/Hst XdiNYtpRPhZfDr/majAeYdBBYQGfZGra3kYCb5gcisUajaAKI9zyvMBFlDTBxdozHBxb Ji7Aqcq12rynwd4vbcQtoXnwDCb/4X5QZYLW69j9arKnoZS9LXgTNKDFAODstrE+HiRP lUUWwUn6I2khJE6+y427GZcDxBJ0GBQj1YjlJC+VQNmK7KxyrMuQh62wLfCmc3OWW+fh E4Ag== 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=nBZl56cwXIMS5MrYNm3KnDDaTcN98ZdLkMKDc078ljY=; b=eTOVXBfiJqxRy1QncyICTyUYvLzsaEy1SdSJGN1ufDvhof1Yga+kOEEK29St4fSx+f PqVuWrWT+qn68D1cv4sGHo0ms2Uqyvjoqnuk4Lc41JgMrAoWZ/W0cMG6VRaFXXk8Ez/Y 8/DoduKtbS4LnclvREtvlJHbbCcnrOrQ99pZilD3HOqv1+AKsCNzpYZjLhccRGXfVas9 Fb8iScCb5fMxmZxcl0T7Dn8pBiIuj6hDq+sLEt89gYyftS8AIrUueWl8W2d17ijVYkXm u7iCvpF53ceE/r0wDzSOcQUWKVzLJVrD+G6Gw2vYBASk9KUjqYeGTkSfep597pfPd/hk baTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HdkoSvfc; 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 ch19si12425808pjb.47.2021.10.21.08.12.17; Thu, 21 Oct 2021 08:12:30 -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=HdkoSvfc; 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 S231769AbhJUPMj (ORCPT + 99 others); Thu, 21 Oct 2021 11:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231761AbhJUPMi (ORCPT ); Thu, 21 Oct 2021 11:12:38 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9DFCC061220; Thu, 21 Oct 2021 08:10:22 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id u6so644303ple.2; Thu, 21 Oct 2021 08:10:22 -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=nBZl56cwXIMS5MrYNm3KnDDaTcN98ZdLkMKDc078ljY=; b=HdkoSvfcTUXobi9Chvh9ved3HASn3xYwiDKYDXWN4rdB7A+yhWpPRtnoUM4EhsGWnI RyMbK4qETKb+a9y3fsQ4FTniSkNxvQUJMgkVUsTzlcsew7Fo8MCnGi00jDpbApEI3UyX Zu4yr3qeC01mj4DlX3sK38LUlIy0jakLtEB+vYwx5i1O6kPJSTYohXR9kobvKdBWI8rJ UTL2AhCcunsJ78c21ku9rLh81UciA1R+N1nnHnJsZ6cQcIarQy8m0iPBx8ztP55G4Kv7 TwPKY8qwmWy3Tldytyg5Zq94nKgpgK/qRdr/w6yzCSWpkFM2iOEIRQ6P0W4wlT13zVd+ UKow== 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=nBZl56cwXIMS5MrYNm3KnDDaTcN98ZdLkMKDc078ljY=; b=yvgjZDWVLCrd/oKsqTM/4op/m2RB8eEgYKUJZ6k/ksIl/idWLNR2Uxw3Wd0lGWDvCU torTXjizNwRdLqyEQoHcHAg6GiLk5VST0mPLb1oZpipkWCVmGCgjLdfNG3eHODjFZinY YtchGDfzsYa/J+cMWHPrSARDonkizXYVmUSJL64fOMwlkqmF5cx9CKV9hryElfto4Mwo 2Y/5iPSh67Yr0AusIGPTukbWAzngg3Dxkj51iQIUNO9tiPwUdDMlH8lHxT6M5Haileyq BdEk3sb+q1c76vEp2QfRWuuWBU9gFLO/5yoGz5I4YelrGLfjKD6m8H3CdoIyYj9jEX5H 4O/Q== X-Gm-Message-State: AOAM5312+U5wkAlFf+pMX5hVohnwAWi/GdGheaT9HDr62YQJfXl46QSC QoLYZVBac5T7fL0J4KawDqk= X-Received: by 2002:a17:90b:4d88:: with SMTP id oj8mr5119693pjb.175.1634829022270; Thu, 21 Oct 2021 08:10:22 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:29a4:d874:a949:6890:f95f]) by smtp.gmail.com with ESMTPSA id c9sm5508027pgq.58.2021.10.21.08.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 08:10:21 -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, skhan@linuxfoundation.org, Rob Herring Subject: [PATCH v3 04/25] PCI: Remove redundant error fabrication when device read fails Date: Thu, 21 Oct 2021 20:37:29 +0530 Message-Id: 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. Reviewed-by: Rob Herring 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 a6bcbad04d89..2705a4412e69 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