Statistics
| Branch: | Revision:

root / hw / ide / core.c @ db895a1e

History | View | Annotate | Download (70.1 kB)

# Date Author Comment
aad64f31 04/15/2013 11:18 am Stefan Hajnoczi

ide: refuse WIN_READ_NATIVE_MAX on empty device

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...

0d09e41a 04/08/2013 07:13 pm Paolo Bonzini

hw: move headers to include/

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....

67bec53d 01/25/2013 07:27 pm Kevin Wolf

ide: Add fall through annotations

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 <>
Reviewed-by: Markus Armbruster <>

80bc2e8d 01/15/2013 11:03 am Paolo Bonzini

ide: fix TRIM with empty range entry

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 <>...

501378c3 01/15/2013 11:03 am Paolo Bonzini

ide: issue discard asynchronously but serialize the pieces

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 <>...

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

6f991980 12/17/2012 07:56 pm Paolo Bonzini

Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEAD

Signed-off-by: Paolo Bonzini <>

a2cb15b0 12/17/2012 01:02 pm Michael S. Tsirkin

pci: update all users to look in pci/

update all users so we can remove the makefile hack.

Signed-off-by: Michael S. Tsirkin <>

a7f3d65b 12/13/2012 12:17 pm Pavel Hrdina

atapi: reset cdrom tray statuses on ide_reset

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....

0c6f08b0 11/30/2012 12:33 pm Pavel Hrdina

atapi: make change media detection for guests easier

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"...

038268e2 11/21/2012 10:47 am Kevin Wolf

ide: Fix crash with too long PRD

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 <>
Signed-off-by: Stefan Hajnoczi <>

72bcca73 11/21/2012 10:47 am Kevin Wolf

ide: Fix status register after short PRDs

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....

d7331bed 11/14/2012 07:19 pm Stefan Hajnoczi

aio: rename AIOPool to AIOCBInfo

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 <>
Signed-off-by: Kevin Wolf <>

1ceee0d5 09/28/2012 08:40 pm Paolo Bonzini

iostatus: change is_read to a bool

Do this while we are touching this part of the code, before introducing
more uses of "int is_read".

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

3e1caa5f 09/28/2012 08:40 pm Paolo Bonzini

iostatus: reorganize io error code

Move the common part of IDE/SCSI/virtio error handling to the block
layer. The new function bdrv_error_action subsumes all three of
bdrv_emit_qmp_error_event, vm_stop, bdrv_iostatus_set_err.

The same scheme will be used for errors in block jobs....

92aa5c6d 09/28/2012 08:40 pm Paolo Bonzini

iostatus: move BlockdevOnError declaration to QAPI

This will let block-stream reuse the enum. Places that used the enums
are renamed accordingly.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

ff06f5f3 09/28/2012 08:14 pm Paolo Bonzini

iostatus: rename BlockErrorAction, BlockQMPEventAction

We want to remove knowledge of BLOCK_ERR_STOP_ENOSPC from drivers;
drivers should only be told whether to stop/report/ignore the error.
On the other hand, we want to keep using the nicer BlockErrorAction...

1e53537f 09/12/2012 04:50 pm Stefan Weil

ide: Fix error messages from static code analysis (no real error)

Report from smatch:
hw/ide/core.c:1472 ide_exec_cmd(423) error: buffer overflow 'smart_attributes' 8 <= 29
hw/ide/core.c:1474 ide_exec_cmd(425) error: buffer overflow 'smart_attributes' 8 <= 29...

2adc99b2 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Compute BIOS CHS translation in one place

Currently, it is split between hd_geometry_guess() and
pc_cmos_init_late(). Confusing. info qtree shows the result of the
former. Also confusing.

Fold the part done in pc_cmos_init_late() into hd_geometry_guess()....

b51daf00 07/17/2012 05:48 pm Markus Armbruster

Relax IDE CHS limits from 16383,16,63 to 65535,16,255

New limits straight from ATA4 6.2 Register delivered data transfer
command sector addressing.

I figure the old sector limit 63 was blindly copied from the BIOS
int 13 limit. Doesn't apply to the hardware. No idea where the old...

577d0a38 07/17/2012 05:48 pm Markus Armbruster

blockdev: Don't limit DriveInfo serial to 20 characters

All current users (IDE, SCSI and virtio-blk) happen to share this 20
characters limit. Still, it should be left to device models. They
already enforce their limits. They have to, as the DriveInfo limit...

b7eb0c9f 07/17/2012 05:48 pm Markus Armbruster

