sdk/emulator/qemu.git
14 years agomonitor: Accept input only byte-wise
Jan Kiszka [Fri, 4 Dec 2009 13:05:29 +0000 (14:05 +0100)]
monitor: Accept input only byte-wise

This allows to suspend command interpretation and execution
synchronously, e.g. during migration.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "kvm: x86: Save/restore exception_index"
Anthony Liguori [Fri, 18 Dec 2009 14:16:30 +0000 (08:16 -0600)]
Revert "kvm: x86: Save/restore exception_index"

This reverts commit ebbc8a3d8e76d0402f8a08c10c0f32e24715d41d.

As suggested by Jan Kiszka,

  "It was obsoleted by d1793b836f8f123b961c613de1bb1c0c185c84cc and now
   saves/restores a useless field."

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmware: increase cursor buffer size.
Dave Airlie [Thu, 17 Dec 2009 22:08:11 +0000 (08:08 +1000)]
vmware: increase cursor buffer size.

The cursor pixmap size we calculate later ends up being 4096 dwords
long by the looks of it. This boots an F12 LiveCD now.

Signed-off-by: Dave Airlie <airlied@linux.ie>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoVMware VGA: Only enable dirty log tracking when fifo is disabled
Anthony Liguori [Thu, 17 Dec 2009 22:08:10 +0000 (08:08 +1000)]
VMware VGA: Only enable dirty log tracking when fifo is disabled

This patch enables dirty log tracking whenever it's needed and disables it
when it is not.

We unconditionally enable dirty log tracking on reset, restart dirty log
tracking when PCI IO regions are remapped, and disable/enable it based on
commands from the guest.

Rebased-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix VMware VGA depth computation
Anthony Liguori [Thu, 17 Dec 2009 22:08:09 +0000 (08:08 +1000)]
Fix VMware VGA depth computation

VMware VGA requires that the depth presented to the guest is the same as the
DisplaySurface that it renders to.  This is because it performs a very simple
memcpy() to blit from one surface to another.

We currently hardcode a 24-bit depth.  The surface allocator for SDL may, and
usually will, allocate a surface with a different depth causing screen
corruption.

This changes the code to allocate the DisplaySurface before initializing the
device which allows the depth of the DisplaySurface to be used instead of
hardcoding something.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMake sure to enable dirty log tracking for VMware VGA
Anthony Liguori [Thu, 17 Dec 2009 22:08:08 +0000 (08:08 +1000)]
Make sure to enable dirty log tracking for VMware VGA

This is needed for VMware VGA to work properly under KVM.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMake sure to enable dirty tracking of VBE vram mapping
Anthony Liguori [Thu, 17 Dec 2009 22:08:07 +0000 (08:08 +1000)]
Make sure to enable dirty tracking of VBE vram mapping

Apparently, VBE maps the VGA vram to a fixed physical location.  KVM requires
that all mappings of the VGA vram have dirty tracking enabled on them.  Any
access to the VGA vram through the VBE mapping currently fails to result in
dirty page tracking updates causing a black screen.

This is the true root cause of VMware VGA not working correctly under KVM and
likely also an issue with some of the std-vga black screen issues too.

Cirrus does not enable VBE so it would not be a problem when using Cirrus.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Rebased-by: Dave Airlie <airlied@redhat.com>
14 years agovmware: setup PCI BAR 2 for FIFO as per vmware spec
Dave Airlie [Thu, 17 Dec 2009 22:08:06 +0000 (08:08 +1000)]
vmware: setup PCI BAR 2 for FIFO as per vmware spec

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: improve property error reporting.
Gerd Hoffmann [Wed, 16 Dec 2009 13:22:11 +0000 (14:22 +0100)]
qdev: improve property error reporting.

Add a error message in case we fail to parse a qdev property.

Also make qemu not abort() in case setting a global property can't be
set.  This used to be a clear programming error.  The introduction of
the -global switch changed that though, so better exit instead (after
printing the new error message).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofix vga names in default_list
Gerd Hoffmann [Wed, 16 Dec 2009 12:35:19 +0000 (13:35 +0100)]
fix vga names in default_list

Fix mismerge between 64465297 and 556cd098.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb-host: check mon before using it.
Gerd Hoffmann [Tue, 15 Dec 2009 10:43:02 +0000 (11:43 +0100)]
usb-host: check mon before using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb-net: use qdev for -usbdevice
Gerd Hoffmann [Tue, 15 Dec 2009 09:20:57 +0000 (10:20 +0100)]
usb-net: use qdev for -usbdevice

