All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Christoph Hellwig <hch@lst.de>,
	bcm-kernel-feedback-list@broadcom.com,
	Robin Murphy <robin.murphy@arm.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	"open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM"
	<linux-remoteproc@vger.kernel.org>,
	"open list:DRM DRIVERS FOR ALLWINNER A10"
	<dri-devel@lists.freedesktop.org>,
	"open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)"
	<linux-ide@vger.kernel.org>, Julien Grall <julien.grall@arm.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Saravana Kannan <saravanak@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"open list:ACPI FOR ARM64 (ACPI/arm64)"
	<linux-acpi@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"open list:ALLWINNER A10 CSI DRIVER"
	<linux-media@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
	<devicetree@vger.kernel.org>, Joerg Roedel <jroedel@suse.de>,
	Arnd Bergmann <arnd@arndb.de>, Oliver Neukum <oneukum@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"moderated list:ARM PORT" <linux-arm-kernel@lists.infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips
Date: Mon, 20 Jul 2020 23:27:53 +0000	[thread overview]
Message-ID: <8e5be265-6029-3c43-989c-4a046dd60c50@gmail.com> (raw)
In-Reply-To: <20200715143530.9702-1-james.quinlan@broadcom.com>

On 7/15/20 7:35 AM, Jim Quinlan wrote:
> Patchset Summary:
>   Enhance a PCIe host controller driver.  Because of its unusual design
>   we are foced to change dev->dma_pfn_offset into a more general role
>   allowing multiple offsets.  See the 'v1' notes below for more info.

Christoph, Robin, are you happy with this version?

> 
> v8:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- To satisfy a specific m68 compile configuration, I moved the 'struct
>      bus_dma_region; definition out of #ifdef CONFIG_HAS_DMA and also defined
>      three inline functions for !CONFIG_HAS_DMA (kernel test robot).
>   -- The sunXi drivers -- suc4i_csi, sun6i_csi, cedrus_hw -- set
>      a pfn_offset outside of_dma_configure() but the code offers no 
>      insight on the size of the translation window.  V7 had me using
>      SIZE_MAX as the size.  I have since contacted the sunXi maintainer and
>      he said that using a size of SZ_4G would cover sunXi configurations.
> 
> v7:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- remove second kcalloc/copy in device.c (AndyS)
>   -- use PTR_ERR_OR_ZERO() and PHYS_PFN() (AndyS)
>   -- indentation, sizeof(struct ...) => sizeof(*r) (AndyS)
>   -- add pfn.h definitions: PFN_DMA_ADDR(), DMA_ADDR_PFN() (AndyS)
>   -- Fixed compile error in "sun6i_csi.c" (kernel test robot)
>   Commit "ata: ahci_brcm: Fix use of BCM7216 reset controller"
>   -- correct name of function in the commit msg (SergeiS)
>   
> v6:
>   Commit "device core: Introduce DMA range map":
>   -- of_dma_get_range() now takes a single argument and returns either
>      NULL, a valid map, or an ERR_PTR. (Robin)
>   -- offsets are no longer a PFN value but an actual address. (Robin)
>   -- the bus_dma_region struct stores the range size instead of
>      the cpu_end and pci_end values. (Robin)
>   -- devices that were setting a single offset with no boundaries
>      have been modified to have boundaries; in a few places
>      where this informatino was unavilable a /* FIXME: ... */
>      comment was added. (Robin)
>   -- dma_attach_offset_range() can be called when an offset
>      map already exists; if it's range is already present
>      nothing is done and success is returned. (Robin)
>   All commits:
>   -- Man name/style/corrections/etc changed (Bjorn)
>   -- rebase to Torvalds master
> 
> v5:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- in of/address.c: "map_size = 0" => "*map_size = 0"
>   -- use kcalloc instead of kzalloc (AndyS)
>   -- use PHYS_ADDR_MAX instead of "~(phys_addr_t)0"
>   Commit "PCI: brcmstb: Set internal memory viewport sizes"
>   -- now gives error on missing dma-ranges property.
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- removed "Allof:" from brcm,scb-sizes definition (RobH)
>   All Commits:
>   -- indentation style, use max chars 100 (AndyS)
>   -- rebased to torvalds master
> 
> v4:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- of_dma_get_range() does not take a dev param but instead
>      takes two "out" params: map and map_size.  We do this so
>      that the code that parses dma-ranges is separate from
>      the code that modifies 'dev'.   (Nicolas)
>   -- the separate case of having a single pfn offset has
>      been removed and is now processed by going through the
>      map array. (Nicolas)
>   -- move attach_uniform_dma_pfn_offset() from of/address.c to
>      dma/mapping.c so that it does not depend on CONFIG_OF. (Nicolas)
>   -- devm_kcalloc => devm_kzalloc (DanC)
>   -- add/fix assignment to dev->dma_pfn_offset_map for func
>      attach_uniform_dma_pfn_offset() (DanC, Nicolas)
>   -- s/struct dma_pfn_offset_region/struct bus_dma_region/ (Nicolas)
>   -- s/attach_uniform_dma_pfn_offset/dma_attach_uniform_pfn_offset/
>   -- s/attach_dma_pfn_offset_map/dma_attach_pfn_offset_map/
>   -- More use of PFN_{PHYS,DOWN,UP}. (AndyS)
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- this commit was sqaushed with "device core: Introduce ..."
> 
> v3:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   Commit "arm: dma-mapping: Invoke dma offset func if needed"
>   -- The above two commits have been squashed.  More importantly,
>      the code has been modified so that the functionality for
>      multiple pfn offsets subsumes the use of dev->dma_pfn_offset.
>      In fact, dma_pfn_offset is removed and supplanted by
>      dma_pfn_offset_map, which is a pointer to an array.  The
>      more common case of a uniform offset is now handled as
>      a map with a single entry, while cases requiring multiple
>      pfn offsets use a map with multiple entries.  Code paths
>      that used to do this:
> 
>          dev->dma_pfn_offset = mydrivers_pfn_offset;
> 
>      have been changed to do this:
> 
>          attach_uniform_dma_pfn_offset(dev, pfn_offset);
> 
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- Add if/then clause for required props: resets, reset-names (RobH)
>   -- Change compatible list from const to enum (RobH)
>   -- Change list of u32-tuples to u64 (RobH)
> 
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- modify of/unittests.c to add NULL param in of_dma_get_range() call.
> 
>   Commit "device core: Add ability to handle multiple dma offsets"
>   -- align comment in device.h (AndyS).
>   -- s/cpu_beg/cpu_start/ and s/dma_beg/dma_start/ in struct
>      dma_pfn_offset_region (AndyS).
> 
> v2:
> Commit: "device core: Add ability to handle multiple dma offsets"
>   o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
>   o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
>   o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
>   o dev->dma_pfn_map => dev->dma_pfn_offset_map
>   o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
>   o In device.h: s/const void */const struct dma_pfn_offset_region */
>   o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
>     guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
>   o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
>     dev->dma_pfn_offset_map is copied as well.
>   o Merged two of the DMA commits into one (Christoph).
> 
> Commit "arm: dma-mapping: Invoke dma offset func if needed":
>   o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> 
> Other commits' changes:
>   o Removed need for carrying of_id var in priv (Nicolas)
>   o Commit message rewordings (Bjorn)
>   o Commit log messages filled to 75 chars (Bjorn)
>   o devm_reset_control_get_shared())
>     => devm_reset_control_get_optional_shared (Philipp)
>   o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> 
> v1:
> This patchset expands the usefulness of the Broadcom Settop Box PCIe
> controller by building upon the PCIe driver used currently by the
> Raspbery Pi.  Other forms of this patchset were submitted by me years
> ago and not accepted; the major sticking point was the code required
> for the DMA remapping needed for the PCIe driver to work [1].
> 
> There have been many changes to the DMA and OF subsystems since that
> time, making a cleaner and less intrusive patchset possible.  This
> patchset implements a generalization of "dev->dma_pfn_offset", except
> that instead of a single scalar offset it provides for multiple
> offsets via a function which depends upon the "dma-ranges" property of
> the PCIe host controller.  This is required for proper functionality
> of the BrcmSTB PCIe controller and possibly some other devices.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/1516058925-46522-5-git-send-email-jim2101024@gmail.com/
> 
> Jim Quinlan (12):
>   PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB
>   ata: ahci_brcm: Fix use of BCM7216 reset controller
>   dt-bindings: PCI: Add bindings for more Brcmstb chips
>   PCI: brcmstb: Add bcm7278 register info
>   PCI: brcmstb: Add suspend and resume pm_ops
>   PCI: brcmstb: Add bcm7278 PERST# support
>   PCI: brcmstb: Add control of rescal reset
>   device core: Introduce DMA range map, supplanting dma_pfn_offset
>   PCI: brcmstb: Set additional internal memory DMA viewport sizes
>   PCI: brcmstb: Accommodate MSI for older chips
>   PCI: brcmstb: Set bus max burst size by chip type
>   PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list
> 
>  .../bindings/pci/brcm,stb-pcie.yaml           |  56 ++-
>  arch/arm/include/asm/dma-mapping.h            |   9 +-
>  arch/arm/mach-keystone/keystone.c             |  17 +-
>  arch/sh/drivers/pci/pcie-sh7786.c             |   9 +-
>  arch/sh/kernel/dma-coherent.c                 |  16 +-
>  arch/x86/pci/sta2x11-fixup.c                  |   7 +-
>  drivers/acpi/arm64/iort.c                     |   5 +-
>  drivers/ata/ahci_brcm.c                       |  11 +-
>  drivers/gpu/drm/sun4i/sun4i_backend.c         |   5 +-
>  drivers/iommu/io-pgtable-arm.c                |   2 +-
>  .../platform/sunxi/sun4i-csi/sun4i_csi.c      |   5 +-
>  .../platform/sunxi/sun6i-csi/sun6i_csi.c      |   4 +-
>  drivers/of/address.c                          |  95 ++--
>  drivers/of/device.c                           |  47 +-
>  drivers/of/of_private.h                       |   9 +-
>  drivers/of/unittest.c                         |  35 +-
>  drivers/pci/controller/Kconfig                |   3 +-
>  drivers/pci/controller/pcie-brcmstb.c         | 408 +++++++++++++++---
>  drivers/remoteproc/remoteproc_core.c          |   2 +-
>  .../staging/media/sunxi/cedrus/cedrus_hw.c    |   7 +-
>  drivers/usb/core/message.c                    |   4 +-
>  drivers/usb/core/usb.c                        |   2 +-
>  include/linux/device.h                        |   4 +-
>  include/linux/dma-direct.h                    |  10 +-
>  include/linux/dma-mapping.h                   |  43 ++
>  include/linux/pfn.h                           |   2 +
>  kernel/dma/coherent.c                         |  10 +-
>  kernel/dma/mapping.c                          |  53 +++
>  28 files changed, 683 insertions(+), 197 deletions(-)
> 


