aboutsummaryrefslogtreecommitdiffstats
path: root/hw/ide
AgeCommit message (Collapse)AuthorFilesLines
2011-08-20Use glib memory allocation and free functionsAnthony Liguori5-8/+8
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-08pci: rename pci_register_bar_region() to pci_register_bar()Avi Kivity4-14/+8
Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-08ppc: convert to memory APIAvi Kivity1-17/+19
Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-08ahci: convert to memory APIAvi Kivity3-21/+15
Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-08ide: convert to memory APIAvi Kivity5-120/+261
Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-29Merge remote-tracking branch 'agraf/xen-next' into stagingAnthony Liguori1-0/+44
2011-07-29Merge remote-tracking branch 'kraxel/migration.2' into stagingAnthony Liguori1-0/+6
2011-07-26xen: implement unplug protocol in xen_platformStefano Stabellini1-0/+44
The unplug protocol is necessary to support PV drivers in the guest: the drivers expect to be able to "unplug" emulated disks and nics before initializing the Xen PV interfaces. It is responsibility of the guest to make sure that the unplug is done before the emulated devices or the PV interface start to be used. We use pci_for_each_device to walk the PCI bus, identify the devices and disks that we want to disable and dynamically unplug them. Changes in v2: - use PCI_CLASS constants; - replace pci_unplug_device with qdev_unplug; - do not import hw/ide/internal.h in xen_platform.c; Changes in v3: - introduce piix3-ide-xen, that support hot-unplug; - move the unplug code to hw/ide/piix.c; - just call qdev_unplug from xen_platform.c to unplug the IDE disks; Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-07-23ide: Turn properties any IDE device must have into bus propertiesMarkus Armbruster1-1/+4
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-20ahci doesn't support migrationGerd Hoffmann1-0/+6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-07-05ide: Initialise buffers with zerosKevin Wolf1-1/+5
Just in case there's still a way how a guest can read out buffers when it's not supposed to, let's zero the buffers during initialisation so that we don't leak information to the guest. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2011-07-05ide: Ignore reads during PIO in and writes during PIO outKevin Wolf1-8/+36
This fixes https://bugs.launchpad.net/qemu/+bug/786209: When the DRQ_STAT bit is set, the IDE core permits both data reads and data writes, regardless of whether the current transfer was initiated as a read or write. This potentially leaks uninitialized host memory into the guest, if, before doing anything else to an IDE device, the guest begins a write transaction (e.g. WIN_WRITE), but then *reads* from the IO port instead of writing to it. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2011-06-22Merge remote-tracking branch 'mst/for_anthony' into stagingAnthony Liguori4-38/+23
Conflicts: hw/usb-uhci.c
2011-06-15Merge remote-tracking branch 'origin/master' into pciMichael S. Tsirkin6-39/+110
Conflicts: hw/virtio-pci.c
2011-06-15ide: Clear error_status after restarting flushKevin Wolf1-7/+11
Clearing the error status flag was missing for restarting flushes. Now that the error status is separate from the BM status register, we can simply set it to 0 after restarting the request. This ensures that we never forget to clear a bit. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-15ide: add TRIM supportChristoph Hellwig5-5/+124
Add support for TRIM sub function of the data set management command, and wire it up to the qemu discard infrastructure. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-15ide: allow other dma comands than read and writeChristoph Hellwig4-17/+33
Replace the is_read flag with a dma_cmd flag to allow the dma and restart logic to handler other commands like TRIM. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-15ide: Add forgotten VMSTATE_END_OF_LIST in subsectionKevin Wolf1-0/+1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-15ide: Fix ide_drive_pio_state_needed()Kevin Wolf1-1/+2
When a failed PIO request caused the VM to stop, we still need to transfer the PIO state even though DRQ=0 at this point. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-15ide: Split error status from status registerKevin Wolf4-8/+105
When adding the werror=stop mode, some flags were added to s->status which are used to determine what kind of operation should be restarted when the VM is continued. Unfortunately, it turns out that s->status is in fact a device register and as such is visible to the guest (some of the abused bits are even writable for the guest). For migration we keep on using the old VMState field (renamed to migration_compat_status) if the status register doesn't use any of the previously abused bits. If it does, we use a subsection with a clean copy of the status register. The error status is always sent in a subsection if there is any error. It can't use the old field because errors happen even without PCI. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-12hw/ide/via.c: convert to PCIDeviceInfo to initialize idsIsaku Yamahata1-4/+4
use PCIDeviceInfo to initialize ids. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-06-12hw/ide/ich.c: convert to PCIDeviceInfo to initialize idsIsaku Yamahata1-5/+4
use PCIDeviceInfo to initialize ids. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-06-12hw/ide/cmd646.c: convert to PCIDeviceInfo to initialize idsIsaku Yamahata1-6/+4
use PCIDeviceInfo to initialize ids. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-06-12ide/piix: convert to PCIDeviceInfo to initialize idsIsaku Yamahata1-22/+10
use PCIDeviceInfo to initialize ids. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-06-08ide/core: Remove explicit setting of BM_STATUS_INTKevin Wolf1-3/+4
BM_STATUS_INT is automatically set during ide_set_irq(), there's no reason to set it manually in addition. There is even one case where the interrupt status bit was set, but no IRQ was raised. This is when the PRD table was reached but there is more data to transfer. The correct behaviour for this case is not to set BM_STATUS_INT. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-19ahci: Fix non-NCQ accesses for LBA > 16bitsAlexander Graf1-2/+25
AHCI provides two ways of reading/writing data: 1) NCQ 2) ATA commands with the LBA in the command FIS In the second code path, we didn't handle any LBAs that were bigger than 16 bits, so whenever a guest that used high LBA numbers wanted to access data, the LBA got truncated down to 16 bits, giving the guest garbage. This patch adds support for LBAs higher than 16 bits. I've tested that it works just fine with SeaBIOS and Linux guests. This patch also unbreaks the often reported grub errors people have seen with AHCI. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-19blockdev: Store -drive option media in DriveInfoMarkus Armbruster2-8/+5
DriveInfo is closely tied to -drive, and like -drive, it mixes information about host and guest part of the block device. Unlike DriveInfo, BlockDriverState should be about the host part only. One of the remaining guest bits there is the "type hint". -drive option media sets it, and qdevs "ide-drive", "scsi-disk" and non-qdev IF_XEN devices check it to pick HD vs. CD. Communicate -drive option media via new DriveInfo member media_cd instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-19ide: Split qdev "ide-drive" into "ide-hd" and "ide-cd"Markus Armbruster3-22/+74
An "ide-drive" is either a hard disk or a CD-ROM, depending on the associated BlockDriverState's type hint. Unclean; disk vs. CD belongs to the guest part, not the host part. Have separate qdevs "ide-hd" and "ide-cd" to model disk vs. CD in the guest part. Keep ide-drive for backward compatibility. "ide-disk" would perhaps be a nicer name than "ide-hd", but there's already "scsi-disk", which is like "ide-drive", and will be likewise split in the next commit. {ide,scsi}-{hd,cd} is the best consistent set of names I could find within the backward compatibility straightjacket. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-18ahci: Fix crashes on duplicate BH registrationJan Kiszka1-3/+5
If ahci_dma_set_inactive is called a while there is still a pending BH from a previous run, we will crash on the second run of ahci_check_cmd_bh as it overwrites AHCIDevice::check_bh. Avoid this broken and redundant duplicate registration. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-18ide: Turn debug messages into assertionsKevin Wolf1-6/+2
These printfs aren't really debug messages, but clearly indicate a bug if they ever become effective. Noone uses DEBUG_IDE, let's re-enable the check unconditionally and make it an assertion instead of printfs in the device emulation. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-18ide: cleanup warningsAndrea Arcangeli1-2/+2
Add \n. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-16ahci: Unbreak bar registrationJan Kiszka1-3/+3
Fix regression of 667bb59: ahci_init initializes ahci.mem, so we have to move bar registration after it. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-05-16ich/ahci: fix uninitialized memory useMichael S. Tsirkin1-2/+2
The commit 667bb59d2358daeef179583c944becba3f1f9680 uses d->ahci.mem before it is initialized by ahci_init(). Fix this by calling ahci_init() first thing so that it's safe to use all fields in the ahci state struct. Reported-by: Alexey Zaytsev <alexey.zaytsev@gmail.com> Reported-by: Jan Kiszka <jan.kiszka@web.de> Tested-by: Alexey Zaytsev <alexey.zaytsev@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-05-05Merge remote branch 'origin/master' into pciMichael S. Tsirkin9-937/+1202
Conflicts: exec.c
2011-05-05MSI: Robust resource releaseJan Kiszka1-4/+1
msi_init may fail, so we need to check on uninit if the cap was actually installed. This also avoids that the users need to check. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-05-03ide/atapi: fix set but unusedAlon Levy1-3/+1
Signed-off-by: Alon Levy <alevy@redhat.com> Acked-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-03atapi: Explain why we need a 'media not present' stateAmit Shah1-1/+7
After the re-org of the atapi code, it might not be intuitive for a reader of the code to understand why we're inserting a 'media not present' state between cd changes. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-03atapi: Move comment to proper placeAmit Shah1-1/+1
Move misplaced comment for media_is_dvd() Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27ide/atapi: Introduce CHECK_READY flag for commandsKevin Wolf1-25/+23
Some commands are supposed to report a Not Ready Condition (i.e. they require a medium to be present in order to execute successfully). Instead of duplicating the check in each command implementation, let's add a flag and check it before calling the command. This patch only converts existing checks, it does not introduce new checks for any of the other commands that can/should report a Not Ready Condition. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27ide/atapi: Replace bdrv_get_geometry calls by s->nb_sectorsKevin Wolf1-15/+6
The disk size can only change when the medium is changed, and the change callback takes care of updating s->nb_sectors in this case. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27ide/atapi: Use table instead of switch for commandsKevin Wolf1-67/+48
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27ide/atapi: Factor commands outKevin Wolf1-378/+459
In preparation for a table of function pointers, factor each command out from ide_atapi_cmd() into its own function. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27ide: Split atapi.c outKevin Wolf3-1061/+1097
Besides moving code, this patch only fixes some whitespace issues in the moved code and makes all functions in atapi.c static which can be static. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27atapi: Add 'medium ready' to 'medium not ready' transition on cd changeAmit Shah1-4/+16
MMC-5 Table F.1 lists errors that can be thrown for the TEST_UNIT_READY command. Going from medium not ready to medium ready states is communicated by throwing an error. This adds the missing 'tray opened' event that we fail to report to guests. After doing this, older Linux guests properly revalidate a disc on the change command. HSM violation errors, which caused Linux guests to do a soft-reset of the link, also go away: ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 sr 1:0:0:0: CDB: Test Unit Ready: 00 00 00 00 00 00 ata2.00: cmd a0/00:00:00:00:00/00:00:00:00:00/a0 tag 0 res 01/60:00:00:00:00/00:00:00:00:00/a0 Emask 0x3 (HSM violation) ata2.00: status: { ERR } ata2: soft resetting link ata2.00: configured for MWDMA2 ata2: EH complete Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Tested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-15Remove unused sysemu.h include directivesBlue Swirl6-6/+0
Remove unused sysemu.h include directives to speed up build with the following patches. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-04-13atapi: GESN: implement 'media' subcommandAmit Shah2-4/+115
Implement the 'media' sub-command of the GET_EVENT_STATUS_NOTIFICATION command. This helps us report tray open, tray closed, no media, media present states to the guest. Newer Linux kernels (2.6.38+) rely on this command to revalidate discs after media change. This patch also sends out tray open/closed status to the guest driver when requested e.g. via the CDROM_DRIVE_STATUS ioctl (thanks Markus). Without such notification, the guest and qemu's tray open/close status was frequently out of sync, causing installers like Anaconda detecting no disc instead of tray open, confusing them terribly. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-13atapi: GESN: Standardise event response handling for future additionsAmit Shah1-6/+19
Handle GET_EVENT_STATUS_NOTIFICATION's No Event Available response in a generic way so that future additions to the code to handle other response types is easier. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-13atapi: GESN: Use structs for commonly-used field typesAmit Shah1-2/+14
Instead of using magic numbers, use structs that are more descriptive of the fields being used. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-13atapi: Move GET_EVENT_STATUS_NOTIFICATION command handling to its own functionAmit Shah1-13/+24
This makes the code more readable. Also, there's a block like: if () { ... } else { ... } Split that into if () { ... return; } ... Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-13atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media changeAmit Shah1-6/+14
After a media change, the only commands allowed from the guest were REQUEST_SENSE and INQUIRY. The guest may also issue GET_EVENT_STATUS_NOTIFICATION commands to get media changed notification. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>