]> Git Repo - linux.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
authorLinus Torvalds <[email protected]>
Sat, 18 Nov 2017 04:21:44 +0000 (20:21 -0800)
committerLinus Torvalds <[email protected]>
Sat, 18 Nov 2017 04:21:44 +0000 (20:21 -0800)
Pull sparc updates from David Miller:

 1) Add missing cmpxchg64() for 32-bit sparc.

 2) Timer conversions from Allen Pais and Kees Cook.

 3) vDSO support, from Nagarathnam Muthusamy.

 4) Fix sparc64 huge page table walks based upon bug report by Al Viro,
    from Nitin Gupta.

 5) Optimized fls() for T4 and above, from Vijay Kumar.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
  sparc64: Fix page table walk for PUD hugepages
  sparc64: Convert timers to user timer_setup()
  sparc64: convert mdesc_handle.refcnt from atomic_t to refcount_t
  sparc/led: Convert timers to use timer_setup()
  sparc64: Use sparc optimized fls and __fls for T4 and above
  sparc64: SPARC optimized __fls function
  sparc64: SPARC optimized fls function
  sparc64: Define SPARC default __fls function
  sparc64: Define SPARC default fls function
  vDSO for sparc
  sparc32: Add cmpxchg64().
  sbus: char: Move D7S_MINOR to include/linux/miscdevice.h
  sparc: time: Remove unneeded linux/miscdevice.h include
  sparc64: mmu_context: Add missing include files

18 files changed:
1  2 
arch/sparc/Kconfig
arch/sparc/Makefile
arch/sparc/include/asm/bitops_64.h
arch/sparc/include/asm/cmpxchg_32.h
arch/sparc/include/asm/elf_64.h
arch/sparc/include/asm/mmu_64.h
arch/sparc/include/asm/mmu_context_64.h
arch/sparc/include/asm/processor_64.h
arch/sparc/include/asm/tsb.h
arch/sparc/kernel/Makefile
arch/sparc/kernel/head_64.S
arch/sparc/kernel/mdesc.c
arch/sparc/kernel/time_64.c
arch/sparc/kernel/viohs.c
arch/sparc/lib/Makefile
arch/sparc/lib/NG4patch.S
arch/sparc/lib/atomic32.c
include/linux/miscdevice.h

diff --combined arch/sparc/Kconfig
index 987a57502909b4eb81bc86afa286f1140955ade0,cd28b6cd95a26883f7f668fde1771aa284ea764d..6bf594ace663ec82f746132b4f62fc351bf5160c
@@@ -44,6 -44,7 +44,6 @@@ config SPAR
        select ARCH_HAS_SG_CHAIN
        select CPU_NO_EFFICIENT_FFS
        select LOCKDEP_SMALL if LOCKDEP
 -      select ARCH_WANT_RELAX_ORDER
  
  config SPARC32
        def_bool !64BIT
@@@ -84,6 -85,8 +84,8 @@@ config SPARC6
        select HAVE_REGS_AND_STACK_ACCESS_API
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
+       select GENERIC_TIME_VSYSCALL
+       select ARCH_CLOCKSOURCE_DATA
  
  config ARCH_DEFCONFIG
        string
@@@ -96,6 -99,9 +98,6 @@@ config ARCH_PROC_KCORE_TEX
  config CPU_BIG_ENDIAN
        def_bool y
  
 -config CPU_BIG_ENDIAN
 -      def_bool y
 -
  config ARCH_ATU
        bool
        default y if SPARC64
diff --combined arch/sparc/Makefile
index dbc448923f48f84b69757171be434c6f71a64355,0395b0de6cb4ca532a5effd76249a1db65ba7a81..edac927e4952347555fe6b60543d6ebf105088c9
@@@ -1,4 -1,3 +1,4 @@@
 +# SPDX-License-Identifier: GPL-2.0
  #
  # sparc/Makefile
  #
@@@ -81,6 -80,10 +81,10 @@@ install
  archclean:
        $(Q)$(MAKE) $(clean)=$(boot)
  
+ PHONY += vdso_install
+ vdso_install:
+       $(Q)$(MAKE) $(build)=arch/sparc/vdso $@
  # This is the image used for packaging
  KBUILD_IMAGE := $(boot)/zImage
  
index a90eea24b2862fcc9fa297f37c494da3eda6ecc5,d7a46e2480c01222da2135c607e06541f6ee5e36..ca7ea5913494f9b66991c1659fcba70f04c525be
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  /*
   * bitops.h: Bit string operations on the V9.
   *
@@@ -23,10 -22,11 +23,11 @@@ void set_bit(unsigned long nr, volatil
  void clear_bit(unsigned long nr, volatile unsigned long *addr);
  void change_bit(unsigned long nr, volatile unsigned long *addr);
  
+ int fls(unsigned int word);
+ int __fls(unsigned long word);
  #include <asm-generic/bitops/non-atomic.h>
  
- #include <asm-generic/bitops/fls.h>
- #include <asm-generic/bitops/__fls.h>
  #include <asm-generic/bitops/fls64.h>
  
  #ifdef __KERNEL__
index 3e3823db303e7d4016a9d5116d0a11e31844dfff,a0101a58fd3fe43a48a5bb6d770609f8eb5d9829..c73b5a3ab7b91f971d7ca9f3f09e7814fd113856
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  /* 32-bit atomic xchg() and cmpxchg() definitions.
   *
   * Copyright (C) 1996 David S. Miller ([email protected])
@@@ -63,6 -62,9 +63,9 @@@ __cmpxchg(volatile void *ptr, unsigned 
                        (unsigned long)_n_, sizeof(*(ptr)));            \
  })
  
+ u64 __cmpxchg_u64(u64 *ptr, u64 old, u64 new);
+ #define cmpxchg64(ptr, old, new)      __cmpxchg_u64(ptr, old, new)
  #include <asm-generic/cmpxchg-local.h>
  
  /*
index 5894389f5ed56ea9f88994d87f5d6a9c442195ba,1aa35a334a22564442e3f9933caad1d91a126cc5..25340df3570c78f1722ae328885927cb39c0dc90
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  #ifndef __ASM_SPARC64_ELF_H
  #define __ASM_SPARC64_ELF_H
  
@@@ -211,4 -210,18 +211,18 @@@ do {     if ((ex).e_ident[EI_CLASS] == ELFC
                        (current->personality & (~PER_MASK)));  \
  } while (0)
  
+ extern unsigned int vdso_enabled;
+ #define       ARCH_DLINFO                                                     \
+ do {                                                                  \
+       if (vdso_enabled)                                               \
+               NEW_AUX_ENT(AT_SYSINFO_EHDR,                            \
+                           (unsigned long)current->mm->context.vdso);  \
+ } while (0)
+ struct linux_binprm;
+ #define ARCH_HAS_SETUP_ADDITIONAL_PAGES       1
+ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
+                                       int uses_interp);
  #endif /* !(__ASM_SPARC64_ELF_H) */
index 5fe64a57b4ba9c9e8964e4ff97b3c2b41f721d14,4142132dcb6b9ab4a60014ce07df1eff3edecfbd..ad4fb93508ba14a8e61b24369c9afa9feaf67b98
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  #ifndef __MMU_H
  #define __MMU_H
  
@@@ -97,6 -96,7 +97,7 @@@ typedef struct 
        unsigned long           thp_pte_count;
        struct tsb_config       tsb_block[MM_NUM_TSBS];
        struct hv_tsb_descr     tsb_descr[MM_NUM_TSBS];
+       void                    *vdso;
  } mm_context_t;
  
  #endif /* !__ASSEMBLY__ */
index e25d25b0a34b52c28a1bf122d7dee3a350b8c35c,a34315e1f0eda4365a524927807e8620cd42c154..b361702ef52a7529aee7849fdf310d28ef338a76
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  #ifndef __SPARC64_MMU_CONTEXT_H
  #define __SPARC64_MMU_CONTEXT_H
  
@@@ -8,9 -7,11 +8,11 @@@
  
  #include <linux/spinlock.h>
  #include <linux/mm_types.h>
+ #include <linux/smp.h>
  
  #include <asm/spitfire.h>
  #include <asm-generic/mm_hooks.h>
+ #include <asm/percpu.h>
  
  static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  {
index c7c79fe8d2655bd3e54177e84ff62395afd2cac6,bcb3172abeda541ace22c717a29f6834780748ed..aac23d4a4ddd5647643dfdb3e337492802f57a8c
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  /*
   * include/asm/processor.h
   *
@@@ -200,6 -199,13 +200,13 @@@ unsigned long get_wchan(struct task_str
   * To make a long story short, we are trying to yield the current cpu
   * strand during busy loops.
   */
+ #ifdef        BUILD_VDSO
+ #define       cpu_relax()     asm volatile("\n99:\n\t"                        \
+                                    "rd        %%ccr, %%g0\n\t"        \
+                                    "rd        %%ccr, %%g0\n\t"        \
+                                    "rd        %%ccr, %%g0\n\t"        \
+                                    ::: "memory")
+ #else /* ! BUILD_VDSO */
  #define cpu_relax()   asm volatile("\n99:\n\t"                        \
                                     "rd        %%ccr, %%g0\n\t"        \
                                     "rd        %%ccr, %%g0\n\t"        \
                                     "nop\n\t"                          \
                                     ".previous"                        \
                                     ::: "memory")
+ #endif
  
  /* Prefetch support.  This is tuned for UltraSPARC-III and later.
   * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
index 25b6abdb39083c6286d1c59984c8ff3179ba4852,ca0de1646f1ede087bc60349f94acd39af7bf1dc..522a677e050d757d9d19afb663b3adeda02245a1
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  #ifndef _SPARC64_TSB_H
  #define _SPARC64_TSB_H
  
@@@ -217,7 -216,7 +217,7 @@@ extern struct tsb_phys_patch_entry __ts
        sllx            REG2, 32, REG2;                 \
        andcc           REG1, REG2, %g0;                \
        be,pt           %xcc, 700f;                     \
-        sethi          %hi(0x1ffc0000), REG2;          \
+        sethi          %hi(0xffe00000), REG2;          \
        sllx            REG2, 1, REG2;                  \
        brgez,pn        REG1, FAIL_LABEL;               \
         andn           REG1, REG2, REG1;               \
index 8de9617589a52e197a6e4ead214910c3e8c733a9,408071e675e87e0ddd5bcdb30fa5a2b925b34831..cc97545737f0554e05ff16cfbd1a8460e5781a75
@@@ -1,4 -1,3 +1,4 @@@
 +# SPDX-License-Identifier: GPL-2.0
  
  #
  # Makefile for the linux kernel.
@@@ -43,6 -42,7 +43,7 @@@ obj-$(CONFIG_SPARC32)   += systbls_32.
  obj-y                   += time_$(BITS).o
  obj-$(CONFIG_SPARC32)   += windows.o
  obj-y                   += cpu.o
+ obj-$(CONFIG_SPARC64) += vdso.o
  obj-$(CONFIG_SPARC32)   += devices.o
  obj-y                   += ptrace_$(BITS).o
  obj-y                   += unaligned_$(BITS).o
index 9e293de120520b55822e63590c2b63ac0d99136f,f362ecb9955d2327100a758b1a61346df3ade34e..a41e6e16eb367d46d16d24f5876f58c151a45db1
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  /* head.S: Initial boot code for the Sparc64 port of Linux.
   *
   * Copyright (C) 1996, 1997, 2007 David S. Miller ([email protected])
@@@ -641,6 -640,8 +641,8 @@@ niagara4_patch
         nop
        call    niagara4_patch_pageops
         nop
+       call    niagara4_patch_fls
+        nop
  
        ba,a,pt %xcc, 80f
         nop
index 1ef6156b15305d40dc8382b4fabb6af974d8a01b,821a7247a0374be1da2253e1687846fae847f4b2..418592a09b411f6cac770ef8f16d807d81d3c3b6
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /* mdesc.c: Sun4V machine description handling.
   *
   * Copyright (C) 2007, 2008 David S. Miller <[email protected]>
@@@ -13,6 -12,7 +13,7 @@@
  #include <linux/miscdevice.h>
  #include <linux/bootmem.h>
  #include <linux/export.h>
+ #include <linux/refcount.h>
  
  #include <asm/cpudata.h>
  #include <asm/hypervisor.h>
@@@ -71,7 -71,7 +72,7 @@@ struct mdesc_handle 
        struct list_head        list;
        struct mdesc_mem_ops    *mops;
        void                    *self_base;
-       atomic_t                refcnt;
+       refcount_t              refcnt;
        unsigned int            handle_size;
        struct mdesc_hdr        mdesc;
  };
@@@ -153,7 -153,7 +154,7 @@@ static void mdesc_handle_init(struct md
        memset(hp, 0, handle_size);
        INIT_LIST_HEAD(&hp->list);
        hp->self_base = base;
-       atomic_set(&hp->refcnt, 1);
+       refcount_set(&hp->refcnt, 1);
        hp->handle_size = handle_size;
  }
  
@@@ -183,7 -183,7 +184,7 @@@ static void __init mdesc_memblock_free(
        unsigned int alloc_size;
        unsigned long start;
  
-       BUG_ON(atomic_read(&hp->refcnt) != 0);
+       BUG_ON(refcount_read(&hp->refcnt) != 0);
        BUG_ON(!list_empty(&hp->list));
  
        alloc_size = PAGE_ALIGN(hp->handle_size);
@@@ -221,7 -221,7 +222,7 @@@ static struct mdesc_handle *mdesc_kmall
  
  static void mdesc_kfree(struct mdesc_handle *hp)
  {
-       BUG_ON(atomic_read(&hp->refcnt) != 0);
+       BUG_ON(refcount_read(&hp->refcnt) != 0);
        BUG_ON(!list_empty(&hp->list));
  
        kfree(hp->self_base);
@@@ -260,7 -260,7 +261,7 @@@ struct mdesc_handle *mdesc_grab(void
        spin_lock_irqsave(&mdesc_lock, flags);
        hp = cur_mdesc;
        if (hp)
-               atomic_inc(&hp->refcnt);
+               refcount_inc(&hp->refcnt);
        spin_unlock_irqrestore(&mdesc_lock, flags);
  
        return hp;
@@@ -272,7 -272,7 +273,7 @@@ void mdesc_release(struct mdesc_handle 
        unsigned long flags;
  
        spin_lock_irqsave(&mdesc_lock, flags);
-       if (atomic_dec_and_test(&hp->refcnt)) {
+       if (refcount_dec_and_test(&hp->refcnt)) {
                list_del_init(&hp->list);
                hp->mops->free(hp);
        }
@@@ -514,7 -514,7 +515,7 @@@ void mdesc_update(void
        if (status != HV_EOK || real_len > len) {
                printk(KERN_ERR "MD: mdesc reread fails with %lu\n",
                       status);
-               atomic_dec(&hp->refcnt);
+               refcount_dec(&hp->refcnt);
                mdesc_free(hp);
                goto out;
        }
        mdesc_notify_clients(orig_hp, hp);
  
        spin_lock_irqsave(&mdesc_lock, flags);
-       if (atomic_dec_and_test(&orig_hp->refcnt))
+       if (refcount_dec_and_test(&orig_hp->refcnt))
                mdesc_free(orig_hp);
        else
                list_add(&orig_hp->list, &mdesc_zombie_list);
index 3b397081047af69a23b6672917e1706786d3134f,79fdf576dab0e3adcaf0048cf6c3be5ffab35115..2ef8cfa9677ed5b034640be15933e0639026ad49
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /* time.c: UltraSparc timer and TOD clock support.
   *
   * Copyright (C) 1997, 2008 David S. Miller ([email protected])
@@@ -28,7 -27,6 +28,6 @@@
  #include <linux/jiffies.h>
  #include <linux/cpufreq.h>
  #include <linux/percpu.h>
- #include <linux/miscdevice.h>
  #include <linux/rtc/m48t59.h>
  #include <linux/kernel_stat.h>
  #include <linux/clockchips.h>
@@@ -54,6 -52,8 +53,8 @@@
  
  DEFINE_SPINLOCK(rtc_lock);
  
+ unsigned int __read_mostly vdso_fix_stick;
  #ifdef CONFIG_SMP
  unsigned long profile_pc(struct pt_regs *regs)
  {
@@@ -831,12 -831,17 +832,17 @@@ static void init_tick_ops(struct sparc6
  void __init time_init_early(void)
  {
        if (tlb_type == spitfire) {
-               if (is_hummingbird())
+               if (is_hummingbird()) {
                        init_tick_ops(&hbtick_operations);
-               else
+                       clocksource_tick.archdata.vclock_mode = VCLOCK_NONE;
+               } else {
                        init_tick_ops(&tick_operations);
+                       clocksource_tick.archdata.vclock_mode = VCLOCK_TICK;
+                       vdso_fix_stick = 1;
+               }
        } else {
                init_tick_ops(&stick_operations);
+               clocksource_tick.archdata.vclock_mode = VCLOCK_STICK;
        }
  }
  
index c858f5f3ce2c13351ac468563b4b0595ddbd9f44,7cb27c2fb16fa1ee73989f0a61fe49fb6c21e880..635d67ffc9a39f72f3acd24f94b052e754fcfcb1
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /* viohs.c: LDOM Virtual I/O handshake helper layer.
   *
   * Copyright (C) 2007 David S. Miller <[email protected]>
@@@ -798,9 -797,9 +798,9 @@@ void vio_port_up(struct vio_driver_stat
  }
  EXPORT_SYMBOL(vio_port_up);
  
- static void vio_port_timer(unsigned long _arg)
+ static void vio_port_timer(struct timer_list *t)
  {
-       struct vio_driver_state *vio = (struct vio_driver_state *) _arg;
+       struct vio_driver_state *vio = from_timer(vio, t, timer);
  
        vio_port_up(vio);
  }
@@@ -849,7 -848,7 +849,7 @@@ int vio_driver_init(struct vio_driver_s
  
        vio->ops = ops;
  
-       setup_timer(&vio->timer, vio_port_timer, (unsigned long) vio);
+       timer_setup(&vio->timer, vio_port_timer, 0);
  
        return 0;
  }
diff --combined arch/sparc/lib/Makefile
index 44829a8dc45818e819a5f08aa67846599f5b41b4,2823b8e530ed631c01b3012ce3fba67a425b5513..0f0f76b4f6cd634d1391a028910e393b16858d64
@@@ -1,4 -1,3 +1,4 @@@
 +# SPDX-License-Identifier: GPL-2.0
  # Makefile for Sparc library files..
  #
  
@@@ -17,6 -16,9 +17,9 @@@ lib-$(CONFIG_SPARC64) += atomic_64.
  lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o
  lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o
  lib-$(CONFIG_SPARC64) += multi3.o
+ lib-$(CONFIG_SPARC64) += fls.o
+ lib-$(CONFIG_SPARC64) += fls64.o
+ obj-$(CONFIG_SPARC64) += NG4fls.o
  
  lib-$(CONFIG_SPARC64) += copy_page.o clear_page.o bzero.o
  lib-$(CONFIG_SPARC64) += csum_copy.o csum_copy_from_user.o csum_copy_to_user.o
index aa58ab39f9a6293ab496f61d21ba40daed5e7df6,da65a3ebb7cce9acc636c4cce3f58e06ba8cd927..37866175c921e2bfdca67d990a2a18cf5a24f08b
@@@ -1,9 -1,10 +1,11 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  /* NG4patch.S: Patch Ultra-I routines with Niagara-4 variant.
   *
   * Copyright (C) 2012 David S. Miller <[email protected]>
   */
  
