Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1661765 > unrolled thread

[PATCH 2/2] include: warn for inconsistent endian config definition

Started byBabu Moger <babu.moger@oracle.com>
First post2017-06-09 00:20 +0200
Last post2017-06-12 23:30 +0200
Articles 12 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] include: warn for inconsistent endian config definition Babu Moger <babu.moger@oracle.com> - 2017-06-09 00:20 +0200
    Re: [PATCH 2/2] include: warn for inconsistent endian config definition Geert Uytterhoeven <geert@linux-m68k.org> - 2017-06-09 09:10 +0200
      Re: [PATCH 2/2] include: warn for inconsistent endian config definition Geert Uytterhoeven <geert@linux-m68k.org> - 2017-06-09 09:20 +0200
        Re: [PATCH 2/2] include: warn for inconsistent endian config  definition Babu Moger <babu.moger@oracle.com> - 2017-06-09 16:00 +0200
          Re: [PATCH 2/2] include: warn for inconsistent endian config definition Geert Uytterhoeven <geert@linux-m68k.org> - 2017-06-09 16:20 +0200
            Re: [PATCH 2/2] include: warn for inconsistent endian config  definition Babu Moger <babu.moger@oracle.com> - 2017-06-09 16:50 +0200
    Re: [PATCH 2/2] include: warn for inconsistent endian config  definition kbuild test robot <lkp@intel.com> - 2017-06-10 16:10 +0200
      Re: [PATCH 2/2] include: warn for inconsistent endian config  definition Babu Moger <babu.moger@oracle.com> - 2017-06-12 22:40 +0200
        Re: [PATCH 2/2] include: warn for inconsistent endian config definition Max Filippov <jcmvbkbc@gmail.com> - 2017-06-12 23:00 +0200
          Re: [PATCH 2/2] include: warn for inconsistent endian config  definition Babu Moger <babu.moger@oracle.com> - 2017-06-12 23:40 +0200
        Re: [PATCH 2/2] include: warn for inconsistent endian config definition Arnd Bergmann <arnd@arndb.de> - 2017-06-12 23:00 +0200
          Re: [PATCH 2/2] include: warn for inconsistent endian config  definition Babu Moger <babu.moger@oracle.com> - 2017-06-12 23:30 +0200

#1661765 — [PATCH 2/2] include: warn for inconsistent endian config definition

FromBabu Moger <babu.moger@oracle.com>
Date2017-06-09 00:20 +0200
Subject[PATCH 2/2] include: warn for inconsistent endian config definition
Message-ID<tQdWz-1BJ-33@gated-at.bofh.it>
Display warning if CPU_BIG_ENDIAN is not defined on big endian
architecture and also warn if it defined on little endian architectures.

We have seen some generic code(for example code include/asm-generic/qrwlock.h)
uses CONFIG_CPU_BIG_ENDIAN to decide the endianess.

Here is the original discussion
http://www.spinics.net/lists/devicetree/msg178101.html

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/byteorder/big_endian.h    |    4 ++++
 include/linux/byteorder/little_endian.h |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index 3920414..ffd2159 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -3,5 +3,9 @@
 
 #include <uapi/linux/byteorder/big_endian.h>
 
+#ifndef CONFIG_CPU_BIG_ENDIAN
+#warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
+#endif
+
 #include <linux/byteorder/generic.h>
 #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index 0805737..ba910bb 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -3,5 +3,9 @@
 
 #include <uapi/linux/byteorder/little_endian.h>
 
+#ifdef CONFIG_CPU_BIG_ENDIAN
+#warning inconsistent configuration, CONFIG_CPU_BIG_ENDIAN is set
+#endif
+
 #include <linux/byteorder/generic.h>
 #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
-- 
1.7.1

[toc] | [next] | [standalone]


#1661995

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2017-06-09 09:10 +0200
Message-ID<tQmds-6TG-17@gated-at.bofh.it>
In reply to#1661765
On Fri, Jun 9, 2017 at 12:17 AM, Babu Moger <babu.moger@oracle.com> wrote:
> Display warning if CPU_BIG_ENDIAN is not defined on big endian
> architecture and also warn if it defined on little endian architectures.
>
> We have seen some generic code(for example code include/asm-generic/qrwlock.h)
> uses CONFIG_CPU_BIG_ENDIAN to decide the endianess.