-- 
Florian

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Christoph Hellwig <hch@lst.de>,
	bcm-kernel-feedback-list@broadcom.com,
	Robin Murphy <robin.murphy@arm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Dan Williams <dan.j.williams@intel.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" 
	<devicetree@vger.kernel.org>,
	"open list:DRM DRIVERS FOR ALLWINNER A10" 
	<dri-devel@lists.freedesktop.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>, Joerg Roedel <jroedel@suse.de>,
	Julien Grall <julien.grall@arm.com>,
	"open list:ACPI FOR ARM64 (ACPI/arm64)"
	<linux-acpi@vger.kernel.org>,
	"moderated list:ARM PORT" <linux-arm-kernel@lists.infradead.org>,
	"open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" 
	<linux-ide@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:ALLWINNER A10 CSI DRIVER"
	<linux-media@vger.kernel.org>,
	"open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM" 
	<linux-remoteproc@vger.kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" 
	<linux-rpi-kernel@lists.infradead.org>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	Oliver Neukum <oneukum@suse.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips
Date: Mon, 20 Jul 2020 16:27:53 -0700	[thread overview]
Message-ID: <8e5be265-6029-3c43-989c-4a046dd60c50@gmail.com> (raw)
In-Reply-To: <20200715143530.9702-1-james.quinlan@broadcom.com>

On 7/15/20 7:35 AM, Jim Quinlan wrote:
> Patchset Summary:
>   Enhance a PCIe host controller driver.  Because of its unusual design
>   we are foced to change dev->dma_pfn_offset into a more general role
>   allowing multiple offsets.  See the 'v1' notes below for more info.

Christoph, Robin, are you happy with this version?

> 
> v8:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- To satisfy a specific m68 compile configuration, I moved the 'struct
>      bus_dma_region; definition out of #ifdef CONFIG_HAS_DMA and also defined
>      three inline functions for !CONFIG_HAS_DMA (kernel test robot).
>   -- The sunXi drivers -- suc4i_csi, sun6i_csi, cedrus_hw -- set
>      a pfn_offset outside of_dma_configure() but the code offers no 
>      insight on the size of the translation window.  V7 had me using
>      SIZE_MAX as the size.  I have since contacted the sunXi maintainer and
>      he said that using a size of SZ_4G would cover sunXi configurations.
> 
> v7:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- remove second kcalloc/copy in device.c (AndyS)
>   -- use PTR_ERR_OR_ZERO() and PHYS_PFN() (AndyS)
>   -- indentation, sizeof(struct ...) => sizeof(*r) (AndyS)
>   -- add pfn.h definitions: PFN_DMA_ADDR(), DMA_ADDR_PFN() (AndyS)
>   -- Fixed compile error in "sun6i_csi.c" (kernel test robot)
>   Commit "ata: ahci_brcm: Fix use of BCM7216 reset controller"
>   -- correct name of function in the commit msg (SergeiS)
>   
> v6:
>   Commit "device core: Introduce DMA range map":
>   -- of_dma_get_range() now takes a single argument and returns either
>      NULL, a valid map, or an ERR_PTR. (Robin)
>   -- offsets are no longer a PFN value but an actual address. (Robin)
>   -- the bus_dma_region struct stores the range size instead of
>      the cpu_end and pci_end values. (Robin)
>   -- devices that were setting a single offset with no boundaries
>      have been modified to have boundaries; in a few places
>      where this informatino was unavilable a /* FIXME: ... */
>      comment was added. (Robin)
>   -- dma_attach_offset_range() can be called when an offset
>      map already exists; if it's range is already present
>      nothing is done and success is returned. (Robin)
>   All commits:
>   -- Man name/style/corrections/etc changed (Bjorn)
>   -- rebase to Torvalds master
> 
> v5:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- in of/address.c: "map_size = 0" => "*map_size = 0"
>   -- use kcalloc instead of kzalloc (AndyS)
>   -- use PHYS_ADDR_MAX instead of "~(phys_addr_t)0"
>   Commit "PCI: brcmstb: Set internal memory viewport sizes"
>   -- now gives error on missing dma-ranges property.
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- removed "Allof:" from brcm,scb-sizes definition (RobH)
>   All Commits:
>   -- indentation style, use max chars 100 (AndyS)
>   -- rebased to torvalds master
> 
> v4:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- of_dma_get_range() does not take a dev param but instead
>      takes two "out" params: map and map_size.  We do this so
>      that the code that parses dma-ranges is separate from
>      the code that modifies 'dev'.   (Nicolas)
>   -- the separate case of having a single pfn offset has
>      been removed and is now processed by going through the
>      map array. (Nicolas)
>   -- move attach_uniform_dma_pfn_offset() from of/address.c to
>      dma/mapping.c so that it does not depend on CONFIG_OF. (Nicolas)
>   -- devm_kcalloc => devm_kzalloc (DanC)
>   -- add/fix assignment to dev->dma_pfn_offset_map for func
>      attach_uniform_dma_pfn_offset() (DanC, Nicolas)
>   -- s/struct dma_pfn_offset_region/struct bus_dma_region/ (Nicolas)
>   -- s/attach_uniform_dma_pfn_offset/dma_attach_uniform_pfn_offset/
>   -- s/attach_dma_pfn_offset_map/dma_attach_pfn_offset_map/
>   -- More use of PFN_{PHYS,DOWN,UP}. (AndyS)
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- this commit was sqaushed with "device core: Introduce ..."
> 
> v3:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   Commit "arm: dma-mapping: Invoke dma offset func if needed"
>   -- The above two commits have been squashed.  More importantly,
>      the code has been modified so that the functionality for
>      multiple pfn offsets subsumes the use of dev->dma_pfn_offset.
>      In fact, dma_pfn_offset is removed and supplanted by
>      dma_pfn_offset_map, which is a pointer to an array.  The
>      more common case of a uniform offset is now handled as
>      a map with a single entry, while cases requiring multiple
>      pfn offsets use a map with multiple entries.  Code paths
>      that used to do this:
> 
>          dev->dma_pfn_offset = mydrivers_pfn_offset;
> 
>      have been changed to do this:
> 
>          attach_uniform_dma_pfn_offset(dev, pfn_offset);
> 
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- Add if/then clause for required props: resets, reset-names (RobH)
>   -- Change compatible list from const to enum (RobH)
>   -- Change list of u32-tuples to u64 (RobH)
> 
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- modify of/unittests.c to add NULL param in of_dma_get_range() call.
> 
>   Commit "device core: Add ability to handle multiple dma offsets"
>   -- align comment in device.h (AndyS).
>   -- s/cpu_beg/cpu_start/ and s/dma_beg/dma_start/ in struct
>      dma_pfn_offset_region (AndyS).
> 
> v2:
> Commit: "device core: Add ability to handle multiple dma offsets"
>   o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
>   o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
>   o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
>   o dev->dma_pfn_map => dev->dma_pfn_offset_map
>   o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
>   o In device.h: s/const void */const struct dma_pfn_offset_region */
>   o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
>     guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
>   o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
>     dev->dma_pfn_offset_map is copied as well.
>   o Merged two of the DMA commits into one (Christoph).
> 
> Commit "arm: dma-mapping: Invoke dma offset func if needed":
>   o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> 
> Other commits' changes:
>   o Removed need for carrying of_id var in priv (Nicolas)
>   o Commit message rewordings (Bjorn)
>   o Commit log messages filled to 75 chars (Bjorn)
>   o devm_reset_control_get_shared())
>     => devm_reset_control_get_optional_shared (Philipp)
>   o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> 
> v1:
> This patchset expands the usefulness of the Broadcom Settop Box PCIe
> controller by building upon the PCIe driver used currently by the
> Raspbery Pi.  Other forms of this patchset were submitted by me years
> ago and not accepted; the major sticking point was the code required
> for the DMA remapping needed for the PCIe driver to work [1].
> 
> There have been many changes to the DMA and OF subsystems since that
> time, making a cleaner and less intrusive patchset possible.  This
> patchset implements a generalization of "dev->dma_pfn_offset", except
> that instead of a single scalar offset it provides for multiple
> offsets via a function which depends upon the "dma-ranges" property of
> the PCIe host controller.  This is required for proper functionality
> of the BrcmSTB PCIe controller and possibly some other devices.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/1516058925-46522-5-git-send-email-jim2101024@gmail.com/
> 
> Jim Quinlan (12):
>   PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB
>   ata: ahci_brcm: Fix use of BCM7216 reset controller
>   dt-bindings: PCI: Add bindings for more Brcmstb chips
>   PCI: brcmstb: Add bcm7278 register info
>   PCI: brcmstb: Add suspend and resume pm_ops
>   PCI: brcmstb: Add bcm7278 PERST# support
>   PCI: brcmstb: Add control of rescal reset
>   device core: Introduce DMA range map, supplanting dma_pfn_offset
>   PCI: brcmstb: Set additional internal memory DMA viewport sizes
>   PCI: brcmstb: Accommodate MSI for older chips
>   PCI: brcmstb: Set bus max burst size by chip type
>   PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list
> 
>  .../bindings/pci/brcm,stb-pcie.yaml           |  56 ++-
>  arch/arm/include/asm/dma-mapping.h            |   9 +-
>  arch/arm/mach-keystone/keystone.c             |  17 +-
>  arch/sh/drivers/pci/pcie-sh7786.c             |   9 +-
>  arch/sh/kernel/dma-coherent.c                 |  16 +-
>  arch/x86/pci/sta2x11-fixup.c                  |   7 +-
>  drivers/acpi/arm64/iort.c                     |   5 +-
>  drivers/ata/ahci_brcm.c                       |  11 +-
>  drivers/gpu/drm/sun4i/sun4i_backend.c         |   5 +-
>  drivers/iommu/io-pgtable-arm.c                |   2 +-
>  .../platform/sunxi/sun4i-csi/sun4i_csi.c      |   5 +-
>  .../platform/sunxi/sun6i-csi/sun6i_csi.c      |   4 +-
>  drivers/of/address.c                          |  95 ++--
>  drivers/of/device.c                           |  47 +-
>  drivers/of/of_private.h                       |   9 +-
>  drivers/of/unittest.c                         |  35 +-
>  drivers/pci/controller/Kconfig                |   3 +-
>  drivers/pci/controller/pcie-brcmstb.c         | 408 +++++++++++++++---
>  drivers/remoteproc/remoteproc_core.c          |   2 +-
>  .../staging/media/sunxi/cedrus/cedrus_hw.c    |   7 +-
>  drivers/usb/core/message.c                    |   4 +-
>  drivers/usb/core/usb.c                        |   2 +-
>  include/linux/device.h                        |   4 +-
>  include/linux/dma-direct.h                    |  10 +-
>  include/linux/dma-mapping.h                   |  43 ++
>  include/linux/pfn.h                           |   2 +
>  kernel/dma/coherent.c                         |  10 +-
>  kernel/dma/mapping.c                          |  53 +++
>  28 files changed, 683 insertions(+), 197 deletions(-)
> 


-- 
Florian

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Christoph Hellwig <hch@lst.de>,
	bcm-kernel-feedback-list@broadcom.com,
	Robin Murphy <robin.murphy@arm.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	"open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM"
	<linux-remoteproc@vger.kernel.org>,
	"open list:DRM DRIVERS FOR ALLWINNER A10"
	<dri-devel@lists.freedesktop.org>,
	"open list:LIBATA SUBSYSTEM \(Serial and Parallel ATA drivers\)"
	<linux-ide@vger.kernel.org>, Julien Grall <julien.grall@arm.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	Rob Herring <robh@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Saravana Kannan <saravanak@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"open list:ACPI FOR ARM64 \(ACPI/arm64\)"
	<linux-acpi@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"open list:ALLWINNER A10 CSI DRIVER"
	<linux-media@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
	<devicetree@vger.kernel.org>, Joerg Roedel <jroedel@suse.de>,
	Arnd Bergmann <arnd@arndb.de>, Oliver Neukum <oneukum@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"moderated list:ARM PORT" <linux-arm-kernel@lists.infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips
Date: Mon, 20 Jul 2020 16:27:53 -0700	[thread overview]
Message-ID: <8e5be265-6029-3c43-989c-4a046dd60c50@gmail.com> (raw)
In-Reply-To: <20200715143530.9702-1-james.quinlan@broadcom.com>

On 7/15/20 7:35 AM, Jim Quinlan wrote:
> Patchset Summary:
>   Enhance a PCIe host controller driver.  Because of its unusual design
>   we are foced to change dev->dma_pfn_offset into a more general role
>   allowing multiple offsets.  See the 'v1' notes below for more info.

Christoph, Robin, are you happy with this version?

