From patchwork Thu May 6 15:31:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12242487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6B56C43460 for ; Thu, 6 May 2021 15:36:41 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 45F286109E for ; Thu, 6 May 2021 15:36:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45F286109E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=zv7yfrh5jouyb7kwMVD0VKE38nc5CYi8bBmwSNz8bTE=; b=ievQD7hJ9HJ0H9CyuEcsBocVFm eXW0Qo3VAHRDxCQ9byEyt1qiQ1oONJ9AyRMbRy6Q+zt649gjnfqpuR7ET37zY7YcifkN1UoNICOzJ 9piMjaHUsfLDPDprsCLRrqFsj1MqRgtb4ssczXx4ctxAAUdbjbcJOY2NcfOfDKIy/DEVB+YnSLEZJ /aKe3SLL8mAsEcJksGK50WtKHn3ujPYygfaVIsrbKdUnAra7bBkQuS5Com4NlEvvlQepQloa/uAgq UyvUXOyC0eZpaA9vrptfVTFFpR6oqJ+KqJ3J6WjTBtNYnA/ApFzMK0ii4tZQd32xVZwceSOOeZng5 sczzbsUQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leg1s-004amn-Hl; Thu, 06 May 2021 15:35:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lefzh-004a3L-V8 for linux-arm-kernel@desiato.infradead.org; Thu, 06 May 2021 15:32:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=Aq5XlmhNkxnPe/xexyT2lUUYvJ3e9T5SuCgw3r2hjHg=; b=vpndY8jUyx46MXUHcUNIRjkO7+ qKWBuug0hq+O8hlZXQSA4fV0Fe5wrAaS+c8RNM4OcBbvoIrXX6PaH7OUOfC5jjKvOD3uLctXh6FpM gKsCLQUr8FDWKjmCotdLZ9EOc/DtGiDn9fdKKc3pNzf+AoCGti+qr6L8Hf4DWN3Aw9ZW5vFIC/bkS 2JUG8etT5haOhKwq6N6jCsfqX0SEUQL6CUW/QrCULCtE57QQkVBhNfwglDt9O17Y+KFGFIoJnCQHH 6hRss33n406sX2SnVqO10tM+veDtL4CRb6NKDtHTAwxuzowbwLGvIb+9KRERIL3r05dVP7NCSlqfo dNDIcqpw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lefzc-0069f5-0m for linux-arm-kernel@lists.infradead.org; Thu, 06 May 2021 15:32:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2FC8D6121F; Thu, 6 May 2021 15:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620315167; bh=4PdOrm3ckyFyLCrz8KXjoYJ/bE97syCdXnf2iYht7P0=; h=From:To:Cc:Subject:Date:From; b=nTYk0C0GB/2hQOoxxPHbZxsBuXKqffrD5pzDXMVjeBfVaXarD/c2bkjwkMbStG6Y9 Qh8sKqg8tP/80bLYac++BizFLF0W1LQTgbJHPoIMILv/S6/T63TLuJe7YIoRsBsSnh lQAW653pZdTiQJvReyxgT41La1gK6UaqN+OWsD5+PuWsAtvfi8/jmNnXSC7kyvqMta UsVXn3zYt9tEL4nmqy0AKV6o0z7IEU21xbhqPjP9S1E65Sj1e9Z8IA8pkrjqhNyslU Lbo6o688qxIYeVd5z8fTVKdkcteuG49rc+nysfhXqRXH/40M3DZNxOaQRJPT0xvgwO E97U50sdrjG1Q== Received: by pali.im (Postfix) id 00869732; Thu, 6 May 2021 17:32:43 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Lorenzo Pieralisi , Thomas Petazzoni , Rob Herring , Bjorn Helgaas Cc: Russell King , =?utf-8?q?Marek_Beh=C3=BAn?= , Remi Pommarel , Xogium , Tomasz Maciej Nowak , Marc Zyngier , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 00/42] PCI: aardvark: Various driver fixes Date: Thu, 6 May 2021 17:31:11 +0200 Message-Id: <20210506153153.30454-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210506_083248_185594_69E4D1C2 X-CRM114-Status: GOOD ( 13.49 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch series fixes various issues in pci-aardvark.c driver (PCIe controller on Marvell Armada 3700 SoC) used on Espressobin and Turris Mox. First patch fixes kernel panic (or TF-A panic depending on used firmware) during execution of PIO transfer and I would suggest to include this fix into v5.13 release to prevent future kernel panics. Other patches then fixes PIO issues, PCIe link training, initialization of PCIe controller, accessing PCIe Root Bridge/Port registers, handling of interrupts (including ERR and PME), setup of Multi-MSI interrupts, adding support for masking MSI interrupts, adding support for more than 32 MSI interrupts with MSI-X support, and adding support for AER. Note that there are still some unresolved issues with PCIe on A3720. I asked Marvell for PCIe documentation or explanations but I have not received anything (yet). Patch "Fix checking for PIO status" is taken from the Marvell github fork and adapted for inclusion into mainline kernel: https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/84444d22023c Whole patch series is available also in my git branch pci-aardvark: https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark If you have Espressobin, Turris Mox or other A3720 board with PCIe please test this patch series with your favourite PCIe card if everything is working fine. Evan Wang (1): PCI: aardvark: Fix checking for PIO status Pali Rohár (39): PCI: aardvark: Fix kernel panic during PIO transfer PCI: aardvark: Fix checking for PIO Non-posted Request PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO response PCI: pci-bridge-emul: Add PCIe Root Capabilities Register PCI: aardvark: Fix reporting CRS Software Visibility on emulated bridge PCI: aardvark: Fix link training PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros PCI: aardvark: Fix PCIe Max Payload Size setting PCI: aardvark: Implement workaround for the readback value of VEND_ID PCI: aardvark: Do not touch status bits of masked interrupts in interrupt handler PCI: aardvark: Check for virq mapping when processing INTx IRQ PCI: aardvark: Remove irq_mask_ack callback for INTx interrupts PCI: aardvark: Don't mask irq when mapping PCI: aardvark: Change name of INTx irq_chip to advk-INT PCI: aardvark: Remove unneeded goto PCI: aardvark: Fix support for MSI interrupts PCI: aardvark: Correctly clear and unmask all MSI interrupts PCI: aardvark: Fix setting MSI address PCI: aardvark: Add support for more than 32 MSI interrupts PCI: aardvark: Add support for masking MSI interrupts PCI: aardvark: Enable MSI-X support PCI: aardvark: Fix support for ERR interrupt on emulated bridge PCI: aardvark: Fix support for PME on emulated bridge PCI: aardvark: Fix support for PME requester on emulated bridge PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on emulated bridge PCI: aardvark: Disable bus mastering and mask all interrupts when unbinding driver PCI: aardvark: Free config space for emulated root bridge when unbinding driver to fix memory leak PCI: aardvark: Reset PCIe card and disable PHY when unbinding driver PCI: aardvark: Rewrite irq code to chained irq handler PCI: aardvark: Use separate INTA interrupt for emulated root bridge PCI: pci-bridge-emul: Add description for class_revision field PCI: pci-bridge-emul: Add definitions for missing capabilities registers PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and LNKCTL2 registers on emulated bridge PCI: aardvark: Add support for PCI_BRIDGE_CTL_BUS_RESET on emulated bridge PCI: aardvark: Replace custom PCIE_CORE_ERR_CAPCTL_* macros by linux/pci_regs.h macros PCI: aardvark: Replace custom PCIE_CORE_INT_* macros by linux PCI_INTERRUPT_* values PCI: aardvark: Cleanup some register macros PCI: aardvark: Add comments for OB_WIN_ENABLE and ADDR_WIN_DISABLE PCI: aardvark: Add support for Advanced Error Reporting registers on emulated bridge Russell King (2): PCI: pci-bridge-emul: re-arrange register tests PCI: pci-bridge-emul: add support for PCIe extended capabilities drivers/pci/controller/pci-aardvark.c | 980 +++++++++++++++++++------- drivers/pci/pci-bridge-emul.c | 149 ++-- drivers/pci/pci-bridge-emul.h | 17 +- include/uapi/linux/pci_regs.h | 6 + 4 files changed, 850 insertions(+), 302 deletions(-)