History log of /linux-master/arch/xtensa/kernel/setup.c
Revision Date Author Comments
# fd90410e 09-Oct-2023 Arnd Bergmann <arnd@arndb.de>

vgacon, arch/*: remove unused screen_info definitions

A number of architectures either kept the screen_info definition for
historical purposes as it used to be required by the generic VT code, or
they copied it from another architecture in order to build the VGA console
driver in an allmodconfig build. The mips definition is used by some
platforms, but the initialization on jazz is not needed.

Now that vgacon no longer builds on these architectures, remove the
stale definitions and initializations.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Dinh Nguyen <dinguyen@kernel.org>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Guo Ren <guoren@kernel.org>
Acked-by: Helge Deller <deller@gmx.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20231009211845.3136536-5-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 03ce34cf 31-Jan-2020 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add XIP-aware MTD support

Add Kconfig symbol, asm/mtd-xip.h header and define related macros:
xip_cpu_idle, xip_irqpending, xip_currtime and xip_elapsed_since.
Append .xiptext to the vectors when separate vectors are configured
because otherwise they are appended to the data and data may not even be
executable in XIP configuration.

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


# f29cf776 13-Jun-2023 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add load/store exception handler

Memory attached to instruction bus of the xtensa CPU is only accessible
for a limited subset of opcodes. Other opcodes generate an exception
with the load/store error cause code. This property complicates use of
such systems. Provide a handler that recognizes and transparently fixes
such exceptions. The following opcodes are recognized when used outside
of FLIX bundles: l32i, l32i.n, l16ui, l16si, l8ui.

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


# 67e88622 13-Jun-2023 Max Filippov <jcmvbkbc@gmail.com>

xtensa: move early_trap_init from kasan_early_init to init_arch

There may be other users for the early traps besides KASAN. Move call to
the early_trap_init from kasan_early_init. Protect init_exc_table
initializer with ifdef to make sure it builds on noMMU configurations.

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


# e6807b44 21-May-2023 Max Filippov <jcmvbkbc@gmail.com>

xtensa: report trax and perf counters in cpuinfo

Add 'trax' to the list of CPU features when xtensa core is configured
with TRAX.
Add 'perf' to the list of CPU features when xtensa core is configured
with perf counters and show the number of configured perf counters.

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


# 7561dfbf 07-Jun-2023 Max Filippov <jcmvbkbc@gmail.com>

xtensa: drop platform_halt and platform_power_off

Instead of using xtensa-specific platform_halt and platform_power_off
callbacks use do_kernel_power_off in the machine_halt and
machine_power_off and reimplement existing platform_halt and
platform_power_off users with register_sys_off_handler.

Drop platform_halt and platform_power_off declarations and default
implementations.

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


# 11976fe2 06-Jun-2023 Max Filippov <jcmvbkbc@gmail.com>

xtensa: drop platform_restart

Instead of using xtensa-specific platform_restart callback use
do_kernel_restart in the machine_restart implementation and reimplement
existing platform_restart users with register_restart_handler.
Drop platform_restart declaration and default implementation.

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


# 89b184f9 28-Dec-2021 Max Filippov <jcmvbkbc@gmail.com>

xtensa: make secondary reset vector support conditional

Whether xtensa cores start from primary or secondary reset vector is
configurable and may be chosen by board designer or controlled at
runtime. When secondary reset vector is unused its location in memory
may not be writable.
Make secondary reset vector support conditional and don't build and load
secondary reset vector code when it is disabled.

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


# 9ddef266 20-Dec-2021 Jason Wang <wangborong@cdjrlc.com>

xtensa: use strscpy to copy strings

The strlcpy should not be used because it doesn't limit the source
length. So that it will lead some potential bugs.

But the strscpy doesn't require reading memory from the src string
beyond the specified "count" bytes, and since the return value is
easier to error-check than strlcpy()'s. In addition, the implementation
is robust to the string changing out from underneath it, unlike the
current strlcpy() implementation.

Thus, replace strlcpy with strscpy.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Message-Id: <20211220084756.955307-1-wangborong@cdjrlc.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# bd47cdb7 29-Aug-2021 Max Filippov <jcmvbkbc@gmail.com>

xtensa: move section symbols to asm/sections.h

Introduce asm/sections.h and move section declarations to this header
from setup.c. Assign section symbols char array type uniformly and drop
address operator from section symbol references in code.
Sort headers in setup.c while at it.

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


# da0a4e5c 26-Jul-2021 Max Filippov <jcmvbkbc@gmail.com>

xtensa: only build windowed register support code when needed

There's no need in window overflow/underflow/alloca exception handlers
or window spill code when neither kernel nor userspace support windowed
registers. Don't build or link it.

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


# d67ed251 24-Sep-2021 Randy Dunlap <rdunlap@infradead.org>

xtensa: use CONFIG_USE_OF instead of CONFIG_OF

CONFIG_OF can be set by a randconfig or by a user -- without setting the
early flattree option (OF_EARLY_FLATTREE). This causes build errors.
However, if randconfig or a user sets USE_OF in the Xtensa config,
the right kconfig symbols are set to fix the build.

Fixes these build errors:

../arch/xtensa/kernel/setup.c:67:19: error: ‘__dtb_start’ undeclared here (not in a function); did you mean ‘dtb_start’?
67 | void *dtb_start = __dtb_start;
| ^~~~~~~~~~~
../arch/xtensa/kernel/setup.c: In function 'xtensa_dt_io_area':
../arch/xtensa/kernel/setup.c:201:14: error: implicit declaration of function 'of_flat_dt_is_compatible'; did you mean 'of_machine_is_compatible'? [-Werror=implicit-function-declaration]
201 | if (!of_flat_dt_is_compatible(node, "simple-bus"))
../arch/xtensa/kernel/setup.c:204:18: error: implicit declaration of function 'of_get_flat_dt_prop' [-Werror=implicit-function-declaration]
204 | ranges = of_get_flat_dt_prop(node, "ranges", &len);
../arch/xtensa/kernel/setup.c:204:16: error: assignment to 'const __be32 *' {aka 'const unsigned int *'} from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
204 | ranges = of_get_flat_dt_prop(node, "ranges", &len);
| ^
../arch/xtensa/kernel/setup.c: In function 'early_init_devtree':
../arch/xtensa/kernel/setup.c:228:9: error: implicit declaration of function 'early_init_dt_scan'; did you mean 'early_init_devtree'? [-Werror=implicit-function-declaration]
228 | early_init_dt_scan(params);
../arch/xtensa/kernel/setup.c:229:9: error: implicit declaration of function 'of_scan_flat_dt' [-Werror=implicit-function-declaration]
229 | of_scan_flat_dt(xtensa_dt_io_area, NULL);

xtensa-elf-ld: arch/xtensa/mm/mmu.o:(.text+0x0): undefined reference to `xtensa_kio_paddr'

Fixes: da844a81779e ("xtensa: add device trees support")
Fixes: 6cb971114f63 ("xtensa: remap io area defined in device tree")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# 33def849 21-Oct-2020 Joe Perches <joe@perches.com>

treewide: Convert macro and uses of __section(foo) to __section("foo")

Use a more generic form for __section that requires quotes to avoid
complications with clang and gcc differences.

Remove the quote operator # from compiler_attributes.h __section macro.

Convert all unquoted __section(foo) uses to quoted __section("foo").
Also convert __attribute__((section("foo"))) uses to __section("foo")
even if the __attribute__ has multiple list entry forms.

Conversion done using the script at:

https://lore.kernel.org/lkml/75393e5ddc272dc7403de74d645e6c6e0f4e70eb.camel@perches.com/2-convert_section.pl

Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@gooogle.com>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 0d5ab144 02-Jul-2020 Max Filippov <jcmvbkbc@gmail.com>

xtensa: update *pos in cpuinfo_op.next

Increment *pos in the cpuinfo_op.next to fix the following warning
triggered by cat /proc/cpuinfo:

seq_file: buggy .next function c_next did not update position index

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


# e31cf2f4 08-Jun-2020 Mike Rapoport <rppt@kernel.org>

mm: don't include asm/pgtable.h if linux/mm.h is already included

Patch series "mm: consolidate definitions of page table accessors", v2.

The low level page table accessors (pXY_index(), pXY_offset()) are
duplicated across all architectures and sometimes more than once. For
instance, we have 31 definition of pgd_offset() for 25 supported
architectures.

Most of these definitions are actually identical and typically it boils
down to, e.g.

static inline unsigned long pmd_index(unsigned long address)
{
return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
}

static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
{
return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
}

These definitions can be shared among 90% of the arches provided
XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.

For architectures that really need a custom version there is always
possibility to override the generic version with the usual ifdefs magic.

These patches introduce include/linux/pgtable.h that replaces
include/asm-generic/pgtable.h and add the definitions of the page table
accessors to the new header.

This patch (of 12):

The linux/mm.h header includes <asm/pgtable.h> to allow inlining of the
functions involving page table manipulations, e.g. pte_alloc() and
pmd_alloc(). So, there is no point to explicitly include <asm/pgtable.h>
in the files that include <linux/mm.h>.

The include statements in such cases are remove with a simple loop:

for f in $(git grep -l "include <linux/mm.h>") ; do
sed -i -e '/include <asm\/pgtable.h>/ d' $f
done

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Cain <bcain@codeaurora.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Greg Ungerer <gerg@linux-m68k.org>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Guo Ren <guoren@kernel.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nick Hu <nickhu@andestech.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rich Felker <dalias@libc.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 5e4417f9 31-Jan-2020 Max Filippov <jcmvbkbc@gmail.com>

xtensa: reorganize vectors placement

Allow vectors to be either merged into the kernel .text or put at a
fixed virtual address independently of XIP option. Drop option that
puts vectors at a fixed offset from the kernel text. Add choice to
Kconfig.
Vectors at fixed virtual address may be useful for XIP-aware MTD support
and for noMMU configurations with available IRAM. Configurations without
VECBASE register must put their vectors at specific locations regardless
of the selected option. All other configurations should happily use
merged vectors.

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


# 50722f0b 31-Jan-2020 Max Filippov <jcmvbkbc@gmail.com>

xtensa: move fast exception handlers close to vectors

On XIP kernels it makes sense to have exception vectors and fast
exception handlers together (in a fast memory). In addition, with MTD
XIP support both vectors and fast exception handlers must be outside of
the FLASH.

Add section .exception.text and move fast exception handlers to it.
Put it together with vectors when vectors are outside of the .text.

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


# fec63889 18-Dec-2019 Arvind Sankar <nivedita@alum.mit.edu>

arch/xtensa/setup: Drop dummy_con initialization

con_init in tty/vt.c will now set conswitchp to dummy_con if it's unset.
Drop it from arch setup code.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20191218214506.49252-25-nivedita@alum.mit.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7af710d9 03-Jan-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add XIP kernel support

XIP (eXecute In Place) kernel image is the image that can be run
directly from ROM, using RAM only for writable data.

XIP xtensa kernel differs from regular xtensa kernel in the following
ways:
- it has exception/IRQ vectors merged into text section. No vectors
relocation takes place at kernel startup.
- .data/.bss location must be specified in the kernel configuration,
its content is copied there in the _startup function.
- .init.text is merged with the rest of text and is executed from ROM.
- when MMU is used the virtual address where the kernel will be mapped
must be specified in the kernel configuration. It may be in the KSEG
or in the KIO, __pa macro is adjusted to be able to handle both.

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


# f348f5c2 24-Jul-2019 Mike Rapoport <rppt@kernel.org>

xtensa: remove free_initrd_mem

The xtensa free_initrd_mem() verifies that initrd is mapped and then
frees its memory using free_reserved_area().

The initrd is considered mapped when its memory was successfully reserved
with mem_reserve().

Resetting initrd_start to 0 in case of mem_reserve() failure allows to
switch to generic free_initrd_mem() implementation.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Message-Id: <1563977432-8376-1-git-send-email-rppt@linux.ibm.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# cd8869f4 12-Aug-2019 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add missing isync to the cpu_reset TLB code

ITLB entry modifications must be followed by the isync instruction
before the new entries are possibly used. cpu_reset lacks one isync
between ITLB way 6 initialization and jump to the identity mapping.
Add missing isync to xtensa cpu_reset.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# 88804e68 15-Oct-2018 Max Filippov <jcmvbkbc@gmail.com>

xtensa: drop dead PCI support code

xtensa-specific PCI initialization code has significantly bitrotted over
time because there's no platform that use it. Get rid of remaining
non-functioning initialization and remove platform_pcibios_* interface.
A new platform that would use PCI on xtensa will configure PCI
controller using device tree.

Drop variables pci_ctrl_head, pci_bus_count and functions pcibios_init,
pci_controller_apertures, platform_pcibios_init and
platform_pcibios_fixup.

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


# adefd051 30-May-2019 Guenter Roeck <linux@roeck-us.net>

xtensa: Fix section mismatch between memblock_reserve and mem_reserve

Since commit 9012d011660ea5cf2 ("compiler: allow all arches to enable
CONFIG_OPTIMIZE_INLINING"), xtensa:tinyconfig fails to build with section
mismatch errors.

WARNING: vmlinux.o(.text.unlikely+0x68): Section mismatch in reference
from the function ___pa()
to the function .meminit.text:memblock_reserve()
WARNING: vmlinux.o(.text.unlikely+0x74): Section mismatch in reference
from the function mem_reserve()
to the function .meminit.text:memblock_reserve()
FATAL: modpost: Section mismatches detected.

This was not seen prior to the above mentioned commit because mem_reserve()
was always inlined.

Mark mem_reserve(() as __init_memblock to have it reside in the same
section as memblock_reserve().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-Id: <1559220098-9955-1-git-send-email-linux@roeck-us.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# f7c34874 20-Dec-2018 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add exclusive atomics support

Implement atomic primitives using exclusive access opcodes available in
the recent xtensa cores.
Since l32ex/s32ex don't have any memory ordering guarantees don't define
__smp_mb__before_atomic/__smp_mb__after_atomic to make them use memw.

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


# cad6fade 27-Nov-2018 Max Filippov <jcmvbkbc@gmail.com>

xtensa: clean up WSR*/RSR*/get_sr/set_sr

