Check return value of qdev_init()
But do so only where it may actually fail. Leave the rest for thenext commit.
Patchworks-ID: 35167Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Make qdev_init() destroy the device on failure
Before, every caller had to do this. Only two actually did.
Patchworks-ID: 35170Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: move comment
Move comment back next to main_system_bus to avoid confusion.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Port PCI NIC hotplug to QemuOpts
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Final net cleanup after conversion to QemuOpts
Now that net_client_init() has no users, kill it off and renamenet_client_init_from_opts().
There is no further need for the old code in net_client_parse() either.We use qemu_opts_parse() 'firstname' facitity for that. Instead, move...
qemu/pci: clarify pci config load routine
PCI load routine has to be called with size equal to 256 (otherwise itwill crash in weird ways). So assert this, making code clearer.Also avoid dynamically sized array on stack - good for portability.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
qemu/pci: make pci not depend on msix
Making pci device cleanup msix automatically makes pci.c depend onmsix.c, which is IMO messy. Since devices do msix_init it's easy andnatural for them to also do msix_uninit.
Make NICInfo string fields non-const
We now only assign strdup()ed strings to these fields, never staticstrings.
aliguori: fix build for ppc_prep and mips_jazz
Revert "Fix exit on 'pci_add' Monitor command"
This reverts commit 0148fde54c2478ea8a47c8dbfe4c0fb8bda4d996.
As requested by Luiz.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
eepro100: support 16 bit read from SCBCmd (== 2)
This is necessary to support OpenBSD 4.2 install, withoutthis change it triggers an assert.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Reorganize option rom (+linux kernel) loading.
This patch adds infrastructure to maintain memory regions which must berestored on reset. That includes roms (vga bios and option roms on pc),but is also used when loading linux kernels directly. Features:...
Improve error reporting on file access
By making the error reporting include strerror(errno), it gives the usera bit more indication as to why qemu failed. This is particularlyimportant for people running qemu as a non root user.
Signed-off-by: Justin M. Forbes <jforbes@redhat.com>...
virtio-pci: return error if virtio_console_init fails
Currently only one virtio_console device is supported. Trying to addmultiple devices fails and such failure should be reported back to theqdev init functions.
Signed-off-by: Amit Shah <amit.shah@redhat.com>...
Set revision in eeprom correctly for 82557 versions.
This is necessary to make FreeBSD recognize the device as 82557 - otherwise itsdriver will use unsupported features and fail to work.
set correct CS seg limit and flags on sipi
TCG works with incorrect values somehow.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix pci_vga_init() not to ignore bus argument
Commit a414c306 converted all VGA devices to qdev. It usedpci_create_simple() for all devices, except for this one it usedpci_create(). That's wrong, because it uses PCI bus#0 regardless ofthe bus argument. Fix by switching to pci_create_noinit()....
Fix pci_add storage not to exit on bad first argument
Monitor command "pci_add ADDR storage ..." does its work inqemu_pci_hot_add_nic(). It called pci_create(..., ADDR) to create thedevice. That's wrong, because pci_create() terminates the programwhen ADDR is invalid....
Make it obvious that pci_nic_init() can't fail
Before this patch, pci_nic_init() returns NULL when it can't find themodel in pci_nic_models[]. Except this can't happen, becauseqemu_check_nic_model_list() just searched for model inpci_nic_models[], and terminated the program on failure....
Fix pci_add nic not to exit on bad model
Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() tocreate the NIC. When MODEL is unknown or "?", this prints to stderrand terminates the program.
Change pci_nic_init() not to treat "?" specially, and to return NULL...
pci_create() is now unused, remove it
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Rename pci_create_noinit() to pci_create()
It's qdev_create() specialized for PCI, so name it accordingly.
qemu: clean up target page usage in msix
Since cpu_register_phys_memory does not require size to be a multiple oftarget page size, simply make msix page size 0x1000. Do this in msix,reverting part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we nolonger have to pass target page around....
qemu/virtio-pci: remove unnecessary check
it's safe to call msix_write_config if msixis disabled, so call it unconditionally onpci config write.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
eepro100: Don't allow guests to fail assertions
The idea of using assert() for input validation is rather questionable.Let's remove it from eepro100, so that guests need to find more interestingways if they want to crash qemu.
This patch replaces asserts that are directly dependent on guest-accessible...
qdev: show name of device that fails init
When initialising a device fails, show the name of the failing device.
The current behaviour is to silently exit on such errors.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu/pci: refactor code/symbolic constants
refactor code slightly, adding symbolic constants and functions, andusing macros where possible. This will also make following resetpatches easier.
No functional changes.
qemu/pci: reset device registers on bus reset
Reset BARs and a couple of other registers on bus reset, as per PCIspec.
floppy: move dma setup + drive connect to fdctrl_init_common()
isa-fdc is completely qdev-ified with this patch applied, allconfiguration uses properties.
sysbus-fdc needs dma_channel config fixed. There is only one user(mips_jazz) which uses dma channel 0. Can anyone knowing this...
qdev: don't crash on unset drive properties.
serial: convert isa to qdev
Everything using standard isa I/O ports and IRQ windup is considerdbeing an actual isa device. That are all serial_init() users exceptmips_mipssim() which seems to have a non-standard IRQ windup.
baud rate is fixed at 115200 now as no caller passed in something else....
qemu/qdev: type safety in reset handler
Add type safety to qdev reset handlers, by declaring them asDeviceState * rather than void *.
qemu/virtio: fix reset with device removal
virtio pci registers its own reset handler, but fails to unregister it,which will lead to crashes after device removal. Solve this problem byswitching to qdev reset handler, which is automatically unregistered....
scsi: hotplug windup
pci: hotplug windup
Create qdev infrastructure for pci hotplug. PCI bus implementationsmust register a handler for hotplug. Creating a new PCI device willautomagically hot-plug it in case the PCI bus in question supports this.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
pci: windup acpi-based hotplug
Switch over acpi-based PCI hotplug for pc over to the newqdev-based pci hotplugging.
drive cleanup fixes.
Changes: * drive_uninit() wants a DriveInfo now. * drive_uninit() also calls bdrv_delete(), so callers don't need to do that. * drive_uninit() calls are moved over to the ->exit() callbacks, destroy_bdrvs() is zapped. * setting bdrv->private is not needed any more as the...
refactor drive_hot_add
move pci device lookup into the "case IF_SCSI" section, so wecan do something else for other interface types.
allow if=none for drive_add
Allow adding unconnected host drives by specifying if=none like it ispossible with -drive. They can be put in use with drive attributes,like this:
drive_add dummy if=none,id=mydisk,file=/some/disk.img device_add virtio-blk-pci,drive=mydisk...
store a pointer to QemuOpts in DeviceState, release it when zapping a device.
floppy: add drive properties.
qdev: device free fixups.
Two bug fixes: * When freeing a device we unregister even stuff we didn't register in the first place because the ->init() callback failed. * When freeing a device with child busses attached, we fail to zap the child bus (and the devices attached to it)....
Add exit callback to DeviceInfo.
This adds a exit callback for device destruction to DeviceInfo, sowe can hook cleanups into qdev device destruction.
Followup patches will put that into use.
Implement scsi device destruction
pci: use qdev for device destruction.
pci_unregister_device is static now and hooked into Devicestate->exit.qdev_free(pci_device) works now.
pci: move unregister from PCIDevice to PCIDeviceInfo
One more cleanup while being at it ;)
usb: hook unplug into qdev, cleanups + fixes.
Hook into DeviceInfo->exit().
handle_destroy() must not free the state struct, this is handledby the new usb_qdev_exit() function now.
qdev_free(usb_device) works now.
Fix usb hub to qdev_free() all connected devices on unplug....
qdev hotplug: infrastructure and monitor commands.
Adds device_add and device_del commands. device_add accepts acceptsthe same syntax like the -device command line switch. device_delexpects a device id. So you should tag your devices with ids if you...
usb: hotplug windup
switch ide bus to inplace allocation.
support inplace allocation for pci bus, split irq init.
convert pci bridge to qdev
piix_pci: kill PIIX3IrqState
parallel: convert isa to qdev
switch scsi bus to inplace allocation.
switch usb bus to inplace allocation.
Enable host-clock-based RTC
Switch RTC emulations to the new host_clock instead of vm_clock bydefault. This has the advantage that the emulated RTC will followautomatically the host time while it might be tuned via NTP. vm_clockcan still be selected by passing '-rtc clock=vm' on the command line....
allow qdev busses allocations be inplace
musicpal: Add VMState support
Register all relevant fields of Musicpal device states with the VMStateframework. This involves a few type changes of state variables.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix exit on 'pci_add' Monitor command
If the user issues one of the following commands to the Monitor:
pci_add pci_addr=auto nic model=Nonepci_add pci_addr=auto nic model=?
QEMU will exit, because the function used to perform sanitychecks (qemu_check_nic_model_list()) exits on error....
vmstate: Add suppot for field_exist() test
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
musicpal: Catch null TX qeueues
They likely represent invalid queues that should be skipped. We alreadydo this for RX queues. Wish I had a spec...
Credits go to malc for analyzing the issue and suggesting this fix.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>...
musicpal: Rework GPIO input events
The qdev_gpio conversion of 343ec8e caused come polarity mismatch of keyevent pins and left an overly complex solution behind. Take this chanceand refactor the GPIO input system of the Musicpal, moving it closer toreality:...
musicpal: Clean up typecasts
musicpal: Coding style fixes
musicpal: True reset support for GPIO
musicpal: True reset support for audio device
musicpal: Make PIT emulation more robust
Stop the periodic timers of the PIT on reset, disabling via the controlregister and invalid parameters.
Add *TL functions to vmstate
vmstate: port twl92230 device
Just don't look. struct tm members are ints' and they are sent as uint16_t.VMState code complains as it should. Have to create hacky int32_as_uint16type. Don't ever think about copying it
Signed-off-by: Juan Quintela <quintela@redhat.com>...
vmstate: add support for arrays of pointers
We need this to send arrays of timers
lm832x: make fields to have the same types that they are saved/loaded
They were saved as uint8_t already. To make things simpler, I justreg == -1 used to indicate an error, I create LM832x_GENERAL_ERRORwith vale 0xff to represet it
vmstate: port lm832x device
vmstate: remove i2c_slave_load/save
All its users moved to vmstate
vmstate: add uint8 array
vmstate: create VMSTATE_I2C_SLAVE
vmstate: port wm8750 device
vmstate: port max7310 device
vmstate: create VMSTATE_STRUCT_POINTER
vmstate: port pxa2xx_i2c device
vmstate: port ssd0303 device
vmstate: create VMSTATE_INT16_ARRAY
tmp105: change len and alorm to uint8_t
They were using only with very small integers, and they are sent/read asbytes. They can't become negative as far as I can see
vmstate: port tmp105 device
twl92230: change pwrbtn_state to uint8_t
its value is always the level of an interrupt, 0 or 1
vmstate: remove const from pre_save() functions
vmstate: remove ps2_kbd_load_old()
Now that we have version_id on post_load() we don't need the old loadfunction
vmstate: Add support for sending partial arrays
This one is needed for changees happening on fdc. It allows you to sendarrays of structs whose size we want to send it is another field with typeuint8_t. (If you have been able to read the whole sentence without...
qdev: Add support for uint8_t
i2c: addresses are load/save as uint8_t values, change types to reflect this
vmstate: port i2c_bus device
vmstate: port i2c_slave device
cirrus_vga: also assign gr0/1 when writting shadow_gr0/1
This is a regression/bug caused by previous vga_cleanup. This fixesUbuntu installer reported by: Pierre Riteau
vga: move back dirty_log functions to vga.c
They are needed there on qemu-kvm.
vmstate: remove const for put operations
In a later patch, we introduce pre_save() and post_save() functions.The whole point of that operation is to change things in the state.Without this patch, we have to remove the const qualifier in eachuse with a cast...
vmstate: add version_id argument to post_load
Revert "eepro100: Remove unused device status entries"
This reverts commit 3031efabd0bb744126a53f32c5426580b5d394d5.
eepro100: Add more i825xx devices
The new devices added here are still not functional -partially because some patches are still missing,partially because I cannot test them. Neverthelessthey belong to the same family and will be supportedby this driver some day....
eepro100: Remove unused device status entries
A lot of entries are unused (they were added by copy + pastefrom other drivers during development of eepro100.c).
Removing them from nic_save, nic_load makes anyold saved status incompatible, so a new version...
hw/omap_dma: add matching {} in if 0
MULTI_REQ is never defined, so it doesn't matter much, but sincewe have an if statement there, let's add {} to clarify what itshould do if it's uncommented, and indent the code properly.
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...