diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2020-03-13 08:39:54 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-03-14 06:44:00 +0300 |
commit | 72a0628c7e8063f1e6c02541cbd459eff617dd07 (patch) | |
tree | e07f26d457e2a6e672116ca08eccb4a367dedfe0 | |
parent | 2343efd0401c329187f1375114b79dd2fb102e55 (diff) | |
download | opensbi-72a0628c7e8063f1e6c02541cbd459eff617dd07.tar.xz |
platform: Use one unified per-HART stack size macro for all platforms
As of today all platforms use 8KB of per-HART stack hence there is
no need for each platform to define its own macro or use the magic
number. Create one macro for all platforms. Platform still can use
its own version if needed.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
-rw-r--r-- | include/sbi/sbi_platform.h | 3 | ||||
-rw-r--r-- | platform/andes/ae350/platform.c | 2 | ||||
-rw-r--r-- | platform/andes/ae350/platform.h | 1 | ||||
-rw-r--r-- | platform/ariane-fpga/platform.c | 2 | ||||
-rw-r--r-- | platform/kendryte/k210/platform.c | 2 | ||||
-rw-r--r-- | platform/kendryte/k210/platform.h | 1 | ||||
-rw-r--r-- | platform/qemu/virt/platform.c | 3 | ||||
-rw-r--r-- | platform/sifive/fu540/platform.c | 3 | ||||
-rw-r--r-- | platform/spike/platform.c | 3 | ||||
-rw-r--r-- | platform/template/platform.c | 2 | ||||
-rw-r--r-- | platform/thead/c910/platform.c | 2 | ||||
-rw-r--r-- | platform/thead/c910/platform.h | 1 |
12 files changed, 11 insertions, 14 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index e4f1a7d..bc7991c 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -161,6 +161,9 @@ struct sbi_platform_operations { struct sbi_trap_info *out_trap); } __packed; +/** Platform default per-HART stack size for exception/interrupt handling */ +#define SBI_PLATFORM_DEFAULT_HART_STACK_SIZE 8192 + /** Representation of a platform */ struct sbi_platform { /** diff --git a/platform/andes/ae350/platform.c b/platform/andes/ae350/platform.c index b85cec4..db5b46e 100644 --- a/platform/andes/ae350/platform.c +++ b/platform/andes/ae350/platform.c @@ -186,6 +186,6 @@ const struct sbi_platform platform = { .name = "Andes AE350", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = AE350_HART_COUNT, - .hart_stack_size = AE350_HART_STACK_SIZE, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/andes/ae350/platform.h b/platform/andes/ae350/platform.h index eff2996..062b656 100644 --- a/platform/andes/ae350/platform.h +++ b/platform/andes/ae350/platform.h @@ -12,7 +12,6 @@ #define _AE350_PLATFORM_H_ #define AE350_HART_COUNT 4 -#define AE350_HART_STACK_SIZE 8192 #define AE350_PLIC_ADDR 0xe4000000 #define AE350_PLIC_NUM_SOURCES 71 diff --git a/platform/ariane-fpga/platform.c b/platform/ariane-fpga/platform.c index 9d9207e..d2b6de9 100644 --- a/platform/ariane-fpga/platform.c +++ b/platform/ariane-fpga/platform.c @@ -201,6 +201,6 @@ const struct sbi_platform platform = { .name = "ARIANE RISC-V", .features = SBI_ARIANE_FEATURES, .hart_count = ARIANE_HART_COUNT, - .hart_stack_size = 8192, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index 00b38f7..2044307 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -138,6 +138,6 @@ const struct sbi_platform platform = { .name = "Kendryte K210", .features = SBI_PLATFORM_HAS_TIMER_VALUE, .hart_count = K210_HART_COUNT, - .hart_stack_size = K210_HART_STACK_SIZE, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/kendryte/k210/platform.h b/platform/kendryte/k210/platform.h index 8e4664f..5269bc4 100644 --- a/platform/kendryte/k210/platform.h +++ b/platform/kendryte/k210/platform.h @@ -12,7 +12,6 @@ #include <sbi/riscv_io.h> #define K210_HART_COUNT 2 -#define K210_HART_STACK_SIZE 8192 #define K210_UART_BAUDRATE 115200 diff --git a/platform/qemu/virt/platform.c b/platform/qemu/virt/platform.c index fdc5a2c..92f34aa 100644 --- a/platform/qemu/virt/platform.c +++ b/platform/qemu/virt/platform.c @@ -21,7 +21,6 @@ /* clang-format off */ #define VIRT_HART_COUNT 8 -#define VIRT_HART_STACK_SIZE 8192 #define VIRT_TEST_ADDR 0x100000 #define VIRT_TEST_FINISHER_FAIL 0x3333 @@ -159,6 +158,6 @@ const struct sbi_platform platform = { .name = "QEMU Virt Machine", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = VIRT_HART_COUNT, - .hart_stack_size = VIRT_HART_STACK_SIZE, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c index 848261c..1cc1f27 100644 --- a/platform/sifive/fu540/platform.c +++ b/platform/sifive/fu540/platform.c @@ -22,7 +22,6 @@ /* clang-format off */ #define FU540_HART_COUNT 5 -#define FU540_HART_STACK_SIZE 8192 #define FU540_SYS_CLK 1000000000 @@ -232,6 +231,6 @@ const struct sbi_platform platform = { .name = "SiFive Freedom U540", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = FU540_HART_COUNT, - .hart_stack_size = FU540_HART_STACK_SIZE, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/spike/platform.c b/platform/spike/platform.c index 2b9b041..25e5765 100644 --- a/platform/spike/platform.c +++ b/platform/spike/platform.c @@ -11,7 +11,6 @@ /* clang-format off */ #define SPIKE_HART_COUNT 8 -#define SPIKE_HART_STACK_SIZE 8192 #define SPIKE_CLINT_ADDR 0x2000000 @@ -109,6 +108,6 @@ const struct sbi_platform platform = { .name = "Spike", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = SPIKE_HART_COUNT, - .hart_stack_size = SPIKE_HART_STACK_SIZE, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/template/platform.c b/platform/template/platform.c index 74ac9f4..d09b8bd 100644 --- a/platform/template/platform.c +++ b/platform/template/platform.c @@ -223,6 +223,6 @@ const struct sbi_platform platform = { .name = "platform-name", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = 1, - .hart_stack_size = 8192, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/thead/c910/platform.c b/platform/thead/c910/platform.c index 482caad..ca2e0e2 100644 --- a/platform/thead/c910/platform.c +++ b/platform/thead/c910/platform.c @@ -152,6 +152,6 @@ const struct sbi_platform platform = { .name = "T-HEAD Xuantie c910", .features = SBI_THEAD_FEATURES, .hart_count = C910_HART_COUNT, - .hart_stack_size = C910_HART_STACK_SIZE, + .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/thead/c910/platform.h b/platform/thead/c910/platform.h index 5dcfae8..5e74128 100644 --- a/platform/thead/c910/platform.h +++ b/platform/thead/c910/platform.h @@ -6,7 +6,6 @@ #define _C910_PLATFORM_H_ #define C910_HART_COUNT 16 -#define C910_HART_STACK_SIZE 8192 #define SBI_THEAD_FEATURES \ (SBI_PLATFORM_HAS_SCOUNTEREN | \ |