xtensa: check thread flags atomically on return from user exception

Check pending signals and rescheduling thread flags with interrupts
disabled, and don't enable them if no flags are set. Call
trace_hardirqs_on after thread flags handling, so that rescheduling is
done and hardirqs tracking flag is updated in the correct task context.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: enable kernel preemption

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: keep a3 and excsave1 on entry to exception handlers

Based on the SMP patch by Joe Taylor and subsequent fixes.
Preserve exception table pointer (normally stored in excsave1 SR) as it
cannot be easily restored in SMP environment.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: new fast_alloca handler

Instead of emulating movsp instruction in the kernel use window
underflow handler to load missing register window and retry failed
movsp.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: don't use echo -e needlessly

-e is not needed to output strings without escape sequences. This breaks
big endian FSF build when the shell is dash, because its builtin echo
doesn't understand '-e' switch and outputs it in the echoed string.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: fix !CONFIG_XTENSA_CALIBRATE_CCOUNT build failure

Commits 925f5532 (xtensa: ccount based clockevent implementation) and e3f43291
(xtensa: ccount based sched_clock) introduced users of ccount_freq. This
variable doesn't exist when CONFIG_XTENSA_CALIBRATE_CCOUNT is disabled. Add
ccount_freq definition in this case.

Reported-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
xtensa: remove CCOUNT_PER_JIFFY

Use ccount_freq directly to make the code a little more readable.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
WIP: fix for sched_clock

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP: xtensa: add Three Core HiFi-2 MX Variant.

Signed-off-by: Pete Delaney <piet@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP: xtensa: add shabu core

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP: xtensa: SMP clockevent

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: extract PIC into drivers/irqchip

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: add MX irqchip

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP: xtensa: add SMP support

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP: xtensa: SMP update for TLB sanity checker

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP: xtensa: implement CPU hotplug

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
WIP: xtensa: SMP debug on real LX200

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>