WSR and RSR are too generic and collide with other macro definitions in
the kernel causing warnings in allmodconfig builds. Drop WSR and RSR
macros and WSR_* and RSR_* variants. Change get_sr and set_sr to
xtensa_get_sr and xtensa_set_sr. Fix up users.

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


# baac1d36 13-Aug-2018 Max Filippov <jcmvbkbc@gmail.com>

xtensa: make bootparam parsing optional

A kernel may not need any boot parameters from the bootloader, allow
disabling bootparam parsing in that case.

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


# fc862ee9 13-Aug-2018 Max Filippov <jcmvbkbc@gmail.com>

xtensa: drop unneeded platform/hardware.h headers

platform/hardware.h no longer supply any information for processor.h,
vectors.h, setup.c or vmlinux.lds.S, don't include it.
This header is now empty in the platforms/iss, so remove it altogether.

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


# 3a6fbcb2 05-Jan-2018 Rob Herring <robh@kernel.org>

xtensa: remove arch specific early DT functions

Now that the DT core code handles bootmem arches, we can remove the xtensa
specific early_init_dt_alloc_memory_arch function. The common
early_init_dt_add_memory_arch can be used too now that xtensa switched to
memblock.

Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa@linux-xtensa.org
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# c633544a 03-Dec-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add support for KASAN

