]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 10 Dec 2014 01:25:00 +0000 (17:25 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 10 Dec 2014 01:25:00 +0000 (17:25 -0800)
Pull asm-generic asm/io.h rewrite from Arnd Bergmann:
 "While there normally is no reason to have a pull request for
  asm-generic but have all changes get merged through whichever tree
  needs them, I do have a series for 3.19.

  There are two sets of patches that change significant portions of
  asm/io.h, and this branch contains both in order to resolve the
  conflicts:

   - Will Deacon has done a set of patches to ensure that all
     architectures define {read,write}{b,w,l,q}_relaxed() functions or
     get them by including asm-generic/io.h.

     These functions are commonly used on ARM specific drivers to avoid
     expensive L2 cache synchronization implied by the normal
     {read,write}{b,w,l,q}, but we need to define them on all
     architectures in order to share the drivers across architectures
     and to enable CONFIG_COMPILE_TEST configurations for them

   - Thierry Reding has done an unrelated set of patches that extends
     the asm-generic/io.h file to the degree necessary to make it useful
     on ARM64 and potentially other architectures"

* tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (29 commits)
  ARM64: use GENERIC_PCI_IOMAP
  sparc: io: remove duplicate relaxed accessors on sparc32
  ARM: sa11x0: Use void __iomem * in MMIO accessors
  arm64: Use include/asm-generic/io.h
  ARM: Use include/asm-generic/io.h
  asm-generic/io.h: Implement generic {read,write}s*()
  asm-generic/io.h: Reconcile I/O accessor overrides
  /dev/mem: Use more consistent data types
  Change xlate_dev_{kmem,mem}_ptr() prototypes
  ARM: ixp4xx: Properly override I/O accessors
  ARM: ixp4xx: Fix build with IXP4XX_INDIRECT_PCI
  ARM: ebsa110: Properly override I/O accessors
  ARC: Remove redundant PCI_IOBASE declaration
  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
  ...

1  2 
arch/arm64/Kconfig
arch/arm64/include/asm/io.h
arch/arm64/include/asm/memory.h

diff --combined arch/arm64/Kconfig
index f385273f4b246e9d3a7a5cc4671972f91ba6453c,bc8879c283b9998c4c269afa91511241c5d01ef7..6b1ebd964c108429f7feff86f74b17b124229f88
@@@ -1,6 -1,5 +1,6 @@@
  config ARM64
        def_bool y
 +      select ARCH_BINFMT_ELF_RANDOMIZE_PIE
        select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
        select ARCH_HAS_SG_CHAIN
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
@@@ -24,9 -23,9 +24,9 @@@
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
        select GENERIC_CPU_AUTOPROBE
        select GENERIC_EARLY_IOREMAP
-       select GENERIC_IOMAP
        select GENERIC_IRQ_PROBE
        select GENERIC_IRQ_SHOW
+       select GENERIC_PCI_IOMAP
        select GENERIC_SCHED_CLOCK
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_TIME_VSYSCALL
        select HANDLE_DOMAIN_IRQ
        select HARDIRQS_SW_RESEND
 +      select HAVE_ALIGNED_STRUCT_PAGE if SLUB
        select HAVE_ARCH_AUDITSYSCALL
        select HAVE_ARCH_JUMP_LABEL
        select HAVE_ARCH_KGDB
 +      select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_BPF_JIT
        select HAVE_C_RECORDMCOUNT
        select HAVE_CC_STACKPROTECTOR
 +      select HAVE_CMPXCHG_DOUBLE
        select HAVE_DEBUG_BUGVERBOSE
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_API_DEBUG
@@@ -145,11 -141,6 +145,11 @@@ source "kernel/Kconfig.freezer
  
  menu "Platform selection"
  
 +config ARCH_SEATTLE
 +      bool "AMD Seattle SoC Family"
 +      help
 +        This enables support for AMD Seattle SOC Family
 +
  config ARCH_THUNDER
        bool "Cavium Inc. Thunder SoC Family"
        help
@@@ -174,6 -165,9 +174,6 @@@ endmen
  
  menu "Bus support"
  
 -config ARM_AMBA
 -      bool
 -
  config PCI
        bool "PCI support"
        help
@@@ -198,114 -192,6 +198,114 @@@ endmen
  
  menu "Kernel Features"
  
 +menu "ARM errata workarounds via the alternatives framework"
 +
 +config ARM64_ERRATUM_826319
 +      bool "Cortex-A53: 826319: System might deadlock if a write cannot complete until read data is accepted"
 +      default y
 +      help
 +        This option adds an alternative code sequence to work around ARM
 +        erratum 826319 on Cortex-A53 parts up to r0p2 with an AMBA 4 ACE or
 +        AXI master interface and an L2 cache.
 +
 +        If a Cortex-A53 uses an AMBA AXI4 ACE interface to other processors
 +        and is unable to accept a certain write via this interface, it will
 +        not progress on read data presented on the read data channel and the
 +        system can deadlock.
 +
 +        The workaround promotes data cache clean instructions to
 +        data cache clean-and-invalidate.
 +        Please note that this does not necessarily enable the workaround,
 +        as it depends on the alternative framework, which will only patch
 +        the kernel if an affected CPU is detected.
 +
 +        If unsure, say Y.
 +
 +config ARM64_ERRATUM_827319
 +      bool "Cortex-A53: 827319: Data cache clean instructions might cause overlapping transactions to the interconnect"
 +      default y
 +      help
 +        This option adds an alternative code sequence to work around ARM
 +        erratum 827319 on Cortex-A53 parts up to r0p2 with an AMBA 5 CHI
 +        master interface and an L2 cache.
 +
 +        Under certain conditions this erratum can cause a clean line eviction
 +        to occur at the same time as another transaction to the same address
 +        on the AMBA 5 CHI interface, which can cause data corruption if the
 +        interconnect reorders the two transactions.
 +
 +        The workaround promotes data cache clean instructions to
 +        data cache clean-and-invalidate.
 +        Please note that this does not necessarily enable the workaround,
 +        as it depends on the alternative framework, which will only patch
 +        the kernel if an affected CPU is detected.
 +
 +        If unsure, say Y.
 +
 +config ARM64_ERRATUM_824069
 +      bool "Cortex-A53: 824069: Cache line might not be marked as clean after a CleanShared snoop"
 +      default y
 +      help
 +        This option adds an alternative code sequence to work around ARM
 +        erratum 824069 on Cortex-A53 parts up to r0p2 when it is connected
 +        to a coherent interconnect.
 +
 +        If a Cortex-A53 processor is executing a store or prefetch for
 +        write instruction at the same time as a processor in another
 +        cluster is executing a cache maintenance operation to the same
 +        address, then this erratum might cause a clean cache line to be
 +        incorrectly marked as dirty.
 +
 +        The workaround promotes data cache clean instructions to
 +        data cache clean-and-invalidate.
 +        Please note that this option does not necessarily enable the
 +        workaround, as it depends on the alternative framework, which will
 +        only patch the kernel if an affected CPU is detected.
 +
 +        If unsure, say Y.
 +
 +config ARM64_ERRATUM_819472
 +      bool "Cortex-A53: 819472: Store exclusive instructions might cause data corruption"
 +      default y
 +      help
 +        This option adds an alternative code sequence to work around ARM
 +        erratum 819472 on Cortex-A53 parts up to r0p1 with an L2 cache
 +        present when it is connected to a coherent interconnect.
 +
 +        If the processor is executing a load and store exclusive sequence at
 +        the same time as a processor in another cluster is executing a cache
 +        maintenance operation to the same address, then this erratum might
 +        cause data corruption.
 +
 +        The workaround promotes data cache clean instructions to
 +        data cache clean-and-invalidate.
 +        Please note that this does not necessarily enable the workaround,
 +        as it depends on the alternative framework, which will only patch
 +        the kernel if an affected CPU is detected.
 +
 +        If unsure, say Y.
 +
 +config ARM64_ERRATUM_832075
 +      bool "Cortex-A57: 832075: possible deadlock on mixing exclusive memory accesses with device loads"
 +      default y
 +      help
 +        This option adds an alternative code sequence to work around ARM
 +        erratum 832075 on Cortex-A57 parts up to r1p2.
 +
 +        Affected Cortex-A57 parts might deadlock when exclusive load/store
 +        instructions to Write-Back memory are mixed with Device loads.
 +
 +        The workaround is to promote device loads to use Load-Acquire
 +        semantics.
 +        Please note that this does not necessarily enable the workaround,
 +        as it depends on the alternative framework, which will only patch
 +        the kernel if an affected CPU is detected.
 +
 +        If unsure, say Y.
 +
 +endmenu
 +
 +
  choice
        prompt "Page size"
        default ARM64_4K_PAGES
@@@ -346,7 -232,7 +346,7 @@@ config ARM64_VA_BITS_4
  
  config ARM64_VA_BITS_48
        bool "48-bit"
 -      depends on BROKEN
 +      depends on !ARM_SMMU
  
  endchoice
  
@@@ -458,19 -344,6 +458,19 @@@ config ARCH_HAS_CACHE_LINE_SIZ
  
  source "mm/Kconfig"
  
 +config SECCOMP
 +      bool "Enable seccomp to safely compute untrusted bytecode"
 +      ---help---
 +        This kernel feature is useful for number crunching applications
 +        that may need to compute untrusted bytecode during their
 +        execution. By using pipes or other transports made available to
 +        the process as file descriptors supporting the read/write
 +        syscalls, it's possible to isolate those applications in
 +        their own address space using seccomp. Once seccomp is
 +        enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
 +        and the task is only allowed to execute a few safe syscalls
 +        defined by each seccomp mode.
 +
  config XEN_DOM0
        def_bool y
        depends on XEN
@@@ -487,58 -360,6 +487,58 @@@ config FORCE_MAX_ZONEORDE
        default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE)
        default "11"
  
 +menuconfig ARMV8_DEPRECATED
 +      bool "Emulate deprecated/obsolete ARMv8 instructions"
 +      depends on COMPAT
 +      help
 +        Legacy software support may require certain instructions
 +        that have been deprecated or obsoleted in the architecture.
 +
 +        Enable this config to enable selective emulation of these
 +        features.
 +
 +        If unsure, say Y
 +
 +if ARMV8_DEPRECATED
 +
 +config SWP_EMULATION
 +      bool "Emulate SWP/SWPB instructions"
 +      help
 +        ARMv8 obsoletes the use of A32 SWP/SWPB instructions such that
 +        they are always undefined. Say Y here to enable software
 +        emulation of these instructions for userspace using LDXR/STXR.
 +
 +        In some older versions of glibc [<=2.8] SWP is used during futex
 +        trylock() operations with the assumption that the code will not
 +        be preempted. This invalid assumption may be more likely to fail
 +        with SWP emulation enabled, leading to deadlock of the user
 +        application.
 +
 +        NOTE: when accessing uncached shared regions, LDXR/STXR rely
 +        on an external transaction monitoring block called a global
 +        monitor to maintain update atomicity. If your system does not
 +        implement a global monitor, this option can cause programs that
 +        perform SWP operations to uncached memory to deadlock.
 +
 +        If unsure, say Y
 +
 +config CP15_BARRIER_EMULATION
 +      bool "Emulate CP15 Barrier instructions"
 +      help
 +        The CP15 barrier instructions - CP15ISB, CP15DSB, and
 +        CP15DMB - are deprecated in ARMv8 (and ARMv7). It is
 +        strongly recommended to use the ISB, DSB, and DMB
 +        instructions instead.
 +
 +        Say Y here to enable software emulation of these
 +        instructions for AArch32 userspace code. When this option is
 +        enabled, CP15 barrier usage is traced which can help
 +        identify software that needs updating.
 +
 +        If unsure, say Y
 +
 +endif
 +
  endmenu
  
  menu "Boot options"
@@@ -579,17 -400,6 +579,17 @@@ config EF
          allow the kernel to be booted as an EFI application. This
          is only useful on systems that have UEFI firmware.
  
 +config DMI
 +      bool "Enable support for SMBIOS (DMI) tables"
 +      depends on EFI
 +      default y
 +      help
 +        This enables SMBIOS/DMI feature for systems.
 +
 +        This option is only useful on systems that have UEFI firmware.
 +        However, even with this option, the resultant kernel should
 +        continue to boot on existing non-UEFI platforms.
 +
  endmenu
  
  menu "Userspace binary formats"
index 75825b63464de58f2d75cc901e4558b7fddc182d,deb6d2b6df0b8a662b92055caf5687213721688a..949c406d4df431902f02d493c0cb133ca4c1728b
  #include <asm/barrier.h>
  #include <asm/pgtable.h>
  #include <asm/early_ioremap.h>
 +#include <asm/alternative.h>
 +#include <asm/cpufeature.h>
  
  #include <xen/xen.h>
  
  /*
   * Generic IO read/write.  These perform native-endian accesses.
   */
+ #define __raw_writeb __raw_writeb
  static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
  {
        asm volatile("strb %w0, [%1]" : : "r" (val), "r" (addr));
  }
  
+ #define __raw_writew __raw_writew
  static inline void __raw_writew(u16 val, volatile void __iomem *addr)
  {
        asm volatile("strh %w0, [%1]" : : "r" (val), "r" (addr));
  }
  
