target/riscv: fix user-mode build issue because mhartid
PATCH 1/1 target/riscv: fix user-mode build issue because mhartid
mhartid csr is not available in user-mode code path and user-mode build fails because of its reference in riscv_cpu_realize function
--- target/riscv/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)
target/riscv/cpu.c +6 -0
@@ -643,9 +643,15 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)if (isa_ext_is_enabled (cpu, &isa_edata_arr[i]) && (env->priv_ver < isa_edata_arr[i].min_version)) {isa_ext_update_enabled (cpu, &isa_edata_arr[i], false); +#ifndef CONFIG_USER_ONLY warn_report ("disabling %s extension for hart 0x%lx because " "privilege spec version does not match" , isa_edata_arr[i].name, (unsigned long )env->mhartid); +#else +warn_report ("disabling %s extension for hart 0x%lx because " +"privilege spec version does not match" , + isa_edata_arr[i].name); +#endif } }
Signature · 1 line
2.34.1
Quoted 5 lines · Rahul Pathak
mhartid csr is not available in user-mode code path and user-mode build fails because of its reference in
riscv_cpu_realizefunction
Normally a "Fixes" tag should be added, but see below:
Quoted 10 lines
Signed-off-by Rahul Pathak <[email protected]>--- target/riscv/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)target/riscv/cpu.c +0
-0
target/riscv/cpu.c static void riscv_cpu_realize(DeviceState *dev, Error **errp) · line 649
Quoted 7 lines
target/riscv/cpu.c +1
-0@@ -643,9 +643,15 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)if (isa_ext_is_enabled (cpu, &isa_edata_arr[i]) && (env->priv_ver < isa_edata_arr[i].min_version)) {isa_ext_update_enabled (cpu, &isa_edata_arr[i], false); +#ifndef CONFIG_USER_ONLY warn_report ("disabling %s extension for hart 0x%lx because " "privilege spec version does not match" , isa_edata_arr[i].name, (unsigned long )env->mhartid);
I can't find this in the mainline codes, so I assume this code exists in Alistair's tree?
If that, please indicate in the commit message that this patch should be squashed into the offending commit in Alistair's tree.
target/riscv/cpu.c static void riscv_cpu_realize(DeviceState *dev, Error **errp) · line 654
Quoted 5 lines
target/riscv/cpu.c +5
-0+#else +warn_report ("disabling %s extension for hart 0x%lx because " +"privilege spec version does not match" , + isa_edata_arr[i].name); +#endif
Regards,
Bin
Hi Bin, Victor,
Going to send the v2 by fixing these
silly mistakes.
Thanks
Rahul
Quoted 34 lines · Bin Meng
Quoted 5 lines · Rahul Pathak
mhartid csr is not available in user-mode code path and user-mode build fails because of its reference in
riscv_cpu_realizefunctionNormally a "Fixes" tag should be added, but see below:
Quoted 10 lines
Signed-off-by Rahul Pathak <[email protected]>--- target/riscv/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)target/riscv/cpu.c +0
-0target/riscv/cpu.c static void riscv_cpu_realize(DeviceState *dev, Error **errp) · line 649
Quoted 7 lines
target/riscv/cpu.c +1
-0@@ -643,9 +643,15 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)if (isa_ext_is_enabled (cpu, &isa_edata_arr[i]) && (env->priv_ver < isa_edata_arr[i].min_version)) {isa_ext_update_enabled (cpu, &isa_edata_arr[i], false); +#ifndef CONFIG_USER_ONLY warn_report ("disabling %s extension for hart 0x%lx because " "privilege spec version does not match" , isa_edata_arr[i].name, (unsigned long )env->mhartid);I can't find this in the mainline codes, so I assume this code exists in Alistair's tree?
If that, please indicate in the commit message that this patch should be squashed into the offending commit in Alistair's tree.
Quoted 8 lines
target/riscv/cpu.c static void riscv_cpu_realize(DeviceState *dev, Error **errp) · line 654
Quoted 5 lines
target/riscv/cpu.c +5
-0+#else +warn_report ("disabling %s extension for hart 0x%lx because " +"privilege spec version does not match" , + isa_edata_arr[i].name); +#endif Regards,
Bin
--
Quoted 15 lines · Rahul Pathak
mhartid csr is not available in user-mode code path and user-mode build fails because of its reference in
riscv_cpu_realizefunctionSigned-off-by Rahul Pathak <[email protected]>--- target/riscv/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)target/riscv/cpu.c +0
-0@@ -643,9 +643,15 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) if (isa_ext_is_enabled(cpu, &isa_edata_arr[i]) &&
target/riscv/cpu.c static void riscv_cpu_realize(DeviceState *dev, Error **errp) · line 653
Quoted 10 lines
target/riscv/cpu.c +5
-0(env->priv_ver < isa_edata_arr[i].min_version)) {isa_ext_update_enabled (cpu, &isa_edata_arr[i], false); +#ifndef CONFIG_USER_ONLY warn_report ("disabling %s extension for hart 0x%lx because " "privilege spec version does not match" , isa_edata_arr[i].name, (unsigned long )env->mhartid); +#else +warn_report ("disabling %s extension for hart 0x%lx because " +"privilege spec version does not match" , + isa_edata_arr[i].name);
Hello, Rahul
Looks like you removed the second argument but didn't update the format string. The second format specifier is still there.
Quoted 8 lines
target/riscv/cpu.c +1
-1+#endif } } --2.34.1
Best regards,
Signature · 3 lines
Víctor Cora Colombo Instituto de Pesquisas ELDORADO Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>