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: Catch attempt to attach multiple devices to a blockdev
For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foohappily creates two SCSI disks connected to the same block device.It's all downhill from there.
Device usb-storage deliberately attaches twice to the same blockdev,...
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...
ide: Make PIIX and ISA IDE init functions return the qdev
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
pc: Fix CMOS info for drives defined with -device
Drives defined with drive if=ide get get created along with the IDEcontroller, inside machine>init(). That's before cmos_init().Drives defined with -device get created during generic device init.That's after cmos_init(). Because of that, CMOS has no information on...
ide: Make it explicit that ide_create_drive() can't fail
All callers of ide_create_drive() ignore its value. Currentlyharmless, because it fails only when qdev_init() fails, which failsonly when ide_drive_initfn() fails, which never fails.
Brittle. Change it to die instead of silently ignoring failure....
MIPS: Initial support of VIA IDE controller used by fulong mini pc
Signed-off-by: Huacai Chen <zltjiangshi@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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 useless IDEDeviceInfo members unit, drive
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 info qtree for ide-drive.ver
Show the actual default value instead of <null> when the property hasnot been set.
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'
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cmd646: fix abort due to changed opaque pointer for ioport read
We cannot install different opaque pointer for read and writeof the same i/o address.
- handle zero address in bmdma_writeb_common and install the same opaque pointer for both read and write access....
cmd646: pass pci_dev as it needs it
Instead of doing tricks to get the pci_dev, just pass it in the 1stplace. Patch is a bit longer that reverting the pci_dev field, but itstates more clearly (IMHO) what we are doing.
It also fixes the bm test, now that you told me that ->unit is not...
Compile ide/macio only once
Replace TARGET_PAGE_SIZE with 4096. Make byte swapping unconditionalsince PPC is big endian.
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 save/restore current transfer fields
If migration takes place between write of the bmdma address register andwrite of the command register (to initiate DMA), the destination willnot properly start the DMA op, hanging the guest:
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen...
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=......
piix: symbolic constants
No functional changes. I verified that the generated binarydoes not change.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>Acked-by: Glauber Costa <glommer@gmail.com>
cmd646: symbolic names for pci registers
workaround for cmd646 bmdma register access while no dma is active
This is a workaround only, and is a partial revertof a few changes to BMDMAState which removed pci_devfield on the way.
- cmd646 pci_from_bm() expects bm->unit value tocorrespond with bm data being passed to callback...
qdev: Replace device names containing whitespace
Device names with whitespace require quoting in the shell and in themonitor. Some of the offenders are also overly long. Some have amore convenient alias, some don't.
The place for verbose device names is DeviceInfo member desc. The...
Add "static" to please Sparse
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
pci: introduce pcibus_t to represent pci bus address/size instead of uint32_t
This patch is preliminary for 64 bit BAR support.Introduce dedicated type, pcibus_t, to represent pci bus address/sizeinstead of uint32_t.Later this type will be changed to uint64_t....
pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h
make constants for pci base address match pci_regs.h byrenaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Acked-by: Michael S. Tsirkin <mst@redhat.com>...
scsi: move scsi-disk.h -> scsi.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-user
These devices are created automatically, and attempting to createanother one with -device fails with "qemu: hardware error:register_ioport_write: invalid opaque".
Signed-off-by: Markus Armbruster <armbru@redhat.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.
Sparc64/x86: remove unneeded calls to device reset
PPC: remove unneeded calls to device reset
v3: don't call reset functions on cpu initialization
There is absolutely no need to call reset functions when initializingdevices. Since we are already registering them, calling qemu_system_reset()should suffice. Actually, it is what happens when we reboot the machine,...
ide: port ide mmio to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: port isa ide to vmstate
ide: port pmac ide to vmstate
ide: port pci ide to vmstate
ide: pre VMState functions are not needed anymore
ide: port ide_drive to vmstate
ide: microdrive cycle field is set as uint8_t
Really, it is used as a booleanSigned-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: add VMSTATE_IDE_BUS and VMSTATE_IDE_DRIVES
ide: port microdrive to vmstate
ide: include bus in MMIOState
Change pointer to struct by embedded struct.
Adjust all callersSigned-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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>
ide: cmd646 ->unit has just the value that we want
Patchworks-ID: 35307Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: BMDMAState don't need a pci_dev field anymore
Patchworks-ID: 35306Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: change cast to DO_UPCAST
Patchworks-ID: 35293Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: Remove cast in pci_register_bar
We already have a PCIDevice at that point
Patchworks-ID: 35296Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: Remove duplicated definitions
Patchworks-ID: 35297Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: remove uselsess casts from void *
Patchworks-ID: 35298Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: create ide/pci.h for common ide pci definitions
Patchworks-ID: 35299Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: export needed ide-pci functions for split
Patchworks-ID: 35300Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: split cmd646 and piix from pci.c
This patch splits cmd646 specific code from pci.c.This patch splits piix4 specific code from pci.c.And compile new piix.o and cmd646.o when they are needed.The only change that is not code movemet is removal of cmd646 specific parts...
ide: PCIIDEState type field is not needed anymore
We have split the functions that needed it for cmd646
Patchworks-ID: 35302Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: 'secondary' field is only used by cmd646
Patchworks-ID: 35303Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide: cmd646 we can get the pci device with container_of
Patchworks-ID: 35305Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Clean up test for qdev_init() failure
Some callers test for != 0, some for < 0. Normalize to < 0.
Patchworks-ID: 35171Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
New qdev_init_nofail()
Like qdev_init(), but terminate program via hw_error() instead ofreturning an error value.
Use it instead of qdev_init() where terminating the program on failureis okay, either because it's during machine construction, or because...
Rename pci_create_noinit() to pci_create()
It's qdev_create() specialized for PCI, so name it accordingly.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
switch ide bus to inplace allocation.
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
Signed-off-by: malc <av1474@comtv.ru>
ide/isa: convert to qdev.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
ide/pci: convert to qdev.
With this patch applied ide drives (when attached to a pci adapter) canbe created via -device, like this:
-drive if=none,id=mydisk,file=/path/to/disk.img -device ide-drive,drive=mydisk,bus=ide.0,unit=0
Note that creating a master on ide1 doesn't work that way. That is a...
ide/pci: fix indention
ide/qdev: add ide bus.
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.
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
mips malta: Fix fdc regression and use qdev for i8042 setup
8baf73adf664e79eae201c3f618078a220a661d9 (qdev/isa: convert fdc)breaks MIPS Malta:
Tried to create isa device isa-fdc with no isa bus present
Fix this by creating an isa bus for piix4.This change also requires some more qdev related changes...
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.
Fix gcc 3 warning: comparison is always true due to limited range of data type
Fix merge of 59f2a78793b6d17634f39646d604e84af51e0919
ide: move code to hw/ide/