Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: force CONFIG_SMP=y and remove redundant #ifdefs

Nobody seems to be producing !SMP systems anymore, so this is just
becoming a source of kernel bugs, particularly if people want to use
coherent DMA with non-shared pages.

This patch forces CONFIG_SMP=y for arm64, removing a modest amount of
code in the process.

Signed-off-by: Will Deacon <will.deacon@arm.com>

+8 -153
+4 -22
arch/arm64/Kconfig
··· 28 28 select EDAC_SUPPORT 29 29 select GENERIC_ALLOCATOR 30 30 select GENERIC_CLOCKEVENTS 31 - select GENERIC_CLOCKEVENTS_BROADCAST if SMP 31 + select GENERIC_CLOCKEVENTS_BROADCAST 32 32 select GENERIC_CPU_AUTOPROBE 33 33 select GENERIC_EARLY_IOREMAP 34 34 select GENERIC_IRQ_PROBE ··· 135 135 def_bool y 136 136 137 137 config NEED_SG_DMA_LENGTH 138 + def_bool y 139 + 140 + config SMP 138 141 def_bool y 139 142 140 143 config SWIOTLB ··· 494 491 help 495 492 Say Y if you plan on running a kernel in big-endian mode. 496 493 497 - config SMP 498 - bool "Symmetric Multi-Processing" 499 - help 500 - This enables support for systems with more than one CPU. If 501 - you say N here, the kernel will run on single and 502 - multiprocessor machines, but will use only one CPU of a 503 - multiprocessor machine. If you say Y here, the kernel will run 504 - on many, but not all, single processor machines. On a single 505 - processor machine, the kernel will run faster if you say N 506 - here. 507 - 508 - If you don't know what to do here, say N. 509 - 510 494 config SCHED_MC 511 495 bool "Multi-core scheduler support" 512 - depends on SMP 513 496 help 514 497 Multi-core scheduler support improves the CPU scheduler's decision 515 498 making when dealing with multi-core CPU chips at a cost of slightly ··· 503 514 504 515 config SCHED_SMT 505 516 bool "SMT scheduler support" 506 - depends on SMP 507 517 help 508 518 Improves the CPU scheduler's decision making when dealing with 509 519 MultiThreading at a cost of slightly increased overhead in some ··· 511 523 config NR_CPUS 512 524 int "Maximum number of CPUs (2-4096)" 513 525 range 2 4096 514 - depends on SMP 515 526 # These have to remain sorted largest to smallest 516 527 default "64" 517 528 518 529 config HOTPLUG_CPU 519 530 bool "Support for hot-pluggable CPUs" 520 - depends on SMP 521 531 help 522 532 Say Y here to experiment with turning CPUs off and on. CPUs 523 533 can be controlled through /sys/devices/system/cpu. 524 534 525 535 source kernel/Kconfig.preempt 526 - 527 - config UP_LATE_INIT 528 - def_bool y 529 - depends on !SMP 530 536 531 537 config HZ 532 538 int
-2
arch/arm64/include/asm/assembler.h
··· 91 91 * SMP data memory barrier 92 92 */ 93 93 .macro smp_dmb, opt 94 - #ifdef CONFIG_SMP 95 94 dmb \opt 96 - #endif 97 95 .endm 98 96 99 97 #define USER(l, x...) \
-24
arch/arm64/include/asm/barrier.h
··· 35 35 #define dma_rmb() dmb(oshld) 36 36 #define dma_wmb() dmb(oshst) 37 37 38 - #ifndef CONFIG_SMP 39 - #define smp_mb() barrier() 40 - #define smp_rmb() barrier() 41 - #define smp_wmb() barrier() 42 - 43 - #define smp_store_release(p, v) \ 44 - do { \ 45 - compiletime_assert_atomic_type(*p); \ 46 - barrier(); \ 47 - ACCESS_ONCE(*p) = (v); \ 48 - } while (0) 49 - 50 - #define smp_load_acquire(p) \ 51 - ({ \ 52 - typeof(*p) ___p1 = ACCESS_ONCE(*p); \ 53 - compiletime_assert_atomic_type(*p); \ 54 - barrier(); \ 55 - ___p1; \ 56 - }) 57 - 58 - #else 59 - 60 38 #define smp_mb() dmb(ish) 61 39 #define smp_rmb() dmb(ishld) 62 40 #define smp_wmb() dmb(ishst) ··· 86 108 } \ 87 109 ___p1; \ 88 110 }) 89 - 90 - #endif 91 111 92 112 #define read_barrier_depends() do { } while(0) 93 113 #define smp_read_barrier_depends() do { } while(0)
-4
arch/arm64/include/asm/hardirq.h
··· 24 24 25 25 typedef struct { 26 26 unsigned int __softirq_pending; 27 - #ifdef CONFIG_SMP 28 27 unsigned int ipi_irqs[NR_IPI]; 29 - #endif 30 28 } ____cacheline_aligned irq_cpustat_t; 31 29 32 30 #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ ··· 32 34 #define __inc_irq_stat(cpu, member) __IRQ_STAT(cpu, member)++ 33 35 #define __get_irq_stat(cpu, member) __IRQ_STAT(cpu, member) 34 36 35 - #ifdef CONFIG_SMP 36 37 u64 smp_irq_stat_cpu(unsigned int cpu); 37 38 #define arch_irq_stat_cpu smp_irq_stat_cpu 38 - #endif 39 39 40 40 #define __ARCH_IRQ_EXIT_IRQS_DISABLED 1 41 41
-11
arch/arm64/include/asm/irq_work.h
··· 1 1 #ifndef __ASM_IRQ_WORK_H 2 2 #define __ASM_IRQ_WORK_H 3 3 4 - #ifdef CONFIG_SMP 5 - 6 4 #include <asm/smp.h> 7 5 8 6 static inline bool arch_irq_work_has_interrupt(void) 9 7 { 10 8 return !!__smp_cross_call; 11 9 } 12 - 13 - #else 14 - 15 - static inline bool arch_irq_work_has_interrupt(void) 16 - { 17 - return false; 18 - } 19 - 20 - #endif 21 10 22 11 #endif /* __ASM_IRQ_WORK_H */
-8
arch/arm64/include/asm/percpu.h
··· 16 16 #ifndef __ASM_PERCPU_H 17 17 #define __ASM_PERCPU_H 18 18 19 - #ifdef CONFIG_SMP 20 - 21 19 static inline void set_my_cpu_offset(unsigned long off) 22 20 { 23 21 asm volatile("msr tpidr_el1, %0" :: "r" (off) : "memory"); ··· 35 37 return off; 36 38 } 37 39 #define __my_cpu_offset __my_cpu_offset() 38 - 39 - #else /* !CONFIG_SMP */ 40 - 41 - #define set_my_cpu_offset(x) do { } while (0) 42 - 43 - #endif /* CONFIG_SMP */ 44 40 45 41 #define PERCPU_OP(op, asm_op) \ 46 42 static inline unsigned long __percpu_##op(void *ptr, \
-5
arch/arm64/include/asm/pgtable.h
··· 61 61 extern void __pud_error(const char *file, int line, unsigned long val); 62 62 extern void __pgd_error(const char *file, int line, unsigned long val); 63 63 64 - #ifdef CONFIG_SMP 65 64 #define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) 66 65 #define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) 67 - #else 68 - #define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF) 69 - #define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF) 70 - #endif 71 66 72 67 #define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE)) 73 68 #define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_NORMAL_NC))
-4
arch/arm64/include/asm/ptrace.h
··· 183 183 184 184 #define instruction_pointer(regs) ((unsigned long)(regs)->pc) 185 185 186 - #ifdef CONFIG_SMP 187 186 extern unsigned long profile_pc(struct pt_regs *regs); 188 - #else 189 - #define profile_pc(regs) instruction_pointer(regs) 190 - #endif 191 187 192 188 #endif /* __ASSEMBLY__ */ 193 189 #endif
-4
arch/arm64/include/asm/smp.h
··· 20 20 #include <linux/cpumask.h> 21 21 #include <linux/thread_info.h> 22 22 23 - #ifndef CONFIG_SMP 24 - # error "<asm/smp.h> included in non-SMP build" 25 - #endif 26 - 27 23 #define raw_smp_processor_id() (current_thread_info()->cpu) 28 24 29 25 struct seq_file;
-9
arch/arm64/include/asm/topology.h
··· 1 1 #ifndef __ASM_TOPOLOGY_H 2 2 #define __ASM_TOPOLOGY_H 3 3 4 - #ifdef CONFIG_SMP 5 - 6 4 #include <linux/cpumask.h> 7 5 8 6 struct cpu_topology { ··· 21 23 void init_cpu_topology(void); 22 24 void store_cpu_topology(unsigned int cpuid); 23 25 const struct cpumask *cpu_coregroup_mask(int cpu); 24 - 25 - #else 26 - 27 - static inline void init_cpu_topology(void) { } 28 - static inline void store_cpu_topology(unsigned int cpuid) { } 29 - 30 - #endif 31 26 32 27 #include <asm-generic/topology.h> 33 28
+4 -3
arch/arm64/kernel/Makefile
··· 17 17 sys.o stacktrace.o time.o traps.o io.o vdso.o \ 18 18 hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \ 19 19 return_address.o cpuinfo.o cpu_errata.o \ 20 - cpufeature.o alternative.o cacheinfo.o 20 + cpufeature.o alternative.o cacheinfo.o \ 21 + smp.o smp_spin_table.o topology.o 21 22 22 23 arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ 23 24 sys_compat.o entry32.o \ ··· 26 25 arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o 27 26 arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o 28 27 arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o topology.o 29 - arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o 30 - arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o 28 + arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o 29 + arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_callchain.o 31 30 arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 32 31 arm64-obj-$(CONFIG_CPU_PM) += sleep.o suspend.o 33 32 arm64-obj-$(CONFIG_CPU_IDLE) += cpuidle.o
-2
arch/arm64/kernel/cpu_ops.c
··· 30 30 const struct cpu_operations *cpu_ops[NR_CPUS]; 31 31 32 32 static const struct cpu_operations *supported_cpu_ops[] __initconst = { 33 - #ifdef CONFIG_SMP 34 33 &smp_spin_table_ops, 35 - #endif 36 34 &cpu_psci_ops, 37 35 NULL, 38 36 };
-7
arch/arm64/kernel/head.S
··· 62 62 /* 63 63 * Initial memory map attributes. 64 64 */ 65 - #ifndef CONFIG_SMP 66 - #define PTE_FLAGS PTE_TYPE_PAGE | PTE_AF 67 - #define PMD_FLAGS PMD_TYPE_SECT | PMD_SECT_AF 68 - #else 69 65 #define PTE_FLAGS PTE_TYPE_PAGE | PTE_AF | PTE_SHARED 70 66 #define PMD_FLAGS PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S 71 - #endif 72 67 73 68 #ifdef CONFIG_ARM64_64K_PAGES 74 69 #define MM_MMUFLAGS PTE_ATTRINDX(MT_NORMAL) | PTE_FLAGS ··· 569 574 .long BOOT_CPU_MODE_EL1 570 575 .popsection 571 576 572 - #ifdef CONFIG_SMP 573 577 /* 574 578 * This provides a "holding pen" for platforms to hold all secondary 575 579 * cores are held until we're ready for them to initialise. ··· 616 622 mov x29, #0 617 623 b secondary_start_kernel 618 624 ENDPROC(__secondary_switched) 619 - #endif /* CONFIG_SMP */ 620 625 621 626 /* 622 627 * Enable the MMU.
-2
arch/arm64/kernel/irq.c
··· 33 33 34 34 int arch_show_interrupts(struct seq_file *p, int prec) 35 35 { 36 - #ifdef CONFIG_SMP 37 36 show_ipi_list(p, prec); 38 - #endif 39 37 seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count); 40 38 return 0; 41 39 }
-5
arch/arm64/kernel/psci.c
··· 462 462 } 463 463 #endif 464 464 465 - #ifdef CONFIG_SMP 466 - 467 465 static int __init cpu_psci_cpu_init(unsigned int cpu) 468 466 { 469 467 return 0; ··· 548 550 return -ETIMEDOUT; 549 551 } 550 552 #endif 551 - #endif 552 553 553 554 static int psci_suspend_finisher(unsigned long index) 554 555 { ··· 582 585 .cpu_init_idle = cpu_psci_cpu_init_idle, 583 586 .cpu_suspend = cpu_psci_cpu_suspend, 584 587 #endif 585 - #ifdef CONFIG_SMP 586 588 .cpu_init = cpu_psci_cpu_init, 587 589 .cpu_prepare = cpu_psci_cpu_prepare, 588 590 .cpu_boot = cpu_psci_cpu_boot, ··· 589 593 .cpu_disable = cpu_psci_cpu_disable, 590 594 .cpu_die = cpu_psci_cpu_die, 591 595 .cpu_kill = cpu_psci_cpu_kill, 592 - #endif 593 596 #endif 594 597 }; 595 598
-6
arch/arm64/kernel/setup.c
··· 131 131 } 132 132 133 133 struct mpidr_hash mpidr_hash; 134 - #ifdef CONFIG_SMP 135 134 /** 136 135 * smp_build_mpidr_hash - Pre-compute shifts required at each affinity 137 136 * level in order to build a linear index from an ··· 196 197 pr_warn("Large number of MPIDR hash buckets detected\n"); 197 198 __flush_dcache_area(&mpidr_hash, sizeof(struct mpidr_hash)); 198 199 } 199 - #endif 200 200 201 201 static void __init hyp_mode_check(void) 202 202 { ··· 403 405 xen_early_init(); 404 406 405 407 cpu_read_bootcpu_ops(); 406 - #ifdef CONFIG_SMP 407 408 smp_init_cpus(); 408 409 smp_build_mpidr_hash(); 409 - #endif 410 410 411 411 #ifdef CONFIG_VT 412 412 #if defined(CONFIG_VGA_CONSOLE) ··· 504 508 * online processors, looking for lines beginning with 505 509 * "processor". Give glibc what it expects. 506 510 */ 507 - #ifdef CONFIG_SMP 508 511 seq_printf(m, "processor\t: %d\n", i); 509 - #endif 510 512 511 513 /* 512 514 * Dump out the common processor features in a single line.
-5
arch/arm64/kernel/sleep.S
··· 82 82 str x2, [x0, #CPU_CTX_SP] 83 83 ldr x1, =sleep_save_sp 84 84 ldr x1, [x1, #SLEEP_SAVE_SP_VIRT] 85 - #ifdef CONFIG_SMP 86 85 mrs x7, mpidr_el1 87 86 ldr x9, =mpidr_hash 88 87 ldr x10, [x9, #MPIDR_HASH_MASK] ··· 93 94 ldp w5, w6, [x9, #(MPIDR_HASH_SHIFTS + 8)] 94 95 compute_mpidr_hash x8, x3, x4, x5, x6, x7, x10 95 96 add x1, x1, x8, lsl #3 96 - #endif 97 97 bl __cpu_suspend_save 98 98 /* 99 99 * Grab suspend finisher in x20 and its argument in x19 ··· 149 151 150 152 ENTRY(cpu_resume) 151 153 bl el2_setup // if in EL2 drop to EL1 cleanly 152 - #ifdef CONFIG_SMP 153 154 mrs x1, mpidr_el1 154 155 adrp x8, mpidr_hash 155 156 add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address ··· 158 161 ldp w5, w6, [x8, #(MPIDR_HASH_SHIFTS + 8)] 159 162 compute_mpidr_hash x7, x3, x4, x5, x6, x1, x2 160 163 /* x7 contains hash index, let's use it to grab context pointer */ 161 - #else 162 164 mov x7, xzr 163 - #endif 164 165 ldr_l x0, sleep_save_sp + SLEEP_SAVE_SP_PHYS 165 166 ldr x0, [x0, x7, lsl #3] 166 167 /* load sp from context */
-2
arch/arm64/kernel/time.c
··· 42 42 #include <asm/thread_info.h> 43 43 #include <asm/stacktrace.h> 44 44 45 - #ifdef CONFIG_SMP 46 45 unsigned long profile_pc(struct pt_regs *regs) 47 46 { 48 47 struct stackframe frame; ··· 61 62 return frame.pc; 62 63 } 63 64 EXPORT_SYMBOL(profile_pc); 64 - #endif 65 65 66 66 void __init time_init(void) 67 67 {
-4
arch/arm64/kernel/traps.c
··· 189 189 #else 190 190 #define S_PREEMPT "" 191 191 #endif 192 - #ifdef CONFIG_SMP 193 192 #define S_SMP " SMP" 194 - #else 195 - #define S_SMP "" 196 - #endif 197 193 198 194 static int __die(const char *str, int err, struct thread_info *thread, 199 195 struct pt_regs *regs)
-16
arch/arm64/mm/context.c
··· 53 53 __flush_icache_all(); 54 54 } 55 55 56 - #ifdef CONFIG_SMP 57 - 58 56 static void set_mm_context(struct mm_struct *mm, unsigned int asid) 59 57 { 60 58 unsigned long flags; ··· 108 110 cpu_switch_mm(mm->pgd, mm); 109 111 } 110 112 111 - #else 112 - 113 - static inline void set_mm_context(struct mm_struct *mm, unsigned int asid) 114 - { 115 - mm->context.id = asid; 116 - cpumask_copy(mm_cpumask(mm), cpumask_of(smp_processor_id())); 117 - } 118 - 119 - #endif 120 - 121 113 void __new_context(struct mm_struct *mm) 122 114 { 123 115 unsigned int asid; 124 116 unsigned int bits = asid_bits(); 125 117 126 118 raw_spin_lock(&cpu_asid_lock); 127 - #ifdef CONFIG_SMP 128 119 /* 129 120 * Check the ASID again, in case the change was broadcast from another 130 121 * CPU before we acquired the lock. ··· 123 136 raw_spin_unlock(&cpu_asid_lock); 124 137 return; 125 138 } 126 - #endif 127 139 /* 128 140 * At this point, it is guaranteed that the current mm (with an old 129 141 * ASID) isn't active on any other CPU since the ASIDs are changed ··· 141 155 cpu_last_asid = ASID_FIRST_VERSION; 142 156 asid = cpu_last_asid + smp_processor_id(); 143 157 flush_context(); 144 - #ifdef CONFIG_SMP 145 158 smp_wmb(); 146 159 smp_call_function(reset_context, NULL, 1); 147 - #endif 148 160 cpu_last_asid += NR_CPUS - 1; 149 161 } 150 162
-4
arch/arm64/mm/flush.c
··· 60 60 unsigned long uaddr, void *dst, const void *src, 61 61 unsigned long len) 62 62 { 63 - #ifdef CONFIG_SMP 64 63 preempt_disable(); 65 - #endif 66 64 memcpy(dst, src, len); 67 65 flush_ptrace_access(vma, page, uaddr, dst, len); 68 - #ifdef CONFIG_SMP 69 66 preempt_enable(); 70 - #endif 71 67 } 72 68 73 69 void __sync_icache_dcache(pte_t pte, unsigned long addr)
-4
arch/arm64/mm/proc.S
··· 34 34 #define TCR_TG_FLAGS TCR_TG0_4K | TCR_TG1_4K 35 35 #endif 36 36 37 - #ifdef CONFIG_SMP 38 37 #define TCR_SMP_FLAGS TCR_SHARED 39 - #else 40 - #define TCR_SMP_FLAGS 0 41 - #endif 42 38 43 39 /* PTWs cacheable, inner/outer WBWA */ 44 40 #define TCR_CACHE_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA