[qemu] Add patch to fix default machine options. This fixes libvirt

Richard W.M. Jones rjones at fedoraproject.org
Tue Jul 10 09:59:45 UTC 2012


commit 91a090265ae10a5884425af76aa371e2e1dc74aa
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Tue Jul 10 10:58:42 2012 +0100

    Add patch to fix default machine options.  This fixes libvirt
    
      detection of qemu.

 0001-qemu-kvm-Fix-default-machine-options.patch |  120 +++++++++++++++++++++++
 qemu.spec                                       |   12 ++-
 2 files changed, 131 insertions(+), 1 deletions(-)
---
diff --git a/0001-qemu-kvm-Fix-default-machine-options.patch b/0001-qemu-kvm-Fix-default-machine-options.patch
new file mode 100644
index 0000000..fc9e2e0
--- /dev/null
+++ b/0001-qemu-kvm-Fix-default-machine-options.patch
@@ -0,0 +1,120 @@
+From ad47ffe7134fc7cd6a74fd3cdc0470723b883b93 Mon Sep 17 00:00:00 2001
+From: "Daniel P. Berrange" <berrange at redhat.com>
+Date: Tue, 10 Jul 2012 10:54:55 +0100
+Subject: [PATCH] qemu-kvm: Fix default machine options
+
+qemu-kvm-specific machine defaults were missing for pc-0.15 to pc-1.1.
+Then Daniel noted that --disable-kvm caused problems as the generated
+binaries would be unable to run. As we are at it, we can drop the
+kernel_irqchip=on that is now enable by default in upstream.
+---
+ hw/pc_piix.c |   23 ++++++++++++++++-------
+ 1 file changed, 16 insertions(+), 7 deletions(-)
+
+diff --git a/hw/pc_piix.c b/hw/pc_piix.c
+index 98a06fa..5860d52 100644
+--- a/hw/pc_piix.c
++++ b/hw/pc_piix.c
+@@ -353,6 +353,12 @@ static void pc_xen_hvm_init(ram_addr_t ram_size,
+ }
+ #endif
+ 
++#ifdef CONFIG_KVM_OPTIONS
++#define KVM_MACHINE_OPTIONS "accel=kvm"
++#else
++#define KVM_MACHINE_OPTIONS ""
++#endif
++
+ static QEMUMachine pc_machine_v1_2 = {
+     .name = "pc-1.2",
+     .alias = "pc",
+@@ -360,7 +366,7 @@ static QEMUMachine pc_machine_v1_2 = {
+     .init = pc_init_pci,
+     .max_cpus = 255,
+     .is_default = 1,
+-    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+ };
+ 
+ #define PC_COMPAT_1_1 \
+@@ -387,6 +393,7 @@ static QEMUMachine pc_machine_v1_1 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci,
+     .max_cpus = 255,
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_1_1,
+         { /* end of list */ }
+@@ -422,6 +429,7 @@ static QEMUMachine pc_machine_v1_0 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci,
+     .max_cpus = 255,
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_1_0,
+         { /* end of list */ }
+@@ -437,6 +445,7 @@ static QEMUMachine pc_machine_v0_15 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci,
+     .max_cpus = 255,
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_0_15,
+         { /* end of list */ }
+@@ -469,7 +478,7 @@ static QEMUMachine pc_machine_v0_14 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci,
+     .max_cpus = 255,
+-    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_0_14, 
+         {
+@@ -503,7 +512,7 @@ static QEMUMachine pc_machine_v0_13 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci_no_kvmclock,
+     .max_cpus = 255,
+-    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_0_13,
+         {
+@@ -541,7 +550,7 @@ static QEMUMachine pc_machine_v0_12 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci_no_kvmclock,
+     .max_cpus = 255,
+-    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_0_12,
+         {
+@@ -575,7 +584,7 @@ static QEMUMachine pc_machine_v0_11 = {
+     .desc = "Standard PC, qemu 0.11",
+     .init = pc_init_pci_no_kvmclock,
+     .max_cpus = 255,
+-    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_0_11,
+         {
+@@ -597,7 +606,7 @@ static QEMUMachine pc_machine_v0_10 = {
+     .desc = "Standard PC, qemu 0.10",
+     .init = pc_init_pci_no_kvmclock,
+     .max_cpus = 255,
+-    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_0_11,
+         {
+@@ -631,7 +640,7 @@ static QEMUMachine isapc_machine = {
+     .desc = "ISA-only PC",
+     .init = pc_init_isa,
+     .max_cpus = 1,
+-    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
++    .default_machine_opts = KVM_MACHINE_OPTIONS,
+     .compat_props = (GlobalProperty[]) {
+         {
+             .driver   = "pc-sysfw",
+-- 
+1.7.10.4
+
diff --git a/qemu.spec b/qemu.spec
index 9cf6e11..8c126e6 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -38,7 +38,7 @@
 Summary: QEMU is a FAST! processor emulator
 Name: qemu
 Version: 1.1.0
-Release: 5%{?dist}
+Release: 6%{?dist}
 # Epoch because we pushed a qemu-1.0 package
 Epoch: 2
 License: GPLv2+ and LGPLv2+ and BSD
@@ -86,6 +86,11 @@ Patch3:   0001-kvm-Enable-use-of-kvm_irqchip_in_kernel-in-hwlib-cod.patch
 # Sent upstream 2012-07-05.
 Patch4:   0001-Replace-struct-siginfo-with-siginfo_t.patch
 
+# Patch to fix default machine options.
+# http://www.spinics.net/lists/kvm/msg75509.html
+# Sent upstream by danpb on 2012-07-06.
+Patch5:   0001-qemu-kvm-Add-missing-default-machine-options.patch
+
 # The infamous chardev flow control patches
 Patch101: 0101-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
 Patch102: 0102-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
@@ -356,6 +361,7 @@ such as kvm_stat.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %patch101 -p1
 %patch102 -p1
@@ -809,6 +815,10 @@ fi
 %{_mandir}/man1/qemu-img.1*
 
 %changelog
+* Tue Jul 10 2012 Richard W.M. Jones <rjones at redhat.com> - 2:1.1.0-6
+- Add patch to fix default machine options.  This fixes libvirt
+  detection of qemu.
+
 * Fri Jul  6 2012 Hans de Goede <hdegoede at redhat.com> - 2:1.1.0-5
 - Fix qemu crashing (on an assert) whenever USB-2.0 isoc transfers are used
 


More information about the scm-commits mailing list