Message ID | 20200604173927.23127-2-Eugeniy.Paltsev@synopsys.com |
---|---|
State | New |
Headers | show |
Series | ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board | expand |
On 6/4/20 10:39 AM, Eugeniy Paltsev wrote: > Kernel builds set their own default -mcpu for a given ISA build. > But that gets in the way of "custom" -mcpu flags from propagating > into kernel build. > > This will also be used in next patches for HSDK-4xD board support which > uses a different -mcpu to effect dual issue scheduling. > > Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Much better. Ack with nit below. > --- > arch/arc/Kconfig | 9 +++++++++ > arch/arc/Makefile | 21 +++++++++++++++++++-- > 2 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig > index ff306246d0f8..7034c217708f 100644 > --- a/arch/arc/Kconfig > +++ b/arch/arc/Kconfig > @@ -377,6 +377,15 @@ config ARC_HAS_SWAPE > bool "Insn: SWAPE (endian-swap)" > default y > > +config ARC_TUNE_MCPU > + string "Override default -mcpu compiler flag" > + default "" > + help > + Override default -mcpu=xxx compiler flag (which is set depending on > + the ISA version) with the specified value. > + NOTE: If specified flag isn't supported by current compiler the > + ISA default value will be used as a fallback. > + > if ISA_ARCV2 > > config ARC_USE_UNALIGNED_MEM_ACCESS > diff --git a/arch/arc/Makefile b/arch/arc/Makefile > index 20e9ab6cc521..2b66e8264174 100644 > --- a/arch/arc/Makefile > +++ b/arch/arc/Makefile > @@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) > endif > > cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ > -cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 > -cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38 > + > +tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mA7 > +tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38 > + > +ifeq ($(CONFIG_ARC_TUNE_MCPU),"") > +cflags-y += $(tune-mcpu-def-y) > +else > +tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) > +tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) > +ifeq ($(tune-mcpu-ok),y) > +cflags-y += $(tune-mcpu) > +else > +# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler > +# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option. It is obvious what is done here and the comments can be skipped (no need to repost). > +$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)') > +cflags-y += $(tune-mcpu-def-y) > +endif > +endif -Vineet
Hi Eugeniy, A couple of minor notes below. > -----Original Message----- > From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> > Sent: Thursday, June 4, 2020 8:39 PM > To: linux-snps-arc@lists.infradead.org; Vineet Gupta <vgupta@synopsys.com> > Cc: linux-kernel@vger.kernel.org; Alexey Brodkin <abrodkin@synopsys.com>; Eugeniy Paltsev > <paltsev@synopsys.com> > Subject: [PATCH v2 1/4] ARC: allow to override default mcpu compiler flag > > Kernel builds set their own default -mcpu for a given ISA build. We used to use a default "-mcpu" per ARC ISA version (one for ARCompact and one for ARCv2). > But that gets in the way of "custom" -mcpu flags from propagating > into kernel build. But with more versions of CPUs & SoCs becoming available we want to be able to fine-tune generated code more precise. > This will also be used in next patches for HSDK-4xD board support which > uses a different -mcpu to effect dual issue scheduling. "...for utilization of the new CPU's dual-issue capabilities"? > +++ b/arch/arc/Makefile > @@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) > endif > > cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ > -cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 > -cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38 > + > +tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mA7 I'd suggest to either swap "-mA7" which is being obsoleted with "-mcpu=arc700" right here or as a separate change, otherwise we may soon get ATC700 builds broken with newer compilers. -Alexey
On 6/5/20 3:47 AM, Alexey Brodkin wrote: > Hi Eugeniy, > > A couple of minor notes below. > >> -----Original Message----- >> From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> >> Sent: Thursday, June 4, 2020 8:39 PM >> To: linux-snps-arc@lists.infradead.org; Vineet Gupta <vgupta@synopsys.com> >> Cc: linux-kernel@vger.kernel.org; Alexey Brodkin <abrodkin@synopsys.com>; Eugeniy Paltsev >> <paltsev@synopsys.com> >> Subject: [PATCH v2 1/4] ARC: allow to override default mcpu compiler flag >> >> Kernel builds set their own default -mcpu for a given ISA build. > > We used to use a default "-mcpu" per ARC ISA version (one for ARCompact > and one for ARCv2). > >> But that gets in the way of "custom" -mcpu flags from propagating >> into kernel build. > > But with more versions of CPUs & SoCs becoming available we want to > be able to fine-tune generated code more precise. > >> This will also be used in next patches for HSDK-4xD board support which >> uses a different -mcpu to effect dual issue scheduling. > > "...for utilization of the new CPU's dual-issue capabilities"? > >> +++ b/arch/arc/Makefile >> @@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) >> endif >> >> cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ >> -cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 >> -cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38 >> + >> +tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mA7 > > I'd suggest to either swap "-mA7" which is being obsoleted with "-mcpu=arc700" > right here or as a separate change, otherwise we may soon get ATC700 builds > broken with newer compilers. FWIW I've added a modified variant of this patch to for-curr as we need it for ongoing ARC64 port as well. -Vineet
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index ff306246d0f8..7034c217708f 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -377,6 +377,15 @@ config ARC_HAS_SWAPE bool "Insn: SWAPE (endian-swap)" default y +config ARC_TUNE_MCPU + string "Override default -mcpu compiler flag" + default "" + help + Override default -mcpu=xxx compiler flag (which is set depending on + the ISA version) with the specified value. + NOTE: If specified flag isn't supported by current compiler the + ISA default value will be used as a fallback. + if ISA_ARCV2 config ARC_USE_UNALIGNED_MEM_ACCESS diff --git a/arch/arc/Makefile b/arch/arc/Makefile index 20e9ab6cc521..2b66e8264174 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile @@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) endif cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ -cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 -cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38 + +tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mA7 +tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38 + +ifeq ($(CONFIG_ARC_TUNE_MCPU),"") +cflags-y += $(tune-mcpu-def-y) +else +tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) +tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) +ifeq ($(tune-mcpu-ok),y) +cflags-y += $(tune-mcpu) +else +# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler +# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option. +$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)') +cflags-y += $(tune-mcpu-def-y) +endif +endif + ifdef CONFIG_ARC_CURR_IN_REG # For a global register defintion, make sure it gets passed to every file
Kernel builds set their own default -mcpu for a given ISA build. But that gets in the way of "custom" -mcpu flags from propagating into kernel build. This will also be used in next patches for HSDK-4xD board support which uses a different -mcpu to effect dual issue scheduling. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> --- arch/arc/Kconfig | 9 +++++++++ arch/arc/Makefile | 21 +++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-)