ahci: Fix ahci cdrom read corruptions for reads > 128k
While testing q35, which has its cdrom attached to the ahci controller, I foundthat the Fedora 17 install would panic on boot. The panic occurs whilesquashfs is trying to read from the cdrom. The errors are:...
ahci: Fix sglist memleak in ahci_dma_rw_buf()
I noticed that in hw/ide/ahci:ahci_dma_rw_buf() we do not free the sglist. Thus,I've added a call to qemu_sglist_destroy() to fix this memory leak.
In addition, I've adeed a call in qemu_sglist_destroy() to 0 all of the sglist...
ide scsi: Mess with geometry only for hard disk devices
Legacy -drive cyls=... are now ignored completely when the drivedoesn't back a hard disk device. Before, they were first checkedagainst a hard disk's limits, then ignored.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
Merge branch pci into master
Merge master and pci branch, resolve build breakage in hw/esp.cintroduced by f90c2bcd.
Conflicts: hw/esp.c
Avoid returning void
It's silly and non-conforming to standards to return void,don't do it.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hd-geometry: Compute BIOS CHS translation in one place
Currently, it is split between hd_geometry_guess() andpc_cmos_init_late(). Confusing. info qtree shows the result of theformer. Also confusing.
Fold the part done in pc_cmos_init_late() into hd_geometry_guess()....
Relax IDE CHS limits from 16383,16,63 to 65535,16,255
New limits straight from ATA4 6.2 Register delivered data transfercommand sector addressing.
I figure the old sector limit 63 was blindly copied from the BIOSint 13 limit. Doesn't apply to the hardware. No idea where the old...
hw/block-common: Move BlockConf & friends from block.h
This stuff doesn't belong to block layer, and was put there onlybecause a better home didn't exist then. Now it does.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/block-common: Factor out fall back to legacy -drive serial=...
blockdev: Don't limit DriveInfo serial to 20 characters
All current users (IDE, SCSI and virtio-blk) happen to share this 20characters limit. Still, it should be left to device models. Theyalready enforce their limits. They have to, as the DriveInfo limit...
hw/block-common: Factor out fall back to legacy -drive cyls=...
ide: qdev properties for disk geometry
Geometry needs to be qdev properties, because it belongs to thedisk's guest part.
Maintain backward compatibility exactly like for serial: fall back toDriveInfo's geometry, set with -drive cyls=...
Do this only for ide-hd. ide-drive is legacy. ide-cd doesn't have a...
ide: qdev property for BIOS CHS translation
This isn't quite orthodox. CHS translation is firmware configuration,communicated via the RTC's CMOS RAM, not a property of the disk. Butit's best to treat it just like geometry anyway.
Maintain backward compatibility exactly like for geometry: fall back...
ide pc: Put hard disk info into CMOS only for hard disks
In particular, don't set disk type and geometry when a CD-ROM on buside.0 has media during CMOS initialization.
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 shouldbe kept in device code, not the block layer. Move it tohw/hd-geometry.c, and make stylistic changes required to keep...
hd-geometry: Cut out block layer translation middleman
hd_geometry_guess() picks geometry and translation. Callers can getthe geometry directly, via parameters, but for translation they needto go through the block layer.
Add a parameter for translation, so it can optionally be gotten just...
ide pc: Cut out the block layer geometry middleman
PC BIOS setup needs IDE geometry information. Get it directly fromthe device model rather than through the block layer. In preparationof purging geometry from the block layer, which will happen later in...
hd-geometry: Switch to uint32_t to match BlockConf
Best to use the same type, to avoid unwanted truncation or signextension.
BlockConf can't use plain int for cyls, heads and secs, becauseinteger properties require an exact width.
pci: convert PCIUnregisterFunc to void
Not a single driver has any possibility of failure on theirexit function, let's keep it that way.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
atapi: implement READ DISC INFORMATION
This command is not necessary for CD-ROM and DVD-ROM, but some versions ofudev trip on its absence.
Cc: Kevin Wolf <kwolf@redhat.com>Cc: Markus Armbruster <armbru@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers
dma-helpers.c contains a number of helper functions for doingscatter/gather DMA, and various block device related DMA. Currently,these directly access guest memory using cpu_physical_memory_*(),...
ide/ahci: Use universal DMA helper functions
The AHCI device can provide both PCI and SysBus AHCI deviceemulations. For this reason, it wasn't previously converted to usethe pci_dma_*() helper functions. Now that we have universal DMAhelper functions, this converts AHCI to use them....
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 switchthe QEMU version).There is a new field now on the struct QEmuMachine, hw_version, which may...
Merge remote-tracking branch 'afaerber-or/qom-next-2' into staging
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
qdev: Convert busses to QEMU Object Model
This is far less interesting than it sounds. We simply add an Object to eachBusState and then register the types appropriately. Most of the interestingrefactoring will follow in the next patches.
Since we're changing fundamental type names (BusInfo -> BusClass), it all needs...
qdev: Move bus properties to a separate global
Simple code movement in order to simplify future refactoring.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
qdev: Move bus properties to abstract superclasses
In qdev, each bus in practice identified an abstract superclass, butthis was mostly hidden. In QOM, instead, these abstract classes areexplicit so we can move bus properties there.
All bus property walks are removed, and all device property walks...
ide: support enable/disable write cache
Enabling or disabling the write cache is done with the SET FEATUREScommand. The command can be issued with sg_sat_set_features fromsg3-utils.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Un-inline fdctrl_init_isa()
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
msi: Invoke msi/msix_reset from PCI core
There is no point in pushing this burden to the devices, they tend toforget to call them (like intel-hda, ahci, xhci did). Instead, resetfunctions are now called from pci_device_reset. They do nothing ifMSI/MSI-X is not in use....
msi: Invoke msi/msix_write_config from PCI core
Also this functions is better invoked by the core than by each and everydevice. This allows to drop the config_write callbacks from ich andintel-hda.
CC: Alexander Graf <agraf@suse.de>CC: Gerd Hoffmann <kraxel@redhat.com>...
ahci: Fix reset of MSI function
Call msi_reset on device reset as still required by the core.
CC: Alexander Graf <agraf@suse.de>CC: qemu-stable@nongnu.orgSigned-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
ahci: Clean up reset functions
Properly register reset functions via the device class.
CC: Alexander Graf <agraf@suse.de>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
build: convert libhw to nested Makefile.objs
After this patch, the libhw* directories will have a hierarchythat mimics the source tree. This is useful because we do havea couple of files there that are in the top source directory.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ahci: SATA FIS is 20 bytes, not 0x20
As in the SATA and AHCI specifications, a FIS is 5 Dwords of 4 byteseach, which comes to 20 bytes (decimal), not 0x20.
Signed-off-by: Daniel Verkamp <daniel@drv.nu>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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 notsupported by our ATA implementation, but Windows expects it to be there....
ide: convert ide_sector_read() to asynchronous I/O
The IDE PIO interface currently uses bdrv_read() to perform readssynchronously. Synchronous I/O in the vcpu thread is bad because itprevents the guest from executing code - it makes the guestunresponsive....
ide: convert ide_sector_write() to asynchronous I/O
The IDE PIO write sector code path uses bdrv_write() and hence can makethe guest unresponsive while the I/O request is in progress. This patchconverts ide_sector_write() to use bdrv_aio_writev() by using the...
Use DMADirection type for dma_bdrv_io
Currently dma_bdrv_io() takes a 'to_dev' boolean parameter todetermine the direction of DMA it is emulating. We already have aDMADirection enum designed specifically to encode DMA directions.This patch uses it for dma_bdrv_io() as well. This involves removing...
aio: move BlockDriverAIOCB to qemu-aio.h
And remove several block_int.h inclusions that should not be there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: IDENTIFY word 86 bit 14 is reserved
Reserved bits should be cleared to zero.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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/fstaband elsewhere. This causes problems when starting a disk image taken from...
ide: Change serial number strncpy() to pstrcpy()
strncpy may not null-terminate the destination string.
Cc: kwolf@redhat.comSigned-off-by: Floris Bos <dev@noc-ps.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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 supportfor assigning a World Wide Name number to a virtual IDE disk....
Add missing const attributes for MemoryRegionOps
Most MemoryRegionOps already had the const attribute.This patch adds it to the remaining ones.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
ide: fail I/O to empty disk
Requesting a read or a write operation on an empty disk can leadto QEMU dumping core.
Also fix a few braces here and there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
Merge remote-tracking branch 'qmp/queue/qmp' into staging
ide: drop ide_tray_state_post_load()
This is used to sync the physical tray state after migration whenusing CD-ROM passthrough. However, migrating when using passthroughis broken anyway and shouldn't be supported...
So, drop this function as it causes a problem with the DEVICE_TRAY_MOVED...
block: Don't call bdrv_eject() if the tray state didn't change
It's not needed. Besides we can then assume that bdrv_eject() isonly called when there's a tray state change, which is useful tothe DEVICE_TRAY_MOVED event (going to be added in a futurecommit)....
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 willbe added soon and it's good to have them next each other.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>...
ahci: use new DMA helpers
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
ide: fix compilation errors when DEBUG_IDE is set
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
AHCI: Fix port reset race
bdrv_aio_cancel() can trigger bdrv_aio_flush() which makes all aiothat is currently in flight finish. So what we do is:
port reset detect ncq in flight cancel ncq delete ncq sg list
at which point we have double freed the sg list. Instead, with this...
AHCI: Masking of IRQs actually masks them
When masking IRQ lines, we should actually mask them out and not declarethem active anymore. Once we mask them in again, they are allowed to triggeragain.
Signed-off-by: Alexander Graf <agraf@suse.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qdev: remove baked in notion of aliases (v2)
Limit them to the device_add functionality. Device aliases were a hack basedon the fact that virtio was modeled the wrong way. The mechanism for aliasingis very limited in that only one alias can exist for any device....
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and thenrebased it into a single step which avoids repeatedly touching every file inthe tree.
The first step was a sed-based addition of the parent type to the subclass...
qdev: kill off DeviceInfo
It is no longer used in the tree since everything is done natively throughQEMU Object Model.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: convert to QEMU Object Model
sysbus: apic: ioapic: convert to QEMU Object Model
This converts three devices because apic and ioapic are subclasses of sysbus.Converting subclasses independently of their base class is prohibitively hard.
ide: convert to QEMU Object Model
qdev: prepare source tree for code conversion
These are various small stylistic changes which help make things moreconsistent such that the automated conversion script can be simpler.
It's not necessary to agree or disagree with these style changes because all...
isa: pic: convert to QEMU Object Model
This converts two devices at once because PIC subclasses ISA and convertingsubclasses independently is extremely hard.
qdev: move qdev->info to class
Right now, DeviceInfo acts as the class for qdev. In order to switch to aproper ObjectClass derivative, we need to ween all of the callers off ofinteracting directly with the info pointer.
ahci: add support for non-PCI based controllers
Add support for ahci on sysbus.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Correct types in bmdma_addr_{read,write}
Back when I made patches introducing dma_addr_t and various PCI DMAwrapper functions, I made a mistake. The bmdma_addr_{read,write} functionsneed to take target_phys_addr_t not dma_addr_t, since they are assigned...
isa: give ISABus/ISADevice to isa_create(), isa_bus_irqs() and isa_get_irq() functions
NULL is a valid bus/device, so there is no change in behaviour.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: drop argument to dma_buf_commit
The argument is unused and even wrong when the function is calledby ide_handle_rw_error. Drop it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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 ...> }...
rule1
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) { ... }...
Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging
Remove unnecessary casts from PCI DMA code in PCI IDE
This patch removes some unnecessary casts in the PCI IDE device,introduced by commit 552908fef5b67ad9d96b76d7cb8371ebc26c9bc8'PCI IDE: Use PCI DMA stub functions'.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
fix spelling in hw sub directory
Correct obvious spelling errors in qemu/hw directory.
block: convert qemu_aio_flush() calls to bdrv_drain_all()
Many places in QEMU call qemu_aio_flush() to complete all pendingasynchronous I/O. Most of these places actually want to drain all blockrequests but there is no block layer API to do so.
This patch introduces the bdrv_drain_all() API to wait for requests...
ide/mmio: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
atapi: kill MODE SENSE, fix MODE SENSE
Mode page 2A of emulated ATAPI DVD-ROM should have page length 0x14like SCSI CD-ROM, rather than 0x12.
Mode page length is off by 8, as it should contain the length of thepayload after the first two bytes....
atapi: implement eject requests
PCI IDE: Use PCI DMA stub functions
This updates the PCI IDE device emulation to use the explicit PCI DMAwrapper to initialize its scatter/gathjer structure. This means thisdriver should not need further changes when the sglist interface isextended to support IOMMUs....
Conflicts: block/vmdk.c
atapi/scsi: unify definitions for MMC
The definitions in ide/internal.h are duplicates, since ATAPI commandsactually come from SCSI. Use the ones in scsi-defs.h and move themissing ones there. Two exceptions:
- MODE_PAGE_WRITE_PARMS conflicts with the "flexible disk geometry"...
atapi: move GESN definitions to scsi-defs.h
As a complement to the previous patch, move definitions for GET EVENTSTATUS NOTIFICATION from the two functions to scsi-defs.h.
The NCR_* constants are just bit values corresponding to the ENC_*values, with no offsets even, so keep just one copy....
atapi: cleanup/fix mode sense results
The first two bytes (after the 8-byte ATAPI header) are the mode pagenumber and the number of bytes after the length field itself. Makethis clear in the code.
The AUDIO_CTL page was filled with wrong values. It is not anymore in...
atapi/scsi-disk: make mode page values coherent between the two
This patch adds to scsi-disk the missing mode page 0x01 for both diskand CD-ROM drives, and mode page 0x0e for CD drives only.
A few offsets were wrong in atapi.c. Also change the 2Ah mode page to...
ide: Fix off-by-one error in array index check
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
ahci: fix DPRINTF format strings
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging
ide: Convert to isa_register_portio_list
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Avi Kivity <avi@redhat.com>
ide: Support I/O status
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
RunState: Rename enum values as generated by the QAPI
Next commit will convert the query-status command to use theRunState type as generated by the QAPI.
In order to "transparently" replace the current enum by the QAPIone, we have to make some changes to some enum values....
ahci: add port I/O index-data pair
Implement an I/O space index-data register pair as defined by the AHCIspec, including the corresponding SATA PCI capability and BAR.
This allows real-mode code to access the AHCI registers; real-modecode cannot address the memory-mapped register space because it is...
AHCI Port Interrupt Enable register cleaning on soft reset
I've found that FreeBSD AHCI driver doesn't work with AHCI hardwareemulation of QEMU 0.15.0. I believe the problem is on QEMU's side. As Isee, it clears port's Interrupt Enable register each time when reset of...