Rebased to master, adapted to device renaming by armbru,
no other changes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoCheck rom_load_all() return value.
Gerd Hoffmann [Mon, 14 Dec 2009 15:07:35 +0000 (16:07 +0100)]
Check rom_load_all() return value.

Check rom_load_all() return value.
Also don't make option rom loading failure fatal.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodefaults: update device_list[]
Gerd Hoffmann [Wed, 16 Dec 2009 13:25:40 +0000 (14:25 +0100)]
defaults: update device_list[]

Add isa-fdc (disables default_floppy).
Add ide-drive (disables default_cdrom).

Also walk the -global QemuOpts, so we'll catch
-global isa-fdc.drive{A,B}=<name> too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodefaults: split default_drive
Gerd Hoffmann [Wed, 16 Dec 2009 13:25:39 +0000 (14:25 +0100)]
defaults: split default_drive

Split default_drive into default_{floppy,cdrom,sdcard}.
Also add QEMUMachine flags to disable them per machine.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomonitor: Catch printing to non-existent monitor
Luiz Capitulino [Mon, 14 Dec 2009 20:53:24 +0000 (18:53 -0200)]
monitor: Catch printing to non-existent monitor

The monitor_vprintf() function now touches the 'mon' pointer
before calling monitor_puts(), this causes block migration
to segfault as its functions call monitor_printf() with a
NULL 'mon'.

To fix the problem this commit moves the 'mon' NULL check
from monitor_puts() to monitor_vprintf().

This can potentially hide bugs, but for some reason this has
been the behavior for a long time.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomonitor: Avoid readline functions in QMP
Luiz Capitulino [Mon, 14 Dec 2009 20:53:23 +0000 (18:53 -0200)]
monitor: Avoid readline functions in QMP

The monitor_read_command() function is readline specific
and should only be used when readline is available.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomonitor: do_balloon(): Check for errors
Luiz Capitulino [Mon, 14 Dec 2009 20:53:22 +0000 (18:53 -0200)]
monitor: do_balloon(): Check for errors

do_balloon() should check for ballooning availability as
do_info_balloon() does.

Noted by Daniel P. Berrange <berrange@redhat.com>.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomonitor: Use 'device' in eject
Luiz Capitulino [Mon, 14 Dec 2009 20:53:21 +0000 (18:53 -0200)]
monitor: Use 'device' in eject

Monitor's eject command uses 'filename' for the device name
argument, but 'device' is a better name.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQDict: Fix size update
Luiz Capitulino [Mon, 14 Dec 2009 20:53:20 +0000 (18:53 -0200)]
QDict: Fix size update

Key replacement should not update the dictionary's size.

This commit also adds a test for the bug.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Improve uni-north device names
Markus Armbruster [Mon, 14 Dec 2009 09:41:21 +0000 (10:41 +0100)]
qdev: Improve uni-north device names

Switch to the names suggested by Blue Swirl.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAvoid permanently disabled QEMU monitor when UNIX migration fails
Daniel P. Berrange [Fri, 11 Dec 2009 21:01:14 +0000 (21:01 +0000)]
Avoid permanently disabled QEMU monitor when UNIX migration fails

If a UNIX migration command is attempt to a UNIX socket which does
not exist, then the monitor is suspended, but never resumed. This
prevents any further use of the monitor

* migration-unix.c: Only call migrate_fd_monitor_suspend() once
  connected to the UNIX socket.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix loading of ELF multiboot kernels
Kevin Wolf [Fri, 4 Dec 2009 16:19:25 +0000 (17:19 +0100)]
Fix loading of ELF multiboot kernels

The multiboot implementation assumed that there is only one program header
(which contains the entry point) and that the entry point is at the start of
the code. This doesn't hold true generally and caused too little data to be
loaded.

Fix the loading code to pass the whole loaded data to the Multiboot Option ROM.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "Rename DriveInfo.onerror to on_write_error" (fix mismerge)
Kevin Wolf [Fri, 4 Dec 2009 11:06:32 +0000 (12:06 +0100)]
Revert "Rename DriveInfo.onerror to on_write_error" (fix mismerge)

