Re: [PATCH RFC 2/4] powerpc: Add Microwatt platform
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2020-05-12 01:58:18
Paul Mackerras [off-list ref] writes:
Microwatt is a FPGA-based implementation of the Power ISA. It currently only implements little-endian 64-bit mode, and does not (yet) support SMP.
... or FP or VSX or Altivec? What about transactional memory?
quoted hunk ↗ jump to hunk
This adds a new machine type to support FPGA-based SoCs with a Microwatt core. Signed-off-by: Paul Mackerras <redacted> --- arch/powerpc/Kconfig | 2 +- arch/powerpc/configs/microwatt_defconfig | 1418 +++++++++++++++++++++ arch/powerpc/platforms/Kconfig | 1 + arch/powerpc/platforms/Makefile | 1 + arch/powerpc/platforms/microwatt/Kconfig | 9 + arch/powerpc/platforms/microwatt/Makefile | 1 + arch/powerpc/platforms/microwatt/setup.c | 40 + 7 files changed, 1471 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/configs/microwatt_defconfig create mode 100644 arch/powerpc/platforms/microwatt/Kconfig create mode 100644 arch/powerpc/platforms/microwatt/Makefile create mode 100644 arch/powerpc/platforms/microwatt/setup.cdiff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 497b7d0b2d7e..97286b8312f5 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig@@ -407,7 +407,7 @@ config HUGETLB_PAGE_SIZE_VARIABLE config MATH_EMULATION bool "Math emulation" - depends on 4xx || PPC_8xx || PPC_MPC832x || BOOKE + depends on 4xx || PPC_8xx || PPC_MPC832x || BOOKE || PPC_MICROWATT help Some PowerPC chips designed for embedded applications do not have a floating-point unit and therefore do not implement thediff --git a/arch/powerpc/configs/microwatt_defconfig b/arch/powerpc/configs/microwatt_defconfig new file mode 100644 index 000000000000..f4f4c965a786 --- /dev/null +++ b/arch/powerpc/configs/microwatt_defconfig@@ -0,0 +1,1418 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/powerpc 5.6.0 Kernel Configuration +# + +# +# Compiler: powerpc64le-linux-gnu-gcc (GCC) 9.2.1 20190827 (Red Hat Cross 9.2.1-1) +# +CONFIG_CC_IS_GCC=y +CONFIG_GCC_VERSION=90201 +CONFIG_CLANG_VERSION=0 +CONFIG_CC_HAS_ASM_GOTO=y +CONFIG_CC_HAS_ASM_INLINE=y +CONFIG_CC_HAS_WARN_MAYBE_UNINITIALIZED=y +CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED=y +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_TABLE_SORT=y +CONFIG_THREAD_INFO_IN_TASK=y
This should be a minimised config generated with savedefconfig.
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index 1f8025383caa..5b701acc6afa 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig@@ -20,6 +20,7 @@ source "arch/powerpc/platforms/embedded6xx/Kconfig" source "arch/powerpc/platforms/44x/Kconfig" source "arch/powerpc/platforms/40x/Kconfig" source "arch/powerpc/platforms/amigaone/Kconfig" +source "arch/powerpc/platforms/microwatt/Kconfig" config KVM_GUEST bool "KVM Guest support"diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile index 143d4417f6cc..edcb54cdb1a8 100644 --- a/arch/powerpc/platforms/Makefile +++ b/arch/powerpc/platforms/Makefile@@ -22,3 +22,4 @@ obj-$(CONFIG_PPC_CELL) += cell/ obj-$(CONFIG_PPC_PS3) += ps3/ obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/ obj-$(CONFIG_AMIGAONE) += amigaone/ +obj-$(CONFIG_PPC_MICROWATT) += microwatt/diff --git a/arch/powerpc/platforms/microwatt/Kconfig b/arch/powerpc/platforms/microwatt/Kconfig new file mode 100644 index 000000000000..981f722ae9ce --- /dev/null +++ b/arch/powerpc/platforms/microwatt/Kconfig@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0 +config PPC_MICROWATT + depends on PPC64 && PPC_BOOK3S
That can just be PPC_BOOK3S_64 I think it should also depend on !CPU_BIG_ENDIAN && !SMP ? Should it also select MATH_EMULATION? And MATH_EMULATION_FULL ?
quoted hunk ↗ jump to hunk
+ bool "Microwatt SoC platform" + select PPC_XICS + select PPC_NATIVE + help + This option enables support for FPGA-based Microwatt implementations. +diff --git a/arch/powerpc/platforms/microwatt/Makefile b/arch/powerpc/platforms/microwatt/Makefile new file mode 100644 index 000000000000..e6885b3b2ee7 --- /dev/null +++ b/arch/powerpc/platforms/microwatt/Makefile@@ -0,0 +1 @@ +obj-y += setup.odiff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c new file mode 100644 index 000000000000..3cfc5955a6fe --- /dev/null +++ b/arch/powerpc/platforms/microwatt/setup.c@@ -0,0 +1,40 @@ +/* + * Microwatt FPGA-based SoC platform setup code. + * + * Copyright 2020 Paul Mackerras (paulus@ozlabs.org), IBM Corp. + */ + +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/stddef.h> +#include <linux/init.h> +#include <linux/of.h> +#include <asm/machdep.h> +#include <asm/time.h> + +static void __init microwatt_calibrate_decr(void) +{ + ppc_tb_freq = 100000000; + ppc_proc_freq = 100000000; +}
Why can't those come via the device tree?
+
+static void __init microwatt_setup_arch(void)
+{
+}That can be NULL in ppc_md.
+static void __init microwatt_init_IRQ(void)
+{
+}Can be NULL in ppc_md.
+static int __init microwatt_probe(void)
+{
+ return of_machine_is_compatible("microwatt-soc");
+}
+
+define_machine(microwatt) {
+ .name = "microwatt",
+ .probe = microwatt_probe,
+ .setup_arch = microwatt_setup_arch,
+ .init_IRQ = microwatt_init_IRQ,
+ .calibrate_decr = microwatt_calibrate_decr,
+};
--
2.25.3cheers