> 
> v8:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- To satisfy a specific m68 compile configuration, I moved the 'struct
>      bus_dma_region; definition out of #ifdef CONFIG_HAS_DMA and also defined
>      three inline functions for !CONFIG_HAS_DMA (kernel test robot).
>   -- The sunXi drivers -- suc4i_csi, sun6i_csi, cedrus_hw -- set
>      a pfn_offset outside of_dma_configure() but the code offers no 
>      insight on the size of the translation window.  V7 had me using
>      SIZE_MAX as the size.  I have since contacted the sunXi maintainer and
>      he said that using a size of SZ_4G would cover sunXi configurations.
> 
> v7:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- remove second kcalloc/copy in device.c (AndyS)
>   -- use PTR_ERR_OR_ZERO() and PHYS_PFN() (AndyS)
>   -- indentation, sizeof(struct ...) => sizeof(*r) (AndyS)
>   -- add pfn.h definitions: PFN_DMA_ADDR(), DMA_ADDR_PFN() (AndyS)
>   -- Fixed compile error in "sun6i_csi.c" (kernel test robot)
>   Commit "ata: ahci_brcm: Fix use of BCM7216 reset controller"
>   -- correct name of function in the commit msg (SergeiS)
>   
> v6:
>   Commit "device core: Introduce DMA range map":
>   -- of_dma_get_range() now takes a single argument and returns either
>      NULL, a valid map, or an ERR_PTR. (Robin)
>   -- offsets are no longer a PFN value but an actual address. (Robin)
>   -- the bus_dma_region struct stores the range size instead of
>      the cpu_end and pci_end values. (Robin)
>   -- devices that were setting a single offset with no boundaries
>      have been modified to have boundaries; in a few places
>      where this informatino was unavilable a /* FIXME: ... */
>      comment was added. (Robin)
>   -- dma_attach_offset_range() can be called when an offset
>      map already exists; if it's range is already present
>      nothing is done and success is returned. (Robin)
>   All commits:
>   -- Man name/style/corrections/etc changed (Bjorn)
>   -- rebase to Torvalds master
> 
> v5:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- in of/address.c: "map_size = 0" => "*map_size = 0"
>   -- use kcalloc instead of kzalloc (AndyS)
>   -- use PHYS_ADDR_MAX instead of "~(phys_addr_t)0"
>   Commit "PCI: brcmstb: Set internal memory viewport sizes"
>   -- now gives error on missing dma-ranges property.
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- removed "Allof:" from brcm,scb-sizes definition (RobH)
>   All Commits:
>   -- indentation style, use max chars 100 (AndyS)
>   -- rebased to torvalds master
> 
> v4:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- of_dma_get_range() does not take a dev param but instead
>      takes two "out" params: map and map_size.  We do this so
>      that the code that parses dma-ranges is separate from
>      the code that modifies 'dev'.   (Nicolas)
>   -- the separate case of having a single pfn offset has
>      been removed and is now processed by going through the
>      map array. (Nicolas)
>   -- move attach_uniform_dma_pfn_offset() from of/address.c to
>      dma/mapping.c so that it does not depend on CONFIG_OF. (Nicolas)
>   -- devm_kcalloc => devm_kzalloc (DanC)
>   -- add/fix assignment to dev->dma_pfn_offset_map for func
>      attach_uniform_dma_pfn_offset() (DanC, Nicolas)
>   -- s/struct dma_pfn_offset_region/struct bus_dma_region/ (Nicolas)
>   -- s/attach_uniform_dma_pfn_offset/dma_attach_uniform_pfn_offset/
>   -- s/attach_dma_pfn_offset_map/dma_attach_pfn_offset_map/
>   -- More use of PFN_{PHYS,DOWN,UP}. (AndyS)
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- this commit was sqaushed with "device core: Introduce ..."
> 
> v3:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   Commit "arm: dma-mapping: Invoke dma offset func if needed"
>   -- The above two commits have been squashed.  More importantly,
>      the code has been modified so that the functionality for
>      multiple pfn offsets subsumes the use of dev->dma_pfn_offset.
>      In fact, dma_pfn_offset is removed and supplanted by
>      dma_pfn_offset_map, which is a pointer to an array.  The
>      more common case of a uniform offset is now handled as
>      a map with a single entry, while cases requiring multiple
>      pfn offsets use a map with multiple entries.  Code paths
>      that used to do this:
> 
>          dev->dma_pfn_offset = mydrivers_pfn_offset;
> 
>      have been changed to do this:
> 
>          attach_uniform_dma_pfn_offset(dev, pfn_offset);
> 
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- Add if/then clause for required props: resets, reset-names (RobH)
>   -- Change compatible list from const to enum (RobH)
>   -- Change list of u32-tuples to u64 (RobH)
> 
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- modify of/unittests.c to add NULL param in of_dma_get_range() call.
> 
>   Commit "device core: Add ability to handle multiple dma offsets"
>   -- align comment in device.h (AndyS).
>   -- s/cpu_beg/cpu_start/ and s/dma_beg/dma_start/ in struct
>      dma_pfn_offset_region (AndyS).
> 
> v2:
> Commit: "device core: Add ability to handle multiple dma offsets"
>   o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
>   o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
>   o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
>   o dev->dma_pfn_map => dev->dma_pfn_offset_map
>   o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
>   o In device.h: s/const void */const struct dma_pfn_offset_region */
>   o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
>     guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
>   o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
>     dev->dma_pfn_offset_map is copied as well.
>   o Merged two of the DMA commits into one (Christoph).
> 
> Commit "arm: dma-mapping: Invoke dma offset func if needed":
>   o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> 
> Other commits' changes:
>   o Removed need for carrying of_id var in priv (Nicolas)
>   o Commit message rewordings (Bjorn)
>   o Commit log messages filled to 75 chars (Bjorn)
>   o devm_reset_control_get_shared())
>     => devm_reset_control_get_optional_shared (Philipp)
>   o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> 
> v1:
> This patchset expands the usefulness of the Broadcom Settop Box PCIe
> controller by building upon the PCIe driver used currently by the
> Raspbery Pi.  Other forms of this patchset were submitted by me years
> ago and not accepted; the major sticking point was the code required
> for the DMA remapping needed for the PCIe driver to work [1].
> 
> There have been many changes to the DMA and OF subsystems since that
> time, making a cleaner and less intrusive patchset possible.  This
> patchset implements a generalization of "dev->dma_pfn_offset", except
> that instead of a single scalar offset it provides for multiple
> offsets via a function which depends upon the "dma-ranges" property of
> the PCIe host controller.  This is required for proper functionality
> of the BrcmSTB PCIe controller and possibly some other devices.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/1516058925-46522-5-git-send-email-jim2101024@gmail.com/
> 
> Jim Quinlan (12):
>   PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB
>   ata: ahci_brcm: Fix use of BCM7216 reset controller
>   dt-bindings: PCI: Add bindings for more Brcmstb chips
>   PCI: brcmstb: Add bcm7278 register info
>   PCI: brcmstb: Add suspend and resume pm_ops
>   PCI: brcmstb: Add bcm7278 PERST# support
>   PCI: brcmstb: Add control of rescal reset
>   device core: Introduce DMA range map, supplanting dma_pfn_offset
>   PCI: brcmstb: Set additional internal memory DMA viewport sizes
>   PCI: brcmstb: Accommodate MSI for older chips
>   PCI: brcmstb: Set bus max burst size by chip type
>   PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list
> 
>  .../bindings/pci/brcm,stb-pcie.yaml           |  56 ++-
>  arch/arm/include/asm/dma-mapping.h            |   9 +-
>  arch/arm/mach-keystone/keystone.c             |  17 +-
>  arch/sh/drivers/pci/pcie-sh7786.c             |   9 +-
>  arch/sh/kernel/dma-coherent.c                 |  16 +-
>  arch/x86/pci/sta2x11-fixup.c                  |   7 +-
>  drivers/acpi/arm64/iort.c                     |   5 +-
>  drivers/ata/ahci_brcm.c                       |  11 +-
>  drivers/gpu/drm/sun4i/sun4i_backend.c         |   5 +-
>  drivers/iommu/io-pgtable-arm.c                |   2 +-
>  .../platform/sunxi/sun4i-csi/sun4i_csi.c      |   5 +-
>  .../platform/sunxi/sun6i-csi/sun6i_csi.c      |   4 +-
>  drivers/of/address.c                          |  95 ++--
>  drivers/of/device.c                           |  47 +-
>  drivers/of/of_private.h                       |   9 +-
>  drivers/of/unittest.c                         |  35 +-
>  drivers/pci/controller/Kconfig                |   3 +-
>  drivers/pci/controller/pcie-brcmstb.c         | 408 +++++++++++++++---
>  drivers/remoteproc/remoteproc_core.c          |   2 +-
>  .../staging/media/sunxi/cedrus/cedrus_hw.c    |   7 +-
>  drivers/usb/core/message.c                    |   4 +-
>  drivers/usb/core/usb.c                        |   2 +-
>  include/linux/device.h                        |   4 +-
>  include/linux/dma-direct.h                    |  10 +-
>  include/linux/dma-mapping.h                   |  43 ++
>  include/linux/pfn.h                           |   2 +
>  kernel/dma/coherent.c                         |  10 +-
>  kernel/dma/mapping.c                          |  53 +++
>  28 files changed, 683 insertions(+), 197 deletions(-)
> 


-- 
Florian
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Christoph Hellwig <hch@lst.de>,
	bcm-kernel-feedback-list@broadcom.com,
	Robin Murphy <robin.murphy@arm.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	"open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM"
	<linux-remoteproc@vger.kernel.org>,
	"open list:DRM DRIVERS FOR ALLWINNER A10"
	<dri-devel@lists.freedesktop.org>,
	"open list:LIBATA SUBSYSTEM \(Serial and Parallel ATA drivers\)"
	<linux-ide@vger.kernel.org>, Julien Grall <julien.grall@arm.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	Rob Herring <robh@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Saravana Kannan <saravanak@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"open list:ACPI FOR ARM64 \(ACPI/arm64\)"
	<linux-acpi@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"open list:ALLWINNER A10 CSI DRIVER"
	<linux-media@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
	<devicetree@vger.kernel.org>, Joerg Roedel <jroedel@suse.de>,
	Arnd Bergmann <arnd@arndb.de>, Oliver Neukum <oneukum@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"moderated list:ARM PORT" <linux-arm-kernel@lists.infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips
Date: Mon, 20 Jul 2020 16:27:53 -0700	[thread overview]
Message-ID: <8e5be265-6029-3c43-989c-4a046dd60c50@gmail.com> (raw)
In-Reply-To: <20200715143530.9702-1-james.quinlan@broadcom.com>

