2020-06-04 17:43:16

by Eugeniy Paltsev

[permalink] [raw]
Subject: [PATCH v2 0/4] ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board

Changes v1->v2:
* Fallback to ISA default mcpu flag if custom one isn't supported by
compiler.
* Drop HSDK custom Kconfig options (choose between HSDK and HSDK-4xD) as
we don't need it (at least for now). Instead we select ARC_LPB_DISABLE
for both boards but it's totally OK as HSDK doesn't have LPB so
disabling will be skipped by BCR check in runtime.
* Add missing HSDK-4xD device tree bindings. Convert HSDK device tree
bindings to json-schema.

Eugeniy Paltsev (4):
ARC: allow to override default mcpu compiler flag
ARC: ARCv2: support loop buffer (LPB) disabling
ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board
ARC: [plat-hsdk*] document HSDK-4xD board/SoC bindings

.../devicetree/bindings/arc/hsdk.txt | 7 -
.../devicetree/bindings/arc/hsdk.yaml | 26 ++
arch/arc/Kconfig | 15 +
arch/arc/Makefile | 21 +-
arch/arc/boot/dts/hsdk-4xd.dts | 322 ++++++++++++++++++
arch/arc/configs/hsdk_4xd_defconfig | 98 ++++++
arch/arc/kernel/devtree.c | 1 +
arch/arc/kernel/head.S | 8 +
arch/arc/plat-hsdk/Kconfig | 3 +-
arch/arc/plat-hsdk/platform.c | 1 +
10 files changed, 492 insertions(+), 10 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/arc/hsdk.txt
create mode 100644 Documentation/devicetree/bindings/arc/hsdk.yaml
create mode 100644 arch/arc/boot/dts/hsdk-4xd.dts
create mode 100644 arch/arc/configs/hsdk_4xd_defconfig

--
2.21.3


2020-06-04 19:02:54

by Eugeniy Paltsev

[permalink] [raw]
Subject: [PATCH v2 4/4] ARC: [plat-hsdk*] document HSDK-4xD board/SoC bindings

Add documentation for HSDK-4xD board/SoC bindings. While I'm at it
convert HSDK board/SoC bindings to DT schema format using
json-schema.

Cc: Rob Herring <[email protected]>
Signed-off-by: Eugeniy Paltsev <[email protected]>
---
.../devicetree/bindings/arc/hsdk.txt | 7 -----
.../devicetree/bindings/arc/hsdk.yaml | 26 +++++++++++++++++++
2 files changed, 26 insertions(+), 7 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/arc/hsdk.txt
create mode 100644 Documentation/devicetree/bindings/arc/hsdk.yaml

diff --git a/Documentation/devicetree/bindings/arc/hsdk.txt b/Documentation/devicetree/bindings/arc/hsdk.txt
deleted file mode 100644
index be50654bbf61..000000000000
--- a/Documentation/devicetree/bindings/arc/hsdk.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Synopsys DesignWare ARC HS Development Kit Device Tree Bindings
----------------------------------------------------------------------------
-
-ARC HSDK Board with quad-core ARC HS38x4 in silicon.
-
-Required root node properties:
- - compatible = "snps,hsdk";
diff --git a/Documentation/devicetree/bindings/arc/hsdk.yaml b/Documentation/devicetree/bindings/arc/hsdk.yaml
new file mode 100644
index 000000000000..3a269423b3d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/arc/hsdk.yaml
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arc/hsdk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare ARC HS Development Kits device tree bindings.
+
+maintainers:
+ - Eugeniy Paltsev <[email protected]>
+
+properties:
+ $nodename:
+ const: '/'
+ compatible:
+ oneOf:
+ - description: ARC HS Development Kit based on quad core ARC HS38
+ processor in silicon
+ items:
+ - const: snps,hsdk
+ - description: ARC HS4x/HS4xD Development Kit based on quad core
+ ARC HS48/HS47D processor in silicon
+ items:
+ - const: snps,hsdk-4xd
+
+...
--
2.21.3

2020-06-04 21:41:48

by Vineet Gupta

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board

On 6/4/20 10:39 AM, Eugeniy Paltsev wrote:
> Changes v1->v2:
> * Fallback to ISA default mcpu flag if custom one isn't supported by
> compiler.
> * Drop HSDK custom Kconfig options (choose between HSDK and HSDK-4xD) as
> we don't need it (at least for now). Instead we select ARC_LPB_DISABLE
> for both boards but it's totally OK as HSDK doesn't have LPB so
> disabling will be skipped by BCR check in runtime.
> * Add missing HSDK-4xD device tree bindings. Convert HSDK device tree
> bindings to json-schema.
>
> Eugeniy Paltsev (4):
> ARC: allow to override default mcpu compiler flag
> ARC: ARCv2: support loop buffer (LPB) disabling
> ARC: [plat-hsdk-4xd] initial port for HSDK-4xD board
> ARC: [plat-hsdk*] document HSDK-4xD board/SoC bindings

LTGM overall. Dropping of new Kconfig items is nice too.

-Vineet

2020-06-04 22:23:33

by Eugeniy Paltsev

[permalink] [raw]
Subject: [PATCH v2 2/4] ARC: ARCv2: support loop buffer (LPB) disabling

On HS cores, loop buffer (LPB) is programmable in runtime and can
be optionally disabled.

Signed-off-by: Eugeniy Paltsev <[email protected]>
---
arch/arc/Kconfig | 6 ++++++
arch/arc/kernel/head.S | 8 ++++++++
2 files changed, 14 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7034c217708f..2dc142c8e1f5 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -473,6 +473,12 @@ config ARC_IRQ_NO_AUTOSAVE
This is programmable and can be optionally disabled in which case
software INTERRUPT_PROLOGUE/EPILGUE do the needed work

+config ARC_LPB_DISABLE
+ bool "Disable loop buffer (LPB)"
+ help
+ On HS cores, loop buffer (LPB) is programmable in runtime and can
+ be optionally disabled.
+
endif # ISA_ARCV2

endmenu # "ARC CPU Configuration"
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 6eb23f1545ee..17fd1ed700cc 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -59,6 +59,14 @@
bclr r5, r5, STATUS_AD_BIT
#endif
kflag r5
+
+#ifdef CONFIG_ARC_LPB_DISABLE
+ lr r5, [ARC_REG_LPB_BUILD]
+ breq r5, 0, 1f ; LPB doesn't exist
+ mov r5, 1
+ sr r5, [ARC_REG_LPB_CTRL]
+1:
+#endif /* CONFIG_ARC_LPB_DISABLE */
#endif
; Config DSP_CTRL properly, so kernel may use integer multiply,
; multiply-accumulate, and divide operations
--
2.21.3

2020-06-04 22:23:33

by Eugeniy Paltsev

[permalink] [raw]
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.
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 <[email protected]>
---
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.
+$(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
--
2.21.3

2020-06-05 10:52:32

by Alexey Brodkin

[permalink] [raw]
Subject: RE: [PATCH v2 1/4] ARC: allow to override default mcpu compiler flag

Hi Eugeniy,

A couple of minor notes below.

> -----Original Message-----
> From: Eugeniy Paltsev <[email protected]>
> Sent: Thursday, June 4, 2020 8:39 PM
> To: [email protected]; Vineet Gupta <[email protected]>
> Cc: [email protected]; Alexey Brodkin <[email protected]>; Eugeniy Paltsev
> <[email protected]>
> 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

2020-06-16 22:17:25

by Vineet Gupta

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] ARC: allow to override default mcpu compiler flag

On 6/5/20 3:47 AM, Alexey Brodkin wrote:
> Hi Eugeniy,
>
> A couple of minor notes below.
>
>> -----Original Message-----
>> From: Eugeniy Paltsev <[email protected]>
>> Sent: Thursday, June 4, 2020 8:39 PM
>> To: [email protected]; Vineet Gupta <[email protected]>
>> Cc: [email protected]; Alexey Brodkin <[email protected]>; Eugeniy Paltsev
>> <[email protected]>
>> 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

2020-06-18 19:54:11

by Eugeniy Paltsev

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] ARC: ARCv2: support loop buffer (LPB) disabling

Hi Vineet,

could you also peek this patch to for-curr as we don't have any disagreement about it?

I'll respin the rest of the patches later. Thanks.
---
Eugeniy Paltsev


________________________________________
From: Eugeniy Paltsev <[email protected]>
Sent: Thursday, June 4, 2020 20:39
To: [email protected]; Vineet Gupta
Cc: [email protected]; Alexey Brodkin; Eugeniy Paltsev
Subject: [PATCH v2 2/4] ARC: ARCv2: support loop buffer (LPB) disabling

On HS cores, loop buffer (LPB) is programmable in runtime and can
be optionally disabled.

Signed-off-by: Eugeniy Paltsev <[email protected]>
---
arch/arc/Kconfig | 6 ++++++
arch/arc/kernel/head.S | 8 ++++++++
2 files changed, 14 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7034c217708f..2dc142c8e1f5 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -473,6 +473,12 @@ config ARC_IRQ_NO_AUTOSAVE
This is programmable and can be optionally disabled in which case
software INTERRUPT_PROLOGUE/EPILGUE do the needed work

+config ARC_LPB_DISABLE
+ bool "Disable loop buffer (LPB)"
+ help
+ On HS cores, loop buffer (LPB) is programmable in runtime and can
+ be optionally disabled.
+
endif # ISA_ARCV2

endmenu # "ARC CPU Configuration"
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 6eb23f1545ee..17fd1ed700cc 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -59,6 +59,14 @@
bclr r5, r5, STATUS_AD_BIT
#endif
kflag r5
+
+#ifdef CONFIG_ARC_LPB_DISABLE
+ lr r5, [ARC_REG_LPB_BUILD]
+ breq r5, 0, 1f ; LPB doesn't exist
+ mov r5, 1
+ sr r5, [ARC_REG_LPB_CTRL]
+1:
+#endif /* CONFIG_ARC_LPB_DISABLE */
#endif
; Config DSP_CTRL properly, so kernel may use integer multiply,
; multiply-accumulate, and divide operations
--
2.21.3

2020-06-18 20:47:14

by Vineet Gupta

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] ARC: ARCv2: support loop buffer (LPB) disabling

On 6/18/20 12:50 PM, Eugeniy Paltsev wrote:
> Hi Vineet,
>
> could you also peek this patch to for-curr as we don't have any disagreement about it?
>
> I'll respin the rest of the patches later. Thanks.
> ---
> Eugeniy Paltsev

Added !

-Vineet