memory: add owner argument to initialization functions
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
dma: keep a device alive while it has SGLists
Reviewed-by: Anthony Liguori <aliguori@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cmd646: fix build when DEBUG_IDE is enabled.
Make sure we use the correct TARGET/PRI macros in the debug statements.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>CC: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: Convert DMA read/write commands to ide_cmd_table handler
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
ide: Convert READ NATIVE MAX ADDRESS to ide_cmd_table handler
ide: Convert CHECK POWER MDOE to ide_cmd_table handler
ide: Convert SET FEATURES to ide_cmd_table handler
ide: Convert FLUSH CACHE to ide_cmd_table handler
ide: Convert SEEK to ide_cmd_table handler
ide: Convert ATAPI commands to ide_cmd_table handler
ide: Convert CF-ATA commands to ide_cmd_table handler
ide: Convert SMART commands to ide_cmd_table handler
ide: Clean up ide_exec_cmd()
All commands are now converted to ide_cmd_table handlers, so it can beunconditional now and the old switch block can go.
ide: Add handler to ide_cmd_table
As a preparation for moving all IDE commands into their own functionlike in the ATAPI code, introduce a 'handler' callback to ide_cmd_table.
Commands using this new infrastructure get some things handledautomatically:...
ide: Convert WIN_DSM to ide_cmd_table handler
ide: Convert WIN_IDENTIFY to ide_cmd_table handler
ide: Convert cmd_nop commands to ide_cmd_table handler
cmd_nop handles all commands that don't really do anything in ourimplementation except setting status register flags.
ide: Convert verify commands to ide_cmd_table handler
ide: Convert read/write multiple commands to ide_cmd_table handler
ide: Convert PIO read/write commands to ide_cmd_table handler
dma: eliminate DMAContext
The DMAContext is a simple pointer to an AddressSpace that is now alwaysalready 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>...
Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu
isa: Use realizefn for ISADevice
Drop ISADeviceClass::init and the resulting no-op initfn and letchildren implement their own realizefn. Adapt error handling.Split off an instance_init where sensible.
Signed-off-by: Andreas Färber <afaerber@suse.de>
ide: Set BSY bit during FLUSH
The implementation of the ATA FLUSH command invokes a flush at the blocklayer, 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 driverreports I/O errors and filesystems get corrupted or remounted read-only....
ide/macio: fix wrong opaque with TRIM support
Commit 215e47b9 enabled TRIM by default, which revealed a bug in TRIMsupport for the IDE macio emulation driver, introduced in d353fb72.
The call to dma_bdrv_io() is using a wrong opaque of type IDEStateinstead of DBDMA_io. This patch fixes that....
ahci: Don't allow creating slave drives
An IDE bus provided by AHCI can only take a single IDE drive. If you adda drive as slave, qemu used to accept the command line but the devicewouldn't be actually usable. Catch the situation instead and error out....
ide: Reset BMIDEA bit when the bus master is stopped
The device is supposed to reset the Bus Master IDE Active bit in thestatus register when 0 is written to the Start/Stop Bus Master bit inthe command register.
In the common cases this happens automatically because bdrv_drain_all()...
ide: QOM'ify ISA IDE
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...
Merge remote-tracking branch 'bonzini/hw-dirs' into staging
include: avoid useless includes of exec/ headers
Headers in include/exec/ are for the deepest innards of QEMU,they should almost never be included directly.
ide: refuse WIN_READ_NATIVE_MAX on empty device
What is the highest addressable sector on an empty CD-ROM? Nothing isaddressable so produce an error.
This patch prevents a divide-by-zero in ide_set_sector() sinces->sectors and s->heads would be 0. Not to mention that a sector=-1...
hw: make all of hw/ide/ configurable via default-configs/
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 dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
blockdev: enable discard by default
Because discard is now a host parameter, we can always fake it as enabledin the guest. This is an extension of the current choice to ignore"not supported" errors from the host when discard_granularity is setto nonzero....
ide/mmio: QOM'ify MMIO IDE for R2D
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>
Merge remote-tracking branch 'kwolf/for-anthony' into staging
ide/macio: QOM'ify MacIO IDE
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>
ppc: Move Mac machines to hw/ppc/
Signed-off-by: Andreas Färber <afaerber@suse.de>[agraf: squash in MAINTAINERS fix]Signed-off-by: Alexander Graf <agraf@suse.de>
ide: Add fall through annotations
Add comments to help static analysers detect that these cases areintentional, and clean up some whitespace in the environment of thesecomments.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>
ahci: Remove unused AHCIDevice fields
'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>
ahci: Change data types in preparation for migration
The size of an int depends on the host, so in order to be able tomigrate these fields, make them either int32_t or bool, depending on theuse.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ahci: Add migration support
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 hasa built-in AHCI controller).
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Jason Baron <jbaron@redhat.com>...
ide: Remove wrong assertion
The Bus Master IDE Active bit (BM_STATUS_DMAING) is not only set whenthe request is still in flight, but also when it has completed and thesize of the physical memory regions in the PRDT was larger than thetransfer size.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
ide: fix TRIM with empty range entry
ATA-ACS-3 says "If the two byte range length is zero, then the LBARange Entry shall be discarded as padding." iovecs are used as ifthey are linearized, so it is incorrect to discard the rest ofthis iovec.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
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 discardcan be an expensive operation.
Make all static TypeInfos const
Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register alltypes natively through QEMU Object Model), TypeInfo as used inthe common, non-iterative pattern is no longer amended with informationand should therefore be const....
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
block: move include files to include/block/
exec: move include files to include/exec/
Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEAD
pci: update all users to look in pci/
update all users so we can remove the makefile hack.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
atapi: reset cdrom tray statuses on ide_reset
Tray statuses should be also reseted. Some guests may lock the trayand after reset before any kernel is loaded the tray should be unlocked.
Also if you reset the real computer the tray is closed. We shoulddo the same in qemu....
atapi: make change media detection for guests easier
If you have a guest with a media in the optical drive and you changeit, the windows guest cannot properly recognize this media change.
Windows needs to detect sense "NOT_READY with ASC_MEDIUM_NOT_PRESENT"...
hw/ide/macio: Fix segfault caused by NULL DMAContext*
Pass qemu_sglist_init the global dma_context_memory rather than a NULLpointer; this fixes a segfault in dma_memory_map() when the gueststarts using DMA.
Reported-by: Amadeusz Sławiński <amade@asmblr.net>...
ide: Fix crash with too long PRD
Without this, s->nsector can become negative and badness happens (tryingto malloc huge amount of memory and glib calls abort())
ide: Fix status register after short PRDs
When failing a request because the length of the regions described bythe PRDT was too short for the requested number of sectors, the IDEemulation forgot to update the status register, so that the device wouldkeep the BSY flag set indefinitely....
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 longerneeds to be modified.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Rename target_phys_addr_t to hwaddr
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes arereserved) and its purpose doesn't match the name (most target_phys_addr_taddresses are not target specific). Replace it with a finger-friendly,...
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu
Remove libhw
The entries for libhw* are no longer needed in .gitignore.
There is also no longer a difference between common-obj-y andhw-obj-y, so one of those two macros is sufficient.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cleanup useless return sentence
This patch cleans up return sentences in the end of void functions.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
scsi, pci, qdev, isa-bus, sysbus: don't let *_get_fw_dev_path return NULL
Use g_strdup rather than strdup, because the sole caller(qdev_get_fw_dev_path_helper) assumes it gets non-NULL, and dereferencesit. Besides, in that caller, the allocated buffer is already freed with...
iostatus: change is_read to a bool
Do this while we are touching this part of the code, before introducingmore uses of "int is_read".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
iostatus: reorganize io error code
Move the common part of IDE/SCSI/virtio error handling to the blocklayer. The new function bdrv_error_action subsumes all three ofbdrv_emit_qmp_error_event, vm_stop, bdrv_iostatus_set_err.
The same scheme will be used for errors in block jobs....
iostatus: move BlockdevOnError declaration to QAPI
This will let block-stream reuse the enum. Places that used the enumsare renamed accordingly.
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...
ATAPI: STARTSTOPUNIT only eject/load media if powercondition is 0
The START STOP UNIT command will only eject/load media ifpower condition is zero.
If power condition is !0 then LOEJ and START will be ignored.
From MMC (sbc contains similar wordings too)...
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 <= 29hw/ide/core.c:1474 ide_exec_cmd(425) error: buffer overflow 'smart_attributes' 8 <= 29...
ahci: properly reset PxCMD on HBA reset
While testing q35, I found that windows 7 (specifically, windows 7 ultimatewith sp1 x64), wouldn't install because it can't find the cdrom or disk drive.The failure message is: 'A required cd/dvd device driver is missing. If you...
Revert "fix some debug printf format strings"
This reverts commit 145c7c880ff520a9348cc2401ba291330b9606fe.
Signed-off-by: malc <av1474@comtv.ru>
fix some debug printf format strings
These are normally ifdefed out and don't matter. But if you enablethem, they ought to be correct.
Signed-off-by: Matthew Ogilvie <mmogilvi_qemu@miniinfo.net>Signed-off-by: malc <av1474@comtv.ru>
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 '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...