hw/block-common: Factor out fall back to legacy -drive cyls=...

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

ba801960 07/17/2012 05:48 pm Markus Armbruster

ide: qdev properties for disk geometry

Geometry needs to be qdev properties, because it belongs to the
disk's guest part.

Maintain backward compatibility exactly like for serial: fall back to
DriveInfo's geometry, set with -drive cyls=...

Do this only for ide-hd. ide-drive is legacy. ide-cd doesn't have a...

9db1c0f7 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Move disk geometry guessing back from block.c

Commit f3d54fc4 factored it out of hw/ide.c for reuse. Sensible,
except it was put into block.c. Device-specific functionality should
be kept in device code, not the block layer. Move it to
hw/hd-geometry.c, and make stylistic changes required to keep...

e2f3dc2b 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Cut out block layer translation middleman

hd_geometry_guess() picks geometry and translation. Callers can get
the geometry directly, via parameters, but for translation they need
to go through the block layer.

Add a parameter for translation, so it can optionally be gotten just...

9139046c 07/17/2012 05:48 pm Markus Armbruster

ide pc: Cut out the block layer geometry middleman

PC BIOS setup needs IDE geometry information. Get it directly from
the device model rather than through the block layer. In preparation
of purging geometry from the block layer, which will happen later in...

1f24d7b4 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Switch to uint32_t to match BlockConf

Best to use the same type, to avoid unwanted truncation or sign
extension.

BlockConf can't use plain int for cyls, heads and secs, because
integer properties require an exact width.

Signed-off-by: Markus Armbruster <>...

93bfef4c 06/19/2012 09:36 pm Crístian Viana

Allow machines to configure the QEMU_VERSION that's exposed via hardware

QEMU exposes its version to the guest's hardware and in some cases that is wrong
(e.g. Windows prints messages about driver updates when you switch
the QEMU version).
There is a new field now on the struct QEmuMachine, hw_version, which may...

7cdd481c 06/15/2012 03:03 pm Paolo Bonzini

ide: support enable/disable write cache

Enabling or disabling the write cache is done with the SET FEATURES
command. The command can be issued with sg_sat_set_features from
sg3-utils.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

d5b406d9 05/02/2012 07:47 pm Alexander Graf

ATA: Allow WIN_SECURITY_FREEZE_LOCK as nop

When using Windows 8 with an AHCI disk drive, it issues a blue screen.
The reason is that WIN_SECURITY_FREEZE_LOCK / CFA_WEAR_LEVEL is not
supported by our ATA implementation, but Windows expects it to be there....

bef0fd59 04/19/2012 05:03 pm Stefan Hajnoczi

ide: convert ide_sector_read() to asynchronous I/O

The IDE PIO interface currently uses bdrv_read() to perform reads
synchronously. Synchronous I/O in the vcpu thread is bad because it
prevents the guest from executing code - it makes the guest
unresponsive....

e82dabd8 04/19/2012 05:03 pm Stefan Hajnoczi

ide: convert ide_sector_write() to asynchronous I/O

The IDE PIO write sector code path uses bdrv_write() and hence can make
the guest unresponsive while the I/O request is in progress. This patch
converts ide_sector_write() to use bdrv_aio_writev() by using the...

43cf8ae6 04/05/2012 03:54 pm David Gibson

Use DMADirection type for dma_bdrv_io

Currently dma_bdrv_io() takes a 'to_dev' boolean parameter to
determine the direction of DMA it is emulating. We already have a
DMADirection enum designed specifically to encode DMA directions.
This patch uses it for dma_bdrv_io() as well. This involves removing...

85e8dab1 04/05/2012 03:54 pm Paolo Bonzini

aio: move BlockDriverAIOCB to qemu-aio.h

And remove several block_int.h inclusions that should not be there.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

2844bdd9 04/05/2012 03:54 pm Kevin Wolf

ide: IDENTIFY word 86 bit 14 is reserved

Reserved bits should be cleared to zero.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

27e0c9a1 04/05/2012 03:54 pm Floris Bos

ide: Add "model=s" qdev option

Allow the user to override the default disk model name "QEMU HARDDISK".

Some Linux distributions use the /dev/disk/by-id/scsi-SATA_name-of-disk-
model_serial addressing scheme when refering to partitions in /etc/fstab
and elsewhere. This causes problems when starting a disk image taken from...

aa2c91bd 04/05/2012 03:54 pm Floris Bos

ide: Change serial number strncpy() to pstrcpy()

