cirrus: simplify mmio BAR access functions
Make use of the memory API's ability to satisfy multi-byte accesses viamultiple single-byte accesses.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: add API to get a BAR's mapped address
Some (hacky) devices that have a back-channel to read thisaddress back outside the normal configuration mechanisms, suchas VMware svga.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Avi Kivity <avi@redhat.com>...
vmsvga: don't remember pci BAR address in callback any more
We're going to remove the callback, so we can't use it to save theaddress. Use the pci API instead.
Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>...
vga: convert vga and its derivatives to the memory API
Convert all vga memory to the memory API. Note we need to fall back toget_system_memory(), since the various buses don't pass the vga windowas a memory region.
We no longer need to sync the dirty bitmap of the cirrus mapped memory...
qdev: Eliminate duplicate reset
qbus_reset_all_fn was registered twice, so a lot of device resetfunctions were also called twice when QEMU started.Which was introduced by 80376c3fc2c38fdd45354e4b0eb45031f35587edThis patch fixes it by making the main_system_bus creation not register...
Check fread() results to avoid gcc 4.6 warnings
When compiling with gcc 4.6, some code in fw_cfg.c complains that fop_retis assigned but not used (which is true). However, it looks like themeaningless assignments to fop_ret were done to suppress other gcc warnings...
Merge remote-tracking branch 'mst/for_anthony' into staging
Merge remote-tracking branch 'spice/spice.v40' into staging
Merge remote-tracking branch 'kraxel/usb.22' into staging
Merge remote-tracking branch 'kwolf/for-anthony' into staging
virtio-balloon: Add exit handler, fix memleaks
Add an exit handler that will free up RAM after a virtio-balloon deviceis unplugged.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>Acked-by: Michael S. Tsirkin <mst@redhat.com>
virtio-balloon: Unregister savevm section on device unplug
Migrating after unplugging a virtio-balloon device resulted in an errormessage on the destination:
Unknown savevm section or instance '0000:00:04.0/virtio-balloon' 0load of migration failed
Fix this by unregistering the section on device unplug....
virtio-balloon: Separate status handling into separate function
Separate out the code to retrieve balloon info from the code that setsballoon values.
This will be used to separate the two callbacks from balloon.c and helpcope with 'balloon 0' on the monitor. Currently, 'balloon 0' causes a...
balloon: Separate out stat and balloon handling
Passing on '0' as ballooning target to indicate retrieval of stats isbad API. It also makes 'balloon 0' in the monitor cause a segfault.Have two different functions handle the different functionality instead....
virtio-balloon: Fix header comment; add Copyright
Signed-off-by: Amit Shah <amit.shah@redhat.com>
virtio-balloon: Check if balloon registration failed
Multiple balloon registrations are not allowed; check if theregistration with the qemu balloon api succeeded. If not, fail thedevice init.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>...
usb-hid: create & use HIDState
First step in separating out the HID emulation code from usb-hid, so itcan be reused without creating a dummy usb device like bluetooth does.
This creates a HIDState struct, moves the non-usbish fields fromUSBHIDStruct there. Renames non-usbish structs, defines and functions...
usb-hid: add event callback
Add callback for event notification, which allows to un-usbify morefunctions. Also split separate hid_* functions for reset and release.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-hid: add hid_has_events()
Add hid_has_events function, use it to figure whenever there are pendingevents instead of checking and updating USBHIDState->changed.
Setting ->changed to 1 on init is removed, that should have absolutelyno effect as the initial state of ->idle is 0 so we report hid state...
usb-hid: split hid code to hw/hid.[ch]
Almost pure code motion. Unstatic hid interface functions and addthem to the header file. Some renames. Some code style cleanups.
hid: move idle+protocol from usb-hid to hid too.
bluetooth: kill dummy usb device, use hid code directly.
usb-storage: iovec support
Add full iovec support to usb-storage.
uhci: remove buffer
Map guest memory and pass on a direct pointer instead of copyingthe bits to a indirect buffer.
ehci: iovec support, remove buffer
Map guest memory and pass on a direct pointer instead of copyingthe bits to a indirect buffer. EHCI transfer descriptors canreference multiple (physical guest) pages so we'll actually startseeing usb packets wich carry iovec with more than one element....
usb-serial: iovec support
Add full support for iovecs to usb-serial.
usb: use iovecs in USBPacket
Zap data pointer from USBPacket, add a QEMUIOVector instead.Add a bunch of helper functions to manage USBPacket data.Switch over users to the new interface.
Note that USBPacket->len was used for two purposes: First topass in the buffer size and second to return the number of...
lm32: softusb: claim to support full speed
The QEMU keyboard and mouse reports themselves as full speed devices,though they are actually low speed devices. Until this is fixed, claim thatwe are supporting full speed devices.
Acked-by: Gerd Hoffmann <kraxel@redhat.com>...
vhost: remove an incorrect assert
The 'to' can go negative when the first region gets removed(it gets incremented by to 0 immediately afterward), whichmakes the assertion fail. Nothing breaks ifto < 0 here so just remove the assert.
Tested-by: David Ahern <daahern@cisco.com>...
qxl: add QXL_IO_FLUSH_{SURFACES,RELEASE} for guest S3&S4 support
Add two new IOs. QXL_IO_FLUSH_SURFACES - equivalent to update area for all surfaces, used to reduce vmexits from NumSurfaces to 1 on guest S3, S4 and resolution change (windows driver implementation is such that this is done on each of those occasions)....
qxl: bump pci rev
Inform guest drivers about the new features I/O commands we havenow (async commands, S3 support) if building with newer spice, i.e.if SPICE_INTERFACE_QXL_MINOR >= 1.
sneaked in some 81+ column line spliting.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
qxl: async io support using new spice api
Some of the QXL port i/o commands are waiting for the spice server tocomplete certain actions. Add async versions for these commands, so wedon't block the vcpu while the spice server processses the command.Instead the qxl device will raise an IRQ when done....
spice: add worker wrapper functions.
Add wrapper functions for all spice worker calls.
spice: add qemu_spice_display_init_common
Factor out SimpleSpiceDisplay initialization intoqemu_spice_display_init_common() and call it fromboth qxl.c (for vga mode) and spice-display.c
spice/qxl: move worker wrappers
Move the wrapper functions which are used by qxl only to qxl.c.Rename them from qemu_spice_* to qxl_spice_*. Also pass in aqxl state pointer instead of a SimpleSpiceDisplay pointer.
qxl: fix surface tracking & locking
Surface tracking needs proper locking since it is used from vcpu and spiceworker threads, add it. Also reset the surface counter when zapping allsurfaces.
qxl: add io_port_to_string
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
qxl: error handling fixes and cleanups.
Add qxl_guest_bug() function which is supposed to be called in casesanity checks of guest requests fail. It raises an error IRQ andlogs a message in case guest debugging is enabled.
Make PANIC_ON() abort instead of exit. That macro should be used...
qxl: make qxl_guest_bug take variable arguments
qxl: only disallow specific io's in vga mode
Since the driver is still in operation even after moving to UNDEFINED, i.e.by destroying primary in any way.
scsi-disk: Codingstyle fixes
Replace tabs with spaces.
Signed-off-by: Hannes Reinecke <hare@suse.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
scsi: Remove references to SET_WINDOW
SET_WINDOW command is vendor-specific only.So we shouldn't try to emulate it.
scsi: Remove REZERO_UNIT emulation
REZERO_UNIT command is obsolete. Remove support for it.
scsi: Sanitize command definitions
Sanitize SCSI command definitions.Add _10 suffix to READ_CAPACITY, WRITE_VERIFY, VERIFY, READ_LONG,WRITE_LONG, and WRITE_SAME.Add new command definitions for LOCATE_10, UNMAP, VARLENGTH_CDB,WRITE_FILEMARKS_16, EXTENDED_COPY, ATA_PASSTHROUGH, ACCESS_CONTROL_IN,...
scsi-disk: Remove 'drive_kind'
Instead of using its own definitions scsi-disk shouldbe using the device type of the parent device.
exec.h cleanup
Move softmmu_exec.h include directives from target-*/exec.h totarget-*/op_helper.c. Move also various other stuff only used inop_helper.c there.
Define global env in dyngen-exec.h.
For i386, move wrappers for segment and FPU helpers from user-exec.c...
revamp acpitable parsing and allow to specify complete (headerful) table
This patch almost rewrites acpi_table_add() function(but still leaves it using old get_param_value() interface).The result is that it's now possible to specify whole table(together with a header) in an external file, instead of just...
sd: do not add one sector to the disk size
This leads to random off-by-one error.When the size of the SD is exactly 1GB, the emulation was returning awrong SDHC CSD descriptor.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
usb-hid: Fix 0/0 position for Windows in tablet mode
For unknown reasons, Windows drivers (tested with XP and Win7) ignoreusb-tablet events that move the pointer to 0/0. So always report 0/0 as1/0.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Add support for Zipit Z2 machine
Zipit Z2 is small PXA270 based handheld.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
onenand: Add missing brace.
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
hw/onenand: program actions can only clear bits
The program actions onenand_prog_main() and onenand_prog_spare()can only set bits.
This implies a rewrite of onenand_erase() to not use the programfunctions, since erase does need to set bits.
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>...
onenand: Handle various ID fields separately
Handle the manufacturer, device and version IDs separately rather thansmooshing them all together into a single uint32_t. Note that the IDregisters are actually 16 bit, even though typically the top bits are 0...
onenand: Pass BlockDriverState to init function
Pass the BlockDriverState to the onenand init function so it doesn'tneed to look up the drive itself.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
hw/nand: qdevify
Qdevify the NAND device.
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>[Riku Voipio: Fixes and restructuring patchset]Signed-off-by: Riku Voipio <riku.voipio@iki.fi>[Peter Maydell: More fixes and cleanups for upstream submission]...
hw/nand: Writing to NAND can only clear bits
Writing to a NAND device cannot set bits, it can only clear them;implement this rather than simply copying the data.
hw/nand: Support multiple reads following READ STATUS
After receiving READ STATUS command all subsequent IO reads should returnthe status register value until another command is issued.
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>[Riku Voipio: Fixes and restructuring patchset]...
hw/nand: Support devices wider than 8 bits
Support NAND devices which are wider than 8 bits.
nand: Bump vmstate version after changing structure.
hw/nand: Support large NAND devices
Add support for NAND devices of over 1Gb.
hw/nand: Pass block device state to init function
Pass the BlockDeviceState to the nand_init() function ratherthan having it look it up via drive_get() itself.
lm832x: Take DeviceState pointer in lm832x_key_event()
Since lm832x has been qdev'ified, its users will generallyhave a DeviceState pointer rather than an i2c_slave pointer,so adjust lm832x_key_event's prototype to suit.
This allows the n810 (its only user) to actually pass a correct...
hw/omap_gpio.c: Convert to qdev
Convert the OMAP GPIO module to qdev.
hw/omap_clk: Add the clock for the OMAP2430-specific fifth GPIO module
The OMAP2430 has a fifth GPIO module which earlier OMAP2 models lack; addthe clock definition for it.
hw/omap_l4.c: Add helper function omap_l4_region_base
Add helper function omap_l4_region_base() to return the base addressof a particular region of an L4 target agent.
Merge remote-tracking branch 'agraf/xen-next' into staging
Merge remote-tracking branch 'kraxel/migration.2' into staging
multiboot: Fix bss segment support
Multiboot images can specify a bss segment. The boot loader must clearthe memory of the bss and ensure that no modules or structures areallocated inside it. Several fields are provided in the Multibootheader that were previously not used properly. The header is now used...
Fix last sector write on sd card
When writing the last sector of an SD card using WRITE_MULTIPLE_BLOCKQEmu throws an error saying that we've run off the end, and leavesitself in the wrong state.
Tested on ARM Vexpress model.
Signed-off-by: Dr. David Alan Gilbert <david.gilbert@linaro.org>...
pc: grab system_memory
While eventually this should come from the machine initialization function,take a short cut to avoid converting all machines now.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pc: convert pc_memory_init() to memory API
pc: move global memory map out of pc_init1() and into its callers
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: pass address space to pci bus when created
This is now done sloppily, via get_system_memory(). Eventually callerswill be converted to stop using that.
pci: add MemoryRegion based BAR management API
Allow registering a BAR using a MemoryRegion. Once all users are converted,pci_register_bar() and pci_register_bar_simple() will be removed.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>...
sysbus: add MemoryRegion based memory management API
Allow registering sysbus device memory using a MemoryRegion. Once all usersare converted, sysbus_init_mmio() and sysbus_init_mmio_cb() will be removed.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>...
usb-ohci: convert to MemoryRegion
showing a splash picture when start
Added options to let qemu transfer two configuration files to bios:"bootsplash.bmp" and "etc/boot-menu-wait", which could be specified by command -boot splash=P,splash-time=TP is jpg/bmp file name or an absolute path, T have a max value of 0xffff, unit...
qdev: Reset hot-plugged devices
Device models rely on the core invoking their reset handlers after init.We do this in the cold-plug case, but so far we miss this step afterhot-plug.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pcie_host: verify mmcfg address range
For a conventional pci device behinda pcie-to-pci bridge, pci_host handlers get confused byan out of bounds access in the range [256, 4K).
Check for such an access and make it have no effect.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>...
virtio: Plug memleak by freeing vdev
virtio_common_init() allocates RAM for the vdev struct (and anyadditional memory, depending on the size passed to the function). Thismemory wasn't being freed until now.
Signed-off-by: Amit Shah <amit.shah@redhat.com>...
virtio-net: don't use vdev after virtio_cleanup
virtio_cleanup() will be changed by the following patch to remove theVirtIONet struct that gets allocated via virtio_common_init(). Ensurewe don't dereference the structure after calling the cleanup function....
virtio-blk: Fix memleak on exit
Calling virtio_cleanup() will free up memory allocated invirtio_common_init().
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio-pci: use generic logic for command access
In practice, guests don't generate config requeststhat cross a word boundary, so the logic todetect command word access is correct becausePCI_COMMAND is 0x4. But depending on this istricky, further, it will break with guests...
pci: Common overflow prevention
Introduce pci_config_read/write_common helpers to prevent passingaccesses down the callback chain that go beyond the config space limits.Adjust length assertions as they are no longer correct (cutting maygenerate valid 3 byte accesses)....
xen: implement unplug protocol in xen_platform
The unplug protocol is necessary to support PV drivers in the guest: thedrivers expect to be able to "unplug" emulated disks and nics beforeinitializing the Xen PV interfaces.It is responsibility of the guest to make sure that the unplug is done...
xen: make xen_enabled even more clever
When using xen_enabled() we're currently only checking if xen is enabledat all during the build. But what if you want to build multiple targetsout of which only one can potentially run xen code?
That means that for generic code we'll still have to fall back to the...
xen: Fix xen_enabled().
Use the "host" CONFIG_ define instead of the "target" one.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>Acked-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Alexander Graf <agraf@suse.de>
Fix chrdev return value conversion
6e1db57b2ac9025c2443c665a0d9e78748637b26 didn'tconvert brlapi or win32 chrdevs, breaking build for those.
Fix by converting the chrdevs.
Acked-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
mc146818rtc: Handle host clock resets
Make use of the new clock reset notifier to update the RTC wheneverrtc_clock is the host clock and that happens to jump backward. Thisavoids that the RTC stalls for the period the host clock was set back.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Correct spelling of licensed
Correct typos of "licenced" to "licensed".
Reviewed-by: Stefan Weil <weil@mail.berlios.de>Reviewed-by: Andreas F=E4rber <andreas.faerber@web.de>Signed-off-by: Matthew Fernandez <matthew.fernandez@gmail.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
notifier: Pass data argument to callback
This allows to pass additional information to the notifier callbackwhich is useful if sender and receiver do not share any other distinctdata structure.
Will be used first for the clock reset notifier.
ide: Turn properties any IDE device must have into bus properties
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-serial: Turn props any virtio-serial-bus device must have into bus props
usb-ccid: Drop unused CCIDCardInfo callback print()
virtio-serial: Clean up virtser_bus_dev_print() output
Old version looks like this in info qtree (last four lines):
dev: virtconsole, id "" dev-prop: is_console = 1 dev-prop: nr = 0 dev-prop: chardev = <null>...
vga: Fix type of lfb/map_addr/end.
These addresses have been passed through pci_to_cpu_addr,and thus need to be full target_phys_addr_t.
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Richard Henderson <rth@twiddle.net>Cc: Jan Kiszka <jan.kiszka@siemens.com>...
qemu-char: Print strerror message on failure
The only way for chardev drivers to communicate an error was to return a NULLpointer, which resulted in an error message that said that something wentwrong, but not why.
This patch changes the interface to return 0/-errno and updates...
report serial devices created with -device in the PIIX4 config space
Serial and parallel devices created with -device are not reported inthe PIIX4 configuration space, and are hence not picked up by the DSDT.This upsets Windows, which hides them altogether from the guest....
multiboot: Support commas in module parameters
Support commas in the parameter list of multiboot modules as well as for thekernel command line, by using double commas (via get_opt_value()).
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>Reviewed-by: Kevin Wolf <kwolf@redhat.com>...
net: Consistently use qemu_macaddr_default_if_unset
Drop the open-coded MAC assignment from net_init_nic and replace it withstandard qemu_macaddr_default_if_unset which is also used by qdev. Thatavoid creating colliding MACs when instantiating NICs via different...