[PATCH 09/14] target/riscv: Replace TARGET_LONG_BITS in header exposed to common code

Anton Johansson via posted 14 patches 1 day, 8 hours ago
[PATCH 09/14] target/riscv: Replace TARGET_LONG_BITS in header exposed to common code
Posted by Anton Johansson via 1 day, 8 hours ago
Macro is used in hw/intc/riscv_imsic.c.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 target/riscv/cpu_bits.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
index b62dd82fe7..3d1c48487f 100644
--- a/target/riscv/cpu_bits.h
+++ b/target/riscv/cpu_bits.h
@@ -810,7 +810,7 @@ typedef enum RISCVException {
 #define IRQ_PMU_OVF                        13
 #define IRQ_LOCAL_MAX                      64
 /* -1 is due to bit zero of hgeip and hgeie being ROZ. */
-#define IRQ_LOCAL_GUEST_MAX                (TARGET_LONG_BITS - 1)
+#define IRQ_LOCAL_GUEST_MAX                (target_long_bits() - 1)
 
 /* RNMI causes */
 #define RNMI_MAX                           16

-- 
2.51.0
Re: [PATCH 09/14] target/riscv: Replace TARGET_LONG_BITS in header exposed to common code
Posted by Philippe Mathieu-Daudé 16 hours ago
On 17/12/25 00:51, Anton Johansson wrote:
> Macro is used in hw/intc/riscv_imsic.c.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   target/riscv/cpu_bits.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
> index b62dd82fe7..3d1c48487f 100644
> --- a/target/riscv/cpu_bits.h
> +++ b/target/riscv/cpu_bits.h
> @@ -810,7 +810,7 @@ typedef enum RISCVException {
>   #define IRQ_PMU_OVF                        13
>   #define IRQ_LOCAL_MAX                      64
>   /* -1 is due to bit zero of hgeip and hgeie being ROZ. */
> -#define IRQ_LOCAL_GUEST_MAX                (TARGET_LONG_BITS - 1)
> +#define IRQ_LOCAL_GUEST_MAX                (target_long_bits() - 1)

Code smell.

Should be a field in RISCVCPUClass instead?
Re: [PATCH 09/14] target/riscv: Replace TARGET_LONG_BITS in header exposed to common code
Posted by Pierrick Bouvier 1 day, 7 hours ago
On 12/16/25 3:51 PM, Anton Johansson wrote:
> Macro is used in hw/intc/riscv_imsic.c.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   target/riscv/cpu_bits.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>