From mboxrd@z Thu Jan 1 00:00:00 1970 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 1128DC433EF for ; Mon, 11 Oct 2021 17:48:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D13FC60E05 for ; Mon, 11 Oct 2021 17:48:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D13FC60E05 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0+z8PwiQDkc86kyXdljIVS2AdJeA9GjTRXUg950ucIQ=; b=rNCW5yMnLzUrCg Tu0Rm7iUePMbrdjBaV8++e/YtQBL+AXCmgbZpDAQ3XoxL6/VbdppoCMugrPOS8W8sXeqwEg5Ax8g/ Mx3xut280yeQd6wK9sPUkqXzqUmgkuyF1/Ai/nYbeLtUf4dXRhv9e5qw2qF2tCaYev2anYFytKeTt AGlrg5gDgGfevStoSiahu9/e/eOecdmLBbGz1BQDaFgSz9nzATQmXCrxUE3IkGm/7A/6Vv/dsiGyt iQ6DU8aawkuTRF4SU0yjLKH6ZSOJFcvnrNxnBoaQGKK1qpdFeU98VFC/7GpfAotNZtleVo2VPX4Yu F6mLcq2yGdhaALXqOv8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZzMo-00AHCq-7u; Mon, 11 Oct 2021 17:45:38 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZzMk-00AHCH-67 for linux-arm-kernel@lists.infradead.org; Mon, 11 Oct 2021 17:45:35 +0000 Received: by mail-pl1-x634.google.com with SMTP id f21so3060000plb.3 for ; Mon, 11 Oct 2021 10:45:33 -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=rvyIILinTPLJ5IGz12ZGgmNprHQpAgzhPfKruj1QRTQ=; b=JrP1Ohv+cYjrx5Jh/JaA7MwB/9gvY+X1vWCy+bHL75WvvGHkjD9CJL50NjhZAIFjel W5Vd5bG4LFgS3+ZaYLS/EccdCLVOWQmE8zFXKq9L9XxrEpD9Ed9OBzeOpnYV8MWVt5m7 RovxeDrvhFMwn64Ldcfe+yGWQSQFgoqFSBOUS5wMtlPZCeU6300+7LyIS5TCDPt/CuPV Z3c+Xrw5aDYy7ivX6Mwnx6Hs79JA+/O1VJyrmjMtNG7vgfCyYpC41G+WQDwijKoIxiLC bgJYonkUnoYeHr/pMqT80xLaX/Zv3upaDGR6IG3ul+W3X++nwnJbyRcvjNMSuijQGKSN dzgQ== 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=rvyIILinTPLJ5IGz12ZGgmNprHQpAgzhPfKruj1QRTQ=; b=F94N8l0H/QSezIvw5yb3COQ//wN6evlQvEGf/6ruHQUdzZKK/FHb7YLA4fL9waEgMs BKNME5DQBTTPJjAhEMWRK2YUoj5nHjVz4r0/fIQgRwX0nEMPv7xi2faZZfJCH5G9w+KK +sazrGuNHcRLRuVV5yHxih00ttqfcgipCuldO1e4uGGmCzPEnTpZjjs5NI5+TItoIIsw rYEraYMSY2yVhyCfSzpc2aYbWXt27oY6+Ja0sxAU0y8bKsvFUbIkOTuRCgCZf4SOJgMz BtfM1KwNNCtE9yEJTShzziuygdqXe1BqMGZL0vwOqRHlErM9vU9TMZekYUMMzg8ocn2/ SZAg== X-Gm-Message-State: AOAM533x5ET+8lh7S3YiDY6BXHF0yl+lAL+8u5cAJcXQvG2Oab2/Usys eFO+1QQcUWbxIHOROgVu6ZY= X-Google-Smtp-Source: ABdhPJxj6ob2ZpfsVy9xfdI99KTdNW8a1qGjYI7I2upgWYUEMQtqA6qVYw3yibmKLLl8AKLPxR4CHQ== X-Received: by 2002:a17:903:2451:b0:13e:f1ef:d819 with SMTP id l17-20020a170903245100b0013ef1efd819mr25566918pls.85.1633974333299; Mon, 11 Oct 2021 10:45:33 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:9f95:848b:7cc8:d852:ad42]) by smtp.gmail.com with ESMTPSA id k22sm8395232pfi.149.2021.10.11.10.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 10:45:32 -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=20Wilczy=C5=84ski?= , linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/22] PCI: thunder: Use SET_PCI_ERROR_RESPONSE() when device not found Date: Mon, 11 Oct 2021 23:15:10 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211011_104534_272397_41057A14 X-CRM114-Status: GOOD ( 15.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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, when a faulty read occurs. 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 | 20 ++++++++++---------- drivers/pci/controller/pci-thunder-pem.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/pci/controller/pci-thunder-ecam.c b/drivers/pci/controller/pci-thunder-ecam.c index ffd84656544f..4c57ad2aa9aa 100644 --- a/drivers/pci/controller/pci-thunder-ecam.c +++ b/drivers/pci/controller/pci-thunder-ecam.c @@ -42,7 +42,7 @@ 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; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } v = readl(addr); @@ -57,7 +57,7 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */ if (!addr) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } barl_orig = readl(addr + 0); @@ -73,7 +73,7 @@ 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; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } v = readl(addr); /* EA entry-3. Base-H */ @@ -105,7 +105,7 @@ 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; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } @@ -136,7 +136,7 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, addr = bus->ops->map_bus(bus, devfn, 0xc); if (!addr) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } @@ -147,7 +147,7 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, addr = bus->ops->map_bus(bus, devfn, 8); if (!addr) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } @@ -177,7 +177,7 @@ 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; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } @@ -197,7 +197,7 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, addr = bus->ops->map_bus(bus, devfn, 0x70); if (!addr) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } /* E_CAP */ @@ -212,7 +212,7 @@ 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; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } v = readl(addr); @@ -269,7 +269,7 @@ 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; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } v = readl(addr); diff --git a/drivers/pci/controller/pci-thunder-pem.c b/drivers/pci/controller/pci-thunder-pem.c index 0660b9da204f..a463a1b61f23 100644 --- a/drivers/pci/controller/pci-thunder-pem.c +++ b/drivers/pci/controller/pci-thunder-pem.c @@ -42,7 +42,7 @@ static int thunder_pem_bridge_read(struct pci_bus *bus, unsigned int devfn, struct thunder_pem_pci *pem_pci = (struct thunder_pem_pci *)cfg->priv; if (devfn != 0 || where >= 2048) { - *val = ~0; + SET_PCI_ERROR_RESPONSE(val); return PCIBIOS_DEVICE_NOT_FOUND; } -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel