[PATCH 06/10] make some functions static

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

 



Some functions that uses kvm_run are not static, but should be.
Make them static, and make them get a CPUState parameter in the process.

Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx>
---
 qemu-kvm-x86.c |   18 +++++++++---------
 qemu-kvm.h     |   33 ---------------------------------
 2 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 7546fcb..10bd530 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -538,19 +538,19 @@ void kvm_show_regs(kvm_vcpu_context_t vcpu)
 		sregs.efer);
 }
 
-uint64_t kvm_get_apic_base(kvm_vcpu_context_t vcpu)
+static uint64_t kvm_get_apic_base(CPUState *env)
 {
-	return vcpu->run->apic_base;
+	return env->kvm_run->apic_base;
 }
 
-void kvm_set_cr8(kvm_vcpu_context_t vcpu, uint64_t cr8)
+static void kvm_set_cr8(CPUState *env, uint64_t cr8)
 {
-	vcpu->run->cr8 = cr8;
+	env->kvm_run->cr8 = cr8;
 }
 
-__u64 kvm_get_cr8(kvm_vcpu_context_t vcpu)
+static __u64 kvm_get_cr8(CPUState *env)
 {
-	return vcpu->run->cr8;
+	return env->kvm_run->cr8;
 }
 
 int kvm_setup_cpuid(kvm_vcpu_context_t vcpu, int nent,
@@ -1372,7 +1372,7 @@ int kvm_arch_halt(kvm_vcpu_context_t vcpu)
 void kvm_arch_pre_kvm_run(void *opaque, CPUState *env)
 {
     if (!kvm_irqchip_in_kernel())
-	kvm_set_cr8(env->kvm_cpu_state.vcpu_ctx, cpu_get_apic_tpr(env));
+	kvm_set_cr8(env, cpu_get_apic_tpr(env));
 }
 
 void kvm_arch_post_kvm_run(void *opaque, CPUState *env)
@@ -1382,8 +1382,8 @@ void kvm_arch_post_kvm_run(void *opaque, CPUState *env)
     env->eflags = kvm_get_interrupt_flag(env->kvm_cpu_state.vcpu_ctx)
 	? env->eflags | IF_MASK : env->eflags & ~IF_MASK;
 
-    cpu_set_apic_tpr(env, kvm_get_cr8(env->kvm_cpu_state.vcpu_ctx));
-    cpu_set_apic_base(env, kvm_get_apic_base(env->kvm_cpu_state.vcpu_ctx));
+    cpu_set_apic_tpr(env, kvm_get_cr8(env));
+    cpu_set_apic_base(env, kvm_get_apic_base(env));
 }
 
 int kvm_arch_has_work(CPUState *env)
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 3bc483e..1f23fe4 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -219,17 +219,6 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env);
 int kvm_get_interrupt_flag(kvm_vcpu_context_t vcpu);
 
 /*!
- * \brief Get the value of the APIC_BASE msr as of last exit to userspace
- *
- * This gets the APIC_BASE msr as it was on the last exit to userspace.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- * \return APIC_BASE msr contents
- */
-uint64_t kvm_get_apic_base(kvm_vcpu_context_t vcpu);
-
-/*!
  * \brief Check if a vcpu is ready for interrupt injection
  *
  * This checks if vcpu interrupts are not masked by mov ss or sti.
@@ -422,28 +411,6 @@ int kvm_set_shadow_pages(kvm_context_t kvm, unsigned int nrshadow_pages);
  */
 int kvm_get_shadow_pages(kvm_context_t kvm, unsigned int *nrshadow_pages);
 
-/*!
- * \brief Set up cr8 for next time the vcpu is executed
- *
- * This is a fast setter for cr8, which will be applied when the
- * vcpu next enters guest mode.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- * \param cr8 next cr8 value
- */
-void kvm_set_cr8(kvm_vcpu_context_t vcpu, uint64_t cr8);
-
-/*!
- * \brief Get cr8 for sync tpr in qemu apic emulation
- *
- * This is a getter for cr8, which used to sync with the tpr in qemu
- * apic emualtion.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- */
-__u64 kvm_get_cr8(kvm_vcpu_context_t vcpu);
 #endif
 
 /*!
-- 
1.6.2.5

--
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