summaryrefslogtreecommitdiff
path: root/hw/ide
AgeCommit message (Collapse)AuthorFilesLines
2013-06-24ide: Convert CHECK POWER MDOE to ide_cmd_table handlerKevin Wolf1-9/+8
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert READ NATIVE MAX ADDRESS to ide_cmd_table handlerKevin Wolf1-17/+18
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert DMA read/write commands to ide_cmd_table handlerKevin Wolf1-31/+38
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert PIO read/write commands to ide_cmd_table handlerKevin Wolf1-43/+50
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert read/write multiple commands to ide_cmd_table handlerKevin Wolf1-59/+60
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert verify commands to ide_cmd_table handlerKevin Wolf1-14/+13
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert cmd_nop commands to ide_cmd_table handlerKevin Wolf1-31/+17
cmd_nop handles all commands that don't really do anything in our implementation except setting status register flags. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert WIN_IDENTIFY to ide_cmd_table handlerKevin Wolf1-17/+23
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Convert WIN_DSM to ide_cmd_table handlerKevin Wolf1-13/+16
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-24ide: Add handler to ide_cmd_tableKevin Wolf1-58/+86
As a preparation for moving all IDE commands into their own function like in the ATAPI code, introduce a 'handler' callback to ide_cmd_table. Commands using this new infrastructure get some things handled automatically: * The BSY flag is set before calling the handler (in order to avoid bugs like the one fixed in f68ec837) and reset on completion. * The (obsolete) DSC flag in the status register is set on completion if the command is flagged with SET_DSC in the command table * An IRQ is triggered on completion. * The error register and the ERR flag in the status register are cleared before calling the handler and on completion it is asserted that either none or both of them are set. No commands are converted at this point. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-20dma: eliminate DMAContextPaolo Bonzini4-14/+14
The DMAContext is a simple pointer to an AddressSpace that is now always already available. Make everyone hold the address space directly, and clean up the DMA API to use the AddressSpace directly. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-06-15Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpuBlue Swirl1-8/+8
* 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu: qdev: Drop FROM_QBUS() macro isa: QOM'ify ISADevice isa: QOM'ify ISABus i8259: Convert PICCommonState to use QOM realizefn kvm/i8259: QOM'ify some more i8259: QOM'ify some more i8254: Convert PITCommonState to QOM realizefn kvm/i8254: QOM'ify some more i8254: QOM'ify some more isa: Use realizefn for ISADevice cs4231a: QOM'ify some more gus: QOM'ify some more
2013-06-07isa: Use realizefn for ISADeviceAndreas Färber1-8/+8
Drop ISADeviceClass::init and the resulting no-op initfn and let children implement their own realizefn. Adapt error handling. Split off an instance_init where sensible. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-06ide: Set BSY bit during FLUSHAndreas Färber1-0/+1
The implementation of the ATA FLUSH command invokes a flush at the block layer, which may on raw files on POSIX entail a synchronous fdatasync(). This may in some cases take so long that the SLES 11 SP1 guest driver reports I/O errors and filesystems get corrupted or remounted read-only. Avoid this by setting BUSY_STAT, so that the guest is made aware we are in the middle of an operation and no ATA commands are attempted to be processed concurrently. Addresses BNC#637297. Suggested-by: Gonglei (Arei) <arei.gonglei@huawei.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-05-20ide/macio: fix wrong opaque with TRIM supportAurelien Jarno1-1/+1
Commit 215e47b9 enabled TRIM by default, which revealed a bug in TRIM support for the IDE macio emulation driver, introduced in d353fb72. The call to dma_bdrv_io() is using a wrong opaque of type IDEState instead of DBDMA_io. This patch fixes that. Fixes LP#1179104 Reported-by: Michael Tokarev <mjt@tls.msk.ru> Tested-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-08ide: Reset BMIDEA bit when the bus master is stoppedKevin Wolf1-0/+1
The device is supposed to reset the Bus Master IDE Active bit in the status register when 0 is written to the Start/Stop Bus Master bit in the command register. In the common cases this happens automatically because bdrv_drain_all() flushes the requests, but with a large PRDT it could remain set. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-08ahci: Don't allow creating slave drivesKevin Wolf9-9/+18
An IDE bus provided by AHCI can only take a single IDE drive. If you add a drive as slave, qemu used to accept the command line but the device wouldn't be actually usable. Catch the situation instead and error out. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-04-29ide: QOM'ify ISA IDEAndreas Färber1-15/+24
Introduce type constant and cast macro to obsolete DO_UPCAST(). Add missing braces. Prepares for ISA realizefn. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1367093935-29091-7-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-15Merge remote-tracking branch 'bonzini/hw-dirs' into stagingAnthony Liguori2-2/+0
* bonzini/hw-dirs: exec: remove useless declarations from memory-internal.h memory: move core typedefs to qemu/typedefs.h include: avoid useless includes of exec/ headers sysemu: avoid proliferation of include/ subdirectories tpm: reorganize headers and split hardware part configure: fix TPM logic acpi.h: make it self contained acpi: move declarations from pc.h to acpi.h hw: Add lost ARM core again Fix failure to create q35 machine Add linux-headers to QEMU_INCLUDES arm: fix location of some include files Conflicts: configure aliguori: trivial conflict in configure output Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-15include: avoid useless includes of exec/ headersPaolo Bonzini2-2/+0
Headers in include/exec/ are for the deepest innards of QEMU, they should almost never be included directly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-15ide: refuse WIN_READ_NATIVE_MAX on empty deviceStefan Hajnoczi1-0/+4
What is the highest addressable sector on an empty CD-ROM? Nothing is addressable so produce an error. This patch prevents a divide-by-zero in ide_set_sector() since s->sectors and s->heads would be 0. Not to mention that a sector=-1 argument would be nonsense. Note that WIN_READ_NATIVE_MAX can be triggered using hdparm -N 1024 /dev/cdrom. The LBA bit will be set to 1 though, so the only easy way to go down the ide_set_sector() CHS code path which divides by zero is to comment out the s->select & 0x40 case for testing. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2013-04-08hw: make all of hw/ide/ configurable via default-configs/Paolo Bonzini1-0/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-08hw: move headers to include/Paolo Bonzini13-23/+23
Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-02-22blockdev: enable discard by defaultPaolo Bonzini1-1/+4
Because discard is now a host parameter, we can always fake it as enabled in the guest. This is an extension of the current choice to ignore "not supported" errors from the host when discard_granularity is set to nonzero. The default granularity is set to the logical block size or 4k, whichever is largest, because cluster sizes below 4k are rarely used and 4K is a typical block size for files. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-02-01ide/mmio: QOM'ify MMIO IDE for R2DAndreas Färber1-19/+73
It was not qdev'ified before, so turn it into a SysBusDevice. Keep mmio_ide_init_drives() around to attach the hard drive. Signed-off-by: Andreas Färberr <afaerber@suse.de> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-01-28Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori4-29/+136
# By Paolo Bonzini (14) and others # Via Kevin Wolf * kwolf/for-anthony: (24 commits) ide: Add fall through annotations block: Create proper size file for disk mirror ahci: Add migration support ahci: Change data types in preparation for migration ahci: Remove unused AHCIDevice fields hbitmap: add assertion on hbitmap_iter_init mirror: do nothing on zero-sized disk block/vdi: Check for bad signature block/vdi: Improved return values from vdi_open block/vdi: Improve debug output for signature block: Use error code EMEDIUMTYPE for wrong format in some block drivers block: Add special error code for wrong format mirror: support arbitrarily-sized iterations mirror: support more than one in-flight AIO operation mirror: add buf-size argument to drive-mirror mirror: switch mirror_iteration to AIO mirror: allow customizing the granularity block: allow customizing the granularity of the dirty bitmap block: return count of dirty sectors, not chunks mirror: perform COW if the cluster size is bigger than the granularity ...
2013-01-25ide/macio: QOM'ify MacIO IDEAndreas Färber1-22/+56
It was not qdev'ified before. Turn it into a SysBusDevice. Embed them into the MacIO devices. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-01-25ppc: Move Mac machines to hw/ppc/Andreas Färber1-3/+3
Signed-off-by: Andreas Färber <afaerber@suse.de> [agraf: squash in MAINTAINERS fix] Signed-off-by: Alexander Graf <agraf@suse.de>
2013-01-25ide: Add fall through annotationsKevin Wolf1-8/+25
Add comments to help static analysers detect that these cases are intentional, and clean up some whitespace in the environment of these comments. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2013-01-25ahci: Add migration supportJason Baron3-5/+101
Jason tested these patches by migrating Windows 7 and Fedora 17 guests (while under I/O) on both piix with ahci attached and on q35 (which has a built-in AHCI controller). Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-01-25ahci: Change data types in preparation for migrationKevin Wolf2-8/+8
The size of an int depends on the host, so in order to be able to migrate these fields, make them either int32_t or bool, depending on the use. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-01-25ahci: Remove unused AHCIDevice fieldsJason Baron2-8/+2
'dma_status' and 'dma_cb' are written to, but never read. Remove these fields in preparation for AHCI migration bits. Signed-off-by: Jason Baron <jbaron@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-01-17ide: Remove wrong assertionKevin Wolf1-1/+0
The Bus Master IDE Active bit (BM_STATUS_DMAING) is not only set when the request is still in flight, but also when it has completed and the size of the physical memory regions in the PRDT was larger than the transfer size. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-15ide: issue discard asynchronously but serialize the piecesPaolo Bonzini1-25/+54
Now that discard can take a long time, make it asynchronous. Each LBA range entry is processed separately because discard can be an expensive operation. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-15ide: fix TRIM with empty range entryPaolo Bonzini1-1/+1
ATA-ACS-3 says "If the two byte range length is zero, then the LBA Range Entry shall be discarded as padding." iovecs are used as if they are linearized, so it is incorrect to discard the rest of this iovec. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-10Make all static TypeInfos constAndreas Färber7-12/+12
Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register all types natively through QEMU Object Model), TypeInfo as used in the common, non-iterative pattern is no longer amended with information and should therefore be const. Fix the documented QOM examples: sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h Since frequently the wrong examples are being copied by contributors of new devices, fix all types in the tree: sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c This also avoids to piggy-back these changes onto real functional changes or other refactorings. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini13-22/+22
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini2-3/+3
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19exec: move include files to include/exec/Paolo Bonzini2-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19block: move include files to include/block/Paolo Bonzini8-8/+8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-17Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEADPaolo Bonzini7-9/+9
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-17pci: update all users to look in pci/Michael S. Tsirkin7-9/+9
update all users so we can remove the makefile hack. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-12-13atapi: reset cdrom tray statuses on ide_resetPavel Hrdina1-0/+2
Tray statuses should be also reseted. Some guests may lock the tray and after reset before any kernel is loaded the tray should be unlocked. Also if you reset the real computer the tray is closed. We should do the same in qemu. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-11-30atapi: make change media detection for guests easierPavel Hrdina2-11/+10
If you have a guest with a media in the optical drive and you change it, the windows guest cannot properly recognize this media change. Windows needs to detect sense "NOT_READY with ASC_MEDIUM_NOT_PRESENT" before we send sense "UNIT_ATTENTION with ASC_MEDIUM_MAY_HAVE_CHANGED". Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-11-26hw/ide/macio: Fix segfault caused by NULL DMAContext*Peter Maydell1-2/+4
Pass qemu_sglist_init the global dma_context_memory rather than a NULL pointer; this fixes a segfault in dma_memory_map() when the guest starts using DMA. Reported-by: Amadeusz Sławiński <amade@asmblr.net> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-21ide: Fix status register after short PRDsKevin Wolf1-0/+1
When failing a request because the length of the regions described by the PRDT was too short for the requested number of sectors, the IDE emulation forgot to update the status register, so that the device would keep the BSY flag set indefinitely. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-21ide: Fix crash with too long PRDKevin Wolf1-0/+12
Without this, s->nsector can become negative and badness happens (trying to malloc huge amount of memory and glib calls abort()) Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-14aio: rename AIOPool to AIOCBInfoStefan Hajnoczi1-2/+2
Now that AIOPool no longer keeps a freelist, it isn't really a "pool" anymore. Rename it to AIOCBInfo and make it const since it no longer needs to be modified. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-10-23Rename target_phys_addr_t to hwaddrAvi Kivity7-28/+28
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are reserved) and its purpose doesn't match the name (most target_phys_addr_t addresses are not target specific). Replace it with a finger-friendly, standards conformant hwaddr. Outstanding patchsets can be fixed up with the command git rebase -i --exec 'find -name "*.[ch]" | xargs s/target_phys_addr_t/hwaddr/g' origin Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>