From patchwork Wed Sep 12 15:48:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 10597815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2C0A14F9 for ; Wed, 12 Sep 2018 15:49:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B05332A5A2 for ; Wed, 12 Sep 2018 15:49:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A48652A5A7; Wed, 12 Sep 2018 15:49:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5DEC92A5A2 for ; Wed, 12 Sep 2018 15:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=jNY+46Qef++yloBIFK8BRWtE0bUpkKyuwZaR4oYGbYE=; b=fE4 GUvOEbYlWd+6W4P2Gitn8niJ1w1DJicBWwC9EefctMfwDZc0OT5l1yo41tNrhlojk610d8M5+shxv 5VKyonFlfXD82LavC7WcjMx2BPaRZKkCBy2EZj8+ESKeU5VhMWJO8qNh1Wd7PDe3E6/f/E6YyqoM+ 6o9RfwRNOpBWD/W7QXa7/ZfkNMAAc/a9tqmceMiYA6yLA8omh0azAuEFJUbXmW5RLdlyZWsezx/cP Xw6/cOgae312V1XXY3yPGOb8eWfS/q9QRkLth1Xg1obKPhK39iK7JYXX2XFNYVohtnTz0DVagu3CC F57qLvQPViu6hXhOmDfCUel3AzhsNoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g07OE-0005OJ-Vd; Wed, 12 Sep 2018 15:49:14 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g07OA-0005L2-WA for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 15:49:12 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 5A8DA2071D; Wed, 12 Sep 2018 17:48:58 +0200 (CEST) Received: from localhost (AAubervilliers-681-1-30-219.w90-88.abo.wanadoo.fr [90.88.15.219]) by mail.bootlin.com (Postfix) with ESMTPSA id 2E5F4206DE; Wed, 12 Sep 2018 17:48:58 +0200 (CEST) From: Thomas Petazzoni To: Bjorn Helgaas , Lorenzo Pieralisi , Russell King Subject: [PATCHv2 0/3] PCI: emulated PCI bridge config space Date: Wed, 12 Sep 2018 17:48:28 +0200 Message-Id: <20180912154831.2220-1-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.14.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_084911_172463_F7172700 X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antoine Tenart , linux-pci@vger.kernel.org, Gregory Clement , Maxime Chevallier , Nadav Haklai , Thomas Petazzoni , =?utf-8?q?Miqu=C3=A8l_Rayn?= =?utf-8?q?al?= , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, The pci-mvebu driver already contains some logic to emulate a root port PCI bridge configuration space. It turns out that we have a similar need for the pci-aardvark driver. Instead of duplicating the same logic in two drivers, this patch series starts by adding a small common infrastructure that helps emulate a root port PCI bridge config space, converts pci-mvebu to use it, and finally extends pci-aardvark to use it as well. Thanks to this, Marvell Armada 3720 based systems, which use the Aarkvark PCI controller, will have better PCI support, by having a root port PCI bridge exposed. The emulated PCI bridge common logic is a proposal, I very much welcome comments and suggestions. Also, if you feel that adding a common logic for only two drivers is too early, I'm fine with duplicating a bit of code betwen pci-mvebu and pci-aardvark. In this version 2, I have (hopefully) taken into account the comments from Bjorn Helgaas and Russell King. Here are the changes: - Rebased to 4.19-rc1 - The functions implementing the config space read/write emulation now have the knowledge of which registers/bits are read-only, read-write, reserved and write-1-to-clear, and behave according to this information. - I have renamed the function to use conf_read() and conf_write() suffixes, as suggested by Bjorn. - The whole thing is now named pci-bridge-emul instead of pci-sw-bridge (and of course all functions, types and macros were changed accordingly), as Bjorn wasn't happy about pci-sw-bridge. - The header file was moved into drivers/pci (instead of being in include/linux). Thanks a lot in advance for your review and feedback. Best regards, Thomas Petazzoni Thomas Petazzoni (2): PCI: Introduce PCI bridge emulated config space common logic PCI: mvebu: Convert to PCI emulated bridge config space Zachary Zhang (1): PCI: aardvark: Implement emulated root PCI bridge config space drivers/pci/Kconfig | 3 + drivers/pci/Makefile | 1 + drivers/pci/controller/Kconfig | 2 + drivers/pci/controller/pci-aardvark.c | 129 ++++++++++- drivers/pci/controller/pci-mvebu.c | 375 +++++++++---------------------- drivers/pci/pci-bridge-emul.c | 408 ++++++++++++++++++++++++++++++++++ drivers/pci/pci-bridge-emul.h | 124 +++++++++++ 7 files changed, 770 insertions(+), 272 deletions(-) create mode 100644 drivers/pci/pci-bridge-emul.c create mode 100644 drivers/pci/pci-bridge-emul.h