07 Jun, 2015

1 commit

  • Add ioremap_wt() for creating Write-Through mappings on x86. It
    follows the same model as ioremap_wc() for multi-arch support.
    Define ARCH_HAS_IOREMAP_WT in the x86 version of io.h to
    indicate that ioremap_wt() is implemented on x86.

    Also update the PAT documentation file to cover ioremap_wt().

    Signed-off-by: Toshi Kani
    Signed-off-by: Borislav Petkov
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Elliott@hp.com
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Luis R. Rodriguez
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: arnd@arndb.de
    Cc: hch@lst.de
    Cc: hmh@hmh.eng.br
    Cc: jgross@suse.com
    Cc: konrad.wilk@oracle.com
    Cc: linux-mm
    Cc: linux-nvdimm@lists.01.org
    Cc: stefan.bader@canonical.com
    Cc: yigal@plexistor.com
    Link: http://lkml.kernel.org/r/1433436928-31903-8-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Toshi Kani
     

11 May, 2015

1 commit

  • ioremap_nocache() currently uses UC- by default. Our goal is to
    eventually make UC the default. Linux maps UC- to PCD=1, PWT=0
    page attributes on non-PAT systems. Linux maps UC to PCD=1,
    PWT=1 page attributes on non-PAT systems. On non-PAT and PAT
    systems a WC MTRR has different effects on pages with either of
    these attributes. In order to help with a smooth transition its
    best to enable use of UC (PCD,1, PWT=1) on a region as that
    ensures a WC MTRR will have no effect on a region, this however
    requires us to have an way to declare a region as UC and we
    currently do not have a way to do this.

    WC MTRR on non-PAT system with PCD=1, PWT=0 (UC-) yields WC.
    WC MTRR on non-PAT system with PCD=1, PWT=1 (UC) yields UC.

    WC MTRR on PAT system with PCD=1, PWT=0 (UC-) yields WC.
    WC MTRR on PAT system with PCD=1, PWT=1 (UC) yields UC.

    A flip of the default ioremap_nocache() behaviour from UC- to UC
    can therefore regress a memory region from effective memory type
    WC to UC if MTRRs are used. Use of MTRRs should be phased out
    and in the best case only arch_phys_wc_add() use will remain,
    even if this happens arch_phys_wc_add() will have an effect on
    non-PAT systems and changes to default ioremap_nocache()
    behaviour could regress drivers.

    Now, ideally we'd use ioremap_nocache() on the regions in which
    we'd need uncachable memory types and avoid any MTRRs on those
    regions. There are however some restrictions on MTRRs use, such
    as the requirement of having the base and size of variable sized
    MTRRs to be powers of two, which could mean having to use a WC
    MTRR over a large area which includes a region in which
    write-combining effects are undesirable.

    Add ioremap_uc() to help with the both phasing out of MTRR use
    and also provide a way to blacklist small WC undesirable regions
    in devices with mixed regions which are size-implicated to use
    large WC MTRRs. Use of ioremap_uc() helps phase out MTRR use by
    avoiding regressions with an eventual flip of default behaviour
    or ioremap_nocache() from UC- to UC.

    Drivers working with WC MTRRs can use the below table to review
    and consider the use of ioremap*() and similar helpers to ensure
    appropriate behaviour long term even if default
    ioremap_nocache() behaviour changes from UC- to UC.

    Although ioremap_uc() is being added we leave set_memory_uc() to
    use UC- as only initial memory type setup is required to be able
    to accommodate existing device drivers and phase out MTRR use.
    It should also be clarified that set_memory_uc() cannot be used
    with IO memory, even though its use will not return any errors,
    it really has no effect.

    ----------------------------------------------------------------------
    MTRR Non-PAT PAT Linux ioremap value Effective memory type
    ----------------------------------------------------------------------
    Non-PAT | PAT
    PAT
    |PCD
    ||PWT
    |||
    WC 000 WB _PAGE_CACHE_MODE_WB WC | WC
    WC 001 WC _PAGE_CACHE_MODE_WC WC* | WC
    WC 010 UC- _PAGE_CACHE_MODE_UC_MINUS WC* | WC
    WC 011 UC _PAGE_CACHE_MODE_UC UC | UC
    ----------------------------------------------------------------------

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Borislav Petkov
    Acked-by: H. Peter Anvin
    Cc: Andy Lutomirski
    Cc: Antonino Daplas
    Cc: Bjorn Helgaas
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Daniel Vetter
    Cc: Dave Airlie
    Cc: Davidlohr Bueso
    Cc: Denys Vlasenko
    Cc: Jean-Christophe Plagniol-Villard
    Cc: Juergen Gross
    Cc: Linus Torvalds
    Cc: Mel Gorman
    Cc: Mike Travis
    Cc: Peter Zijlstra
    Cc: Suresh Siddha
    Cc: Thierry Reding
    Cc: Thomas Gleixner
    Cc: Tomi Valkeinen
    Cc: Toshi Kani
    Cc: Ville Syrjälä
    Cc: Vlastimil Babka
    Cc: Will Deacon
    Cc: linux-fbdev@vger.kernel.org
    Link: http://lkml.kernel.org/r/1430343851-967-2-git-send-email-mcgrof@do-not-panic.com
    Link: http://lkml.kernel.org/r/1431332153-18566-9-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Luis R. Rodriguez
     

12 Nov, 2014

1 commit

  • * 'io' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux:
    documentation: memory-barriers: clarify relaxed io accessor semantics
    x86: io: implement dummy relaxed accessor macros for writes
    tile: io: implement dummy relaxed accessor macros for writes
    sparc: io: implement dummy relaxed accessor macros for writes
    powerpc: io: implement dummy relaxed accessor macros for writes
    parisc: io: implement dummy relaxed accessor macros for writes
    mn10300: io: implement dummy relaxed accessor macros for writes
    m68k: io: implement dummy relaxed accessor macros for writes
    m32r: io: implement dummy relaxed accessor macros for writes
    ia64: io: implement dummy relaxed accessor macros for writes
    cris: io: implement dummy relaxed accessor macros for writes
    frv: io: implement dummy relaxed accessor macros for writes
    xtensa: io: remove dummy relaxed accessor macros for reads
    s390: io: remove dummy relaxed accessor macros for reads
    microblaze: io: remove dummy relaxed accessor macros
    asm-generic: io: implement relaxed accessor macros as conditional wrappers

    Conflicts:
    include/asm-generic/io.h

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

10 Nov, 2014

2 commits

  • Currently driver writers need to use io{read,write}{8,16,32}_rep() when
    accessing FIFO registers portably. This is bad for two reasons: it is
    inconsistent with how other registers are accessed using the standard
    {read,write}{b,w,l}() functions, which can lead to confusion. On some
    architectures the io{read,write}*() functions also need to perform some
    extra checks to determine whether an address is memory-mapped or refers
    to I/O space. Drivers which can be expected to never use I/O can safely
    use the {read,write}s{b,w,l,q}(), just like they use their non-string
    variants and there's no need for these extra checks.

    This patch implements generic versions of readsb(), readsw(), readsl(),
    readsq(), writesb(), writesw(), writesl() and writesq(). Variants of
    these string functions for I/O accesses (ins*() and outs*() as well as
    ioread*_rep() and iowrite*_rep()) are now implemented in terms of the
    new functions.

    Going forward, {read,write}{,s}{b,w,l,q}() should be used consistently
    by drivers for devices that will only ever be memory-mapped and hence
    don't need to access I/O space, whereas io{read,write}{8,16,32}_rep()
    should be used by drivers for devices that can be either memory-mapped
    or I/O-mapped.

    Signed-off-by: Thierry Reding

    Thierry Reding
     
  • Overriding I/O accessors and helpers is currently very inconsistent.
    This commit introduces a homogeneous way to override functions by
    checking for the existence of a macro with the same of the function.
    Architectures can provide their own implementations and communicate this
    to the generic header by defining the appropriate macro. Doing this will
    also help prevent the implementations from being subsequently
    overridden.

    While at it, also turn a lot of macros into static inline functions for
    better type checking and to provide a canonical signature for overriding
    architectures to copy. Also reorder functions by logical groups.

    Signed-off-by: Thierry Reding

    Thierry Reding
     

21 Oct, 2014

