diff mbox

[RFC,v3,00/25] Allow NOMMU for MULTIPLATFORM

Message ID be4002b0-d4e8-bb3a-dff0-8050f680f5ae@st.com
State New
Headers show

Commit Message

mickael guene Dec. 12, 2016, 9:44 a.m. UTC
Hi Vladimir,

  At the end of https://github.com/mickael-guene/fdpic_manifest you can
find a set of patch to apply for kernel fdpic support. Unfortunately
they are quite old ... But I have done some test on May for
stm32f469-disco platform and I have attached patches against more
recent kernel.

  I also remove Maxime address since he quit st few month ago and his
address is no more valid.

Regards
Mickael

On 12/12/2016 10:28 AM, Vladimir Murzin wrote:
> Hi,

>

> On 12/12/16 07:07, mickael guene wrote:

>> Hi all,

>>

>>  You can find an R toolchain here:

>> https://github.com/mickael-guene/fdpic_manifest/releases/download/v7-r-1.0.1/toolset-v7-r-1.0.1-0-gbdcc6a7c-armv7-r.tgz

>>

>>  It's an fdpic toolset for cortex-r cpu class. gcc version is

>> quite old (4.7).

>>

>>  Note also that generated code may crash on class A cpu due to

>> generation of udiv/sdiv which is optional for class A.

>> (cortex a15 is ok but not a9).

>>

>> Hope it helps

>

> Unfortunately, it doesn't help because it depends on FDPIC Linux patches

> which are out of tree and no link has been given.

>

> M-class toolchain should just work with A-class; you don't even need to

> disable MMU to try it out after d782e42 ("ARM: 8594/1: enable binfmt_flat on

> systems with an MMU").

>

> Cheers

> Vladimir

>

>>

>> Regards

>> Mickael

>>

>> On 12/11/2016 09:01 PM, Peter Korsgaard wrote:

>>>>>>>> "Afzal" == Afzal Mohammed <afzal.mohd.ma@gmail.com> writes:

>>>

>>> Hi,

>>>

>>>  >> You can build a toolchain and initramfs with Buildroot. Have a look at

>>>  >> the stm32f429 nommu config:

>>>  >>

>>>  >> https://git.buildroot.net/buildroot/tree/configs/stm32f429_disco_defconfig

>>>

>>>  > iiuc, it builds one for Cortex-M. i already had a file system w/

>>>  > busybox compiled using a Cortex-M toolchain (stolen from

>>>  > Pengutronix's OSELAS.Toolchain), which works on Cortex M4 (Vybrid

>>>  > VF610 M4 core). But it does not work here, i.e. on Cortex A, seems the

>>>  > above mentioned also would have the same effect.

>>>

>>> Hmm, I'm not sure why a cortex-M toolchain wouldn't work on cortex-A, I

>>> thought the 'M' instruction set was a pure subset of the 'A'.

>>>

>>>  > And in buildroot, couldn't see Cortex R option in menuconfig, and

>>>  > selecting Cortex-A's excludes flat binary target & presents only with

>>>  > ELF.

>>>

>>> We indeed don't have cortex-R support. I'm not aware of any cortex-R

>>> Linux support.

>>>

>>> When you select a cortex-A variant, then we enable MMU support by

>>> default, but you can disable it under toolchain options (Enable MMU) and

>>> then the flat binary option is available.

>>>

>>

>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox

Patch

From 3dd56a70e2dd5646db6412dd934b73ecc45f2bef Mon Sep 17 00:00:00 2001
From: Mickael Guene <mickael.guene@st.com>
Date: Fri, 29 May 2015 09:41:21 +0200
Subject: [PATCH 5/5] fdpic: Workaround to fix futex bug on mmu less

 See https://bugzilla.kernel.org/show_bug.cgi?id=78881 for description
and test case.

Change-Id: Id87f5aaceabc4226143b146a9613b37eedec22f1
Signed-off-by: Mickael Guene <mickael.guene@st.com>
---
 arch/arm/kernel/signal.c | 14 +-------------
 arch/arm/kernel/traps.c  |  2 +-
 fs/binfmt_elf_fdpic.c    |  6 +++---
 kernel/futex.c           |  4 ++++
 4 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index f6cfefdbd206..c48ccb2af742 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -53,19 +53,7 @@  const unsigned long sigreturn_fdpic__thumb_codes[3] = {
     0xf000f8dc  /* ldr pc, [r12] to jump into restorer */
 };
 
-/*
- * For Thumb syscalls, we pass the syscall number via r7.  We therefore
- * need two 16-bit instructions.
- */
-#define SWI_THUMB_SIGRETURN	(0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE))
-#define SWI_THUMB_RT_SIGRETURN	(0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE))
-
-static const unsigned long sigreturn_codes[7] = {
-	MOV_R7_NR_SIGRETURN,    SWI_SYS_SIGRETURN,    SWI_THUMB_SIGRETURN,
-	MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
-};
-
-static unsigned long signal_return_offset;
+unsigned long signal_return_offset;
 
 #ifdef CONFIG_CRUNCH
 static int preserve_crunch_context(struct crunch_sigframe __user *frame)
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 1ba16ec2bfdf..d43329461f53 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -626,7 +626,7 @@  asmlinkage int arm_syscall(int no, struct pt_regs *regs)
 		return 0;
 
 	case NR(get_tls):
-	    return thread->tp_value[0];
+	    return current_thread_info()->tp_value[0];
 
 	default:
 		/* Calls 9f00xx..9f07ff are defined to return -ENOSYS
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 583cdf14279e..21ae7c99eaa6 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -349,7 +349,7 @@  static int load_elf_fdpic_binary(struct linux_binprm *bprm)
 	 * error_kill */
     /* TODO : call SET_PERSONALITY is certainly better .... */
 	set_personality(PER_LINUX_FDPIC | PER_LINUX_32BIT);
-	if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
+	if (elf_read_implies_exec(exec_params.hdr, executable_stack))
 		current->personality |= READ_IMPLIES_EXEC;
 
 	setup_new_exec(bprm);
@@ -813,8 +813,8 @@  static int elf_fdpic_map_file(struct elf_fdpic_params *params,
 			if (params->hdr.e_entry >= seg->p_vaddr &&
 			    params->hdr.e_entry < seg->p_vaddr + seg->p_memsz) {
 				params->entry_addr =
-					(params->hdr.e_entry - seg->p_vaddr) +
-					seg->addr;
+					((params->hdr.e_entry - seg->p_vaddr) +
+					seg->addr) | 1;
 				break;
 			}
 		}
diff --git a/kernel/futex.c b/kernel/futex.c
index 0773f2b23b10..505ac60dab86 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -494,12 +494,16 @@  get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
 	 * Note : We do have to check 'uaddr' is a valid user address,
 	 *        but access_ok() should be faster than find_vma()
 	 */
+#if defined(CONFIG_MMU)
 	if (!fshared) {
+#endif
 		key->private.mm = mm;
 		key->private.address = address;
 		get_futex_key_refs(key);  /* implies MB (B) */
 		return 0;
+#if defined(CONFIG_MMU)
 	}
+#endif
 
 again:
 	/* Ignore any VERIFY_READ mapping (futex common case) */
-- 
1.9.1