* [PATCH] kvm-userspace: fix compilation w/out KVM_CAP_MP_STATE
@ 2008-05-21 1:24 Chris Wright
2008-05-21 15:17 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Chris Wright @ 2008-05-21 1:24 UTC (permalink / raw)
To: kvm
Add kvm_reset_mpstate inline function and only call it when
KVM_CAP_MP_STATE is defined.
qemu/qemu-kvm-x86.c:677: error: unknown field `mp_state' specified in initializer
qemu/qemu-kvm-x86.c:677: error: `KVM_MP_STATE_UNINITIALIZED' undeclared (first use in this function)
...
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
Note: could easily extend this to have an #else clause in libkvm.h
to simplify some of the ifdef-ery in qemu-kvm-x86.c.
libkvm/libkvm.h | 9 +++++++++
qemu/qemu-kvm-x86.c | 10 +++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 31c0d59..63183b8 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -314,6 +314,15 @@ int kvm_get_mpstate(kvm_context_t kvm, int vcpu,
*/
int kvm_set_mpstate(kvm_context_t kvm, int vcpu,
struct kvm_mp_state *mp_state);
+/*!
+ * * \brief Reset VCPU MP state
+ *
+ */
+static inline int kvm_reset_mpstate(kvm_context_t kvm, int vcpu)
+{
+ struct kvm_mp_state mp_state = {.mp_state = KVM_MP_STATE_UNINITIALIZED};
+ return kvm_set_mpstate(kvm, vcpu, &mp_state);
+}
#endif
/*!
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 6cc08fc..197d761 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -674,13 +674,13 @@ int handle_tpr_access(void *opaque, int vcpu,
void kvm_arch_cpu_reset(CPUState *env)
{
- struct kvm_mp_state mp_state = { .mp_state = KVM_MP_STATE_UNINITIALIZED };
-
kvm_arch_load_regs(env);
if (env->cpu_index != 0) {
- if (kvm_irqchip_in_kernel(kvm_context))
- kvm_set_mpstate(kvm_context, env->cpu_index, &mp_state);
- else {
+ if (kvm_irqchip_in_kernel(kvm_context)) {
+#ifdef KVM_CAP_MP_STATE
+ kvm_reset_mpstate(kvm_context, env->cpu_index);
+#endif
+ } else {
env->interrupt_request &= ~CPU_INTERRUPT_HARD;
env->hflags |= HF_HALTED_MASK;
env->exception_index = EXCP_HLT;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kvm-userspace: fix compilation w/out KVM_CAP_MP_STATE
2008-05-21 1:24 [PATCH] kvm-userspace: fix compilation w/out KVM_CAP_MP_STATE Chris Wright
@ 2008-05-21 15:17 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-05-21 15:17 UTC (permalink / raw)
To: Chris Wright; +Cc: kvm
Chris Wright wrote:
> Add kvm_reset_mpstate inline function and only call it when
> KVM_CAP_MP_STATE is defined.
>
> qemu/qemu-kvm-x86.c:677: error: unknown field `mp_state' specified in initializer
> qemu/qemu-kvm-x86.c:677: error: `KVM_MP_STATE_UNINITIALIZED' undeclared (first use in this function)
> ...
>
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-21 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 1:24 [PATCH] kvm-userspace: fix compilation w/out KVM_CAP_MP_STATE Chris Wright
2008-05-21 15:17 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox