From patchwork Fri Oct 15 14:35: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: 1541730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=RPL7BCrK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HW83G1Cnfz9sX3 for ; Sat, 16 Oct 2021 01:36:25 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HW83F5wNBz3c55 for ; Sat, 16 Oct 2021 01:36:25 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=RPL7BCrK; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::436; helo=mail-pf1-x436.google.com; envelope-from=naveennaidu479@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=RPL7BCrK; dkim-atps=neutral Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HW83106dzz3bT7 for ; Sat, 16 Oct 2021 01:36:11 +1100 (AEDT) Received: by mail-pf1-x436.google.com with SMTP id o133so8513970pfg.7 for ; Fri, 15 Oct 2021 07:36:11 -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:mime-version :content-transfer-encoding; bh=A1+buzEnWHFfl/ZaWbrWJXy+M9IGPXk9SXcGFxZnAfs=; b=RPL7BCrK2/jYy7dA9EeV9fzfOZdBvV8FM1iW0gA441nrIxQ1xg44AUgbJZXbJN0dLZ h8GZ848pgkw/SpggGk3Zko6r2dmRVDyVgm4Qzpu+JQZBNG9uUyRXcLcXSMbKPNZdxitc /r2CDWerhToBA5WnN6QULeO+FTZ6euC8cju6Uchf4G5vUgen13X2ecOGczouC8L9W32b 3MlEbvo6LetX8BjoFIfC7+6AN6NRzKguY9vM57zS01VuXgIlLpDVdVL+ConAEe3b3USo OdQi9coc7ijOlKl5z4CG4gkXjcOES8tkv7Dlj3zY2sw4Iv3ZuUxfFKTnCjHiYeOB4D8z dzyg== 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:mime-version :content-transfer-encoding; bh=A1+buzEnWHFfl/ZaWbrWJXy+M9IGPXk9SXcGFxZnAfs=; b=zaMpchFHpmoRGHos+uimeXHp9LEV8lHwVdAHBn9hPgIXvQ2Xvh5otVFTZgi1d7b6T3 F/f9KJOmViR+F8MX7/V/zU4UTaFgjsw5Ir4rg19WK0Uj++4dBuxYqT1Wcs/AE4VFCUj6 GpqDSJRKf/O0ATgnrsgaKNa/QsDO2wKRfTc61k2CUk8P7l5bAu7zBZB+y8zUYyWv+Fza LYcK6X2y6P53vln63h07wNiJixKIMkkFZkgVPdQ2n0mbu/0F1XDSZm1Pn2l/iRP7Kl57 LpXSdzE2Pa6F/iRLSM9272PgBNFb86Pk38wSz1DeA/MZZFDEKq3FhAHyegl9q6xNrYB2 X8Zg== X-Gm-Message-State: AOAM531Oupmo41Ep5u/E4/4fLum8XPQd1PstjaX2mjV65+xXCG8dty4o CeLZEg8JRSGmO3cjtLMn5/M= X-Google-Smtp-Source: ABdhPJyWuQ1K1JxflSMa0Mke7WMw5bxh8bvQ3ExR+gido75xKDvVtio4NGskzHymTTSJ5ZhB267d6g== X-Received: by 2002:a62:ed01:0:b0:44d:6aa6:30eb with SMTP id u1-20020a62ed01000000b0044d6aa630ebmr12041882pfh.53.1634308567962; Fri, 15 Oct 2021 07:36:07 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:4806:9a51:7f4b:9b5c:337a]) by smtp.gmail.com with ESMTPSA id x7sm11536941pjg.5.2021.10.15.07.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:36:07 -0700 (PDT) From: Naveen Naidu To: bhelgaas@google.com Subject: [PATCH v2 00/24] Unify PCI error response checking Date: Fri, 15 Oct 2021 20:05:51 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , linux-hyperv@vger.kernel.org, linux-samsung-soc@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , linux-rockchip@lists.infradead.org, linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Naveen Naidu , linux-mediatek@lists.infradead.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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. This patch series adds PCI_ERROR_RESPONSE definition and other helper definition SET_PCI_ERROR_RESPONSE and RESPONSE_IS_PCI_ERROR and uses it where appropriate to make these checks consistent and easier to find. This helps unify PCI error response checking and make error check consistent and easier to find. This series also ensures that the error response fabrication now happens in the PCI_OP_READ and PCI_USER_READ_CONFIG. This removes the responsibility from controller drivers to do the error response setting. Patch 1: - Adds the PCI_ERROR_RESPONSE and other related defintions - All other patches are dependent on this patch. This patch needs to be applied first, before the others Patch 2: - Error fabrication happens in PCI_OP_READ and PCI_USER_READ_CONFIG whenever the data read via the controller driver fails. - This patch needs to be applied before, Patch 4/24 to Patch 15/24 are applied. Patch 3: - Uses SET_PCI_ERROR_RESPONSE() when device is not found and RESPONSE_IS_PCI_ERROR() to check hardware read from the hardware. Patch 4 - 15: - Removes redundant error fabrication that happens in controller drivers when the read from a PCI device fails. - These patches are dependent on Patch 2/24 of the series. - These can be applied in any order. Patch 16 - 22: - Uses RESPONSE_IS_PCI_ERROR() to check the reads from hardware - Patches can be applied in any order. Patch 23 - 24: - Edits the comments to include PCI_ERROR_RESPONSE alsong with 0xFFFFFFFF, so that it becomes easier to grep for faulty hardware reads. Changelog ========= v2: - Instead of using SET_PCI_ERROR_RESPONSE in all controller drivers to fabricate error response, only use them in PCI_OP_READ and PCI_USER_READ_CONFIG Naveen Naidu (24): [PATCH 1/24] PCI: Add PCI_ERROR_RESPONSE and it's related definitions [PATCH 2/24] PCI: Set error response in config access defines when ops->read() fails [PATCH 3/24] PCI: Unify PCI error response checking [PATCH 4/24] PCI: Remove redundant error fabrication when device read fails [PATCH 5/24] PCI: thunder: Remove redundant error fabrication when device read fails [PATCH 6/24] PCI: iproc: Remove redundant error fabrication when device read fails [PATCH 7/24] PCI: mediatek: Remove redundant error fabrication when device read fails [PATCH 8/24] PCI: exynos: Remove redundant error fabrication when device read fails [PATCH 9/24] PCI: histb: Remove redundant error fabrication when device read fails [PATCH 10/24] PCI: kirin: Remove redundant error fabrication when device read fails [PATCH 11/24] PCI: aardvark: Remove redundant error fabrication when device read fails [PATCH 12/24] PCI: mvebu: Remove redundant error fabrication when device read fails [PATCH 13/24] PCI: altera: Remove redundant error fabrication when device read fails [PATCH 14/24] PCI: rcar: Remove redundant error fabrication when device read fails [PATCH 15/24] PCI: rockchip: Remove redundant error fabrication when device read fails [PATCH 16/24] PCI/ERR: Use RESPONSE_IS_PCI_ERROR() to check read from hardware [PATCH 17/24] PCI: vmd: Use RESPONSE_IS_PCI_ERROR() to check read from hardware [PATCH 18/24] PCI: pciehp: Use RESPONSE_IS_PCI_ERROR() to check read from hardware [PATCH 19/24] PCI/DPC: Use RESPONSE_IS_PCI_ERROR() to check read from hardware [PATCH 20/24] PCI/PME: Use RESPONSE_IS_PCI_ERROR() to check read from hardware [PATCH 21/24] PCI: cpqphp: Use RESPONSE_IS_PCI_ERROR() to check read from hardware [PATCH 22/24] PCI: keystone: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH 23/24] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error [PATCH 24/24] PCI: xgene: Use PCI_ERROR_RESPONSE to specify hardware error drivers/pci/access.c | 36 ++++++++-------- drivers/pci/controller/dwc/pci-exynos.c | 4 +- drivers/pci/controller/dwc/pci-keystone.c | 4 +- drivers/pci/controller/dwc/pcie-histb.c | 4 +- drivers/pci/controller/dwc/pcie-kirin.c | 4 +- drivers/pci/controller/pci-aardvark.c | 10 +---- drivers/pci/controller/pci-hyperv.c | 2 +- drivers/pci/controller/pci-mvebu.c | 8 +--- drivers/pci/controller/pci-thunder-ecam.c | 46 +++++++-------------- drivers/pci/controller/pci-thunder-pem.c | 4 +- drivers/pci/controller/pci-xgene.c | 8 ++-- drivers/pci/controller/pcie-altera.c | 4 +- drivers/pci/controller/pcie-iproc.c | 4 +- drivers/pci/controller/pcie-mediatek.c | 11 +---- drivers/pci/controller/pcie-rcar-host.c | 4 +- drivers/pci/controller/pcie-rockchip-host.c | 4 +- drivers/pci/controller/vmd.c | 2 +- drivers/pci/hotplug/cpqphp_ctrl.c | 4 +- drivers/pci/hotplug/pciehp_hpc.c | 10 ++--- drivers/pci/pci.c | 10 ++--- drivers/pci/pcie/dpc.c | 4 +- drivers/pci/pcie/pme.c | 4 +- drivers/pci/probe.c | 10 ++--- include/linux/pci.h | 9 ++++ 24 files changed, 87 insertions(+), 123 deletions(-)