+ #define __raw_writel __raw_writel
  static inline void __raw_writel(u32 val, volatile void __iomem *addr)
  {
        asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr));
  }
  
+ #define __raw_writeq __raw_writeq
  static inline void __raw_writeq(u64 val, volatile void __iomem *addr)
  {
        asm volatile("str %0, [%1]" : : "r" (val), "r" (addr));
  }
  
+ #define __raw_readb __raw_readb
  static inline u8 __raw_readb(const volatile void __iomem *addr)
  {
        u8 val;
 -      asm volatile("ldrb %w0, [%1]" : "=r" (val) : "r" (addr));
 +      asm volatile(ALTERNATIVE("ldrb %w0, [%1]",
 +                               "ldarb %w0, [%1]",
 +                               ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
 +                   : "=r" (val) : "r" (addr));
        return val;
  }
  
+ #define __raw_readw __raw_readw
  static inline u16 __raw_readw(const volatile void __iomem *addr)
  {
        u16 val;
 -      asm volatile("ldrh %w0, [%1]" : "=r" (val) : "r" (addr));
 +
 +      asm volatile(ALTERNATIVE("ldrh %w0, [%1]",
 +                               "ldarh %w0, [%1]",
 +                               ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
 +                   : "=r" (val) : "r" (addr));
        return val;
  }
  
+ #define __raw_readl __raw_readl
  static inline u32 __raw_readl(const volatile void __iomem *addr)
  {
        u32 val;
 -      asm volatile("ldr %w0, [%1]" : "=r" (val) : "r" (addr));
 +      asm volatile(ALTERNATIVE("ldr %w0, [%1]",
 +                               "ldar %w0, [%1]",
 +                               ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
 +                   : "=r" (val) : "r" (addr));
        return val;
  }
  
+ #define __raw_readq __raw_readq
  static inline u64 __raw_readq(const volatile void __iomem *addr)
  {
        u64 val;
 -      asm volatile("ldr %0, [%1]" : "=r" (val) : "r" (addr));
 +      asm volatile(ALTERNATIVE("ldr %0, [%1]",
 +                               "ldar %0, [%1]",
 +                               ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
 +                   : "=r" (val) : "r" (addr));
        return val;
  }
  
  #define IO_SPACE_LIMIT                (SZ_32M - 1)
  #define PCI_IOBASE            ((void __iomem *)(MODULES_VADDR - SZ_32M))
  
- static inline u8 inb(unsigned long addr)
- {
-       return readb(addr + PCI_IOBASE);
- }
- static inline u16 inw(unsigned long addr)
- {
-       return readw(addr + PCI_IOBASE);
- }
- static inline u32 inl(unsigned long addr)
- {
-       return readl(addr + PCI_IOBASE);
- }
- static inline void outb(u8 b, unsigned long addr)
- {
-       writeb(b, addr + PCI_IOBASE);
- }
- static inline void outw(u16 b, unsigned long addr)
- {
-       writew(b, addr + PCI_IOBASE);
- }
- static inline void outl(u32 b, unsigned long addr)
- {
-       writel(b, addr + PCI_IOBASE);
- }
- #define inb_p(addr)   inb(addr)
- #define inw_p(addr)   inw(addr)
- #define inl_p(addr)   inl(addr)
- #define outb_p(x, addr)       outb((x), (addr))
- #define outw_p(x, addr)       outw((x), (addr))
- #define outl_p(x, addr)       outl((x), (addr))
- static inline void insb(unsigned long addr, void *buffer, int count)
- {
-       u8 *buf = buffer;
-       while (count--)
-               *buf++ = __raw_readb(addr + PCI_IOBASE);
- }
- static inline void insw(unsigned long addr, void *buffer, int count)
- {
-       u16 *buf = buffer;
-       while (count--)
-               *buf++ = __raw_readw(addr + PCI_IOBASE);
- }
- static inline void insl(unsigned long addr, void *buffer, int count)
- {
-       u32 *buf = buffer;
-       while (count--)
-               *buf++ = __raw_readl(addr + PCI_IOBASE);
- }
- static inline void outsb(unsigned long addr, const void *buffer, int count)
- {
-       const u8 *buf = buffer;
-       while (count--)
-               __raw_writeb(*buf++, addr + PCI_IOBASE);
- }
- static inline void outsw(unsigned long addr, const void *buffer, int count)
- {
-       const u16 *buf = buffer;
-       while (count--)
-               __raw_writew(*buf++, addr + PCI_IOBASE);
- }
- static inline void outsl(unsigned long addr, const void *buffer, int count)
- {
-       const u32 *buf = buffer;
-       while (count--)
-               __raw_writel(*buf++, addr + PCI_IOBASE);
- }
- #define insb_p(port,to,len)   insb(port,to,len)
- #define insw_p(port,to,len)   insw(port,to,len)
- #define insl_p(port,to,len)   insl(port,to,len)
- #define outsb_p(port,from,len)        outsb(port,from,len)
- #define outsw_p(port,from,len)        outsw(port,from,len)
- #define outsl_p(port,from,len)        outsl(port,from,len)
  /*
   * String version of I/O memory access operations.
   */
@@@ -251,18 -156,14 +171,14 @@@ extern void __iomem *ioremap_cache(phys
  #define ioremap_wc(addr, size)                __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
  #define iounmap                               __iounmap
  
- #define ARCH_HAS_IOREMAP_WC
- #include <asm-generic/iomap.h>
  /*
-  * More restrictive address range checking than the default implementation
-  * (PHYS_OFFSET and PHYS_MASK taken into account).
+  * io{read,write}{16,32}be() macros
   */
- #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
- extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
- extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
+ #define ioread16be(p)         ({ __u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
+ #define ioread32be(p)         ({ __u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
  
- extern int devmem_is_allowed(unsigned long pfn);
+ #define iowrite16be(v,p)      ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); })
+ #define iowrite32be(v,p)      ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); })
  
  /*
   * Convert a physical pointer to a virtual kernel pointer for /dev/mem
   */
  #define xlate_dev_kmem_ptr(p) p
  
+ #include <asm-generic/io.h>
+ /*
+  * More restrictive address range checking than the default implementation
+  * (PHYS_OFFSET and PHYS_MASK taken into account).
+  */
+ #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
+ extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
+ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
+ extern int devmem_is_allowed(unsigned long pfn);
  struct bio_vec;
  extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
                                      const struct bio_vec *vec2);
index a62cd077457b933641d4f016c255e297b332c3bc,a40a4d7e830fd42992c494cb17c41198636e20a4..6486b2bfd56263c920cd28d840d9583212391d01
@@@ -120,11 -120,13 +120,13 @@@ extern phys_addr_t              memstart_addr
   * translation for translating DMA addresses.  Use the driver
   * DMA support - see dma-mapping.h.
   */
+ #define virt_to_phys virt_to_phys
  static inline phys_addr_t virt_to_phys(const volatile void *x)
  {
        return __virt_to_phys((unsigned long)(x));
  }
  
+ #define phys_to_virt phys_to_virt
  static inline void *phys_to_virt(phys_addr_t x)
  {
        return (void *)(__phys_to_virt(x));
   *  virt_to_page(k)   convert a _valid_ virtual address to struct page *
   *  virt_addr_valid(k)        indicates whether a virtual address is valid
   */
 -#define ARCH_PFN_OFFSET               PHYS_PFN_OFFSET
 +#define ARCH_PFN_OFFSET               ((unsigned long)PHYS_PFN_OFFSET)
  
  #define virt_to_page(kaddr)   pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
  #define       virt_addr_valid(kaddr)  pfn_valid(__pa(kaddr) >> PAGE_SHIFT)