xtensa: allow multi-inclusion for uapi/unistd.h

Xtensa implements a method that allows to generate a arbitrary output
for each system call by defining the __SYSCALL(number, function, num_args).
This usually requires to include uapi/unistd.h twice. Instead of removing
the guard agains multiple inclusion entirely, allow to include unistd.h again
only if __SYSCALL is defined. Note that __SYSCALL gets always undefined at
the end of the file.

Signed-off-by: Chris Zankel <chris@zankel.net>
xtensa: use physical addresses for bus addresses

Define virt_to_bus and bus_to_virt as virt_to_phys, and phys_to_virt,
       respectively.

Signed-off-by: Chris Zankel <chris@zankel.net>
xtensa: reset windowbase/windowstart when cloning the VM

When we copy a user thread with CLONE_VM, we also have to reset
windowbase and windowstart to start a pristine stack frame. Otherwise,
overflows can happen using the address 0 as the stack pointer.
Also add a special case for vfork, which continues on the
parent stack until it calls execve. Because this could be a call8, we
need to spill the stack pointer of the previus frame (if still 'live' in
the register file).

Signed-off-by: Chris Zankel <chris@zankel.net>
xtensa: switch to generic kernel_thread()

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: switch to generic kernel_execve()

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: switch to generic sys_execve()

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: properly fix missing compiler barrier in simcall

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: ISS: add BASE_BAUD definition to serial.h

This fixes the following build error in allyesconfig:

drivers/tty/serial/8250/8250_early.c: In function 'parse_options':
drivers/tty/serial/8250/8250_early.c:160:18: error: 'BASE_BAUD' undeclared (first use in this function)

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: provide DMA_ERROR_CODE definition

This fixes the following allmodconfig build error:

drivers/uio/uio_dmem_genirq.c:95:18: error: 'DMA_ERROR_CODE' undeclared (first use in this function)
drivers/uio/uio_dmem_genirq.c:238:18: error: 'DMA_ERROR_CODE' undeclared (first use in this function)
make[3]: *** [drivers/uio/uio_dmem_genirq.o] Error 1

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: Add config files for Diamond 233L - Rev C processor variant

The Diamond 233L processor is a pre-configured Xtensa processor tailored
for Linux application.

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

Signed-off-by: Pete Delaney <piet@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa WIP: add support for the LX60 board

The Avnet LX60 board is an FPGA board that can be configured with
an Xtensa processor and an OpenCores Ethernet device.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: add U-Boot image support (uImage).

Signed-off-by: Ross Morley <ross@linux-xtensa.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Ported-from: 47e4a5dfe8f33339cb6aec3efd198c0f8aebf96b
xtensa: add IRQ_DOMAIN

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

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

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: lx60: fix serial for OF builds

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: dispatch medium-priority interrupts

Add rudimentary support for dispatching medium-priority interrupts,
that is, interrupts of priority levels 2 to EXCM_LEVEL.
This change does not introduce interrupt nesting:  all interrupts are
kept locked (up to level EXCM_LEVEL) during interrupt handling.
This of course is expected to change at some point in the future.

Signed-off-by: Marc Gauthier <marc@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: fix ccount_read prototype

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