On 2026-09-18 0:04, Anton Johansson wrote:
KVM fields of CPURISCVState are now always exposed as CONFIG_KVM cannot
be used in common code.

^-- one patch

v-- another one?

riscv_cpu_mxl() is changed to return CPURISCVState::misa_mxl
unconditionally, as use of target_riscv64() would result in an extra
load and compare with TargetInfo::target_arch.  We might as well just
perform a single load.  Likewise, for cpu_recompute_xl(),
cpu_address_xl(), and riscv_cpu_sxl(), we opt for returning the
corresponding CPURISCVState field with ifdefs for system mode adding
extra conditions.

Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Anton Johansson <[email protected]>
---
  target/riscv/cpu.h | 36 ++++++++----------------------------
  1 file changed, 8 insertions(+), 28 deletions(-)

diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index aee1dcaaf9..e2e0547eef 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -525,7 +525,6 @@ struct CPUArchState {
      hwaddr kernel_addr;
      hwaddr fdt_addr;
-#ifdef CONFIG_KVM
      /* kvm timer */
      bool kvm_timer_dirty;
      uint64_t kvm_timer_time;
@@ -536,7 +535,6 @@ struct CPUArchState {
      /* KVM multiprocessor state */
      uint32_t kvm_mp_state;
      bool kvm_mp_state_loaded;
-#endif /* CONFIG_KVM */

Daniel, a possible improvement to have safer kvm code path checked
at compile-time is to convert as an opaque kvm-specific structure
declared in target/riscv/kvm/kvm_riscv.h.

  };

Reply via email to