That example is IMHO the least harmful, as qrwlock must be selected explicitly
by the architecture.

The uses in

    drivers/of/base.c
    drivers/of/fdt.c
    drivers/tty/serial/earlycon.c
    drivers/tty/serial/serial_core.c

are more dangerous, and may have bitten people already.
In addition, people may have worked around them in DT, so this series may
actually introduce regressions.

> Here is the original discussion
> http://www.spinics.net/lists/devicetree/msg178101.html
>
> Signed-off-by: Babu Moger <babu.moger@oracle.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>

Hmm, the link above refers to a mail from me? ;-)

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

[toc] | [prev] | [next] | [standalone]


#1662002

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2017-06-09 09:20 +0200
Message-ID<tQmn7-6YU-5@gated-at.bofh.it>
In reply to#1661995
Hi Babu,

On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
>> Here is the original discussion
>> http://www.spinics.net/lists/devicetree/msg178101.html
>>
>> Signed-off-by: Babu Moger <babu.moger@oracle.com>
>> Suggested-by: Arnd Bergmann <arnd@arndb.de>
>
> Hmm, the link above refers to a mail from me? ;-)

Please ignore that comment. I accidentally copied one line too much
from the other reply.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

[toc] | [prev] | [next] | [standalone]


#1662446 — Re: [PATCH 2/2] include: warn for inconsistent endian config definition

FromBabu Moger <babu.moger@oracle.com>
Date2017-06-09 16:00 +0200
SubjectRe: [PATCH 2/2] include: warn for inconsistent endian config definition
Message-ID<tQsCe-2cm-7@gated-at.bofh.it>
In reply to#1662002
Geert,

On 6/9/2017 2:16 AM, Geert Uytterhoeven wrote:
> Hi Babu,
>
> On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>> Here is the original discussion
>>> http://www.spinics.net/lists/devicetree/msg178101.html
>>>
>>> Signed-off-by: Babu Moger <babu.moger@oracle.com>
>>> Suggested-by: Arnd Bergmann <arnd@arndb.de>
>> Hmm, the link above refers to a mail from me? ;-)
> Please ignore that comment. I accidentally copied one line too much
> from the other reply.

Yes. Got it.  So patch #1 is fine.   But, patch #2 might cause 
regressions. Should I drop patch 2.

>
> Gr{oetje,eeting}s,
>
>                          Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds

[toc] | [prev] | [next] | [standalone]


#1662494

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2017-06-09 16:20 +0200
Message-ID<tQsVA-2Cx-11@gated-at.bofh.it>
In reply to#1662446
Hi Babu,

On Fri, Jun 9, 2017 at 3:55 PM, Babu Moger <babu.moger@oracle.com> wrote:
> On 6/9/2017 2:16 AM, Geert Uytterhoeven wrote:
>> On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven <geert@linux-m68k.org>
>> wrote:
>>>> Here is the original discussion
>>>> http://www.spinics.net/lists/devicetree/msg178101.html
>>>>
>>>> Signed-off-by: Babu Moger <babu.moger@oracle.com>
>>>> Suggested-by: Arnd Bergmann <arnd@arndb.de>

> Yes. Got it.  So patch #1 is fine.   But, patch #2 might cause regressions.
> Should I drop patch 2.

No, it should be applied, and regressions should be fixed.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

[toc] | [prev] | [next] | [standalone]


#1662538 — Re: [PATCH 2/2] include: warn for inconsistent endian config definition

FromBabu Moger <babu.moger@oracle.com>
Date2017-06-09 16:50 +0200
SubjectRe: [PATCH 2/2] include: warn for inconsistent endian config definition
Message-ID<tQtoC-2MZ-19@gated-at.bofh.it>
In reply to#1662494
On 6/9/2017 9:11 AM, Geert Uytterhoeven wrote:
> Hi Babu,
>
> On Fri, Jun 9, 2017 at 3:55 PM, Babu Moger <babu.moger@oracle.com> wrote:
>> On 6/9/2017 2:16 AM, Geert Uytterhoeven wrote:
>>> On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven <geert@linux-m68k.org>
>>> wrote:
>>>>> Here is the original discussion
>>>>> http://www.spinics.net/lists/devicetree/msg178101.html
>>>>>
>>>>> Signed-off-by: Babu Moger <babu.moger@oracle.com>
>>>>> Suggested-by: Arnd Bergmann <arnd@arndb.de>
>> Yes. Got it.  So patch #1 is fine.   But, patch #2 might cause regressions.
>> Should I drop patch 2.
> No, it should be applied, and regressions should be fixed.

Geert,  Ok. Sure. I will resubmit the patch mentioning all the 
files(base.c, fdt.c etc..) that are affected by this change.
thanks
> Gr{oetje,eeting}s,
>
>                          Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds

[toc] | [prev] | [next] | [standalone]


#1662961 — Re: [PATCH 2/2] include: warn for inconsistent endian config definition

Fromkbuild test robot <lkp@intel.com>
Date2017-06-10 16:10 +0200
SubjectRe: [PATCH 2/2] include: warn for inconsistent endian config definition
Message-ID<tQPfr-84G-9@gated-at.bofh.it>
In reply to#1661765

[Multipart message — attachments visible in raw view] — view raw

Hi Babu,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.12-rc4 next-20170609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Babu-Moger/Define-CPU_BIG_ENDIAN-or-warn-for-inconsistencies/20170610-200424
config: microblaze-mmu_defconfig (attached as .config)
compiler: microblaze-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=microblaze 

All warnings (new ones prefixed by >>):

   In file included from arch/microblaze/include/uapi/asm/byteorder.h:7:0,
                    from include/asm-generic/bitops/le.h:5,
                    from include/asm-generic/bitops.h:34,
                    from arch/microblaze/include/asm/bitops.h:1,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/asm-generic/bug.h:15,
                    from arch/microblaze/include/asm/bug.h:1,
                    from include/linux/bug.h:4,
                    from include/linux/page-flags.h:9,
                    from kernel/bounds.c:9:
>> include/linux/byteorder/big_endian.h:7:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
    #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
     ^~~~~~~
--
   In file included from arch/microblaze/include/uapi/asm/byteorder.h:7:0,
                    from include/asm-generic/bitops/le.h:5,
                    from include/asm-generic/bitops.h:34,
                    from arch/microblaze/include/asm/bitops.h:1,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/asm-generic/bug.h:15,
                    from arch/microblaze/include/asm/bug.h:1,
                    from include/linux/bug.h:4,
                    from include/linux/page-flags.h:9,
                    from kernel/bounds.c:9:
>> include/linux/byteorder/big_endian.h:7:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
    #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
     ^~~~~~~
   In file included from arch/microblaze/include/uapi/asm/byteorder.h:7:0,
                    from include/asm-generic/bitops/le.h:5,
                    from include/asm-generic/bitops.h:34,
                    from arch/microblaze/include/asm/bitops.h:1,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/rculist.h:9,
                    from include/linux/pid.h:4,
                    from include/linux/sched.h:13,
                    from arch/microblaze/kernel/asm-offsets.c:13:
>> include/linux/byteorder/big_endian.h:7:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
    #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
     ^~~~~~~
   <stdin>:1326:2: warning: #warning syscall statx not implemented [-Wcpp]

vim +7 include/linux/byteorder/big_endian.h

     1	#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
     2	#define _LINUX_BYTEORDER_BIG_ENDIAN_H
     3	
     4	#include <uapi/linux/byteorder/big_endian.h>
     5	
     6	#ifndef CONFIG_CPU_BIG_ENDIAN
   > 7	#warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
     8	#endif
     9	
    10	#include <linux/byteorder/generic.h>
    11	#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1664211 — Re: [PATCH 2/2] include: warn for inconsistent endian config definition

FromBabu Moger <babu.moger@oracle.com>
Date2017-06-12 22:40 +0200
SubjectRe: [PATCH 2/2] include: warn for inconsistent endian config definition
Message-ID<tREhX-71h-17@gated-at.bofh.it>
In reply to#1662961
Hi All,

