History | View | Annotate | Download (60.2 kB)
ide: Initialise buffers with zeros
Just in case there's still a way how a guest can read out buffers when it's notsupposed to, let's zero the buffers during initialisation so that we don't leakinformation to the guest.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
ide: Ignore reads during PIO in and writes during PIO out
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....
ide: Add forgotten VMSTATE_END_OF_LIST in subsection
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: allow other dma comands than read and write
Replace the is_read flag with a dma_cmd flag to allow the dma andrestart logic to handler other commands like TRIM.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: add TRIM support
Add support for TRIM sub function of the data set management command,and wire it up to the qemu discard infrastructure.
ide: Split error status from status register
When adding the werror=stop mode, some flags were added to s->statuswhich are used to determine what kind of operation should be restartedwhen the VM is continued.
Unfortunately, it turns out that s->status is in fact a device register...
ide: Fix ide_drive_pio_state_needed()
When a failed PIO request caused the VM to stop, we still need to transfer thePIO state even though DRQ=0 at this point.
ide/core: Remove explicit setting of BM_STATUS_INT
BM_STATUS_INT is automatically set during ide_set_irq(), there's no reason toset it manually in addition.
There is even one case where the interrupt status bit was set, but no IRQ wasraised. This is when the PRD table was reached but there is more data to...
blockdev: Store -drive option media in DriveInfo
DriveInfo is closely tied to -drive, and like -drive, it mixesinformation about host and guest part of the block device. UnlikeDriveInfo, BlockDriverState should be about the host part only.
One of the remaining guest bits there is the "type hint". -drive...
ide: Split qdev "ide-drive" into "ide-hd" and "ide-cd"
An "ide-drive" is either a hard disk or a CD-ROM, depending on theassociated BlockDriverState's type hint. Unclean; disk vs. CD belongsto the guest part, not the host part.
Have separate qdevs "ide-hd" and "ide-cd" to model disk vs. CD in...
ide: Split atapi.c out
Besides moving code, this patch only fixes some whitespace issues in the movedcode and makes all functions in atapi.c static which can be static.
atapi: Add 'medium ready' to 'medium not ready' transition on cd change
MMC-5 Table F.1 lists errors that can be thrown for the TEST_UNIT_READYcommand. Going from medium not ready to medium ready states iscommunicated by throwing an error.
This adds the missing 'tray opened' event that we fail to report to...
atapi: GESN: implement 'media' subcommand
Implement the 'media' sub-command of the GET_EVENT_STATUS_NOTIFICATIONcommand. This helps us report tray open, tray closed, no media, mediapresent states to the guest.
Newer Linux kernels (2.6.38+) rely on this command to revalidate discs...
atapi: GESN: Standardise event response handling for future additions
Handle GET_EVENT_STATUS_NOTIFICATION's No Event Available response in ageneric way so that future additions to the code to handle otherresponse types is easier.
Signed-off-by: Amit Shah <amit.shah@redhat.com>...
atapi: GESN: Use structs for commonly-used field types
Instead of using magic numbers, use structs that are more descriptive ofthe 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>...
atapi: Move GET_EVENT_STATUS_NOTIFICATION command handling to its own function
This makes the code more readable.
Also, there's a block like:
if () { ...} else { ...}
Split that into
if () { ... return;}...
atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change
After a media change, the only commands allowed from the guest wereREQUEST_SENSE and INQUIRY. The guest may also issueGET_EVENT_STATUS_NOTIFICATION commands to get mediachanged notification....
atapi: Drives can be locked without media present
Drivers are free to lock drives without any media present. Such acondition should not result in an error condition.
See Table 341 in MMC-5 spec for details.
atapi: Report correct errors on guest eject request
Table 629 of the MMC-5 spec mentions two different error conditions whena CDROM eject is requested: a) while a disc is inserted and b) while adisc is not inserted.
Ensure we return the appropriate error for the present condition of the...
ide: consolidate drive_get(IF_IDE)
factor out ide initialization to call drive_get(IF_IDE)
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Merge branch 'for-anthony' of git://github.com/bonzini/qemu
change all other clock references to use nanosecond resolution accessors
This was done with:
sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' )...
Fix ATA SMART and CHECK POWER MODE
This patch fixes two things:
1) CHECK POWER MODE
The error return value wasn't always zero, so it would show up asoffline. Error is now explicitly set to zero.
2) SMART
The smart values that were returned were invalid and tools like skdump...
Improve vm_stop reason declarations
Define and use dedicated constants for vm_stop reasons, they actuallyhave nothing to do with the EXCP_* defines used so far. At this chance,specify more detailed reasons so that VM state change handlers canevaluate them....
block: tell drivers about an image resize
Extend the change_cb callback with a reason argument, and use itto tell drivers about size changes.
ide: also reset io_buffer_index for writes
Currenly the code only resets the io_buffer_index field for reads,but the code seems to expect this for all types of I/O. I guesswe simply don't hit large enough transfers that would require thisoften enough....
ide: kill ide_dma_submit_check
Merge ide_dma_submit_check into it's only caller. Also use tail recursionusing a goto instead of a real recursion - this avoid overflowing thestack in the pathological situation of an recurring error that is ignored.We'll still be busy looping in ide_dma_cb, but at least won't eat up...
ide: factor dma handling helpers
Factor the DMA I/O path that is duplicated between read and writecommands, into common helpers using the s->is_read flag added forthe macio ATA controller.
ide: honor ncq for atapi
ATAPI also can do ncq, so let's expose the capability.
This patch makes CD-ROM support work on Windows 7 for me.
Signed-off-by: Alexander Graf <agraf@suse.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: add ncq identify data for ahci sata drives
I modified ide_identify() to include the zero-based queue lengthvalue in word 75, and set bit 8 in word 76 to signal NCQ supportin the identify data for AHCI SATA drives.
Signed-off-by: Roland Elek <elek.roland@gmail.com>...
ide: Split out BMDMA code from ATA core
The ATA core is currently heavily intertwined with BMDMA code. Let's loosenthat a bit, so we can happily replace the DMA backend with differentimplementations.
ide: move transfer_start after variable modification
We hook into transfer_start and immediately call the end functionfor ahci. This means that everything needs to be in place for theend function when we start the transfer, so let's move the functiondown to where all state is in place....
ide: split ide command interpretation off
The ATA command interpretation code can be used for PATA and SATAinterfaces alike. So let's split it out into a separate function.
ide: fix whitespace gap in ide_exec_cmd
Now that we have the function split out, we have to reindent it.In order to increase the readability of the actual functional change,this is split out.
ide: Factor ide_dma_set_inactive out
Several places that stop a DMA transfer duplicate this code. Factor it out intoa common function.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
ide: Set bus master inactive on error
BMIDEA in the status register must be cleared on error. This makes FreeBSDrespond (more) correctly to I/O errors.
ide: Handle immediate bdrv_aio_flush failure
If bdrv_aio_flush returns NULL, this should be treated as an error.
ide: set WCACHE supported in IDENTIFY data
ATA does not only have the WCACHE enabled bit in identify word 85, but alsoa WCACHE supported bit in word 82. While the Linux kernel is fine with thelatter at least hdparm also needs the former before correctly displaying...
ide: Factor ide_flush_cache out
The next patch reuses this code, so put it in its own function.
ide: Handle flush failure
Instead of always assuming success for bdrv_aio_flush, actually do somethingwith the error. This respects the werror option and accordingly ignores theerror, reports it to the guest or stops the VM and retries after cont.
Ignoring the error is trivial, obviously. For stopping the VM and retrying...
ide: propagate the required alignment
IDE is a bit ugly in this respect. For one it doesn't really keep trackof a sector size - most of the protocol is in units of 512 bytes, and weassume 2048 bytes for CDROMs which is correct most of the time.
Second IDE allocates an I/O buffer long before we know if we're dealing...
Improve ATA IDENTIFY word 64 contents.
Fill in word 64 of IDENTIFY data to indicate support for PIO modes 3 and 4.This allows NetBSD guests to use UltraDMA modes instead of just PIO mode 0.
Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Rearrange block headers
Changing block.h or blockdev.h resulted in recompiling most objects.
Move DriveInfo typedef and BlockInterfaceType enum definitionsto qemu-common.h and rearrange blockdev.h use to decrease churn.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Merge branch 'for-anthony' of git://repo.or.cz/qemu/kevin
Fix uint8_t comparisons with negative values
Fix the following warnings:/src/qemu/hw/ide/core.c: In function `ide_drive_pio_post_load':/src/qemu/hw/ide/core.c:2767: warning: comparison is always false due to limited range of data type
/src/qemu/ui/vnc-enc-tight.c: In function `tight_detect_smooth_image':...
ide: fix migration in the middle of pio operation
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Revert "ide save/restore pio/atapi cmd transfer fields and io buffer"
This reverts commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6.
The conflicts are due to commit 4fc8d6711aff7a9c11e402c3d77b481609f9f486that is a fix to the ide_drive_pre_save() function. It reverts both...
ide/atapi: add support for GET EVENT STATUS NOTIFICATION
The GET EVENT STATUS NOTIFICATION is a mandatory command accordingto MMC-3, even if event status notification is not supported.
This patch adds support for this command. It returns NEA ("No Event...
ide scsi virtio-blk: Reject empty drives unless media is removable
Disks without media make no sense. For SCSI, a Linux guest kernelcomplains during boot. I didn't try other combinations.
scsi-generic doesn't need the additional check, because it already...
ide: Reject readonly drives unless CD-ROM
drive_init() doesn't permit option readonly for if=ide, but that'sworthless: we get it via if=none and -device.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: Reject invalid CHS geometry
drive_init() doesn't permit invalid CHS for if=ide, but that'sworthless: we get it via if=none and -device.
ide: Replace IDEState members is_cdrom, is_cf by drive_kind
The two aren't independent variables. Make that obvious.
ide: Make ide_init_drive() return success
It still always succeeds. The next commits will add failures.
qdev: Decouple qdev_prop_drive from DriveInfo
Make the property point to BlockDriverState, cutting out the DriveInfomiddleman. This prepares the ground for block devices that don't havea DriveInfo.
Currently all user-defined ones have a DriveInfo, because the only way...
block: Fix virtual media change for if=none
BlockDriverState member removable controls whether virtual mediachange (monitor commands change, eject) is allowed. It is set whenthe "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY.
The type hint is only set by drive_init(). It sets BDRV_TYPE_FLOPPY...
block: Move error actions from DriveInfo to BlockDriverState
That's where they belong semantically (block device host part), eventhough the actions are actually executed by guest device code.
blockdev: Collect block device code in new blockdev.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
ide: Remove redundant IDEState member conf
Commit 428c149b added IDEState member conf to let commit 0009baf1 findthe BlockConf from there. It exists only for qdev drives, created viaide_drive_initfn(), not for drives created via ide_init2().
But for a qdev drive, we can just as well reach its IDEDevice, which...
ide: Split ide_init1() off ide_init2()
ide: Change ide_init_drive() to require valid dinfo argument
IDEState members drive_serial_str and version are now left empty untilan actual drive is connected. Before, they got a default value thatwas overwritten when a drive got connected. Doesn't matter, because...
ide: Split non-qdev code off ide_init2()
ide: Turn drive serial into a qdev property ide-drive.serial
It needs to be a qdev property, because it belongs to the drive'sguest part.
Bonus: info qtree now shows the serial number.
ide: Fix ide_dma_cancel
When cancelling a request, bdrv_aio_cancel may decide that it waits forcompletion of a request rather than for cancellation. IDE therefore can'tabandon its DMA status before calling bdrv_aio_cancel; otherwise the callbackof a completed request would use invalid data....
ide: make a table 'const'
Fix build
Actually some systems don't define PAGE_SIZE. Fixes build breakageby f7736b91c40a617e93505e32dcbd2cb56aad8a23.
Compile ide/core only once
Make win2k install hack unconditional as it is still restricted tox86 only in vl.c.
Replace TARGET_PAGE_SIZE and 4096 with PAGE_SIZE.
block: Emit BLOCK_IO_ERROR before vm_stop() call
The next commit will move the STOP event into do_vm_stop(), tohave the expected event sequence we need to emit the I/O errorevent before calling vm_stop().
The expected sequence is:
{ "event": "BLOCK_IO_ERROR" [...] }...
Fix warning on mingw32
/src/qemu/hw/ide/core.c: In function 'ide_drive_pre_save':/src/qemu/hw/ide/core.c:2740: warning: comparison is always false due to limited range of data type
ide save/restore pio/atapi cmd transfer fields and io buffer
Save/restore information necessary to continue in progress PIO/ATAPI CMDtransfers.
This includes the IO buffer.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: add topology support
Export the physical block size in the ATA IDENTIFY command. Theother topology values are not supported in ATA so skip them.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block: add topology qdev properties
Add three new qdev properties to export block topology information tothe guest. This is needed to get optimal I/O alignment for RAID arraysor SSDs.
The options are:
- physical_block_size to specify the physical block size of the device,...
ide: Generate BLOCK_IO_ERROR QMP event
Just call bdrv_mon_event() in the right place.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: device version property
This patch adds a new property named 'ver' to ide-drive which allows tospecify the version which the virtual disk/cdrom should report to theguest. By default this is the qemu version (i.e. 0.12). usage:
-drive if=none,id=disk,file=......
ide: Use some already defined page macros instead of constants
Some PAGE constants were used instead of the macros we already havedefined in internal.h.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: implement stub for audio control/volume read
This implements the audio control or volume read support as needed bysome systems. A Conectiva Parolin system required this to detect an IDEdevice as CD-ROM, through the CDVOLREAD ioctl.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>...
Rename DriveInfo.onerror to on_write_error
Either rename variables and functions to refer to write errors (which is whatthey actually do) or introduce a parameter to distinguish reads and writes.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: Implement rerror option
scsi: move scsi-disk.h -> scsi.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
IDE: Fix reset handling
Problem: x86 systems could not survive a few system_resets.
Clear most of IDE state when reset. Implement the missing reset handlers.
ide: pre VMState functions are not needed anymore
ide: port ide_drive to vmstate
ide: port idebus to vmstate
ide: change identify_data type to uint8_t
It is used everywhere as uint8_t except in one place. Cast to uint16_tin that placeSigned-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
split away drive init from ide_init2()
This allows the ide bus being initialized without drives attachedand the drives being attached and initialization later on asseparate step.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Unexport ticks_per_sec variable. Create get_ticks_per_sec() function
block: add enable_write_cache flag
Add a enable_write_cache flag in the block driver state, and use it todecide if we claim to have a volatile write cache that needs controlledflushing from the guest. The flag is off if cache=writethrough isdefined because O_DSYNC guarantees that every write goes to stable...
ide: use bdrv_aio_flush
ide: pass down DriveInfo instead of BlockDriverState
ide: move cmd+irq from IDEState to IDEBus.
These variables are per bus, not per drive. Lets move them andcleanup things a bit. And fix the cmd migration bug for real.
ide: move code to hw/ide/