All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: <linux-mips@linux-mips.org>
Subject: Re: [PATCH 1/2] MIPS: Makefile: Set correct ISA level for MIPS ASEs
Date: Fri, 30 Jan 2015 16:27:00 +0000	[thread overview]
Message-ID: <54CBB0D4.1040506@imgtec.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1501301606470.28301@eddie.linux-mips.org>

On 01/30/2015 04:20 PM, Maciej W. Rozycki wrote:
> On Fri, 30 Jan 2015, Markos Chandras wrote:
> 
>> @@ -131,14 +131,14 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= $(shell $(CC) -dumpmachine |grep -q 'mips.
>>  # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
>>  # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
>>  # been fixed properly.
>> -cflags-$(CONFIG_CPU_HAS_SMARTMIPS)	+= $(call cc-option,-msmartmips) -Wa,--no-warn
>> -cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips)
>> +cflags-$(CONFIG_CPU_HAS_SMARTMIPS)	+= $(call cc-option,-march=mips32r2 -msmartmips) -Wa,--no-warn
>> +cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-march=mips32r2 -mmicromips)
> 
>  The SmartMIPS ASE has been there since r1, e.g. the 4KSd core so you want 
> to allow `-march=mips32', but also `-march=mips32r2' if running on earlier 
> processors is not needed.
> 
>  I think to ensure the right ISA option has been selected it will be the 
> best to make it happen in Kconfig, by making CPU_HAS_SMARTMIPS and 
> CPU_MICROMIPS depend on the right CPU selection option.  Have you 
> considered such an approach (and disregarded it for some reason)?

I considered it but i thought passing something sane to $(call
cc-option) might be preferred. What I am trying to do here is to ensure
the $(call cc-option) will not fail in case your toolchain really
supports micromips or smartmips but when combined with a bad default it
simply fails

> 
>>  
>>  cflags-$(CONFIG_SB1XXX_CORELIS)	+= $(call cc-option,-mno-sched-prolog) \
>>  				   -fno-omit-frame-pointer
>>  
>>  ifeq ($(CONFIG_CPU_HAS_MSA),y)
>> -toolchain-msa	:= $(call cc-option-yn,-mhard-float -mfp64 -Wa$(comma)-mmsa)
>> +toolchain-msa	:= $(call cc-option-yn,-march=mips32r2 -mhard-float -mfp64 -Wa$(comma)-mmsa)
>>  cflags-$(toolchain-msa)		+= -DTOOLCHAIN_SUPPORTS_MSA
>>  endif
> 
>  Similarly here, is CPU_HAS_MSA incompatible with `-march=mips64r2'?
I am not sure but like I explained above, it does not have to be 100%
accurate. Just something to keep your toolchain happy and really enable
MSA support even if you happen and old ISA level as the default one for
your toolchain.

for example, if your toolchain has -march=mips2 as default then

-mhard-float -mfp64 will fail

but

-march=mips32r2 -mhard-float -mfp64

will pass. Your toolchain does support MSA, but because you combined the
check with incompatible flags, then the end result is not what you want.

I am open to suggestions if you want to solve this in a better way.

-- 
markos

WARNING: multiple messages have this Message-ID (diff)
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH 1/2] MIPS: Makefile: Set correct ISA level for MIPS ASEs
Date: Fri, 30 Jan 2015 16:27:00 +0000	[thread overview]
Message-ID: <54CBB0D4.1040506@imgtec.com> (raw)
Message-ID: <20150130162700.5wvUDd_L6gVF8mmoiOrlDtpw0a0-DAcUwsPdc-Rdx8c@z> (raw)
In-Reply-To: <alpine.LFD.2.11.1501301606470.28301@eddie.linux-mips.org>

On 01/30/2015 04:20 PM, Maciej W. Rozycki wrote:
> On Fri, 30 Jan 2015, Markos Chandras wrote:
> 
>> @@ -131,14 +131,14 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= $(shell $(CC) -dumpmachine |grep -q 'mips.
>>  # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
>>  # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
>>  # been fixed properly.
>> -cflags-$(CONFIG_CPU_HAS_SMARTMIPS)	+= $(call cc-option,-msmartmips) -Wa,--no-warn
>> -cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips)
>> +cflags-$(CONFIG_CPU_HAS_SMARTMIPS)	+= $(call cc-option,-march=mips32r2 -msmartmips) -Wa,--no-warn
>> +cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-march=mips32r2 -mmicromips)
> 
>  The SmartMIPS ASE has been there since r1, e.g. the 4KSd core so you want 
> to allow `-march=mips32', but also `-march=mips32r2' if running on earlier 
> processors is not needed.
> 
>  I think to ensure the right ISA option has been selected it will be the 
> best to make it happen in Kconfig, by making CPU_HAS_SMARTMIPS and 
> CPU_MICROMIPS depend on the right CPU selection option.  Have you 
> considered such an approach (and disregarded it for some reason)?

I considered it but i thought passing something sane to $(call
cc-option) might be preferred. What I am trying to do here is to ensure
the $(call cc-option) will not fail in case your toolchain really
supports micromips or smartmips but when combined with a bad default it
simply fails

> 
>>  
>>  cflags-$(CONFIG_SB1XXX_CORELIS)	+= $(call cc-option,-mno-sched-prolog) \
>>  				   -fno-omit-frame-pointer
>>  
>>  ifeq ($(CONFIG_CPU_HAS_MSA),y)
>> -toolchain-msa	:= $(call cc-option-yn,-mhard-float -mfp64 -Wa$(comma)-mmsa)
>> +toolchain-msa	:= $(call cc-option-yn,-march=mips32r2 -mhard-float -mfp64 -Wa$(comma)-mmsa)
>>  cflags-$(toolchain-msa)		+= -DTOOLCHAIN_SUPPORTS_MSA
>>  endif
> 
>  Similarly here, is CPU_HAS_MSA incompatible with `-march=mips64r2'?
I am not sure but like I explained above, it does not have to be 100%
accurate. Just something to keep your toolchain happy and really enable
MSA support even if you happen and old ISA level as the default one for
your toolchain.

for example, if your toolchain has -march=mips2 as default then

-mhard-float -mfp64 will fail

but

-march=mips32r2 -mhard-float -mfp64

will pass. Your toolchain does support MSA, but because you combined the
check with incompatible flags, then the end result is not what you want.

I am open to suggestions if you want to solve this in a better way.

-- 
markos

  reply	other threads:[~2015-01-30 16:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 14:44 [PATCH 1/2] MIPS: Makefile: Set correct ISA level for MIPS ASEs Markos Chandras
2015-01-30 14:44 ` Markos Chandras
2015-01-30 14:44 ` [PATCH 2/2] MIPS: Makefile: Set default ISA level Markos Chandras
2015-01-30 14:44   ` Markos Chandras
2015-01-30 16:37   ` Maciej W. Rozycki
2015-01-30 16:52     ` Markos Chandras
2015-01-30 16:52       ` Markos Chandras
2015-01-30 17:11       ` Maciej W. Rozycki
2015-01-30 16:20 ` [PATCH 1/2] MIPS: Makefile: Set correct ISA level for MIPS ASEs Maciej W. Rozycki
2015-01-30 16:27   ` Markos Chandras [this message]
2015-01-30 16:27     ` Markos Chandras
2015-01-30 16:50     ` Maciej W. Rozycki
2015-01-30 16:53       ` Markos Chandras
2015-01-30 16:53         ` Markos Chandras
2015-01-30 17:13         ` Maciej W. Rozycki

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=54CBB0D4.1040506@imgtec.com \
    --to=markos.chandras@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    /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: link
Be 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.