public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 5/5] kvm-tpr-opt: delete CPUState field
Date: Mon, 01 Aug 2011 12:27:27 -0300	[thread overview]
Message-ID: <20110801152820.318186742@redhat.com> (raw)
In-Reply-To: 20110801152722.231510187@redhat.com

[-- Attachment #1: kvmtpr-remove-cpustate-field --]
[-- Type: text/plain, Size: 3095 bytes --]

The information can be inferred from CPU_PUT_FULL_STATE and
bios_enabled.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-kvm/kvm-tpr-opt.c
===================================================================
--- qemu-kvm.orig/kvm-tpr-opt.c
+++ qemu-kvm/kvm-tpr-opt.c
@@ -218,7 +218,7 @@ static int get_pcr_cpu(CPUState *env)
     return (int)b;
 }
 
-int kvm_tpr_enable_vapic(CPUState *env)
+static int tpr_enable_vapic(CPUState *env)
 {
     static uint8_t one = 1;
     int pcr_cpu = get_pcr_cpu(env);
@@ -228,11 +228,17 @@ int kvm_tpr_enable_vapic(CPUState *env)
 
     kvm_enable_vapic(env, vapic_phys + (pcr_cpu << 7));
     cpu_physical_memory_write_rom(vapic_phys + (pcr_cpu << 7) + 4, &one, 1);
-    env->kvm_vcpu_update_vapic = 0;
     bios_enabled = 1;
     return 1;
 }
 
+void kvm_tpr_enable_vapic(CPUState *env)
+{
+    if (!bios_enabled)
+        return;
+    tpr_enable_vapic(env);
+}
+
 static void patch_call(CPUState *env, uint64_t rip, uint32_t target)
 {
     uint32_t offset;
@@ -293,7 +299,7 @@ void kvm_tpr_access_report(CPUState *env
 	return;
     if (!bios_is_mapped(env, rip))
 	return;
-    if (!kvm_tpr_enable_vapic(env))
+    if (!tpr_enable_vapic(env))
 	return;
     patch_instruction(env, rip);
 }
@@ -326,13 +332,6 @@ static int tpr_load(QEMUFile *f, void *s
     qemu_get_be32s(f, &vapic_phys);
     qemu_get_be32s(f, &vbios_desc_phys);
   
-    if (bios_enabled) {
-        CPUState *env = first_cpu->next_cpu;
-
-        for (env = first_cpu; env != NULL; env = env->next_cpu)
-            env->kvm_vcpu_update_vapic = 1;
-    }
-
     return 0;
 }
 
@@ -367,7 +366,7 @@ static void vtpr_ioport_write(void *opaq
 	}
     bios_enabled = 1;
     update_vbios_real_tpr();
-    kvm_tpr_enable_vapic(env);
+    tpr_enable_vapic(env);
 }
 
 static void kvm_tpr_opt_setup(void)
Index: qemu-kvm/qemu-kvm.h
===================================================================
--- qemu-kvm.orig/qemu-kvm.h
+++ qemu-kvm/qemu-kvm.h
@@ -265,6 +265,6 @@ extern int kvm_pit_reinject;
 extern unsigned int kvm_shadow_memory;
 
 int kvm_handle_tpr_access(CPUState *env);
-int kvm_tpr_enable_vapic(CPUState *env);
+void kvm_tpr_enable_vapic(CPUState *env);
 
 #endif
Index: qemu-kvm/target-i386/cpu.h
===================================================================
--- qemu-kvm.orig/target-i386/cpu.h
+++ qemu-kvm/target-i386/cpu.h
@@ -759,8 +759,6 @@ typedef struct CPUX86State {
     uint16_t fptag_vmstate;
     uint16_t fpregs_format_vmstate;
 
-    int kvm_vcpu_update_vapic;
-
     uint64_t xstate_bv;
     XMMReg ymmh_regs[CPU_NB_REGS];
 
Index: qemu-kvm/target-i386/kvm.c
===================================================================
--- qemu-kvm.orig/target-i386/kvm.c
+++ qemu-kvm/target-i386/kvm.c
@@ -1451,9 +1451,7 @@ int kvm_arch_put_registers(CPUState *env
         return ret;
     }
     if (level == KVM_PUT_FULL_STATE) {
-        if (env->kvm_vcpu_update_vapic) {
-            kvm_tpr_enable_vapic(env);
-        }
+        kvm_tpr_enable_vapic(env);
     }
     /* must be last */
     ret = kvm_guest_debug_workarounds(env);



  parent reply	other threads:[~2011-08-01 15:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 15:27 [patch 0/5] misc qemu-kvm cleanups Marcelo Tosatti
2011-08-01 15:27 ` [patch 1/5] qemu-kvm: remove hpagesize variable declaration Marcelo Tosatti
2011-08-01 15:27 ` [patch 2/5] piix_pci: remove kvm.h include Marcelo Tosatti
2011-08-01 15:27 ` [patch 3/5] qemu-kvm: remove unused kvm_nested variable Marcelo Tosatti
2011-08-01 15:27 ` [patch 4/5] pc: drop unnecessary memory un-assignment Marcelo Tosatti
2011-08-02 11:28   ` Avi Kivity
2011-08-02 11:40     ` Avi Kivity
2011-08-01 15:27 ` Marcelo Tosatti [this message]
2011-08-02 12:37   ` [patch 5/5] kvm-tpr-opt: delete CPUState field 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=20110801152820.318186742@redhat.com \
    --to=mtosatti@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