qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 11/20] target/riscv: introduce KVM AccelCPUClass


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 11/20] target/riscv: introduce KVM AccelCPUClass
Date: Mon, 28 Aug 2023 18:38:57 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0

On 25/8/23 15:08, Daniel Henrique Barboza wrote:
Add a KVM accelerator class like we did with TCG. The difference is
that, at least for now, we won't be using a realize() implementation for
this accelerator.

We'll start by assiging kvm_riscv_cpu_add_kvm_properties(), renamed to
kvm_cpu_instance_init(), as a 'cpu_instance_init' implementation. Change
riscv_cpu_post_init() to invoke accel_cpu_instance_init(), which will go
through the 'cpu_instance_init' impl of the current acceleration (if
available) and execute it. The end result is that the KVM initial setup,
i.e. starting registers and adding its specific properties, will be done
via this hook.

riscv_cpu_add_user_properties() is still being called via the common
post_init() function, thus we still need the "if kvm then return" logic
inside it for now. We'll deal with it when TCG accel class get its own
'cpu_instance_init' implementation.

riscv_add_satp_mode_properties() is now being exported from cpu.c since
it's a common helper between KVM and TCG.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
  target/riscv/cpu.c       |  8 ++---
  target/riscv/cpu.h       |  1 +
  target/riscv/kvm.c       | 64 +++++++++++++++++++++++++++-------------
  target/riscv/kvm_riscv.h |  1 -
  4 files changed, 49 insertions(+), 25 deletions(-)


-static void riscv_add_satp_mode_properties(Object *obj)
+void riscv_add_satp_mode_properties(Object *obj)
  {
      RISCVCPU *cpu = RISCV_CPU(obj);
@@ -1199,6 +1199,8 @@ static void riscv_cpu_post_init(Object *obj)
      RISCVCPU *cpu = RISCV_CPU(obj);
      RISCVCPUClass *rcc = RISCV_CPU_GET_CLASS(cpu);
+ accel_cpu_instance_init(CPU(obj));
+
      if (rcc->user_extension_properties) {
          riscv_cpu_add_user_properties(obj);
      }
@@ -1561,12 +1563,10 @@ static void riscv_cpu_add_multiext_prop_array(Object 
*obj,
  static void riscv_cpu_add_user_properties(Object *obj)
  {
  #ifndef CONFIG_USER_ONLY
-    riscv_add_satp_mode_properties(obj);
-
      if (kvm_enabled()) {
-        kvm_riscv_cpu_add_kvm_properties(obj);
          return;
      }

Maybe in a preliminary patch:

if (tcg_enabled()) {

+    riscv_add_satp_mode_properties(obj);

}

then remove the 'if kvm_enabled' in this patch?

  #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]