1 commit

  • {read,write}{b,w,l,q}_relaxed are implemented by some architectures in
    order to permit memory-mapped I/O accesses with weaker barrier semantics
    than the non-relaxed variants.

    This patch adds wrappers to asm-generic so that drivers can rely on the
    relaxed accessors being available, even if they don't always provide
    weaker ordering guarantees. Since some architectures both include
    asm-generic/io.h and define some relaxed accessors, the definitions here
    are conditional for the time being.

    Cc: Arnd Bergmann
    Signed-off-by: Will Deacon

    Will Deacon
     

30 Sep, 2014

1 commit

  • The !CONFIG_GENERIC_IOMAP version of ioport_map() 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.

    Tested-by: Tanmay Inamdar
    Signed-off-by: Liviu Dudau
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Catalin Marinas
    Acked-by: Arnd Bergmann

    Liviu Dudau
     

08 Apr, 2014

1 commit

  • If the renamed symbol is defined lib/iomap.c implements ioport_map and
    ioport_unmap and currently (nearly) all platforms define the port
    accessor functions outb/inb and friend unconditionally. So
    HAS_IOPORT_MAP is the better name for this.

    Consequently NO_IOPORT is renamed to NO_IOPORT_MAP.

    The motivation for this change is to reintroduce a symbol HAS_IOPORT
    that signals if outb/int et al are available. I will address that at
    least one merge window later though to keep surprises to a minimum and
    catch new introductions of (HAS|NO)_IOPORT.

    The changes in this commit were done using:

    $ git grep -l -E '(NO|HAS)_IOPORT' | xargs perl -p -i -e 's/\b((?:CONFIG_)?(?:NO|HAS)_IOPORT)\b/$1_MAP/'

    Signed-off-by: Uwe Kleine-König
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     

22 May, 2013

1 commit

  • On s390 the prefix page and absolute zero pages are not correctly
    returned when reading /dev/mem. The reason is that the s390 asm/io.h
    file includes the asm-generic/io.h file which then defines
    xlate_dev_mem_ptr() and therefore overwrites the s390 specific
    version that does the correct swap operation for prefix and absolute
    zero pages. The problem is a regression that was introduced with git
    commit cd248341 (s390/pci: base support).

    To fix the problem add "#ifndef xlate_dev_mem_ptr" in asm-generic/io.h
    and "#define xlate_dev_mem_ptr" in asm/io.h. This ensures that the
    s390 version is used. For completeness also add the "#ifndef"
    construct for xlate_dev_kmem_ptr().

    Signed-off-by: Michael Holzheu
    Signed-off-by: Martin Schwidefsky

    Michael Holzheu
     

04 Mar, 2013

1 commit

  • Pull new ImgTec Meta architecture from James Hogan:
    "This adds core architecture support for Imagination's Meta processor
    cores, followed by some later miscellaneous arch/metag cleanups and
    fixes which I kept separate to ease review:

    - Support for basic Meta 1 (ATP) and Meta 2 (HTP) core architecture
    - A few fixes all over, particularly for symbol prefixes
    - A few privilege protection fixes
    - Several cleanups (setup.c includes, split out a lot of
    metag_ksyms.c)
    - Fix some missing exports
    - Convert hugetlb to use vm_unmapped_area()
    - Copy device tree to non-init memory
    - Provide dma_get_sgtable()"

    * tag 'metag-v3.9-rc1-v4' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag: (61 commits)
    metag: Provide dma_get_sgtable()
    metag: prom.h: remove declaration of metag_dt_memblock_reserve()
    metag: copy devicetree to non-init memory
    metag: cleanup metag_ksyms.c includes
    metag: move mm/init.c exports out of metag_ksyms.c
    metag: move usercopy.c exports out of metag_ksyms.c
    metag: move setup.c exports out of metag_ksyms.c
    metag: move kick.c exports out of metag_ksyms.c
    metag: move traps.c exports out of metag_ksyms.c
    metag: move irq enable out of irqflags.h on SMP
    genksyms: fix metag symbol prefix on crc symbols
    metag: hugetlb: convert to vm_unmapped_area()
    metag: export clear_page and copy_page
    metag: export metag_code_cache_flush_all
    metag: protect more non-MMU memory regions
    metag: make TXPRIVEXT bits explicit
    metag: kernel/setup.c: sort includes
    perf: Enable building perf tools for Meta
    metag: add boot time LNKGET/LNKSET check
    metag: add __init to metag_cache_probe()
    ...

    Linus Torvalds
     

03 Mar, 2013

1 commit

  • Make asm-generic/io.h check CONFIG_VIRT_TO_BUS before defining
    virt_to_bus() and bus_to_virt(), otherwise it's easy to accidentally
    have a silently failing incorrect direct mapped definition rather then
    no definition at all.

    Signed-off-by: James Hogan
    Acked-by: Arnd Bergmann

    James Hogan
     

27 Feb, 2013

1 commit

  • Pull microblaze update from Michal Simek:
    "Microblaze changes.

    After my discussion with Arnd I have also added there asm-generic io
    patch which is Acked by him and Geert."

    * 'next' of git://git.monstr.eu/linux-2.6-microblaze:
    asm-generic: io: Fix ioread16/32be and iowrite16/32be
    microblaze: Do not use module.h in files which are not modules
    microblaze: Fix coding style issues
    microblaze: Add missing return from debugfs_tlb
    microblaze: Makefile clean
    microblaze: Add .gitignore entries for auto-generated files
    microblaze: Fix strncpy_from_user macro

    Linus Torvalds
     

14 Feb, 2013

1 commit

  • E.g. readl is defined like this

    #define readl(addr) __le32_to_cpu(__raw_readl(addr))

    If a there is a readl() call that doesn't check the return value
    this will cause a compile warning on big endian machines due to
    the __le32_to_cpu macro magic.

    E.g. code like this:

    readl(addr);

    will generate the following compile warning:

    warning: value computed is not used [-Wunused-value]

    With this patch we get rid of dozens of compile warnings on s390.

    Signed-off-by: Heiko Carstens
    Acked-by: Arnd Bergmann
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

12 Feb, 2013

1 commit

  • Fix ioreadXXbe and iowriteXXbe functions which did
    additional little endian conversion on native big endian systems.
    Using be_to_cpu (cpu_to_be) conversions with __raw_read/write
    functions have resolved it.

    Signed-off-by: Michal Simek
    Acked-by: Arnd Bergmann
    Acked-by: Geert Uytterhoeven
    CC: Benjamin Herrenschmidt
    CC: Will Deacon
    CC: linux-arch@vger.kernel.org

    Michal Simek
     

22 Dec, 2012

1 commit

  • Pull asm-generic cleanup from Arnd Bergmann:
    "These are a few cleanups for asm-generic:

    - a set of patches from Lars-Peter Clausen to generalize asm/mmu.h
    and use it in the architectures that don't need any special
    handling.
    - A patch from Will Deacon to remove the {read,write}s{b,w,l} as
    discussed during the arm64 review
    - A patch from James Hogan that helps with the meta architecture
    series."

    * tag 'asm-generic' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    xtensa: Use generic asm/mmu.h for nommu
    h8300: Use generic asm/mmu.h
    c6x: Use generic asm/mmu.h
    asm-generic/mmu.h: Add support for FDPIC
    asm-generic/mmu.h: Remove unused vmlist field from mm_context_t
    asm-generic: io: remove {read,write} string functions
    asm-generic/io.h: remove asm/cacheflush.h include

    Linus Torvalds
     

18 Dec, 2012

1 commit

  • The {in,out}s{b,w,l} functions are designed to operate on a stream of
    bytes and therefore should not perform any byte-swapping, regardless of
    the CPU byte order.

    This patch fixes the generic IO header so that {in,out}s{b,w,l} call the
    __raw_{read,write} functions directly rather than going via the
    endian-correcting accessors.

    Signed-off-by: Will Deacon
    Cc: Mike Frysinger
    Acked-by: Arnd Bergmann
    Acked-by: Ben Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Will Deacon
     

30 Nov, 2012

1 commit

  • Add PCI support for s390, (only 64 bit mode is supported by hardware):
    - PCI facility tests
    - PCI instructions: pcilg, pcistg, pcistb, stpcifc, mpcifc, rpcit
    - map readb/w/l/q and writeb/w/l/q to pcilg and pcistg instructions
    - pci_iomap implementation
    - memcpy_fromio/toio
    - pci_root_ops using special pcilg/pcistg
    - device, bus and domain allocation

    Signed-off-by: Jan Glauber
    Signed-off-by: Martin Schwidefsky

    Jan Glauber
     

26 Oct, 2012