Part of the first patch of the -drive rerror series has been merged once more
on top of the rest of the series. This effectively disables the rerror option
and always goes with the default value. Reverting the commit re-enables the
option.

This reverts commit fc072ec4df0996682dfbff6c735e2bbc0d93132f.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-io: Fix memory leak
Kevin Wolf [Wed, 18 Nov 2009 09:42:59 +0000 (10:42 +0100)]
qemu-io: Fix memory leak

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix thinko in linuxboot.S
Paolo Bonzini [Sun, 13 Dec 2009 10:36:40 +0000 (11:36 +0100)]
Fix thinko in linuxboot.S

The %gs segment that was used was not matching the comments.
I just moved the GDT descriptor on the stack instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotarget-i386: Fix evaluation of DR7 register
Jan Kiszka [Mon, 14 Dec 2009 11:26:27 +0000 (12:26 +0100)]
target-i386: Fix evaluation of DR7 register

hw_breakpoint_type and hw_breakpoint_len used the wrong index multiplier
to extract type and len.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokvm: x86: Use separate exception_injected CPUState field
Jan Kiszka [Mon, 14 Dec 2009 11:26:17 +0000 (12:26 +0100)]
kvm: x86: Use separate exception_injected CPUState field

Marcelo correctly remarked that there are usage conflicts between QEMU
core code and KVM /wrt exception_index. So spend a separate field and
also save/restore it properly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: hextile: do not generate ForegroundSpecified and SubrectsColoured tiles
Anthony Liguori [Mon, 14 Dec 2009 20:11:56 +0000 (14:11 -0600)]
vnc: hextile: do not generate ForegroundSpecified and SubrectsColoured tiles

This violates the RFB specification (section 6.6.4).  It happens to work with
most clients but it's still wrong.

Reported-by: Yaniv Kaul <ykaul@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "pci: interrupt disable bit support"
Anthony Liguori [Mon, 14 Dec 2009 17:36:53 +0000 (11:36 -0600)]
Revert "pci: interrupt disable bit support"

This reverts commit 0ea5709a32085f7d14901a09d12bd35f9b267607.

Per discussion with Michael Tsirkin, this is too risky for 0.12

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoS390: Bail out without KVM
Alexander Graf [Fri, 18 Dec 2009 15:29:04 +0000 (16:29 +0100)]
S390: Bail out without KVM

Currently only the S390 KVM target works. To keep users from accidently not
using KVM, let's not even initialize the machine when KVM is not used.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoS390: Don't tell guest we're updating config space
Alexander Graf [Thu, 17 Dec 2009 12:06:09 +0000 (13:06 +0100)]
S390: Don't tell guest we're updating config space

Currently we always set the "config space changed" bit to 1 when triggering
any virtio interrupt. While that worked in 2.6.27, newer kernels interpret
that value as "only the config space changed and nothing else happened".

Since we usually trigger interrupts to tell the guest that something did
happen, we just not tell it the config space changed for now until we
implement the correct callback for that.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoadd default virtcon initialization
Alexander Graf [Thu, 17 Dec 2009 12:06:08 +0000 (13:06 +0100)]
add default virtcon initialization

When going through the default devices, we don't initialize the virtio
console, unless we're doing -nographic.

I suppose that's just a leftover from the recent code restructuring, so
let's put it in.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoS390: Loop through virtio console devices
Alexander Graf [Thu, 17 Dec 2009 12:06:07 +0000 (13:06 +0100)]
S390: Loop through virtio console devices

We used to always create one single virtio console device. This breaks when
either zero of multiple virtio console devices are requested, so let's use
the same code as on x86.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-s390: Fail on unknown instructions
Alexander Graf [Thu, 17 Dec 2009 12:56:47 +0000 (13:56 +0100)]
target-s390: Fail on unknown instructions

We were being a bit too nice and didn't give the guest an invalid instruction
interrupt.

While that works, it's not exactly the fastest thing to do, since now the
guest doesn't know that we're not really implementing that instruction, so it
continues doing it.

We run into this with the set_page_unstable hint instruction. So let's bail out
in these cases.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoosdep: Fix runtime failure on older Linux kernels
Andre Przywara [Fri, 18 Dec 2009 09:45:07 +0000 (10:45 +0100)]
osdep: Fix runtime failure on older Linux kernels

