[RFC PATCH kvmtool 3/5] ARM: Stash vcpu_init in the vCPU structure
Oliver Upton
oupton at google.com
Fri Mar 11 09:57:15 PST 2022
A subsequent change to kvmtool will require that a vCPU be reset more
than once. Derive a valid target/feature set exactly once and stash that
for later use.
Signed-off-by: Oliver Upton <oupton at google.com>
---
arm/include/arm-common/kvm-cpu-arch.h | 18 +++++++++---------
arm/kvm-cpu.c | 2 +-
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arm/include/arm-common/kvm-cpu-arch.h b/arm/include/arm-common/kvm-cpu-arch.h
index 923d2c4..4027afe 100644
--- a/arm/include/arm-common/kvm-cpu-arch.h
+++ b/arm/include/arm-common/kvm-cpu-arch.h
@@ -10,18 +10,18 @@ struct kvm;
struct kvm_cpu {
pthread_t thread;
- unsigned long cpu_id;
- unsigned long cpu_type;
- const char *cpu_compatible;
+ unsigned long cpu_id;
+ struct kvm_vcpu_init init;
+ const char *cpu_compatible;
- struct kvm *kvm;
- int vcpu_fd;
- struct kvm_run *kvm_run;
+ struct kvm *kvm;
+ int vcpu_fd;
+ struct kvm_run *kvm_run;
struct kvm_cpu_task *task;
- u8 is_running;
- u8 paused;
- u8 needs_nmi;
+ u8 is_running;
+ u8 paused;
+ u8 needs_nmi;
struct kvm_coalesced_mmio_ring *ring;
diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c
index 6a2408c..1ea56bb 100644
--- a/arm/kvm-cpu.c
+++ b/arm/kvm-cpu.c
@@ -128,7 +128,7 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id)
/* Populate the vcpu structure. */
vcpu->kvm = kvm;
vcpu->cpu_id = cpu_id;
- vcpu->cpu_type = vcpu_init.target;
+ vcpu->init = vcpu_init;
vcpu->cpu_compatible = target->compatible;
vcpu->is_running = true;
--
2.35.1.723.g4982287a31-goog
More information about the linux-arm-kernel
mailing list