+ #include <linux/linkage.h>
  #define BRANCH_ALWAYS 0x10680000
  #define NOP           0x01000000
  #define NG_DO_PATCH(OLD, NEW) \
@@@ -53,3 -54,10 +55,10 @@@ niagara4_patch_pageops
        retl
         nop
        .size   niagara4_patch_pageops,.-niagara4_patch_pageops
+ ENTRY(niagara4_patch_fls)
+       NG_DO_PATCH(fls, NG4fls)
+       NG_DO_PATCH(__fls, __NG4fls)
+       retl
+        nop
+ ENDPROC(niagara4_patch_fls)
index 5010df4973879fb1b17e689e01ae11ca754ffc56,ddacb5aeb4242623aca2f4a79138499ed69a2879..465a901a0ada71aef7ac08e36c90b7f528ae809d
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * atomic32.c: 32-bit atomic_t implementation
   *
@@@ -173,6 -172,20 +173,20 @@@ unsigned long __cmpxchg_u32(volatile u3
  }
  EXPORT_SYMBOL(__cmpxchg_u32);
  
+ u64 __cmpxchg_u64(u64 *ptr, u64 old, u64 new)
+ {
+       unsigned long flags;
+       u64 prev;
+       spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
+       if ((prev = *ptr) == old)
+               *ptr = new;
+       spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
+       return prev;
+ }
+ EXPORT_SYMBOL(__cmpxchg_u64);
  unsigned long __xchg_u32(volatile u32 *ptr, u32 new)
  {
        unsigned long flags;
index 4de703d9e21f0de963752a83efa2a29dc6b00b24,05c3892b3e92543a2e33f1e23fbce0c47bf1a022..3247a3dc7934893b586547a3dd830d2e63b43589
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  #ifndef _LINUX_MISCDEVICE_H
  #define _LINUX_MISCDEVICE_H
  #include <linux/major.h>
@@@ -36,6 -35,7 +36,7 @@@
  #define HWRNG_MINOR           183
  #define MICROCODE_MINOR               184
  #define IRNET_MINOR           187
+ #define D7S_MINOR             193
  #define VFIO_MINOR            196
  #define TUN_MINOR             200
  #define CUSE_MINOR            203
This page took 0.091337 seconds and 4 git commands to generate.