diff options
author | Avi Kivity <avi@redhat.com> | 2009-12-20 12:28:51 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-12-20 12:28:51 +0200 |
commit | 210cd710b3bd36ca3c10e68b976f22319438f5ce (patch) | |
tree | 1031d5445f5513a414a7fa570d7a2b7f964428ea /hw | |
parent | Merge commit '686a3c3dc235df2492e754423799d1abe4f6d9e2' into stable-0.12-merge (diff) | |
parent | Make sure to enable dirty tracking of VBE vram mapping (diff) | |
download | qemu-kvm-210cd710b3bd36ca3c10e68b976f22319438f5ce.tar.gz qemu-kvm-210cd710b3bd36ca3c10e68b976f22319438f5ce.tar.bz2 qemu-kvm-210cd710b3bd36ca3c10e68b976f22319438f5ce.zip |
Merge commit '3c547d7bb7889182d5bcecbb3edea4c71774c6a3' into stable-0.12-merge
* commit '3c547d7bb7889182d5bcecbb3edea4c71774c6a3': (23 commits)
Make sure to enable dirty tracking of VBE vram mapping
vmware: setup PCI BAR 2 for FIFO as per vmware spec
qdev: improve property error reporting.
fix vga names in default_list
usb-host: check mon before using it.
usb-net: use qdev for -usbdevice
Check rom_load_all() return value.
defaults: update device_list[]
defaults: split default_drive
monitor: Catch printing to non-existent monitor
monitor: Avoid readline functions in QMP
monitor: do_balloon(): Check for errors
monitor: Use 'device' in eject
QDict: Fix size update
qdev: Improve uni-north device names
Avoid permanently disabled QEMU monitor when UNIX migration fails
Fix loading of ELF multiboot kernels
Revert "Rename DriveInfo.onerror to on_write_error" (fix mismerge)
qemu-io: Fix memory leak
Fix thinko in linuxboot.S
...
Conflicts:
hw/vga.c
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/boards.h | 5 | ||||
-rw-r--r-- | hw/loader.c | 4 | ||||
-rw-r--r-- | hw/pc.c | 10 | ||||
-rw-r--r-- | hw/qdev-properties.c | 9 | ||||
-rw-r--r-- | hw/unin_pci.c | 24 | ||||
-rw-r--r-- | hw/usb-net.c | 78 | ||||
-rw-r--r-- | hw/usb.h | 3 | ||||
-rw-r--r-- | hw/vga-isa.c | 6 | ||||
-rw-r--r-- | hw/vga-pci.c | 7 | ||||
-rw-r--r-- | hw/vga.c | 24 | ||||
-rw-r--r-- | hw/vga_int.h | 5 | ||||
-rw-r--r-- | hw/vmware_vga.c | 43 |
12 files changed, 138 insertions, 80 deletions
diff --git a/hw/boards.h b/hw/boards.h index 8fe0fbc8f..e1beda308 100644 --- a/hw/boards.h +++ b/hw/boards.h @@ -22,7 +22,10 @@ typedef struct QEMUMachine { int no_serial:1, no_parallel:1, use_virtcon:1, - no_vga:1; + no_vga:1, + no_floppy:1, + no_cdrom:1, + no_sdcard:1; int is_default; GlobalProperty *compat_props; struct QEMUMachine *next; diff --git a/hw/loader.c b/hw/loader.c index 2d7a2c495..dd4a9a2b1 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -669,7 +669,7 @@ int rom_load_all(void) "addr 0x" TARGET_FMT_plx ", size 0x%zx, max 0x" TARGET_FMT_plx ")\n", rom->name, addr, rom->romsize, rom->max); - return -1; + continue; } } else { /* fixed address requested */ @@ -718,8 +718,6 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size) QTAILQ_FOREACH(rom, &roms, next) { if (rom->max) continue; - if (rom->min > addr) - continue; if (rom->min + rom->romsize < addr) continue; if (rom->min > end) @@ -567,19 +567,21 @@ static int load_multiboot(void *fw_cfg, } if (!(flags & 0x00010000)) { /* MULTIBOOT_HEADER_HAS_ADDR */ uint64_t elf_entry; + uint64_t elf_low, elf_high; int kernel_size; fclose(f); - kernel_size = load_elf(kernel_filename, 0, &elf_entry, NULL, NULL, + kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_low, &elf_high, 0, ELF_MACHINE, 0); if (kernel_size < 0) { fprintf(stderr, "Error while loading elf kernel\n"); exit(1); } - mh_load_addr = mh_entry_addr = elf_entry; - mb_kernel_size = kernel_size; + mh_load_addr = elf_low; + mb_kernel_size = elf_high - elf_low; + mh_entry_addr = elf_entry; mb_kernel_data = qemu_malloc(mb_kernel_size); - if (rom_copy(mb_kernel_data, elf_entry, kernel_size) != kernel_size) { + if (rom_copy(mb_kernel_data, mh_load_addr, mb_kernel_size) != mb_kernel_size) { fprintf(stderr, "Error while fetching elf kernel from rom\n"); exit(1); } diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index fb07279ba..217ddc0b7 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -500,7 +500,12 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value) dev->info->name, name); return -1; } - return prop->info->parse(dev, prop, value); + if (prop->info->parse(dev, prop, value) != 0) { + fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n", + dev->info->name, name, value); + return -1; + } + return 0; } void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyType type) @@ -619,7 +624,7 @@ void qdev_prop_set_globals(DeviceState *dev) continue; } if (qdev_prop_parse(dev, prop->property, prop->value) != 0) { - abort(); + exit(1); } } } diff --git a/hw/unin_pci.c b/hw/unin_pci.c index f07c96644..3ae4e7a14 100644 --- a/hw/unin_pci.c +++ b/hw/unin_pci.c @@ -148,7 +148,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic) /* Use values found on a real PowerMac */ /* Uninorth main bus */ - dev = qdev_create(NULL, "uni-north-main"); + dev = qdev_create(NULL, "uni-north"); qdev_init_nofail(dev); s = sysbus_from_qdev(dev); d = FROM_SYSBUS(UNINState, s); @@ -157,7 +157,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic) pic, 11 << 3, 4); #if 0 - pci_create_simple(d->host_state.bus, 11 << 3, "uni-north-main"); + pci_create_simple(d->host_state.bus, 11 << 3, "uni-north"); #endif sysbus_mmio_map(s, 0, 0xf2800000); @@ -170,8 +170,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic) #endif /* Uninorth AGP bus */ - pci_create_simple(d->host_state.bus, 11 << 3, "uni-north-AGP"); - dev = qdev_create(NULL, "uni-north-AGP"); + pci_create_simple(d->host_state.bus, 11 << 3, "uni-north-agp"); + dev = qdev_create(NULL, "uni-north-agp"); qdev_init_nofail(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, 0xf0800000); @@ -180,8 +180,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic) /* Uninorth internal bus */ #if 0 /* XXX: not needed for now */ - pci_create_simple(d->host_state.bus, 14 << 3, "uni-north-internal"); - dev = qdev_create(NULL, "uni-north-internal"); + pci_create_simple(d->host_state.bus, 14 << 3, "uni-north-pci"); + dev = qdev_create(NULL, "uni-north-pci"); qdev_init_nofail(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, 0xf4800000); @@ -260,7 +260,7 @@ static int unin_internal_pci_host_init(PCIDevice *d) } static PCIDeviceInfo unin_main_pci_host_info = { - .qdev.name = "uni-north-main", + .qdev.name = "uni-north", .qdev.size = sizeof(PCIDevice), .init = unin_main_pci_host_init, }; @@ -272,29 +272,29 @@ static PCIDeviceInfo dec_21154_pci_host_info = { }; static PCIDeviceInfo unin_agp_pci_host_info = { - .qdev.name = "uni-north-AGP", + .qdev.name = "uni-north-agp", .qdev.size = sizeof(PCIDevice), .init = unin_agp_pci_host_init, }; static PCIDeviceInfo unin_internal_pci_host_info = { - .qdev.name = "uni-north-internal", + .qdev.name = "uni-north-pci", .qdev.size = sizeof(PCIDevice), .init = unin_internal_pci_host_init, }; static void unin_register_devices(void) { - sysbus_register_dev("uni-north-main", sizeof(UNINState), + sysbus_register_dev("uni-north", sizeof(UNINState), pci_unin_main_init_device); pci_qdev_register(&unin_main_pci_host_info); sysbus_register_dev("dec-21154", sizeof(UNINState), pci_dec_21154_init_device); pci_qdev_register(&dec_21154_pci_host_info); - sysbus_register_dev("uni-north-AGP", sizeof(UNINState), + sysbus_register_dev("uni-north-agp", sizeof(UNINState), pci_unin_agp_init_device); pci_qdev_register(&unin_agp_pci_host_info); - sysbus_register_dev("uni-north-internal", sizeof(UNINState), + sysbus_register_dev("uni-north-pci", sizeof(UNINState), pci_unin_internal_init_device); pci_qdev_register(&unin_internal_pci_host_info); } diff --git a/hw/usb-net.c b/hw/usb-net.c index 122a0d849..9744dfa5d 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1420,8 +1420,7 @@ static void usbnet_cleanup(VLANClientState *nc) { USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque; - rndis_clear_responsequeue(s); - qemu_free(s); + s->nic = NULL; } static void usb_net_handle_destroy(USBDevice *dev) @@ -1429,9 +1428,18 @@ static void usb_net_handle_destroy(USBDevice *dev) USBNetState *s = (USBNetState *) dev; /* TODO: remove the nd_table[] entry */ + rndis_clear_responsequeue(s); qemu_del_vlan_client(&s->nic->nc); } +static NetClientInfo net_usbnet_info = { + .type = NET_CLIENT_TYPE_NIC, + .size = sizeof(NICState), + .can_receive = usbnet_can_receive, + .receive = usbnet_receive, + .cleanup = usbnet_cleanup, +}; + static int usb_net_initfn(USBDevice *dev) { USBNetState *s = DO_UPCAST(USBNetState, dev, dev); @@ -1447,43 +1455,45 @@ static int usb_net_initfn(USBDevice *dev) s->media_state = 0; /* NDIS_MEDIA_STATE_CONNECTED */; s->filter = 0; s->vendorid = 0x1234; + + qemu_macaddr_default_if_unset(&s->conf.macaddr); + s->nic = qemu_new_nic(&net_usbnet_info, &s->conf, + s->dev.qdev.info->name, s->dev.qdev.id, s); + qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); + snprintf(s->usbstring_mac, sizeof(s->usbstring_mac), + "%02x%02x%02x%02x%02x%02x", + 0x40, + s->conf.macaddr.a[1], + s->conf.macaddr.a[2], + s->conf.macaddr.a[3], + s->conf.macaddr.a[4], + s->conf.macaddr.a[5]); + return 0; } -static NetClientInfo net_usbnet_info = { - .type = NET_CLIENT_TYPE_NIC, - .size = sizeof(NICState), - .can_receive = usbnet_can_receive, - .receive = usbnet_receive, - .cleanup = usbnet_cleanup, -}; - -USBDevice *usb_net_init(NICInfo *nd) +static USBDevice *usb_net_init(const char *cmdline) { USBDevice *dev; - USBNetState *s; - - dev = usb_create_simple(NULL /* FIXME */, "usb-net"); - s = DO_UPCAST(USBNetState, dev, dev); + QemuOpts *opts; + int idx; - memcpy(s->conf.macaddr.a, nd->macaddr, sizeof(nd->macaddr)); - s->conf.vlan = nd->vlan; - s->conf.peer = nd->netdev; - - s->nic = qemu_new_nic(&net_usbnet_info, &s->conf, - nd->model, nd->name, s); + opts = qemu_opts_parse(&qemu_net_opts, cmdline, NULL); + if (!opts) { + return NULL; + } + qemu_opt_set(opts, "type", "nic"); + qemu_opt_set(opts, "model", "usb"); - qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); + idx = net_client_init(NULL, opts, 0); + if (idx == -1) { + return NULL; + } - snprintf(s->usbstring_mac, sizeof(s->usbstring_mac), - "%02x%02x%02x%02x%02x%02x", - 0x40, s->conf.macaddr.a[1], s->conf.macaddr.a[2], - s->conf.macaddr.a[3], s->conf.macaddr.a[4], s->conf.macaddr.a[5]); - fprintf(stderr, "usbnet: initialized mac %02x:%02x:%02x:%02x:%02x:%02x\n", - s->conf.macaddr.a[0], s->conf.macaddr.a[1], s->conf.macaddr.a[2], - s->conf.macaddr.a[3], s->conf.macaddr.a[4], s->conf.macaddr.a[5]); - - return (USBDevice *) s; + dev = usb_create(NULL /* FIXME */, "usb-net"); + qdev_set_nic_properties(&dev->qdev, &nd_table[idx]); + qdev_init(&dev->qdev); + return dev; } static struct USBDeviceInfo net_info = { @@ -1496,6 +1506,12 @@ static struct USBDeviceInfo net_info = { .handle_control = usb_net_handle_control, .handle_data = usb_net_handle_data, .handle_destroy = usb_net_handle_destroy, + .usbdevice_name = "net", + .usbdevice_init = usb_net_init, + .qdev.props = (Property[]) { + DEFINE_NIC_PROPERTIES(USBNetState, conf), + DEFINE_PROP_END_OF_LIST(), + } }; static void usb_net_register_devices(void) @@ -258,9 +258,6 @@ void usb_host_info(Monitor *mon); /* usb-hid.c */ void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *)); -/* usb-net.c */ -USBDevice *usb_net_init(NICInfo *nd); - /* usb-bt.c */ USBDevice *usb_bt_init(HCIInfo *hci); diff --git a/hw/vga-isa.c b/hw/vga-isa.c index 5f2990413..793714417 100644 --- a/hw/vga-isa.c +++ b/hw/vga-isa.c @@ -42,11 +42,7 @@ int isa_vga_init(void) s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); -#ifdef CONFIG_BOCHS_VBE - /* XXX: use optimized standard vga accesses */ - cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS, - VGA_RAM_SIZE, s->vram_offset); -#endif + vga_init_vbe(s); /* ROM BIOS */ rom_add_vga(VGABIOS_FILENAME); return 0; diff --git a/hw/vga-pci.c b/hw/vga-pci.c index b7642ec81..9089c9f5d 100644 --- a/hw/vga-pci.c +++ b/hw/vga-pci.c @@ -108,12 +108,7 @@ static int pci_vga_initfn(PCIDevice *dev) PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map); } -#ifdef CONFIG_BOCHS_VBE - /* XXX: use optimized standard vga accesses */ - cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS, - VGA_RAM_SIZE, s->vram_offset); -#endif - + vga_init_vbe(s); /* ROM BIOS */ rom_add_vga(VGABIOS_FILENAME); return 0; @@ -1583,6 +1583,14 @@ static void vga_sync_dirty_bitmap(VGACommonState *s) cpu_physical_sync_dirty_bitmap(isa_mem_base + 0xa0000, 0xa8000); cpu_physical_sync_dirty_bitmap(isa_mem_base + 0xa8000, 0xb0000); } + +#ifdef CONFIG_BOCHS_VBE + if (s->vbe_mapped) { + cpu_physical_sync_dirty_bitmap(VBE_DISPI_LFB_PHYSICAL_ADDRESS, + VBE_DISPI_LFB_PHYSICAL_ADDRESS + s->vram_size); + } +#endif + vga_dirty_log_start(s); } @@ -1626,6 +1634,13 @@ void vga_dirty_log_start(VGACommonState *s) } s2 = 1; } + +#ifdef CONFIG_BOCHS_VBE + if (kvm_enabled() && s->vbe_mapped) { + kvm_log_start(VBE_DISPI_LFB_PHYSICAL_ADDRESS, s->vram_size); + } +#endif + } /* @@ -2332,6 +2347,15 @@ void vga_init(VGACommonState *s) qemu_register_coalesced_mmio(isa_mem_base + 0x000a0000, 0x20000); } +void vga_init_vbe(VGACommonState *s) +{ +#ifdef CONFIG_BOCHS_VBE + /* XXX: use optimized standard vga accesses */ + cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS, + VGA_RAM_SIZE, s->vram_offset); + s->vbe_mapped = 1; +#endif +} /********************************************************/ /* vga screen dump */ diff --git a/hw/vga_int.h b/hw/vga_int.h index aa6221c24..d2756f78a 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -71,8 +71,8 @@ uint16_t vbe_regs[VBE_DISPI_INDEX_NB]; \ uint32_t vbe_start_addr; \ uint32_t vbe_line_offset; \ - uint32_t vbe_bank_mask; - + uint32_t vbe_bank_mask; \ + int vbe_mapped; #else #define VGA_STATE_COMMON_BOCHS_VBE @@ -218,6 +218,7 @@ void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1, unsigned int color_xor); int vga_ioport_invalid(VGACommonState *s, uint32_t addr); +void vga_init_vbe(VGACommonState *s); extern const uint8_t sr_mask[8]; extern const uint8_t gr_mask[16]; diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index f3e3749e9..07befc85d 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -67,6 +67,11 @@ struct vmsvga_state_s { int syncing; int fb_size; + ram_addr_t fifo_offset; + uint8_t *fifo_ptr; + unsigned int fifo_size; + target_phys_addr_t fifo_base; + union { uint32_t *fifo; struct __attribute__((__packed__)) { @@ -680,7 +685,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) return 0x0; case SVGA_REG_VRAM_SIZE: - return s->vga.vram_size - SVGA_FIFO_SIZE; + return s->vga.vram_size; case SVGA_REG_FB_SIZE: return s->fb_size; @@ -701,10 +706,10 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) return caps; case SVGA_REG_MEM_START: - return s->vram_base + s->vga.vram_size - SVGA_FIFO_SIZE; + return s->fifo_base; case SVGA_REG_MEM_SIZE: - return SVGA_FIFO_SIZE; + return s->fifo_size; case SVGA_REG_CONFIG_DONE: return s->config; @@ -790,7 +795,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) case SVGA_REG_CONFIG_DONE: if (value) { - s->fifo = (uint32_t *) &s->vga.vram_ptr[s->vga.vram_size - SVGA_FIFO_SIZE]; + s->fifo = (uint32_t *) s->fifo_ptr; /* Check range and alignment. */ if ((CMD(min) | CMD(max) | CMD(next_cmd) | CMD(stop)) & 3) @@ -1059,7 +1064,7 @@ static int vmsvga_post_load(void *opaque, int version_id) s->invalidated = 1; if (s->config) - s->fifo = (uint32_t *) &s->vga.vram_ptr[s->vga.vram_size - SVGA_FIFO_SIZE]; + s->fifo = (uint32_t *) s->fifo_ptr; return 0; } @@ -1111,6 +1116,10 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) vmsvga_reset(s); + s->fifo_size = SVGA_FIFO_SIZE; + s->fifo_offset = qemu_ram_alloc(s->fifo_size); + s->fifo_ptr = qemu_get_ram_ptr(s->fifo_offset); + vga_common_init(&s->vga, vga_ram_size); vga_init(&s->vga); vmstate_register(0, &vmstate_vga_common, &s->vga); @@ -1120,12 +1129,8 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size) vmsvga_screen_dump, vmsvga_text_update, s); -#ifdef CONFIG_BOCHS_VBE - /* XXX: use optimized standard vga accesses */ - cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS, - vga_ram_size, s->vga.vram_offset); -#endif - rom_add_vga(VGABIOS_FILENAME); + vga_init_vbe(&s->vga); + rom_add_vga(VGABIOS_FILENAME); } static void pci_vmsvga_map_ioport(PCIDevice *pci_dev, int region_num, @@ -1166,6 +1171,19 @@ static void pci_vmsvga_map_mem(PCIDevice *pci_dev, int region_num, iomemtype); } +static void pci_vmsvga_map_fifo(PCIDevice *pci_dev, int region_num, + pcibus_t addr, pcibus_t size, int type) +{ + struct pci_vmsvga_state_s *d = (struct pci_vmsvga_state_s *) pci_dev; + struct vmsvga_state_s *s = &d->chip; + ram_addr_t iomemtype; + + s->fifo_base = addr; + iomemtype = s->fifo_offset | IO_MEM_RAM; + cpu_register_physical_memory(s->fifo_base, s->fifo_size, + iomemtype); +} + static int pci_vmsvga_initfn(PCIDevice *dev) { struct pci_vmsvga_state_s *s = @@ -1189,6 +1207,9 @@ static int pci_vmsvga_initfn(PCIDevice *dev) pci_register_bar(&s->card, 1, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem); + pci_register_bar(&s->card, 2, SVGA_FIFO_SIZE, + PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo); + vmsvga_init(&s->chip, VGA_RAM_SIZE); return 0; |