devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Will Deacon <will.deacon@arm.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH] PCI: generic: Fix address window calculation for non-zero starting bus.
Date: Thu, 8 Oct 2015 17:05:07 -0500	[thread overview]
Message-ID: <CAL_JsqKobjdCOHiQLEStp4Q12e9=3dLZUgq+TuTkmoFVtAz5xw@mail.gmail.com> (raw)
In-Reply-To: <1444334056-4870-1-git-send-email-ddaney.cavm@gmail.com>

On Thu, Oct 8, 2015 at 2:54 PM, David Daney <ddaney.cavm@gmail.com> wrote:
> From: David Daney <david.daney@cavium.com>
>
> Make the offset from the beginning of the "reg" property be from the
> starting bus number, rather than zero.  Hoist the invariant size
> calculation out of the mapping for loop.
>
> Update host-generic-pci.txt to clarify the semantics of the "reg"
> property with respect to non-zero starting bus numbers.
>
> Signed-off-by: David Daney <david.daney@cavium.com>

Acked-by: Rob Herring <robh@kernel.org>

> ---
> This is a replacement for:
>
> https://lkml.org/lkml/2015/10/2/653
>
> Since that patch is getting too much push-back, this is the only other
> option for fixing the driver to be internally consistent in its
> treatment of the offset from "reg" to the first bus in the "bus-range"
> property.
>
>  Documentation/devicetree/bindings/pci/host-generic-pci.txt | 5 +++--
>  drivers/pci/host/pci-host-generic.c                        | 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/pci/host-generic-pci.txt b/Documentation/devicetree/bindings/pci/host-generic-pci.txt
> index cf3e205..3f1d3fc 100644
> --- a/Documentation/devicetree/bindings/pci/host-generic-pci.txt
> +++ b/Documentation/devicetree/bindings/pci/host-generic-pci.txt
> @@ -34,8 +34,9 @@ Properties of the host controller node:
>  - #size-cells    : Must be 2.
>
>  - reg            : The Configuration Space base address and size, as accessed
> -                   from the parent bus.
> -
> +                   from the parent bus.  The base address corresponds to
> +                   the first bus in the "bus-range" property.  If no
> +                   "bus-range" is specified, this will be bus 0 (the default).
>
>  Properties of the /chosen node:
>
> diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
> index fe9a81b..bb93346 100644
> --- a/drivers/pci/host/pci-host-generic.c
> +++ b/drivers/pci/host/pci-host-generic.c
> @@ -169,6 +169,7 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci)
>         struct resource *bus_range;
>         struct device *dev = pci->host.dev.parent;
>         struct device_node *np = dev->of_node;
> +       u32 sz = 1 << pci->cfg.ops->bus_shift;
>
>         err = of_address_to_resource(np, 0, &pci->cfg.res);
>         if (err) {
> @@ -196,10 +197,9 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci)
>         bus_range = pci->cfg.bus_range;
>         for (busn = bus_range->start; busn <= bus_range->end; ++busn) {
>                 u32 idx = busn - bus_range->start;
> -               u32 sz = 1 << pci->cfg.ops->bus_shift;
>
>                 pci->cfg.win[idx] = devm_ioremap(dev,
> -                                                pci->cfg.res.start + busn * sz,
> +                                                pci->cfg.res.start + idx * sz,
>                                                  sz);
>                 if (!pci->cfg.win[idx])
>                         return -ENOMEM;
> --
> 1.9.1
>

  parent reply	other threads:[~2015-10-08 22:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 19:54 [PATCH] PCI: generic: Fix address window calculation for non-zero starting bus David Daney
2015-10-08 21:09 ` Arnd Bergmann
2015-10-08 22:05 ` Rob Herring [this message]
2015-10-09 23:21 ` Bjorn Helgaas

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='CAL_JsqKobjdCOHiQLEStp4Q12e9=3dLZUgq+TuTkmoFVtAz5xw@mail.gmail.com' \
    --to=robherring2@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=david.daney@cavium.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=will.deacon@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 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).