On 7/15/20 7:35 AM, Jim Quinlan wrote:
> Patchset Summary:
>   Enhance a PCIe host controller driver.  Because of its unusual design
>   we are foced to change dev->dma_pfn_offset into a more general role
>   allowing multiple offsets.  See the 'v1' notes below for more info.

Christoph, Robin, are you happy with this version?

> 
> v8:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- To satisfy a specific m68 compile configuration, I moved the 'struct
>      bus_dma_region; definition out of #ifdef CONFIG_HAS_DMA and also defined
>      three inline functions for !CONFIG_HAS_DMA (kernel test robot).
>   -- The sunXi drivers -- suc4i_csi, sun6i_csi, cedrus_hw -- set
>      a pfn_offset outside of_dma_configure() but the code offers no 
>      insight on the size of the translation window.  V7 had me using
>      SIZE_MAX as the size.  I have since contacted the sunXi maintainer and
>      he said that using a size of SZ_4G would cover sunXi configurations.
> 
> v7:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- remove second kcalloc/copy in device.c (AndyS)
>   -- use PTR_ERR_OR_ZERO() and PHYS_PFN() (AndyS)
>   -- indentation, sizeof(struct ...) => sizeof(*r) (AndyS)
>   -- add pfn.h definitions: PFN_DMA_ADDR(), DMA_ADDR_PFN() (AndyS)
>   -- Fixed compile error in "sun6i_csi.c" (kernel test robot)
>   Commit "ata: ahci_brcm: Fix use of BCM7216 reset controller"
>   -- correct name of function in the commit msg (SergeiS)
>   
> v6:
>   Commit "device core: Introduce DMA range map":
>   -- of_dma_get_range() now takes a single argument and returns either
>      NULL, a valid map, or an ERR_PTR. (Robin)
>   -- offsets are no longer a PFN value but an actual address. (Robin)
>   -- the bus_dma_region struct stores the range size instead of
>      the cpu_end and pci_end values. (Robin)
>   -- devices that were setting a single offset with no boundaries
>      have been modified to have boundaries; in a few places
>      where this informatino was unavilable a /* FIXME: ... */
>      comment was added. (Robin)
>   -- dma_attach_offset_range() can be called when an offset
>      map already exists; if it's range is already present
>      nothing is done and success is returned. (Robin)
>   All commits:
>   -- Man name/style/corrections/etc changed (Bjorn)
>   -- rebase to Torvalds master
> 
> v5:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- in of/address.c: "map_size = 0" => "*map_size = 0"
>   -- use kcalloc instead of kzalloc (AndyS)
>   -- use PHYS_ADDR_MAX instead of "~(phys_addr_t)0"
>   Commit "PCI: brcmstb: Set internal memory viewport sizes"
>   -- now gives error on missing dma-ranges property.
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- removed "Allof:" from brcm,scb-sizes definition (RobH)
>   All Commits:
>   -- indentation style, use max chars 100 (AndyS)
>   -- rebased to torvalds master
> 
> v4:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- of_dma_get_range() does not take a dev param but instead
>      takes two "out" params: map and map_size.  We do this so
>      that the code that parses dma-ranges is separate from
>      the code that modifies 'dev'.   (Nicolas)
>   -- the separate case of having a single pfn offset has
>      been removed and is now processed by going through the
>      map array. (Nicolas)
>   -- move attach_uniform_dma_pfn_offset() from of/address.c to
>      dma/mapping.c so that it does not depend on CONFIG_OF. (Nicolas)
>   -- devm_kcalloc => devm_kzalloc (DanC)
>   -- add/fix assignment to dev->dma_pfn_offset_map for func
>      attach_uniform_dma_pfn_offset() (DanC, Nicolas)
>   -- s/struct dma_pfn_offset_region/struct bus_dma_region/ (Nicolas)
>   -- s/attach_uniform_dma_pfn_offset/dma_attach_uniform_pfn_offset/
>   -- s/attach_dma_pfn_offset_map/dma_attach_pfn_offset_map/
>   -- More use of PFN_{PHYS,DOWN,UP}. (AndyS)
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- this commit was sqaushed with "device core: Introduce ..."
> 
> v3:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   Commit "arm: dma-mapping: Invoke dma offset func if needed"
>   -- The above two commits have been squashed.  More importantly,
>      the code has been modified so that the functionality for
>      multiple pfn offsets subsumes the use of dev->dma_pfn_offset.
>      In fact, dma_pfn_offset is removed and supplanted by
>      dma_pfn_offset_map, which is a pointer to an array.  The
>      more common case of a uniform offset is now handled as
>      a map with a single entry, while cases requiring multiple
>      pfn offsets use a map with multiple entries.  Code paths
>      that used to do this:
> 
>          dev->dma_pfn_offset = mydrivers_pfn_offset;
> 
>      have been changed to do this:
> 
>          attach_uniform_dma_pfn_offset(dev, pfn_offset);
> 
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- Add if/then clause for required props: resets, reset-names (RobH)
>   -- Change compatible list from const to enum (RobH)
>   -- Change list of u32-tuples to u64 (RobH)
> 
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- modify of/unittests.c to add NULL param in of_dma_get_range() call.
> 
>   Commit "device core: Add ability to handle multiple dma offsets"
>   -- align comment in device.h (AndyS).
>   -- s/cpu_beg/cpu_start/ and s/dma_beg/dma_start/ in struct
>      dma_pfn_offset_region (AndyS).
> 
> v2:
> Commit: "device core: Add ability to handle multiple dma offsets"
>   o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
>   o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
>   o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
>   o dev->dma_pfn_map => dev->dma_pfn_offset_map
>   o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
>   o In device.h: s/const void */const struct dma_pfn_offset_region */
>   o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
>     guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
>   o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
>     dev->dma_pfn_offset_map is copied as well.
>   o Merged two of the DMA commits into one (Christoph).
> 
> Commit "arm: dma-mapping: Invoke dma offset func if needed":
>   o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> 
> Other commits' changes:
>   o Removed need for carrying of_id var in priv (Nicolas)
>   o Commit message rewordings (Bjorn)
>   o Commit log messages filled to 75 chars (Bjorn)
>   o devm_reset_control_get_shared())
>     => devm_reset_control_get_optional_shared (Philipp)
>   o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> 
> v1:
> This patchset expands the usefulness of the Broadcom Settop Box PCIe
> controller by building upon the PCIe driver used currently by the
> Raspbery Pi.  Other forms of this patchset were submitted by me years
> ago and not accepted; the major sticking point was the code required
> for the DMA remapping needed for the PCIe driver to work [1].
> 
> There have been many changes to the DMA and OF subsystems since that
> time, making a cleaner and less intrusive patchset possible.  This
> patchset implements a generalization of "dev->dma_pfn_offset", except
> that instead of a single scalar offset it provides for multiple
> offsets via a function which depends upon the "dma-ranges" property of
> the PCIe host controller.  This is required for proper functionality
> of the BrcmSTB PCIe controller and possibly some other devices.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/1516058925-46522-5-git-send-email-jim2101024@gmail.com/
> 
> Jim Quinlan (12):
>   PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB
>   ata: ahci_brcm: Fix use of BCM7216 reset controller
>   dt-bindings: PCI: Add bindings for more Brcmstb chips
>   PCI: brcmstb: Add bcm7278 register info
>   PCI: brcmstb: Add suspend and resume pm_ops
>   PCI: brcmstb: Add bcm7278 PERST# support
>   PCI: brcmstb: Add control of rescal reset
>   device core: Introduce DMA range map, supplanting dma_pfn_offset
>   PCI: brcmstb: Set additional internal memory DMA viewport sizes
>   PCI: brcmstb: Accommodate MSI for older chips
>   PCI: brcmstb: Set bus max burst size by chip type
>   PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list
> 
>  .../bindings/pci/brcm,stb-pcie.yaml           |  56 ++-
>  arch/arm/include/asm/dma-mapping.h            |   9 +-
>  arch/arm/mach-keystone/keystone.c             |  17 +-
>  arch/sh/drivers/pci/pcie-sh7786.c             |   9 +-
>  arch/sh/kernel/dma-coherent.c                 |  16 +-
>  arch/x86/pci/sta2x11-fixup.c                  |   7 +-
>  drivers/acpi/arm64/iort.c                     |   5 +-
>  drivers/ata/ahci_brcm.c                       |  11 +-
>  drivers/gpu/drm/sun4i/sun4i_backend.c         |   5 +-
>  drivers/iommu/io-pgtable-arm.c                |   2 +-
>  .../platform/sunxi/sun4i-csi/sun4i_csi.c      |   5 +-
>  .../platform/sunxi/sun6i-csi/sun6i_csi.c      |   4 +-
>  drivers/of/address.c                          |  95 ++--
>  drivers/of/device.c                           |  47 +-
>  drivers/of/of_private.h                       |   9 +-
>  drivers/of/unittest.c                         |  35 +-
>  drivers/pci/controller/Kconfig                |   3 +-
>  drivers/pci/controller/pcie-brcmstb.c         | 408 +++++++++++++++---
>  drivers/remoteproc/remoteproc_core.c          |   2 +-
>  .../staging/media/sunxi/cedrus/cedrus_hw.c    |   7 +-
>  drivers/usb/core/message.c                    |   4 +-
>  drivers/usb/core/usb.c                        |   2 +-
>  include/linux/device.h                        |   4 +-
>  include/linux/dma-direct.h                    |  10 +-
>  include/linux/dma-mapping.h                   |  43 ++
>  include/linux/pfn.h                           |   2 +
>  kernel/dma/coherent.c                         |  10 +-
>  kernel/dma/mapping.c                          |  53 +++
>  28 files changed, 683 insertions(+), 197 deletions(-)
> 


