From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Rob Herring <robherring2@gmail.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Russell King <linux@arm.linux.org.uk>,
Peter Maydell <peter.maydell@linaro.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
"arm@kernel.org" <arm@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH 4/9] pci: add DT based ARM Versatile PCI host driver
Date: Mon, 05 Jan 2015 10:35:32 +0100 [thread overview]
Message-ID: <29010664.sxfpXiecGs@wuerfel> (raw)
In-Reply-To: <CAL_JsqKj3KCwgtb8SViiAFSqhOS0gSq2gLQU1G3kFmV6o=q5iQ@mail.gmail.com>
On Friday 02 January 2015 17:13:19 Rob Herring wrote:
> On Fri, Jan 2, 2015 at 2:52 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Friday 02 January 2015 12:14:43 Rob Herring wrote:
> >> On Tue, Dec 30, 2014 at 3:58 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> >> > On Tuesday 30 December 2014 13:28:33 Rob Herring wrote:
> >> > Maybe just return PCIBIOS_BAD_REGISTER_NUMBER in this case?
> >>
> >> Perhaps. We could probably simplify the config space read/write
> >> functions and just provide the PCI core a bus/devfn/offset to config
> >> address translation function. That would not work in all cases, but
> >> propably most that have memory mapped config space.
> >
> > Actually, thinking about this some more, the implementation seems to
> > be "CAM" compliant, and we could share the confic space accessors with
> > the ones from drivers/pci/host/pci-host-generic.c.
>
> Almost. It uses readl for all size accesses. Yet writes support
> different access sizes. I would guess that the h/w can support byte
> and word reads if writes are supported, but I can't really verify.
> Dword-only sized reads or reads and writes seem to be the main
> variations for config space accesses. There's a few hosts with more
> complex config space access setup, but quite a few only vary in
> address decode.
It was probably just done the current way because it seemed simpler
at the time, but I agree that we can just keep it like this if there
is any chance it's required as a workaround for a hardware glitch.
With your other patch you just posted, it really becomes trivial
to do.
> >> I'm a bit puzzled myself. I think that the devices are not probed
> >> until after pci_assign_unassigned_bus_resources. It certainly doesn't
> >> work without that call. Really, I think of_irq_parse_and_map_pci
> >> should be the default if no one else has set the device's irq (and the
> >> host has a device node of course).
> >>
> >> It also seems to be a bit of random set of pci functions that are
> >> called here. It would be nice to simplify this chunk of code.
> >
> > Yes, and we recently had some attempts at creating a better interface posted
> > on the mailing list, not sure what the latest status on it is. I think we
> > want to end up with a two-stage interface along the lines of:
> >
> > /* allocate a pci_host_bridge, scan DT, set default operations, map
> > I/O space if necessary, request all resources ... */
> > phb = pci_host_bridge_create(parent, ..., sizeof(struct my_pci_private));
>
> Humm, I wondered what happened to pci_host_bridge_create and thought
> we had abandoned it. It wasn't too clear reading thru the threads. The
> host drivers generally still have to walk thru the resources anyway to
> setup inbound and outbound windows, so we don't gain too much moving
> that out.
I think the discussion has not ended yet, I'm still in favor of
doing it like that. The current of_pci_get_host_bridge_resources()
function is indeed lacking a bit because it just returns the resources
that are needed for setting up the PCI side, but it doesn't
provide a list of the host side windows that may need to get programmed
into hardware registers on machines without a firmware that has set them
up in advance (i.e. most ARM32 and MIPS32 machines).
We could add another exported function to return those, or we could
find a way to pass those back through the pci_host_bridge pointer
from the common function.
Setting up the PCI side by itself does seem useful to me though, mainly
to prevent host controller drivers from getting it wrong.
> And the error clean-up gets complicated too.
In what way? I would hope that we could come up with a way to make
pci_host_bridge_create() able to roll-back, so it does nothing in
case of an error, and allocate all resources using devm_* so it
all gets undone if probe() fails for another reason.
Arnd
next prev parent reply other threads:[~2015-01-05 9:35 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 19:28 [PATCH 0/9] ARM Versatile multi-platform support Rob Herring
2014-12-30 19:28 ` [PATCH 4/9] pci: add DT based ARM Versatile PCI host driver Rob Herring
2014-12-30 21:58 ` Arnd Bergmann
2015-01-02 18:14 ` Rob Herring
2015-01-02 20:52 ` Arnd Bergmann
2015-01-02 23:13 ` Rob Herring
2015-01-05 9:35 ` Arnd Bergmann [this message]
2015-01-24 1:01 ` Bjorn Helgaas
2015-01-24 0:54 ` Bjorn Helgaas
[not found] ` <1419967718-26909-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-12-30 19:28 ` [PATCH 1/9] dt/bindings: add versatile PCI binding Rob Herring
2014-12-30 19:28 ` [PATCH 2/9] dts: versatile: add PCI controller binding Rob Herring
2014-12-30 19:28 ` [PATCH 3/9] ARM: versatile: add DT based PCI detection Rob Herring
[not found] ` <1419967718-26909-4-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-12-30 21:37 ` Arnd Bergmann
2014-12-30 23:05 ` Rob Herring
[not found] ` <CAL_Jsq+iVWPsN9LXEMT6DmjS7MGsnmgJLgyb33N3me=OcCet6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-31 15:23 ` Arnd Bergmann
2014-12-31 16:13 ` Peter Maydell
[not found] ` <CAFEAcA9=eoP4-F0Z8J171=DHE5JHVn7ahMnQrHQFz9SHePQHNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-31 19:22 ` Rob Herring
[not found] ` <CAL_JsqLBCeCc2VKvHAdG5bBJt=2qmX5BnosdGd_2n+Pb9BhuZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-31 21:07 ` Peter Maydell
[not found] ` <CAFEAcA-=2GGEAdnO9+8EV+8OkwUHj3tRiMYWvS4b-cpy6P6rYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-01 15:35 ` Arnd Bergmann
2015-01-01 15:52 ` Peter Maydell
2015-01-08 19:37 ` Linus Walleij
[not found] ` <CACRpkdYEHwXhw3nEPHp7+4rtzXyh9Qb2QCpsRMfopxNoaX3rLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-08 21:34 ` Rob Herring
2014-12-30 19:28 ` [PATCH 5/9] dts: versatile: add sysregs nodes Rob Herring
[not found] ` <1419967718-26909-6-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-08 19:44 ` Linus Walleij
[not found] ` <CACRpkdbinR3Uvi5zZmQJFxJgnWfvE6JZouMVxxRRGVtMNXkBQQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-08 23:53 ` Rob Herring
[not found] ` <CAL_JsqKBLx03E1w0NMH8CH+Pm_L8yQvnR6VTTDxqnpOwAoDhXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-09 7:10 ` Linus Walleij
[not found] ` <CACRpkdZFxToT5L0sJXap-NQGtjkryn4KTZVnweKCxXL9WvFLEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-09 11:53 ` Lorenzo Pieralisi
2015-01-15 16:06 ` Lorenzo Pieralisi
2015-01-19 10:25 ` Linus Walleij
2014-12-30 19:28 ` [PATCH 6/9] ARM: versatile: switch to DT only booting and remove legacy code Rob Herring
2014-12-30 19:28 ` [PATCH 7/9] ARM: versatile: move mach includes into mach directory Rob Herring
[not found] ` <1419967718-26909-8-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-12-30 22:05 ` Arnd Bergmann
2014-12-30 19:28 ` [PATCH 8/9] ARM: versatile: convert to multi-platform Rob Herring
2014-12-30 19:28 ` [PATCH 9/9] ARM: versatile: consolidate code to single file Rob Herring
2014-12-30 22:08 ` [PATCH 0/9] ARM Versatile multi-platform support Arnd Bergmann
2014-12-31 9:25 ` Peter Maydell
[not found] ` <CAFEAcA9pKdRNQ-fgKumQhjTjei-4NJ-OB1gSOxTCnCjShy10jw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-05 9:50 ` Marc Zyngier
[not found] ` <54AA5E7C.1040706-5wv7dgnIgG8@public.gmane.org>
2015-01-05 10:08 ` Peter Maydell
[not found] ` <CAFEAcA8Nq6BPOerN7EhHpT_oa9W3+2Y_=5+zBuQD_c5fh0Yb1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-05 11:19 ` Marc Zyngier
[not found] ` <87y4ph79wb.fsf-BgpFEFc6EmV6Fr0h90IsVGS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2015-01-05 17:41 ` Peter Maydell
2015-01-08 19:47 ` Linus Walleij
[not found] ` <CACRpkda8T8CwghVYtTw41h_y+GdCA5xCEaSL1Jy4VZBo3MAy-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-08 21:38 ` Rob Herring
[not found] ` <CAL_JsqKLNPVDCUELaZU8JW0roT3RcyqcxtJbvbYQrjzxjt3FeQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-09 8:34 ` Linus Walleij
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=29010664.sxfpXiecGs@wuerfel \
--to=arnd@arndb.de \
--cc=arm@kernel.org \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=peter.maydell@linaro.org \
--cc=robherring2@gmail.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