Cover kernel addresses above 0x90000000 by the shadow map. Enable
HAVE_ARCH_KASAN when MMU is enabled. Provide kasan_early_init that fills
shadow map with writable copies of kasan_zero_page. Call
kasan_early_init right after mmu initialization in the setup_arch.
Provide kasan_init that allocates proper shadow map pages from the
memblock and puts these pages into the shadow map for addresses from
VMALLOC area to the end of KSEG. Call kasan_init right after memblock
initialization. Don't use KASAN for the boot code, MMU and KASAN
initialization and page fault handler. Make kernel stack size 4 times
larger when KASAN is enabled to avoid stack overflows.
GCC 7.3, 8 or newer is required to build the xtensa kernel with KASAN.

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


# c2edb35a 15-Dec-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: extract init_kio

KIO region placement may be specified in the device tree, that's why
it's initialized with the rest of MMU after the early_init_devtree. In
order to support KASAN the MMU must be initialized earlier.
Separate KIO initialization from the rest of MMU initialization.
Reinitialize KIO if its location is specified in the device tree.

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


# c130d3be 15-Dec-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: clean up custom-controlled debug output

Replace #ifdef'fed/commented out debug printk statements with pr_debug.
Replace printk statements with pr_* equivalents.

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


# aa6476f7 08-Aug-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: print hardware config ID on startup

