mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@mips.com>
To: Jim Quinlan <jim2101024@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Kevin Cernekee <cernekee@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <jhogan@kernel.org>,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	"bcm-kernel-feedback-list@broadcom.com" 
	<bcm-kernel-feedback-list@broadcom.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v5 06/12] MIPS: BMIPS: add dma remap for BrcmSTB PCIe
Date: Wed, 26 Sep 2018 22:07:04 +0000	[thread overview]
Message-ID: <20180926220703.4ocppooccuot55i5@pburton-laptop> (raw)
In-Reply-To: <1537367527-20773-7-git-send-email-jim2101024@gmail.com>

Hi Jim,

On Wed, Sep 19, 2018 at 10:32:01AM -0400, Jim Quinlan wrote:
> The design of the Broadcom PCIe RC controller requires us to remap its
> DMA addresses for inbound traffic.  We do this by modifying the
> definitions of __phys_to_dma() and __dma_to_phys().
> 
> In arch/mips/bmips/dma.c, these functions are already in use to remap
> DMA addresses for the 338x SOC chips.  We leave this code alone -- and
> give its mapping priority -- but if it is not in use, the PCIe DMA
> mapping is in effect.
> 
> One might think that the two DMA remapping systems of dma.c could be
> combined, but they cannot: one governs only DMA addresses for the PCIe
> controller of BrcmSTB ARM/ARM64/MIPs chips, while the other governs
> the PCIe controller *and* other peripherals for only MIPs 338x
> chips.
> 
> Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
> ---
>  arch/mips/bmips/dma.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Please copy me/linux-mips on the whole series next time - I seem to have
only received patches 6, 8 & 9 which means I have no idea whether they
have dependencies & if so whether those dependencies have been accepted
or rejected. I also have no clue whether these patches make sense to
take through the MIPS tree or if it would make more sense for someone
else to take them with acks.

> diff --git a/arch/mips/bmips/dma.c b/arch/mips/bmips/dma.c
> index 3d13c77..292994f 100644
> --- a/arch/mips/bmips/dma.c
> +++ b/arch/mips/bmips/dma.c
> @@ -18,6 +18,7 @@
>  #include <linux/slab.h>
>  #include <linux/types.h>
>  #include <asm/bmips.h>
> +#include <soc/brcmstb/common.h>
>  
>  /*
>   * BCM338x has configurable address translation windows which allow the
> @@ -44,6 +45,10 @@ dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t pa)
>  {
>  	struct bmips_dma_range *r;
>  
> +#ifdef CONFIG_PCIE_BRCMSTB
> +	if (!bmips_dma_ranges)
> +		return brcm_phys_to_dma(dev, pa);
> +#endif
>  	for (r = bmips_dma_ranges; r && r->size; r++) {
>  		if (pa >= r->child_addr &&
>  		    pa < (r->child_addr + r->size))

I can't tell because I presume brcm_phys_to_dma() is added in one of
those patches I wasn't copied on, but perhaps you could avoid the #ifdef
by just returning brcm_phys_to_dma(dev, pa) after the loop?

> @@ -56,6 +61,10 @@ phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
>  {
>  	struct bmips_dma_range *r;
>  
> +#ifdef CONFIG_PCIE_BRCMSTB
> +	if (!bmips_dma_ranges)
> +		return (unsigned long)brcm_dma_to_phys(dev, dma_addr);
> +#endif
>  	for (r = bmips_dma_ranges; r && r->size; r++) {
>  		if (dma_addr >= r->parent_addr &&
>  		    dma_addr < (r->parent_addr + r->size))

And similar here.

Thanks,
    Paul

  reply	other threads:[~2018-09-26 22:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19 14:31 [PATCH v5 00/12] PCI: brcmstb: Add Broadcom Settopbox PCIe support (resend) Jim Quinlan
2018-09-19 14:31 ` [PATCH v5 01/12] soc: bcm: brcmstb: add memory API Jim Quinlan
2018-09-19 14:31 ` [PATCH v5 02/12] dt-bindings: pci: add DT docs for Brcmstb PCIe device Jim Quinlan
2018-09-20  9:06   ` Jonas Gorski
2018-09-21 18:00     ` Jim Quinlan
2018-09-19 14:31 ` [PATCH v5 03/12] PCI: brcmstb: add Broadcom STB PCIe host controller driver Jim Quinlan
2018-09-19 14:31 ` [PATCH v5 04/12] PCI: brcmstb: add dma-range mapping for inbound traffic Jim Quinlan
2018-09-20  2:19   ` Ard Biesheuvel
2018-09-20 20:55     ` Florian Fainelli
2018-09-20 21:04       ` Ard Biesheuvel
2018-09-20 21:31         ` Florian Fainelli
2018-09-20 21:33           ` Ard Biesheuvel
2018-09-20 21:39             ` Florian Fainelli
2018-09-21 17:40               ` Jim Quinlan
2018-09-24  8:25                 ` Ard Biesheuvel
2018-09-24 15:01                   ` Jim Quinlan
2018-09-26  2:59                     ` Florian Fainelli
2018-09-26  7:59                       ` Ard Biesheuvel
2018-09-26 10:56                       ` Robin Murphy
2018-10-01 18:13                         ` Florian Fainelli
2019-06-27 16:55                     ` Stefan Wahren
2018-09-19 14:32 ` [PATCH v5 05/12] PCI: brcmstb: add MSI capability Jim Quinlan
2018-09-19 14:32 ` [PATCH v5 06/12] MIPS: BMIPS: add dma remap for BrcmSTB PCIe Jim Quinlan
2018-09-26 22:07   ` Paul Burton [this message]
2018-09-28 21:48     ` Jim Quinlan
2018-09-19 14:32 ` [PATCH v5 07/12] PCI/MSI: enable PCI_MSI_IRQ_DOMAIN support for MIPS Jim Quinlan
2018-09-19 14:32 ` [PATCH v5 08/12] MIPS: BMIPS: add PCI bindings for 7425, 7435 Jim Quinlan
2018-09-19 14:32 ` [PATCH v5 09/12] MIPS: BMIPS: enable PCI Jim Quinlan
2018-09-19 14:32 ` [PATCH v5 10/12] ARM64: declare __phys_to_dma on ARCH_HAS_PHYS_TO_DMA Jim Quinlan
2018-09-19 14:37   ` Christoph Hellwig
2018-09-19 14:32 ` [PATCH v5 11/12] ARM64: add dma remap for BrcmSTB PCIe Jim Quinlan
2018-09-19 14:41   ` Christoph Hellwig
2018-09-21 18:29     ` Jim Quinlan
2018-09-19 14:32 ` [PATCH v5 12/12] ARM: " Jim Quinlan
2019-03-20 23:15 ` [PATCH v5 00/12] PCI: brcmstb: Add Broadcom Settopbox PCIe support (resend) Bjorn Helgaas
2019-03-20 23:22   ` 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=20180926220703.4ocppooccuot55i5@pburton-laptop \
    --to=paul.burton@mips.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=cernekee@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=hch@lst.de \
    --cc=jhogan@kernel.org \
    --cc=jim2101024@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®