On 6/10/2017 9:06 AM, kbuild test robot wrote:
> Hi Babu,
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.12-rc4 next-20170609]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Babu-Moger/Define-CPU_BIG_ENDIAN-or-warn-for-inconsistencies/20170610-200424
> config: microblaze-mmu_defconfig (attached as .config)
> compiler: microblaze-linux-gcc (GCC) 6.2.0
> reproduce:
>          wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # save the attached .config to linux build tree
>          make.cross ARCH=microblaze
>
> All warnings (new ones prefixed by >>):
>
>     In file included from arch/microblaze/include/uapi/asm/byteorder.h:7:0,
>                      from include/asm-generic/bitops/le.h:5,
>                      from include/asm-generic/bitops.h:34,
>                      from arch/microblaze/include/asm/bitops.h:1,
>                      from include/linux/bitops.h:36,
>                      from include/linux/kernel.h:10,
>                      from include/asm-generic/bug.h:15,
>                      from arch/microblaze/include/asm/bug.h:1,
>                      from include/linux/bug.h:4,
>                      from include/linux/page-flags.h:9,
>                      from kernel/bounds.c:9:
>>> include/linux/byteorder/big_endian.h:7:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
>      #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
>       ^~~~~~~
> --
>     In file included from arch/microblaze/include/uapi/asm/byteorder.h:7:0,
>                      from include/asm-generic/bitops/le.h:5,
>                      from include/asm-generic/bitops.h:34,
>                      from arch/microblaze/include/asm/bitops.h:1,
>                      from include/linux/bitops.h:36,
>                      from include/linux/kernel.h:10,
>                      from include/asm-generic/bug.h:15,
>                      from arch/microblaze/include/asm/bug.h:1,
>                      from include/linux/bug.h:4,
>                      from include/linux/page-flags.h:9,
>                      from kernel/bounds.c:9:
>>> include/linux/byteorder/big_endian.h:7:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
>      #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
>       ^~~~~~~
>     In file included from arch/microblaze/include/uapi/asm/byteorder.h:7:0,
>                      from include/asm-generic/bitops/le.h:5,
>                      from include/asm-generic/bitops.h:34,
>                      from arch/microblaze/include/asm/bitops.h:1,
>                      from include/linux/bitops.h:36,
>                      from include/linux/kernel.h:10,
>                      from include/linux/list.h:8,
>                      from include/linux/rculist.h:9,
>                      from include/linux/pid.h:4,
>                      from include/linux/sched.h:13,
>                      from arch/microblaze/kernel/asm-offsets.c:13:
>>> include/linux/byteorder/big_endian.h:7:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
>      #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
>       ^~~~~~~
>     <stdin>:1326:2: warning: #warning syscall statx not implemented [-Wcpp]
>
> vim +7 include/linux/byteorder/big_endian.h
>
>       1	#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
>       2	#define _LINUX_BYTEORDER_BIG_ENDIAN_H
>       3	
>       4	#include <uapi/linux/byteorder/big_endian.h>
>       5	
>       6	#ifndef CONFIG_CPU_BIG_ENDIAN
>     > 7	#warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
>       8	#endif
>       9	
>      10	#include <linux/byteorder/generic.h>
>      11	#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Looks like microblaze can be configured to either little or big endian 
formats.  How about
adding a choice statement to address this.
Here is my proposed patch.
=======================================
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 85885a5..74aa5de 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -35,6 +35,22 @@ config MICROBLAZE
         select VIRT_TO_BUS
         select CPU_NO_EFFICIENT_FFS

+# Endianness selection
+choice
+       prompt "Endianness selection"
+       default CPU_BIG_ENDIAN
+       help
+         microblaze architectures can be configured for either little or
+         big endian formats. Be sure to select the appropriate mode.
+
+config CPU_BIG_ENDIAN
+       bool "Big endian"
+
+config CPU_LITTLE_ENDIAN
+       bool "Little endian"
+
+endchoice
+
  config SWAP
         def_bool n

[toc] | [prev] | [next] | [standalone]


#1664217

FromMax Filippov <jcmvbkbc@gmail.com>
Date2017-06-12 23:00 +0200
Message-ID<tREBk-77B-3@gated-at.bofh.it>
In reply to#1664211
On Mon, Jun 12, 2017 at 1:51 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> That way, we don't have to guess what the toolchain does, but rather
> tell it to do whatever is configured, like we do for most other architectures.
>
> Unfortunately we can't do the same thing on xtensa, as that no longer
> supports the -mbig-endian/-mbig-endian flags in any recent gcc version
> (a long time ago it had them, but they were removed along with many other
> options).

For xtensa we probably need to generate Kconfig fragment that would go
in with the variant subdirectory. That will solve this, and clean up other
options that we currently have for manual selection for xtensa, but there's
actually no choice, i.e. the option has to be selected correctly, there's only
one correct choice and otherwise the kernel either won't build or won't work.
I'll look into it.

-- 
Thanks.
-- Max

[toc] | [prev] | [next] | [standalone]


#1664250 — Re: [PATCH 2/2] include: warn for inconsistent endian config definition

FromBabu Moger <babu.moger@oracle.com>
Date2017-06-12 23:40 +0200
SubjectRe: [PATCH 2/2] include: warn for inconsistent endian config definition
Message-ID<tRFe1-7zG-9@gated-at.bofh.it>
In reply to#1664217
On 6/12/2017 3:58 PM, Max Filippov wrote:
> On Mon, Jun 12, 2017 at 1:51 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> That way, we don't have to guess what the toolchain does, but rather
>> tell it to do whatever is configured, like we do for most other architectures.
>>
>> Unfortunately we can't do the same thing on xtensa, as that no longer
>> supports the -mbig-endian/-mbig-endian flags in any recent gcc version
>> (a long time ago it had them, but they were removed along with many other
>> options).
> For xtensa we probably need to generate Kconfig fragment that would go
> in with the variant subdirectory. That will solve this, and clean up other
> options that we currently have for manual selection for xtensa, but there's
> actually no choice, i.e. the option has to be selected correctly, there's only
> one correct choice and otherwise the kernel either won't build or won't work.
> I'll look into it.
Max. Thanks. Please update us when you are done.
>

[toc] | [prev] | [next] | [standalone]


#1664223

FromArnd Bergmann <arnd@arndb.de>
Date2017-06-12 23:00 +0200
Message-ID<tREBk-77B-5@gated-at.bofh.it>
In reply to#1664211
On Mon, Jun 12, 2017 at 10:30 PM, Babu Moger <babu.moger@oracle.com> wrote:
>
> Looks like microblaze can be configured to either little or big endian
> formats.  How about
> adding a choice statement to address this.
> Here is my proposed patch.

Hi Babu,

This part looks fine, but I think we also need this one:

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 740f2b82a182..1f6c486826a0 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -35,6 +35,8 @@ endif
 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
+CPUFLAGS-$(CONFIG_BIG_ENDIAN) += -mbig-endian
+CPUFLAGS-$(CONFIG_LITTLE_ENDIAN) += -mlittle-endian

 CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))


That way, we don't have to guess what the toolchain does, but rather
tell it to do whatever is configured, like we do for most other architectures.

Unfortunately we can't do the same thing on xtensa, as that no longer
supports the -mbig-endian/-mbig-endian flags in any recent gcc version
(a long time ago it had them, but they were removed along with many other
options).

        Arnd

[toc] | [prev] | [next] | [standalone]


#1664243 — Re: [PATCH 2/2] include: warn for inconsistent endian config definition

FromBabu Moger <babu.moger@oracle.com>
Date2017-06-12 23:30 +0200
SubjectRe: [PATCH 2/2] include: warn for inconsistent endian config definition
Message-ID<tRF4m-7wC-7@gated-at.bofh.it>
In reply to#1664223
On 6/12/2017 3:51 PM, Arnd Bergmann wrote:
> On Mon, Jun 12, 2017 at 10:30 PM, Babu Moger <babu.moger@oracle.com> wrote:
>> Looks like microblaze can be configured to either little or big endian
>> formats.  How about
>> adding a choice statement to address this.
>> Here is my proposed patch.
> Hi Babu,
>
> This part looks fine, but I think we also need this one:
>
> diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
> index 740f2b82a182..1f6c486826a0 100644
> --- a/arch/microblaze/Makefile
> +++ b/arch/microblaze/Makefile
> @@ -35,6 +35,8 @@ endif
>   CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
>   CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
>   CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
> +CPUFLAGS-$(CONFIG_BIG_ENDIAN) += -mbig-endian
> +CPUFLAGS-$(CONFIG_LITTLE_ENDIAN) += -mlittle-endian
>
>   CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
>
>
> That way, we don't have to guess what the toolchain does, but rather
> tell it to do whatever is configured, like we do for most other architectures.

Ok. Thanks. Arnd. Will update and resend the series.

>
> Unfortunately we can't do the same thing on xtensa, as that no longer
> supports the -mbig-endian/-mbig-endian flags in any recent gcc version
> (a long time ago it had them, but they were removed along with many other
> options).
>
>          Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web