Print hardware config ID on startup and config ID recorded in the
configuration if it doesn't match one read from the hardware.

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


# f8f02ca7 03-Dec-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: build kernel with text-section-literals

vmlinux.lds.S doesn't do anything special with literals, so instead of
keeping them separate put them into the corresponding text sections.
Drop explicit .literal sections from the vmlinux.lds.S, use standard
section macros. Mark literal pool locations in the assembly sources.
Unfortunately assembler doesn't put literals into .init sections and
external libgcc may still have .literal sections, so sed transformation
to the linker script is still needed.

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


# 18244362 02-Aug-2017 Masami Hiramatsu <mhiramat@kernel.org>

xtensa: Mark _stext and _end as char-arrays, not single char variables

Mark _stext and _end as character arrays instead of single
character variables, like include/asm-generic/sections.h does.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: David S . Miller <davem@davemloft.net>
Cc: Francis Deslauriers <francis.deslauriers@efficios.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: linux-arch@vger.kernel.org
Cc: linux-cris-kernel@axis.com
Cc: mathieu.desnoyers@efficios.com
Link: http://lkml.kernel.org/r/150172775958.27216.12951305461398200544.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>


# c32537d4 07-May-2017 Markus Elfring <elfring@users.sourceforge.net>

xtensa: Use seq_puts() in c_show()

A string which did not contain a data format specification should be put
into a sequence. Thus use the corresponding function "seq_puts".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# 60e22cff 29-Mar-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: use ITLB_HIT_BIT instead of hardcoded number

There is ITLB_HIT_BIT macro, no need to use 0x8 to check for TLB hit.

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


# fbe22d28 13-Mar-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: ISS: update kernel command line in platform_setup

Move platform_setup call higher in initialization sequence so that it
could change kernel command line.
Check command line passed to simulator in ISS platform_stup and update
kernel command line if there's anything.

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


# b46dcfa3 04-Jan-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: allow merging vectors into .text section

Currently code for exception/IRQ vectors is stored in kernel image as
initialization data and is copied to its working addresses during
startup. It doesn't always make sense. In many cases vectors location
can be automatically decided at kernel link time and code can be placed
right there. This is especially useful for XIP kernel.

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


# 4ab18701 03-Jan-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: move parse_tag_fdt out of #ifdef CONFIG_BLK_DEV_INITRD

FDT tag parsing is not related to whether BLK_DEV_INITRD is configured
or not, move it out of the corresponding #ifdef/#endif block.
This fixes passing external FDT to the kernel configured w/o
BLK_DEV_INITRD support.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# 4b3e6f2e 31-Jan-2017 Max Filippov <jcmvbkbc@gmail.com>

xtensa: fix noMMU build on cores with MMU