-- 
Florian
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Christoph Hellwig <hch@lst.de>,
	bcm-kernel-feedback-list@broadcom.com,
	Robin Murphy <robin.murphy@arm.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	"open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM"
	<linux-remoteproc@vger.kernel.org>,
	"open list:DRM DRIVERS FOR ALLWINNER A10"
	<dri-devel@lists.freedesktop.org>,
	"open list:LIBATA SUBSYSTEM \(Serial and Parallel ATA drivers\)"
	<linux-ide@vger.kernel.org>, Julien Grall <julien.grall@arm.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	Rob Herring <robh@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Saravana Kannan <saravanak@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"open list:ACPI FOR ARM64 \(ACPI/arm64\)"
	<linux-acpi@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"open list:ALLWINNER A10 CSI DRIVER"
	<linux-media@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
	<devicetree@vger.kernel.org>, Joerg Roedel <jroedel@suse.de>,
	Arnd Bergmann <arnd@arndb.de>, Oliver Neukum <oneukum@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"moderated list:ARM PORT" <linux-arm-kernel@lists.infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips
Date: Mon, 20 Jul 2020 16:27:53 -0700	[thread overview]
Message-ID: <8e5be265-6029-3c43-989c-4a046dd60c50@gmail.com> (raw)
In-Reply-To: <20200715143530.9702-1-james.quinlan@broadcom.com>

On 7/15/20 7:35 AM, Jim Quinlan wrote:
> Patchset Summary:
>   Enhance a PCIe host controller driver.  Because of its unusual design
>   we are foced to change dev->dma_pfn_offset into a more general role
>   allowing multiple offsets.  See the 'v1' notes below for more info.

Christoph, Robin, are you happy with this version?

> 
> v8:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- To satisfy a specific m68 compile configuration, I moved the 'struct
>      bus_dma_region; definition out of #ifdef CONFIG_HAS_DMA and also defined
>      three inline functions for !CONFIG_HAS_DMA (kernel test robot).
>   -- The sunXi drivers -- suc4i_csi, sun6i_csi, cedrus_hw -- set
>      a pfn_offset outside of_dma_configure() but the code offers no 
>      insight on the size of the translation window.  V7 had me using
>      SIZE_MAX as the size.  I have since contacted the sunXi maintainer and
>      he said that using a size of SZ_4G would cover sunXi configurations.
> 
> v7:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- remove second kcalloc/copy in device.c (AndyS)
>   -- use PTR_ERR_OR_ZERO() and PHYS_PFN() (AndyS)
>   -- indentation, sizeof(struct ...) => sizeof(*r) (AndyS)
>   -- add pfn.h definitions: PFN_DMA_ADDR(), DMA_ADDR_PFN() (AndyS)
>   -- Fixed compile error in "sun6i_csi.c" (kernel test robot)
>   Commit "ata: ahci_brcm: Fix use of BCM7216 reset controller"
>   -- correct name of function in the commit msg (SergeiS)
>   
> v6:
>   Commit "device core: Introduce DMA range map":
>   -- of_dma_get_range() now takes a single argument and returns either
>      NULL, a valid map, or an ERR_PTR. (Robin)
>   -- offsets are no longer a PFN value but an actual address. (Robin)
>   -- the bus_dma_region struct stores the range size instead of
>      the cpu_end and pci_end values. (Robin)
>   -- devices that were setting a single offset with no boundaries
>      have been modified to have boundaries; in a few places
>      where this informatino was unavilable a /* FIXME: ... */
>      comment was added. (Robin)
>   -- dma_attach_offset_range() can be called when an offset
>      map already exists; if it's range is already present
>      nothing is done and success is returned. (Robin)
>   All commits:
>   -- Man name/style/corrections/etc changed (Bjorn)
>   -- rebase to Torvalds master
> 
> v5:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- in of/address.c: "map_size = 0" => "*map_size = 0"
>   -- use kcalloc instead of kzalloc (AndyS)
>   -- use PHYS_ADDR_MAX instead of "~(phys_addr_t)0"
>   Commit "PCI: brcmstb: Set internal memory viewport sizes"
>   -- now gives error on missing dma-ranges property.
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- removed "Allof:" from brcm,scb-sizes definition (RobH)
>   All Commits:
>   -- indentation style, use max chars 100 (AndyS)
>   -- rebased to torvalds master
> 
> v4:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- of_dma_get_range() does not take a dev param but instead
>      takes two "out" params: map and map_size.  We do this so
>      that the code that parses dma-ranges is separate from
>      the code that modifies 'dev'.   (Nicolas)
>   -- the separate case of having a single pfn offset has
>      been removed and is now processed by going through the
>      map array. (Nicolas)
>   -- move attach_uniform_dma_pfn_offset() from of/address.c to
>      dma/mapping.c so that it does not depend on CONFIG_OF. (Nicolas)
>   -- devm_kcalloc => devm_kzalloc (DanC)
>   -- add/fix assignment to dev->dma_pfn_offset_map for func
>      attach_uniform_dma_pfn_offset() (DanC, Nicolas)
>   -- s/struct dma_pfn_offset_region/struct bus_dma_region/ (Nicolas)
>   -- s/attach_uniform_dma_pfn_offset/dma_attach_uniform_pfn_offset/
>   -- s/attach_dma_pfn_offset_map/dma_attach_pfn_offset_map/
>   -- More use of PFN_{PHYS,DOWN,UP}. (AndyS)
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- this commit was sqaushed with "device core: Introduce ..."
> 
> v3:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   Commit "arm: dma-mapping: Invoke dma offset func if needed"
>   -- The above two commits have been squashed.  More importantly,
>      the code has been modified so that the functionality for
>      multiple pfn offsets subsumes the use of dev->dma_pfn_offset.
>      In fact, dma_pfn_offset is removed and supplanted by
>      dma_pfn_offset_map, which is a pointer to an array.  The
>      more common case of a uniform offset is now handled as
>      a map with a single entry, while cases requiring multiple
>      pfn offsets use a map with multiple entries.  Code paths
>      that used to do this:
> 
>          dev->dma_pfn_offset = mydrivers_pfn_offset;
> 
>      have been changed to do this:
> 
>          attach_uniform_dma_pfn_offset(dev, pfn_offset);
> 
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- Add if/then clause for required props: resets, reset-names (RobH)
>   -- Change compatible list from const to enum (RobH)
>   -- Change list of u32-tuples to u64 (RobH)
> 
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- modify of/unittests.c to add NULL param in of_dma_get_range() call.
> 
>   Commit "device core: Add ability to handle multiple dma offsets"
>   -- align comment in device.h (AndyS).
>   -- s/cpu_beg/cpu_start/ and s/dma_beg/dma_start/ in struct
>      dma_pfn_offset_region (AndyS).
> 
> v2:
> Commit: "device core: Add ability to handle multiple dma offsets"
>   o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
>   o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
>   o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
>   o dev->dma_pfn_map => dev->dma_pfn_offset_map
>   o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
>   o In device.h: s/const void */const struct dma_pfn_offset_region */
>   o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
>     guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
>   o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
>     dev->dma_pfn_offset_map is copied as well.
>   o Merged two of the DMA commits into one (Christoph).
> 
> Commit "arm: dma-mapping: Invoke dma offset func if needed":
>   o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> 
> Other commits' changes:
>   o Removed need for carrying of_id var in priv (Nicolas)
>   o Commit message rewordings (Bjorn)
>   o Commit log messages filled to 75 chars (Bjorn)
>   o devm_reset_control_get_shared())
>     => devm_reset_control_get_optional_shared (Philipp)
>   o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> 
> v1:
> This patchset expands the usefulness of the Broadcom Settop Box PCIe
> controller by building upon the PCIe driver used currently by the
> Raspbery Pi.  Other forms of this patchset were submitted by me years
> ago and not accepted; the major sticking point was the code required
> for the DMA remapping needed for the PCIe driver to work [1].
> 
> There have been many changes to the DMA and OF subsystems since that
> time, making a cleaner and less intrusive patchset possible.  This
> patchset implements a generalization of "dev->dma_pfn_offset", except
> that instead of a single scalar offset it provides for multiple
> offsets via a function which depends upon the "dma-ranges" property of
> the PCIe host controller.  This is required for proper functionality
> of the BrcmSTB PCIe controller and possibly some other devices.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/1516058925-46522-5-git-send-email-jim2101024@gmail.com/
> 
> Jim Quinlan (12):
>   PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB
>   ata: ahci_brcm: Fix use of BCM7216 reset controller
>   dt-bindings: PCI: Add bindings for more Brcmstb chips
>   PCI: brcmstb: Add bcm7278 register info
>   PCI: brcmstb: Add suspend and resume pm_ops
>   PCI: brcmstb: Add bcm7278 PERST# support
>   PCI: brcmstb: Add control of rescal reset
>   device core: Introduce DMA range map, supplanting dma_pfn_offset
>   PCI: brcmstb: Set additional internal memory DMA viewport sizes
>   PCI: brcmstb: Accommodate MSI for older chips
>   PCI: brcmstb: Set bus max burst size by chip type
>   PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list
> 
>  .../bindings/pci/brcm,stb-pcie.yaml           |  56 ++-
>  arch/arm/include/asm/dma-mapping.h            |   9 +-
>  arch/arm/mach-keystone/keystone.c             |  17 +-
>  arch/sh/drivers/pci/pcie-sh7786.c             |   9 +-
>  arch/sh/kernel/dma-coherent.c                 |  16 +-
>  arch/x86/pci/sta2x11-fixup.c                  |   7 +-
>  drivers/acpi/arm64/iort.c                     |   5 +-
>  drivers/ata/ahci_brcm.c                       |  11 +-
>  drivers/gpu/drm/sun4i/sun4i_backend.c         |   5 +-
>  drivers/iommu/io-pgtable-arm.c                |   2 +-
>  .../platform/sunxi/sun4i-csi/sun4i_csi.c      |   5 +-
>  .../platform/sunxi/sun6i-csi/sun6i_csi.c      |   4 +-
>  drivers/of/address.c                          |  95 ++--
>  drivers/of/device.c                           |  47 +-
>  drivers/of/of_private.h                       |   9 +-
>  drivers/of/unittest.c                         |  35 +-
>  drivers/pci/controller/Kconfig                |   3 +-
>  drivers/pci/controller/pcie-brcmstb.c         | 408 +++++++++++++++---
>  drivers/remoteproc/remoteproc_core.c          |   2 +-
>  .../staging/media/sunxi/cedrus/cedrus_hw.c    |   7 +-
>  drivers/usb/core/message.c                    |   4 +-
>  drivers/usb/core/usb.c                        |   2 +-
>  include/linux/device.h                        |   4 +-
>  include/linux/dma-direct.h                    |  10 +-
>  include/linux/dma-mapping.h                   |  43 ++
>  include/linux/pfn.h                           |   2 +
>  kernel/dma/coherent.c                         |  10 +-
>  kernel/dma/mapping.c                          |  53 +++
>  28 files changed, 683 insertions(+), 197 deletions(-)
> 


