Skip to contentSkip to conversation

qemu-kvm compat (v3)

PATCH In review Marcelo Tosatti 3 participants 10 messages Oct 5, 2012 – Oct 8, 2012

lore
Share & tools
lore
#0 lore raw

cover qemu-kvm compat (v3)

As discussed on this weeks qemu call, follows qemu-kvm compat patches for qemu:

- command line compatibility
- allow configurable ram size for cirrus

Jan, please ACK.

v3:
- improve changelog wording

v2:

- add -no-kvm command line compatibility
- change command documentation to deprecated style
- improve changelogs

#1 lore raw

PATCH 1/7 cirrus_vga: allow configurable vram size

Allow RAM size to be configurable for cirrus, to allow migration compatibility from qemu-kvm.

hw/cirrus_vga.c +16 -5
Index: qemu-compat-kvm/hw/cirrus_vga.c
===================================================================
@@ -43,8 +43,6 @@
 //#define DEBUG_CIRRUS
 //#define DEBUG_BITBLT
 
-#define VGA_RAM_SIZE (8192 * 1024)
-
 /***************************************
  *
  *  definitions
@@ -2853,7 +2851,8 @@ static void cirrus_init_common(CirrusVGA
 
     /* I/O handler for LFB */
     memory_region_init_io(&s->cirrus_linear_io, &cirrus_linear_io_ops, s,
-                          "cirrus-linear-io", VGA_RAM_SIZE);
+                          "cirrus-linear-io", s->vga.vram_size_mb
+                                              * 1024 * 1024);
 
     /* I/O handler for LFB */
     memory_region_init_io(&s->cirrus_linear_bitblt_io,
@@ -2893,7 +2892,6 @@ static int vga_initfn(ISADevice *dev)
     ISACirrusVGAState *d = DO_UPCAST(ISACirrusVGAState, dev, dev);
     VGACommonState *s = &d->cirrus_vga.vga;
 
-    s->vram_size_mb = VGA_RAM_SIZE >> 20;
     vga_common_init(s);
     cirrus_init_common(&d->cirrus_vga, CIRRUS_ID_CLGD5430, 0,
                        isa_address_space(dev));
@@ -2906,6 +2904,12 @@ static int vga_initfn(ISADevice *dev)
     return 0;
 }
 
