Skip to contentSkip to conversation

Compat cleanups

PATCH In review Mark McLoughlin 2 participants 5 messages Jul 30, 2009

lore
Share & tools
lore
#0 lore raw

cover Compat cleanups

Hi,
These two seem to have dropped through the cracks. The make
sense for stable-0.11 too

Cheers,
Mark.

#1 lore raw

PATCH 1/2 Remove the pc-0-10 machine type

We have the pc-0.10 machine type now which does exactly the same thing.

---
 hw/pc.c |   55 +++++--------------------------------------------------
 1 files changed, 5 insertions(+), 50 deletions(-)
hw/pc.c +5 -50
index 46ff8cf..bc9e646 100644
@@ -1100,11 +1100,6 @@ static CPUState *pc_new_cpu(const char *cpu_model)
     return env;
 }
 
-enum {
-    COMPAT_DEFAULT = 0,
-    COMPAT_0_10, /* compatible with qemu 0.10.x */
-};
-
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size,
                      const char *boot_device,
@@ -1112,8 +1107,7 @@ static void pc_init1(ram_addr_t ram_size,
                      const char *kernel_cmdline,
                      const char *initrd_filename,
                      const char *cpu_model,
-                     int pci_enabled,
-                     int compat_level)
+                     int pci_enabled)
 {
     char *filename;
     int ret, linux_boot, i;
@@ -1131,7 +1125,6 @@ static void pc_init1(ram_addr_t ram_size,
     BlockDriverState *fd[MAX_FD];
     int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;
     void *fw_cfg;
-    const char *virtio_blk_name, *virtio_console_name;
 
     if (ram_size >= 0xe0000000 ) {
         above_4g_mem_size = ram_size - 0xe0000000;
@@ -1416,25 +1409,12 @@ static void pc_init1(ram_addr_t ram_size,
         }
     }
 
-    switch (compat_level) {
-    case COMPAT_DEFAULT:
-    default:
-        virtio_blk_name = "virtio-blk-pci";
-        virtio_console_name = "virtio-console-pci";
-        break;
-
-    case COMPAT_0_10:
-        virtio_blk_name = "virtio-blk-pci-0-10";
-        virtio_console_name = "virtio-console-pci-0-10";
-        break;
-    }
-
     /* Add virtio block devices */
     if (pci_enabled) {
         int unit_id = 0;
 
         while ((dinfo = drive_get(IF_VIRTIO, 0, unit_id)) != NULL) {
-            pci_dev = pci_create(virtio_blk_name,
+            pci_dev = pci_create("virtio-blk-pci",
                                  dinfo->devaddr);
             qdev_init(&pci_dev->qdev);
             unit_id++;
@@ -1451,7 +1431,7 @@ static void pc_init1(ram_addr_t ram_size,
     if (pci_enabled) {
         for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
             if (virtcon_hds[i]) {
-                pci_create_simple(pci_bus, -1, virtio_console_name);
+                pci_create_simple(pci_bus, -1, "virtio-console-pci");
             }
         }
     }
@@ -1466,8 +1446,7 @@ static void pc_init_pci(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model,
-             1, COMPAT_DEFAULT);
+             initrd_filename, cpu_model, 1);
 }
 
 static void pc_init_isa(ram_addr_t ram_size,
@@ -1479,21 +1458,7 @@ static void pc_init_isa(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model,
-             0, COMPAT_DEFAULT);
-}
-
-static void pc_init_pci_0_10(ram_addr_t ram_size,
-                             const char *boot_device,
-                             const char *kernel_filename,
-                             const char *kernel_cmdline,
-                             const char *initrd_filename,
-                             const char *cpu_model)
-{
-    pc_init1(ram_size, boot_device,
-             kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model,
-             1, COMPAT_0_10);
+             initrd_filename, cpu_model, 0);
 }
 
 /* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
@@ -1543,21 +1508,11 @@ static QEMUMachine isapc_machine = {
     .max_cpus = 1,
 };
 
-static QEMUMachine pc_0_10_machine = {
-    .name = "pc-0-10",
-    .desc = "Standard PC compatible with qemu 0.10.x",
-    .init = pc_init_pci_0_10,
-    .max_cpus = 255,
-};
-
 static void pc_machine_init(void)
 {
     qemu_register_machine(&pc_machine);
     qemu_register_machine(&pc_machine_v0_10);
     qemu_register_machine(&isapc_machine);
-
-    /* For compatibility with 0.10.x */
-    qemu_register_machine(&pc_0_10_machine);
 }
 
 machine_init(pc_machine_init);
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 2/2 Remove the virtio-{blk, console}-pci-0-10 device types

In reply to Mark McLoughlin

These are now unused.

However, perhaps the idea is that when we add -device, they will be useful? In that case, we should add virtio-net-pci-0-10 too.

---
 hw/virtio-pci.c |   57 ++++++++++--------------------------------------------
 1 files changed, 11 insertions(+), 46 deletions(-)
hw/virtio-pci.c +11 -46
index 1f922c2..703f4fe 100644
@@ -423,63 +423,37 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
     virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
 }
 
