* [PATCH 1/3 - qemu-kvm stable-1.0] Fix conditional build of various x86 specific bits
@ 2012-05-24 2:14 Benjamin Herrenschmidt
2012-05-24 2:51 ` Jan Kiszka
2012-06-01 23:07 ` Marcelo Tosatti
0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2012-05-24 2:14 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm, Marcelo Tosatti
This adds/modifies ifdefs etc. and moves code to make sure that
x86-specific code doesn't get compiled on non-x86 platforms.
These changes all relate to code that is in the qemu-kvm tree and
not in the qemu tree.
The change from KVM_CAP_IRQCHIP to KVM_IRQCHIP_PIC_MASTER is because
the KVM_CAP_IRQCHIP symbol is defined on all platforms (though the
capability only exists on x86), whereas KVM_IRQCHIP_PIC_MASTER is
only defined on x86. (If a better symbol exists it could be used
instead.)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
An equivalent of this is already in qemu-kvm master as commit id
20ad1def644494f5055d129961d46b050c0a6158
Makefile.target | 2 ++
configure | 6 ++++--
hw/i8259.c | 6 ++++--
qemu-kvm-x86.c | 16 ++++++++++++++++
qemu-kvm.c | 30 ++++++++++++++----------------
5 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index 29eaa68..0d0baf4 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -80,7 +80,9 @@ endif
libobj-$(TARGET_SPARC64) += vis_helper.o
libobj-$(CONFIG_NEED_MMU) += mmu.o
+ifeq ($(TARGET_BASE_ARCH), i386)
libobj-$(CONFIG_KVM) += kvm-tpr-opt.o
+endif
libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
ifeq ($(TARGET_BASE_ARCH), sparc)
diff --git a/configure b/configure
index 4b7faec..79a49a9 100755
--- a/configure
+++ b/configure
@@ -3579,8 +3579,10 @@ case "$target_arch2" in
if test $kvm_cap_pit = "yes" ; then
echo "CONFIG_KVM_PIT=y" >> $config_target_mak
fi
- if test $kvm_cap_device_assignment = "yes" ; then
- echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
+ if test "$cpu" = "i386" -o "$cpu" = "x86_64" ; then
+ if test $kvm_cap_device_assignment = "yes" ; then
+ echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
+ fi
fi
fi
esac
diff --git a/hw/i8259.c b/hw/i8259.c
index a9ea9c9..c5841c0 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -635,7 +635,7 @@ static void pic_register(void)
static void kvm_kernel_pic_save_to_user(PicState *s)
{
-#ifdef KVM_CAP_IRQCHIP
+#ifdef KVM_IRQCHIP_PIC_MASTER
struct kvm_irqchip chip;
struct kvm_pic_state *kpic;
@@ -666,7 +666,7 @@ static void kvm_kernel_pic_save_to_user(PicState *s)
static int kvm_kernel_pic_load_from_user(PicState *s)
{
-#ifdef KVM_CAP_IRQCHIP
+#ifdef KVM_IRQCHIP_PIC_MASTER
struct kvm_irqchip chip;
struct kvm_pic_state *kpic;
@@ -701,8 +701,10 @@ static void kvm_i8259_set_irq(void *opaque, int irq, int level)
{
int pic_ret;
if (kvm_set_irq(irq, level, &pic_ret)) {
+#ifdef KVM_IRQCHIP_PIC_MASTER
if (pic_ret != 0)
apic_set_irq_delivered();
+#endif
return;
}
}
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index a7981b1..f1db968 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -23,6 +23,22 @@
#include "kvm.h"
#include "hw/apic.h"
+int kvm_reinject_control(KVMState *s, int pit_reinject)
+{
+#ifdef KVM_CAP_REINJECT_CONTROL
+ int r;
+ struct kvm_reinject_control control;
+
+ control.pit_reinject = pit_reinject;
+
+ r = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_REINJECT_CONTROL);
+ if (r > 0) {
+ return kvm_vm_ioctl(s, KVM_REINJECT_CONTROL, &control);
+ }
+#endif
+ return -ENOSYS;
+}
+
static int kvm_create_pit(KVMState *s)
{
int r;
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 8d68545..f37535d 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -222,22 +222,6 @@ int kvm_deassign_pci_device(KVMState *s,
}
#endif
-int kvm_reinject_control(KVMState *s, int pit_reinject)
-{
-#ifdef KVM_CAP_REINJECT_CONTROL
- int r;
- struct kvm_reinject_control control;
-
- control.pit_reinject = pit_reinject;
-
- r = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_REINJECT_CONTROL);
- if (r > 0) {
- return kvm_vm_ioctl(s, KVM_REINJECT_CONTROL, &control);
- }
-#endif
- return -ENOSYS;
-}
-
int kvm_has_gsi_routing(void)
{
int r = 0;
@@ -463,6 +447,7 @@ int kvm_get_irq_route_gsi(void)
return -ENOSPC;
}
+#ifdef KVM_CAP_IRQ_ROUTING
static void kvm_msi_routing_entry(struct kvm_irq_routing_entry *e,
KVMMsiMessage *msg)
@@ -474,9 +459,11 @@ static void kvm_msi_routing_entry(struct kvm_irq_routing_entry *e,
e->u.msi.address_hi = msg->addr_hi;
e->u.msi.data = msg->data;
}
+#endif
int kvm_msi_message_add(KVMMsiMessage *msg)
{
+#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_entry e;
int ret;
@@ -488,18 +475,26 @@ int kvm_msi_message_add(KVMMsiMessage *msg)
kvm_msi_routing_entry(&e, msg);
return kvm_add_routing_entry(&e);
+#else
+ return -ENOSYS;
+#endif
}
int kvm_msi_message_del(KVMMsiMessage *msg)
{
+#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_entry e;
kvm_msi_routing_entry(&e, msg);
return kvm_del_routing_entry(&e);
+#else
+ return -ENOSYS;
+#endif
}
int kvm_msi_message_update(KVMMsiMessage *old, KVMMsiMessage *new)
{
+#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_entry e1, e2;
int ret;
@@ -517,6 +512,9 @@ int kvm_msi_message_update(KVMMsiMessage *old, KVMMsiMessage *new)
}
return 1;
+#else
+ return -ENOSYS;
+#endif
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/3 - qemu-kvm stable-1.0] Fix conditional build of various x86 specific bits
2012-05-24 2:14 [PATCH 1/3 - qemu-kvm stable-1.0] Fix conditional build of various x86 specific bits Benjamin Herrenschmidt
@ 2012-05-24 2:51 ` Jan Kiszka
2012-05-24 3:03 ` Benjamin Herrenschmidt
2012-06-01 23:07 ` Marcelo Tosatti
1 sibling, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2012-05-24 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Avi Kivity, kvm, Marcelo Tosatti
[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]
On 2012-05-23 23:14, Benjamin Herrenschmidt wrote:
> This adds/modifies ifdefs etc. and moves code to make sure that
> x86-specific code doesn't get compiled on non-x86 platforms.
> These changes all relate to code that is in the qemu-kvm tree and
> not in the qemu tree.
>
> The change from KVM_CAP_IRQCHIP to KVM_IRQCHIP_PIC_MASTER is because
> the KVM_CAP_IRQCHIP symbol is defined on all platforms (though the
> capability only exists on x86), whereas KVM_IRQCHIP_PIC_MASTER is
> only defined on x86. (If a better symbol exists it could be used
> instead.)
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> An equivalent of this is already in qemu-kvm master as commit id
> 20ad1def644494f5055d129961d46b050c0a6158
What is the interest of patching qemu-kvm for non-x86? It is not
supposed to be used for this. And the affected bits are history in 1.1
(or 1.2 latest). Are there distros proving QEMU based on qemu-kvm for
non-x86 hosts?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3 - qemu-kvm stable-1.0] Fix conditional build of various x86 specific bits
2012-05-24 2:51 ` Jan Kiszka
@ 2012-05-24 3:03 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2012-05-24 3:03 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm, Marcelo Tosatti
> > An equivalent of this is already in qemu-kvm master as commit id
> > 20ad1def644494f5055d129961d46b050c0a6158
>
> What is the interest of patching qemu-kvm for non-x86? It is not
> supposed to be used for this. And the affected bits are history in 1.1
> (or 1.2 latest). Are there distros proving QEMU based on qemu-kvm for
> non-x86 hosts?
Fedora uses qemu-kvm as their "upstream" qemu source tree for all qemu
builds, KVM and non-KVM ones, for all targets.
These fixes are necessary to make qemu in fc17 (and later) to build
ppc64-softmmu targets (with and without KVM).
Cheers,
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3 - qemu-kvm stable-1.0] Fix conditional build of various x86 specific bits
2012-05-24 2:14 [PATCH 1/3 - qemu-kvm stable-1.0] Fix conditional build of various x86 specific bits Benjamin Herrenschmidt
2012-05-24 2:51 ` Jan Kiszka
@ 2012-06-01 23:07 ` Marcelo Tosatti
1 sibling, 0 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2012-06-01 23:07 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Avi Kivity, kvm
On Thu, May 24, 2012 at 12:14:50PM +1000, Benjamin Herrenschmidt wrote:
> This adds/modifies ifdefs etc. and moves code to make sure that
> x86-specific code doesn't get compiled on non-x86 platforms.
> These changes all relate to code that is in the qemu-kvm tree and
> not in the qemu tree.
>
> The change from KVM_CAP_IRQCHIP to KVM_IRQCHIP_PIC_MASTER is because
> the KVM_CAP_IRQCHIP symbol is defined on all platforms (though the
> capability only exists on x86), whereas KVM_IRQCHIP_PIC_MASTER is
> only defined on x86. (If a better symbol exists it could be used
> instead.)
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-01 23:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-24 2:14 [PATCH 1/3 - qemu-kvm stable-1.0] Fix conditional build of various x86 specific bits Benjamin Herrenschmidt
2012-05-24 2:51 ` Jan Kiszka
2012-05-24 3:03 ` Benjamin Herrenschmidt
2012-06-01 23:07 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox