[PATCH 6/9] remove run from vcpu context

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

 



Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx>
---
 qemu-kvm-x86.c |   10 +++++-----
 qemu-kvm.c     |   18 +++++++++---------
 qemu-kvm.h     |    1 -
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index c9d741d..14f1ee3 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -164,7 +164,7 @@ int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
 
 static int kvm_handle_tpr_access(kvm_vcpu_context_t vcpu)
 {
-	struct kvm_run *run = vcpu->run;
+	struct kvm_run *run = vcpu->env->kvm_run;
 	kvm_tpr_access_report(cpu_single_env,
                          run->tpr_access.rip,
                          run->tpr_access.is_write);
@@ -193,7 +193,7 @@ int kvm_enable_vapic(kvm_vcpu_context_t vcpu, uint64_t vapic)
 int kvm_arch_run(kvm_vcpu_context_t vcpu)
 {
 	int r = 0;
-	struct kvm_run *run = vcpu->run;
+	struct kvm_run *run = vcpu->env->kvm_run;
 
 
 	switch (run->exit_reason) {
@@ -540,17 +540,17 @@ void kvm_show_regs(kvm_vcpu_context_t vcpu)
 
 uint64_t kvm_get_apic_base(kvm_vcpu_context_t vcpu)
 {
-	return vcpu->run->apic_base;
+	return vcpu->env->kvm_run->apic_base;
 }
 
 void kvm_set_cr8(kvm_vcpu_context_t vcpu, uint64_t cr8)
 {
-	vcpu->run->cr8 = cr8;
+	vcpu->env->kvm_run->cr8 = cr8;
 }
 
 __u64 kvm_get_cr8(kvm_vcpu_context_t vcpu)
 {
-	return vcpu->run->cr8;
+	return vcpu->env->kvm_run->cr8;
 }
 
 int kvm_setup_cpuid(kvm_vcpu_context_t vcpu, int nent,
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 981640c..5bcb637 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -453,9 +453,9 @@ kvm_vcpu_context_t kvm_create_vcpu(CPUState *env, int id)
 		fprintf(stderr, "get vcpu mmap size: %m\n");
 		goto err_fd;
 	}
-	vcpu_ctx->run = mmap(NULL, mmap_size, PROT_READ|PROT_WRITE, MAP_SHARED,
+	env->kvm_run = mmap(NULL, mmap_size, PROT_READ|PROT_WRITE, MAP_SHARED,
 			      env->kvm_fd, 0);
-	if (vcpu_ctx->run == MAP_FAILED) {
+	if (env->kvm_run == MAP_FAILED) {
 		fprintf(stderr, "mmap vcpu area: %m\n");
 		goto err_fd;
 	}
@@ -751,7 +751,7 @@ int kvm_set_irqchip(kvm_context_t kvm, struct kvm_irqchip *chip)
 
 static int handle_io(kvm_vcpu_context_t vcpu)
 {
-	struct kvm_run *run = vcpu->run;
+	struct kvm_run *run = vcpu->env->kvm_run;
 	uint16_t addr = run->io.port;
 	int i;
 	void *p = (void *)run + run->io.data_offset;
@@ -804,7 +804,7 @@ static int handle_io(kvm_vcpu_context_t vcpu)
 int handle_debug(kvm_vcpu_context_t vcpu, void *env)
 {
 #ifdef KVM_CAP_SET_GUEST_DEBUG
-    struct kvm_run *run = vcpu->run;
+    struct kvm_run *run = vcpu->env->kvm_run;
 
     return kvm_debug(vcpu->env, env, &run->debug.arch);
 #else
@@ -866,8 +866,8 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct kvm_mp_state *mp_state)
 
 static void handle_mmio(kvm_vcpu_context_t vcpu)
 {
-	unsigned long addr = vcpu->run->mmio.phys_addr;
-	struct kvm_run *kvm_run = vcpu->run;
+	unsigned long addr = vcpu->env->kvm_run->mmio.phys_addr;
+	struct kvm_run *kvm_run = vcpu->env->kvm_run;
 	void *data = kvm_run->mmio.data;
 
 	/* hack: Red Hat 7.1 generates these weird accesses. */
@@ -912,19 +912,19 @@ int pre_kvm_run(kvm_context_t kvm, CPUState *env)
 
 int kvm_get_interrupt_flag(kvm_vcpu_context_t vcpu)
 {
-	return vcpu->run->if_flag;
+	return vcpu->env->kvm_run->if_flag;
 }
 
 int kvm_is_ready_for_interrupt_injection(kvm_vcpu_context_t vcpu)
 {
-	return vcpu->run->ready_for_interrupt_injection;
+	return vcpu->env->kvm_run->ready_for_interrupt_injection;
 }
 
 int kvm_run(kvm_vcpu_context_t vcpu, void *env)
 {
 	int r;
 	int fd = vcpu->env->kvm_fd;
-	struct kvm_run *run = vcpu->run;
+	struct kvm_run *run = vcpu->env->kvm_run;
 	kvm_context_t kvm = vcpu->kvm;
 
 again:
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 473e8e3..c97e6a9 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -71,7 +71,6 @@ struct kvm_context {
 struct kvm_vcpu_context
 {
     CPUState *env;
-	struct kvm_run *run;
 	struct kvm_context *kvm;
 	uint32_t id;
 };
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux