diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-10 09:57:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-10 09:57:23 -0700 |
commit | d719518d9ce9132bad8a06e8029aeead328f66a3 (patch) | |
tree | f5a143973255868f68d3b71fb5bd4715326f0e52 /arch/sparc/kernel/smp_64.c | |
parent | 4c2b5e0fab602b468ce4d8c4d78c99f2caa79a3e (diff) | |
parent | b6fe1089667a7afcc2cf92cdaec590c7b8381715 (diff) | |
download | lwn-d719518d9ce9132bad8a06e8029aeead328f66a3.tar.gz lwn-d719518d9ce9132bad8a06e8029aeead328f66a3.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next
Pull sparc updates from David Miller:
1) Use register window state adjustment instructions when available,
from Anthony Yznaga.
2) Add VCC console concentrator driver, from Jag Raman.
3) Add 16GB hugepage support, from Nitin Gupta.
4) Support cpu 'poke' hypercall, from Vijay Kumar.
5) Add M7/M8 optimized memcpy/memset/copy_{to,from}_user, from Babu
Moger.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next: (33 commits)
sparc64: Handle additional cases of no fault loads
sparc64: speed up etrap/rtrap on NG2 and later processors
sparc64: vcc: make ktermios const
sparc: leon: grpci1: constify of_device_id
sparc: leon: grpci2: constify of_device_id
sparc64: vcc: Check for IS_ERR() instead of NULL
sparc64: Cleanup hugepage table walk functions
sparc64: Add 16GB hugepage support
sparc64: Support huge PUD case in get_user_pages
sparc64: vcc: Add install & cleanup TTY operations
sparc64: vcc: Add break_ctl TTY operation
sparc64: vcc: Add chars_in_buffer TTY operation
sparc64: vcc: Add write & write_room TTY operations
sparc64: vcc: Add hangup TTY operation
sparc64: vcc: Add open & close TTY operations
sparc64: vcc: Enable LDC event processing engine
sparc64: vcc: Add RX & TX timer for delayed LDC operation
sparc64: vcc: Create sysfs attribute group
sparc64: vcc: Enable VCC port probe and removal
sparc64: vcc: TTY driver initialization and cleanup
...
Diffstat (limited to 'arch/sparc/kernel/smp_64.c')
-rw-r--r-- | arch/sparc/kernel/smp_64.c | 80 |
1 files changed, 77 insertions, 3 deletions
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 3218bc43302e..4898329970c5 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -74,6 +74,9 @@ EXPORT_SYMBOL(cpu_core_sib_cache_map); static cpumask_t smp_commenced_mask; +static DEFINE_PER_CPU(bool, poke); +static bool cpu_poke; + void smp_info(struct seq_file *m) { int i; @@ -1439,15 +1442,86 @@ void __init smp_cpus_done(unsigned int max_cpus) { } +static void send_cpu_ipi(int cpu) +{ + xcall_deliver((u64) &xcall_receive_signal, + 0, 0, cpumask_of(cpu)); +} + +void scheduler_poke(void) +{ + if (!cpu_poke) + return; + + if (!__this_cpu_read(poke)) + return; + + __this_cpu_write(poke, false); + set_softint(1 << PIL_SMP_RECEIVE_SIGNAL); +} + +static unsigned long send_cpu_poke(int cpu) +{ + unsigned long hv_err; + + per_cpu(poke, cpu) = true; + hv_err = sun4v_cpu_poke(cpu); + if (hv_err != HV_EOK) { + per_cpu(poke, cpu) = false; + pr_err_ratelimited("%s: sun4v_cpu_poke() fails err=%lu\n", + __func__, hv_err); + } + + return hv_err; +} + void smp_send_reschedule(int cpu) { if (cpu == smp_processor_id()) { WARN_ON_ONCE(preemptible()); set_softint(1 << PIL_SMP_RECEIVE_SIGNAL); - } else { - xcall_deliver((u64) &xcall_receive_signal, - 0, 0, cpumask_of(cpu)); + return; + } + + /* Use cpu poke to resume idle cpu if supported. */ + if (cpu_poke && idle_cpu(cpu)) { + unsigned long ret; + + ret = send_cpu_poke(cpu); + if (ret == HV_EOK) + return; } + + /* Use IPI in following cases: + * - cpu poke not supported + * - cpu not idle + * - send_cpu_poke() returns with error + */ + send_cpu_ipi(cpu); +} + +void smp_init_cpu_poke(void) +{ + unsigned long major; + unsigned long minor; + int ret; + + if (tlb_type != hypervisor) + return; + + ret = sun4v_hvapi_get(HV_GRP_CORE, &major, &minor); + if (ret) { + pr_debug("HV_GRP_CORE is not registered\n"); + return; + } + + if (major == 1 && minor >= 6) { + /* CPU POKE is registered. */ + cpu_poke = true; + return; + } + + pr_debug("CPU_POKE not supported\n"); } void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs) |