apic: avoid passing CPUState from CPU code
Pass only APICState when accessing APIC from CPU code.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
apic: avoid passing CPUState from devices
Pass only APICState from pc.c.
ioapic: convert to qdev
Convert to qdev.
ioapic: unexport ioapic_set_irq
There's no need to use ioapic_set_irq() outside of ioapic.c, somake it static.
GDB exit status for semihosting
Report exit status to GDB when a semihosted application exits.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Strace mprotect flags.
Teach strace code about linux specific mprotect flags.
Usermode exec-stack fix
When loading a shared library that requires an executable stack,glibc uses the mprotext PROT_GROWSDOWN flag to achieve this.We don't support PROT_GROWSDOWN.Add a special case to handle changing the stack permissions in this way....
cris: Move sign extension.
Move it in preparation for further changes.No functional change.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@axis.com>
cris: Centralize fetching
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
tcg: Optionally sign-extend 32-bit arguments for 64-bit hosts.
Some hosts (amd64, ia64) have an ABI that ignores the high bitsof the 64-bit register when passing 32-bit arguments. Othersrequire the value to be properly sign-extended for the type.I.e. "int32_t" must be sign-extended and "uint32_t" must be...
cris: Make the CRISv32 insn decoders return signed int.
Prepare to return error from the individual decoders.
Fix comparison which always returned false
Comparing an 8 bit value with ~0 does not work as expected.Replace ~0 by UINT8_MAX in comparison and also in assignment(and fix coding style, too).
Cc: Gleb Natapov <gleb@redhat.com>Cc: Anthony Liguori <aliguori@us.ibm.com>...
xen: Fix build error due to missing include
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: fix a warning and possible truncation
Fix a warning from OpenBSD gcc (3.3.5 (propolice)):/src/qemu/block.c: In function `bdrv_info_stats_bs':/src/qemu/block.c:1548: warning: long long int format, long unsignedint arg (arg 6)
There may be also truncation effects....
cow: use pread/pwrite
Use pread/pwrite instead of lseek + read/write in preparation of using theqemu block API.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
cow: stop using mmap
We don't have an equivalent to mmap in the qemu block API, so read andwrite the bitmap directly. At least in the dumb implementation addedin this patch this is a lot less efficient, but it means cow can alsowork on windows, and over nbd or curl. And it fixes qemu-iotests testcase...
cow: use qemu block API
Use bdrv_pwrite to access the backing device instead of pread, andconvert the driver to implementing the bdrv_open method which givesit an already opened BlockDriverState for the underlying device.
Signed-off-by: Christoph Hellwig <hch@lst.de>...
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.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Decouple block device "commit all" from DriveInfo
do_commit() and mux_proc_byte() iterate over the list of drivesdefined with drive_init(). This misses host block devices defined byother means. Such means don't exist now, but will be introduced later...
monitor: Make "commit FOO" complain when FOO doesn't exist
block: New bdrv_next()
This is a more flexible alternative to bdrv_iterate().
block: Decouple savevm from DriveInfo
We find snapshots by iterating over the list of drives defined withdrive_init(). This misses host block devices defined by other means.Such means don't exist now, but will be introduced later in thisseries.
Iterate over all host block devices instead, with bdrv_next()....
blockdev: Give drives internal linkage
This is the list of drives defined with drive_init(). Hide it, so itdoesn't get abused.
Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE
Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE in hw/fdc.c
Per https://bugs.launchpad.net/qemu/+bug/424453 the correct valuesfor FD_CMD_SAVE is 0x2e and FD_CMD_RESTORE is 0x4e. Verified against...
vpc: Read/write multiple sectors at once
This changes the vpc block driver (for VHD) to read/write multiple sectors atonce instead of doing a request for each single sector.
Before this, running qemu-iotests for VPC took ages, now it's actually quitereasonable to run it always (down from ~1 hour to 40 seconds for me)....
qcow2: Allow get_refcount to return errors
get_refcount might need to load a refcount block from disk, so errors mayhappen. Return the error code instead of assuming a refcount of 1 and changethe callers to respect error return values.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qcow2: Allow alloc_clusters_noref to return errors
Currently it would consider blocks for which get_refcount fails used. However,it's unlikely that get_refcount would succeed for the next cluster, so it's notreally helpful. Return an error instead.
qcow2: Return real error code in load_refcount_block
This fixes load_refcount_block which completely ignored the return value ofwrite_refcount_block and always returned -EIO for bdrv_pwrite failure.
savevm: Really verify if a drive supports snapshots
Both bdrv_can_snapshot() and bdrv_has_snapshot() does not work as advertized.
First issue: Their names implies different porpouses, but they do the same thingand have exactly the same code. Maybe copied and pasted and forgotten?...
Fix regression for "-drive file="
Empty file used to create an empty drive (no media). Since commit9dfd7c7a, it's an error: "qemu: could not open disk image : No suchfile or directory". Older versions of libvirt can choke on this.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
qcow2: Restore L1 entry on l2_allocate failure
If writing the L1 table to disk failed, we need to restore its old content inmemory to avoid inconsistencies.
Reported-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
migration: use qemu_free() instead of free().
Although there is no difference, other migration related code useqemu_free(), and it should be better to be consistent.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration-tcp: call migrate_fd_error() instead of close() and free().
This patch fixes the following error report. When changingmigration-tcp.c to call migrate_fd_error() instead of close() andfree() by itself, monitor is resumed, and returns allocated mig_state...
make qemu_thread_create block all signals
All signals will thus be routed through the IO thread.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
un-register kbd driver in case of USB kbd unplug.
If a USB keyboard is unplugged, the keyboard eventhandler is neverremoved, and events will continue to be passed through to the device,causing crashes or memory corruption.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>...
virtio-blk: stop tracking old_bs
There is a 1:1 relation between VirtIOBlock and BlockDriverState instances,no need to track it because it won't change.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-blk: simplify multiwrite calling conventions
Pass the MultiReqBuffer structure down all the way to the I/O submissioninstead of takin it apart. Also mark num_writes unsigned as it can'tgo negative, and take the check for any pending I/O requests into the...
Clarify error message when a PCI slot is already in use (v2)
When mistakenly configuring two devices in the same PCI slot,QEMU gives a not entirely obvious message about a 'devfn' beingin use:
$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3...
qdev: Revert the hack to let -net nic and pci_add set qdev ID
Setting the ID in pci_nic_init() is a blatant violation of theDeviceState abstraction. Which even carries a comment advisingagainst this:
/* This structure should not be accessed directly. We declare it here...
qemu-option: Reject anti-social IDs
Restrict IDs to letters, digits, '-', '.', '_', starting with aletter.
This takes care of '/' in qdev IDs breaking qbus_find().
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
acpi_piix4: save gpe and pci hotplug slot status
PCI hotplug currently doesn't work after a migration becausewe don't migrate the enable bits of the GPE state. Pull hotplugstructs into vmstate.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
Add exit notifiers.
Hook up any cleanup work which needs to be done here. Advantages overusing atexit(3):
(1) You get passed in a pointer to the notifier. If you embed that into your state struct you can use container_of() to get get your state info....
etrax-ser: Support the uart rx fifo.
Add support for the rx fifo to speed up bulk transfers.
qemu-option: Fix uninitialized value in append_option_parameter
When dest is NULL, i.e. a new copy of the list is created, we don't get aproperly terminated list after the realloc. Initialize it as an empty list.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
hpet: Init capability register only once
The capability register is read-only from guest POV, so we do not needto update it on reset.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pass info about hpets to seabios.]
Currently HPET ACPI table is created regardless of whether qemu actuallycreated hpet device. This may confuse some guests that don't check thathpet is functional before using it. Solve this by passing info abouthpets in qemu to seabios via fw config interface. Additional benefit is...
Make netdev_del delete the netdev even when it's in use
To hot-unplug guest and host part of a network device, you do:
device_del NIC-ID netdev_del NETDEV-ID
For PCI devices, device_del merely tells ACPI to unplug the device.The device goes away for real only after the guest processed the ACPI...
ram_blocks: Convert to a QLIST
This makes the RAM block list easier to manipulate. Also incorporaterelevant variables into the RAMList struct.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Acked-by: Chris Wright <chrisw@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove unused DEBUG defines from hw/msix.c
Remove unused DEBUG defines from hw/msix.c to avoid having anythingdefine the word DEBUG without any additions such as MSIX_DEBUG.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c
Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c to makeit possible to build QEMU with -DDEBUG
Merge remote branch 'kwolf/for-anthony' into staging
Conflicts: hw/pc.c
Merge remote branch 'qmp/for-anthony' into staging
OHCI address decoding fix
Ignore high address bits when PCI memory window is not mapped on a pageboundary.
Move stdbool.h
Move inclusion of stdbool.h to common header files, instead of includingin an ad-hoc manner.
monitor/QMP: Drop info hpet / query-hpet
This command was of minimal use before, now it is useless as the hpetbecome a qdev device and is thus easily discoverable. We shoulddefinitely not set query-hpet in QMP's stone, and there is also no goodreason to keep it for the interactive monitor....
vmstate: Add VMSTATE_STRUCT_VARRAY_UINT8
Required for hpet.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hpet: Make number of timers configurable
One HPET block supports up to 32 timers. Allow to instantiate more thanthe recommended and implemented minimum of 3. The number is configuredvia the qdev property "timers". It is also saved/restored so that itneed not match between migration peers....
hpet: Add MSI support
This implements the HPET capability of routing IRQs to the front-sidebus, aka MSI support. This feature can be enabled via the qdev property"msi" and is off by default.
Note that switching it on can cause guests (at least Linux) to use the...
hpet/rtc: Rework RTC IRQ replacement by HPET
Allow the intercept the RTC IRQ for the HPET legacy mode. Then pushrouting to IRQ8 completely into the HPET. This allows to turnhpet_in_legacy_mode() into a private function. Furthermore, this stopsthe RTC from clearing IRQ8 even if the HPET is in control....
hpet: Drop static state
Instead of keeping a static reference around, pass the state tohpet_enabled and hpet_get_ticks. All callers now have it at hand. Willonce allow to instantiate the HPET more than a single time.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
hpet: Add support for level-triggered interrupts
By implementing this feature we can also remove a nasty way to kill qemu(by trying to enable level-triggered hpet interrupts).
hpet: Silence warning on write to running main counter
Setting the main counter while the HPET is enabled may not be a goodidea of the guest, but it is supported and should, thus, not spam thehost console with warnings.
hpet: Move static timer field initialization
Properly initialize HPETTimer::tn and HPETTimer::state once duringhpet_init instead of (re-)writing them on every reset.
hpet: Convert to qdev
Register the HPET as a sysbus device and create it that way. As it canroute its IRQs to any ISA IRQ, we need to connect it to all 24 of them.Once converted to qdev, we can move reset handler and vmstateregistration into its hands as well....
hpet: Start/stop timer when HPET_TN_ENABLE is modified
We have to update the qemu timer when the per-timer enable bit istoggled, just like for HPET_CFG_ENABLE changes.
hpet: Catch out-of-bounds timer access
Also prevent out-of-bounds write access to the timers but don't spam thehost console if it triggers.
hpet: Coding style cleanups and some refactorings
This moves the private HPET structures into the C module, simplifiessome helper functions and fixes most coding style issues (biggest chunkwas improper switch-case indention). No functional changes.
configure: Fix evaluation of config-host.mak in create_config
Only match on true dir variable assignments, avoid generating garbagedue to the "# Configured with: ..." line which may contain "*dir=" aswell.
tcg-s390: correctly detect s390 with a 64-bit kernel
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Compile OS specific files only once for all targets
OS specific files are not target dependent, so they can be compiledonce for all targets.
Rename qemu-options.h to qemu-options.def
Rename qemu-options.h to qemu-options.def as it is not a header filefor general use and this leaves space for a proper qemu-options.h
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>...
Introduce OS specific cmdline argument handling and move SMB arg to os-posix.c
Introduce OS specific cmdline argument handling by callingos_parse_cmd_args() at the end of switch() statement. Move optionenum to qemu-options.h and have it included from os-posix.c and...
Move runas handling from vl.c to OS specific files.
Move code to handle runas, ie. change of user id of QEMU processto OS specific files and provide dummy stub for Win32.
Move chroot handling to OS specific files.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>Acked-by: Richard Henderson <rth@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Move daemonize handling to OS specific files
Move daemonize handling from vl.c to OS specific files. Provide dummystubs for Win32.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>Acked-by: Richard Henderson <rth@redhat.com>...
Make os_change_process_uid and os_change_root os-posix.c local
os_change_process_uid() and os_change_root() are now only calledfrom os-posix.c, so no need to keep win32 stubs for them.
Move line-buffering setup to OS specific files.
Move set_proc_name() to OS specific files.
Move handling to change process name to POSIX specific filesplus add a better error message to cover the case where thefeature isn't supported.
Create qemu-os-win32.h and move WIN32 specific declarations there
Create qemu-os-win32.h for WIN32 specific declarations. Move pollinghandling declaration into this file from sysemu.h
Introduce os-win32.c and move polling functions from vl.c
This introduces os-win32.c. It is meant to carry win32 specificfunctions thata are not relevant for all of QEMU as well as win32versions of various pieces like signal handling etc.
Move win32 polling handler helper functions from vl.c to os-win32.c...
vl.c: Move host_main_loop_wait() to OS specific files.
Move host_main_loop_wait() to OS specific files. Createqemu-os-posix.h and provide empty inline for the POSIX case.
Introduce os-posix.c and create os_setup_signal_handling()
Introcuce os-posix.c and move posix specific signal handlingthere.
Move win32 early signal handling setup to os_setup_signal_handling()
Rename os_setup_signal_handling() to os_setup_early_signal_handling()
Move main signal handler setup to os specificfiles.
Move main signal handler setup to os specific files.
Move find_datadir to OS specific files.
This moves the win32 and POSIX versions of find_datadir() to OSspecific files, and removes some #ifdef clutter from vl.c
vl.c: Remove double include of netinet/in.h for Solaris
vl.c: netinet/in.h is already included once above for the
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Acked-by: Andreas Faerber <afaerber@opensolaris.org>Acked-by: Juan Quintela <quintela@redhat.com>...
NEON vldN optimization
When combining multiple values as part of a NEON array load, do explcitshift/or rather than using gen_bfi. This voids redundant maskoperations.
hxtool: Fix line number reporting on SQMP/EQMP errors
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
json-lexer: Initialize 'x' and 'y'
The 'lexer' variable is passed by the caller, it can contain anything(eg. garbage).
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
json-lexer: Handle missing escapes
The JSON escape sequence "\/" and "\\" are valid and should behandled.
qjson: Handle "\f"
It's valid JSON and should be handled.
check-qjson: Add more escape tests
While there make the fail_unless() calls print error messages.
IMPORTANT: The test for "\/" is failing, don't know why.
json-lexer: Drop 'buf'
QString supports adding a single char, 'buf' is unneeded.
json-streamer: Don't use qdict_put_obj()
It's not needed, use qobject_put() instead and get a cleaner code.
add some tests for invalid JSON
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
implement optional lookahead in json lexer
Not requiring one extra character when lookahead is not necessaryensures that clients behave properly even if they, for example,send QMP requests without a trailing newline.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
remove unnecessary lookaheads
tcg: fix DEF macro after commit c61aaf7a388c4ad95d8b546fdb9267dc01183317
tcg-s390: Adjust compilation flags.
Force -m31/-m64 based on s390/s390x target.
Force -march=z990. The TCG backend will always require thelong-displacement facility, so the compiler may as well makeuse of that as well.
Signed-off-by: Richard Henderson <rth@twiddle.net>...