Re: [PATCH 01/20] ARM64 / ACPI: Make PCI optional for ACPI on ARM64

From: Bjorn Helgaas
Date: Fri Jan 17 2014 - 11:01:45 EST


[+cc Jens, James, Ben, Fujita (authors of PCI_DMA_BUS_IS_PHYS usage)]

On Fri, Jan 17, 2014 at 5:24 AM, Hanjun Guo <hanjun.guo@xxxxxxxxxx> wrote:
> Not all the ARM64 targets that are using ACPI have PCI, so introduce
> some stub functions to make PCI optional for ACPI, and make ACPI core
> run without CONFIG_PCI on ARM64.
>
> pcibios_penalize_isa_irq() is arch dependent, introduce asm/pci.h to
> include it.
>
> Since ACPI on X86 and IA64 depends on PCI, it will not break X86 and
> IA64 with this patch.
>
> Signed-off-by: Graeme Gregory <graeme.gregory@xxxxxxxxxx>
> Signed-off-by: Al Stone <al.stone@xxxxxxxxxx>
> Signed-off-by: Hanjun Guo <hanjun.guo@xxxxxxxxxx>
> ---
> arch/arm64/include/asm/pci.h | 20 ++++++++++++++++++++
> drivers/acpi/Makefile | 2 +-
> drivers/acpi/internal.h | 7 +++++++
> drivers/acpi/osl.c | 3 ++-
> include/linux/pci.h | 33 ++++++++++++++++++++++++---------
> 5 files changed, 54 insertions(+), 11 deletions(-)
> create mode 100644 arch/arm64/include/asm/pci.h
>
> diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
> new file mode 100644
> index 0000000..455909d
> --- /dev/null
> +++ b/arch/arm64/include/asm/pci.h
> @@ -0,0 +1,20 @@
> +#ifndef __ASMARM64_PCI_H
> +#define __ASMARM64_PCI_H
> +
> +#ifdef __KERNEL__
> +
> +static inline void pcibios_penalize_isa_irq(int irq, int active)
> +{
> + /* We don't do dynamic PCI IRQ allocation */
> +}
> +
> +/*
> + * The PCI address space does equal the physical memory address space.
> + * The networking and block device layers use this boolean for bounce
> + * buffer decisions.
> + */
> +#define PCI_DMA_BUS_IS_PHYS (1)

I'm not sure this is accurate. The arm code uses
pci_add_resource_offset() with non-zero offsets, which means a
physical memory address is not the same as a PCI bus address. I don't
know what arm64 does for PCI, but I suspect it is similar.

I think PCI_DMA_BUS_IS_PHYS is due for some overhaul. I'm dubious
that it is working as intended anymore. At the very least, it seems
like something that is dependent on the device in question.

> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index a13d682..726cf2a 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> ...
> +static inline int raw_pci_read(unsigned int domain, unsigned int bus,
> + unsigned int devfn, int reg, int len, u32 *val)
> +{ return -EINVAL; }
> +
> +static inline int raw_pci_write(unsigned int domain, unsigned int bus,
> + unsigned int devfn, int reg, int len, u32 val)
> +{return -EINVAL; }

Fix the spacing here (missing a space before "return").

With that, this include/linux/pci.h change is:

Acked-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/