If QEMU finds newer kernel header files on compilation time, it will use
advertised features like pipe2 or SOCK_CLOEXEC by just doing a compile test.
If later the executables are executed on an older kernel (<2.6.27,
like Xen Dom0 2.6.18), then QEMU will fail on opening sockets and creating
pipes and returns the rather unspecific "qemu_init_main_loop failed".
This patch fixes this by checking the return values of these calls
for EINVAL and ENOSYS and falling back to the older versions automatically.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix a make -j race
Juergen Lock [Mon, 14 Dec 2009 20:54:43 +0000 (21:54 +0100)]
Fix a make -j race

Make libuser.a depend on $(GENERATED_HEADERS) too so make -j won't start
building it before the headers exist.  (There may be more bugs like this
but at least this makes (g)make -j4 started from scratch on a quadcore
now always complete here again.)

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix float32_to_s vs zero exponent.
Richard Henderson [Mon, 14 Dec 2009 01:50:46 +0000 (17:50 -0800)]
target-alpha: Fix float32_to_s vs zero exponent.

There was a bug in float32_to_s that incorrectly mapped a zero exponent
to 0x38.  This meant 0.0f != 0.  At the same time, fix a generic type
punning bug in helper_memory_to_s and helper_s_to_memory.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix cvtlq.
Richard Henderson [Mon, 14 Dec 2009 01:48:55 +0000 (17:48 -0800)]
target-alpha: Fix cvtlq.

We were missing the 0xc0000000 mask, leading to incorrect results.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix generic ctz64.
Richard Henderson [Mon, 14 Dec 2009 01:47:25 +0000 (17:47 -0800)]
target-alpha: Fix generic ctz64.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement fp branch/cmov inline.
Richard Henderson [Mon, 14 Dec 2009 01:46:17 +0000 (17:46 -0800)]
target-alpha: Implement fp branch/cmov inline.

The old fcmov implementation had a typo:
-        tcg_gen_mov_i64(cpu_fir[rc], cpu_fir[ra]);
which moved the condition, not the second source, to the destination.

But it's also easy to implement the simplified fp comparison inline.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Add placeholders for missing userspace PALcalls.
Richard Henderson [Mon, 14 Dec 2009 01:18:47 +0000 (17:18 -0800)]
target-alpha: Add placeholders for missing userspace PALcalls.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: No MIPS16 support for 4Kc, 4KEc cores
Stefan Weil [Tue, 15 Dec 2009 13:03:03 +0000 (14:03 +0100)]
target-mips: No MIPS16 support for 4Kc, 4KEc cores

Fix regression introduced by d19954f46dfc262612c30e9534e660e953049487.

4Kc and 4KEc don't support MIPS16.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix compiler warning for gcc-4.3 (and older)
Stefan Weil [Mon, 14 Dec 2009 09:54:49 +0000 (10:54 +0100)]
target-alpha: Fix compiler warning for gcc-4.3 (and older)

"Old" compilers obviously are not able to recognise
that all cases are handled here:

qemu/target-alpha/helper.c:70: error: ‘round_mode’ may be used uninitialized in this function

A small modification helps the compiler to do its jobs.

gcc-4.4 does not need this, but is still not standard on all platforms.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agos390: Fix buggy assignment
Stefan Weil [Mon, 14 Dec 2009 09:39:12 +0000 (10:39 +0100)]
s390: Fix buggy assignment

nd->model keeps dynamically allocated model names.
So casting of a constant string is wrong here.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: 4Kc, 4KEc cores do not support MIPS16
Stefan Weil [Tue, 15 Dec 2009 13:43:40 +0000 (14:43 +0100)]
target-mips: 4Kc, 4KEc cores do not support MIPS16

4Kc, 4KEc cores do not support MIPS16, so not only the
CP0_Config1 had to be fixed (see previous patch),
but also MIPS16 instructions must not be executed.

(Hint from Nathan Froyd, thanks).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomicroblaze: Print content of EAR register
Michal Simek [Mon, 7 Dec 2009 13:12:49 +0000 (14:12 +0100)]
microblaze: Print content of EAR register

I need to see EAR register in output because I need to parse irqsoff problem.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agomicroblaze: Update debug logs.
Edgar E. Iglesias [Wed, 16 Dec 2009 11:52:56 +0000 (12:52 +0100)]
microblaze: Update debug logs.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agotcg/ppc64: Fix loading of 32bit constants
malc [Tue, 15 Dec 2009 16:44:20 +0000 (19:44 +0300)]
tcg/ppc64: Fix loading of 32bit constants

