Skip to contentSkip to conversation

Move kvm_get_pit to libkvm.c common code

PATCH Applied Jerone Young 5 participants 6 messages Mar 11, 2008 – Mar 24, 2008 KVM

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Move kvm_get_pit to libkvm.c common code

# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205266548 18000
# Branch merge
# Node ID b136c0450c0f7c6ff2262437b1beb9896b1585e3 # Parent c14fbbaee36241aa0fab0d6391e47cf9f4ac8012 Move kvm_get_pit to libkvm.c common code

This fixes compilation issues for PowerPC and other non x86 archs that do not
have in kernel pit. The pit code is added into the kvm_context in kvm-common.h &the error causing the issue is coming from a definition in qemu. This seems to be the proper fix as there is also a common function:
kvm_irqchip_in_kernel
for in kernel irq that handles this the same way.

libkvm/libkvm-x86.c +0 -9
@@ -660,12 +660,3 @@ int kvm_disable_tpr_access_reporting(kvm
 }
 
 #endif
-
-int kvm_pit_in_kernel(kvm_context_t kvm)
-{
-#ifdef KVM_CAP_PIT
-	return kvm->pit_in_kernel;
-#else
-	return 0;
-#endif
-}
libkvm/libkvm.c +5 -0
@@ -962,3 +962,8 @@ int kvm_irqchip_in_kernel(kvm_context_t 
 {
     return kvm->irqchip_in_kernel;
 }
+
+int kvm_pit_in_kernel(kvm_context_t kvm)
+{
+	return kvm->pit_in_kernel;
+}
libkvm/libkvm.h +7 -0
@@ -530,6 +530,13 @@ int kvm_set_lapic(kvm_context_t kvm, int
 
 #endif
 
+/*!
+ * \brief Query wheather in kernel pit is used
+ *
+ *  \param kvm Pointer to the current kvm_context
+ */
+int kvm_pit_in_kernel(kvm_context_t kvm);
+
 #ifdef KVM_CAP_PIT
 
 /*!

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#1 lore raw
Quoted 8 lines · On Wednesday 12 March 2008 04:17:11 Jerone Young wrote:

# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205266548 18000
# Branch merge
# Node ID b136c0450c0f7c6ff2262437b1beb9896b1585e3 # Parent c14fbbaee36241aa0fab0d6391e47cf9f4ac8012 Move kvm_get_pit to libkvm.c common code

Quoted 6 lines

This fixes compilation issues for PowerPC and other non x86 archs that do not have in kernel pit. The pit code is added into the kvm_context in kvm-common.h &the error causing the issue is coming from a definition in qemu. This seems to be the proper fix as there is also a common function:
kvm_irqchip_in_kernel
for in kernel irq that handles this the same way.

OK to me. Sorry for inconvenient...

Signature · 2 lines
Thanks
Yang, Sheng
Quoted 48 lines
libkvm/libkvm-x86.c +0 -9
@@ -660,12 +660,3 @@ int kvm_disable_tpr_access_reporting(kvm
 }
 
 #endif
-
-int kvm_pit_in_kernel(kvm_context_t kvm)
-{
-#ifdef KVM_CAP_PIT
-	return kvm->pit_in_kernel;
-#else
-	return 0;
-#endif
-}
libkvm/libkvm.c +5 -0
@@ -962,3 +962,8 @@ int kvm_irqchip_in_kernel(kvm_context_t
 {
     return kvm->irqchip_in_kernel;
 }
+
+int kvm_pit_in_kernel(kvm_context_t kvm)
+{
+	return kvm->pit_in_kernel;
+}
libkvm/libkvm.h +7 -1
@@ -530,6 +530,13 @@ int kvm_set_lapic(kvm_context_t kvm, int
 
 #endif
 
+/*!
+ * \brief Query wheather in kernel pit is used
+ *
+ *  \param kvm Pointer to the current kvm_context
+ */
+int kvm_pit_in_kernel(kvm_context_t kvm);
+
 #ifdef KVM_CAP_PIT
 
 /*!
 
-------------------------------------------------------------------------
Quoted 7 lines

This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Applied
#2 lore raw
In reply to Jerone Young
Quoted 5 lines · Jerone Young

This fixes compilation issues for PowerPC and other non x86 archs that do not
have in kernel pit. The pit code is added into the kvm_context in kvm-common.h &the error causing the issue is coming from a definition in qemu. This seems to be the proper fix as there is also a common function:
kvm_irqchip_in_kernel
for in kernel irq that handles this the same way.

Applied, thanks.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#3 lore raw
In reply to Jerone Young

Avi, please apply the patch at the end of this mail.

Quoted 54 lines · Jerone Young

# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1205266548 18000
# Branch merge
# Node ID b136c0450c0f7c6ff2262437b1beb9896b1585e3 # Parent c14fbbaee36241aa0fab0d6391e47cf9f4ac8012 Move kvm_get_pit to libkvm.c common code

This fixes compilation issues for PowerPC and other non x86 archs that do not
have in kernel pit. The pit code is added into the kvm_context in kvm-common.h &the error causing the issue is coming from a definition in qemu. This seems to be the proper fix as there is also a common function:
kvm_irqchip_in_kernel
for in kernel irq that handles this the same way.

libkvm/libkvm-x86.c +0 -9
@@ -660,12 +660,3 @@ int kvm_disable_tpr_access_reporting(kvm
 }
 
 #endif
-
-int kvm_pit_in_kernel(kvm_context_t kvm)
-{
-#ifdef KVM_CAP_PIT
-	return kvm->pit_in_kernel;
-#else
-	return 0;
-#endif
-}
libkvm/libkvm.c +5 -0
@@ -962,3 +962,8 @@ int kvm_irqchip_in_kernel(kvm_context_t 
 {
     return kvm->irqchip_in_kernel;
 }
+
+int kvm_pit_in_kernel(kvm_context_t kvm)
+{
+	return kvm->pit_in_kernel;
+}
libkvm/libkvm.h +0 -0
@@ -530,6 +530,13 @@ int kvm_set_lapic(kvm_context_t kvm, int
 
 #endif
 

libkvm/libkvm.h int kvm_set_lapic(kvm_context_t kvm, int · line 542

Quoted 10 lines
libkvm/libkvm.h +7 -0
+/*!
+ * \brief Query wheather in kernel pit is used
+ *
+ *  \param kvm Pointer to the current kvm_context
+ */
+int kvm_pit_in_kernel(kvm_context_t kvm);
+
 #ifdef KVM_CAP_PIT
 
 /*!

This doesn't fix libkvm, and qemu is even worse off:

In file included from ../qemu-kvm.h:80,

                 from ../hw/i8254.c:29:

/home/hollisb/source/kvm-userspace-ppc.hg/qemu/../libkvm/libkvm.h:550: warning: "struct kvm_pit_state" declared inside parameter list /home/hollisb/source/kvm-userspace-ppc.hg/qemu/../libkvm/libkvm.h:550: warning: its scope is only this definition or declaration, which is probably not what you want /home/hollisb/source/kvm-userspace-ppc.hg/qemu/../libkvm/libkvm.h:561: warning: "struct kvm_pit_state" declared inside parameter list ../hw/i8254.c: In function `kvm_kernel_pit_save_to_user':
../hw/i8254.c:421: error: storage size of 'pit' isn't known
../hw/i8254.c:431: error: dereferencing pointer to incomplete type
[repeated a lot]

The below patch fixes the libkvm.h issue, taking the same approach as kvm_get/set_lapic() just above it. (I can't say I'm a fan of this approach, but kvm-userspace is eroding my idealism.)

The qemu breakage is fixed by Anthony's PIT patch that creates i8254-kvm.c.

Don't compile kvm_*_pit() on architectures whose currently supported platforms do not contain a PIT.

libkvm/libkvm.h +3 -0
@@ -539,6 +539,7 @@ int kvm_pit_in_kernel(kvm_context_t kvm)
 
 #ifdef KVM_CAP_PIT
 
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) 
 /*!
  * \brief Get in kernel PIT of the virtual domain
  *
@@ -562,6 +563,8 @@ int kvm_set_pit(kvm_context_t kvm, struc
 
 #endif
 
+#endif
+
 #ifdef KVM_CAP_VAPIC
 
 /*!
Signature · 8 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#4 lore raw
Quoted 18 lines · Hollis Blanchard

Don't compile kvm_*_pit() on architectures whose currently supported platforms do not contain a PIT.

libkvm/libkvm.h +1 -0
@@ -539,6 +539,7 @@ int kvm_pit_in_kernel(kvm_context_t kvm)
 
 #ifdef KVM_CAP_PIT
 
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) 
 /*!
  * \brief Get in kernel PIT of the virtual domain
  *

libkvm/libkvm.h int kvm_set_pit(kvm_context_t kvm, struc · line 568

Quoted 6 lines
libkvm/libkvm.h +2 -0
@@ -562,6 +563,8 @@ int kvm_set_pit(kvm_context_t kvm, struc
 
 #endif
 
+#endif
+
 #ifdef KVM_CAP_VAPIC

ia64 doesn't have an in-kernel pit? (yet?)

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#5 lore raw

Re: [kvm-ppc-devel] [PATCH] Move kvm_get_pit tolibkvm.c common code

Quoted 20 lines · Avi Kivity
Quoted 19 lines · Hollis Blanchard

Don't compile kvm_*_pit() on architectures whose currently supported platforms do not contain a PIT.

libkvm/libkvm.h +1 -0
@@ -539,6 +539,7 @@ int kvm_pit_in_kernel(kvm_context_t kvm)
 
 #ifdef KVM_CAP_PIT
 
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) 
 /*! 
  * \brief Get in kernel PIT of the virtual domain
  *
@@ -562,6 +563,8 @@ int kvm_set_pit(kvm_context_t kvm, struc
 
Quoted 7 lines

libkvm/libkvm.h int kvm_set_pit(kvm_context_t kvm, struc · line 568

Quoted 5 lines
libkvm/libkvm.h +2 -0
 #endif
 
+#endif
+
 #ifdef KVM_CAP_VAPIC

ia64 doesn't have an in-kernel pit? (yet?)

IA64 doesn't have pit on platform.
Xiantao

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/