strncpy may not null-terminate the destination string.

Cc:
Signed-off-by: Floris Bos <>
Signed-off-by: Kevin Wolf <>

95ebda85 04/05/2012 03:54 pm Floris Bos

ide: Adds wwn=hex qdev option

Allow the user to specify a disk's World Wide Name.

Linux guests can address disks by their unique World Wide Name number
(e.g. /dev/disk/by-id/wwn-0x5001517959123522). This patch adds support
for assigning a World Wide Name number to a virtual IDE disk....

d53cdb30 02/29/2012 01:48 pm Paolo Bonzini

ide: fail I/O to empty disk

Requesting a read or a write operation on an empty disk can lead
to QEMU dumping core.

Also fix a few braces here and there.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Stefan Hajnoczi <>...

bde25388 02/22/2012 09:23 pm Luiz Capitulino

ide: drop ide_tray_state_post_load()

This is used to sync the physical tray state after migration when
using CD-ROM passthrough. However, migrating when using passthrough
is broken anyway and shouldn't be supported...

So, drop this function as it causes a problem with the DEVICE_TRAY_MOVED...

329c0a48 02/22/2012 09:22 pm Luiz Capitulino

block: Rename bdrv_mon_event() & BlockMonEventAction

They are QMP events, not monitor events. Rename them accordingly.

Also, move bdrv_emit_qmp_error_event() up in the file. A new event will
be added soon and it's good to have them next each other.

Signed-off-by: Luiz Capitulino <>...

3cfdd0da 12/19/2011 05:10 pm Anthony Liguori

Merge remote-tracking branch 'stefanha/trivial-patches' into staging

b61744b3 12/16/2011 11:53 am Paolo Bonzini

ide: drop argument to dma_buf_commit

The argument is unused and even wrong when the function is called
by ide_handle_rw_error. Drop it.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

b9b2008b 12/15/2011 01:40 pm Paolo Bonzini

block: dma_bdrv_* does not return NULL

Initially attempted with the following semantic patch:

rule1
expression E;
statement S;
@@
E =
(
dma_bdrv_io | dma_bdrv_read | dma_bdrv_write
)
(...);
(
- if (E == NULL) { ... } |
- if (E) { <... S ...> }...

ad54ae80 12/15/2011 01:40 pm Paolo Bonzini

block: bdrv_aio_* do not return NULL

Initially done with the following semantic patch:

rule1
expression E;
statement S;
@@
E =
(
bdrv_aio_readv | bdrv_aio_writev | bdrv_aio_flush | bdrv_aio_discard | bdrv_aio_ioctl
)
(...);
(
- if (E == NULL) { ... }...

66a0a2cb 12/06/2011 11:56 am Dong Xu Wang

fix spelling in hw sub directory

Correct obvious spelling errors in qemu/hw directory.

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Stefan Hajnoczi <>

2df0a3a3 11/11/2011 03:02 pm Paolo Bonzini

atapi: implement eject requests

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

67cc61e4 10/28/2011 08:25 pm Paolo Bonzini

atapi/scsi: unify definitions for MMC

The definitions in ide/internal.h are duplicates, since ATAPI commands
actually come from SCSI. Use the ones in scsi-defs.h and move the
missing ones there. Two exceptions:

- MODE_PAGE_WRITE_PARMS conflicts with the "flexible disk geometry"...

fb60105d 10/28/2011 08:25 pm Kevin Wolf

ide: Fix off-by-one error in array index check

Signed-off-by: Kevin Wolf <>
Reviewed-by: Paolo Bonzini <>

2a22e6eb 10/14/2011 08:36 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

36f490b1 10/14/2011 06:44 pm Anthony Liguori

Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging

4a91d3b3 10/11/2011 04:57 pm Richard Henderson

ide: Convert to isa_register_portio_list

Signed-off-by: Richard Henderson <>
Signed-off-by: Avi Kivity <>

50fb1900 10/11/2011 10:42 am Luiz Capitulino

ide: Support I/O status

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

0461d5a6 10/04/2011 05:02 pm Luiz Capitulino

RunState: Rename enum values as generated by the QAPI

Next commit will convert the query-status command to use the
RunState type as generated by the QAPI.

In order to "transparently" replace the current enum by the QAPI
one, we have to make some changes to some enum values....

c8af89af 09/20/2011 11:21 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

bbca72c6 09/19/2011 12:35 pm Paolo Bonzini

dma-helpers: rename is_write to to_dev

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

1dfb4dd9 09/15/2011 10:39 pm Luiz Capitulino

Replace the VMSTOP macros with a proper state type

Today, when notifying a VM state change with vm_state_notify(),
we pass a VMSTOP macro as the 'reason' argument. This is not ideal
because the VMSTOP macros tell why qemu stopped and not exactly
what the current VM state is....

7b6f9300 09/12/2011 04:17 pm Markus Armbruster

block: New bdrv_set_buffer_alignment()

Device models should be able to set it without an unclean include of
block_int.h.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

7d4b4ba5 09/12/2011 04:17 pm Markus Armbruster

block: New change_media_cb() parameter load

To let device models distinguish between eject and load.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

25ad22bc 09/12/2011 04:17 pm Markus Armbruster

ide/atapi scsi-disk: Make monitor eject -f, then change work

change fails while the tray is locked by the guest. eject -f forces
it open and removes any media. Unfortunately, the tray closes again
instantly. Since the lock remains as it is, there is no way to insert...

db118fe7 09/12/2011 04:17 pm Markus Armbruster

ide/atapi: Preserve tray state on migration

Use a subsection, so that migration to older version still works,
provided the tray is closed and unlocked.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

9e6a4c91 09/12/2011 04:17 pm Markus Armbruster

block: Drop BlockDriverState member removable

It's a confused mess (see previous commit). No users remain.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

e4def80b 09/12/2011 04:17 pm Markus Armbruster

block: Show whether the virtual tray is open in info block

Need to ask the device, so this requires new BlockDevOps member
is_tray_open().

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

d1a0739d 09/12/2011 04:17 pm Markus Armbruster

block: Move BlockConf & friends from block_int.h to block.h

It's convenience stuff for block device models, so block.h isn't the
ideal home either, but better than block_int.h.

Permits moving some #include "block_int.h" from device model .h into
.c.

Signed-off-by: Markus Armbruster <>...

f107639a 09/12/2011 04:17 pm Markus Armbruster

block: Drop medium lock tracking, ask device models instead

Requires new BlockDevOps member is_medium_locked(). Implement for IDE
and SCSI CD-ROMs.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

844505b1 09/12/2011 04:17 pm Markus Armbruster

ide: Use a table to declare which drive kinds accept each command

No functional change.

It would be nice to have handler functions in the table, like commit
e1a064f9 did for ATAPI. Left for another day.

Signed-off-by: Markus Armbruster <>...

3cfc2269 09/12/2011 04:17 pm Markus Armbruster

ide: Reject ATA commands specific to drive kinds

ACS-2 Table B.2 explicitly prohibits ATAPI devices from implementing
WIN_RECAL, WIN_READ_EXT, WIN_READDMA_EXT, WIN_READ_NATIVE_MAX,
WIN_MULTREAD_EXT, WIN_WRITE, WIN_WRITE_ONCE, WIN_WRITE_EXT,
WIN_WRITEDMA_EXT, WIN_MULTWRITE_EXT, WIN_WRITE_VERIFY, WIN_VERIFY,...

3f76a7c3 09/12/2011 04:17 pm Markus Armbruster

ide: Fix ATA command READ to set ATAPI signature for CD-ROM

Must set the ATAPI device signature, see ATA4 8.27.5.2 Outputs for
PACKET Command feature set devices, and ACS-2 7.36.6 Outputs for
PACKET feature set devices.

Signed-off-by: Markus Armbruster <>...

656fbeff 09/06/2011 12:24 pm Markus Armbruster

ide: Give vmstate structs internal linkage where possible

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

fa879d62 09/06/2011 12:23 pm Markus Armbruster

block: Attach non-qdev devices as well

For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.

While there, rename BlockDriverState member peer to dev, bdrv_attach()...

0e49de52 09/06/2011 12:23 pm Markus Armbruster

block: Generalize change_cb() to BlockDevOps

So we can more easily add device model callbacks.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

145feb17 09/06/2011 12:23 pm Markus Armbruster

block: Split change_cb() into change_media_cb(), resize_cb()

Multiplexing callbacks complicates matters needlessly.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

1d4316d3 09/06/2011 12:23 pm Markus Armbruster

ide: Update command code definitions as per ACS-2 Table B.2

Drop WIN_SRST, it has the same value as WIN_DEVICE_RESET.

Drop unused WIN_RESTORE, it has the same value as WIN_RECAL.

Drop codes that are not implemented and long obsolete: WIN_READ_LONG,
WIN_READ_LONG_ONCE, WIN_WRITE_LONG, WIN_WRITE_LONG_ONCE, WIN_FORMAT...

814839c0 09/06/2011 12:23 pm Markus Armbruster

ide: Clean up case label indentation in ide_exec_cmd()

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

a597e79c 08/25/2011 07:18 pm Christoph Hellwig

block: explicit I/O accounting

Decouple the I/O accounting from bdrv_aio_readv/writev/flush and
make the hardware models call directly into the accounting helpers.

This means:
- we do not count internal requests from image formats in addition
to guest originating I/O...

c925400b 07/05/2011 12:23 pm Kevin Wolf

ide: Initialise buffers with zeros

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 <>...

40c4ed3f 07/05/2011 12:23 pm Kevin Wolf

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....
0754f9ec 06/15/2011 03:36 pm Kevin Wolf

ide: Add forgotten VMSTATE_END_OF_LIST in subsection

Signed-off-by: Kevin Wolf <>

4e1e0051 06/15/2011 03:36 pm Christoph Hellwig

ide: allow other dma comands than read and write

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 <>
Signed-off-by: Kevin Wolf <>

d353fb72 06/15/2011 03:36 pm Christoph Hellwig

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.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

def93791 06/15/2011 03:36 pm Kevin Wolf

ide: Split error status from status register

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...

fdc650d7 06/15/2011 03:36 pm Kevin Wolf

ide: Fix ide_drive_pio_state_needed()

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 <>

69c38b8f 06/08/2011 11:39 am Kevin Wolf

ide/core: Remove explicit setting of BM_STATUS_INT

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...

95b5edcd 05/19/2011 11:26 am Markus Armbruster

blockdev: Store -drive option media in DriveInfo

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...

1f56e32a 05/19/2011 11:26 am Markus Armbruster

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 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...

33231e0e 04/27/2011 05:20 pm Kevin Wolf

ide: Split atapi.c out

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 <>

4b9b7092 04/27/2011 03:36 pm Amit Shah

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_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...

996faf1a 04/13/2011 01:20 pm Amit Shah

atapi: GESN: implement 'media' subcommand

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...

0af63ba3 04/13/2011 01:20 pm Amit Shah

atapi: GESN: Standardise event response handling for future additions

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 <>...

8f8e834d 04/13/2011 01:20 pm Amit Shah

atapi: GESN: Use structs for commonly-used field types

Instead of using magic numbers, use structs that are more descriptive of
the fields being used.

Signed-off-by: Amit Shah <>
Acked-by: Jes Sorensen <>
Acked-by: Paolo Bonzini <>...

493accd6 04/13/2011 01:20 pm Amit Shah

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;
}
...

Signed-off-by: Amit Shah <>...

0c370a35 04/13/2011 01:19 pm Amit Shah

atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change

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....

8aa71917 04/13/2011 01:06 pm Amit Shah

atapi: Drives can be locked without media present

Drivers are free to lock drives without any media present. Such a
condition should not result in an error condition.

See Table 341 in MMC-5 spec for details.

Signed-off-by: Amit Shah <>...

88f2bb58 04/13/2011 01:06 pm Amit Shah

atapi: Report correct errors on guest eject request

Table 629 of the MMC-5 spec mentions two different error conditions when
a CDROM eject is requested: a) while a disc is inserted and b) while a
disc is not inserted.

Ensure we return the appropriate error for the present condition of the...

75717903 04/07/2011 02:51 pm Isaku Yamahata

ide: consolidate drive_get(IF_IDE)

factor out ide initialization to call drive_get(IF_IDE)

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Kevin Wolf <>

aa315f95 03/21/2011 10:28 pm Aurelien Jarno

Merge branch 'for-anthony' of git://github.com/bonzini/qemu

  • 'for-anthony' of git://github.com/bonzini/qemu:
    remove qemu_get_clock
    add a generic scaling mechanism for timers
    change all other clock references to use nanosecond resolution accessors
    change all rt_clock references to use millisecond resolution accessors...
74475455 03/21/2011 10:23 am Paolo Bonzini

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\>' )...
b93af93d 03/15/2011 02:21 pm Brian Wheeler

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 as
offline. Error is now explicitly set to zero.

2) SMART

The smart values that were returned were invalid and tools like skdump...

e07bbac5 02/14/2011 04:39 pm Jan Kiszka

Improve vm_stop reason declarations

Define and use dedicated constants for vm_stop reasons, they actually
have nothing to do with the EXCP_* defines used so far. At this chance,
specify more detailed reasons so that VM state change handlers can
evaluate them....