riscv: irq: Set prio for dynamic and direct irqs on clic

The irq priority has to be called for dynamic and direct irqs, too. For
direct isrs, this was missing completely, for direct irqs just for the
clic.

For dynamic irqs, I replaced the current implementation with
`z_riscv_irq_priority_set`. For the plic, this is exaclty the same.

Signed-off-by: Greter Raffael <rgreter@baumer.com>
diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c
index f95b099..bf0b668 100644
--- a/arch/riscv/core/irq_manage.c
+++ b/arch/riscv/core/irq_manage.c
@@ -43,15 +43,12 @@
 			     void (*routine)(const void *parameter),
 			     const void *parameter, uint32_t flags)
 {
-	ARG_UNUSED(flags);
-
 	z_isr_install(irq, routine, parameter);
 
-#if defined(CONFIG_RISCV_HAS_PLIC)
-	if (irq_get_level(irq) == 2) {
-		riscv_plic_set_priority(irq, priority);
-	}
+#if defined(CONFIG_RISCV_HAS_PLIC) || defined(CONFIG_RISCV_HAS_CLIC)
+	z_riscv_irq_priority_set(irq, priority, flags);
 #else
+	ARG_UNUSED(flags);
 	ARG_UNUSED(priority);
 #endif
 	return irq;
diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h
index 84d3a49..cf64680 100644
--- a/include/zephyr/arch/riscv/irq.h
+++ b/include/zephyr/arch/riscv/irq.h
@@ -70,6 +70,7 @@
 { \
 	Z_ISR_DECLARE(irq_p + CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET, \
 		      ISR_FLAG_DIRECT, isr_p, NULL); \
+	z_riscv_irq_priority_set(irq_p, priority_p, flags_p); \
 }
 
 #define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header()