From 7ba9d81bfeba0186ae5b8800df8deb9761d6ce80 Mon Sep 17 00:00:00 2001 From: Miguel Gazquez Date: Fri, 4 Jul 2025 15:35:50 +0200 Subject: [PATCH 1/2] soc: riscv: wch: Remove unused __soc_is_irq function The __soc_is_irq function is only used when CONFIG_RISCV_SOC_EXCEPTION_FROM_IRQ is enabled, which is not the case for any WCH SoC. The implementation is therefore dead code. Additionally, the implementation matches the default fallback behavior, so no functional change would occur even if the config were enabled. Signed-off-by: Miguel Gazquez --- soc/wch/ch32v/ch32v00x/soc_irq.S | 6 ------ soc/wch/ch32v/qingke_v2a/soc_irq.S | 6 ------ soc/wch/ch32v/qingke_v4b/soc_irq.S | 6 ------ soc/wch/ch32v/qingke_v4c/soc_irq.S | 6 ------ soc/wch/ch32v/qingke_v4f/soc_irq.S | 6 ------ 5 files changed, 30 deletions(-) diff --git a/soc/wch/ch32v/ch32v00x/soc_irq.S b/soc/wch/ch32v/ch32v00x/soc_irq.S index 04f1407e2ad38..648c5bf9c8bd2 100644 --- a/soc/wch/ch32v/ch32v00x/soc_irq.S +++ b/soc/wch/ch32v/ch32v00x/soc_irq.S @@ -8,13 +8,7 @@ #include /* Exports */ -GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - SECTION_FUNC(exception.other, __soc_handle_irq) ret diff --git a/soc/wch/ch32v/qingke_v2a/soc_irq.S b/soc/wch/ch32v/qingke_v2a/soc_irq.S index fcb0daea51d01..c31e1cfea6a68 100644 --- a/soc/wch/ch32v/qingke_v2a/soc_irq.S +++ b/soc/wch/ch32v/qingke_v2a/soc_irq.S @@ -7,13 +7,7 @@ #include /* Exports */ -GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - SECTION_FUNC(exception.other, __soc_handle_irq) ret diff --git a/soc/wch/ch32v/qingke_v4b/soc_irq.S b/soc/wch/ch32v/qingke_v4b/soc_irq.S index fcb0daea51d01..c31e1cfea6a68 100644 --- a/soc/wch/ch32v/qingke_v4b/soc_irq.S +++ b/soc/wch/ch32v/qingke_v4b/soc_irq.S @@ -7,13 +7,7 @@ #include /* Exports */ -GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - SECTION_FUNC(exception.other, __soc_handle_irq) ret diff --git a/soc/wch/ch32v/qingke_v4c/soc_irq.S b/soc/wch/ch32v/qingke_v4c/soc_irq.S index fcb0daea51d01..c31e1cfea6a68 100644 --- a/soc/wch/ch32v/qingke_v4c/soc_irq.S +++ b/soc/wch/ch32v/qingke_v4c/soc_irq.S @@ -7,13 +7,7 @@ #include /* Exports */ -GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - SECTION_FUNC(exception.other, __soc_handle_irq) ret diff --git a/soc/wch/ch32v/qingke_v4f/soc_irq.S b/soc/wch/ch32v/qingke_v4f/soc_irq.S index fcb0daea51d01..c31e1cfea6a68 100644 --- a/soc/wch/ch32v/qingke_v4f/soc_irq.S +++ b/soc/wch/ch32v/qingke_v4f/soc_irq.S @@ -7,13 +7,7 @@ #include /* Exports */ -GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - SECTION_FUNC(exception.other, __soc_handle_irq) ret From 401b0050f9b0a07c8f66debf5b7533bb3912394d Mon Sep 17 00:00:00 2001 From: Miguel Gazquez Date: Fri, 4 Jul 2025 15:41:40 +0200 Subject: [PATCH 2/2] soc: riscv: sensry: Remove __soc_is_irq and disable unused config The sy1xx SoC enabled CONFIG_RISCV_SOC_EXCEPTION_FROM_IRQ and provided its own __soc_is_irq implementation. However, the behavior matches the default implementation, making the override unnecessary. This commit removes the custom implementation and disables the config option to remove unnecessary code. Signed-off-by: Miguel Gazquez --- soc/sensry/ganymed/sy1xx/Kconfig.defconfig | 3 --- soc/sensry/ganymed/sy1xx/common/crt0.S | 6 ------ 2 files changed, 9 deletions(-) diff --git a/soc/sensry/ganymed/sy1xx/Kconfig.defconfig b/soc/sensry/ganymed/sy1xx/Kconfig.defconfig index 3c60c5ce3294c..0f8b7e18cd24e 100644 --- a/soc/sensry/ganymed/sy1xx/Kconfig.defconfig +++ b/soc/sensry/ganymed/sy1xx/Kconfig.defconfig @@ -61,9 +61,6 @@ config USE_DT_CODE_PARTITION config RISCV_SOC_HAS_CUSTOM_IRQ_LOCK_OPS default n -config RISCV_SOC_EXCEPTION_FROM_IRQ - default y - config INIT_STACKS default y diff --git a/soc/sensry/ganymed/sy1xx/common/crt0.S b/soc/sensry/ganymed/sy1xx/common/crt0.S index bbffbec925894..7f2eb85d38942 100644 --- a/soc/sensry/ganymed/sy1xx/common/crt0.S +++ b/soc/sensry/ganymed/sy1xx/common/crt0.S @@ -26,12 +26,6 @@ __prestart_routine: /* Call into Zephyr initialization. */ jal x0, __start -GTEXT(__soc_is_irq) -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - GTEXT(__soc_handle_irq) SECTION_FUNC(exception.other, __soc_handle_irq) ## clear pending interrupt