linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Srinath Mannam <srinath.mannam@broadcom.com>
To: Rob Herring <robh@kernel.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
	Karthikeyan Mitran <m.karthikeyan@mobiveil.co.in>,
	linux-pci@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Toan Le <toan@os.amperecomputing.com>,
	Will Deacon <will@kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Christoph Hellwig <hch@infradead.org>,
	linux-rockchip@lists.infradead.org,
	BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	Shawn Lin <shawn.lin@rock-chips.com>, Ray Jui <rjui@broadcom.com>,
	Hou Zhiqiang <Zhiqiang.Hou@nxp.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	linux-mediatek@lists.infradead.org,
	Andrew Murray <andrew.murray@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Scott Branden <sbranden@broadcom.com>,
	Jingoo Han <jingoohan1@gmail.com>,
	rfi@lists.rocketboards.org, linux-renesas-soc@vger.kernel.org,
	Tom Joseph <tjoseph@cadence.com>,
	Simon Horman <horms@verge.net.au>,
	Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
	Ley Foon Tan <lftan@altera.com>
Subject: Re: [PATCH v3 23/25] PCI: iproc: Use inbound resources for setup
Date: Tue, 29 Oct 2019 21:29:35 +0530	[thread overview]
Message-ID: <CABe79T4p-YJp7nNx0iyyx46PFWBC57H-2+VL=RM9rKK-X4qdFg@mail.gmail.com> (raw)
In-Reply-To: <20191028163256.8004-24-robh@kernel.org>

Hi Rob,

I reviewed and verified this change.. It is working fine.

Regards,
Srinath.

On Mon, Oct 28, 2019 at 10:03 PM Rob Herring <robh@kernel.org> wrote:
>
> Now that the helpers provide the inbound resources in the host bridge
> 'dma_ranges' resource list, convert Broadcom iProc host bridge to use
> the resource list to setup the inbound addresses.
>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Reviewed-by: Andrew Murray <andrew.murray@arm.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> v2:
>  - Fix iproc_pcie_paxb_v2_msi_steer() to use resource_entry
> ---
>  drivers/pci/controller/pcie-iproc.c | 77 +++++++----------------------
>  1 file changed, 17 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index 223335ee791a..f4d78e66846e 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -1122,15 +1122,16 @@ static int iproc_pcie_ib_write(struct iproc_pcie *pcie, int region_idx,
>  }
>
>  static int iproc_pcie_setup_ib(struct iproc_pcie *pcie,
> -                              struct of_pci_range *range,
> +                              struct resource_entry *entry,
>                                enum iproc_pcie_ib_map_type type)
>  {
>         struct device *dev = pcie->dev;
>         struct iproc_pcie_ib *ib = &pcie->ib;
>         int ret;
>         unsigned int region_idx, size_idx;
> -       u64 axi_addr = range->cpu_addr, pci_addr = range->pci_addr;
> -       resource_size_t size = range->size;
> +       u64 axi_addr = entry->res->start;
> +       u64 pci_addr = entry->res->start - entry->offset;
> +       resource_size_t size = resource_size(entry->res);
>
>         /* iterate through all IARR mapping regions */
>         for (region_idx = 0; region_idx < ib->nr_regions; region_idx++) {
> @@ -1182,66 +1183,19 @@ static int iproc_pcie_setup_ib(struct iproc_pcie *pcie,
>         return ret;
>  }
>
> -static int iproc_pcie_add_dma_range(struct device *dev,
> -                                   struct list_head *resources,
> -                                   struct of_pci_range *range)
> -{
> -       struct resource *res;
> -       struct resource_entry *entry, *tmp;
> -       struct list_head *head = resources;
> -
> -       res = devm_kzalloc(dev, sizeof(struct resource), GFP_KERNEL);
> -       if (!res)
> -               return -ENOMEM;
> -
> -       resource_list_for_each_entry(tmp, resources) {
> -               if (tmp->res->start < range->cpu_addr)
> -                       head = &tmp->node;
> -       }
> -
> -       res->start = range->cpu_addr;
> -       res->end = res->start + range->size - 1;
> -
> -       entry = resource_list_create_entry(res, 0);
> -       if (!entry)
> -               return -ENOMEM;
> -
> -       entry->offset = res->start - range->cpu_addr;
> -       resource_list_add(entry, head);
> -
> -       return 0;
> -}
> -
>  static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie)
>  {
>         struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
> -       struct of_pci_range range;
> -       struct of_pci_range_parser parser;
> -       int ret;
> -       LIST_HEAD(resources);
> -
> -       /* Get the dma-ranges from DT */
> -       ret = of_pci_dma_range_parser_init(&parser, pcie->dev->of_node);
> -       if (ret)
> -               return ret;
> +       struct resource_entry *entry;
> +       int ret = 0;
>
> -       for_each_of_pci_range(&parser, &range) {
> -               ret = iproc_pcie_add_dma_range(pcie->dev,
> -                                              &resources,
> -                                              &range);
> -               if (ret)
> -                       goto out;
> +       resource_list_for_each_entry(entry, &host->dma_ranges) {
>                 /* Each range entry corresponds to an inbound mapping region */
> -               ret = iproc_pcie_setup_ib(pcie, &range, IPROC_PCIE_IB_MAP_MEM);
> +               ret = iproc_pcie_setup_ib(pcie, entry, IPROC_PCIE_IB_MAP_MEM);
>                 if (ret)
> -                       goto out;
> +                       break;
>         }
>
> -       list_splice_init(&resources, &host->dma_ranges);
> -
> -       return 0;
> -out:
> -       pci_free_resource_list(&resources);
>         return ret;
>  }
>
> @@ -1276,13 +1230,16 @@ static int iproce_pcie_get_msi(struct iproc_pcie *pcie,
>  static int iproc_pcie_paxb_v2_msi_steer(struct iproc_pcie *pcie, u64 msi_addr)
>  {
>         int ret;
> -       struct of_pci_range range;
> +       struct resource_entry entry;
> +
> +       memset(&entry, 0, sizeof(entry));
> +       entry.res = &entry.__res;
>
> -       memset(&range, 0, sizeof(range));
> -       range.size = SZ_32K;
> -       range.pci_addr = range.cpu_addr = msi_addr & ~(range.size - 1);
> +       msi_addr &= ~(SZ_32K - 1);
> +       entry.res->start = msi_addr;
> +       entry.res->end = msi_addr + SZ_32K - 1;
>
> -       ret = iproc_pcie_setup_ib(pcie, &range, IPROC_PCIE_IB_MAP_IO);
> +       ret = iproc_pcie_setup_ib(pcie, &entry, IPROC_PCIE_IB_MAP_IO);
>         return ret;
>  }
>
> --
> 2.20.1
>

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

  reply	other threads:[~2019-10-29 16:00 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 16:32 [PATCH v3 00/25] PCI host resource consolidation Rob Herring
2019-10-28 16:32 ` [PATCH v3 01/25] resource: Add a resource_list_first_type helper Rob Herring
2019-10-28 16:32 ` [PATCH v3 02/25] PCI: Export pci_parse_request_of_pci_ranges() Rob Herring
2019-10-28 16:32 ` [PATCH v3 03/25] PCI: aardvark: Use pci_parse_request_of_pci_ranges() Rob Herring
2019-10-28 16:32 ` [PATCH v3 04/25] PCI: altera: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 05/25] PCI: dwc: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 06/25] PCI: faraday: " Rob Herring
2019-11-03 19:12   ` Linus Walleij
2019-10-28 16:32 ` [PATCH v3 07/25] PCI: iproc: " Rob Herring
2019-10-29 15:58   ` Srinath Mannam
2019-10-29 17:09     ` Florian Fainelli
2019-10-28 16:32 ` [PATCH v3 08/25] PCI: mediatek: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 09/25] PCI: mobiveil: " Rob Herring
2019-10-29  9:00   ` Z.q. Hou
2019-10-28 16:32 ` [PATCH v3 10/25] PCI: rockchip: " Rob Herring
2019-12-05 17:56   ` Enric Balletbo Serra
2019-12-06 13:52     ` Lorenzo Pieralisi
2019-12-06 14:09     ` Lorenzo Pieralisi
2019-12-06 14:59       ` Enric Balletbo Serra
2019-10-28 16:32 ` [PATCH v3 11/25] PCI: rockchip: Drop storing driver private outbound resource data Rob Herring
2019-12-06 15:36   ` Lorenzo Pieralisi
2019-12-10 17:33     ` Enric Balletbo Serra
2019-12-11  9:39       ` Enric Balletbo Serra
2019-10-28 16:32 ` [PATCH v3 12/25] PCI: v3-semi: Use pci_parse_request_of_pci_ranges() Rob Herring
2019-10-28 16:32 ` [PATCH v3 13/25] PCI: xgene: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 14/25] PCI: xilinx: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 15/25] PCI: xilinx-nwl: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 16/25] PCI: versatile: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 17/25] PCI: versatile: Remove usage of PHYS_OFFSET Rob Herring
2019-10-28 16:32 ` [PATCH v3 18/25] PCI: versatile: Enable COMPILE_TEST Rob Herring
2019-10-28 16:32 ` [PATCH v3 19/25] PCI: of: Add inbound resource parsing to helpers Rob Herring
2019-10-29 11:07   ` Lorenzo Pieralisi
2019-10-29 15:56     ` Srinath Mannam
2019-10-29 17:34       ` Lorenzo Pieralisi
2019-10-30  6:44         ` Srinath Mannam
2019-10-30 11:48           ` Lorenzo Pieralisi
2019-10-30 12:49             ` Robin Murphy
2019-10-30 14:56               ` Lorenzo Pieralisi
2019-10-30 22:18                 ` Rob Herring
2019-10-31 10:09                   ` Lorenzo Pieralisi
2019-10-29 22:12     ` Bjorn Helgaas
2019-10-28 16:32 ` [PATCH v3 20/25] PCI: ftpci100: Use inbound resources for setup Rob Herring
2019-10-28 16:32 ` [PATCH v3 21/25] PCI: v3-semi: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 22/25] PCI: xgene: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 23/25] PCI: iproc: " Rob Herring
2019-10-29 15:59   ` Srinath Mannam [this message]
2019-10-28 16:32 ` [PATCH v3 24/25] PCI: rcar: " Rob Herring
2019-10-28 16:32 ` [PATCH v3 25/25] PCI: Make devm_of_pci_get_host_bridge_resources() static Rob Herring
2019-10-31 10:57 ` [PATCH v3 00/25] PCI host resource consolidation Lorenzo Pieralisi

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='CABe79T4p-YJp7nNx0iyyx46PFWBC57H-2+VL=RM9rKK-X4qdFg@mail.gmail.com' \
    --to=srinath.mannam@broadcom.com \
    --cc=Zhiqiang.Hou@nxp.com \
    --cc=andrew.murray@arm.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=hch@infradead.org \
    --cc=heiko@sntech.de \
    --cc=horms@verge.net.au \
    --cc=jingoohan1@gmail.com \
    --cc=lftan@altera.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=m.karthikeyan@mobiveil.co.in \
    --cc=matthias.bgg@gmail.com \
    --cc=michal.simek@xilinx.com \
    --cc=rfi@lists.rocketboards.org \
    --cc=rjui@broadcom.com \
    --cc=robh@kernel.org \
    --cc=ryder.lee@mediatek.com \
    --cc=sbranden@broadcom.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tjoseph@cadence.com \
    --cc=toan@os.amperecomputing.com \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).