Skip to contentSkip to conversation

target/riscv/kvm: Use riscv_cpu_is_32bit() when handling SBI_DBCN reg

PATCH Applied Philippe Mathieu-Daudé 3 participants 4 messages Sep 24, 2025 – Sep 29, 2025 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/riscv/kvm: Use riscv_cpu_is_32bit() when handling SBI_DBCN reg

Use the existing riscv_cpu_is_32bit() helper to check for 32-bit CPU.

---
 target/riscv/kvm/kvm-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/kvm/kvm-cpu.c +1 -1
index 5c19062c19b..187c2c9501e 100644
@@ -1588,7 +1588,7 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, struct kvm_run *run)
          * Handle the case where a 32 bit CPU is running in a
          * 64 bit addressing env.
          */
-        if (riscv_cpu_mxl(&cpu->env) == MXL_RV32) {
+        if (riscv_cpu_is_32bit(cpu)) {
             addr |= (uint64_t)run->riscv_sbi.args[2] << 32;
         }
 
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Philippe Mathieu-Daudé

Use the existing riscv_cpu_is_32bit() helper to check for 32-bit CPU.

---
 target/riscv/kvm/kvm-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/kvm/kvm-cpu.c +1 -1
index 5c19062c19b..187c2c9501e 100644
@@ -1588,7 +1588,7 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, struct kvm_run *run)
          * Handle the case where a 32 bit CPU is running in a
          * 64 bit addressing env.
          */
-        if (riscv_cpu_mxl(&cpu->env) == MXL_RV32) {
+        if (riscv_cpu_is_32bit(cpu)) {
             addr |= (uint64_t)run->riscv_sbi.args[2] << 32;
         }
 
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

Use the existing riscv_cpu_is_32bit() helper to check for 32-bit CPU.

Alistair

Quoted 21 lines
---
 target/riscv/kvm/kvm-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/kvm/kvm-cpu.c +1 -2
index 5c19062c19b..187c2c9501e 100644
@@ -1588,7 +1588,7 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, struct kvm_run *run)
          * Handle the case where a 32 bit CPU is running in a
          * 64 bit addressing env.
          */
-        if (riscv_cpu_mxl(&cpu->env) == MXL_RV32) {
+        if (riscv_cpu_is_32bit(cpu)) {
             addr |= (uint64_t)run->riscv_sbi.args[2] << 32;
         }
 
--

2.51.0

#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

Use the existing riscv_cpu_is_32bit() helper to check for 32-bit CPU.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 21 lines
---
 target/riscv/kvm/kvm-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/kvm/kvm-cpu.c +1 -2
index 5c19062c19b..187c2c9501e 100644
@@ -1588,7 +1588,7 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, struct kvm_run *run)
          * Handle the case where a 32 bit CPU is running in a
          * 64 bit addressing env.
          */
-        if (riscv_cpu_mxl(&cpu->env) == MXL_RV32) {
+        if (riscv_cpu_is_32bit(cpu)) {
             addr |= (uint64_t)run->riscv_sbi.args[2] << 32;
         }
 
--

2.51.0