Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
kvm
kvm-qemu-macmodel.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kvm-qemu-macmodel.patch of Package kvm
#qemu-only -> submit upstream qemu, but improve first: # undo rather hacky pci_enabled -> model > MODEL_ISA changes # and replace checks wether to enable newer emulated Mac hardware # depending in the bits in a bitfield which is passed pc_init1() # like this: pc_init1(.... , ISA, ...) # pc_init1(.... , PCI | IOAPIC | PIIX, ..... # pc_init1(.... , PCI | ICH6, LPC, SMC , ...) Index: qemu-kvm-0.10.5/hw/pc.c =================================================================== --- qemu-kvm-0.10.5.orig/hw/pc.c +++ qemu-kvm-0.10.5/hw/pc.c @@ -91,6 +91,12 @@ static void option_rom_setup_reset(targe qemu_register_reset(option_rom_reset, rrd); } +enum pc_model { + MODEL_ISA = 0, + MODEL_PCI = 1, + MODEL_MAC = 2 +}; + static void ioport80_write(void *opaque, uint32_t addr, uint32_t data) { } @@ -814,7 +820,7 @@ static void pc_init1(ram_addr_t ram_size const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, - int pci_enabled, const char *cpu_model) + int model, const char *cpu_model) { char buf[1024]; int ret, linux_boot, i; @@ -842,15 +848,19 @@ static void pc_init1(ram_addr_t ram_size /* init CPUs */ if (cpu_model == NULL) { + if(model == MODEL_MAC) { + cpu_model = "coreduo"; + } else { #ifdef TARGET_X86_64 - cpu_model = "qemu64"; + cpu_model = "qemu64"; #else - cpu_model = "qemu32"; + cpu_model = "qemu32"; #endif + } } for(i = 0; i < smp_cpus; i++) { - env = pc_new_cpu(i, cpu_model, pci_enabled); + env = pc_new_cpu(i, cpu_model, model > MODEL_ISA); } vmport_init(); @@ -889,8 +899,16 @@ static void pc_init1(ram_addr_t ram_size vga_ram_addr = qemu_ram_alloc(vga_ram_size); /* BIOS load */ - if (bios_name == NULL) - bios_name = BIOS_FILENAME; + if (bios_name == NULL) { + switch(model) { + case MODEL_MAC: + bios_name = "bios-mac.bin"; + break; + default: + bios_name = BIOS_FILENAME; + break; + } + } snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); bios_size = get_image_size(buf); if (bios_size <= 0 || @@ -998,7 +1016,7 @@ vga_bios_error: i8259 = i8259_init(cpu_irq[0]); ferr_irq = i8259[13]; - if (pci_enabled) { + if (model > MODEL_ISA) { pci_bus = i440fx_init(&i440fx_state, i8259); piix3_devfn = piix3_init(pci_bus, -1); } else { @@ -1011,7 +1029,7 @@ vga_bios_error: register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); if (cirrus_vga_enabled) { - if (pci_enabled) { + if (model > MODEL_ISA) { pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr, vga_ram_addr, vga_ram_size); @@ -1020,13 +1038,13 @@ vga_bios_error: vga_ram_addr, vga_ram_size); } } else if (vmsvga_enabled) { - if (pci_enabled) + if (model > MODEL_ISA) pci_vmsvga_init(pci_bus, phys_ram_base + vga_ram_addr, vga_ram_addr, vga_ram_size); else fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__); } else if (std_vga_enabled) { - if (pci_enabled) { + if (model > MODEL_ISA) { pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr, vga_ram_addr, vga_ram_size, 0, 0); } else { @@ -1042,8 +1060,13 @@ vga_bios_error: register_ioport_read(0x92, 1, 1, ioport92_read, NULL); register_ioport_write(0x92, 1, 1, ioport92_write, NULL); - if (pci_enabled) { - ioapic = ioapic_init(); + switch (model) { + case MODEL_MAC: + applesmc_init(); + lpc_init(pci_bus, piix3_devfn, i8259); + case MODEL_PCI: + ioapic = ioapic_init(); + break; } #ifdef USE_KVM_PIT if (kvm_enabled() && qemu_kvm_pit_in_kernel()) @@ -1055,7 +1078,7 @@ vga_bios_error: if (!no_hpet) { hpet_init(i8259); } - if (pci_enabled) { + if (model > MODEL_ISA) { pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic); } @@ -1076,7 +1099,7 @@ vga_bios_error: for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; - if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) + if (model == MODEL_ISA || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) pc_init_ne2k_isa(nd, i8259); else pci_nic_init(pci_bus, nd, -1, "rtl8139"); @@ -1097,19 +1120,25 @@ vga_bios_error: hd[i] = NULL; } - if (pci_enabled) { - pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1, i8259); - } else { - for(i = 0; i < MAX_IDE_BUS; i++) { - isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], - hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); - } + switch(model) { + case MODEL_MAC: + pci_ich6_ide_init(pci_bus, hd, piix3_devfn + 1, i8259); + break; + case MODEL_PCI: + pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1, i8259); + break; + default: + for(i = 0; i < 2; i++) { + isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], + hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); + } + break; } i8042_init(i8259[1], i8259[12], 0x60); DMA_init(0); #ifdef HAS_AUDIO - audio_init(pci_enabled ? pci_bus : NULL, i8259); + audio_init((model > MODEL_ISA) ? pci_bus : NULL, i8259); #endif for(i = 0; i < MAX_FD; i++) { @@ -1123,11 +1152,11 @@ vga_bios_error: cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd); - if (pci_enabled && usb_enabled) { + if ((model > MODEL_ISA) && usb_enabled) { usb_uhci_piix3_init(pci_bus, piix3_devfn + 2); } - if (pci_enabled && acpi_enabled) { + if ((model > MODEL_ISA) && acpi_enabled) { uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ i2c_bus *smbus; @@ -1142,7 +1171,7 @@ vga_bios_error: i440fx_init_memory_mappings(i440fx_state); } - if (pci_enabled) { + if (model > MODEL_ISA) { int max_bus; int bus, unit; void *scsi; @@ -1161,7 +1190,7 @@ vga_bios_error: } /* Add virtio block devices */ - if (pci_enabled) { + if (model > MODEL_ISA) { int index; int unit_id = 0; @@ -1184,11 +1213,11 @@ vga_bios_error: } /* Add virtio balloon device */ - if (pci_enabled) + if (model > MODEL_ISA) virtio_balloon_init(pci_bus); /* Add virtio console devices */ - if (pci_enabled) { + if (model > MODEL_ISA) { for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { if (virtcon_hds[i]) virtio_console_init(pci_bus, virtcon_hds[i]); @@ -1203,6 +1232,18 @@ vga_bios_error: #endif /* USE_KVM_DEVICE_ASSIGNMENT */ } +static void pc_init_mac(ram_addr_t ram_size, int vga_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, vga_ram_size, boot_device, + kernel_filename, kernel_cmdline, + initrd_filename, MODEL_MAC, cpu_model); +} + static void pc_init_pci(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, const char *kernel_filename, @@ -1212,7 +1253,7 @@ static void pc_init_pci(ram_addr_t ram_s { pc_init1(ram_size, vga_ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename, 1, cpu_model); + initrd_filename, MODEL_PCI, cpu_model); } static void pc_init_isa(ram_addr_t ram_size, int vga_ram_size, @@ -1224,7 +1265,7 @@ static void pc_init_isa(ram_addr_t ram_s { pc_init1(ram_size, vga_ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename, 0, cpu_model); + initrd_filename, MODEL_ISA, cpu_model); } /* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE) @@ -1242,6 +1283,14 @@ QEMUMachine pc_machine = { .ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE, .max_cpus = 255, }; + +QEMUMachine mac_machine = { + .name = "mac", + .desc = "Intel-Mac", + .init = pc_init_mac, + .ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE, + .max_cpus = 255, +}; QEMUMachine isapc_machine = { .name = "isapc", Index: qemu-kvm-0.10.5/hw/boards.h =================================================================== --- qemu-kvm-0.10.5.orig/hw/boards.h +++ qemu-kvm-0.10.5/hw/boards.h @@ -34,6 +34,7 @@ extern QEMUMachine axisdev88_machine; /* pc.c */ extern QEMUMachine pc_machine; extern QEMUMachine isapc_machine; +extern QEMUMachine mac_machine; /* ppc.c */ extern QEMUMachine prep_machine; Index: qemu-kvm-0.10.5/target-i386/machine.c =================================================================== --- qemu-kvm-0.10.5.orig/target-i386/machine.c +++ qemu-kvm-0.10.5/target-i386/machine.c @@ -10,6 +10,7 @@ void register_machines(void) { qemu_register_machine(&pc_machine); qemu_register_machine(&isapc_machine); + qemu_register_machine(&mac_machine); } static void cpu_put_seg(QEMUFile *f, SegmentCache *dt)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor