From patchwork Mon Dec 12 09:44:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mickael guene X-Patchwork-Id: 87640 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1545702qgi; Mon, 12 Dec 2016 01:47:12 -0800 (PST) X-Received: by 10.98.23.88 with SMTP id 85mr95357862pfx.21.1481536032303; Mon, 12 Dec 2016 01:47:12 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id j62si42703190pgc.104.2016.12.12.01.47.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 01:47:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cGNBI-0004SK-2m; Mon, 12 Dec 2016 09:46:00 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cGNB9-0004AU-9B for linux-arm-kernel@lists.infradead.org; Mon, 12 Dec 2016 09:45:54 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id uBC9hw3v024886; Mon, 12 Dec 2016 10:44:58 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-.pphosted.com with ESMTP id 2789fgtr2q-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 12 Dec 2016 10:44:57 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A666134; Mon, 12 Dec 2016 09:44:47 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas3.st.com [10.75.90.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3949728AF; Mon, 12 Dec 2016 09:44:47 +0000 (GMT) Received: from [10.129.186.101] (164.129.122.161) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.444.0; Mon, 12 Dec 2016 10:44:46 +0100 Subject: Re: [RFC v3 PATCH 00/25] Allow NOMMU for MULTIPLATFORM To: Vladimir Murzin , Peter Korsgaard , Afzal Mohammed References: <1480691143-19845-1-git-send-email-vladimir.murzin@arm.com> <20161210181639.GA5660@afzalpc> <878trntrig.fsf@dell.be.48ers.dk> <20161211070104.GB3035@afzalpc> <87fulus094.fsf@dell.be.48ers.dk> <238a0185-db3a-fa43-cd7d-91baebdb82d4@st.com> <584E6DA3.5070009@arm.com> From: mickael guene Message-ID: Date: Mon, 12 Dec 2016 10:44:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <584E6DA3.5070009@arm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-12_05:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161212_014551_708424_DCA41150 X-CRM114-Status: GOOD ( 35.08 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [91.207.212.93 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 T_FILL_THIS_FORM_SHORT Fill in a short form with personal information X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryan Mallon , Arnd Bergmann , Tony Lindgren , Linus Walleij , Russell King , Hartley Sweeten , Alexander Shiyan , Thierry Reding , Sascha Hauer , Fabio Estevam , Shawn Guo , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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 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 >From 3dd56a70e2dd5646db6412dd934b73ecc45f2bef Mon Sep 17 00:00:00 2001 From: Mickael Guene 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 --- 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