-static void virtio_blk_init_pci_with_class(PCIDevice *pci_dev,
-                                           uint16_t class_code)
+static void virtio_blk_init_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
 
-    vdev = virtio_blk_init(&pci_dev->qdev);
-    virtio_init_pci(proxy, vdev,
-                    PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_BLOCK,
-                    class_code, 0x00);
-}
-
-static void virtio_blk_init_pci(PCIDevice *pci_dev)
-{
-    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
-  
     if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&
         proxy->class_code != PCI_CLASS_STORAGE_OTHER)
         proxy->class_code = PCI_CLASS_STORAGE_SCSI;
- 
-    virtio_blk_init_pci_with_class(pci_dev, proxy->class_code);
-}
-
-static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev)
-{
-    virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_OTHER);
-}
-
-static void virtio_console_init_pci_with_class(PCIDevice *pci_dev,
-                                               uint16_t class_code)
-{
-    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
-    VirtIODevice *vdev;
 
-    vdev = virtio_console_init(&pci_dev->qdev);
+    vdev = virtio_blk_init(&pci_dev->qdev);
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_CONSOLE,
-                    class_code, 0x00);
+                    PCI_DEVICE_ID_VIRTIO_BLOCK,
+                    proxy->class_code, 0x00);
 }
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
-  
+    VirtIODevice *vdev;
+
     if (proxy->class_code != PCI_CLASS_COMMUNICATION_OTHER &&
         proxy->class_code != PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 */
         proxy->class_code != PCI_CLASS_OTHERS)          /* qemu-kvm  */
         proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
 
-    virtio_console_init_pci_with_class(pci_dev, proxy->class_code);
-}
-
-static void virtio_console_init_pci_0_10(PCIDevice *pci_dev)
-{
-    virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_DISPLAY_OTHER);
+    vdev = virtio_console_init(&pci_dev->qdev);
+    virtio_init_pci(proxy, vdev,
+                    PCI_VENDOR_ID_REDHAT_QUMRANET,
+                    PCI_DEVICE_ID_VIRTIO_CONSOLE,
+                    proxy->class_code, 0x00);
 }
 
 static void virtio_net_init_pci(PCIDevice *pci_dev)
@@ -561,15 +535,6 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_balloon_init_pci,
     },{
-        /* For compatibility with 0.10 */
-        .qdev.name = "virtio-blk-pci-0-10",
-        .qdev.size = sizeof(VirtIOPCIProxy),
-        .init      = virtio_blk_init_pci_0_10,
-    },{
-        .qdev.name = "virtio-console-pci-0-10",
-        .qdev.size = sizeof(VirtIOPCIProxy),
-        .init      = virtio_console_init_pci_0_10,
-    },{
         /* end of list */
     }
 };
Signature · 1 line
1.6.2.5
Acked-by on v1 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] Remove the virtio-{blk, console}-pci-0-10 device types

Quoted 4 lines · Mark McLoughlin

These are now unused.

However, perhaps the idea is that when we add -device, they will be useful? In that case, we should add virtio-net-pci-0-10 too.

With -device you can switch devices into compat mode by simply setting the attribute. Doesn't work (yet) because you can't create functional virtio console+block devices via -device right now. I'll plan to have that fixed at least for virtio blk soon though. For virtio-net this can be done today (-net nic,model=virtio,vectors=0 turns off msi).

So IMHO there is no need in keeping the device types and the patch should be applied.

cheers,
Gerd