On Fri, Feb 28, 2025 at 8:30 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Use GLib conversion macros to pass misa_mxl_max as
> riscv_cpu_class_init() class data.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Link: https://lore.kernel.org/r/20250212213249.45574-8-philmd@linaro.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/cpu.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 85dc2fe3bec..f05b72ac873 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -2961,7 +2961,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
> {
> RISCVCPUClass *mcc = RISCV_CPU_CLASS(c);
>
> - mcc->misa_mxl_max = (RISCVMXL)(uintptr_t)data;
> + mcc->misa_mxl_max = (RISCVMXL)GPOINTER_TO_UINT(data);
> riscv_cpu_validate_misa_mxl(mcc);
> }
>
> @@ -3063,7 +3063,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_DYNAMIC_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> #define DEFINE_VENDOR_CPU(type_name, misa_mxl_max, initfn) \
> @@ -3072,7 +3072,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_VENDOR_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> #define DEFINE_BARE_CPU(type_name, misa_mxl_max, initfn) \
> @@ -3081,7 +3081,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_BARE_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> #define DEFINE_PROFILE_CPU(type_name, misa_mxl_max, initfn) \
> @@ -3090,7 +3090,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_BARE_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> static const TypeInfo riscv_cpu_type_infos[] = {
> --
> 2.48.1
>
>