diff mbox series

[RFC,kvmtool,3/5] ARM: Stash vcpu_init in the vCPU structure

Message ID 20220311175717.616958-4-oupton@google.com (mailing list archive)
State New, archived
Headers show
Series [RFC,kvmtool,1/5] TESTONLY: Sync KVM headers with pending changes | expand

Commit Message

Oliver Upton March 11, 2022, 5:57 p.m. UTC
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@google.com>
---
 arm/include/arm-common/kvm-cpu-arch.h | 18 +++++++++---------
 arm/kvm-cpu.c                         |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

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;