-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Christoph Hellwig <hch@lst.de>,
	bcm-kernel-feedback-list@broadcom.com,
	Robin Murphy <robin.murphy@arm.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	"open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM"
	<linux-remoteproc@vger.kernel.org>,
	"open list:DRM DRIVERS FOR ALLWINNER A10"
	<dri-devel@lists.freedesktop.org>,
	"open list:LIBATA SUBSYSTEM \(Serial and Parallel ATA drivers\)"
	<linux-ide@vger.kernel.org>, Julien Grall <julien.grall@arm.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Saravana Kannan <saravanak@google.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"open list:ACPI FOR ARM64 \(ACPI/arm64\)"
	<linux-acpi@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	"open list:ALLWINNER A10 CSI DRIVER"
	<linux-media@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
	<devicetree@vger.kernel.org>, Joerg Roedel <jroedel@suse.de>,
	Arnd Bergmann <arnd@arndb.de>, Oliver Neukum <oneukum@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"moderated list:ARM PORT" <linux-arm-kernel@lists.infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips
Date: Mon, 20 Jul 2020 16:27:53 -0700	[thread overview]
Message-ID: <8e5be265-6029-3c43-989c-4a046dd60c50@gmail.com> (raw)
In-Reply-To: <20200715143530.9702-1-james.quinlan@broadcom.com>

On 7/15/20 7:35 AM, Jim Quinlan wrote:
> Patchset Summary:
>   Enhance a PCIe host controller driver.  Because of its unusual design
>   we are foced to change dev->dma_pfn_offset into a more general role
>   allowing multiple offsets.  See the 'v1' notes below for more info.

Christoph, Robin, are you happy with this version?

