public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com
Subject: [PATCH 6/9] remove run from vcpu context
Date: Wed, 29 Jul 2009 13:49:16 -0400	[thread overview]
Message-ID: <1248889759-25063-7-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1248889759-25063-6-git-send-email-glommer@redhat.com>

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 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


  reply	other threads:[~2009-07-29 17:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 17:49 [PATCH 0/9] (Almost) get rid of kvm vcpu structure Glauber Costa
2009-07-29 17:49 ` [PATCH 1/9] use coalesced_mmio field from qemu upstream Glauber Costa
2009-07-29 17:49   ` [PATCH 2/9] remove kvm_mmio_read and kvm_mmio_write Glauber Costa
2009-07-29 17:49     ` [PATCH 3/9] put env inside vcpu_context Glauber Costa
2009-07-29 17:49       ` [PATCH 4/9] remove opaque field from kvm_context Glauber Costa
2009-07-29 17:49         ` [PATCH 5/9] remove fd from vcpu_context Glauber Costa
2009-07-29 17:49           ` Glauber Costa [this message]
2009-07-29 17:49             ` [PATCH 7/9] remove kvm_context " Glauber Costa
2009-07-29 17:49               ` [PATCH 8/9] use kvm_vcpu_ioctl Glauber Costa
2009-07-29 17:49                 ` [PATCH 9/9] remove id from vcpu context Glauber Costa
2009-08-03 13:12     ` [PATCH 2/9] remove kvm_mmio_read and kvm_mmio_write Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1248889759-25063-7-git-send-email-glommer@redhat.com \
    --to=glommer@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox