* Re: [PATCH 01/17] drivers: support PCIe in RISCV
[not found] ` <20170606230007.19101-2-palmer@dabbelt.com>
@ 2017-06-07 7:17 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2017-06-07 7:17 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: Linux-Arch, linux-kernel@vger.kernel.org, Arnd Bergmann,
Olof Johansson, albert, patches, Wesley W. Terpstra,
Bjorn Helgaas, linux-pci
CC pci folks
On Wed, Jun 7, 2017 at 12:59 AM, Palmer Dabbelt <palmer@dabbelt.com> wrote:
> From: "Wesley W. Terpstra" <wesley@sifive.com>
>
> There are RISC-V systems that have been mapped to Xilinx FPGAs that have
> their PCIe controllers on chip. These build system changes allow RISC-V
> systems to enable the Xilinx PCIe controller, and to setup PCIe IRQs.
>
> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
> ---
> drivers/pci/Makefile | 1 +
> drivers/pci/host/Kconfig | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> index 462c1f5f5546..a29d9ec05d13 100644
> --- a/drivers/pci/Makefile
> +++ b/drivers/pci/Makefile
> @@ -41,6 +41,7 @@ obj-$(CONFIG_MIPS) += setup-irq.o
> obj-$(CONFIG_TILE) += setup-irq.o
> obj-$(CONFIG_SPARC_LEON) += setup-irq.o
> obj-$(CONFIG_M68K) += setup-irq.o
> +obj-$(CONFIG_RISCV) += setup-irq.o
>
> #
> # ACPI Related PCI FW Functions
> diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
> index 7f47cd5e10a5..5148f3d3cab7 100644
> --- a/drivers/pci/host/Kconfig
> +++ b/drivers/pci/host/Kconfig
> @@ -71,7 +71,7 @@ config PCI_HOST_GENERIC
>
> config PCIE_XILINX
> bool "Xilinx AXI PCIe host bridge support"
> - depends on ARCH_ZYNQ || MICROBLAZE
> + depends on ARCH_ZYNQ || MICROBLAZE || RISCV
> help
> Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
> Host Bridge driver.
> --
> 2.13.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 02/17] pcie-xilinx: add missing 5th legacy interrupt
[not found] ` <20170606230007.19101-3-palmer@dabbelt.com>
@ 2017-06-07 7:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2017-06-07 7:18 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: Linux-Arch, linux-kernel@vger.kernel.org, Arnd Bergmann,
Olof Johansson, albert, patches, Wesley W. Terpstra,
Bjorn Helgaas, Michal Simek, Soren Brinkmann, linux-pci
CC pci folks
On Wed, Jun 7, 2017 at 12:59 AM, Palmer Dabbelt <palmer@dabbelt.com> wrote:
> From: "Wesley W. Terpstra" <wesley@sifive.com>
>
> These are numbered from 1.
>
> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
> ---
> drivers/pci/host/pcie-xilinx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
> index 2fe2df51f9f8..8804145d399a 100644
> --- a/drivers/pci/host/pcie-xilinx.c
> +++ b/drivers/pci/host/pcie-xilinx.c
> @@ -443,7 +443,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
> val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
> XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
> generic_handle_irq(irq_find_mapping(port->leg_domain,
> - val));
> + val + 1));
> }
> }
>
> @@ -524,7 +524,7 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
> return -ENODEV;
> }
>
> - port->leg_domain = irq_domain_add_linear(pcie_intc_node, 4,
> + port->leg_domain = irq_domain_add_linear(pcie_intc_node, 5,
> &intx_domain_ops,
> port);
> if (!port->leg_domain) {
> --
> 2.13.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 06/17] pci: Add generic pcibios_{fixup_bus,align_resource}
[not found] ` <20170606230007.19101-7-palmer@dabbelt.com>
@ 2017-06-07 7:19 ` Geert Uytterhoeven
2017-06-07 8:01 ` Arnd Bergmann
2017-06-08 8:12 ` Christoph Hellwig
0 siblings, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2017-06-07 7:19 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: Linux-Arch, linux-kernel@vger.kernel.org, Arnd Bergmann,
Olof Johansson, albert, patches, Bjorn Helgaas, linux-pci
CC pci folks
On Wed, Jun 7, 2017 at 12:59 AM, Palmer Dabbelt <palmer@dabbelt.com> wrote:
> While upstreaming the RISC-V port, it was pointed out that multiple
> architectures (arc, arm64, cris, microblaze, sh, tile) have copied the
> mostly empty versions of at least one of these functions. This defines
> weakly bound versions of the common functions so other architetures can
> use them.
>
> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
> ---
> drivers/pci/Makefile | 2 +-
> drivers/pci/bios.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 43 insertions(+), 1 deletion(-)
> create mode 100644 drivers/pci/bios.c
>
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> index a29d9ec05d13..fa7040915194 100644
> --- a/drivers/pci/Makefile
> +++ b/drivers/pci/Makefile
> @@ -4,7 +4,7 @@
>
> obj-y += access.o bus.o probe.o host-bridge.o remove.o pci.o \
> pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
> - irq.o vpd.o setup-bus.o vc.o mmap.o
> + irq.o vpd.o setup-bus.o vc.o mmap.o bios.o
> obj-$(CONFIG_PROC_FS) += proc.o
> obj-$(CONFIG_SYSFS) += slot.o
>
> diff --git a/drivers/pci/bios.c b/drivers/pci/bios.c
> new file mode 100644
> index 000000000000..ffe34c024aa8
> --- /dev/null
> +++ b/drivers/pci/bios.c
> @@ -0,0 +1,42 @@
> +/*
> + * Code borrowed from arch/arm64/kernel/pci.c
> + * which borrowed from powerpc/kernel/pci-common.c
> + * which borrowed from arch/alpha/kernel/pci.c
> + *
> + * Extruded from code written by
> + * Dave Rusling (david.rusling@reo.mts.dec.com)
> + * David Mosberger (davidm@cs.arizona.edu)
> + * Copyright (C) 1999 Andrea Arcangeli <andrea@suse.de>
> + * Copyright (C) 2000 Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> + * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
> + * Copyright (C) 2014 ARM Ltd.
> + * Copyright (C) 2017 SiFive
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + */
> +
> +/* This file contains weakly bound functions that implement pcibios functions
> + * that some architectures have copied verbatim.
> + */
> +
> +#include <linux/pci.h>
> +
> +/*
> + * Called after each bus is probed, but before its children are examined
> + */
> +__attribute__ ((weak))
> +void pcibios_fixup_bus(struct pci_bus *bus)
> +{
> + /* nothing to do, expected to be removed in the future */
> +}
> +/*
> + * We don't have to worry about legacy ISA devices, so nothing to do here
> + */
> +__attribute__ ((weak))
> +resource_size_t pcibios_align_resource(void *data, const struct resource *res,
> + resource_size_t size, resource_size_t align)
> +{
> + return res->start;
> +}
> --
> 2.13.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 06/17] pci: Add generic pcibios_{fixup_bus,align_resource}
2017-06-07 7:19 ` [PATCH 06/17] pci: Add generic pcibios_{fixup_bus,align_resource} Geert Uytterhoeven
@ 2017-06-07 8:01 ` Arnd Bergmann
2017-06-08 8:12 ` Christoph Hellwig
1 sibling, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2017-06-07 8:01 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Palmer Dabbelt, Linux-Arch, linux-kernel@vger.kernel.org,
Olof Johansson, albert, patches, Bjorn Helgaas, linux-pci
On Wed, Jun 7, 2017 at 9:19 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> CC pci folks
>
> On Wed, Jun 7, 2017 at 12:59 AM, Palmer Dabbelt <palmer@dabbelt.com> wrote:
>> While upstreaming the RISC-V port, it was pointed out that multiple
>> architectures (arc, arm64, cris, microblaze, sh, tile) have copied the
>> mostly empty versions of at least one of these functions. This defines
>> weakly bound versions of the common functions so other architetures can
>> use them.
>>
>> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Thanks a lot for taking care of this!
>> diff --git a/drivers/pci/bios.c b/drivers/pci/bios.c
>> new file mode 100644
>> index 000000000000..ffe34c024aa8
>> --- /dev/null
>> +++ b/drivers/pci/bios.c
>> @@ -0,0 +1,42 @@
>> +
>> +/* This file contains weakly bound functions that implement pcibios functions
>> + * that some architectures have copied verbatim.
>> + */
Instead of adding a new file, I would suggest adding the two functions next
to their callers, in probe.c and setup-res.c, respectively.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 06/17] pci: Add generic pcibios_{fixup_bus,align_resource}
2017-06-07 7:19 ` [PATCH 06/17] pci: Add generic pcibios_{fixup_bus,align_resource} Geert Uytterhoeven
2017-06-07 8:01 ` Arnd Bergmann
@ 2017-06-08 8:12 ` Christoph Hellwig
2017-06-08 8:35 ` Arnd Bergmann
1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2017-06-08 8:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Palmer Dabbelt, Linux-Arch, linux-kernel@vger.kernel.org,
Arnd Bergmann, Olof Johansson, albert, patches, Bjorn Helgaas,
linux-pci
On Wed, Jun 07, 2017 at 09:19:49AM +0200, Geert Uytterhoeven wrote:
> CC pci folks
Ok, replying with pci folks in Cc then :)
Weak symbols have (rightly) gotten a bad reputation, so maybe
we should approach this without them.
It seems we have a large number of emptry pcibios_fixup_bus calls
alreayd, so I think we should simply have the architectures
that do define it define a Kconfig or header symbol and not call
it at all otherwise.
For the ones that exist as lot just seem to call pci_read_bridge_bases
and/or pcibios_fixup_device_resources in one form or another,
and I wonder why we even need the arch indirection for that.
Similarly for pcibios_align_resource: a lot of architetures seem
to have a noop, and the once that don't mostly seem copy and
paste code, so we should again have a symbol for architectures
to opt into it, and we probably should have a generic helper
for the VGA window mirroring code instead of duplicating it multiple
times.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 06/17] pci: Add generic pcibios_{fixup_bus,align_resource}
2017-06-08 8:12 ` Christoph Hellwig
@ 2017-06-08 8:35 ` Arnd Bergmann
0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2017-06-08 8:35 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Geert Uytterhoeven, Palmer Dabbelt, Linux-Arch,
linux-kernel@vger.kernel.org, Olof Johansson, albert, patches,
Bjorn Helgaas, linux-pci
On Thu, Jun 8, 2017 at 10:12 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Wed, Jun 07, 2017 at 09:19:49AM +0200, Geert Uytterhoeven wrote:
>> CC pci folks
>
> Ok, replying with pci folks in Cc then :)
>
> Weak symbols have (rightly) gotten a bad reputation, so maybe
> we should approach this without them.
Agreed, I would almost never recommend using a __weak symbol,
but they are already widely used in the PCI subsystem, so I suggested
using them here for consistency.
We have a struct pci_host_bridge now, and we should eventually
move most of the 38 pci specific weak per-architecture symbols
into per-host driver callbacks, but that I think that would be too much
to ask for when adding an architecture port.
> It seems we have a large number of emptry pcibios_fixup_bus calls
> alreayd, so I think we should simply have the architectures
> that do define it define a Kconfig or header symbol and not call
> it at all otherwise.
I would argue that most of them should not be per-architecture
in the first place, the current state is mostly an artifact of the
times when each architecture had just one PCI implementation.
The ones that have multiple implementations (arm, powerpc, ...)
tend to actually override the weak functions with their own
per-host multiplexers again.
> For the ones that exist as lot just seem to call pci_read_bridge_bases
> and/or pcibios_fixup_device_resources in one form or another,
> and I wonder why we even need the arch indirection for that.
>
> Similarly for pcibios_align_resource: a lot of architetures seem
> to have a noop, and the once that don't mostly seem copy and
> paste code, so we should again have a symbol for architectures
> to opt into it, and we probably should have a generic helper
> for the VGA window mirroring code instead of duplicating it multiple
> times.
I now remember that we already have a host_bridge->align_resource
callback pointer, so the generic function should definitely try
to use that.
We could just use the version from arch/mips/pci/pci-generic.c
and remove that in the process. I'm not sure about why mips calls
pci_read_bridge_bases() in pcibios_fixup_bus() though, or whether
this make sense to put in the generic version.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-06-08 8:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170523004107.536-1-palmer@dabbelt.com>
[not found] ` <20170606230007.19101-1-palmer@dabbelt.com>
[not found] ` <20170606230007.19101-2-palmer@dabbelt.com>
2017-06-07 7:17 ` [PATCH 01/17] drivers: support PCIe in RISCV Geert Uytterhoeven
[not found] ` <20170606230007.19101-3-palmer@dabbelt.com>
2017-06-07 7:18 ` [PATCH 02/17] pcie-xilinx: add missing 5th legacy interrupt Geert Uytterhoeven
[not found] ` <20170606230007.19101-7-palmer@dabbelt.com>
2017-06-07 7:19 ` [PATCH 06/17] pci: Add generic pcibios_{fixup_bus,align_resource} Geert Uytterhoeven
2017-06-07 8:01 ` Arnd Bergmann
2017-06-08 8:12 ` Christoph Hellwig
2017-06-08 8:35 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox