aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2010-07-06pci: Implement BusInfo.get_dev_path()Alex Williamson1-0/+14
This works great for PCI since a <segment>:<bus>:<dev>.<fn> uniquely describes a global address. No need to traverse up the qdev tree. PCI segment support is a placeholder for compatibility once we support multiple segments. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06qdev: Add a get_dev_path() function to BusInfoAlex Williamson1-0/+3
This function is meant to provide a stable device path for buses which are able to implement it. If a bus has a globally unique addresses scheme, one address level may be sufficient to provide a path. Other buses may need to recursively traverse up the qdev tree. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06pc: Allocate all ram in a single qemu_ram_alloc()Alex Williamson1-13/+9
This will benefit us when we migrate based on ramblock name since we won't be bouncing between separate blocks. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06Remove uses of ram.last_offset (aka last_ram_offset)Alex Williamson3-13/+30
We currently need this either to allocate the next ram_addr_t for a new block, or for total memory to be migrated. Both of which we can calculate without need of this to keep us in a contiguous address space. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06make rtc alatm workGleb Natapov1-4/+3
Convert alarm time from BCD if needed before comparing with current time. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06scsi: Fix SCSI bus resetJan Kiszka1-2/+13
When the controller raises the SCSI reset line, we have to perform the requested reset on all disks attached to the controller's bus. Moreover, reset is edge triggered, so avoid repeating it if the line was already high. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06Fix io-thread build breakage of a88790a14fJan Kiszka1-0/+1
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06block: add sheepdog driver for distributed storage supportMORITA Kazutaka2-1/+2037
Sheepdog is a distributed storage system for QEMU. It provides highly available block level storage volumes to VMs like Amazon EBS. This patch adds a qemu block driver for Sheepdog. Sheepdog features are: - No node in the cluster is special (no metadata node, no control node, etc) - Linear scalability in performance and capacity - No single point of failure - Autonomous management (zero configuration) - Useful volume management support such as snapshot and cloning - Thin provisioning - Autonomous load balancing The more details are available at the project site: http://www.osrg.net/sheepdog/ Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06ide: Reject invalid CHS geometryMarkus Armbruster1-0/+12
drive_init() doesn't permit invalid CHS for if=ide, but that's worthless: we get it via if=none and -device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06ide: Reject readonly drives unless CD-ROMMarkus Armbruster1-0/+5
drive_init() doesn't permit option readonly for if=ide, but that's worthless: we get it via if=none and -device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06ide: Make ide_init_drive() return successMarkus Armbruster3-7/+14
It still always succeeds. The next commits will add failures. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06ide: Replace IDEState members is_cdrom, is_cf by drive_kindMarkus Armbruster4-24/+25
The two aren't independent variables. Make that obvious. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06ide: Improve error messagesMarkus Armbruster1-4/+5
Use error_report(), because it points to the error location. Reword "tried to assign twice" messages to make it clear that we're complaining about the unit property. Report invalid unit property instead of failing silently. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06scsi: Error locations for -drive if=scsi device initializationMarkus Armbruster1-0/+4
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06error: New qemu_opts_loc_restore()Markus Armbruster2-0/+6
Needed for decent error locations when complaining about options outside of qemu_opts_foreach(). That one sets the location already. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06scsi: Reject unimplemented error actionsMarkus Armbruster2-0/+14
drive_init() doesn't permit rerror for if=scsi, but that's worthless: we get it via if=none and -device. Moreover, scsi-generic doesn't support werror. Since drive_init() doesn't catch that, option werror was silently ignored even with if=scsi. Wart: unlike drive_init(), we don't reject the default action when it's explicitly specified. That's because we can't distinguish "no rerror option" from "rerror=report", or "no werror" from "rerror=enospc". Left for another day. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06qdev: Don't hw_error() in qdev_init_nofail()Markus Armbruster1-2/+4
Some of the failures are internal errors, and hw_error() is okay then. But the common way to fail is bad user input, e.g. -global isa-fdc.driveA=foo where drive foo has an unsupported rerror value. exit(1) instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06fdc: Reject unimplemented error actionsMarkus Armbruster1-6/+16
drive_init() doesn't permit them for if=floppy, but that's worthless: we get them via if=none and -global. This can make device initialization fail. Since all callers of fdctrl_init_isa() ignore its value, change it to die instead of returning failure. Without this, some callers would ignore the failure, and others would crash. Wart: unlike drive_init(), we don't reject the default action when it's explicitly specified. That's because we can't distinguish "no rerror option" from "rerror=report", or "no werror" from "rerror=enospc". Left for another day. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06raw-posix: Fix test for host CD-ROMMarkus Armbruster1-11/+6
raw_pread_aligned() retries up to two times if the block device backs a virtual CD-ROM (a drive with media=cdrom and if=ide, scsi, xen or none). This makes no sense. Whether retrying reads can correct read errors can only depend on what we're reading, not on how the result gets used. We need to check what whether we're reading from a physical CD-ROM or floppy here. I doubt retrying is useful even then. Left for another day. Impact: * Virtual CD-ROM backed by host_cdrom behaves the same. * Virtual CD-ROM backed by file or host_device no longer retries. * A drive backed by host_cdrom now retries even if it's not a virtual CD-ROM. * Any drive backed by host_floppy now retries. While there, clean up gratuitous use of goto. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06block migration: Fix test for read-only driveMarkus Armbruster1-1/+1
init_blk_migration_it() skips drives with type hint BDRV_TYPE_CDROM. The intention is to skip read-only drives. However, BDRV_TYPE_CDROM is only a hint. It is currently sufficent for read-only. But it's not necessary, and it may not remain sufficient. Use bdrv_is_read_only() instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06blockdev: Clean up how readonly persists across virtual media changeMarkus Armbruster1-1/+1
Since commit cb4e5f8e, monitor command change makes the new media readonly iff the type hint is BDRV_TYPE_CDROM, i.e. the drive was created with media=cdrom. The intention is to avoid changing a block device's read-only-ness. However, BDRV_TYPE_CDROM is only a hint. It is currently sufficent for read-only. But it's not necessary, and it may not remain sufficient. Use bdrv_is_read_only() instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06Add virtio disk identification supportjohn cooper2-0/+17
This patch adds the final missing bits for support of passing a serial/id string to a virtio-blk guest driver. The guest-side component already exists in the virtio driver, and has recently been reworked by Ryan to export a /sys interface for retrieval of the id from guest userland. Signed-off-by: john cooper <john.cooper@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06qcow2/vdi: Change check to distinguish error casesKevin Wolf6-67/+79
This distinguishes between harmless leaks and real corruption. Hopefully users better understand what qemu-img check wants to tell them. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06qemu-img check: Distinguish different kinds of errorsKevin Wolf3-19/+64
People think that their images are corrupted when in fact there are just some leaked clusters. Differentiating several error cases should make the messages more comprehensible. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06Include sys/mman.h before qemu-options.hJes Sorensen1-0/+2
The result of parsing qemu-options.def depends on whehter or not MAP_POPULATE is defined, so make sure to include sys/mman.h before including qemu-options.h. Reported by Frank Arnold. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori34-259/+606
2010-07-06Merge remote branch 'qmp/for-anthony' into stagingAnthony Liguori14-212/+418
2010-07-05cris: Avoid debug clobbering for both I & D MMU state.Edgar E. Iglesias3-20/+10
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@axis.com>
2010-07-05cris: Dont clobber the MMU state across calls to cpu_get_phys_page_debug.Edgar E. Iglesias1-0/+17
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-07-05cris: Break out rand LFSR update into a separate func.Edgar E. Iglesias1-8/+13
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@axis.com>
2010-07-03piix4: compile only onceBlue Swirl6-1/+8
Compile piix4 in hwlib. Two compilations less for the full build. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03remove exec-all.h inclusion from cpu.hPaolo Bonzini15-12/+4
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03move cpu_pc_from_tb to target-*/exec.hPaolo Bonzini22-59/+65
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03remove unused stuff from */exec.hPaolo Bonzini6-17/+7
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-02block: Handle multiwrite errors only when all requests have completedKevin Wolf1-4/+1
Don't try to be clever by freeing all temporary data and calling all callbacks when the return value (an error) is certain. Doing so has at least two important problems: * The temporary data that is freed (qiov, possibly zero buffer) is still used by the requests that have not yet completed. * Calling the callbacks for all requests in the multiwrite means for the caller that it may free buffers etc. which are still in use. Just remember the error value and do the cleanup when all requests have completed. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02block: Fix early failure in multiwriteKevin Wolf1-6/+29
bdrv_aio_writev may call the callback immediately (and it will commonly do so in error cases). Current code doesn't consider this. For details see the comment added by this patch. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02qemu-img: avoid calling exit(1) to release resources properlyMORITA Kazutaka1-52/+185
This patch removes exit(1) from error(), and properly releases resources such as a block driver and an allocated memory. For testing the Sheepdog block driver with qemu-iotests, it is necessary to call bdrv_delete() before the program exits. Because the driver releases the lock of VM images in the close handler. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02pc: Fix CMOS info for drives defined with -deviceMarkus Armbruster5-41/+81
Drives defined with -drive if=ide get get created along with the IDE controller, inside machine->init(). That's before cmos_init(). Drives defined with -device get created during generic device init. That's after cmos_init(). Because of that, CMOS has no information on them (type, geometry, translation). Older versions of Windows such as XP reportedly choke on that. Split off the part of CMOS initialization that needs to know about -device devices, and turn it into a reset handler, so it runs after device creation. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02ide: Make PIIX and ISA IDE init functions return the qdevMarkus Armbruster3-11/+14
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02block: Fix virtual media change for if=noneMarkus Armbruster7-3/+24
BlockDriverState member removable controls whether virtual media change (monitor commands change, eject) is allowed. It is set when the "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY. The type hint is only set by drive_init(). It sets BDRV_TYPE_FLOPPY for if=floppy. It sets BDRV_TYPE_CDROM for media=cdrom and if=ide, scsi, xen, or none. if=ide and if=scsi work, because the type hint makes it a CD-ROM. if=xen likewise, I think. For the same reason, if=none works when it's used by ide-drive or scsi-disk. For other guest devices, there are problems: * fdc: you can't change virtual media $ qemu [...] -drive if=none,id=foo,... -global isa-fdc.driveA=foo QEMU 0.12.50 monitor - type 'help' for more information (qemu) eject foo Device 'foo' is not removable unless you add media=cdrom, but that makes it readonly. * virtio: if you add media=cdrom, you can change virtual media. If you eject, the guest gets I/O errors. If you change, the guest sees the drive's contents suddenly change. * scsi-generic: if you add media=cdrom, you can change virtual media. I didn't test what that does to the guest or the physical device, but it can't be pretty. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02block: Clean up bdrv_snapshots()Markus Armbruster1-5/+4
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02savevm: Survive hot-unplug of snapshot deviceMarkus Armbruster3-27/+31
savevm.c keeps a pointer to the snapshot block device. If you manage to get that device deleted, the pointer dangles, and the next snapshot operation will crash & burn. Unplugging a guest device that uses it does the trick: $ MALLOC_PERTURB_=234 qemu-system-x86_64 [...] QEMU 0.12.50 monitor - type 'help' for more information (qemu) info snapshots No available block device supports snapshots (qemu) drive_add auto if=none,file=tmp.qcow2 OK (qemu) device_add usb-storage,id=foo,drive=none1 (qemu) info snapshots Snapshot devices: none1 Snapshot list (from none1): ID TAG VM SIZE DATE VM CLOCK (qemu) device_del foo (qemu) info snapshots Snapshot devices: Segmentation fault (core dumped) Move management of that pointer to block.c, and zap it when the device it points becomes unusable. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02blkdebug: Initialize state as 1Kevin Wolf1-0/+3
state = 0 in rules means that the rule is valid for any state. Therefore it's impossible to have a rule that works only in the initial state. This changes the initial state from 0 to 1 to make this possible. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02blkdebug: Free QemuOpts after having read the configKevin Wolf1-0/+2
Forgetting to free them means that the next instance inherits all rules and gets its own rules only additionally. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02blkdebug: Fix set_state_opts definitionKevin Wolf1-1/+1
The list head was initialized to point to the wrong list, so all actions ended up being handled as inject-error even if they were set-state in fact. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02qemu-option: New qemu_opts_reset()Markus Armbruster2-0/+10
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02block: Catch attempt to attach multiple devices to a blockdevMarkus Armbruster11-15/+74
For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foo happily creates two SCSI disks connected to the same block device. It's all downhill from there. Device usb-storage deliberately attaches twice to the same blockdev, which fails with the fix in place. Detach before the second attach there. Also catch attempt to delete while a guest device model is attached. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02blockdev: drive_get_by_id() is no longer used, removeMarkus Armbruster2-13/+0
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02qdev: Decouple qdev_prop_drive from DriveInfoMarkus Armbruster16-72/+73
Make the property point to BlockDriverState, cutting out the DriveInfo middleman. This prepares the ground for block devices that don't have a DriveInfo. Currently all user-defined ones have a DriveInfo, because the only way to define one is -drive & friends (they go through drive_init()). DriveInfo is closely tied to -drive, and like -drive, it mixes information about host and guest part of the block device. I'm working towards a new way to define block devices, with clean host/guest separation, and I need to get DriveInfo out of the way for that. Fortunately, the device models are perfectly happy with BlockDriverState, except for two places: ide_drive_initfn() and scsi_disk_initfn() need to check the DriveInfo for a serial number set with legacy -drive serial=... Use drive_get_by_blockdev() there. Device model code should now use DriveInfo only when explicitly dealing with drives defined the old way, i.e. without -device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02blockdev: Clean up automatic drive deletionMarkus Armbruster7-7/+56
We automatically delete blockdev host parts on unplug of the guest device. Too much magic, but we can't change that now. The delete happens early in the guest device teardown, before the connection to the host part is severed. Thus, the guest part's pointer to the host part dangles for a brief time. No actual harm comes from this, but we'll catch such dangling pointers a few commits down the road. Clean up the dangling pointers by delaying the automatic deletion until the guest part's pointer is gone. Device usb-storage deliberately makes two qdev properties refer to the same drive, because it automatically creates a second device. Again, too much magic we can't change now. Multiple references worked okay before, but now free_drive() dies for the second one. Zap the extra reference. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>