Thread (12 messages) 12 messages, 5 authors, 2014-03-14

[PATCH v6 1/3] Fix ioport_map() for !CONFIG_GENERIC_IOMAP cases.

From: Russell King - ARM Linux <hidden>
Date: 2014-03-07 01:10:06
Also in: linux-devicetree, linux-pci, lkml

On Fri, Mar 07, 2014 at 01:37:38AM +0100, Arnd Bergmann wrote:
On Thursday 06 March 2014, Russell King - ARM Linux wrote:
quoted
On Wed, Mar 05, 2014 at 11:49:08AM +0000, Liviu Dudau wrote:
quoted
The inline version of ioport_map() that gets used when !CONFIG_GENERIC_IOMAP
is wrong. It returns a mapped (i.e. virtual) address that can start from
zero and completely ignores the PCI_IOBASE and IO_SPACE_LIMIT that most
architectures that use !CONFIG_GENERIC_MAP define.
What value does PCI_IOBASE and IO_SPACE_LIMIT have on other architectures
who make use of asm-generic/io.h ?

$ git grep asm-generic/io.h arch/
arch/arc/include/asm/io.h:#include <asm-generic/io.h>
PCI support hasn't been upstreamed.
quoted
arch/blackfin/include/asm/io.h:#include <asm-generic/io.h>
arch/metag/include/asm/io.h:#include <asm-generic/io.h>
No PCI support
quoted
arch/microblaze/include/asm/io.h:/* from asm-generic/io.h */
PCI_IOBASE=0, IO_SPACE_LIMIT=0xffffffff, so no change.
Seems to define _IO_BASE not PCI_IOBASE.
quoted
arch/openrisc/include/asm/io.h:#include <asm-generic/io.h>
No PCI support
quoted
arch/s390/include/asm/io.h:#include <asm-generic/io.h>
s390 supports PCI but no I/O space
quoted
arch/score/include/asm/io.h:#include <asm-generic/io.h>
No PCI support
quoted
arch/unicore32/include/asm/io.h:#include <asm-generic/io.h>
unicore32 is broken currently, the patch fixes it.
quoted
arch/xtensa/include/asm/io.h:#include <asm-generic/io.h>
PCI_IOBASE=0, IO_SPACE_LIMIT=0xffffffff, so no change.
Doesn't appear to define PCI_IOBASE.

Maybe there's other patches required for these?
For most of these, I assume we actually want to remove support
for inb/outb as they don't support I/O space accesses. The other
ones look correct to me.
Right, so:

#ifdef CONFIG_HAS_IOPORT
#ifndef CONFIG_GENERIC_IOMAP
static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
        return (void __iomem *) port;
}

changing that to include PCI_IOBASE in there will result in a build
failure if the C compiler sees that.  In other words, when HAS_IOPORT=y
and GENERIC_IOMAP=n.

HAS_IOPORT is set when HAS_IOMEM is also set and NO_IOPORT unset.

It looks to me like blackfin doesn't set NO_IOPORT nor NO_IOMEM, so
this would have HAS_IOPORT set, and from what I can see doesn't set
GENERIC_IOMAP.  So, this change probably breaks blackfin.

I haven't looked deeply at the others.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help