[patch] bugfix, make qemu-kvm build and run again on ia64

Jes Sorensen <[email protected]>
Newsgroups org.kernel.vger.kvm-ia64
Message-ID <[email protected]>
Hi,

With the recent changes to APIs in qemu-kvm, this patch makes it build
again on ia64.

This is a showstopper for ia64.

Cheers,
Jes
0010-qemu-kvm-build-fix.patch (text/x-patch, 5.4 KB)
Update ipf.c and Makefile.target for QEMU/ia64 to match recent
changes in QEMU.

Signed-off-by: Jes Sorensen <[email protected]>

---
 Makefile.target |    7 ++-----
 hw/ipf.c        |   50 ++++++++++++++++++++++++++------------------------
 2 files changed, 28 insertions(+), 29 deletions(-)

Index: qemu-kvm-2/Makefile.target
===================================================================
--- qemu-kvm-2.orig/Makefile.target
+++ qemu-kvm-2/Makefile.target
@@ -633,13 +633,10 @@
 endif
 ifeq ($(TARGET_BASE_ARCH), ia64)
 # Hardware support
-OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
+OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
-OBJS+= usb-uhci.o smbus_eeprom.o
-# virtio support
-OBJS+= virtio.o virtio-blk.o virtio-balloon.o
-OBJS+= virtio-net.o
+OBJS+= usb-uhci.o
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
Index: qemu-kvm-2/hw/ipf.c
===================================================================
--- qemu-kvm-2.orig/hw/ipf.c
+++ qemu-kvm-2/hw/ipf.c
@@ -373,7 +373,7 @@
 }
 
 /* Itanium hardware initialisation */
-static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
+static void ipf_init1(ram_addr_t ram_size,
                       const char *boot_device, DisplayState *ds,
                       const char *kernel_filename, const char *kernel_cmdline,
                       const char *initrd_filename,
@@ -381,7 +381,7 @@
 {
     char buf[1024];
     int i;
-    ram_addr_t ram_addr, vga_ram_addr;
+    ram_addr_t ram_addr;
     ram_addr_t above_4g_mem_size = 0;
     PCIBus *pci_bus;
     int piix3_devfn = -1;
@@ -421,7 +421,7 @@
         if (i != 0)
             env->hflags |= HF_HALTED_MASK;
         register_savevm("cpu", i, 4, cpu_save, cpu_load, env);
-        qemu_register_reset(main_cpu_reset, env);
+        qemu_register_reset(main_cpu_reset, 0, env);
     }
 
     /* allocate RAM */
@@ -440,8 +440,6 @@
         ram_addr = qemu_ram_alloc(ram_size);
         cpu_register_physical_memory(0, ram_size, ram_addr);
     }
-    /* allocate VGA RAM */
-    vga_ram_addr = qemu_ram_alloc(vga_ram_size);
 
     /* above 4giga memory allocation */
     if (above_4g_mem_size > 0) {
@@ -498,7 +496,7 @@
                                  ipf_legacy_io_mem);
 
     cpu_irq = qemu_allocate_irqs(pic_irq_request, first_cpu, 1);
-    i8259 = i8259_init(cpu_irq[0]);
+    i8259 = kvm_i8259_init(cpu_irq[0]);
 
     if (pci_enabled) {
         pci_bus = i440fx_init(&i440fx_state, i8259);
@@ -509,14 +507,14 @@
 
     if (cirrus_vga_enabled) {
         if (pci_enabled)
-            pci_cirrus_vga_init(pci_bus, vga_ram_size);
+            pci_cirrus_vga_init(pci_bus);
         else
-            isa_cirrus_vga_init(vga_ram_size);
+            isa_cirrus_vga_init();
     } else {
         if (pci_enabled)
-            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
+            pci_vga_init(pci_bus, 0, 0);
         else
-            isa_vga_init(vga_ram_size);
+            isa_vga_init();
     }
 
     rtc_state = rtc_init(0x70, i8259[8], 2000);
@@ -603,7 +601,11 @@
         /* TODO: Populate SPD eeprom data.  */
         smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, i8259[9]);
         for (i = 0; i < 8; i++) {
-            smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256));
+            DeviceState *eeprom;
+            eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
+            qdev_set_prop_int(eeprom, "address", 0x50 + i);
+            qdev_set_prop_ptr(eeprom, "data", eeprom_buf + (i * 256));
+            qdev_init(eeprom);
         }
     }
 
@@ -613,19 +615,11 @@
 
     if (pci_enabled) {
 	int max_bus;
-        int bus, unit;
-        void *scsi;
+        int bus;
 
         max_bus = drive_get_max_bus(IF_SCSI);
-
 	for (bus = 0; bus <= max_bus; bus++) {
-            scsi = lsi_scsi_init(pci_bus, -1);
-            for (unit = 0; unit < LSI_MAX_DEVS; unit++) {
-	        index = drive_get_index(IF_SCSI, bus, unit);
-		if (index == -1)
-		    continue;
-		lsi_scsi_attach(scsi, drives_table[index].bdrv, unit);
-	    }
+            pci_create_simple(pci_bus, -1, "lsi53c895a");
         }
     }
     /* Add virtio block devices */
@@ -634,7 +628,7 @@
 	int unit_id = 0;
 
 	while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
-	    virtio_blk_init(pci_bus, drives_table[index].bdrv);
+            pci_create_simple(pci_bus, -1, "virtio-blk-pci");
 	    unit_id++;
 	}
     }
@@ -646,14 +640,14 @@
 
 }
 
-static void ipf_init_pci(ram_addr_t ram_size, int vga_ram_size,
+static void ipf_init_pci(ram_addr_t ram_size,
                          const char *boot_device, DisplayState *ds,
                          const char *kernel_filename,
                          const char *kernel_cmdline,
                          const char *initrd_filename,
                          const char *cpu_model)
 {
-    ipf_init1(ram_size, vga_ram_size, boot_device, ds, kernel_filename,
+    ipf_init1(ram_size, boot_device, ds, kernel_filename,
               kernel_cmdline, initrd_filename, 1, cpu_model);
 }
 
@@ -662,8 +656,16 @@
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
     .max_cpus = 255,
+    .is_default = 1,
 };
 
+static void ipf_machine_init(void)
+{
+    qemu_register_machine(&ipf_machine);
+}
+
+machine_init(ipf_machine_init);
+
 #define IOAPIC_NUM_PINS 48
 
 static int ioapic_irq_count[IOAPIC_NUM_PINS];
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.