Signed-off-by: malc <av1474@comtv.ru>
14 years agotarget-alpha: Fix double log_cpu_state.
Richard Henderson [Fri, 11 Dec 2009 21:23:52 +0000 (13:23 -0800)]
target-alpha: Fix double log_cpu_state.

The proper logging is handled by generic code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix FMOV.
Richard Henderson [Fri, 11 Dec 2009 21:21:02 +0000 (13:21 -0800)]
target-alpha: Fix FMOV.

Properly handle move from the zero register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Expand ins*h inline.
Richard Henderson [Sat, 12 Dec 2009 00:31:29 +0000 (16:31 -0800)]
target-alpha: Expand ins*h inline.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Expand msk*h inline.
Richard Henderson [Fri, 11 Dec 2009 19:58:29 +0000 (11:58 -0800)]
target-alpha: Expand msk*h inline.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Expand msk*l inline.
Richard Henderson [Fri, 11 Dec 2009 19:51:45 +0000 (11:51 -0800)]
target-alpha: Expand msk*l inline.

Similar in difficulty to ext*l, already expanded.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Expand ins*l inline.
Richard Henderson [Fri, 11 Dec 2009 18:39:56 +0000 (10:39 -0800)]
target-alpha: Expand ins*l inline.

Similar in difficulty to ext*l, already expanded.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement RD/WRUNIQUE in the translator
Richard Henderson [Fri, 11 Dec 2009 17:38:23 +0000 (09:38 -0800)]
target-alpha: Implement RD/WRUNIQUE in the translator

When emulating user-mode only, there's no reason to exit
the translation block to effect a call_pal.  We can generate
a move to/from the unique slot directly.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix fbcond branch offset.
Richard Henderson [Fri, 11 Dec 2009 17:07:29 +0000 (09:07 -0800)]
target-alpha: Fix fbcond branch offset.

The instructions use a disp21 like all other branch insns,
not the disp16 that was being passed.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Rewrite gen_ext_[hl] in terms of zapnot.
Richard Henderson [Thu, 10 Dec 2009 22:00:18 +0000 (14:00 -0800)]
target-alpha: Rewrite gen_ext_[hl] in terms of zapnot.

The architecture manual specifies the EXT instructions
in terms of the ZAPNOT operation; writing it that way in
the translator makes things a bit clearer.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Expand zap/zapnot with immediate inline.
Richard Henderson [Thu, 10 Dec 2009 21:43:58 +0000 (13:43 -0800)]
target-alpha: Expand zap/zapnot with immediate inline.

The vast majority of zap instructions have an immediate operand,
since zapnot is the canonical method to zero-extend from u16 or u32.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix -d in_asm
Richard Henderson [Thu, 10 Dec 2009 20:54:04 +0000 (12:54 -0800)]
target-alpha: Fix -d in_asm

Generic disassembly was incorrectly keyed on ALPHA_DEBUG_DISAS
rather than the generic DEBUG_DISAS.  Use qemu_log_mask for
additional LOG_DISAS output.  Delete some random insn_count
logging noise from gen_intermediate_code_internal.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement missing MVI instructions.
Richard Henderson [Thu, 10 Dec 2009 20:04:42 +0000 (12:04 -0800)]
target-alpha: Implement missing MVI instructions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: fix user-mode emulation startup
Nathan Froyd [Fri, 11 Dec 2009 17:29:20 +0000 (09:29 -0800)]
target-mips: fix user-mode emulation startup

Running programs with the MIPS user-mode emulator fails during dynamic
loading, as floating-point instructions are not enabled in in
env->hflags.  Move the code for doing so from fpu_init to cpu_reset so
the MIPS_HFLAG_{FPU,F64} setting doesn't get clobbered by cpu_reset
setting env->hflags to MIPS_HFLAG_UM.

The same end can be achieved by swapping the ordering of fpu_init and
cpu_reset in cpu_mips_init, but it seemed better to consolidate the
CONFIG_USER_ONLY code into a single location.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-i386: Update CPUID feature set for TCG
Andre Przywara [Mon, 7 Dec 2009 11:05:38 +0000 (12:05 +0100)]
target-i386: Update CPUID feature set for TCG

The CPUID features QEMU presented to the guest were not up-to-date
with QEMU's emulated feature set.
Add the missing bits of recent (and not so recent) additions to
QEMU's emulation engine.
For stability reasons only the user mode usable bits are exposed for
now, features like Monitor or CR8LEG are left out.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fixes for alpha-linux syscalls.
Richard Henderson [Wed, 9 Dec 2009 23:56:29 +0000 (15:56 -0800)]
target-alpha: Fixes for alpha-linux syscalls.

1. Add correct definitions of error numbers.
2. Implement SYS_osf_sigprocmask
3. Implement SYS_osf_get/setsysinfo for IEEE_FP_CONTROL.

This last requires exposing the FPCR value to do_syscall.
Since this value is actually split up into the float_status,
expose routines from helper.c to access it.

Finally, also add a float_exception_mask field to float_status.
We don't actually use it to control delivery of exceptions to
the emulator yet, but simply hold the value that we placed there
when loading/storing the FPCR.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Enable softfloat.
Richard Henderson [Wed, 9 Dec 2009 23:48:02 +0000 (15:48 -0800)]
target-alpha: Enable softfloat.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Honor the -cpu command line argument.
Richard Henderson [Wed, 9 Dec 2009 23:46:36 +0000 (15:46 -0800)]
target-alpha: Honor the -cpu command line argument.

Also change the default cpu to ev67.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Remove bogus DO_TB_FLUSH code from translator.
Richard Henderson [Wed, 9 Dec 2009 23:44:08 +0000 (15:44 -0800)]
target-alpha: Remove bogus DO_TB_FLUSH code from translator.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Add binfmt entry.
Richard Henderson [Wed, 9 Dec 2009 23:40:11 +0000 (15:40 -0800)]
target-alpha: Add binfmt entry.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Drop bogus UNIQ initial value on Linux.
Richard Henderson [Wed, 9 Dec 2009 23:39:42 +0000 (15:39 -0800)]
target-alpha: Drop bogus UNIQ initial value on Linux.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: set Config1.CA for MIPS16-aware CPUs
Nathan Froyd [Tue, 8 Dec 2009 16:06:32 +0000 (08:06 -0800)]
target-mips: set Config1.CA for MIPS16-aware CPUs

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: add copyright notice for mips16 work
Nathan Froyd [Tue, 8 Dec 2009 16:06:31 +0000 (08:06 -0800)]
target-mips: add copyright notice for mips16 work

Also cross off mips16 ASE in TODO.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agogdbstub: add MIPS16 support
Nathan Froyd [Tue, 8 Dec 2009 16:06:30 +0000 (08:06 -0800)]
gdbstub: add MIPS16 support

The only thing to do here is to expose the current processor mode to GDB
and to set the processor mode properly when we change the PC.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: add mips16 instruction decoding
Nathan Froyd [Tue, 8 Dec 2009 16:06:29 +0000 (08:06 -0800)]
target-mips: add mips16 instruction decoding

There's no good way to add this incrementally, so we do it all at once.
The only changes to shared code are in handle_delay_slot.  We need to
flip ISAMode when doing a jump-and-exchange.  We also need to set
ISAMode the low bit of the target address for jump-to-register.

Also, since we're now adding bits that can be in MIPS_HFLAG_BMASK_EXT,
make sure we use MIPS_HFLAG_BMASK_BASE in the places where we just want
basic information about a branch.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: add enums for MIPS16 opcodes
Nathan Froyd [Tue, 8 Dec 2009 16:06:28 +0000 (08:06 -0800)]
target-mips: add enums for MIPS16 opcodes

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: split out delay slot handling
Nathan Froyd [Tue, 8 Dec 2009 16:06:27 +0000 (08:06 -0800)]
target-mips: split out delay slot handling

Move delay slot handling to common code whose invocation can be
controlled from gen_intermediate_code_internal.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: add gen_base_offset_addr
Nathan Froyd [Tue, 8 Dec 2009 18:01:01 +0000 (10:01 -0800)]
target-mips: add gen_base_offset_addr

This is a common pattern in existing code.  We'll also use it to
implement the mips16 SAVE/RESTORE instructions.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: make gen_compute_branch 16/32-bit-aware
Nathan Froyd [Tue, 8 Dec 2009 16:06:25 +0000 (08:06 -0800)]
target-mips: make gen_compute_branch 16/32-bit-aware

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: move ROTR and ROTRV inside gen_shift_{imm, }
Nathan Froyd [Tue, 8 Dec 2009 16:06:24 +0000 (08:06 -0800)]
target-mips: move ROTR and ROTRV inside gen_shift_{imm, }

It's easier to implement mips16 shift instructions if we're not
examining the opcode inside gen_shift_{imm,}.  So move ROTR and ROTRV
and do the special-case handling of SRL and SRLV inside decode_opc.
Likewise for their 64-bit counterparts.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: change interrupt bits to be mips16-aware
Nathan Froyd [Tue, 8 Dec 2009 16:06:23 +0000 (08:06 -0800)]
target-mips: change interrupt bits to be mips16-aware

We need to stash the operating mode into the low bit of the error PC and
restore it on return from interrupts.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: add new HFLAGs for JALX and 16/32-bit delay slots
Nathan Froyd [Tue, 8 Dec 2009 16:06:22 +0000 (08:06 -0800)]
target-mips: add new HFLAGs for JALX and 16/32-bit delay slots

We create separate masks for the "basic" branch hflags and the
"extended" branch hflags and define MIPS_HFLAG_BMASK as the logical or
of those two.  This is done to avoid churning the codebase in lots of
different places.

We also make the execution mode an hflag under MIPS_HFLAG_TMASK

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoworkaround for cmd646 bmdma register access while no dma is active
Igor V. Kovalenko [Sun, 13 Dec 2009 19:03:31 +0000 (19:03 +0000)]
workaround for cmd646 bmdma register access while no dma is active

This is a workaround only, and is a partial revert
of a few changes to BMDMAState which removed pci_dev
field on the way.

- cmd646 pci_from_bm() expects bm->unit value to
correspond with bm data being passed to callback
as opaque pointer. This breaks when write to dma
control register of second channel happens when no
dma operation is in progress, so bm->unit is zero
for second channel, and pci_from_bm() returns garbage
pointer. Crash happens shortly after that while
dereferencing that pointer.

v0->v1: cleaned up dead code from pci_from_bm.

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agos390: typo fix
Michael S. Tsirkin [Sun, 13 Dec 2009 14:45:47 +0000 (16:45 +0200)]
s390: typo fix

s390 code has an obvious typo, which results in:
hw/s390-virtio.c: At top level:
hw/s390-virtio.c:249: error: request for member ‘no_vga’ in something not a structure or union

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agos390: fix build on 32 bit host
Michael S. Tsirkin [Sun, 13 Dec 2009 14:44:33 +0000 (16:44 +0200)]
s390: fix build on 32 bit host

Building on 32 bit host we get:
hw/s390-virtio.c: In function ‘s390_init’:
hw/s390-virtio.c:184: error: integer constant is too large for ‘unsigned long’ type
64 bit values must be ULL.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoqemu-io: add 'const'
Blue Swirl [Sun, 13 Dec 2009 15:41:43 +0000 (15:41 +0000)]
qemu-io: add 'const'

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSilence softfloat warnings on OpenSolaris
Andreas Färber [Sat, 12 Dec 2009 19:10:56 +0000 (20:10 +0100)]
Silence softfloat warnings on OpenSolaris

Don't define C99 math functions on OpenSolaris (Solaris 11),
which still ships GCC 3.4.3. This fixes redefinition warnings.

Spotted by Palle Lyckegaard.

Signed-off-by: Andreas Färber <afaerber@opensolaris.org>
Cc: Palle Lyckegaard <palle@lyckegaard.dk>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotap: Compilation fix for Solaris
Andreas Färber [Sat, 12 Dec 2009 19:10:55 +0000 (20:10 +0100)]
tap: Compilation fix for Solaris

Avoid an unresolved symbol error for TFR,
which is defined in sysemu.h.

Based on patch by Palle Lyckegaard.

Signed-off-by: Andreas Färber <afaerber@opensolaris.org>
Cc: Palle Lyckegaard <palle@lyckegaard.dk>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agofdc/sparc32: don't hang on detection under OBP
Artyom Tarasenko [Sun, 13 Dec 2009 13:30:44 +0000 (13:30 +0000)]
fdc/sparc32: don't hang on detection under OBP

Stepping through the SS-5's OBP initialization routines
it looks like reading fdc main status register should
clear the fd interrupt.
The patch doesn't fix problems with fdc on sparc platform,
it only fixes fdc detection.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSparc32: implement AFX for SS-5
Artyom Tarasenko [Sun, 13 Dec 2009 13:30:19 +0000 (13:30 +0000)]
Sparc32: implement AFX for SS-5

Implement a stub for the AFX register on SparcStation-5.
This stub is needed for running the original SS-5 OBP
instead of OpenBIOS (which allows to boot Solaris 2.5.1
and Solaris 2.6 kernels).

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoscsi-disk: Inquiry with allocation length of CDB < 36 (v4)
Artyom Tarasenko [Sun, 13 Dec 2009 10:32:36 +0000 (11:32 +0100)]
scsi-disk: Inquiry with allocation length of CDB < 36 (v4)

According to the SCSI-2 specification,
http://ldkelley.com/SCSI2/SCSI2/SCSI2/SCSI2-08.html#8.2.5 ,
"if the allocation length of the command descriptor block (CDB) is too
small to transfer all of the parameters, the additional length shall
not be adjusted to reflect the truncation."
The 36 mandatory bytes of response are written to outbuf, and then
only the length requested in CDB is transferred.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agomicroblaze: Handle wdc flush and clear.
Edgar E. Iglesias [Sun, 13 Dec 2009 08:10:08 +0000 (09:10 +0100)]
microblaze: Handle wdc flush and clear.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agomicroblaze: Correct branch to registers.
Paul Hartke [Sun, 13 Dec 2009 02:22:24 +0000 (03:22 +0100)]
microblaze: Correct branch to registers.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agov2: properly save kvm system time msr registers
Glauber Costa [Thu, 22 Oct 2009 12:26:56 +0000 (10:26 -0200)]
v2: properly save kvm system time msr registers

Currently, the msrs involved in setting up pvclock are not saved over
migration and/or save/restore. This patch puts their value in special
fields in our CPUState, and deal with them using vmstate.

kvm also has to account for it, by including them in the msr list
for the ioctls.

This is a backport from qemu-kvm.git

[v2: sucessfully build without kerneldir ]

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoVNC: Convert do_info_vnc() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:10 +0000 (17:16 -0200)]
VNC: Convert do_info_vnc() to QObject

Return a QDict with server information. Connected clients are returned
as a QList of QDicts.

The new functions (vnc_qdict_remote_addr(), vnc_qdict_local_addr() and
put_addr_qdict()) are used to insert 'host' and 'service' information
in the returned QDict.

This patch is big, but I don't see how to split it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoPCI: Convert pci_device_hot_add() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:09 +0000 (17:16 -0200)]
PCI: Convert pci_device_hot_add() to QObject

Return a QDict with information about the just added device.

This commit should not change user output.

Please, note that this patch does not do error handling
conversion. In error conditions the handler still calls
monitor_printf().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agochar: Convert qemu_chr_info() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:08 +0000 (17:16 -0200)]
char: Convert qemu_chr_info() to QObject

Each device is represented by a QDict. The returned QObject is a QList
of all devices.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoblock: Convert bdrv_info_stats() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:07 +0000 (17:16 -0200)]
block: Convert bdrv_info_stats() to QObject

Each device statistic information is stored in a QDict and
the returned QObject is a QList of all devices.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoblock: Convert bdrv_info() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:06 +0000 (17:16 -0200)]
block: Convert bdrv_info() to QObject

Each block device information is stored in a QDict and the
returned QObject is a QList of all devices.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomigration: Convert do_info_migrate() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:05 +0000 (17:16 -0200)]
migration: Convert do_info_migrate() to QObject

Return a QDict, which may contain up to more two QDicts, depending
on the type of migration we're performing.

IMPORTANT: as a QInt stores a int64_t integer, RAM values are going
to be stored as int64_t and not as uint64_t as they are today. If
this is a problem QInt will have to be changed.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomonitor: Convert do_info_mice() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:04 +0000 (17:16 -0200)]
monitor: Convert do_info_mice() to QObject

Each mouse is represented by a QDict, the returned QObject is a QList of
all mice.

This commit should not change user output.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomonitor: Convert do_info_uuid() to QObject
Luiz Capitulino [Thu, 10 Dec 2009 19:16:03 +0000 (17:16 -0200)]
monitor: Convert do_info_uuid() to QObject

snprintf() is used because the UUID_FMT is too complex for
qobject_from_jsonf().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>