Loading arch/sparc/include/asm/bitops_64.h +4 −38 Original line number Diff line number Diff line Loading @@ -42,45 +42,11 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); * of bits set) of a N-bit word */ #ifdef ULTRA_HAS_POPULATION_COUNT extern unsigned long __arch_hweight64(__u64 w); extern unsigned int __arch_hweight32(unsigned int w); extern unsigned int __arch_hweight16(unsigned int w); extern unsigned int __arch_hweight8(unsigned int w); static inline unsigned int __arch_hweight64(unsigned long w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w)); return res; } static inline unsigned int __arch_hweight32(unsigned int w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff)); return res; } static inline unsigned int __arch_hweight16(unsigned int w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff)); return res; } static inline unsigned int __arch_hweight8(unsigned int w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff)); return res; } #else #include <asm-generic/bitops/arch_hweight.h> #endif #include <asm-generic/bitops/const_hweight.h> #include <asm-generic/bitops/lock.h> #endif /* __KERNEL__ */ Loading arch/sparc/kernel/entry.h +7 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,13 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, extern void fpload(unsigned long *fpregs, unsigned long *fsr); #else /* CONFIG_SPARC32 */ struct popc_3insn_patch_entry { unsigned int addr; unsigned int insns[3]; }; extern struct popc_3insn_patch_entry __popc_3insn_patch, __popc_3insn_patch_end; extern void __init per_cpu_patch(void); extern void __init sun4v_patch(void); extern void __init boot_cpu_id_too_large(int cpu); Loading arch/sparc/kernel/setup_64.c +27 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,30 @@ void __init sun4v_patch(void) sun4v_hvapi_init(); } static void __init popc_patch(void) { struct popc_3insn_patch_entry *p3; p3 = &__popc_3insn_patch; while (p3 < &__popc_3insn_patch_end) { unsigned long addr = p3->addr; *(unsigned int *) (addr + 0) = p3->insns[0]; wmb(); __asm__ __volatile__("flush %0" : : "r" (addr + 0)); *(unsigned int *) (addr + 4) = p3->insns[1]; wmb(); __asm__ __volatile__("flush %0" : : "r" (addr + 4)); *(unsigned int *) (addr + 8) = p3->insns[2]; wmb(); __asm__ __volatile__("flush %0" : : "r" (addr + 4)); p3++; } } #ifdef CONFIG_SMP void __init boot_cpu_id_too_large(int cpu) { Loading Loading @@ -424,6 +448,9 @@ static void __init init_sparc64_elf_hwcap(void) sparc64_elf_hwcap = cap | mdesc_caps; report_hwcaps(sparc64_elf_hwcap); if (sparc64_elf_hwcap & AV_SPARC_POPC) popc_patch(); } void __init setup_arch(char **cmdline_p) Loading arch/sparc/kernel/sparc_ksyms_64.c +7 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/bitops.h> #include <asm/system.h> #include <asm/cpudata.h> Loading Loading @@ -38,5 +39,11 @@ EXPORT_SYMBOL(sun4v_niagara_setperf); EXPORT_SYMBOL(sun4v_niagara2_getperf); EXPORT_SYMBOL(sun4v_niagara2_setperf); /* from hweight.S */ EXPORT_SYMBOL(__arch_hweight8); EXPORT_SYMBOL(__arch_hweight16); EXPORT_SYMBOL(__arch_hweight32); EXPORT_SYMBOL(__arch_hweight64); /* Exporting a symbol from /init/main.c */ EXPORT_SYMBOL(saved_command_line); arch/sparc/kernel/vmlinux.lds.S +5 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,11 @@ SECTIONS *(.sun4v_2insn_patch) __sun4v_2insn_patch_end = .; } .popc_3insn_patch : { __popc_3insn_patch = .; *(.popc_3insn_patch) __popc_3insn_patch_end = .; } PERCPU_SECTION(SMP_CACHE_BYTES) . = ALIGN(PAGE_SIZE); Loading Loading
arch/sparc/include/asm/bitops_64.h +4 −38 Original line number Diff line number Diff line Loading @@ -42,45 +42,11 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); * of bits set) of a N-bit word */ #ifdef ULTRA_HAS_POPULATION_COUNT extern unsigned long __arch_hweight64(__u64 w); extern unsigned int __arch_hweight32(unsigned int w); extern unsigned int __arch_hweight16(unsigned int w); extern unsigned int __arch_hweight8(unsigned int w); static inline unsigned int __arch_hweight64(unsigned long w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w)); return res; } static inline unsigned int __arch_hweight32(unsigned int w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff)); return res; } static inline unsigned int __arch_hweight16(unsigned int w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff)); return res; } static inline unsigned int __arch_hweight8(unsigned int w) { unsigned int res; __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff)); return res; } #else #include <asm-generic/bitops/arch_hweight.h> #endif #include <asm-generic/bitops/const_hweight.h> #include <asm-generic/bitops/lock.h> #endif /* __KERNEL__ */ Loading
arch/sparc/kernel/entry.h +7 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,13 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, extern void fpload(unsigned long *fpregs, unsigned long *fsr); #else /* CONFIG_SPARC32 */ struct popc_3insn_patch_entry { unsigned int addr; unsigned int insns[3]; }; extern struct popc_3insn_patch_entry __popc_3insn_patch, __popc_3insn_patch_end; extern void __init per_cpu_patch(void); extern void __init sun4v_patch(void); extern void __init boot_cpu_id_too_large(int cpu); Loading
arch/sparc/kernel/setup_64.c +27 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,30 @@ void __init sun4v_patch(void) sun4v_hvapi_init(); } static void __init popc_patch(void) { struct popc_3insn_patch_entry *p3; p3 = &__popc_3insn_patch; while (p3 < &__popc_3insn_patch_end) { unsigned long addr = p3->addr; *(unsigned int *) (addr + 0) = p3->insns[0]; wmb(); __asm__ __volatile__("flush %0" : : "r" (addr + 0)); *(unsigned int *) (addr + 4) = p3->insns[1]; wmb(); __asm__ __volatile__("flush %0" : : "r" (addr + 4)); *(unsigned int *) (addr + 8) = p3->insns[2]; wmb(); __asm__ __volatile__("flush %0" : : "r" (addr + 4)); p3++; } } #ifdef CONFIG_SMP void __init boot_cpu_id_too_large(int cpu) { Loading Loading @@ -424,6 +448,9 @@ static void __init init_sparc64_elf_hwcap(void) sparc64_elf_hwcap = cap | mdesc_caps; report_hwcaps(sparc64_elf_hwcap); if (sparc64_elf_hwcap & AV_SPARC_POPC) popc_patch(); } void __init setup_arch(char **cmdline_p) Loading
arch/sparc/kernel/sparc_ksyms_64.c +7 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/bitops.h> #include <asm/system.h> #include <asm/cpudata.h> Loading Loading @@ -38,5 +39,11 @@ EXPORT_SYMBOL(sun4v_niagara_setperf); EXPORT_SYMBOL(sun4v_niagara2_getperf); EXPORT_SYMBOL(sun4v_niagara2_setperf); /* from hweight.S */ EXPORT_SYMBOL(__arch_hweight8); EXPORT_SYMBOL(__arch_hweight16); EXPORT_SYMBOL(__arch_hweight32); EXPORT_SYMBOL(__arch_hweight64); /* Exporting a symbol from /init/main.c */ EXPORT_SYMBOL(saved_command_line);
arch/sparc/kernel/vmlinux.lds.S +5 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,11 @@ SECTIONS *(.sun4v_2insn_patch) __sun4v_2insn_patch_end = .; } .popc_3insn_patch : { __popc_3insn_patch = .; *(.popc_3insn_patch) __popc_3insn_patch_end = .; } PERCPU_SECTION(SMP_CACHE_BYTES) . = ALIGN(PAGE_SIZE); Loading