Commit bf15f86b343ed8 ("xtensa: initialize MMU before jumping to reset
vector") calls MMU management functions even when CONFIG_MMU is not
selected. That breaks noMMU build on cores with MMU.

Don't manage MMU when CONFIG_MMU is not selected.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# 3863c58c 16-Nov-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: move S32C1I self-test to a separate file

The test is not called from any of the setup functions, so there's no
reason keeping it in the setup.c. Move it to s32c1i_selftest.c and drop
related #include directives.

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


# 03eae3ac 15-Nov-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: fix screen_info, clean up unused declarations in setup.c

screen_info on xtensa has old style initializer without field names.
It was broken by the commit d9b263528e01 ("x86, setup: Store the boot
cursor state") that split the unused2 field into two.

Rewrite screen_info initialization with explicit field names.

Drop unused declarations/tentative definitions of RTC- and FD-related
structures. Drop inclusion of linux/timex.h when RTC is enabled in
configuration.

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


# 205ad548 20-Sep-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: rearrange CCOUNT calibration

DT-enabled kernel should have a CPU node connected to a clock. This clock
is the CCOUNT clock. Use old platform_calibrate_ccount call as a fallback
when CPU node cannot be found or has no clock and in non-DT-enabled
configurations.

Drop no longer needed code that updates CPU clock-frequency property in
the DT; drop DT-related code from the platform_calibrate_ccount too.

Move of_clk_init to the top of time_init, so that clocks are initialized
before CCOUNT calibration is attempted.

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


# bf15f86b 11-Sep-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: initialize MMU before jumping to reset vector

When reset is simulated MMU need to be brought into its initial state,
because that's what bootloaders/OS kernels assume. This is especially
important for MMUv3 because TLB state when the kernel is running is
significatly different from its reset state.

With this change it is possible to boot linux and get back to U-Boot
repeatedly.

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


# ea951c34 11-Sep-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: fix icountlevel setting in cpu_reset

icountlevel SR value specifies lowest intlevel that does not do
instruction counting, so to disable instruction counting completely it
must be set to 0, not to 15.

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


# 4f205687 07-Sep-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: extract common CPU reset code into separate function

platform_restart implementatations do the same thing to reset CPU.
Don't duplicate that code, move it to a function and call it from
platform_restart.

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


# e973f4ec 26-Jul-2016 Rob Herring <robh@kernel.org>

xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table"

This partially reverts commit 69d99e6c0d62 keeping only the main
purpose of the original commit which is the removal of
of_platform_populate() call. The moving of of_clk_init() caused changes
in the initialization order breaking booting.

Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table")
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Tested-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# d02014b2 23-Jul-2016 Guenter Roeck <linux@roeck-us.net>

xtensa: Fix build error due to missing include file

Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate
with default match table") dropped various include files from
arch/xtensa/kernel/setup.c. This results in the following build error.

arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’:
arch/xtensa/kernel/setup.c:213:2: error:
implicit declaration of function ‘of_read_ulong’

Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table")
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# 0e46c111 25-Apr-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: drop sysmem and switch to memblock

Memblock is the standard kernel boot-time memory tracker/allocator. Use
it instead of the custom sysmem allocator. This allows using kmemleak,
CMA and device tree memory reservation.

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


# 3de00482 22-Jul-2016 Max Filippov <jcmvbkbc@gmail.com>

xtensa: minimize use of PLATFORM_DEFAULT_MEM_{ADDR,SIZE}

Now that the kernel load address and KSEG physical base address have
their own Kconfig symbols PLATFORM_DEFAULT_MEM seems redundant. It makes
little sense to use it in MMU configurations instead of KSEG_PADDR.
In noMMU configurations there's no explicit KSEG, so it's still useful
for the early cache initialization and definition of ARCH_PFN_OFFSET,
which affects mem_map size.

- limit it to noMMU; MMU variants have XCHAL_KSEG_PADDR and
XCHAL_KSEG_SIZE;
- don't use it to define TASK_SIZE or MAX_LOW_PFN: first doesn't make
any difference in noMMU, second is meaningless as there's no high
memory;
- don't add default physical memory region: memory layout should come
from the DT, bootloader tags, or memmap= command line parameter.

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


# 69d99e6c 01-Jun-2016 Kefeng Wang <wangkefeng.wang@huawei.com>

xtensa: Remove unnecessary of_platform_populate with default match table

After patch "of/platform: Add common method to populate default bus",
it is possible for arch code to remove unnecessary callers of
of_platform_populate with default match table.

Move of_clk_init() into time_init(), then drop xtensa_device_probe() fully.

Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# ab45fb14 16-Oct-2015 Max Filippov <jcmvbkbc@gmail.com>

xtensa: fix secondary core boot in SMP

There are multiple factors adding to the issue in different
configurations:

- commit 17290231df16eeee ("xtensa: add fixup for double exception raised
in window overflow") added function window_overflow_restore_a0_fixup to
double exception vector overlapping reset vector location of secondary
processor cores.
- on MMUv2 cores RESET_VECTOR1_VADDR may point to uncached kernel memory
making code overlapping depend on cache type and size, so that without
cache or with WT cache reset vector code overwrites double exception
code, making issue even harder to detect.
- on MMUv3 cores RESET_VECTOR1_VADDR may point to unmapped area, as
MMUv3 cores change virtual address map to match MMUv2 layout, but
reset vector virtual address is given for the original MMUv3 mapping.
- physical memory region of the secondary reset vector is not reserved
in the physical memory map, and thus may be allocated and overwritten
at arbitrary moment.

Fix it as follows:

- move window_overflow_restore_a0_fixup code to .text section.
- define RESET_VECTOR1_VADDR so that it points to reset vector in the
cacheable MMUv2 map for cores with MMU.
- reserve reset vector region in the physical memory map. Drop separate
literal section and build mxhead.S with text section literals.

Cc: <stable@vger.kernel.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# 260c64bb 24-Sep-2015 Max Filippov <jcmvbkbc@gmail.com>

xtensa: nommu: provide correct KIO addresses

KIO region location is different for noMMU cores. Provide different
default physical address and make KIO virtual address equal to physical.

Move xtensa_get_kio_paddr function close to XCHAL_KIO_PADDR definition
and define it not only for MMUv3, but for all MMU options except MMUv2.

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


# 62518994 13-Feb-2015 Tejun Heo <tj@kernel.org>

xtensa: use %*pb[l] to print bitmaps including cpumasks and nodemasks

printk and friends can now format bitmaps using '%*pb[l]'. cpumask
and nodemask also provide cpumask_pr_args() and nodemask_pr_args()
respectively which can be used to generate the two printf arguments
necessary to format the specified cpu/nodemask.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 9d0c4dfe 01-Apr-2014 Rob Herring <robh@kernel.org>

of/fdt: update of_get_flat_dt_prop in prep for libfdt

Make of_get_flat_dt_prop arguments compatible with libfdt fdt_getprop
call in preparation to convert FDT code to use libfdt. Make the return
value const and the property length ptr type an int.

Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>


# ccf3356e 03-Apr-2014 Rob Herring <robh@kernel.org>

of/fdt: consolidate built-in dtb section variables

Unify the various architectures __dtb_start and __dtb_end definitions
moving them into of_fdt.h.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-metag@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux@lists.openrisc.net
Cc: linux-xtensa@linux-xtensa.org
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>


# 06bd2824 21-Mar-2014 Max Filippov <jcmvbkbc@gmail.com>

xtensa: handle memmap kernel option

This option is useful for reserving memory regions for secondary cores
in AMP configurations.

Implement the following memmap variants:
- memmap=nn[KMG]@ss[KMG]: force usage of a specific region of memory;
- memmap=nn[KMG]$ss[KMG]: mark specified memory as reserved;
- memmap=nn[KMG]: set end of memory.

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


# 62327918 22-Mar-2014 Max Filippov <jcmvbkbc@gmail.com>

xtensa: keep sysmem banks ordered in mem_reserve

Rewrite mem_reserve so that it keeps bank order.
Also make its return code more traditional.

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


# 9ba067f9 22-Mar-2014 Max Filippov <jcmvbkbc@gmail.com>

xtensa: split bootparam and kernel meminfo

Bootparam meminfo is a bootloader ABI, kernel meminfo is for the kernel
bookkeeping, keep them separate. Kernel doesn't care of memory region
types, so drop the type field and don't pass it to add_sysmem_bank.
Move kernel sysmem structures and prototypes to asm/sysmem.h and sysmem
variable and add_sysmem_bank to mm/init.c

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


# bda8932d 28-Jan-2014 Max Filippov <jcmvbkbc@gmail.com>

xtensa: support common clock framework

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


# 6cb97111 29-Dec-2013 Baruch Siach <baruch@tkos.co.il>

xtensa: remap io area defined in device tree

Use the simple-bus node to discover the io area, and remap the cached and
bypass io ranges. The parent-bus-address value of the first triplet in the
"ranges" property is used. This value is rounded down to the nearest 256MB
boundary. The length of the io area is fixed at 256MB; the "ranges" property
length value is ignored.

Other limitations: (1) only the first simple-bus node is considered, and (2)
only the first triplet of the "ranges" property is considered.

See ePAPR 1.1 §6.5 for the simple-bus node description, and §2.3.8 for the
"ranges" property description.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# f8935f30 23-Dec-2013 Baruch Siach <baruch@tkos.co.il>

xtensa: support default device tree buses

This currently includes simple-bus.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>


# 49b424fe 16-Oct-2013 Max Filippov <jcmvbkbc@gmail.com>

xtensa: implement CPU hotplug

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# f615136c 16-Oct-2013 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add SMP support

This is largely based on SMP code from the xtensa-2.6.29-smp tree by
Piet Delaney, Marc Gauthier, Joe Taylor, Christian Zankel (and possibly
other Tensilica folks).

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# c8f3a7dc 16-Oct-2013 Max Filippov <jcmvbkbc@gmail.com>

xtensa: move init_mmu declaration to mmu_context.h

Secondary CPUs need this declaration to initialize their MMUs.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 59970753 16-Oct-2013 Max Filippov <jcmvbkbc@gmail.com>

xtensa: call check_s32c1i after trap_init

Otherwise exceptions may occur prior to exception handling mechanism
initialization, resulting in silently dead system.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 29eb45a9 30-Aug-2013 Rob Herring <rob.herring@calxeda.com>

of: remove early_init_dt_setup_initrd_arch

All arches do essentially the same thing now for
early_init_dt_setup_initrd_arch, so it can now be removed.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Grant Likely <grant.likely@linaro.org>


# 7745fc1f 28-Aug-2013 Rob Herring <rob.herring@calxeda.com>

xtensa: use early_init_dt_scan

Convert xtensa to use new early_init_dt_scan function.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa@linux-xtensa.org


# 3104021c 26-Aug-2013 Rob Herring <rob.herring@calxeda.com>

xtensa: use unflatten_and_copy_device_tree

Use the common unflatten_and_copy_device_tree to copy the built-in FDT
out of init section.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Chris Zankel <chris@zankel.net>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
Acked-by: Grant Likely <grant.likely@linaro.org>


# 8d5e1d8e 14-Jul-2013 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>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 374d5c99 01-Jul-2013 Santosh Shilimkar <santosh.shilimkar@ti.com>

of: Specify initrd location using 64-bit

On some PAE architectures, the entire range of physical memory could reside
outside the 32-bit limit. These systems need the ability to specify the
initrd location using 64-bit numbers.

This patch globally modifies the early_init_dt_setup_initrd_arch() function to
use 64-bit numbers instead of the current unsigned long.

There has been quite a bit of debate about whether to use u64 or phys_addr_t.
It was concluded to stick to u64 to be consistent with rest of the device
tree code. As summarized by Geert, "The address to load the initrd is decided
by the bootloader/user and set at that point later in time. The dtb should not
be tied to the kernel you are booting"

More details on the discussion can be found here:
https://lkml.org/lkml/2013/6/20/690
https://lkml.org/lkml/2012/9/13/544

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 220f5354 21-Feb-2013 Vineet Gupta <Vineet.Gupta1@synopsys.com>

xtensa: Flat DeviceTree copy not future-safe

flat DT copy code calls bootmem allocator with @align = 0.
This is probably OK with legacy allocator which xtensa uses right now,
but this will panic right away with memblock allocator

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Marc Gauthier <marc@tensilica.com>
Cc: linux-xtensa@linux-xtensa.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# c5a771d0 08-Jun-2013 Max Filippov <jcmvbkbc@gmail.com>

xtensa: adjust boot parameters address when INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is selected

The virtual address of boot parameters chain is passed to the kernel via
a2 register. Adjust it in case it is remapped during MMUv3 -> MMUv2
mapping change, i.e. when it is in the first 128M.

Also fix interpretation of initrd and FDT addresses passed in the boot
parameters: these are physical addresses.

Cc: stable@vger.kernel.org
Reported-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 2d1c645c 04-Jan-2013 Marc Gauthier <marc@tensilica.com>

xtensa: dispatch medium-priority interrupts

Add support for dispatching medium-priority interrupts, that is,
interrupts of priority levels 2 to EXCM_LEVEL. IRQ handling may be
preempted by higher priority IRQ.

Signed-off-by: Marc Gauthier <marc@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# c4c4594b 28-Nov-2012 Chris Zankel <chris@zankel.net>

xtensa: clean up files to make them code-style compliant

Remove heading and trailing spaces, trim trailing lines, and wrap lines
that are longer than 80 characters.

Signed-off-by: Chris Zankel <chris@zankel.net>


# da844a81 03-Nov-2012 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add device trees support

Device trees allow specification of hardware topology and device
parameters at runtime instead of hard-coding them in platform setup
code. This allows running single binary kernel on a range of compatible
boards.

New boot parameters tag BP_TAG_FDT is allocated and a pointer to flat
device tree is passed in it.

Note that current interrupt mapping scheme uses single cell for
interrupt identification. That means that IRQ numbers used in DTS must
be CPU internal IRQ numbers, not external. It is possible to extend
interrupt identification to two cells, and use second cell to tell
external IRQ numbers form internal. That would allow to use single DTS
on multiple boards with different mapping of external IRQ numbers.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 00273125 28-Nov-2012 Max Filippov <jcmvbkbc@gmail.com>

xtensa: add s32c1i sanity check

Add a brief sanity test of S32C1I functionality. This instruction
is needed by the kernel and userland as part of the base ABI
(including GCC atomic builtins, certain threading packages, future
atomic support in the C++ standard, etc). However, correct operation
of this instruction requires some cooperation by hardware external to
the processor (such as bus bridge, bus fabric, or memory controller).
Minimally exercising this mechanism and reporting explicit status
early in the boot process is helpful to chip vendors using the Linux
kernel as a benchmark of correctness of hardware.

As it turns out, S32C1I is not exercised by the kernel and by uClibc
based userland as of early June 2008. This is expected to change
soon as both incorporate more recent open source developments.

Signed-off-by: Marc Gauthier <marc@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 2f6ea6a7 10-Nov-2012 Max Filippov <jcmvbkbc@gmail.com>

xtensa: display s32c1i feature flag in cpuinfo

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 415217ef 10-Nov-2012 Max Filippov <jcmvbkbc@gmail.com>

xtensa: fix CPU cache flags formatting

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# f4349b6e 14-Oct-2012 Max Filippov <jcmvbkbc@gmail.com>

xtensa: fix boot parameters parsing

Boot parameter tags with handlers are ignored like this:

[ 0.000000] Ignoring tag 0x00001003
[ 0.000000] Ignoring tag 0x00001001
[ 0.000000] Ignoring tag 0x00001004

because neither tagtable entries nor tag handlers appear in the vmlinux.

Fix tagtable definition attributes so that tag entries are not dropped.

Fix end of memory bank calculation in parse_tag_mem: it is intended to
round down to page size, but instead did something strange leading to
hang right after boot.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 9ad79b58 16-Sep-2012 Max Filippov <jcmvbkbc@gmail.com>

xtensa: drop CONFIG_EMBEDDED_RAMDISK

Remove Kconfig entries, boot subdirectory, dependencies from other
boot-* Makefiles, and sections from ld scripts.

Remove stale redboot code that used to pass initrd addresses in a3 and
a4 to _start.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# f9aa7e18 28-Mar-2012 David Howells <dhowells@redhat.com>

Disintegrate asm/system.h for Xtensa

Disintegrate asm/system.h for Xtensa.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Chris Zankel <chris@zankel.net>


# e5083a63 04-Mar-2009 Johannes Weiner <jw@emlix.com>

xtensa: nommu support

Add support for !CONFIG_MMU setups.

Signed-off-by: Johannes Weiner <jw@emlix.com>
Signed-off-by: Chris Zankel <chris@zankel.net>


# 5a891ed5 10-Mar-2009 Alexey Dobriyan <adobriyan@gmail.com>

xtensa: fix compilation somewhat

* ->put_char changes
* HIGHMEM is bogus it seems, there is no kmap_atomic() et al
* some includes

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Chris Zankel <zankel@tensilica.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 91ddc998 13-Oct-2008 Adrian Bunk <bunk@kernel.org>

xtensa: remove dead CONFIG_BLK_DEV_IDE code

I don't know why this was there, but it was dead code.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: chris@zankel.net
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>


# 27ac792c 23-Jul-2008 Andrea Righi <righi.andrea@gmail.com>

PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures

On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:

u64 val = PAGE_ALIGN(size);

always returns a value < 4GB even if size is greater than 4GB.

The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):

#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)

The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.

Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.

See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 78c5bbc1 07-Dec-2007 Adrian Bunk <bunk@kernel.org>

[XTENSA] Remove dead code reported by Robert P. J. Day.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Christian Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# 03a44825 08-Feb-2008 Jan Engelhardt <jengelh@computergmbh.de>

procfs: constify function pointer tables

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-By: David Howells <dhowells@redhat.com>
Acked-by: Bryan Wu <bryan.wu@analog.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# de4f6e5b 31-May-2007 Chris Zankel <chris@zankel.net>

[XTENSA] clean-up header files

The header files in the asm-xtensa directory are not clean and
'make headers_check' fails. This is a first patch to fix most of
the header files. It removes unnecessary include statements and
adds some that are required for building the kernel. The linker
script required some updates or the linking stage would fail.

Signed-off-by: Chris Zankel <chris@zankel.net>


# d3e9ccea 12-Feb-2007 Alon Bar-Lev <alon.barlev@gmail.com>

[PATCH] Dynamic kernel command-line: xtensa

1. Rename saved_command_line into boot_command_line.
2. Set command_line as __initdata.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 173d6681 10-Dec-2006 Chris Zankel <czankel@tensilica.com>

[PATCH] xtensa: remove extra header files

The Xtensa port contained many header files that were never needed. This
rather lengthy patch removes all those files. Unfortunately, there were
many dependencies that needed to be updated, so this patch touches quite a
few source files.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# f30c2269 03-Oct-2006 Uwe Zeisberger <Uwe_Zeisberger@digi.com>

fix file specification in comments

Many files include the filename at the beginning, serveral used a wrong one.

Signed-off-by: Uwe Zeisberger <Uwe_Zeisberger@digi.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>


# 894673ee 10-Jul-2006 Jon Smirl <jonsmir@gmail.com>

[PATCH] tty: Remove include of screen_info.h from tty.h

screen_info.h doesn't have anything to do with the tty layer and shouldn't be
included by tty.h. This patches removes the include and modifies all users to
directly include screen_info.h. struct screen_info is mainly used to
communicate with the console drivers in drivers/video/console. Note that this
patch touches every arch and I have no way of testing it. If there is a
mistake the worst thing that will happen is a compile error.

[akpm@osdl.org: fix arm build]
[akpm@osdl.org: fix alpha build]
Signed-off-by: Jon Smirl <jonsmir@gmail.com>
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 6ab3d562 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de>

Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>


# 288a60cf 22-Sep-2005 Chris Zankel <czankel@tensilica.com>

[PATCH] xtensa: remove io_remap_page_range and minor clean-ups

Remove io_remap_page_range() from all of Linux 2.6.x (as requested and
suggested by Randy Dunlap) and minor clean-ups.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 5a0015d6 23-Jun-2005 Chris Zankel <czankel@tensilica.com>

[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 3

The attached patches provides part 3 of an architecture implementation for the
Tensilica Xtensa CPU series.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>