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 BEAB0C43217 for ; Thu, 18 Nov 2021 14:04:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A925560EFD for ; Thu, 18 Nov 2021 14:04:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbhKROHl (ORCPT ); Thu, 18 Nov 2021 09:07:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbhKROHY (ORCPT ); Thu, 18 Nov 2021 09:07:24 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D30C061570; Thu, 18 Nov 2021 06:04:19 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id nh10-20020a17090b364a00b001a69adad5ebso5808092pjb.2; Thu, 18 Nov 2021 06:04:19 -0800 (PST) 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=U2AsFUKZLXJxwq1AOzr4+SXvMtjFGsxO8ExXuBT8byCkoGnUJsmIHIE9RaBdrO41Rl 8huvDZAw5E9R6TLbkkzhiG0KK3ozoaeqyNAOCPgfaVXDO9RiMVzPYQO8kM0jpDHGImp7 mGfT7LqSqvp0vGwEav+2G8mOB/HtIp0+n1d5lT7on4J/eCJ5BhjDOqpUJNodLcLk69LE dsQIh5VyqtbSeUIvPCt28VdXKYnJ3AC6q5Y7i7rFWNmPQzuQYztj2GETNDY5XVCxMBRi +q4uDB/9eeOsa42CQY/qDnZw4RfX5KuaXc2wcxRoWzNfS6iF4pK1CZwYlyHMbvLRGlQR cSRg== 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=bD7wvHy6oVttcx5ZhlwIRXXHLOOwdWDb2BhXJWg1BJMsbi42RzjjtEIFTxXqKhFCYV gs3s60pkVgew69ZrxzULUkJAJonsUpRxxA0nMqY5sQRPyNKiTMRjZw4piSiny/uymuA9 Gd1ZWowlQLbV3bk22DQWD5pvtBN97TWQpJ3gVBwWQkJJjDr5A1wgmyT3LSRqQDslWJm1 G6FvOypJpWb8+tiR216BQVjopEWwEOmnKQ0yJhAHbeCbLZH1AaH0XswlpsqexM6biFw8 HuTLtOgCOELCmfq3uV2m1ne5HheGOwtAk86ftQ0IRENThiIvYY0/CU+jpsOEOCjYcwYe rfKQ== X-Gm-Message-State: AOAM533nJeIw+Ytp8qeV6WlQMKxSkwzNvBSYLfGx1Jb3NaVTs/91MJrk tcjyAbrIpwjc2GiSX7KhK5Y= X-Google-Smtp-Source: ABdhPJxcxZ6cnPohSI0/EFdUtlWDJVxg7caCTPrSiqQO3khzZ31HBiXw2/qZEqHgRBRrRj1t2soQnA== X-Received: by 2002:a17:902:9303:b0:143:d6c7:babc with SMTP id bc3-20020a170902930300b00143d6c7babcmr21567418plb.58.1637244258545; Thu, 18 Nov 2021 06:04:18 -0800 (PST) Received: from localhost.localdomain ([2406:7400:63:2c47:5ffe:fc34:61f0:f1ea]) by smtp.gmail.com with ESMTPSA id x14sm2822878pjl.27.2021.11.18.06.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:04:18 -0800 (PST) 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, linux-hyperv@vger.kernel.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Rob Herring , =?UTF-8?q?Pali=20Roh=C3=A1r?= , skhan@linuxfoundation.org, Robert Richter , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM IPROC ARM ARCHITECTURE), Ryder Lee , Jianjun Wang , Matthias Brugger , Jingoo Han , Krzysztof Kozlowski , Shawn Guo , Xiaowei Song , Binghui Wang , Thomas Petazzoni , Joyce Ooi , Marek Vasut , Yoshihiro Shimoda , Shawn Lin , Heiko Stuebner , Nirmal Patel , Jonathan Derrick , Kuppuswamy Sathyanarayanan , Lukas Wunner , Amey Narkhede , Russell Currey , "Oliver O'Halloran" , Sean V Kelley , Qiuxu Zhuo , Marc Zyngier , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Toan Le , Kishon Vijay Abraham I Subject: [PATCH v4 00/25] Unify PCI error response checking Date: Thu, 18 Nov 2021 19:33:10 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@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. This patch series adds PCI_ERROR_RESPONSE definition and other helper definition PCI_SET_ERROR_RESPONSE and PCI_POSSIBLE_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 PCI_SET_ERROR_RESPONSE() when device is not found 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 PCI_POSSIBLE_ERROR() to check the reads from hardware - Patches can be applied in any order. Patch 23 - 25: - Edits the comments to include PCI_ERROR_RESPONSE alsong with 0xFFFFFFFF, so that it becomes easier to grep for faulty hardware reads. Changelog ========= v4: - Rename SET_PCI_ERROR_RESPONSE to PCI_SET_ERROR_RESPONSE - Rename RESPONSE_IS_PCI_ERROR to PCI_POSSIBLE_ERROR v3: - Change RESPONSE_IS_PCI_ERROR macro definition - Fix the macros, Add () around macro parameters - Fix alignment issue in Patch 2/24 - Add proper receipients for all the patches 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 (25): [PATCH v4 1/25] PCI: Add PCI_ERROR_RESPONSE and it's related definitions [PATCH v4 2/25] PCI: Set error response in config access defines when ops->read() fails [PATCH v4 3/25] PCI: Use PCI_SET_ERROR_RESPONSE() when device not found [PATCH v4 4/25] PCI: Remove redundant error fabrication when device read fails [PATCH v4 5/25] PCI: thunder: Remove redundant error fabrication when device read fails [PATCH v4 6/25] PCI: iproc: Remove redundant error fabrication when device read fails [PATCH v4 7/25] PCI: mediatek: Remove redundant error fabrication when device read fails [PATCH v4 8/25] PCI: exynos: Remove redundant error fabrication when device read fails [PATCH v4 9/25] PCI: histb: Remove redundant error fabrication when device read fails [PATCH v4 10/25] PCI: kirin: Remove redundant error fabrication when device read fails [PATCH v4 11/25] PCI: aardvark: Remove redundant error fabrication when device read fails [PATCH v4 12/25] PCI: mvebu: Remove redundant error fabrication when device read fails [PATCH v4 13/25] PCI: altera: Remove redundant error fabrication when device read fails [PATCH v4 14/25] PCI: rcar: Remove redundant error fabrication when device read fails [PATCH v4 15/25] PCI: rockchip: Remove redundant error fabrication when device read fails [PATCH v4 16/25] PCI/ERR: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 17/25] PCI: vmd: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 18/25] PCI: pciehp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 19/25] PCI/DPC: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 20/25] PCI/PME: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 21/25] PCI: cpqphp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 22/25] PCI: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 23/25] PCI: keystone: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 24/25] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error [PATCH v4 25/25] PCI: xgene: Use PCI_ERROR_RESPONSE to specify hardware error drivers/pci/access.c | 32 +++++++------- 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 | 4 +- 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, 84 insertions(+), 116 deletions(-) -- 2.25.1 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 717B2C433F5 for ; Thu, 18 Nov 2021 14:04:24 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 F2B8061AE2 for ; Thu, 18 Nov 2021 14:04:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2B8061AE2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A5F914035D; Thu, 18 Nov 2021 14:04:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4vco7ZgJSjFq; Thu, 18 Nov 2021 14:04:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id B58AE40295; Thu, 18 Nov 2021 14:04:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 88DC6C001E; Thu, 18 Nov 2021 14:04:22 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2C650C0012 for ; Thu, 18 Nov 2021 14:04:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 00DF24025F for ; Thu, 18 Nov 2021 14:04:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RTGXqzfoCyct for ; Thu, 18 Nov 2021 14:04:19 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by smtp2.osuosl.org (Postfix) with ESMTPS id A177D40245 for ; Thu, 18 Nov 2021 14:04:19 +0000 (UTC) Received: by mail-pl1-x62a.google.com with SMTP id n8so5333246plf.4 for ; Thu, 18 Nov 2021 06:04:19 -0800 (PST) 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=U2AsFUKZLXJxwq1AOzr4+SXvMtjFGsxO8ExXuBT8byCkoGnUJsmIHIE9RaBdrO41Rl 8huvDZAw5E9R6TLbkkzhiG0KK3ozoaeqyNAOCPgfaVXDO9RiMVzPYQO8kM0jpDHGImp7 mGfT7LqSqvp0vGwEav+2G8mOB/HtIp0+n1d5lT7on4J/eCJ5BhjDOqpUJNodLcLk69LE dsQIh5VyqtbSeUIvPCt28VdXKYnJ3AC6q5Y7i7rFWNmPQzuQYztj2GETNDY5XVCxMBRi +q4uDB/9eeOsa42CQY/qDnZw4RfX5KuaXc2wcxRoWzNfS6iF4pK1CZwYlyHMbvLRGlQR cSRg== 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=VjdkrJDWmNUWpnnH+Ps4v91RumfNTzz9p1cyazoPFllWFNIMPhTREYADjpKFWoPFVc UaL9uml39mXzJLjuicsN23nZqFFVEkju7MtSg8JFwSZ2Gj51eddETnwDVefk3PSMW0I0 LjTAfIw9GydywJwwiaXT1xiwA5nZFJ5gY3ptuIQaYKUy41GSCYLvaNw9vQmNX2D5dbur v5gSXCxrnRFwfq/nGH08dbeZNbaV/9PPoLwMhTbBogvhZKjDVRI3O/qjvISUrD8eb8qk eYqfJEqRx65kbNC/aUsHd2FnyKwBy5RKMN0na3ytdQ+fYgnZRmIa2ZzX1SdVqSxrzsD8 ZneA== X-Gm-Message-State: AOAM531zBrqLlmoswmaTndxZUjEPS1/6eTLKreCuqdPCIp0alnD8GWip 66VX5VR6m9VkVO/ac2EBekE= X-Google-Smtp-Source: ABdhPJxcxZ6cnPohSI0/EFdUtlWDJVxg7caCTPrSiqQO3khzZ31HBiXw2/qZEqHgRBRrRj1t2soQnA== X-Received: by 2002:a17:902:9303:b0:143:d6c7:babc with SMTP id bc3-20020a170902930300b00143d6c7babcmr21567418plb.58.1637244258545; Thu, 18 Nov 2021 06:04:18 -0800 (PST) Received: from localhost.localdomain ([2406:7400:63:2c47:5ffe:fc34:61f0:f1ea]) by smtp.gmail.com with ESMTPSA id x14sm2822878pjl.27.2021.11.18.06.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:04:18 -0800 (PST) From: Naveen Naidu To: bhelgaas@google.com Subject: [PATCH v4 00/25] Unify PCI error response checking Date: Thu, 18 Nov 2021 19:33:10 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Cc: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , linux-hyperv@vger.kernel.org, Heiko Stuebner , linux-pci@vger.kernel.org, Shawn Lin , Binghui Wang , Kuppuswamy Sathyanarayanan , Oliver O'Halloran , Thomas Petazzoni , Russell Currey , Lorenzo Pieralisi , Toan Le , "K. Y. Srinivasan" , Nirmal Patel , Marek Vasut , Rob Herring , Wei Liu , linux-samsung-soc@vger.kernel.org, Marc Zyngier , Joyce Ooi , Dexuan Cui , Kishon Vijay Abraham I , Jianjun Wang , linux-rockchip@lists.infradead.org, "maintainer:BROADCOM IPROC ARM ARCHITECTURE" , Jonathan Derrick , Xiaowei Song , linux-kernel-mentees@lists.linuxfoundation.org, Robert Richter , Sean V Kelley , Ray Jui , Haiyang Zhang , Ryder Lee , linux-mediatek@lists.infradead.org, Matthias Brugger , Stephen Hemminger , linux-arm-kernel@lists.infradead.org, Qiuxu Zhuo , Scott Branden , linuxppc-dev@lists.ozlabs.org, Yoshihiro Shimoda , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Lukas Wunner , Jingoo Han , Shawn Guo , =?UTF-8?q?Pali=20Roh=C3=A1r?= X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 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 Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" 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 PCI_SET_ERROR_RESPONSE and PCI_POSSIBLE_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 PCI_SET_ERROR_RESPONSE() when device is not found 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 PCI_POSSIBLE_ERROR() to check the reads from hardware - Patches can be applied in any order. Patch 23 - 25: - Edits the comments to include PCI_ERROR_RESPONSE alsong with 0xFFFFFFFF, so that it becomes easier to grep for faulty hardware reads. Changelog ========= v4: - Rename SET_PCI_ERROR_RESPONSE to PCI_SET_ERROR_RESPONSE - Rename RESPONSE_IS_PCI_ERROR to PCI_POSSIBLE_ERROR v3: - Change RESPONSE_IS_PCI_ERROR macro definition - Fix the macros, Add () around macro parameters - Fix alignment issue in Patch 2/24 - Add proper receipients for all the patches 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 (25): [PATCH v4 1/25] PCI: Add PCI_ERROR_RESPONSE and it's related definitions [PATCH v4 2/25] PCI: Set error response in config access defines when ops->read() fails [PATCH v4 3/25] PCI: Use PCI_SET_ERROR_RESPONSE() when device not found [PATCH v4 4/25] PCI: Remove redundant error fabrication when device read fails [PATCH v4 5/25] PCI: thunder: Remove redundant error fabrication when device read fails [PATCH v4 6/25] PCI: iproc: Remove redundant error fabrication when device read fails [PATCH v4 7/25] PCI: mediatek: Remove redundant error fabrication when device read fails [PATCH v4 8/25] PCI: exynos: Remove redundant error fabrication when device read fails [PATCH v4 9/25] PCI: histb: Remove redundant error fabrication when device read fails [PATCH v4 10/25] PCI: kirin: Remove redundant error fabrication when device read fails [PATCH v4 11/25] PCI: aardvark: Remove redundant error fabrication when device read fails [PATCH v4 12/25] PCI: mvebu: Remove redundant error fabrication when device read fails [PATCH v4 13/25] PCI: altera: Remove redundant error fabrication when device read fails [PATCH v4 14/25] PCI: rcar: Remove redundant error fabrication when device read fails [PATCH v4 15/25] PCI: rockchip: Remove redundant error fabrication when device read fails [PATCH v4 16/25] PCI/ERR: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 17/25] PCI: vmd: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 18/25] PCI: pciehp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 19/25] PCI/DPC: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 20/25] PCI/PME: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 21/25] PCI: cpqphp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 22/25] PCI: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 23/25] PCI: keystone: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 24/25] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error [PATCH v4 25/25] PCI: xgene: Use PCI_ERROR_RESPONSE to specify hardware error drivers/pci/access.c | 32 +++++++------- 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 | 4 +- 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, 84 insertions(+), 116 deletions(-) -- 2.25.1 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees 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 0B46FC433F5 for ; Thu, 18 Nov 2021 14:04:32 +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 C8CA360EFD for ; Thu, 18 Nov 2021 14:04:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C8CA360EFD 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: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:In-Reply-To:References: List-Owner; bh=8+Fp+/HyFpiaPu488V17RlIP1Lxa7CTzr8zEMKFLPBE=; b=XYl8pah9ZHk+aL EXeNLd0ilYJ3N57C2jFjioI/gbua+3x7UgssrBUMzAD3hWqIpUZwhhLtEqXsOdvy23nfbDRQT64tK P4BE4vz4qHLiIpDRBXo5KkktTmUJ/AMuoxQ45GairJG9gsAhGfZLazj9XnS+lt8dvobNhLGoaEM2c er8jvxM5t3JCs3lLfw2tEGaFW1yn+gy7vakT1nohduJBbVU69yWT88IcMM9Ro8RbMIwFkPximKbU6 wJqHgkyk8UnUry+uwpeG7yoNJ4DBnUEQFvUyV9+rI2pmNqFiUclgFLL9ht94QKyHMTA2RNAIMPGIu YMgYSywVFNgFwwPhyqsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mni1X-007zy6-PK; Thu, 18 Nov 2021 14:04:23 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mni1T-007zwL-Tt; Thu, 18 Nov 2021 14:04:21 +0000 Received: by mail-pj1-x1035.google.com with SMTP id o6-20020a17090a0a0600b001a64b9a11aeso5783162pjo.3; Thu, 18 Nov 2021 06:04:19 -0800 (PST) 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=U2AsFUKZLXJxwq1AOzr4+SXvMtjFGsxO8ExXuBT8byCkoGnUJsmIHIE9RaBdrO41Rl 8huvDZAw5E9R6TLbkkzhiG0KK3ozoaeqyNAOCPgfaVXDO9RiMVzPYQO8kM0jpDHGImp7 mGfT7LqSqvp0vGwEav+2G8mOB/HtIp0+n1d5lT7on4J/eCJ5BhjDOqpUJNodLcLk69LE dsQIh5VyqtbSeUIvPCt28VdXKYnJ3AC6q5Y7i7rFWNmPQzuQYztj2GETNDY5XVCxMBRi +q4uDB/9eeOsa42CQY/qDnZw4RfX5KuaXc2wcxRoWzNfS6iF4pK1CZwYlyHMbvLRGlQR cSRg== 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=XLVp0iE8J7r5k1jLBZmhdochA8twCeLmyd+BgQpdom4GBoK+qoHgwBLNerW4Relqp6 a/Ujuo4msZHzOrTjJAoT6d8HZvLci8Z33yBjzGgCaLAMPV3IgcxUM4G4SOmgTLyTjGMf 4v5DYdwqlxc0KU0KM1VIGvHQ2a4WsOxkdYsnFs6ob/OpW8F3TBp/VnlshiFKxLXfWo3i zfOhLDd+ZBnDpO3mSXUXeMgktHlbHESknmLpz0uf1X89G8NwS3YUuVdTVDAuN69VlCCV U76dVtyk5AbBIXnxBsQyXCwUUNiBL0wSQ7MxtxBKjwlPQZ+uvaf69zFpaK18OzTja+Rg g5jA== X-Gm-Message-State: AOAM531gq7kivlPiaJ9EIyY9VXF0GvTm+Exc9lOEa10q4t1VVsGGqSNK TlbSm4IuShNeEQktcWYQ5GE= X-Google-Smtp-Source: ABdhPJxcxZ6cnPohSI0/EFdUtlWDJVxg7caCTPrSiqQO3khzZ31HBiXw2/qZEqHgRBRrRj1t2soQnA== X-Received: by 2002:a17:902:9303:b0:143:d6c7:babc with SMTP id bc3-20020a170902930300b00143d6c7babcmr21567418plb.58.1637244258545; Thu, 18 Nov 2021 06:04:18 -0800 (PST) Received: from localhost.localdomain ([2406:7400:63:2c47:5ffe:fc34:61f0:f1ea]) by smtp.gmail.com with ESMTPSA id x14sm2822878pjl.27.2021.11.18.06.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:04:18 -0800 (PST) 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, linux-hyperv@vger.kernel.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Rob Herring , =?UTF-8?q?Pali=20Roh=C3=A1r?= , skhan@linuxfoundation.org, Robert Richter , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM IPROC ARM ARCHITECTURE), Ryder Lee , Jianjun Wang , Matthias Brugger , Jingoo Han , Krzysztof Kozlowski , Shawn Guo , Xiaowei Song , Binghui Wang , Thomas Petazzoni , Joyce Ooi , Marek Vasut , Yoshihiro Shimoda , Shawn Lin , Heiko Stuebner , Nirmal Patel , Jonathan Derrick , Kuppuswamy Sathyanarayanan , Lukas Wunner , Amey Narkhede , Russell Currey , "Oliver O'Halloran" , Sean V Kelley , Qiuxu Zhuo , Marc Zyngier , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Toan Le , Kishon Vijay Abraham I Subject: [PATCH v4 00/25] Unify PCI error response checking Date: Thu, 18 Nov 2021 19:33:10 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211118_060420_023445_CDE5C724 X-CRM114-Status: GOOD ( 19.27 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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. This patch series adds PCI_ERROR_RESPONSE definition and other helper definition PCI_SET_ERROR_RESPONSE and PCI_POSSIBLE_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 PCI_SET_ERROR_RESPONSE() when device is not found 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 PCI_POSSIBLE_ERROR() to check the reads from hardware - Patches can be applied in any order. Patch 23 - 25: - Edits the comments to include PCI_ERROR_RESPONSE alsong with 0xFFFFFFFF, so that it becomes easier to grep for faulty hardware reads. Changelog ========= v4: - Rename SET_PCI_ERROR_RESPONSE to PCI_SET_ERROR_RESPONSE - Rename RESPONSE_IS_PCI_ERROR to PCI_POSSIBLE_ERROR v3: - Change RESPONSE_IS_PCI_ERROR macro definition - Fix the macros, Add () around macro parameters - Fix alignment issue in Patch 2/24 - Add proper receipients for all the patches 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 (25): [PATCH v4 1/25] PCI: Add PCI_ERROR_RESPONSE and it's related definitions [PATCH v4 2/25] PCI: Set error response in config access defines when ops->read() fails [PATCH v4 3/25] PCI: Use PCI_SET_ERROR_RESPONSE() when device not found [PATCH v4 4/25] PCI: Remove redundant error fabrication when device read fails [PATCH v4 5/25] PCI: thunder: Remove redundant error fabrication when device read fails [PATCH v4 6/25] PCI: iproc: Remove redundant error fabrication when device read fails [PATCH v4 7/25] PCI: mediatek: Remove redundant error fabrication when device read fails [PATCH v4 8/25] PCI: exynos: Remove redundant error fabrication when device read fails [PATCH v4 9/25] PCI: histb: Remove redundant error fabrication when device read fails [PATCH v4 10/25] PCI: kirin: Remove redundant error fabrication when device read fails [PATCH v4 11/25] PCI: aardvark: Remove redundant error fabrication when device read fails [PATCH v4 12/25] PCI: mvebu: Remove redundant error fabrication when device read fails [PATCH v4 13/25] PCI: altera: Remove redundant error fabrication when device read fails [PATCH v4 14/25] PCI: rcar: Remove redundant error fabrication when device read fails [PATCH v4 15/25] PCI: rockchip: Remove redundant error fabrication when device read fails [PATCH v4 16/25] PCI/ERR: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 17/25] PCI: vmd: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 18/25] PCI: pciehp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 19/25] PCI/DPC: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 20/25] PCI/PME: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 21/25] PCI: cpqphp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 22/25] PCI: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 23/25] PCI: keystone: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 24/25] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error [PATCH v4 25/25] PCI: xgene: Use PCI_ERROR_RESPONSE to specify hardware error drivers/pci/access.c | 32 +++++++------- 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 | 4 +- 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, 84 insertions(+), 116 deletions(-) -- 2.25.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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 20A57C433EF for ; Thu, 18 Nov 2021 14:04:31 +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 E37F860EFD for ; Thu, 18 Nov 2021 14:04:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E37F860EFD 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: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:In-Reply-To:References: List-Owner; bh=DxCAyannsNjldYusg/9XeMgWu58aX9qs6R+rLczfeMA=; b=uZDjNvU/Kol6Fc XaNIqFMx5QuV4Li0r3GXFC2DZ0Adtf93A9qQhxKTSUbVPWpTRDToHD7QECODTPEQWb0iDKWVthVV0 B+MQvKJq68VVnCn0u9oVRWIHSt/iIKpOsJhgbSatsb2fbKdTWj9wfKtxWIRY4c/Ou06GiRMX4BKeg oDmpCbJOSMzXW56XRp2nlpoEBOO0DQ3JSwP0lKZRnANce+sEKmvh6BxPyH/RT5yQ3CZgNFHTlA02R NTgEDO7rqyGnG+fiIoAJdxULUxwL3jOAj3XRson3fDL36/ZUi8diOnfMKUf7sBzvA1P0fDuPq7nf9 I2IQJmGEiHVJrg8m4zJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mni1Y-007zyR-TO; Thu, 18 Nov 2021 14:04:24 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mni1T-007zwL-Tt; Thu, 18 Nov 2021 14:04:21 +0000 Received: by mail-pj1-x1035.google.com with SMTP id o6-20020a17090a0a0600b001a64b9a11aeso5783162pjo.3; Thu, 18 Nov 2021 06:04:19 -0800 (PST) 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=U2AsFUKZLXJxwq1AOzr4+SXvMtjFGsxO8ExXuBT8byCkoGnUJsmIHIE9RaBdrO41Rl 8huvDZAw5E9R6TLbkkzhiG0KK3ozoaeqyNAOCPgfaVXDO9RiMVzPYQO8kM0jpDHGImp7 mGfT7LqSqvp0vGwEav+2G8mOB/HtIp0+n1d5lT7on4J/eCJ5BhjDOqpUJNodLcLk69LE dsQIh5VyqtbSeUIvPCt28VdXKYnJ3AC6q5Y7i7rFWNmPQzuQYztj2GETNDY5XVCxMBRi +q4uDB/9eeOsa42CQY/qDnZw4RfX5KuaXc2wcxRoWzNfS6iF4pK1CZwYlyHMbvLRGlQR cSRg== 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=XLVp0iE8J7r5k1jLBZmhdochA8twCeLmyd+BgQpdom4GBoK+qoHgwBLNerW4Relqp6 a/Ujuo4msZHzOrTjJAoT6d8HZvLci8Z33yBjzGgCaLAMPV3IgcxUM4G4SOmgTLyTjGMf 4v5DYdwqlxc0KU0KM1VIGvHQ2a4WsOxkdYsnFs6ob/OpW8F3TBp/VnlshiFKxLXfWo3i zfOhLDd+ZBnDpO3mSXUXeMgktHlbHESknmLpz0uf1X89G8NwS3YUuVdTVDAuN69VlCCV U76dVtyk5AbBIXnxBsQyXCwUUNiBL0wSQ7MxtxBKjwlPQZ+uvaf69zFpaK18OzTja+Rg g5jA== X-Gm-Message-State: AOAM531gq7kivlPiaJ9EIyY9VXF0GvTm+Exc9lOEa10q4t1VVsGGqSNK TlbSm4IuShNeEQktcWYQ5GE= X-Google-Smtp-Source: ABdhPJxcxZ6cnPohSI0/EFdUtlWDJVxg7caCTPrSiqQO3khzZ31HBiXw2/qZEqHgRBRrRj1t2soQnA== X-Received: by 2002:a17:902:9303:b0:143:d6c7:babc with SMTP id bc3-20020a170902930300b00143d6c7babcmr21567418plb.58.1637244258545; Thu, 18 Nov 2021 06:04:18 -0800 (PST) Received: from localhost.localdomain ([2406:7400:63:2c47:5ffe:fc34:61f0:f1ea]) by smtp.gmail.com with ESMTPSA id x14sm2822878pjl.27.2021.11.18.06.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:04:18 -0800 (PST) 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, linux-hyperv@vger.kernel.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Rob Herring , =?UTF-8?q?Pali=20Roh=C3=A1r?= , skhan@linuxfoundation.org, Robert Richter , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM IPROC ARM ARCHITECTURE), Ryder Lee , Jianjun Wang , Matthias Brugger , Jingoo Han , Krzysztof Kozlowski , Shawn Guo , Xiaowei Song , Binghui Wang , Thomas Petazzoni , Joyce Ooi , Marek Vasut , Yoshihiro Shimoda , Shawn Lin , Heiko Stuebner , Nirmal Patel , Jonathan Derrick , Kuppuswamy Sathyanarayanan , Lukas Wunner , Amey Narkhede , Russell Currey , "Oliver O'Halloran" , Sean V Kelley , Qiuxu Zhuo , Marc Zyngier , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Toan Le , Kishon Vijay Abraham I Subject: [PATCH v4 00/25] Unify PCI error response checking Date: Thu, 18 Nov 2021 19:33:10 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211118_060420_023445_CDE5C724 X-CRM114-Status: GOOD ( 19.27 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=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. This patch series adds PCI_ERROR_RESPONSE definition and other helper definition PCI_SET_ERROR_RESPONSE and PCI_POSSIBLE_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 PCI_SET_ERROR_RESPONSE() when device is not found 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 PCI_POSSIBLE_ERROR() to check the reads from hardware - Patches can be applied in any order. Patch 23 - 25: - Edits the comments to include PCI_ERROR_RESPONSE alsong with 0xFFFFFFFF, so that it becomes easier to grep for faulty hardware reads. Changelog ========= v4: - Rename SET_PCI_ERROR_RESPONSE to PCI_SET_ERROR_RESPONSE - Rename RESPONSE_IS_PCI_ERROR to PCI_POSSIBLE_ERROR v3: - Change RESPONSE_IS_PCI_ERROR macro definition - Fix the macros, Add () around macro parameters - Fix alignment issue in Patch 2/24 - Add proper receipients for all the patches 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 (25): [PATCH v4 1/25] PCI: Add PCI_ERROR_RESPONSE and it's related definitions [PATCH v4 2/25] PCI: Set error response in config access defines when ops->read() fails [PATCH v4 3/25] PCI: Use PCI_SET_ERROR_RESPONSE() when device not found [PATCH v4 4/25] PCI: Remove redundant error fabrication when device read fails [PATCH v4 5/25] PCI: thunder: Remove redundant error fabrication when device read fails [PATCH v4 6/25] PCI: iproc: Remove redundant error fabrication when device read fails [PATCH v4 7/25] PCI: mediatek: Remove redundant error fabrication when device read fails [PATCH v4 8/25] PCI: exynos: Remove redundant error fabrication when device read fails [PATCH v4 9/25] PCI: histb: Remove redundant error fabrication when device read fails [PATCH v4 10/25] PCI: kirin: Remove redundant error fabrication when device read fails [PATCH v4 11/25] PCI: aardvark: Remove redundant error fabrication when device read fails [PATCH v4 12/25] PCI: mvebu: Remove redundant error fabrication when device read fails [PATCH v4 13/25] PCI: altera: Remove redundant error fabrication when device read fails [PATCH v4 14/25] PCI: rcar: Remove redundant error fabrication when device read fails [PATCH v4 15/25] PCI: rockchip: Remove redundant error fabrication when device read fails [PATCH v4 16/25] PCI/ERR: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 17/25] PCI: vmd: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 18/25] PCI: pciehp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 19/25] PCI/DPC: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 20/25] PCI/PME: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 21/25] PCI: cpqphp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 22/25] PCI: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 23/25] PCI: keystone: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 24/25] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error [PATCH v4 25/25] PCI: xgene: Use PCI_ERROR_RESPONSE to specify hardware error drivers/pci/access.c | 32 +++++++------- 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 | 4 +- 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, 84 insertions(+), 116 deletions(-) -- 2.25.1 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip 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 EDC46C433EF for ; Thu, 18 Nov 2021 14:05:05 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 7AE4560EFD for ; Thu, 18 Nov 2021 14:05:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7AE4560EFD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Hw1lN03jVz2ywZ for ; Fri, 19 Nov 2021 01:05:04 +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=U2AsFUKZ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1033; helo=mail-pj1-x1033.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=U2AsFUKZ; dkim-atps=neutral Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (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 4Hw1kb07njz2xBx for ; Fri, 19 Nov 2021 01:04:21 +1100 (AEDT) Received: by mail-pj1-x1033.google.com with SMTP id np6-20020a17090b4c4600b001a90b011e06so5774463pjb.5 for ; Thu, 18 Nov 2021 06:04:21 -0800 (PST) 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=U2AsFUKZLXJxwq1AOzr4+SXvMtjFGsxO8ExXuBT8byCkoGnUJsmIHIE9RaBdrO41Rl 8huvDZAw5E9R6TLbkkzhiG0KK3ozoaeqyNAOCPgfaVXDO9RiMVzPYQO8kM0jpDHGImp7 mGfT7LqSqvp0vGwEav+2G8mOB/HtIp0+n1d5lT7on4J/eCJ5BhjDOqpUJNodLcLk69LE dsQIh5VyqtbSeUIvPCt28VdXKYnJ3AC6q5Y7i7rFWNmPQzuQYztj2GETNDY5XVCxMBRi +q4uDB/9eeOsa42CQY/qDnZw4RfX5KuaXc2wcxRoWzNfS6iF4pK1CZwYlyHMbvLRGlQR cSRg== 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=2+h5Kd/hjqlgWPZhxmNy3OoG7OiHuipUsgtMWPBV6Ak=; b=2Ywcf18n102jEbLutlQkFIEE/iQ9CLN4OtenMUhwQY7gXklgfSJcImsRgmjE/PPxsF XOXpTGmdJyqlFeT8Wa6rtvCV7jpXCApbEC3mgmjP30FqewWELEZjTVQlQC3JD5IqRc6I p5zhycXqH8zbPpNhoWIpSGiSTDzwuxgRdo7pmEEE+JWOAivNlMw83qldvxDZHBeBNEgv hnbQzW5d730QN3IMjX7ScTuK7N5YVD5EIRjJS9qZL8Dza7g8z4ioZV31dbpYw+1xP7Om PrNw/v31vJiGhN1hwgP0nmcRsauCkVn7f87oWkeJ7T+88MJacqjrDRBvmvhupmeSi3aY 5sdw== X-Gm-Message-State: AOAM530tgQzABF9H3fhlvtu6ezUrkCgEnW/xlscDZPzFsfbJEwlt6dP3 3oOBjFHR3aV9QuEMqVRsVpU= X-Google-Smtp-Source: ABdhPJxcxZ6cnPohSI0/EFdUtlWDJVxg7caCTPrSiqQO3khzZ31HBiXw2/qZEqHgRBRrRj1t2soQnA== X-Received: by 2002:a17:902:9303:b0:143:d6c7:babc with SMTP id bc3-20020a170902930300b00143d6c7babcmr21567418plb.58.1637244258545; Thu, 18 Nov 2021 06:04:18 -0800 (PST) Received: from localhost.localdomain ([2406:7400:63:2c47:5ffe:fc34:61f0:f1ea]) by smtp.gmail.com with ESMTPSA id x14sm2822878pjl.27.2021.11.18.06.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:04:18 -0800 (PST) From: Naveen Naidu To: bhelgaas@google.com Subject: [PATCH v4 00/25] Unify PCI error response checking Date: Thu, 18 Nov 2021 19:33:10 +0530 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , linux-hyperv@vger.kernel.org, Heiko Stuebner , linux-pci@vger.kernel.org, Shawn Lin , Binghui Wang , Kuppuswamy Sathyanarayanan , Amey Narkhede , Oliver O'Halloran , Thomas Petazzoni , Lorenzo Pieralisi , Toan Le , "K. Y. Srinivasan" , Nirmal Patel , Marek Vasut , Rob Herring , Wei Liu , linux-samsung-soc@vger.kernel.org, Marc Zyngier , Naveen Naidu , Joyce Ooi , Dexuan Cui , Kishon Vijay Abraham I , Jianjun Wang , linux-rockchip@lists.infradead.org, "maintainer:BROADCOM IPROC ARM ARCHITECTURE" , Jonathan Derrick , Xiaowei Song , linux-kernel-mentees@lists.linuxfoundation.org, Robert Richter , Sean V Kelley , Ray Jui , Haiyang Zhang , Ryder Lee , linux-mediatek@lists.infradead.org, skhan@linuxfoundation.org, Matthias Brugger , Stephen Hemminger , linux-arm-kernel@lists.infradead.org, Qiuxu Zhuo , Scott Branden , linuxppc-dev@lists.ozlabs.org, Yoshihiro Shimoda , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Lukas Wunner , Jingoo Han , Shawn Guo , =?UTF-8?q?Pali=20Roh=C3=A1r?= Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.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 PCI_SET_ERROR_RESPONSE and PCI_POSSIBLE_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 PCI_SET_ERROR_RESPONSE() when device is not found 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 PCI_POSSIBLE_ERROR() to check the reads from hardware - Patches can be applied in any order. Patch 23 - 25: - Edits the comments to include PCI_ERROR_RESPONSE alsong with 0xFFFFFFFF, so that it becomes easier to grep for faulty hardware reads. Changelog ========= v4: - Rename SET_PCI_ERROR_RESPONSE to PCI_SET_ERROR_RESPONSE - Rename RESPONSE_IS_PCI_ERROR to PCI_POSSIBLE_ERROR v3: - Change RESPONSE_IS_PCI_ERROR macro definition - Fix the macros, Add () around macro parameters - Fix alignment issue in Patch 2/24 - Add proper receipients for all the patches 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 (25): [PATCH v4 1/25] PCI: Add PCI_ERROR_RESPONSE and it's related definitions [PATCH v4 2/25] PCI: Set error response in config access defines when ops->read() fails [PATCH v4 3/25] PCI: Use PCI_SET_ERROR_RESPONSE() when device not found [PATCH v4 4/25] PCI: Remove redundant error fabrication when device read fails [PATCH v4 5/25] PCI: thunder: Remove redundant error fabrication when device read fails [PATCH v4 6/25] PCI: iproc: Remove redundant error fabrication when device read fails [PATCH v4 7/25] PCI: mediatek: Remove redundant error fabrication when device read fails [PATCH v4 8/25] PCI: exynos: Remove redundant error fabrication when device read fails [PATCH v4 9/25] PCI: histb: Remove redundant error fabrication when device read fails [PATCH v4 10/25] PCI: kirin: Remove redundant error fabrication when device read fails [PATCH v4 11/25] PCI: aardvark: Remove redundant error fabrication when device read fails [PATCH v4 12/25] PCI: mvebu: Remove redundant error fabrication when device read fails [PATCH v4 13/25] PCI: altera: Remove redundant error fabrication when device read fails [PATCH v4 14/25] PCI: rcar: Remove redundant error fabrication when device read fails [PATCH v4 15/25] PCI: rockchip: Remove redundant error fabrication when device read fails [PATCH v4 16/25] PCI/ERR: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 17/25] PCI: vmd: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 18/25] PCI: pciehp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 19/25] PCI/DPC: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 20/25] PCI/PME: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 21/25] PCI: cpqphp: Use PCI_POSSIBLE_ERROR() to check read from hardware [PATCH v4 22/25] PCI: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 23/25] PCI: keystone: Use PCI_ERROR_RESPONSE to specify hardware error [PATCH v4 24/25] PCI: hv: Use PCI_ERROR_RESPONSE to specify hardware read error [PATCH v4 25/25] PCI: xgene: Use PCI_ERROR_RESPONSE to specify hardware error drivers/pci/access.c | 32 +++++++------- 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 | 4 +- 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, 84 insertions(+), 116 deletions(-) -- 2.25.1