From: Antony Yu <swpenim@gmail.com> To: Nick Desaulniers <ndesaulniers@google.com> Cc: Nathan Chancellor <natechancellor@gmail.com>, Russell King <linux@armlinux.org.uk>, Linux ARM <linux-arm-kernel@lists.infradead.org>, LKML <linux-kernel@vger.kernel.org>, clang-built-linux <clang-built-linux@googlegroups.com>, swpenim@gmail.com Subject: [PATCH v2] ARM: fix __div64_32() error when compiling with clang Date: Mon, 30 Nov 2020 16:20:32 +0800 [thread overview] Message-ID: <20201130082032.GA25739@penyung-VirtualBox> (raw) In-Reply-To: <CAKwvOdkE5-OBWjmGwc8qUkj5wuqZTmtYxaMD3sz+4+aNiC2vLg@mail.gmail.com> [-- Attachment #1: v2-0001-ARM-fix-__div64_32-error-when-compiling-with-clan.patch --] [-- Type: text/x-diff, Size: 1326 bytes --] From 3a4c19e09079324a625941ea3c16fe4b0df2ed86 Mon Sep 17 00:00:00 2001 From: Antony Yu <swpenim@gmail.com> Date: Mon, 9 Nov 2020 17:31:52 +0800 Subject: [PATCH v2] ARM: fix __div64_32() error when compiling with clang __do_div64 clobbers the input register r0 in little endian system. According to the inline assembly document, if an input operand is modified, it should be tied to a output operand. This patch can prevent compilers from reusing r0 register after asm statements. Signed-off-by: Antony Yu <swpenim@gmail.com> Reported-by: kernel test robot <lkp@intel.com> --- changed in v2 - add kernel-test-robot tag - fix build failure on big endian arch/arm/include/asm/div64.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h index 898e9c78a7e7..961a129eb41f 100644 --- a/arch/arm/include/asm/div64.h +++ b/arch/arm/include/asm/div64.h @@ -39,9 +39,10 @@ static inline uint32_t __div64_32(uint64_t *n, uint32_t base) asm( __asmeq("%0", __xh) __asmeq("%1", "r2") __asmeq("%2", "r0") - __asmeq("%3", "r4") + __asmeq("%3", "r0") + __asmeq("%4", "r4") "bl __do_div64" - : "=r" (__rem), "=r" (__res) + : "=r" (__rem), "=r" (__res), "=r" (__xl) : "r" (__n), "r" (__base) : "ip", "lr", "cc"); *n = __res; -- 2.29.0
WARNING: multiple messages have this Message-ID (diff)
From: Antony Yu <swpenim@gmail.com> To: Nick Desaulniers <ndesaulniers@google.com> Cc: swpenim@gmail.com, Russell King <linux@armlinux.org.uk>, LKML <linux-kernel@vger.kernel.org>, clang-built-linux <clang-built-linux@googlegroups.com>, Nathan Chancellor <natechancellor@gmail.com>, Linux ARM <linux-arm-kernel@lists.infradead.org> Subject: [PATCH v2] ARM: fix __div64_32() error when compiling with clang Date: Mon, 30 Nov 2020 16:20:32 +0800 [thread overview] Message-ID: <20201130082032.GA25739@penyung-VirtualBox> (raw) In-Reply-To: <CAKwvOdkE5-OBWjmGwc8qUkj5wuqZTmtYxaMD3sz+4+aNiC2vLg@mail.gmail.com> [-- Attachment #1: v2-0001-ARM-fix-__div64_32-error-when-compiling-with-clan.patch --] [-- Type: text/x-diff, Size: 1327 bytes --] From 3a4c19e09079324a625941ea3c16fe4b0df2ed86 Mon Sep 17 00:00:00 2001 From: Antony Yu <swpenim@gmail.com> Date: Mon, 9 Nov 2020 17:31:52 +0800 Subject: [PATCH v2] ARM: fix __div64_32() error when compiling with clang __do_div64 clobbers the input register r0 in little endian system. According to the inline assembly document, if an input operand is modified, it should be tied to a output operand. This patch can prevent compilers from reusing r0 register after asm statements. Signed-off-by: Antony Yu <swpenim@gmail.com> Reported-by: kernel test robot <lkp@intel.com> --- changed in v2 - add kernel-test-robot tag - fix build failure on big endian arch/arm/include/asm/div64.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h index 898e9c78a7e7..961a129eb41f 100644 --- a/arch/arm/include/asm/div64.h +++ b/arch/arm/include/asm/div64.h @@ -39,9 +39,10 @@ static inline uint32_t __div64_32(uint64_t *n, uint32_t base) asm( __asmeq("%0", __xh) __asmeq("%1", "r2") __asmeq("%2", "r0") - __asmeq("%3", "r4") + __asmeq("%3", "r0") + __asmeq("%4", "r4") "bl __do_div64" - : "=r" (__rem), "=r" (__res) + : "=r" (__rem), "=r" (__res), "=r" (__xl) : "r" (__n), "r" (__base) : "ip", "lr", "cc"); *n = __res; -- 2.29.0 [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-11-30 8:21 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-23 7:36 [RESEND,PATCH] ARM: fix __div64_32() error when compiling with clang Antony Yu 2020-11-23 7:36 ` Antony Yu 2020-11-23 18:16 ` Nathan Chancellor 2020-11-23 18:16 ` Nathan Chancellor 2020-11-24 7:42 ` Antony Yu 2020-11-24 10:14 ` Antony Yu 2020-11-24 10:14 ` [RESEND, PATCH] " Antony Yu 2020-11-24 21:06 ` [RESEND,PATCH] " Nick Desaulniers 2020-11-24 21:06 ` [RESEND, PATCH] " Nick Desaulniers 2020-11-30 8:20 ` Antony Yu [this message] 2020-11-30 8:20 ` [PATCH v2] " Antony Yu 2020-11-24 23:16 ` [RESEND,PATCH] " kernel test robot 2020-11-24 23:16 ` [RESEND, PATCH] " kernel test robot 2020-11-24 23:16 ` [RESEND,PATCH] " kernel test robot 2020-11-30 10:11 ` Ard Biesheuvel 2020-11-30 10:11 ` [RESEND, PATCH] " Ard Biesheuvel 2020-11-30 10:12 ` [RESEND,PATCH] " Ard Biesheuvel 2020-11-30 10:12 ` [RESEND, PATCH] " Ard Biesheuvel 2020-11-30 10:21 ` [RESEND,PATCH] " Russell King - ARM Linux admin 2020-11-30 10:21 ` Russell King - ARM Linux admin 2020-11-30 10:40 ` Ard Biesheuvel 2020-11-30 10:40 ` [RESEND, PATCH] " Ard Biesheuvel 2020-11-30 13:58 ` [RESEND,PATCH] " David Laight 2020-11-30 13:58 ` David Laight 2020-11-30 14:18 ` Russell King - ARM Linux admin 2020-11-30 14:18 ` Russell King - ARM Linux admin 2020-11-30 15:50 ` Nicolas Pitre 2020-11-30 15:50 ` Nicolas Pitre 2020-11-30 17:18 ` Ard Biesheuvel 2020-11-30 17:18 ` [RESEND, PATCH] " Ard Biesheuvel 2020-11-30 17:52 ` [RESEND,PATCH] " Nicolas Pitre 2020-11-30 17:52 ` Nicolas Pitre 2020-11-30 18:08 ` Ard Biesheuvel 2020-11-30 18:08 ` [RESEND, PATCH] " Ard Biesheuvel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201130082032.GA25739@penyung-VirtualBox \ --to=swpenim@gmail.com \ --cc=clang-built-linux@googlegroups.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=natechancellor@gmail.com \ --cc=ndesaulniers@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.