+static Property isa_vga_cirrus_properties[] = {
+    DEFINE_PROP_UINT32("vgamem_mb", struct ISACirrusVGAState,
+                       cirrus_vga.vga.vram_size_mb, 8),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void isa_cirrus_vga_class_init(ObjectClass *klass, void *data)
 {
     ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
@@ -2913,6 +2917,7 @@ static void isa_cirrus_vga_class_init(Ob
 
     dc->vmsd  = &vmstate_cirrus_vga;
     k->init   = vga_initfn;
+    dc->props = isa_vga_cirrus_properties;
 }
 
 static TypeInfo isa_cirrus_vga_info = {
@@ -2936,7 +2941,6 @@ static int pci_cirrus_vga_initfn(PCIDevi
      int16_t device_id = pc->device_id;
 
      /* setup VGA */
-     s->vga.vram_size_mb = VGA_RAM_SIZE >> 20;
      vga_common_init(&s->vga);
      cirrus_init_common(s, device_id, 1, pci_address_space(dev));
      s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate,
@@ -2968,6 +2972,12 @@ DeviceState *pci_cirrus_vga_init(PCIBus 
     return &pci_create_simple(bus, -1, "cirrus-vga")->qdev;
 }
 
+static Property pci_vga_cirrus_properties[] = {
+    DEFINE_PROP_UINT32("vgamem_mb", struct PCICirrusVGAState,
+                       cirrus_vga.vga.vram_size_mb, 8),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void cirrus_vga_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -2981,6 +2991,7 @@ static void cirrus_vga_class_init(Object
     k->class_id = PCI_CLASS_DISPLAY_VGA;
     dc->desc = "Cirrus CLGD 54xx VGA";
     dc->vmsd = &vmstate_pci_cirrus_vga;
+    dc->props = pci_vga_cirrus_properties;
 }
 
 static TypeInfo cirrus_vga_info = {
#4 lore raw

PATCH 3/7 Issue warning when deprecated -no-kvm-pit is used

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Releases of qemu-kvm will be interrupted at qemu 1.3.0. Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line options specific to qemu-kvm, port these switches from qemu-kvm to qemu.git.

Port -no-kvm-pit option.

vl.c +5 -0
Index: qemu-compat-kvm/vl.c
===================================================================
@@ -3066,6 +3066,11 @@ int main(int argc, char **argv, char **e
                     machine = machine_parse(optarg);
                 }
                 break;
+            case QEMU_OPTION_no_kvm_pit: {
+                fprintf(stderr, "Warning: KVM PIT can no longer be disabled "
+                                "separately.\n");
+                break;
+            }
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
qemu-options.hx +3 -0
Index: qemu-compat-kvm/qemu-options.hx
===================================================================
@@ -2838,6 +2838,9 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
+HXCOMM Deprecated (ignored)
+DEF("no-kvm-pit", HAS_ARG, QEMU_OPTION_no_kvm_pit, "", QEMU_ARCH_I386)
+
 HXCOMM Deprecated by -machine kernel_irqchip=on|off property
 DEF("no-kvm-irqchip", HAS_ARG, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386)
 
#6 lore raw

PATCH 5/7 Issue warning when deprecated drive parameter boot=on|off is used

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Releases of qemu-kvm will be interrupted at qemu 1.3.0. Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line options specific to qemu-kvm, port these switches from qemu-kvm to qemu.git.

Port drive boot option. From the qemu-kvm original commit message:

We do not want to maintain this option forever. It will be removed after a grace period of a few releases. So warn the user that this option has no effect and will become invalid soon.

blockdev.c +6 -0
Index: qemu-compat-kvm/blockdev.c
===================================================================
@@ -432,6 +432,12 @@ DriveInfo *drive_init(QemuOpts *opts, in
         return NULL;
     }
 
+    if (qemu_opt_get(opts, "boot") != NULL) {
+        fprintf(stderr, "qemu-kvm: boot=on|off is deprecated and will be "
+                "ignored. Future versions will reject this parameter. Please "
+                "update your scripts.\n");
+    }
+
     on_write_error = BLOCK_ERR_STOP_ENOSPC;
     if ((buf = qemu_opt_get(opts, "werror")) != NULL) {
         if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) {
qemu-config.c +4 -0
Index: qemu-compat-kvm/qemu-config.c
===================================================================
@@ -114,6 +114,10 @@ static QemuOptsList qemu_drive_opts = {
             .name = "copy-on-read",
             .type = QEMU_OPT_BOOL,
             .help = "copy read data from backing file into image file",
+        },{
+            .name = "boot",
+            .type = QEMU_OPT_BOOL,
+            .help = "(deprecated, ignored)",
         },
         { /* end of list */ }
     },
#8 lore raw

PATCH 7/7 Emulate qemu-kvms -no-kvm option

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Releases of qemu-kvm will be interrupted at qemu 1.3.0. Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line options specific to qemu-kvm, port these switches from qemu-kvm to qemu.git.

Port -no-kvm option.

vl.c +4 -0
Index: qemu-compat-kvm/vl.c
===================================================================
@@ -3066,6 +3066,10 @@ int main(int argc, char **argv, char **e
                     machine = machine_parse(optarg);
                 }
                 break;
+             case QEMU_OPTION_no_kvm:
+                olist = qemu_find_opts("machine");
+                qemu_opts_parse(olist, "accel=tcg", 0);
+                break;
             case QEMU_OPTION_no_kvm_pit: {
                 fprintf(stderr, "Warning: KVM PIT can no longer be disabled "
                                 "separately.\n");
qemu-options.hx +3 -0
Index: qemu-compat-kvm/qemu-options.hx
===================================================================
@@ -2838,6 +2838,9 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
+HXCOMM Deprecated by -machine accel=tcg property
+DEF("no-kvm", HAS_ARG, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
+
 HXCOMM Deprecated by kvm-pit driver properties
 DEF("no-kvm-pit-reinjection", HAS_ARG, QEMU_OPTION_no_kvm_pit_reinjection,
     "", QEMU_ARCH_I386)
#3 lore raw

PATCH 2/7 Use machine options to emulate -no-kvm-irqchip

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Releases of qemu-kvm will be interrupted at qemu 1.3.0. Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line options specific to qemu-kvm, port these switches from qemu-kvm to qemu.git.

Port -no-kvm-irqchip option.

vl.c +5 -0
Index: qemu-compat-kvm/vl.c
===================================================================
@@ -2470,6 +2470,11 @@ int main(int argc, char **argv, char **e
             case QEMU_OPTION_M:
                 machine = machine_parse(optarg);
                 break;
+            case QEMU_OPTION_no_kvm_irqchip: {
+                olist = qemu_find_opts("machine");
+                qemu_opts_parse(olist, "kernel_irqchip=off", 0);
+                break;
+            }
             case QEMU_OPTION_cpu:
                 /* hw initialization will check this */
                 cpu_model = optarg;
qemu-options.hx +3 -0
Index: qemu-compat-kvm/qemu-options.hx
===================================================================
@@ -2838,6 +2838,9 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
+HXCOMM Deprecated by -machine kernel_irqchip=on|off property
+DEF("no-kvm-irqchip", HAS_ARG, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386)
+
 HXCOMM This is the last statement. Insert new options before this line!
 STEXI
 @end table
#5 lore raw

PATCH 4/7 Use global properties to emulate -no-kvm-pit-reinjection

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Releases of qemu-kvm will be interrupted at qemu 1.3.0. Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line options specific to qemu-kvm, port these switches from qemu-kvm to qemu.git.

Port -no-kvm-pit-reinjection.

vl.c +15 -0
Index: qemu-compat-kvm/vl.c
===================================================================
@@ -3071,6 +3071,21 @@ int main(int argc, char **argv, char **e
                                 "separately.\n");
                 break;
             }
+            case QEMU_OPTION_no_kvm_pit_reinjection: {
+                static GlobalProperty kvm_pit_lost_tick_policy[] = {
+                    {
+                        .driver   = "kvm-pit",
+                        .property = "lost_tick_policy",
+                        .value    = "discard",
+                    },
+                    { /* end of list */ }
+                };
+
+                fprintf(stderr, "Warning: option deprecated, use "
+                        "lost_tick_policy property of kvm-pit instead.\n");
+                qdev_prop_register_global_list(kvm_pit_lost_tick_policy);
+                break;
+            }
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
qemu-options.hx +4 -0
Index: qemu-compat-kvm/qemu-options.hx
===================================================================
@@ -2838,6 +2838,10 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
+HXCOMM Deprecated by kvm-pit driver properties
+DEF("no-kvm-pit-reinjection", HAS_ARG, QEMU_OPTION_no_kvm_pit_reinjection,
+    "", QEMU_ARCH_I386)
+
 HXCOMM Deprecated (ignored)
 DEF("no-kvm-pit", HAS_ARG, QEMU_OPTION_no_kvm_pit, "", QEMU_ARCH_I386)
 
#7 lore raw

PATCH 6/7 Issue warning when deprecated -tdf option is used

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Releases of qemu-kvm will be interrupted at qemu 1.3.0. Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line options specific to qemu-kvm, port these switches from qemu-kvm to qemu.git.

Port -tdf option.

vl.c +4 -0
Index: qemu-compat-kvm/vl.c
===================================================================
@@ -3169,6 +3169,10 @@ int main(int argc, char **argv, char **e
             case QEMU_OPTION_semihosting:
                 semihosting_enabled = 1;
                 break;
+            case QEMU_OPTION_tdf:
+                fprintf(stderr, "Warning: user space PIT time drift fix "
+                                "is no longer supported.\n");
+                break;
             case QEMU_OPTION_name:
                 qemu_name = g_strdup(optarg);
 		 {
qemu-options.hx +3 -0
Index: qemu-compat-kvm/qemu-options.hx
===================================================================
@@ -2848,6 +2848,9 @@ DEF("no-kvm-pit", HAS_ARG, QEMU_OPTION_n
 HXCOMM Deprecated by -machine kernel_irqchip=on|off property
 DEF("no-kvm-irqchip", HAS_ARG, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386)
 
+HXCOMM Deprecated (ignored)
+DEF("tdf", 0, QEMU_OPTION_tdf,"", QEMU_ARCH_ALL)
+
 HXCOMM This is the last statement. Insert new options before this line!
 STEXI
 @end table
#9 lore raw
In reply to Marcelo Tosatti
Quoted 7 lines · Marcelo Tosatti

As discussed on this weeks qemu call, follows qemu-kvm compat patches for qemu:

- command line compatibility
- allow configurable ram size for cirrus

Jan, please ACK.

Ack for the switches.

Thanks,
Jan

Quoted 13 lines

v3:
- improve changelog wording

v2:

- add -no-kvm command line compatibility
- change command documentation to deprecated style
- improve changelogs

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux