1. 14 9月, 2018 1 次提交
    • A
      asm-generic: io: Fix ioport_map() for !CONFIG_GENERIC_IOMAP && CONFIG_INDIRECT_PIO · 500dd232
      Andrew Murray 提交于
      The !CONFIG_GENERIC_IOMAP version of ioport_map uses MMIO_UPPER_LIMIT to
      prevent users from making I/O accesses outside the expected I/O range -
      however it erroneously treats MMIO_UPPER_LIMIT as a mask which is
      contradictory to its other users.
      
      The introduction of CONFIG_INDIRECT_PIO, which subtracts an arbitrary
      amount from IO_SPACE_LIMIT to form MMIO_UPPER_LIMIT, results in ioport_map
      mangling the given port rather than capping it.
      
      We address this by aligning more closely with the CONFIG_GENERIC_IOMAP
      implementation of ioport_map by using the comparison operator and
      returning NULL where the port exceeds MMIO_UPPER_LIMIT. Though note that
      we preserve the existing behavior of masking with IO_SPACE_LIMIT such that
      we don't break existing buggy drivers that somehow rely on this masking.
      
      Fixes: 5745392e ("PCI: Apply the new generic I/O management on PCI IO hosts")
      Reported-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      500dd232
  2. 10 4月, 2018 2 次提交
    • S
      io: change writeX_relaxed() to remove barriers · a71e7c44
      Sinan Kaya 提交于
      Now that we hardened writeX() API in asm-generic version, writeX_relaxed()
      API is violating the rules when writeX_relaxed() == writeX() in the default
      implementation.
      
      The relaxed API shouldn't have any barriers in it and it doesn't provide
      any ordering with respect to the memory transactions. The only requirement
      is for writes to be ordered with respect to each other. This is achieved
      by the volatile in the __raw_writeX() API.
      
      Open code the relaxed API and remove any barriers in it.
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      a71e7c44
    • S
      io: change readX_relaxed() to remove barriers · 8875c554
      Sinan Kaya 提交于
      Now that we hardened readX() API in asm-generic version, readX_relaxed()
      API is violating the rules when readX_relaxed() == readX() in the default
      implementation.
      
      The relaxed API shouldn't have any barriers in it and it doesn't provide
      any ordering with respect to the memory transactions. The only requirement
      is for reads to be ordered with respect to each other. This is achieved
      by the volatile in the __raw_readX() API.
      
      Open code the relaxed API and remove any barriers in it.
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      8875c554
  3. 06 4月, 2018 5 次提交
  4. 04 4月, 2018 1 次提交
  5. 22 3月, 2018 1 次提交
  6. 10 3月, 2018 1 次提交
  7. 22 2月, 2018 1 次提交
  8. 24 7月, 2017 2 次提交
  9. 31 5月, 2016 2 次提交
  10. 04 5月, 2016 1 次提交
    • R
      io-64-nonatomic: Add relaxed accessor variants · e511267b
      Robin Murphy 提交于
      Whilst commit 9439eb3a ("asm-generic: io: implement relaxed
      accessor macros as conditional wrappers") makes the *_relaxed forms of
      I/O accessors universally available to drivers, in cases where writeq()
      is implemented via the io-64-nonatomic helpers, writeq_relaxed() will
      end up falling back to writel() regardless of whether writel_relaxed()
      is available (identically for s/write/read/).
      
      Add corresponding relaxed forms of the nonatomic helpers to delegate
      to the equivalent 32-bit accessors as appropriate. We also need to fix
      io.h to avoid defining default relaxed variants if the basic accessors
      themselves don't exist.
      
      CC: Christoph Hellwig <hch@lst.de>
      CC: Darren Hart <dvhart@linux.intel.com>
      CC: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      e511267b
  11. 21 7月, 2015 1 次提交
    • L
      x86/mm, asm-generic: Add IOMMU ioremap_uc() variant default · 8c7ea50c
      Luis R. Rodriguez 提交于
      We currently have no safe way of currently defining architecture
      agnostic IOMMU ioremap_*() variants. The trend is for folks to
      *assume* that ioremap_nocache() should be the default everywhere
      and then add this mapping on each architectures -- this is not
      correct today for a variety of reasons.
      
      We have two options:
      
        1) Sit and wait for every architecture in Linux to get a
           an ioremap_*() variant defined before including it upstream.
      
        2) Gather consensus on a safe architecture agnostic ioremap_*()
           default.
      
      Approach 1) introduces development latencies, and since 2) will
      take time and work on clarifying semantics the only remaining
      sensible thing to do to avoid issues is returning NULL on
      ioremap_*() variants.
      
      In order for this to work we must have all architectures declare
      their own ioremap_*() variants as defined. This will take some
      work, do this for ioremp_uc() to set the example as its only
      currently implemented on x86. Document all this.
      
      We only provide implementation support for ioremap_uc() as the
      other ioremap_*() variants are well defined all over the kernel
      for other architectures already.
      Signed-off-by: NLuis R. Rodriguez <mcgrof@suse.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: arnd@arndb.de
      Cc: benh@kernel.crashing.org
      Cc: bp@suse.de
      Cc: dan.j.williams@intel.com
      Cc: geert@linux-m68k.org
      Cc: hch@lst.de
      Cc: hmh@hmh.eng.br
      Cc: jgross@suse.com
      Cc: linux-mm@kvack.org
      Cc: luto@amacapital.net
      Cc: mpe@ellerman.id.au
      Cc: mst@redhat.com
      Cc: ralf@linux-mips.org
      Cc: ross.zwisler@linux.intel.com
      Cc: stefan.bader@canonical.com
      Cc: tj@kernel.org
      Cc: tomi.valkeinen@ti.com
      Cc: toshi.kani@hp.com
      Link: http://lkml.kernel.org/r/1436488096-3165-1-git-send-email-mcgrof@do-not-panic.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      8c7ea50c
  12. 07 6月, 2015 1 次提交
  13. 11 5月, 2015 1 次提交
    • L
      x86/mm: Add ioremap_uc() helper to map memory uncacheable (not UC-) · e4b6be33
      Luis R. Rodriguez 提交于
      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: NLuis R. Rodriguez <mcgrof@suse.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Acked-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Antonino Daplas <adaplas@gmail.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Mike Travis <travis@sgi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suresh Siddha <sbsiddha@gmail.com>
      Cc: Thierry Reding <treding@nvidia.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
      Cc: Toshi Kani <toshi.kani@hp.com>
      Cc: Ville Syrjälä <syrjala@sci.fi>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Will Deacon <will.deacon@arm.com>
      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.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      e4b6be33
  14. 10 11月, 2014 2 次提交
    • T
      asm-generic/io.h: Implement generic {read,write}s*() · 9ab3a7a0
      Thierry Reding 提交于
      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: NThierry Reding <treding@nvidia.com>
      9ab3a7a0
    • T
      asm-generic/io.h: Reconcile I/O accessor overrides · 9216efaf
      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: NThierry Reding <treding@nvidia.com>
      9216efaf
  15. 21 10月, 2014 1 次提交
    • W
      asm-generic: io: implement relaxed accessor macros as conditional wrappers · 9439eb3a
      Will Deacon 提交于
      {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 <arnd@arndb.de>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      9439eb3a
  16. 30 9月, 2014 1 次提交
  17. 08 4月, 2014 1 次提交
  18. 22 5月, 2013 1 次提交
    • M
      kernel: Fix s390 absolute memory access for /dev/mem · 576ebd74
      Michael Holzheu 提交于
      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: NMichael Holzheu <holzheu@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      576ebd74
  19. 03 3月, 2013 1 次提交
  20. 14 2月, 2013 1 次提交
  21. 12 2月, 2013 1 次提交
  22. 18 12月, 2012 1 次提交
  23. 30 11月, 2012 1 次提交
    • J
      s390/pci: base support · cd248341
      Jan Glauber 提交于
      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: NJan Glauber <jang@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      cd248341
  24. 26 10月, 2012 1 次提交
    • W
      asm-generic: io: remove {read,write} string functions · b2656a13
      Will Deacon 提交于
      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 <arnd@arndb.de>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Ben Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      b2656a13
  25. 25 10月, 2012 1 次提交
    • J
      asm-generic/io.h: remove asm/cacheflush.h include · 9b04ebd1
      James Hogan 提交于
      Including <asm/cacheflush.h> from <asm-generic/io.h> 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 <asm/pgtable.h> including from it's <asm/io.h> 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: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NJonas Bonn <jonas@southpole.se>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Chen Liqin <liqin.chen@sunplusct.com>
      Cc: Lennox Wu <lennox.wu@gmail.com>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      9b04ebd1
  26. 29 11月, 2011 1 次提交
  27. 07 10月, 2011 1 次提交
  28. 23 7月, 2011 2 次提交
  29. 17 3月, 2011 1 次提交
  30. 10 1月, 2011 1 次提交
  31. 18 10月, 2010 1 次提交