> 
> v8:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- To satisfy a specific m68 compile configuration, I moved the 'struct
>      bus_dma_region; definition out of #ifdef CONFIG_HAS_DMA and also defined
>      three inline functions for !CONFIG_HAS_DMA (kernel test robot).
>   -- The sunXi drivers -- suc4i_csi, sun6i_csi, cedrus_hw -- set
>      a pfn_offset outside of_dma_configure() but the code offers no 
>      insight on the size of the translation window.  V7 had me using
>      SIZE_MAX as the size.  I have since contacted the sunXi maintainer and
>      he said that using a size of SZ_4G would cover sunXi configurations.
> 
> v7:
>   Commit: "device core: Introduce DMA range map, supplanting ..."
>   -- remove second kcalloc/copy in device.c (AndyS)
>   -- use PTR_ERR_OR_ZERO() and PHYS_PFN() (AndyS)
>   -- indentation, sizeof(struct ...) => sizeof(*r) (AndyS)
>   -- add pfn.h definitions: PFN_DMA_ADDR(), DMA_ADDR_PFN() (AndyS)
>   -- Fixed compile error in "sun6i_csi.c" (kernel test robot)
>   Commit "ata: ahci_brcm: Fix use of BCM7216 reset controller"
>   -- correct name of function in the commit msg (SergeiS)
>   
> v6:
>   Commit "device core: Introduce DMA range map":
>   -- of_dma_get_range() now takes a single argument and returns either
>      NULL, a valid map, or an ERR_PTR. (Robin)
>   -- offsets are no longer a PFN value but an actual address. (Robin)
>   -- the bus_dma_region struct stores the range size instead of
>      the cpu_end and pci_end values. (Robin)
>   -- devices that were setting a single offset with no boundaries
>      have been modified to have boundaries; in a few places
>      where this informatino was unavilable a /* FIXME: ... */
>      comment was added. (Robin)
>   -- dma_attach_offset_range() can be called when an offset
>      map already exists; if it's range is already present
>      nothing is done and success is returned. (Robin)
>   All commits:
>   -- Man name/style/corrections/etc changed (Bjorn)
>   -- rebase to Torvalds master
> 
> v5:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- in of/address.c: "map_size = 0" => "*map_size = 0"
>   -- use kcalloc instead of kzalloc (AndyS)
>   -- use PHYS_ADDR_MAX instead of "~(phys_addr_t)0"
>   Commit "PCI: brcmstb: Set internal memory viewport sizes"
>   -- now gives error on missing dma-ranges property.
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- removed "Allof:" from brcm,scb-sizes definition (RobH)
>   All Commits:
>   -- indentation style, use max chars 100 (AndyS)
>   -- rebased to torvalds master
> 
> v4:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   -- of_dma_get_range() does not take a dev param but instead
>      takes two "out" params: map and map_size.  We do this so
>      that the code that parses dma-ranges is separate from
>      the code that modifies 'dev'.   (Nicolas)
>   -- the separate case of having a single pfn offset has
>      been removed and is now processed by going through the
>      map array. (Nicolas)
>   -- move attach_uniform_dma_pfn_offset() from of/address.c to
>      dma/mapping.c so that it does not depend on CONFIG_OF. (Nicolas)
>   -- devm_kcalloc => devm_kzalloc (DanC)
>   -- add/fix assignment to dev->dma_pfn_offset_map for func
>      attach_uniform_dma_pfn_offset() (DanC, Nicolas)
>   -- s/struct dma_pfn_offset_region/struct bus_dma_region/ (Nicolas)
>   -- s/attach_uniform_dma_pfn_offset/dma_attach_uniform_pfn_offset/
>   -- s/attach_dma_pfn_offset_map/dma_attach_pfn_offset_map/
>   -- More use of PFN_{PHYS,DOWN,UP}. (AndyS)
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- this commit was sqaushed with "device core: Introduce ..."
> 
> v3:
>   Commit "device core: Introduce multiple dma pfn offsets"
>   Commit "arm: dma-mapping: Invoke dma offset func if needed"
>   -- The above two commits have been squashed.  More importantly,
>      the code has been modified so that the functionality for
>      multiple pfn offsets subsumes the use of dev->dma_pfn_offset.
>      In fact, dma_pfn_offset is removed and supplanted by
>      dma_pfn_offset_map, which is a pointer to an array.  The
>      more common case of a uniform offset is now handled as
>      a map with a single entry, while cases requiring multiple
>      pfn offsets use a map with multiple entries.  Code paths
>      that used to do this:
> 
>          dev->dma_pfn_offset = mydrivers_pfn_offset;
> 
>      have been changed to do this:
> 
>          attach_uniform_dma_pfn_offset(dev, pfn_offset);
> 
>   Commit "dt-bindings: PCI: Add bindings for more Brcmstb chips"
>   -- Add if/then clause for required props: resets, reset-names (RobH)
>   -- Change compatible list from const to enum (RobH)
>   -- Change list of u32-tuples to u64 (RobH)
> 
>   Commit "of: Include a dev param in of_dma_get_range()"
>   -- modify of/unittests.c to add NULL param in of_dma_get_range() call.
> 
>   Commit "device core: Add ability to handle multiple dma offsets"
>   -- align comment in device.h (AndyS).
>   -- s/cpu_beg/cpu_start/ and s/dma_beg/dma_start/ in struct
>      dma_pfn_offset_region (AndyS).
> 
> v2:
> Commit: "device core: Add ability to handle multiple dma offsets"
>   o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
>   o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
>   o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
>   o dev->dma_pfn_map => dev->dma_pfn_offset_map
>   o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
>   o In device.h: s/const void */const struct dma_pfn_offset_region */
>   o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
>     guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
>   o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
>     dev->dma_pfn_offset_map is copied as well.
>   o Merged two of the DMA commits into one (Christoph).
> 
> Commit "arm: dma-mapping: Invoke dma offset func if needed":
>   o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> 
> Other commits' changes:
>   o Removed need for carrying of_id var in priv (Nicolas)
>   o Commit message rewordings (Bjorn)
>   o Commit log messages filled to 75 chars (Bjorn)
>   o devm_reset_control_get_shared())
>     => devm_reset_control_get_optional_shared (Philipp)
>   o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> 
> v1:
> This patchset expands the usefulness of the Broadcom Settop Box PCIe
> controller by building upon the PCIe driver used currently by the
> Raspbery Pi.  Other forms of this patchset were submitted by me years
> ago and not accepted; the major sticking point was the code required
> for the DMA remapping needed for the PCIe driver to work [1].
> 
> There have been many changes to the DMA and OF subsystems since that
> time, making a cleaner and less intrusive patchset possible.  This
> patchset implements a generalization of "dev->dma_pfn_offset", except
> that instead of a single scalar offset it provides for multiple
> offsets via a function which depends upon the "dma-ranges" property of
> the PCIe host controller.  This is required for proper functionality
> of the BrcmSTB PCIe controller and possibly some other devices.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/1516058925-46522-5-git-send-email-jim2101024@gmail.com/
> 
> Jim Quinlan (12):
>   PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB
>   ata: ahci_brcm: Fix use of BCM7216 reset controller
>   dt-bindings: PCI: Add bindings for more Brcmstb chips
>   PCI: brcmstb: Add bcm7278 register info
>   PCI: brcmstb: Add suspend and resume pm_ops
>   PCI: brcmstb: Add bcm7278 PERST# support
>   PCI: brcmstb: Add control of rescal reset
>   device core: Introduce DMA range map, supplanting dma_pfn_offset
>   PCI: brcmstb: Set additional internal memory DMA viewport sizes
>   PCI: brcmstb: Accommodate MSI for older chips
>   PCI: brcmstb: Set bus max burst size by chip type
>   PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list
> 
>  .../bindings/pci/brcm,stb-pcie.yaml           |  56 ++-
>  arch/arm/include/asm/dma-mapping.h            |   9 +-
>  arch/arm/mach-keystone/keystone.c             |  17 +-
>  arch/sh/drivers/pci/pcie-sh7786.c             |   9 +-
>  arch/sh/kernel/dma-coherent.c                 |  16 +-
>  arch/x86/pci/sta2x11-fixup.c                  |   7 +-
>  drivers/acpi/arm64/iort.c                     |   5 +-
>  drivers/ata/ahci_brcm.c                       |  11 +-
>  drivers/gpu/drm/sun4i/sun4i_backend.c         |   5 +-
>  drivers/iommu/io-pgtable-arm.c                |   2 +-
>  .../platform/sunxi/sun4i-csi/sun4i_csi.c      |   5 +-
>  .../platform/sunxi/sun6i-csi/sun6i_csi.c      |   4 +-
>  drivers/of/address.c                          |  95 ++--
>  drivers/of/device.c                           |  47 +-
>  drivers/of/of_private.h                       |   9 +-
>  drivers/of/unittest.c                         |  35 +-
>  drivers/pci/controller/Kconfig                |   3 +-
>  drivers/pci/controller/pcie-brcmstb.c         | 408 +++++++++++++++---
>  drivers/remoteproc/remoteproc_core.c          |   2 +-
>  .../staging/media/sunxi/cedrus/cedrus_hw.c    |   7 +-
>  drivers/usb/core/message.c                    |   4 +-
>  drivers/usb/core/usb.c                        |   2 +-
>  include/linux/device.h                        |   4 +-
>  include/linux/dma-direct.h                    |  10 +-
>  include/linux/dma-mapping.h                   |  43 ++
>  include/linux/pfn.h                           |   2 +
>  kernel/dma/coherent.c                         |  10 +-
>  kernel/dma/mapping.c                          |  53 +++
>  28 files changed, 683 insertions(+), 197 deletions(-)
> 


-- 
Florian
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-07-20 23:27 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 14:35 [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips Jim Quinlan
2020-07-15 14:35 ` Jim Quinlan
2020-07-15 14:35 ` Jim Quinlan
2020-07-15 14:35 ` Jim Quinlan via iommu
2020-07-15 14:35 ` Jim Quinlan
2020-07-15 14:35 ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 01/12] PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 02/12] ata: ahci_brcm: Fix use of BCM7216 reset controller Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 03/12] dt-bindings: PCI: Add bindings for more Brcmstb chips Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 04/12] PCI: brcmstb: Add bcm7278 register info Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 05/12] PCI: brcmstb: Add suspend and resume pm_ops Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 06/12] PCI: brcmstb: Add bcm7278 PERST# support Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 07/12] PCI: brcmstb: Add control of rescal reset Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan via iommu
2020-07-21 12:51   ` Christoph Hellwig
2020-07-21 12:51     ` Christoph Hellwig
2020-07-22 22:37     ` Jim Quinlan
2020-07-22 22:37       ` Jim Quinlan
2020-07-22 22:37       ` Jim Quinlan via iommu
2020-07-15 14:35 ` [PATCH v8 09/12] PCI: brcmstb: Set additional internal memory DMA viewport sizes Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 10/12] PCI: brcmstb: Accommodate MSI for older chips Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 11/12] PCI: brcmstb: Set bus max burst size by chip type Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-15 14:35 ` [PATCH v8 12/12] PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list Jim Quinlan
2020-07-15 14:35   ` Jim Quinlan
2020-07-20 23:27 ` Florian Fainelli [this message]
2020-07-20 23:27   ` [PATCH v8 00/12] PCI: brcmstb: enable PCIe for STB chips Florian Fainelli
2020-07-20 23:27   ` Florian Fainelli
2020-07-20 23:27   ` Florian Fainelli
2020-07-20 23:27   ` Florian Fainelli
2020-07-20 23:27   ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e5be265-6029-3c43-989c-4a046dd60c50@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dan.j.williams@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=james.quinlan@broadcom.com \
    --cc=jroedel@suse.de \
    --cc=julien.grall@arm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nsaenzjulienne@suse.de \
    --cc=oneukum@suse.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robin.murphy@arm.com \
    --cc=saravanak@google.com \
    --cc=sstabellini@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.