summaryrefslogtreecommitdiffstats
path: root/arch/xtensa/kernel
diff options
context:
space:
mode:
authorLinus Torvalds2019-03-07 22:27:53 +0100
committerLinus Torvalds2019-03-07 22:27:53 +0100
commitdd1c3ed76f26504621b5ce08b894666aafa38e47 (patch)
treef879aefbbd7871733bc616cb7f73dd5ffca53f44 /arch/xtensa/kernel
parentMerge tag 'powerpc-5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/po... (diff)
parentxtensa: simplify trap_init (diff)
downloadkernel-qcow2-linux-dd1c3ed76f26504621b5ce08b894666aafa38e47.tar.gz
kernel-qcow2-linux-dd1c3ed76f26504621b5ce08b894666aafa38e47.tar.xz
kernel-qcow2-linux-dd1c3ed76f26504621b5ce08b894666aafa38e47.zip
Merge tag 'xtensa-20190307' of git://github.com/jcmvbkbc/linux-xtensa
Pull xtensa updates from Max Filippov: - use generic spinlock/rwlock implementations - clean up IPI processing - document boot parameters passing to the kernel - fix get_wchan - various cleanups in time.c, process.c, traps.c and thread_info.h * tag 'xtensa-20190307' of git://github.com/jcmvbkbc/linux-xtensa: xtensa: simplify trap_init xtensa: drop unused definitions xtensa: fix get_wchan xtensa: use generic spinlock/rwlock implementation xtensa: provide xchg for sizes 1 and 2 xtensa: clean up arch/xtensa/kernel/time.c xtensa: SMP: rework IPI processing xtensa: document boot parameter passing
Diffstat (limited to 'arch/xtensa/kernel')
-rw-r--r--arch/xtensa/kernel/process.c6
-rw-r--r--arch/xtensa/kernel/smp.c38
-rw-r--r--arch/xtensa/kernel/time.c53
-rw-r--r--arch/xtensa/kernel/traps.c5
4 files changed, 52 insertions, 50 deletions
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 74969a437a37..db278a9e80c7 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -52,8 +52,6 @@
extern void ret_from_fork(void);
extern void ret_from_kernel_thread(void);
-struct task_struct *current_set[NR_CPUS] = {&init_task, };
-
void (*pm_power_off)(void) = NULL;
EXPORT_SYMBOL(pm_power_off);
@@ -321,8 +319,8 @@ unsigned long get_wchan(struct task_struct *p)
/* Stack layout: sp-4: ra, sp-3: sp' */
- pc = MAKE_PC_FROM_RA(*(unsigned long*)sp - 4, sp);
- sp = *(unsigned long *)sp - 3;
+ pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp);
+ sp = SPILL_SLOT(sp, 1);
} while (count++ < 16);
return 0;
}
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
index be1f280c322c..3699d6d3e479 100644
--- a/arch/xtensa/kernel/smp.c
+++ b/arch/xtensa/kernel/smp.c
@@ -372,8 +372,7 @@ static void send_ipi_message(const struct cpumask *callmask,
unsigned long mask = 0;
for_each_cpu(index, callmask)
- if (index != smp_processor_id())
- mask |= 1 << index;
+ mask |= 1 << index;
set_er(mask, MIPISET(msg_id));
}
@@ -412,22 +411,31 @@ irqreturn_t ipi_interrupt(int irq, void *dev_id)
{
unsigned int cpu = smp_processor_id();
struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
- unsigned int msg;
- unsigned i;
- msg = get_er(MIPICAUSE(cpu));
- for (i = 0; i < IPI_MAX; i++)
- if (msg & (1 << i)) {
- set_er(1 << i, MIPICAUSE(cpu));
- ++ipi->ipi_count[i];
+ for (;;) {
+ unsigned int msg;
+
+ msg = get_er(MIPICAUSE(cpu));
+ set_er(msg, MIPICAUSE(cpu));
+
+ if (!msg)
+ break;
+
+ if (msg & (1 << IPI_CALL_FUNC)) {
+ ++ipi->ipi_count[IPI_CALL_FUNC];
+ generic_smp_call_function_interrupt();
}
- if (msg & (1 << IPI_RESCHEDULE))
- scheduler_ipi();
- if (msg & (1 << IPI_CALL_FUNC))
- generic_smp_call_function_interrupt();
- if (msg & (1 << IPI_CPU_STOP))
- ipi_cpu_stop(cpu);
+ if (msg & (1 << IPI_RESCHEDULE)) {
+ ++ipi->ipi_count[IPI_RESCHEDULE];
+ scheduler_ipi();
+ }
+
+ if (msg & (1 << IPI_CPU_STOP)) {
+ ++ipi->ipi_count[IPI_CPU_STOP];
+ ipi_cpu_stop(cpu);
+ }
+ }
return IRQ_HANDLED;
}
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 378186b5eb40..69db8c93c1f9 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -52,14 +52,11 @@ static struct clocksource ccount_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
-static int ccount_timer_set_next_event(unsigned long delta,
- struct clock_event_device *dev);
struct ccount_timer {
struct clock_event_device evt;
int irq_enabled;
char name[24];
};
-static DEFINE_PER_CPU(struct ccount_timer, ccount_timer);
static int ccount_timer_set_next_event(unsigned long delta,
struct clock_event_device *dev)
@@ -107,7 +104,30 @@ static int ccount_timer_set_oneshot(struct clock_event_device *evt)
return 0;
}
-static irqreturn_t timer_interrupt(int irq, void *dev_id);
+static DEFINE_PER_CPU(struct ccount_timer, ccount_timer) = {
+ .evt = {
+ .features = CLOCK_EVT_FEAT_ONESHOT,
+ .rating = 300,
+ .set_next_event = ccount_timer_set_next_event,
+ .set_state_shutdown = ccount_timer_shutdown,
+ .set_state_oneshot = ccount_timer_set_oneshot,
+ .tick_resume = ccount_timer_set_oneshot,
+ },
+};
+
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+ struct clock_event_device *evt = &this_cpu_ptr(&ccount_timer)->evt;
+
+ set_linux_timer(get_linux_timer());
+ evt->event_handler(evt);
+
+ /* Allow platform to do something useful (Wdog). */
+ platform_heartbeat();
+
+ return IRQ_HANDLED;
+}
+
static struct irqaction timer_irqaction = {
.handler = timer_interrupt,
.flags = IRQF_TIMER,
@@ -120,14 +140,8 @@ void local_timer_setup(unsigned cpu)
struct clock_event_device *clockevent = &timer->evt;
timer->irq_enabled = 1;
- clockevent->name = timer->name;
snprintf(timer->name, sizeof(timer->name), "ccount_clockevent_%u", cpu);
- clockevent->features = CLOCK_EVT_FEAT_ONESHOT;
- clockevent->rating = 300;
- clockevent->set_next_event = ccount_timer_set_next_event;
- clockevent->set_state_shutdown = ccount_timer_shutdown;
- clockevent->set_state_oneshot = ccount_timer_set_oneshot;
- clockevent->tick_resume = ccount_timer_set_oneshot;
+ clockevent->name = timer->name;
clockevent->cpumask = cpumask_of(cpu);
clockevent->irq = irq_create_mapping(NULL, LINUX_TIMER_INT);
if (WARN(!clockevent->irq, "error: can't map timer irq"))
@@ -190,23 +204,6 @@ void __init time_init(void)
timer_probe();
}
-/*
- * The timer interrupt is called HZ times per second.
- */
-
-irqreturn_t timer_interrupt(int irq, void *dev_id)
-{
- struct clock_event_device *evt = &this_cpu_ptr(&ccount_timer)->evt;
-
- set_linux_timer(get_linux_timer());
- evt->event_handler(evt);
-
- /* Allow platform to do something useful (Wdog). */
- platform_heartbeat();
-
- return IRQ_HANDLED;
-}
-
#ifndef CONFIG_GENERIC_CALIBRATE_DELAY
void calibrate_delay(void)
{
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index e6fa55aa1ccb..454d53096bc9 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -420,16 +420,15 @@ void __init trap_init(void)
/* Setup specific handlers. */
for(i = 0; dispatch_init_table[i].cause >= 0; i++) {
-
int fast = dispatch_init_table[i].fast;
int cause = dispatch_init_table[i].cause;
void *handler = dispatch_init_table[i].handler;
if (fast == 0)
set_handler(default_handler, cause, handler);
- if (fast && fast & USER)
+ if ((fast & USER) != 0)
set_handler(fast_user_handler, cause, handler);
- if (fast && fast & KRNL)
+ if ((fast & KRNL) != 0)
set_handler(fast_kernel_handler, cause, handler);
}