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: 10597807 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 72584921 for ; Wed, 12 Sep 2018 15:49:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61AC62A599 for ; Wed, 12 Sep 2018 15:49:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 554752A59C; Wed, 12 Sep 2018 15:49:01 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0A572A599 for ; Wed, 12 Sep 2018 15:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726842AbeILUyF (ORCPT ); Wed, 12 Sep 2018 16:54:05 -0400 Received: from mail.bootlin.com ([62.4.15.54]:58520 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbeILUyF (ORCPT ); Wed, 12 Sep 2018 16:54:05 -0400 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 Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Gregory Clement , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Maxime Chevallier , Antoine Tenart , Nadav Haklai , Thomas Petazzoni 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 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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