1 commit

  • The {read,write}s{b,w,l} functions are not defined across all
    architectures and therefore shouldn't be used by portable drivers. We
    should encourage driver writers to use the io{read,write}{8,16,32}_rep
    functions instead.

    This patch removes the {read,write} string functions for the generic IO
    header as they have no place in a new architecture port.

    Cc: Arnd Bergmann
    Cc: Mike Frysinger
    Cc: Ben Herrenschmidt
    Signed-off-by: Will Deacon

    Will Deacon
     

25 Oct, 2012

1 commit

  • Including from prevents
    cacheflush.h being able to use I/O functions like readl and writel due
    to circular include dependencies. It doesn't appear as if anything from
    cacheflush.h is actually used by the generic io.h, so remove the
    include.

    I've compile tested a defconfig compilation of blackfin, openrisc (which
    needed including from it's to get the PAGE_*
    definitions), and xtensa.

    Other architectures which use asm-generic/io.h are score and unicore32,
    and looking at their io.h I don't see any obvious problems.

    Signed-off-by: James Hogan
    Acked-by: Jonas Bonn
    Cc: Chris Zankel
    Cc: Max Filippov
    Cc: Mike Frysinger
    Cc: Chen Liqin
    Cc: Lennox Wu
    Cc: Guan Xuetao
    Signed-off-by: Arnd Bergmann

    James Hogan
     

11 Jan, 2012

1 commit

  • lib: use generic pci_iomap on all architectures

    Many architectures don't want to pull in iomap.c,
    so they ended up duplicating pci_iomap from that file.
    That function isn't trivial, and we are going to modify it
    https://lkml.org/lkml/2011/11/14/183
    so the duplication hurts.

    This reduces the scope of the problem significantly,
    by moving pci_iomap to a separate file and
    referencing that from all architectures.

    * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
    alpha: drop pci_iomap/pci_iounmap from pci-noop.c
    mn10300: switch to GENERIC_PCI_IOMAP
    mn10300: add missing __iomap markers
    frv: switch to GENERIC_PCI_IOMAP
    tile: switch to GENERIC_PCI_IOMAP
    tile: don't panic on iomap
    sparc: switch to GENERIC_PCI_IOMAP
    sh: switch to GENERIC_PCI_IOMAP
    powerpc: switch to GENERIC_PCI_IOMAP
    parisc: switch to GENERIC_PCI_IOMAP
    mips: switch to GENERIC_PCI_IOMAP
    microblaze: switch to GENERIC_PCI_IOMAP
    arm: switch to GENERIC_PCI_IOMAP
    alpha: switch to GENERIC_PCI_IOMAP
    lib: add GENERIC_PCI_IOMAP
    lib: move GENERIC_IOMAP to lib/Kconfig

    Fix up trivial conflicts due to changes nearby in arch/{m68k,score}/Kconfig

    Linus Torvalds
     

29 Nov, 2011

1 commit


07 Oct, 2011

1 commit


23 Jul, 2011

2 commits

  • Use the CONFIG_HAS_IOPORT and CONFIG_PCI options to decide whether or
    not functions for mapping these areas are provided.

    Signed-off-by: Jonas Bonn
    Acked-by: Arnd Bergmann

    Jonas Bonn
     
  • Some of the implementations, in particular the ioremap variants, in
    asm-generic/io.h are for systems without an MMU. In order to be able to
    use the generic header file for systems with an MMU, this patch wraps
    these implementations in checks for CONFIG_MMU.

    Tested on OpenRISC.

    Signed-off-by: Jonas Bonn
    Cc: liqin.chen@sunplusct.com
    Cc: gxt@mprc.pku.edu.cn
    Acked-by: Mike Frysinger
    Acked-by: Arnd Bergmann

    Jonas Bonn
     

17 Mar, 2011

1 commit

  • The definitions for the PC-style PIO functions in asm-generic/io.h were
    meant as dummies so you could compile code on architectures without
    ISA and PCI buses. However, unicore32 actually wants to use them
    with a real PCI bus, so they need to be defined to actually address
    the register window holding the I/O ports.

    Signed-off-by: Arnd Bergmann

    GuanXuetao
     

10 Jan, 2011

1 commit


18 Oct, 2010

1 commit


10 Aug, 2010

1 commit


12 Jun, 2009

1 commit