Separate generic header usage from ARCH_MULTIPLATFORM
Subsystems (13)
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
The original aim of this series was to restore the ability to build a NOMMU kernel for Versatile Express, something that was lost when we converted ARCH_VEXPRESS for ARCH_MULTIPLATFORM.
In order to do this, it is necessary to abstract the use of generic headers from selection of ARCH_MULTIPLATFORM so that the two can be used separately. This is necessary becuase building a multiplatform kernel for processors without and MMU doesn't make sense (it is necessary to hardcode certain mem-map related data) and the versatile express can host NOMMU processors.
This series performs this separation, and then goes on to add a 'dummy' ARCH_VEXPRESS_NOMMU platform that can be selected as standalone platform.
Patch 2 was sent to the list as an RFC some time ago where it was ACKd, but alone is not sufficient to solve the problem, hence this follow-up series.
Changes since V1:
- Rebase on to 3.10-rc1: fixup conflict from CONFIG_UNCOMPRESS_INCLUDE-foo
Changes since V2
- Rename ARM_GENERIC_HEADERS to NEED_NO_MACH_HEADERS as suggested/requested by Rob Herring
Jonathan Austin (3):
ARM: allow platforms to use generic headers without
ARCH_MULTIPLATFORM
ARM: nommu: re-enable use of vexpress without ARCH_MULTIPLATFORM
ARM: vexpress-nommu: add a Makefile.boot to restore single-platform
build
arch/arm/Kconfig | 21 +++++++++++++++++++++ arch/arm/Kconfig.debug | 4 ++-- arch/arm/Makefile | 2 +- arch/arm/include/asm/timex.h | 2 +- arch/arm/mach-mvebu/Makefile | 2 +- arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-vexpress/Makefile | 2 +- arch/arm/mach-vexpress/Makefile.boot | 4 ++++ arch/arm/plat-omap/Makefile | 2 +- arch/arm/plat-orion/Makefile | 2 +- arch/arm/plat-versatile/Makefile | 2 +- 11 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 arch/arm/mach-vexpress/Makefile.boot
Signature · 1 line
1.7.9.5
PATCH v3 1/3 ARM: allow platforms to use generic headers without ARCH_MULTIPLATFORM
Currently the use of generic mach headers is only is controlled by the same config option as selection of a multiplatform kernel (i.e. ARCH_MULTIPLATFORM). However, there are cases where it is valid to use the generic headers but still build a single platform kernel.
One such example is when using the vexpress platform with a core that does not have an MMU; a multiplatform kernel does not make sense, but use of the generic headers is required by the vexpress platform since 617276307cd4c ("ARM: vexpress: convert to multi-platform").
This patch untangles these two options by introducing a new NEED_NO_MACH_HEADERS config option that ARCH_MULTIPLATFORM selects. Other platforms can now select NEED_NO_MACH_HEADERS independently.
--- arch/arm/Kconfig | 4 ++++ arch/arm/Kconfig.debug | 4 ++-- arch/arm/Makefile | 2 +- arch/arm/include/asm/timex.h | 2 +- arch/arm/mach-mvebu/Makefile | 2 +- arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-vexpress/Makefile | 2 +- arch/arm/plat-omap/Makefile | 2 +- arch/arm/plat-orion/Makefile | 2 +- arch/arm/plat-versatile/Makefile | 2 +- 10 files changed, 14 insertions(+), 10 deletions(-)
arch/arm/Kconfig +4 -0
@@ -207,6 +207,9 @@ config NEED_RET_TO_USER config ARCH_MTD_XIP bool +config NEED_NO_MACH_HEADERS + bool + config VECTORS_BASE hex default 0xffff0000 if MMU || CPU_HIGH_VECTOR
@@ -296,6 +299,7 @@ config ARCH_MULTIPLATFORM select MULTI_IRQ_HANDLER select SPARSE_IRQ select USE_OF + select NEED_NO_MACH_HEADERS config ARCH_INTEGRATOR bool "ARM Ltd. Integrator family"
arch/arm/Kconfig.debug +2 -2
@@ -652,13 +652,13 @@ config DEBUG_LL_INCLUDE config DEBUG_UNCOMPRESS bool - default y if ARCH_MULTIPLATFORM && DEBUG_LL && \ + default y if NEED_NO_MACH_HEADERS && DEBUG_LL && \ !DEBUG_OMAP2PLUS_UART && \ !DEBUG_TEGRA_UART config UNCOMPRESS_INCLUDE string - default "debug/uncompress.h" if ARCH_MULTIPLATFORM + default "debug/uncompress.h" if NEED_NO_MACH_HEADERS default "mach/uncompress.h" config EARLY_PRINTK
arch/arm/Makefile +1 -1
@@ -230,7 +230,7 @@ endif machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y)) -ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y) +ifneq ($(CONFIG_NEED_NO_MACH_HEADERS),y) ifeq ($(KBUILD_SRC),) KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs)) else
arch/arm/include/asm/timex.h +1 -1
@@ -12,7 +12,7 @@#ifndef _ASMARM_TIMEX_H#define _ASMARM_TIMEX_H -#ifdef CONFIG_ARCH_MULTIPLATFORM +#ifdef CONFIG_NEED_NO_MACH_HEADERS #define CLOCK_TICK_RATE 1000000#else #include <mach/timex.h>
arch/arm/mach-mvebu/Makefile +1 -1
@@ -1,4 +1,4 @@ -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ +ccflags-$(CONFIG_NEED_NO_MACH_HEADERS) := -I$(srctree)/$(src)/include \ -I$(srctree)/arch/arm/plat-orion/include AFLAGS_coherency_ll.o := -Wa,-march=armv7-a
arch/arm/mach-omap2/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ +ccflags-$(CONFIG_NEED_NO_MACH_HEADERS) := -I$(srctree)/$(src)/include \ -I$(srctree)/arch/arm/plat-omap/include # Common support
arch/arm/mach-vexpress/Makefile +1 -1
@@ -1,7 +1,7 @@ # # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ +ccflags-$(CONFIG_NEED_NO_MACH_HEADERS) := -I$(srctree)/$(src)/include \ -I$(srctree)/arch/arm/plat-versatile/include obj-y := v2m.o
arch/arm/plat-omap/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/plat-omap/include +ccflags-$(CONFIG_NEED_NO_MACH_HEADERS) := -I$(srctree)/arch/arm/plat-omap/include # Common support obj-y := sram.o dma.o counter_32k.o
arch/arm/plat-orion/Makefile +1 -1
@@ -1,7 +1,7 @@ # # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include +ccflags-$(CONFIG_NEED_NO_MACH_HEADERS) := -I$(srctree)/$(src)/include orion-gpio-$(CONFIG_GPIOLIB) += gpio.o obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o
arch/arm/plat-versatile/Makefile +1 -1
@@ -1,4 +1,4 @@ -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include +ccflags-$(CONFIG_NEED_NO_MACH_HEADERS) := -I$(srctree)/$(src)/include obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
Signature · 1 line
1.7.9.5
PATCH v3 2/3 ARM: nommu: re-enable use of vexpress without ARCH_MULTIPLATFORM
In reply to Jonathan AustinSince 617276307cd4c ("ARM: vexpress: convert to multi-platform") it has been impossible to select ARCH_VEXPRESS without ARCH_MULTIPLATFORM.
ARCH_MULTIPLATFORM doesn't make sense for NOMMU targets, not least because of the need to hard-code the memory map. However, it should still be possible to run NOMMU kernels on top of the Versatile Express by selecting it as the only platform.
This patch creates a shim ARCH_VEXPRESS_NOMMU config option in the 'choice' for "ARM system type" to make this possible again.
--- arch/arm/Kconfig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm/Kconfig +17 -0
@@ -351,6 +351,23 @@ config ARCH_VERSATILE help This enables support for ARM Ltd Versatile board. +config ARCH_VEXPRESS_NOMMU + bool "ARM Ltd. Versatile Express family for NOMMU" + depends on !MMU + select ARCH_VEXPRESS + select SPARSE_IRQ + select NEED_NO_MACH_HEADERS + help + This option enables support for systems using Cortex processor based + ARM core and logic (FPGA) tiles on the Versatile Express motherboard, + in configurations WITHOUT an MMU. You must boot using a Flattened + Device Tree - the traditional ATAGs boot method is not usable with + this configuration. + + If your system has an MMU and you want to make use of it, you + should instead choose to build a multiplatform kernel and + select ARCH_VEXPRESS + config ARCH_AT91 bool "Atmel AT91" select ARCH_REQUIRE_GPIOLIB
Signature · 1 line
1.7.9.5
PATCH v3 3/3 ARM: vexpress-nommu: add a Makefile.boot to restore single-platform build
In reply to Jonathan AustinWhen a single-platform kernel is built, a machine-specific Makefile.boot is expected. In the move to a multiplatform kernels this was removed for vexpress. Assuming AUTO_ZRELADDR is selected and a DT is used, the values recorded in it are no-longer required. However, the missing file breaks building of a single platform kernel for vexpress, such as when using vexpress and a platform without an MMU.
This patch re-instates Makefile.boot for vexpress in single platform configuration, fixing single-platform build. This change does not affect the multi-platform kernel.
--- arch/arm/mach-vexpress/Makefile.boot | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 arch/arm/mach-vexpress/Makefile.boot
arch/arm/mach-vexpress/Makefile.boot new file +4 -0
@@ -0,0 +1,4 @@ +# This is a dummy Makefile.boot for building ARCH_VEXPRESS as a standalone +# platform as opposed with ARCH_MULTIPLATFORM. It is preferable to use +# CONFIG_AUTO_ZRELADDR=y and DT but uncomment the line below if you need it. +# zreladdr-y += 0x00008000
Signature · 1 line
1.7.9.5
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
In reply to Jonathan AustinQuoted 10 lines · On Friday 07 June 2013 11:48:28 Jonathan Austin wrote:
The original aim of this series was to restore the ability to build a NOMMU kernel for Versatile Express, something that was lost when we converted
ARCH_VEXPRESSforARCH_MULTIPLATFORM.In order to do this, it is necessary to abstract the use of generic headers from selection of
ARCH_MULTIPLATFORMso that the two can be used separately. This is necessary becuase building a multiplatform kernel for processors without and MMU doesn't make sense (it is necessary to hardcode certain mem-map related data) and the versatile express can host NOMMU processors.
Quoted 5 lines
This series performs this separation, and then goes on to add a 'dummy'
ARCH_VEXPRESS_NOMMUplatform that can be selected as standalone platform.Patch 2 was sent to the list as an RFC some time ago where it was ACKd, but alone is not sufficient to solve the problem, hence this follow-up series.
I'd like to revisit whether we can't just make !CONFIG_MMU work in combination with CONFIG_ARCH_MULTIPLATFORM. I've spent some time recently on randconfig builds and used the patch below to actually fix all build-time bugs I see with that. The changes need to be split up into separate patches and reviewed one by one, but I think the only one you really need is to not select ARM_PATCH_PHYS_VIRT when building a NOMMU kernel.
Arnd
commit b62a2b6e472bfb3c7b224b300f25365112be1ea9
Author: Arnd Bergmann <[email protected]> Date: Mon Jun 3 11:06:23 2013 +0200
ARM: make "randconfig" work with NOMMU
arch/arm/Kconfig +4 -5
@@ -19,7 +19,7 @@ config ARM select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER select HARDIRQS_SW_RESEND - select HAVE_AOUT + select HAVE_AOUT if MMU select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL select HAVE_ARCH_KGDB select HAVE_ARCH_SECCOMP_FILTER
@@ -285,13 +285,11 @@ config MMU # choice prompt "ARM system type" - default ARCH_VERSATILE if !MMU - default ARCH_MULTIPLATFORM if MMU + default ARCH_MULTIPLATFORM config ARCH_MULTIPLATFORM bool "Allow multiple platforms to be selected" - depends on MMU - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select AUTO_ZRELADDR select COMMON_CLK select MULTI_IRQ_HANDLER
@@ -1812,6 +1810,7 @@ config XEN depends on ARM && AEABI && OF depends on CPU_V7 && !CPU_V6 depends on !GENERIC_ATOMIC64 + depends on MMU select ARM_PSCI select PARAVIRT help
arch/arm/include/asm/cacheflush.h +1 -1
@@ -248,7 +248,7 @@ vivt_flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsig } } -#ifndef CONFIG_CPU_CACHE_VIPT +#if !defined(CONFIG_CPU_CACHE_VIPT ) || !defined(CONFIG_MMU )#define flush_cache_mm (mm) \ vivt_flush_cache_mm(mm)#define flush_cache_range (vma,start,end) \
arch/arm/include/asm/io.h +4 -0
@@ -166,7 +166,11 @@ static inline void __iomem *__typesafe_io(unsigned long addr)/* PCI fixed i/o mapping */ #define PCI_IO_VIRT_BASE 0xfee00000 +#ifdef CONFIG_MMU extern int pci_ioremap_io (unsigned int offset,phys_addr_t phys_addr); +#else +static inline int pci_ioremap_io (unsigned int offset,phys_addr_t phys_addr) {return 0 ; } +#endif /* * Now, pick up the machine-defined IO definitions
arch/arm/include/asm/mach/map.h +2 -1
@@ -55,8 +55,9 @@ extern const struct mem_type *get_mem_type(unsigned int type);extern int ioremap_page (unsigned long virt,unsigned long phys,const struct mem_type *mtype);#else -#define iotable_init (map,num) do { } while (0) +#define iotable_init (map,num) do { (void)(map); } while (0)#define vm_reserve_area_early (a,s,c) do { } while (0) +static inline void debug_ll_io_init (void ) {}#endif #endif
arch/arm/kernel/debug.S +1 -1
@@ -35,7 +35,7 @@ #else /* !CONFIG_MMU */ .macro addruart_current, rx, tmp1, tmp2 - addruart \rx, \tmp1 + addruart \rx, \tmp1, \tmp2 .endm #endif /* CONFIG_MMU */
arch/arm/kernel/head-common.S +2 -0
@@ -175,6 +175,8 @@ __lookup_processor_type_data: .long __proc_info_end .size __lookup_processor_type_data, . - __lookup_processor_type_data + __HEAD + __error_p: #ifdef CONFIG_DEBUG_LL adr r0, str_p1
arch/arm/kernel/suspend.c +7 -2
@@ -22,7 +22,9 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr) *save_ptr =virt_to_phys (ptr);/* This must correspond to the LDM in cpu_resume() assembly */ +#ifdef CONFIG_MMU *ptr++ =virt_to_phys (idmap_pgd); +#endif *ptr++ = sp; *ptr++ =virt_to_phys (cpu_do_resume);
@@ -53,11 +55,11 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)*/ int cpu_suspend (unsigned long arg,int (*fn)(unsigned long )) { -struct mm_struct *mm = current->active_mm;int ret; - +#ifdef CONFIG_MMU if (!idmap_pgd)return -EINVAL ; +#endif /* * Provide a temporary page table with an identity mapping for
@@ -66,11 +68,14 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))* back to the correct page tables. */ ret =__cpu_suspend (arg, fn); +#ifdef CONFIG_MMU if (ret ==0 ) { +struct mm_struct *mm = current->active_mm;cpu_switch_mm (mm->pgd, mm);local_flush_bp_all ();local_flush_tlb_all (); } +#endif return ret; }
arch/arm/mach-at91/Kconfig.non_dt +1 -0
@@ -36,6 +36,7 @@ config ARCH_AT91SAM9G45 config ARCH_AT91X40 bool "AT91x40" depends on !MMU + select CPU_ARM9TDMI select ARCH_USES_GETTIMEOFFSET select MULTI_IRQ_HANDLER select SPARSE_IRQ
arch/arm/mach-imx/Kconfig +1 -1
@@ -1,7 +1,7 @@ config ARCH_MXC bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 select ARCH_REQUIRE_GPIOLIB - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select AUTO_ZRELADDR if !ZBOOT_ROM select CLKDEV_LOOKUP select CLKSRC_MMIO
arch/arm/mach-imx/pm-imx5.c +2 -0
@@ -110,7 +110,9 @@ static int mx5_suspend_enter(suspend_state_t state) }if (state ==PM_SUSPEND_MEM ) { +#ifdef CONFIG_MMU local_flush_tlb_all (); +#endif flush_cache_all ();/*clear the EMPGC0/1 bits */
arch/arm/mach-omap2/Kconfig +1 -1
@@ -100,7 +100,7 @@ config ARCH_OMAP2PLUS_TYPICAL bool "Typical OMAP configuration" default y select AEABI - select HIGHMEM + select HIGHMEM if MMU select I2C select I2C_OMAP select MENELAUS if ARCH_OMAP2
arch/arm/mach-omap2/omap-secure.c +2 -2
@@ -60,8 +60,8 @@ int __init omap_secure_ram_reserve_memblock(void) {u32 size =OMAP_SECURE_RAM_STORAGE ; - size =ALIGN (size,SECTION_SIZE ); - omap_secure_memblock_base =arm_memblock_steal (size,SECTION_SIZE ); + size =ALIGN (size,SZ_1M ); + omap_secure_memblock_base =arm_memblock_steal (size,SZ_1M );return 0 ; }
arch/arm/mach-picoxcell/Kconfig +1 -1
@@ -1,7 +1,7 @@ config ARCH_PICOXCELL bool "Picochip PicoXcell" if ARCH_MULTI_V6 select ARCH_REQUIRE_GPIOLIB - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select ARM_VIC select CPU_V6K select DW_APB_TIMER
arch/arm/mm/Kconfig +2 -2
@@ -6,7 +6,7 @@ comment "Processor Type" # ARM7TDMI config CPU_ARM7TDMI - bool "Support ARM7TDMI processor" + bool depends on !MMU select CPU_32v4T select CPU_ABRT_LV4T
@@ -56,7 +56,7 @@ config CPU_ARM740T # ARM9TDMI config CPU_ARM9TDMI - bool "Support ARM9TDMI processor" + bool depends on !MMU select CPU_32v4T select CPU_ABRT_NOMMU
arch/arm/plat-omap/sram.c +4 -0
@@ -81,7 +81,11 @@ void __init omap_map_sram(unsigned long start, unsigned long size, start =ROUND_DOWN (start,PAGE_SIZE ); omap_sram_size = size; omap_sram_skip = skip; +#ifdef CONFIG_MMU omap_sram_base =__arm_ioremap_exec (start, size, cached); +#else + omap_sram_base = (void __iomem *)start; +#endif if (!omap_sram_base) {pr_err ("SRAM: Could not map\n" );return ;
drivers/iommu/Kconfig +1 -1
@@ -130,7 +130,7 @@ config IRQ_REMAP # OMAP IOMMU support config OMAP_IOMMU bool "OMAP IOMMU Support" - depends on ARCH_OMAP2PLUS + depends on ARCH_OMAP2PLUS && MMU select IOMMU_API config OMAP_IOVMM
drivers/staging/android/Kconfig +1 -0
@@ -10,6 +10,7 @@ if ANDROID config ANDROID_BINDER_IPC bool "Android Binder IPC Driver" + depends on MMU default n ---help--- Binder is used in Android for both communication between processes,
drivers/staging/zsmalloc/Kconfig +1 -0
@@ -1,5 +1,6 @@ config ZSMALLOC bool "Memory allocator for compressed pages" + depends on MMU default n help zsmalloc is a slab-based memory allocator designed to store
include/linux/kernel.h +7 -3
@@ -193,13 +193,17 @@ extern int _cond_resched(void); (__x <0 ) ? -__x : __x; \ }) -#ifdef CONFIG_PROVE_LOCKING -void might_fault (void ); -#else +#ifndef CONFIG_MMU +static inline void might_fault (void ) +{ +} +#elif !defined(CONFIG_PROVE_LOCKING )static inline void might_fault (void ) {might_sleep (); } +#else +void might_fault (void );#endif extern struct atomic_notifier_head panic_notifier_list;
include/linux/mm.h +4 -0
@@ -919,7 +919,11 @@ extern bool skip_free_areas_node(unsigned int flags, int nid);int shmem_zero_setup (struct vm_area_struct *); +#ifdef CONFIG_MMU extern int can_do_mlock (void ); +#else +static inline int can_do_mlock (void ) {return 0 ; } +#endif extern int user_shm_lock (size_t ,struct user_struct *);extern void user_shm_unlock (size_t ,struct user_struct *);
mm/nommu.c +1 -0
@@ -54,6 +54,7 @@#endif void *high_memory; +EXPORT_SYMBOL (high_memory);struct page *mem_map;unsigned long max_mapnr;unsigned long highest_memmap_pfn;
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
Hi Arnd,
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · On Friday 07 June 2013 11:48:28 Jonathan Austin wrote:
The original aim of this series was to restore the ability to build a NOMMU kernel for Versatile Express, something that was lost when we converted
ARCH_VEXPRESSforARCH_MULTIPLATFORM.In order to do this, it is necessary to abstract the use of generic headers from selection of
ARCH_MULTIPLATFORMso that the two can be used separately. This is necessary becuase building a multiplatform kernel for processors without and MMU doesn't make sense (it is necessary to hardcode certain mem-map related data) and the versatile express can host NOMMU processors.
Quoted 8 lines
Quoted 5 lines
This series performs this separation, and then goes on to add a 'dummy'
ARCH_VEXPRESS_NOMMUplatform that can be selected as standalone platform.Patch 2 was sent to the list as an RFC some time ago where it was ACKd, but alone is not sufficient to solve the problem, hence this follow-up series.
I'd like to revisit whether we can't just make !CONFIG_MMU work in combination with
CONFIG_ARCH_MULTIPLATFORM.
Do you mean you want to build real !MMU multiplatform kernels that validly work on multiple platforms, or are you just interested in keeping the config options set?
I don't think the former makes sense - we still rely on setting CONFIG_DRAM_BASE (and hence PHYS_OFFSET) and we *can't* use the high exception vector on many platforms (high exception vectors is deprecated for R class, too) but we need to use it on others.
In the case that you just want to keep the config option set, I don't really see what you gain?
The problem I see with enabling !MMU/ARCH_MULTIPLATFORM is that you end up needing to change platforms that (as far as I know) people never use in NOMMU configurations for NOMMU behaviour: cf imx, omap2 needing to be changed in a specific way for the NOMMU case in the diff below. (I say 'specific way' because, of course, this series does make a small change to them, but I see it more as separating out two previously conflated options than as NOMMU specific changes...)
Quoted 5 lines
I've spent some time recently on randconfig
builds and used the patch below to actually fix all build-time bugs I see with that. The changes need to be split up into separate patches and reviewed one by one, but I think the only one you really need is to not selectARM_PATCH_PHYS_VIRTwhen building a NOMMU kernel.
I agree that this seems to get you to something that builds, though I'm not sure it'd build something that runs... Don't we end up just making life harder (I think the diff below is more complicated than the one for this series...) for ourselves without a win?
Doesn't the explicit dependency of CONFIG_MMU for ARCH_MULTIPLATFORM mean that randconfig builds still work, even without the changes below?
Apologies if I'm missing a use-case here!
Jonny
Quoted 371 lines
Arnd
commit
b62a2b6e472bfb3c7b224b300f25365112be1ea9Author: Arnd Bergmann <[email protected]> Date: Mon Jun 3 11:06:23 2013 +0200ARM: make "randconfig" work with NOMMU
Signed-off-by Arnd Bergmann <[email protected]>arch/arm/Kconfig +4
-5@@ -19,7 +19,7 @@ config ARM select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER select HARDIRQS_SW_RESEND - select HAVE_AOUT + select HAVE_AOUT if MMU select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL select HAVE_ARCH_KGDB select HAVE_ARCH_SECCOMP_FILTER@@ -285,13 +285,11 @@ config MMU # choice prompt "ARM system type" - default ARCH_VERSATILE if !MMU - default ARCH_MULTIPLATFORM if MMU + default ARCH_MULTIPLATFORM config ARCH_MULTIPLATFORM bool "Allow multiple platforms to be selected" - depends on MMU - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select AUTO_ZRELADDR select COMMON_CLK select MULTI_IRQ_HANDLER@@ -1812,6 +1810,7 @@ config XEN depends on ARM && AEABI && OF depends on CPU_V7 && !CPU_V6 depends on !GENERIC_ATOMIC64 + depends on MMU select ARM_PSCI select PARAVIRT helparch/arm/include/asm/cacheflush.h +1
-1@@ -248,7 +248,7 @@ vivt_flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsig } } -#ifndef CONFIG_CPU_CACHE_VIPT +#if !defined(CONFIG_CPU_CACHE_VIPT ) || !defined(CONFIG_MMU )#define flush_cache_mm (mm) \ vivt_flush_cache_mm(mm)#define flush_cache_range (vma,start,end) \arch/arm/include/asm/io.h +4
-0@@ -166,7 +166,11 @@ static inline void __iomem *__typesafe_io(unsigned long addr)/* PCI fixed i/o mapping */ #define PCI_IO_VIRT_BASE 0xfee00000 +#ifdef CONFIG_MMU extern int pci_ioremap_io (unsigned int offset,phys_addr_t phys_addr); +#else +static inline int pci_ioremap_io (unsigned int offset,phys_addr_t phys_addr) {return 0 ; } +#endif /* * Now, pick up the machine-defined IO definitions arch/arm/include/asm/mach/map.h +2
-1@@ -55,8 +55,9 @@ extern const struct mem_type *get_mem_type(unsigned int type);extern int ioremap_page (unsigned long virt,unsigned long phys,const struct mem_type *mtype);#else -#define iotable_init (map,num) do { } while (0) +#define iotable_init (map,num) do { (void)(map); } while (0)#define vm_reserve_area_early (a,s,c) do { } while (0) +static inline void debug_ll_io_init (void ) {}#endif #endif arch/arm/kernel/debug.S +1
-1@@ -35,7 +35,7 @@ #else /* !CONFIG_MMU */ .macro addruart_current, rx, tmp1, tmp2 - addruart \rx, \tmp1 + addruart \rx, \tmp1, \tmp2 .endm #endif /* CONFIG_MMU */arch/arm/kernel/head-common.S +2
-0@@ -175,6 +175,8 @@ __lookup_processor_type_data: .long __proc_info_end .size __lookup_processor_type_data, . - __lookup_processor_type_data + __HEAD + __error_p: #ifdef CONFIG_DEBUG_LL adr r0, str_p1arch/arm/kernel/suspend.c +7
-2@@ -22,7 +22,9 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr) *save_ptr =virt_to_phys (ptr);/* This must correspond to the LDM in cpu_resume() assembly */ +#ifdef CONFIG_MMU *ptr++ =virt_to_phys (idmap_pgd); +#endif *ptr++ = sp; *ptr++ =virt_to_phys (cpu_do_resume);@@ -53,11 +55,11 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)*/ int cpu_suspend (unsigned long arg,int (*fn)(unsigned long )) { -struct mm_struct *mm = current->active_mm;int ret; - +#ifdef CONFIG_MMU if (!idmap_pgd)return -EINVAL ; +#endif /* * Provide a temporary page table with an identity mapping for @@ -66,11 +68,14 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))* back to the correct page tables. */ ret =__cpu_suspend (arg, fn); +#ifdef CONFIG_MMU if (ret ==0 ) { +struct mm_struct *mm = current->active_mm;cpu_switch_mm (mm->pgd, mm);local_flush_bp_all ();local_flush_tlb_all (); } +#endif return ret; }arch/arm/mach-at91/Kconfig.non_dt +1
-0@@ -36,6 +36,7 @@ config ARCH_AT91SAM9G45 config ARCH_AT91X40 bool "AT91x40" depends on !MMU + select CPU_ARM9TDMI select ARCH_USES_GETTIMEOFFSET select MULTI_IRQ_HANDLER select SPARSE_IRQarch/arm/mach-imx/Kconfig +1
-1@@ -1,7 +1,7 @@ config ARCH_MXC bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 select ARCH_REQUIRE_GPIOLIB - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select AUTO_ZRELADDR if !ZBOOT_ROM select CLKDEV_LOOKUP select CLKSRC_MMIOarch/arm/mach-imx/pm-imx5.c +2
-0@@ -110,7 +110,9 @@ static int mx5_suspend_enter(suspend_state_t state) }if (state ==PM_SUSPEND_MEM ) { +#ifdef CONFIG_MMU local_flush_tlb_all (); +#endif flush_cache_all ();/*clear the EMPGC0/1 bits */ arch/arm/mach-omap2/Kconfig +1
-1@@ -100,7 +100,7 @@ config ARCH_OMAP2PLUS_TYPICAL bool "Typical OMAP configuration" default y select AEABI - select HIGHMEM + select HIGHMEM if MMU select I2C select I2C_OMAP select MENELAUS if ARCH_OMAP2arch/arm/mach-omap2/omap-secure.c +2
-2@@ -60,8 +60,8 @@ int __init omap_secure_ram_reserve_memblock(void) {u32 size =OMAP_SECURE_RAM_STORAGE ; - size =ALIGN (size,SECTION_SIZE ); - omap_secure_memblock_base =arm_memblock_steal (size,SECTION_SIZE ); + size =ALIGN (size,SZ_1M ); + omap_secure_memblock_base =arm_memblock_steal (size,SZ_1M );return 0 ; }arch/arm/mach-picoxcell/Kconfig +1
-1@@ -1,7 +1,7 @@ config ARCH_PICOXCELL bool "Picochip PicoXcell" if ARCH_MULTI_V6 select ARCH_REQUIRE_GPIOLIB - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select ARM_VIC select CPU_V6K select DW_APB_TIMERarch/arm/mm/Kconfig +2
-2@@ -6,7 +6,7 @@ comment "Processor Type" # ARM7TDMI config CPU_ARM7TDMI - bool "Support ARM7TDMI processor" + bool depends on !MMU select CPU_32v4T select CPU_ABRT_LV4T@@ -56,7 +56,7 @@ config CPU_ARM740T # ARM9TDMI config CPU_ARM9TDMI - bool "Support ARM9TDMI processor" + bool depends on !MMU select CPU_32v4T select CPU_ABRT_NOMMUarch/arm/plat-omap/sram.c +4
-0@@ -81,7 +81,11 @@ void __init omap_map_sram(unsigned long start, unsigned long size, start =ROUND_DOWN (start,PAGE_SIZE ); omap_sram_size = size; omap_sram_skip = skip; +#ifdef CONFIG_MMU omap_sram_base =__arm_ioremap_exec (start, size, cached); +#else + omap_sram_base = (void __iomem *)start; +#endif if (!omap_sram_base) {pr_err ("SRAM: Could not map\n" );return ;drivers/iommu/Kconfig +1
-1@@ -130,7 +130,7 @@ config IRQ_REMAP # OMAP IOMMU support config OMAP_IOMMU bool "OMAP IOMMU Support" - depends on ARCH_OMAP2PLUS + depends on ARCH_OMAP2PLUS && MMU select IOMMU_API config OMAP_IOVMMdrivers/staging/android/Kconfig +1
-0@@ -10,6 +10,7 @@ if ANDROID config ANDROID_BINDER_IPC bool "Android Binder IPC Driver" + depends on MMU default n ---help--- Binder is used in Android for both communication between processes,drivers/staging/zsmalloc/Kconfig +1
-0@@ -1,5 +1,6 @@ config ZSMALLOC bool "Memory allocator for compressed pages" + depends on MMU default n help zsmalloc is a slab-based memory allocator designed to storeinclude/linux/kernel.h +7
-3@@ -193,13 +193,17 @@ extern int _cond_resched(void); (__x <0 ) ? -__x : __x; \ }) -#ifdef CONFIG_PROVE_LOCKING -void might_fault (void ); -#else +#ifndef CONFIG_MMU +static inline void might_fault (void ) +{ +} +#elif !defined(CONFIG_PROVE_LOCKING )static inline void might_fault (void ) {might_sleep (); } +#else +void might_fault (void );#endif extern struct atomic_notifier_head panic_notifier_list;include/linux/mm.h +4
-0@@ -919,7 +919,11 @@ extern bool skip_free_areas_node(unsigned int flags, int nid);int shmem_zero_setup (struct vm_area_struct *); +#ifdef CONFIG_MMU extern int can_do_mlock (void ); +#else +static inline int can_do_mlock (void ) {return 0 ; } +#endif extern int user_shm_lock (size_t ,struct user_struct *);extern void user_shm_unlock (size_t ,struct user_struct *);mm/nommu.c +1
-0@@ -54,6 +54,7 @@#endif void *high_memory; +EXPORT_SYMBOL (high_memory);struct page *mem_map;unsigned long max_mapnr;unsigned long highest_memmap_pfn;
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
Quoted 5 lines · On Friday 07 June 2013 14:13:24 Jonathan Austin wrote:
Do you mean you want to build real !MMU multiplatform kernels that validly work on multiple platforms, or are you just interested in keeping the config options set?
Quoted 7 lines
I don't think the former makes sense - we still rely on setting
CONFIG_DRAM_BASE(and hencePHYS_OFFSET) and we *can't* use the high exception vector on many platforms (high exception vectors is deprecated for R class, too) but we need to use it on others.In the case that you just want to keep the config option set, I don't really see what you gain?
The main interest on my side is to keep the MMU and NOMMU configuration as similar as possible, and minimize the complexity in Kconfig. Ideally CONFIG_MMU should just be a single switch to turn on or off, with a few options becoming visible only for one of the settings.
Quoted 7 lines
The problem I see with enabling !MMU/ARCH_MULTIPLATFORM is that you end up needing to change platforms that (as far as I know) people never use in NOMMU configurations for NOMMU behaviour: cf imx, omap2 needing to be changed in a specific way for the NOMMU case in the diff below. (I say 'specific way' because, of course, this series does make a small change to them, but I see it more as separating out two previously conflated options than as NOMMU specific changes...)
Well, I would consider the imx and omap2 changes to be actual bugs. We previously allowed them to be built with !MMU, and we could still decide that we don't want them to run that way but just disable those. I would however prefer to allow !MMU builds by default for everything that is not know to be broken, rather than allowing it only for code that is known to work.
Quoted 11 lines
Quoted 5 lines
I've spent some time recently on randconfig
builds and used the patch below to actually fix all build-time bugs I see with that. The changes need to be split up into separate patches and reviewed one by one, but I think the only one you really need is to not selectARM_PATCH_PHYS_VIRTwhen building a NOMMU kernel.I agree that this seems to get you to something that builds, though I'm not sure it'd build something that runs... Don't we end up just making life harder (I think the diff below is more complicated than the one for this series...) for ourselves without a win?
Quoted 4 lines
Doesn't the explicit dependency of
CONFIG_MMUforARCH_MULTIPLATFORMmean that randconfig builds still work, even without the changes below?Apologies if I'm missing a use-case here!
I am somewhat annoyed by the fact that I had to disable ARCH_MULTIPLATFORM for !MMU kernels in order to get 'make randconfig' to work and I would rather allow it and fix the bugs.
Arnd
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
Quoted 8 lines · On Friday 07 June 2013 16:00:47 Arnd Bergmann wrote:
Quoted 4 lines
Doesn't the explicit dependency of
CONFIG_MMUforARCH_MULTIPLATFORMmean that randconfig builds still work, even without the changes below?Apologies if I'm missing a use-case here!
I am somewhat annoyed by the fact that I had to disable
ARCH_MULTIPLATFORMfor !MMU kernels in order to get 'make randconfig' to work and I would rather allow it and fix the bugs.
To expand on this a bit more: I want to eventually make ARCH_MULTIPLATFORM mandatory for all modern platforms, in particular anything ARMv6 and ARMv7 based. Forcing all !MMU-kernels to be !ARCH_MULTIPLATFORM means we won't get there unless we disallow !MMU on modern platforms.
Arnd
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · On Friday 07 June 2013 16:00:47 Arnd Bergmann wrote:
Quoted 4 lines
Doesn't the explicit dependency of
CONFIG_MMUforARCH_MULTIPLATFORMmean that randconfig builds still work, even without the changes below?Apologies if I'm missing a use-case here!
Quoted 9 lines
Quoted 3 lines
I am somewhat annoyed by the fact that I had to disable
ARCH_MULTIPLATFORMfor !MMU kernels in order to get 'make randconfig' to work and I would rather allow it and fix the bugs.To expand on this a bit more: I want to eventually make
ARCH_MULTIPLATFORMmandatory for all modern platforms, in particular anything ARMv6 and ARMv7 based. Forcing all !MMU-kernels to be !ARCH_MULTIPLATFORM means we won't get there unless we disallow !MMU on modern platforms.
Thanks for the expansion. I like that as an aim :). We should remember it'll still only make sense for platforms where PHYS_OFFSET/DRAM_BASE is the same - not sure how many that will be.
I've had a play with keeping !MMU and ARCH_MULTIPLATFORM selectable together, and of the fixes in your diff, only the following is required to get R7 booting on top of Vexpress:
-----8<-------
arch/arm/Kconfig +1 -2
@@ -289,8 +289,7 @@ choice config ARCH_MULTIPLATFORM bool "Allow multiple platforms to be selected" - depends on MMU - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select AUTO_ZRELADDR select COMMON_CLK select MULTI_IRQ_HANDLER
----->8--------
It's nice too, because we don't need to add back Makefile.boot for vexpress.
The R7 support, nommu-fixes and MPU patches I sent before and which I hope to have merged for 3.11 (pull request for rmk coming shortly) can all work fine using this instead of the NEED_NO_MACH_HEADERS series (IE this series)....
It would be cool, then, to have the small patch above in for 3.11 too if we're not too late and if nobody is against going down this route?
Arnd: would you like to send it as a patch to the list for consideration, or shall I take this on?
Jonny
Quoted 3 lines
Arnd
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
Quoted 4 lines · On Friday 07 June 2013 17:51:07 Jonathan Austin wrote:
Thanks for the expansion. I like that as an aim :). We should remember it'll still only make sense for platforms where PHYS_OFFSET/DRAM_BASE is the same - not sure how many that will be.
Yes, this is much less about the practical value of actually running a kernel that is built for multiple NOMMU machines than it is about doing things in a consistent way throughout the kernel.
Quoted 21 lines
I've had a play with keeping !MMU and
ARCH_MULTIPLATFORMselectable together, and of the fixes in your diff, only the following is required to get R7 booting on top of Vexpress:-----8<-------
arch/arm/Kconfig +1
-3@@ -289,8 +289,7 @@ choice config ARCH_MULTIPLATFORM bool "Allow multiple platforms to be selected" - depends on MMU - select ARM_PATCH_PHYS_VIRT + select ARM_PATCH_PHYS_VIRT if MMU select AUTO_ZRELADDR select COMMON_CLK select MULTI_IRQ_HANDLER ----->8--------
Quoted 1 line
It's nice too, because we don't need to add back Makefile.boot for vexpress.
Ok, excellent. We can probably mark that for -stable backports so we also get it in 3.8.x and 3.9.x.
Quoted 4 lines
The R7 support, nommu-fixes and MPU patches I sent before and which I hope to have merged for 3.11 (pull request for rmk coming shortly) can all work fine using this instead of the
NEED_NO_MACH_HEADERSseries (IE this series)....
Ok.
Quoted 5 lines
It would be cool, then, to have the small patch above in for 3.11 too if we're not too late and if nobody is against going down this route?
Arnd: would you like to send it as a patch to the list for consideration, or shall I take this on?
Please send a patch with a correct description.
Arnd
v3 cover Separate generic header usage from ARCH_MULTIPLATFORM
Quoted 3 lines · Arnd Bergmann
On Friday 07 June 2013 17:51:07 Jonathan Austin wrote:
Please send a patch with a correct description.
No worries. What's the authorship etiquette on a little patch like this?
Thanks,
Jonny