xtensa: kernel/traps.c: include hardirq.h
PATCH 1/7 xtensa: kernel/traps.c: include hardirq.h
In reply to a message not in the archiveThe file refers to in_interrupt() so hardirq.h must be included.
--- arch/xtensa/kernel/traps.c | 1 + 1 file changed, 1 insertion(+)
arch/xtensa/kernel/traps.c +1 -0
@@ -25,6 +25,7 @@#include <linux/kernel.h> #include <linux/sched.h> +#include <linux/hardirq.h> #include <linux/init.h> #include <linux/module.h> #include <linux/stringify.h>
PATCH 2/7 xtensa: remove redefinition of XCHAL_MMU_ASID_BITS
In reply to a message not in the archiveThis constant is defined in all core headers. Remove the redundant definition which might error out if other includes lead to inclusion of <variant/core.h>.
--- arch/xtensa/include/asm/mmu_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/xtensa/include/asm/mmu_context.h +2 -2
@@ -16,13 +16,13 @@#include <linux/stringify.h> #include <linux/sched.h> +#include <variant/core.h> +#include <asm/pgtable.h> #include <asm/cacheflush.h> #include <asm/tlbflush.h> #include <asm-generic/mm_hooks.h> -#define XCHAL_MMU_ASID_BITS 8 -#if (XCHAL_HAVE_TLBS !=1 )# error "Linux must have an MMU!"#endif
PATCH 3/7 xtensa: beat Kconfig into shape
In reply to a message not in the archiveInstead of making support code depend on variants or platforms, the latter should select what they need explicitely.
Otherwise this starts looking weird when support code depends on !XTENSA_PLATFORM_FOO && !XTENSA_PLATFORM_BAR etc.
This also includes some minor fixlets like converting bool and default to def_bool and fixing indentation and whitespace errors.
--- arch/xtensa/Kconfig | 168 ++++++++++++++++++++++++---------------------------- 1 file changed, 79 insertions(+), 89 deletions(-)
arch/xtensa/Kconfig +79 -89
@@ -4,16 +4,13 @@ mainmenu "Linux/Xtensa Kernel Configuration" config FRAME_POINTER - bool - default n + def_bool n config ZONE_DMA - bool - default y + def_bool y config XTENSA - bool - default y + def_bool y select HAVE_IDE help Xtensa processors are 32-bit RISC machines designed by Tensilica
@@ -24,28 +21,22 @@ config XTENSA a home page at <http://xtensa.sourceforge.net/>. config RWSEM_XCHGADD_ALGORITHM - bool - default y + def_bool y config GENERIC_FIND_NEXT_BIT - bool - default y + def_bool y config GENERIC_HWEIGHT - bool - default y + def_bool y config GENERIC_HARDIRQS - bool - default y + def_bool y config ARCH_HAS_ILOG2_U32 - bool - default n + def_bool n config ARCH_HAS_ILOG2_U64 - bool - default n + def_bool n config NO_IOPORT def_bool y
@@ -57,6 +48,9 @@ config HZ source "init/Kconfig" source "kernel/Kconfig.freezer" +config MMU + def_bool n + menu "Processor type and features" choice
@@ -65,38 +59,36 @@ choice config XTENSA_VARIANT_FSF bool "fsf - default (not generic) configuration" + select MMU config XTENSA_VARIANT_DC232B bool "dc232b - Diamond 232L Standard Core Rev.B (LE)" + select MMU help - This variant refers to Tensilica's Diamond 232L Standard core Rev.B (LE). + This variant refers to Tensilica's Diamond 232L Standard core Rev.B (LE). endchoice -config MMU - bool - default y - config XTENSA_UNALIGNED_USER bool "Unaligned memory access in use space" - ---help--- - The Xtensa architecture currently does not handle unaligned - memory accesses in hardware but through an exception handler. - Per default, unaligned memory accesses are disabled in user space. + help + The Xtensa architecture currently does not handle unaligned + memory accesses in hardware but through an exception handler. + Per default, unaligned memory accesses are disabled in user space. - Say Y here to enable unaligned memory access in user space. + Say Y here to enable unaligned memory access in user space. config PREEMPT bool "Preemptible Kernel" - ---help--- - This option reduces the latency of the kernel when reacting to - real-time or interactive events by allowing a low priority process to - be preempted even if it is in kernel mode executing a system call. - Unfortunately the kernel code has some race conditions if both - CONFIG_SMP and CONFIG_PREEMPT are enabled, so this option is - currently disabled if you are building an SMP kernel. + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + Unfortunately the kernel code has some race conditions if both + CONFIG_SMP and CONFIG_PREEMPT are enabled, so this option is + currently disabled if you are building an SMP kernel. - Say Y here if you are building a kernel for a desktop, embedded - or real-time system. Say N if you are unsure. + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. config MATH_EMULATION bool "Math emulation"
@@ -108,6 +100,32 @@ config HIGHMEM endmenu +config XTENSA_CALIBRATE_CCOUNT + def_bool n + help + On some platforms (XT2000, for example), the CPU clock rate can + vary. The frequency can be determined, however, by measuring + against a well known, fixed frequency, such as an UART oscillator. + +config SERIAL_CONSOLE + def_bool n + +config XTENSA_ISS_NETWORK + def_bool n + +menu "Bus options" + +config PCI + bool "PCI support" + default y + help + Find out whether you have a PCI motherboard. PCI is the name of a + bus system, i.e. the way the CPU talks to the other stuff inside + your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or + VESA. If you have PCI, say Y, otherwise N. + +source "drivers/pci/Kconfig" + menu "Platform options" choice
@@ -116,11 +134,16 @@ choice config XTENSA_PLATFORM_ISS bool "ISS" + select XTENSA_CALIBRATE_CCOUNT + select SERIAL_CONSOLE + select XTENSA_ISS_NETWORK help ISS is an acronym for Tensilica's Instruction Set Simulator. config XTENSA_PLATFORM_XT2000 bool "XT2000" + select XTENSA_CALIBRATE_CCOUNT + select PCI help XT2000 is the name of Tensilica's feature-rich emulation platform. This hardware is capable of running a full Linux distribution.
@@ -128,21 +151,14 @@ config XTENSA_PLATFORM_XT2000 endchoice -config XTENSA_CALIBRATE_CCOUNT - bool "Auto calibration of the CPU clock rate" - ---help--- - On some platforms (XT2000, for example), the CPU clock rate can - vary. The frequency can be determined, however, by measuring - against a well known, fixed frequency, such as an UART oscillator. - config XTENSA_CPU_CLOCK int "CPU clock rate [MHz]" depends on !XTENSA_CALIBRATE_CCOUNT - default "16" + default 16 config GENERIC_CALIBRATE_DELAY bool "Auto calibration of the BogoMIPS value" - ---help--- + help The BogoMIPS value can easily be derived from the CPU frequency. config CMDLINE_BOOL
@@ -159,52 +175,27 @@ config CMDLINE time by entering them here. As a minimum, you should specify the memory size and the root device (e.g., mem=64M root=/dev/nfs). -config SERIAL_CONSOLE - bool - depends on XTENSA_PLATFORM_ISS - default y - -config XTENSA_ISS_NETWORK - bool - depends on XTENSA_PLATFORM_ISS - default y - source "mm/Kconfig" endmenu -menu "Bus options" - -config PCI - bool "PCI support" if !XTENSA_PLATFORM_ISS - depends on !XTENSA_PLATFORM_ISS - default y - help - Find out whether you have a PCI motherboard. PCI is the name of a - bus system, i.e. the way the CPU talks to the other stuff inside - your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or - VESA. If you have PCI, say Y, otherwise N. - -source "drivers/pci/Kconfig" - config HOTPLUG - bool "Support for hot-pluggable devices" - ---help--- - Say Y here if you want to plug devices into your computer while - the system is running, and be able to use them quickly. In many - cases, the devices can likewise be unplugged at any time too. - - One well known example of this is PCMCIA- or PC-cards, credit-card - size devices such as network cards, modems or hard drives which are - plugged into slots found on all modern laptop computers. Another - example, used on modern desktops as well as laptops, is USB. - - Enable HOTPLUG and build a modular kernel. Get agent software - (from <http://linux-hotplug.sourceforge.net/>) and install it. - Then your kernel will automatically call out to a user mode "policy - agent" (/sbin/hotplug) to load modules and set up software needed - to use devices as you hotplug them. + help + Say Y here if you want to plug devices into your computer while + the system is running, and be able to use them quickly. In many + cases, the devices can likewise be unplugged at any time too. + + One well known example of this is PCMCIA- or PC-cards, credit-card + size devices such as network cards, modems or hard drives which are + plugged into slots found on all modern laptop computers. Another + example, used on modern desktops as well as laptops, is USB. + + Enable HOTPLUG and build a modular kernel. Get agent software + (from <http://linux-hotplug.sourceforge.net/>) and install it. + Then your kernel will automatically call out to a user mode "policy + agent" (/sbin/hotplug) to load modules and set up software needed + to use devices as you hotplug them. source "drivers/pcmcia/Kconfig"
@@ -216,9 +207,8 @@ menu "Executable file formats" # only elf supported config KCORE_ELF - bool + def_bool y depends on PROC_FS - default y help If you enabled support for /proc file system then the file /proc/kcore will contain the kernel core image in ELF format. This
@@ -243,7 +233,7 @@ source "fs/Kconfig" menu "Xtensa initrd options" depends on BLK_DEV_INITRD - config EMBEDDED_RAMDISK +config EMBEDDED_RAMDISK bool "Embed root filesystem ramdisk into the kernel" config EMBEDDED_RAMDISK_IMAGE
PATCH 4/7 xtensa: use correct stack pointer for stack traces
In reply to a message not in the archiveRight now, the xtensa stacktrace code reads the _current_ kernel stack pointer if nothing is supplied. With debugging facilities like sysrq this means that the backtrace of the sysrq-handler is printed instead of a trace of the given task's stack.
When no stack pointer is specified in show_trace() and show_stack(), use the stack pointer that comes with the handed in task descriptor to make stack traces more useful.
--- arch/xtensa/kernel/traps.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
arch/xtensa/kernel/traps.c +6 -8
@@ -372,11 +372,10 @@ void show_trace(struct task_struct *taskunsigned long a0, a1, pc;unsigned long sp_start, sp_end; - a1 = (unsigned long )sp; - -if (a1 ==0 ) - __asm__ __volatile__ ("mov %0, a1\n" :"=a" (a1)); - +if (sp) + a1 = (unsigned long )sp; +else + a1 = task->thread.sp; sp_start = a1 & ~(THREAD_SIZE -1 ); sp_end = sp_start +THREAD_SIZE ;
@@ -418,9 +417,8 @@ void show_stack(struct task_struct *taskint i =0 ;unsigned long *stack; -if (sp ==0 ) - __asm__ __volatile__ ("mov %0, a1\n" :"=a" (sp)); - +if (!sp) + sp = (unsigned long *)task->thread.sp; stack = sp;printk ("\nStack: " );
PATCH 5/7 xtensa: fix init_bootmem_node() argument order
In reply to a message not in the archiveThe second argument to init_bootmem_node() is the PFN to place the bootmem bitmap at and the third argument is the first PFN on the node.
This is currently backwards but never made any problems as both values were always zero.
--- arch/xtensa/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/mm/init.c +2 -1
@@ -145,8 +145,9 @@ void __init bootmem_init(void)/* Reserve the bootmem bitmap area */ mem_reserve (bootmap_start, bootmap_start + bootmap_size,1 ); - bootmap_size =init_bootmem_node (NODE_DATA (0 ), min_low_pfn, + bootmap_size =init_bootmem_node (NODE_DATA (0 ), bootmap_start >>PAGE_SHIFT , + min_low_pfn, max_low_pfn);/* Add all remaining memory pieces into the bootmem map */
PATCH 6/7 xtensa: dont make bootmem bitmap larger than required
In reply to a message not in the archiveIf min_low_pfn is non-zero, the bitmap reserved for bootmem is bigger than needed. The number of pages bootmem has to maintain is the range from min_low_pfn to max_low_pfn.
For now it has only been a theoretical mistake, min_low_pfn was always zero.
--- arch/xtensa/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/mm/init.c +2 -1
@@ -130,7 +130,8 @@ void __init bootmem_init(void)/* Find an area to use for the bootmem bitmap. */ - bootmap_size =bootmem_bootmap_pages (max_low_pfn) <<PAGE_SHIFT ; + bootmap_size =bootmem_bootmap_pages (max_low_pfn - min_low_pfn); + bootmap_size <<=PAGE_SHIFT ; bootmap_start = ~0 ;for (i=0 ; i<sysmem.nr_banks; i++)
PATCH 7/7 xtensa: cope with ram beginning at higher addresses
In reply to a message not in the archiveThe current assumption of the memory code is that the first RAM PFN in the system is 0.
Adjust the relevant code to play well with setups where memory starts at higher addresses, indicated by PLATFORM_DEFAULT_MEM_START.
The new memory model looks like this:
+----------+--+----------------------+----------------+
| | | | |
| | | RAM | |
| | | | |
+----------+--+----------------------+----------------+
| | | | |
+- PFN 0 | +- min_low_pfn +- max_low_pfn +- max_pfn
|
+- ARCH_PFN_OFFSET
+- PLATFORM_DEFAULT_MEM_START >> PAGE_SIZEThe memory map contains pages starting from pfn ARCH_PFN_OFFSET up to max_low_pfn. The only zone used right now will span exactly the same region.
Usually, ARCH_PFN_OFFSET and min_low_pfn are the same value. Handle them separately for robustness. Gapping pages will be in the memory map but marked as reserved and won't be touched.
--- arch/xtensa/include/asm/page.h | 5 ++++- arch/xtensa/mm/init.c | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
arch/xtensa/include/asm/page.h +4 -1
@@ -14,6 +14,7 @@#include <asm/processor.h> #include <asm/types.h> #include <asm/cache.h> +#include <platform/hardware.h> /* * Fixed TLB translations in the processor.
@@ -150,9 +151,11 @@ extern void copy_user_page(void*, void*,* addresses. */ +#define ARCH_PFN_OFFSET (PLATFORM_DEFAULT_MEM_START >> PAGE_SHIFT) +#define __pa (x) ((unsigned long) (x) - PAGE_OFFSET)#define __va (x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) -#define pfn_valid (pfn) ((unsigned long)pfn < max_mapnr) +#define pfn_valid (pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)#ifdef CONFIG_DISCONTIGMEM # error CONFIG_DISCONTIGMEM not supported#endif
arch/xtensa/mm/init.c +5 -5
@@ -167,7 +167,7 @@ void __init paging_init(void)/* All pages are DMA-able, so we put them all in the DMA zone. */ - zones_size[ZONE_DMA ] = max_low_pfn; + zones_size[ZONE_DMA ] = max_low_pfn -ARCH_PFN_OFFSET ;for (i =1 ; i <MAX_NR_ZONES ; i++) zones_size[i] =0 ;
@@ -179,7 +179,7 @@ void __init paging_init(void)memset (swapper_pg_dir,0 ,PAGE_SIZE ); -free_area_init (zones_size); +free_area_init_node (0 , zones_size,ARCH_PFN_OFFSET ,NULL ); }/*
@@ -220,8 +220,8 @@ void __init mem_init(void)unsigned long codesize, reservedpages, datasize, initsize;unsigned long highmemsize, tmp, ram; - max_mapnr = num_physpages = max_low_pfn; - high_memory = (void *)__va (max_mapnr <<PAGE_SHIFT ); + max_mapnr = num_physpages = max_low_pfn -ARCH_PFN_OFFSET ; + high_memory = (void *)__va (max_low_pfn <<PAGE_SHIFT ); highmemsize =0 ;#ifdef CONFIG_HIGHMEM
@@ -231,7 +231,7 @@ void __init mem_init(void) totalram_pages +=free_all_bootmem (); reservedpages = ram =0 ; -for (tmp =0 ; tmp < max_low_pfn; tmp++) { +for (tmp =0 ; tmp < max_mapnr; tmp++) { ram++;if (PageReserved (mem_map+tmp)) reservedpages++;
Quoted 10 lines · Johannes Weiner
The file refers to
in_interrupt()sohardirq.hmust be included.Signed-off-by Johannes Weiner <[email protected]>--- arch/xtensa/kernel/traps.c | 1 + 1 file changed, 1 insertion(+)
arch/xtensa/kernel/traps.c line 31
Quoted 7 lines
arch/xtensa/kernel/traps.c +1
-0@@ -25,6 +25,7 @@#include <linux/kernel.h> #include <linux/sched.h> +#include <linux/hardirq.h> #include <linux/init.h> #include <linux/module.h> #include <linux/stringify.h>
This is obsoleted by Alexey's fix in mainline:
5a891ed xtensa: fix compilation somewhat