sdk/emulator/qemu.git
13 years agoCorrect spelling of licensed
Matthew Fernandez [Sun, 26 Jun 2011 02:21:35 +0000 (12:21 +1000)]
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>
13 years agoRegister Linux dyntick timer as per-thread signal
Jan Kiszka [Fri, 17 Jun 2011 09:25:49 +0000 (11:25 +0200)]
Register Linux dyntick timer as per-thread signal

Derived from kvm-tool patch
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/74309

Ingo Molnar pointed out that sending the timer signal to the whole
process, just blocking it everywhere, is suboptimal with an increasing
number of threads. QEMU is also using this pattern so far.

Linux provides a (non-portable) way to restrict the signal to a single
thread: We can use SIGEV_THREAD_ID unless we are forced to emulate
signalfd via an additional thread. That case could theoretically be
optimized as well, but it doesn't look worth bothering.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomc146818rtc: Handle host clock resets
Jan Kiszka [Mon, 20 Jun 2011 12:06:28 +0000 (14:06 +0200)]
mc146818rtc: Handle host clock resets

Make use of the new clock reset notifier to update the RTC whenever
rtc_clock is the host clock and that happens to jump backward. This
avoids that the RTC stalls for the period the host clock was set back.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqemu-timer: Introduce clock reset notifier
Jan Kiszka [Mon, 20 Jun 2011 12:06:27 +0000 (14:06 +0200)]
qemu-timer: Introduce clock reset notifier

QEMU_CLOCK_HOST is based on the system time which may jump backward in
case the admin or NTP adjusts it. RTC emulations and other device models
can suffer in this case as timers will stall for the period the clock
was tuned back.

This adds a detection mechanism that checks on every host clock readout
if the new time is before the last result. If that is the case a
notifier list is informed. Device models interested in this event can
register a notifier with the clock.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agonotifier: Pass data argument to callback
Jan Kiszka [Mon, 20 Jun 2011 12:06:26 +0000 (14:06 +0200)]
notifier: Pass data argument to callback

This allows to pass additional information to the notifier callback
which is useful if sender and receiver do not share any other distinct
data structure.

Will be used first for the clock reset notifier.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoide: Turn properties any IDE device must have into bus properties
Markus Armbruster [Thu, 19 May 2011 11:37:17 +0000 (13:37 +0200)]
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>
13 years agovirtio-serial: Turn props any virtio-serial-bus device must have into bus props
Markus Armbruster [Thu, 19 May 2011 11:37:16 +0000 (13:37 +0200)]
virtio-serial: Turn props any virtio-serial-bus device must have into bus props

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovirtio-serial: Clean up virtser_bus_dev_print() output
Markus Armbruster [Thu, 19 May 2011 11:37:15 +0000 (13:37 +0200)]
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>
            dev-prop: name = <null>
             dev-prop-int: id: 0
             dev-prop-int: guest_connected: 1
             dev-prop-int: host_connected: 0
             dev-prop-int: throttled: 0

Indentation is off, and "dev-prop-int" suggests these are properties
you can configure with -device, which isn't the case.  The other
buses' print_dev() callbacks don't do that.  For instance, PCI's
output looks like this:

        class Ethernet controller, addr 00:03.0, pci id 1af4:1000 (sub 1af4:0001)
        bar 0: i/o at 0xffffffffffffffff [0x1e]
        bar 1: mem at 0xffffffffffffffff [0xffe]
        bar 6: mem at 0xffffffffffffffff [0xfffe]

Change virtser_bus_dev_print() to that style.  Result:

          dev: virtconsole, id ""
            dev-prop: is_console = 1
            dev-prop: nr = 0
            dev-prop: chardev = <null>
            dev-prop: name = <null>
            port 0, guest on, host off, throttle off

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agousb-ccid: Drop unused CCIDCardInfo callback print()
Markus Armbruster [Thu, 19 May 2011 11:37:14 +0000 (13:37 +0200)]
usb-ccid: Drop unused CCIDCardInfo callback print()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoRemove unused USES_X509_AUTH macro from VNC sasl code
Daniel P. Berrange [Thu, 23 Jun 2011 12:31:43 +0000 (13:31 +0100)]
Remove unused USES_X509_AUTH macro from VNC sasl code

The USES_X509_AUTH macro is defined in several VNC files,
but not used in all of them. Remove the unused definition.

* ui/vnc-auth-sasl.c: Remove USES_X509_AUTH macro

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoIntroduce a 'client_add' monitor command accepting an open FD
Daniel P. Berrange [Thu, 23 Jun 2011 12:31:42 +0000 (13:31 +0100)]
Introduce a 'client_add' monitor command accepting an open FD

Allow client connections for VNC and socket based character
devices to be passed in over the monitor using SCM_RIGHTS.

One intended usage scenario is to start QEMU with VNC on a
UNIX domain socket. An unprivileged user which cannot access
the UNIX domain socket, can then connect to QEMU's VNC server
by passing an open FD to libvirt, which passes it onto QEMU.

 { "execute": "get_fd", "arguments": { "fdname": "myclient" } }
 { "return": {} }
 { "execute": "add_client", "arguments": { "protocol": "vnc",
                                           "fdname": "myclient",
                                           "skipauth": true } }
 { "return": {} }

In this case 'protocol' can be 'vnc' or 'spice', or the name
of a character device (eg from -chardev id=XXXX)

The 'skipauth' parameter can be used to skip any configured
VNC authentication scheme, which is useful if the mgmt layer
talking to the monitor has already authenticated the client
in another way.

* console.h: Define 'vnc_display_add_client' method
* monitor.c: Implement 'client_add' command
* qemu-char.c, qemu-char.h: Add 'qemu_char_add_client' method
* qerror.c, qerror.h: Add QERR_ADD_CLIENT_FAILED
* qmp-commands.hx: Declare 'client_add' command
* ui/vnc.c: Implement 'vnc_display_add_client' method

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoStore VNC auth scheme per-client as well as per-server
Daniel P. Berrange [Thu, 23 Jun 2011 12:31:41 +0000 (13:31 +0100)]
Store VNC auth scheme per-client as well as per-server

A future patch will introduce a situation where different
clients may have different authentication schemes set.
When a new client arrives, copy the 'auth' and 'subauth'
fields from VncDisplay into the client's VncState, and
use the latter in all authentication functions.

* ui/vnc.h: Add 'auth' and 'subauth' to VncState
* ui/vnc-auth-sasl.c, ui/vnc-auth-vencrypt.c,
  ui/vnc.c: Make auth functions pull auth scheme
  from VncState instead of VncDisplay

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agodo not reset no_shutdown after we shutdown the vm
Wen Congyang [Fri, 17 Jun 2011 02:25:22 +0000 (10:25 +0800)]
do not reset no_shutdown after we shutdown the vm

Daniel P. Berrange sent a libvirt's patch to support
reboots with the QEMU driver. He implements it in
json model like this:
1. add -no-shutdown in the qemu's option:
   qemu -no-shutdown xxxx
2. shutdown the vm by monitor command system_powerdown
3. wait for shutdown event
4. reset the vm by monitor command system_reset

no_shutdown will be reset to 0 if the vm is powered down.
We only can reboot the vm once.

If no_shutdown is not reset to 0, we can reboot the vm
many times.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovl.c: Don't limit node count by smp count
Sasha Levin [Thu, 30 Jun 2011 03:29:39 +0000 (23:29 -0400)]
vl.c: Don't limit node count by smp count

[I've sent this patch couple of months ago and noticed it
 didn't make it's way in - so I'm sending it again]

It is possible to create CPU-less NUMA nodes, node amount shouldn't be
limited by amount of CPUs.

Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Acked-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovga: Fix type of lfb/map_addr/end.
Richard Henderson [Tue, 14 Jun 2011 19:53:08 +0000 (12:53 -0700)]
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqemu-char: Print strerror message on failure
Kevin Wolf [Wed, 1 Jun 2011 11:29:11 +0000 (13:29 +0200)]
qemu-char: Print strerror message on failure

The only way for chardev drivers to communicate an error was to return a NULL
pointer, which resulted in an error message that said _that_ something went
wrong, but not _why_.

This patch changes the interface to return 0/-errno and updates
qemu_chr_open_opts to use strerror to display a more helpful error message.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqemu-timer: change unix timer to dynticks
Paolo Bonzini [Thu, 9 Jun 2011 11:10:25 +0000 (13:10 +0200)]
qemu-timer: change unix timer to dynticks

A timer that wakes up every millisecond puts a lot of stress on the
iothread.  The large amount of IPIs causes very high context switch
activity, making emulation slow and the UI unusable.  This is by the
way the same reason why the Windows timers were switched to dynticks.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoiothread: replace fair_mutex with a condition variable
Paolo Bonzini [Thu, 9 Jun 2011 11:10:24 +0000 (13:10 +0200)]
iothread: replace fair_mutex with a condition variable

This conveys the intention better, and scales to more than >1
threads contending the mutex with the iothread (as long as all
of them have a "quiescent point" like the TCG thread has).

Also, on Mac OS X the fair_mutex somehow didn't work as intended
and deadlocked.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomultiboot: Support commas in module parameters
Adam Lackorzynski [Wed, 6 Jul 2011 08:03:57 +0000 (10:03 +0200)]
multiboot: Support commas in module parameters

Support commas in the parameter list of multiboot modules as well as for the
kernel 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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoreport serial devices created with -device in the PIIX4 config space
Paolo Bonzini [Fri, 15 Jul 2011 15:10:15 +0000 (17:10 +0200)]
report serial devices created with -device in the PIIX4 config space

Serial and parallel devices created with -device are not reported in
the PIIX4 configuration space, and are hence not picked up by the DSDT.
This upsets Windows, which hides them altogether from the guest.

To avoid this, check at the end of machine initialization whether the
corresponding I/O ports have been registered.  The new function in
ioport.c does this; this also requires a tweak to isa_unassign_ioport.

I left the comment in piix4_pm_initfn since the registers I moved do
seem to match the 82371AB datasheet.  There are some quirks though.
We are setting this bit:

    "Device 8 EIO Enable (EIO_EN_DEV8)—R/W. 1=Enable PCI access to the
    device 8 enabled I/O ranges to be claimed by PIIX4 and forwarded
    to the ISA/EIO bus. 0=Disable. The LPT_MON_EN must be set to enable
    the decode."

but not LPT_MON_EN (bit 18 at 50h):

    LPT Port Enable (LPT_MON_EN)—R/W. 1=Enable accesses to parallel
    port address range (LPT_DEC_SEL) to generate a device 8 (parallel
    port) decode event. 0=Disable.

We're also setting the LPT_DEC_SEL field (that's the 0x60 written to
63h) to 11, which means reserved, rather than to 01 (378h-37Fh).

Likewise we're not setting SA_MON_EN, SB_MON_EN (respectively bit 14
and bit 16 at address 50h) for the serial ports.  However, we're setting
COMA_DEC_SEL and COMB_DEC_SEL correctly, unlike the corresponding register
for the parallel port.

All these fields are left as they are, since they are probably only
meant to be used in the DSDT.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years ago.gitignore: ignore qemu-ga and qapi-generated
Alexandre Raymond [Sat, 23 Jul 2011 05:41:57 +0000 (01:41 -0400)]
.gitignore: ignore qemu-ga and qapi-generated

Add a new binary and generation directory to the gitignore file

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoguest agent: use QERR_UNSUPPORTED for disabled RPCs
Michael Roth [Fri, 22 Jul 2011 21:42:00 +0000 (16:42 -0500)]
guest agent: use QERR_UNSUPPORTED for disabled RPCs

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agonet: Consistently use qemu_macaddr_default_if_unset
Jan Kiszka [Wed, 20 Jul 2011 10:20:22 +0000 (12:20 +0200)]
net: Consistently use qemu_macaddr_default_if_unset

Drop the open-coded MAC assignment from net_init_nic and replace it with
standard qemu_macaddr_default_if_unset which is also used by qdev. That
avoid creating colliding MACs when instantiating NICs via different
mechanisms.

This change requires to store the MAC as MACAddr in NICInfo, and the
remaining nd_table users need to be updated.

Based on suggestion by Peter Maydell.

CC: Markus Armbruster <armbru@redhat.com>
CC: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agonet: Dump client type 'info network'
Jan Kiszka [Wed, 20 Jul 2011 10:20:21 +0000 (12:20 +0200)]
net: Dump client type 'info network'

Include the client type name into the output of 'info network'. The
result looks like this:

(qemu) info network
VLAN 0 devices:
  rtl8139.0: type=nic,model=rtl8139,macaddr=52:54:00:12:34:57
Devices not on any VLAN:
  virtio-net-pci.0: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
   \ network1: type=tap,fd=5

CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agonet: Refactor net_client_types
Jan Kiszka [Wed, 20 Jul 2011 10:20:20 +0000 (12:20 +0200)]
net: Refactor net_client_types

Position entries of net_client_types according to the corresponding
values of NET_CLIENT_TYPE_*. The array size is now defined by
NET_CLIENT_TYPE_MAX. This will allow to obtain entries based on type
value in later patches.

At this chance rename NET_CLIENT_TYPE_SLIRP to NET_CLIENT_TYPE_USER for
the sake of consistency.

CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agonet: Improve layout of 'info network'
Jan Kiszka [Wed, 20 Jul 2011 10:20:19 +0000 (12:20 +0200)]
net: Improve layout of 'info network'

Improve the layout when listing non-vlan clients via 'info network'. The
result looks like this:

(qemu) info network
Devices not on any VLAN:
  orphan: net=10.0.2.0, restricted=n
  virtio-net-pci.0: model=virtio-net-pci,macaddr=52:54:00:12:34:56
   \ network2: fd=5
  e1000.0: model=e1000,macaddr=52:54:00:12:34:57
   \ network1: net=10.0.2.0, restricted=n
  rtl8139.0: model=rtl8139,macaddr=52:54:00:12:34:58

ie. peers are grouped, orphans are listed as before.

CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoslirp: Forward ICMP echo requests via unprivileged sockets
Jan Kiszka [Wed, 20 Jul 2011 10:20:18 +0000 (12:20 +0200)]
slirp: Forward ICMP echo requests via unprivileged sockets

Linux 3.0 gained support for unprivileged ICMP ping sockets. Use this
feature to forward guest pings to the outer world. The host admin has to
set the ping_group_range in order to grant access to those sockets. To
allow ping for the users group (GID 100):

echo 100 100 > /proc/sys/net/ipv4/ping_group_range

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoslirp: Put forked exec into separate process group
Jan Kiszka [Wed, 20 Jul 2011 10:20:17 +0000 (12:20 +0200)]
slirp: Put forked exec into separate process group

Recent smb daemons tend to terminate themselves via a process group
SIGTERM. If the daemon is still in qemu's group by that time, qemu will
die as well. Avoid this by always pushing fork_exec processes into a
group of their own, not just (unused) type 2 execs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoslirp: Replace m_freem with m_free
Jan Kiszka [Wed, 20 Jul 2011 10:20:16 +0000 (12:20 +0200)]
slirp: Replace m_freem with m_free

Remove this pointless wrapping.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoslirp: Strictly associate DHCP/BOOTP and TFTP with virtual host
Jan Kiszka [Wed, 20 Jul 2011 10:20:15 +0000 (12:20 +0200)]
slirp: Strictly associate DHCP/BOOTP and TFTP with virtual host

Instead of accepting every DHCP/BOOTP and TFTP packet, only invoke the
built-in servers if the target is the virtual host.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoslirp: Canonicalize restrict syntax
Jan Kiszka [Wed, 20 Jul 2011 10:20:14 +0000 (12:20 +0200)]
slirp: Canonicalize restrict syntax

All other boolean arguments accept on|off - except for slirp's restrict.
Fix that while still accepting the formerly allowed yes|y|no|n, but
reject everything else. This avoids accidentally allowing external
connections because syntax errors were so far interpreted as
'restrict=no'.

CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoslirp: Fix restricted mode
Jan Kiszka [Wed, 20 Jul 2011 10:20:13 +0000 (12:20 +0200)]
slirp: Fix restricted mode

This aligns the code to what the documentation claims: Allow everything
but requests that would have to be routed outside of the virtual LAN.

So we need to drop the unneeded IP-level filter, allow TFTP requests,
and add the missing protocol-level filter to ICMP.

CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoDeprecate -M command line options
Jan Kiszka [Sat, 23 Jul 2011 10:39:46 +0000 (12:39 +0200)]
Deprecate -M command line options

Superseded by -machine. Therefore, this patch removes -M from the help
list and pushes -machine at the same place in the output.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoGeneralize -machine command line option
Jan Kiszka [Sat, 23 Jul 2011 10:38:37 +0000 (12:38 +0200)]
Generalize -machine command line option

-machine somehow suggests that it selects the machine, but it doesn't.
Fix that before this command is set in stone.

Actually, -machine should supersede -M and allow to introduce arbitrary
per-machine options to the command line. That will change the internal
realization again, but we will be able to keep the user interface
stable.

Tested-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoguest-agent: fix build with OpenBSD
Anthony Liguori [Fri, 22 Jul 2011 19:14:17 +0000 (14:14 -0500)]
guest-agent: fix build with OpenBSD

FS-Freeze only works with Linux.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoxen: fix xen-mapcache build on non-Xen capable targets
Avi Kivity [Wed, 20 Jul 2011 09:14:06 +0000 (12:14 +0300)]
xen: fix xen-mapcache build on non-Xen capable targets

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Fri, 22 Jul 2011 16:07:08 +0000 (11:07 -0500)]
Merge remote-tracking branch 'origin/master' into staging

13 years agotarget-sparc: Fix compiler errors (format strings)
Stefan Weil [Fri, 22 Jul 2011 05:44:27 +0000 (07:44 +0200)]
target-sparc: Fix compiler errors (format strings)

This change is needed because commit 06e12b65
now uses an unsigned long long value
(uint64_t && unsigned long long => unsigned long long).

Cc: Tsuneo Saito <tsnsaito@gmail.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge remote-tracking branch 'spice/spice.v39' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:24:07 +0000 (09:24 -0500)]
Merge remote-tracking branch 'spice/spice.v39' into staging

13 years agoMerge remote-tracking branch 'qmp/for-anthony' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:23:53 +0000 (09:23 -0500)]
Merge remote-tracking branch 'qmp/for-anthony' into staging

13 years agoMerge remote-tracking branch 'kraxel/usb.21' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:23:49 +0000 (09:23 -0500)]
Merge remote-tracking branch 'kraxel/usb.21' into staging

13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 22 Jul 2011 14:23:43 +0000 (09:23 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoUSB: add usb network redirection support
Hans de Goede [Tue, 19 Jul 2011 09:04:10 +0000 (11:04 +0200)]
USB: add usb network redirection support

This patch adds support for a usb-redir device, which takes a chardev
as a communication channel to an actual usbdevice using the usbredir protocol.

Compiling the usb-redir device requires usbredir-0.3 to be installed for
the usbredir protocol parser, usbredir-0.3 also contains a server for
redirecting usb traffic from an actual usb device. You can get the 0.3
release of usbredir here:
http://people.fedoraproject.org/~jwrdegoede/usbredir-0.3.tar.bz2
(getting a more formal site for it is a WIP)

Example usage:
1) Start usbredirserver for a usb device:
sudo usbredirserver 045e:0772
2) Start qemu with usb2 support + a chardev talking to usbredirserver +
   a usb-redir device using this chardev:
qemu ... \
  -readconfig docs/ich9-ehci-uhci.cfg \
  -chardev socket,id=usbredirchardev,host=localhost,port=4000 \
  -device usb-redir,chardev=usbredirchardev,id=usbredirdev

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: trace: rename "next" to "nxt".
Gerd Hoffmann [Wed, 20 Jul 2011 13:44:01 +0000 (15:44 +0200)]
usb-ehci: trace: rename "next" to "nxt".

"next" is reserved in systemtap thus using this as a
trace parameter name causes trouble when trying to trace
with systemtap.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-uhci: fix irq handling on error.
Gerd Hoffmann [Fri, 8 Jul 2011 15:28:11 +0000 (17:28 +0200)]
usb-uhci: fix irq handling on error.

Spec on UHCI_STS_USBERR: "If the TD on which the error interrupt
occurred also had its IOC bit set, both this bit and Bit 0 are set."

Make UHCI emulation do that.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-hid: fixup changed tracking.
Gerd Hoffmann [Fri, 8 Jul 2011 11:19:01 +0000 (13:19 +0200)]
usb-hid: fixup changed tracking.

Remove leftover calls to usb_hid_changed().

Take care to update the changed flag after delivering a event via
GET_REPORT like we do when sending events via interrupt endpoint.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoSPARC64: implement addtional MMU faults related to nonfaulting load
Tsuneo Saito [Thu, 21 Jul 2011 15:16:33 +0000 (00:16 +0900)]
SPARC64: implement addtional MMU faults related to nonfaulting load

This patch implements MMU faults caused by TTE.NFO and TTE.E:
- access other than nonfaulting load to a page marked NFO should
  raise data_access_exception
- nonfaulting load to a page marked with E bit should raise
  data_access_exception

To distinguish nonfaulting loads, this patch extends (abuses?) the rw
argument of get_physical_address_data().  rw is set to 4 on nonfaulting
loads.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: implement MMU miss traps on nonfaulting loads
Tsuneo Saito [Thu, 21 Jul 2011 15:16:32 +0000 (00:16 +0900)]
SPARC64: implement MMU miss traps on nonfaulting loads

Nonfaulting loads should raise fast_data_access_MMU_miss traps as
normal loads do.  It is up to the guest OS kernel that detect MMU misses
on nonfaulting load instructions and make them complete without signaling.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: fix fault status overwritten on nonfaulting load
Tsuneo Saito [Thu, 21 Jul 2011 15:16:31 +0000 (00:16 +0900)]
SPARC64: fix fault status overwritten on nonfaulting load

cpu_get_phys_page_nofault() calls get_physical_address() twice,
that results in overwriting the fault status in the SFSR.
We need this change in order for nonfaulting loads to raising MMU faults
as normal loads do.
Also removed the call to cpu_get_physical_page_desc() since we are
going to modify nonfaulting loads raising MMU faults.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: split cpu_get_phys_page_debug() from cpu_get_phys_page_nofault()
Tsuneo Saito [Thu, 21 Jul 2011 15:16:30 +0000 (00:16 +0900)]
SPARC64: split cpu_get_phys_page_debug() from cpu_get_phys_page_nofault()

This patch makes cpu_get_phys_page_debug() independent from
cpu_get_phys_page_nofault() in advance of implementing nonfaulting load.
This also modifies cpu_get_phys_page_nofault() to be compiled only on
TARGET_SPARC64 because it is not required on SPARC32.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: introduce a convenience function for getting physical addresses
Tsuneo Saito [Thu, 21 Jul 2011 15:16:29 +0000 (00:16 +0900)]
SPARC64: introduce a convenience function for getting physical addresses

Introduce cpu_sparc_get_phys_page() to be used as a help for splitting
cpu_get_phys_page_debug() from cpu_get_phys_page_nofault().

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: SFSR cleanup and fix
Tsuneo Saito [Thu, 21 Jul 2011 15:16:28 +0000 (00:16 +0900)]
SPARC64: SFSR cleanup and fix

Add macros for SFSR fields and use macros instead of magic numbers.
Also fix the update of the register fields on MMU faults.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: TTE bits cleanup
Tsuneo Saito [Thu, 21 Jul 2011 15:16:27 +0000 (00:16 +0900)]
SPARC64: TTE bits cleanup

Add macros for TTE bits and modify to use macros instead of
magic numbers.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoguest agent: add guest agent RPCs/commands
Michael Roth [Tue, 19 Jul 2011 20:41:55 +0000 (15:41 -0500)]
guest agent: add guest agent RPCs/commands

This adds the initial set of QMP/QAPI commands provided by the guest
agent:

guest-sync
guest-ping
guest-info
guest-shutdown
guest-file-open
guest-file-read
guest-file-write
guest-file-seek
guest-file-flush
guest-file-close
guest-fsfreeze-freeze
guest-fsfreeze-thaw
guest-fsfreeze-status

The input/output specification for these commands are documented in the
schema.

Example usage:

  host:
    qemu -device virtio-serial \
         -chardev socket,path=/tmp/vs0.sock,server,nowait,id=qga0 \
         -device virtserialport,chardev=qga0,name=org.qemu.quest_agent.0
         ...

    echo "{'execute':'guest-info'}" | socat stdio unix-connect:/tmp/qga0.sock

  guest:
    qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0 \
            -p /var/run/qemu-guest-agent.pid -d

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoguest agent: qemu-ga daemon
Michael Roth [Wed, 20 Jul 2011 20:19:37 +0000 (15:19 -0500)]
guest agent: qemu-ga daemon

This is the actual guest daemon, it listens for requests over a
virtio-serial/isa-serial/unix socket channel and routes them through
to dispatch routines, and writes the results back to the channel in
a manner similar to QMP.

A shorthand invocation:

  qemu-ga -d

Is equivalent to:

  qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0 \
          -f /var/run/qemu-ga.pid -d

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoguest agent: command state class
Michael Roth [Tue, 19 Jul 2011 20:41:53 +0000 (15:41 -0500)]
guest agent: command state class

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqerror: add QERR_JSON_PARSE_ERROR to qerror.c
Michael Roth [Tue, 19 Jul 2011 20:41:52 +0000 (15:41 -0500)]
qerror: add QERR_JSON_PARSE_ERROR to qerror.c

Missing from previous addition of error to qerror.h. Needed for
qerror_format() and friends.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add QAPI code generation documentation
Michael Roth [Tue, 19 Jul 2011 19:50:46 +0000 (14:50 -0500)]
qapi: add QAPI code generation documentation

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add test-qmp-commands, tests for gen. marshalling/dispatch code
Michael Roth [Tue, 19 Jul 2011 19:50:45 +0000 (14:50 -0500)]
qapi: add test-qmp-commands, tests for gen. marshalling/dispatch code

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add test-visitor, tests for gen. visitor code
Michael Roth [Tue, 19 Jul 2011 19:50:44 +0000 (14:50 -0500)]
qapi: add test-visitor, tests for gen. visitor code

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: test schema used for unit tests
Michael Roth [Tue, 19 Jul 2011 19:50:43 +0000 (14:50 -0500)]
qapi: test schema used for unit tests

This is how QMP commands/parameters/types would be defined. We use a
subset of that functionality here to implement functions/types for unit
testing.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add qapi-commands.py code generator
Michael Roth [Tue, 19 Jul 2011 19:50:42 +0000 (14:50 -0500)]
qapi: add qapi-commands.py code generator

This is the code generator for qapi command marshaling/dispatch.
Currently only generators for synchronous qapi/qmp functions are
supported. This script generates the following files:

  $(prefix)qmp-marshal.c: command marshal/dispatch functions for each
                          QMP command defined in the schema. Functions
                          generated by qapi-visit.py are used to
                          convert qobjects recieved from the wire into
                          function parameters, and uses the same
                          visiter functions to convert native C return
                          values to qobjects from transmission back
                          over the wire.

  $(prefix)qmp-commands.h: Function prototypes for the QMP commands
                           specified in the schema.

$(prefix) is used in the same manner as with qapi-types.py

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add qapi-visit.py code generator
Michael Roth [Tue, 19 Jul 2011 19:50:41 +0000 (14:50 -0500)]
qapi: add qapi-visit.py code generator

This is the code generator for qapi visiter functions used to
marshal/unmarshal/dealloc qapi types. It generates the following 2
files:

  $(prefix)qapi-visit.c: visiter function for a particular c type, used
                         to automagically convert qobjects into the
                         corresponding C type and vice-versa, and well
                         as for deallocation memory for an existing C
                         type

  $(prefix)qapi-visit.h: declarations for previously mentioned visiter
                         functions

$(prefix) is used as decribed for qapi-types.py

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add qapi-types.py code generator
Michael Roth [Tue, 19 Jul 2011 19:50:40 +0000 (14:50 -0500)]
qapi: add qapi-types.py code generator

This is the code generator for qapi types. It will generation the
following files:

  $(prefix)qapi-types.h - C types corresponding to types defined in
                          the schema you pass in
  $(prefix)qapi-types.c - Cleanup functions for the above C types

The $(prefix) is used to as a namespace to keep the generated code from
one schema/code-generation separated from others so code and be
generated from multiple schemas with clobbering previously created code.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add qapi.py helper libraries
Michael Roth [Tue, 19 Jul 2011 19:50:39 +0000 (14:50 -0500)]
qapi: add qapi.py helper libraries

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add ordereddict.py helper library
Michael Roth [Tue, 19 Jul 2011 19:50:38 +0000 (14:50 -0500)]
qapi: add ordereddict.py helper library

We need this to parse dictionaries with schema ordering intact so that C
prototypes can be generated deterministically.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add QMP dispatch functions
Michael Roth [Tue, 19 Jul 2011 19:50:37 +0000 (14:50 -0500)]
qapi: add QMP dispatch functions

Given an object recieved via QMP, this code uses the dispatch table
provided by qmp_registry.c to call the corresponding marshalling/dispatch
function and format return values/errors for delivery to the QMP.
Currently only synchronous QMP functions are supported, but this will
also be used for async QMP functions and QMP guest proxy dispatch as
well.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add QMP command registration/lookup functions
Michael Roth [Tue, 19 Jul 2011 19:50:36 +0000 (14:50 -0500)]
qapi: add QMP command registration/lookup functions

Registration/lookup functions for that provide a lookup table for
dispatching QMP commands.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add QAPI dealloc visitor
Michael Roth [Tue, 19 Jul 2011 19:50:35 +0000 (14:50 -0500)]
qapi: add QAPI dealloc visitor

Type of Visitor class that can be passed into a qapi-generated C
type's visitor function to free() any heap-allocated data types.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add QMP output visitor
Michael Roth [Tue, 19 Jul 2011 19:50:34 +0000 (14:50 -0500)]
qapi: add QMP output visitor

Type of Visiter class that serves as the inverse of the input visitor:
it takes a series of native C types and uses their values to construct a
corresponding QObject. The command marshaling/dispatcher functions will
use this to convert the output of QMP functions into a QObject that can
be sent over the wire.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add QMP input visitor
Michael Roth [Tue, 19 Jul 2011 19:50:33 +0000 (14:50 -0500)]
qapi: add QMP input visitor

A type of Visiter class that is used to walk a qobject's
structure and assign each entry to the corresponding native C type.
Command marshaling function will use this to pull out QMP command
parameters recieved over the wire and pass them as native arguments
to the corresponding C functions.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add QAPI visitor core
Michael Roth [Tue, 19 Jul 2011 19:50:32 +0000 (14:50 -0500)]
qapi: add QAPI visitor core

Base definitions/includes for Visiter interface used by generated
visiter/marshalling code.

Includes a GenericList type. Our lists require an embedded element.
Since these types are generated, if you want to use them in a different
type of data structure, there's no easy way to add another embedded
element. The solution is to have non-embedded lists and that what this is.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqapi: add module init types for qapi
Michael Roth [Tue, 19 Jul 2011 19:50:31 +0000 (14:50 -0500)]
qapi: add module init types for qapi

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoqlist: add qlist_first()/qlist_next()
Michael Roth [Tue, 19 Jul 2011 19:50:30 +0000 (14:50 -0500)]
qlist: add qlist_first()/qlist_next()

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoAdd hard build dependency on glib
Anthony Liguori [Tue, 19 Jul 2011 19:50:29 +0000 (14:50 -0500)]
Add hard build dependency on glib

GLib is an extremely common library that has a portable thread implementation
along with tons of other goodies.

GLib and GObject have a fantastic amount of infrastructure we can leverage in
QEMU including an object oriented programming infrastructure.

Short term, it has a very nice thread pool implementation that we could leverage
in something like virtio-9p.  It also has a test harness implementation that
this series will use.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoError: Fix build when qemu-common.h is not included
Luiz Capitulino [Mon, 11 Jul 2011 18:01:57 +0000 (15:01 -0300)]
Error: Fix build when qemu-common.h is not included

Commit e4ea5e2d0e0e4c5188ab45b66f3195062ae059dc added the use of
the macro GCC_FMT_ATTR to error.h, however compiler.h is not
included by error.h

This will cause a build error when files including error.h
don't include qemu-common.h (or compiler.h). Not an issue today
because the only file including it is json-parser.h and it does
include qemu-common.h, but let's get it fixed.

Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoIntroduce compiler.h header file
Luiz Capitulino [Mon, 11 Jul 2011 17:24:44 +0000 (14:24 -0300)]
Introduce compiler.h header file

This moves compiler related macros from qemu-common.h to compiler.h.

The reason for this change is that there are simple header files that
depend only on the compiler macros, so including qemu-common.h is overkill.

Besides, qemu-common.h is bloated and will benefit from some splitting.

Please, also note that the QEMU_BUILD_BUG_ON() macro is being fixed to
not use double underscores as a prefix and the license text was added
by Vassili Karpov (malc), who is one of the authors of the new file.

Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoQMP: add snapshot-blkdev-sync command
Jes Sorensen [Mon, 11 Jul 2011 18:01:09 +0000 (20:01 +0200)]
QMP: add snapshot-blkdev-sync command

Add QMP bits for snapshot_blkdev command. This is the same as
snapshot_blkdev in the human monitor. The command is synchronous.

In the future async commands and or a break down of the functionality
into multiple commands might be added.

Also change the 'snapshot_file' argument to 'snapshot-file' in
the human monitor, so that it matches QMP.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
13 years agoUpdate OpenBIOS images for Sparc32 and Sparc64
Blue Swirl [Wed, 20 Jul 2011 22:06:33 +0000 (22:06 +0000)]
Update OpenBIOS images for Sparc32 and Sparc64

Update Sparc32 and Sparc64 OpenBIOS images to SVN revision 1045.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoFix unassigned memory access handling
Blue Swirl [Sun, 3 Jul 2011 08:53:46 +0000 (08:53 +0000)]
Fix unassigned memory access handling

cea5f9a28faa528b6b1b117c9ab2d8828f473fef exposed bugs in unassigned memory
access handling. Fix them by always passing CPUState to the handlers.

Reported-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAvoid CPU endian memory accesses in devices
Blue Swirl [Thu, 14 Jul 2011 15:22:20 +0000 (15:22 +0000)]
Avoid CPU endian memory accesses in devices

Don't compile virtio.c in hwlib, it depends on memory accesses
performed in CPU endianness.

Make loads and stores in CPU endianness unavailable to devices
and poison them to avoid further bugs.

Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: treat UA2007 ASI_BLK_* as translating ASIs.
Tsuneo Saito [Mon, 18 Jul 2011 05:32:18 +0000 (14:32 +0900)]
SPARC64: treat UA2007 ASI_BLK_* as translating ASIs.

UA2007 ASI_BLK_* should be added in is_translating_asi().

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agocheckpatch: Fix bracing false positives on #if
Blue Swirl [Fri, 15 Jul 2011 20:09:10 +0000 (20:09 +0000)]
checkpatch: Fix bracing false positives on #if

789f88d0b21fedfd4251d56bb7a9fbfbda7a4ac7 only fixed #else,
fix also #if.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/mips: Fix regression caused by typo (copy + paste bug)
Stefan Weil [Wed, 20 Jul 2011 18:56:36 +0000 (20:56 +0200)]
tcg/mips: Fix regression caused by typo (copy + paste bug)

cppcheck reports an error:
qemu/tcg/mips/tcg-target.c:1487: error: Invalid number of character (()

The unpatched code won't compile on mips hosts starting with commit
cea5f9a28faa528b6b1b117c9ab2d8828f473fef.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: convert to qdev device, and use it in MIPS Jazz emulation
Hervé Poussineau [Mon, 18 Jul 2011 21:34:22 +0000 (23:34 +0200)]
ds1225y: convert to qdev device, and use it in MIPS Jazz emulation

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: use trace framework
Hervé Poussineau [Mon, 18 Jul 2011 21:34:21 +0000 (23:34 +0200)]
ds1225y: use trace framework

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: Remove protection stuff, which doesn't belong to this device
Hervé Poussineau [Mon, 18 Jul 2011 21:34:20 +0000 (23:34 +0200)]
ds1225y: Remove protection stuff, which doesn't belong to this device

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: add missing break on fmovdcc
Tsuneo Saito [Mon, 18 Jul 2011 06:36:57 +0000 (15:36 +0900)]
SPARC64: add missing break on fmovdcc

"break" is missing on V9 fmovdcc (%icc).

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: fix VIS1 SIMD signed compare instructions
Tsuneo Saito [Mon, 18 Jul 2011 06:00:00 +0000 (15:00 +0900)]
SPARC64: fix VIS1 SIMD signed compare instructions

The destination registers of SIMD signed compare instructions
(fcmp*<16|32>) are not FP registers but general purpose r registers.
Comparisons should be freg_rs1 CMP freg_rs2, that were reversed.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Wed, 20 Jul 2011 20:23:01 +0000 (20:23 +0000)]
Merge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Fix BASEPRI, BASEPRI_MAX, and FAULTMASK access
  target-arm: Minimal implementation of performance counters
  Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
  Revert "target-arm: Use global env in neon_helper.c helpers"
  target-arm: Pass fp status pointer explicitly to neon fp helpers
  target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
  target-arm: Add helper function to generate code to get fpstatus pointer
  Revert "target-arm: Use global env in iwmmxt_helper.c helpers"

Conflicts:
Makefile.target

13 years agoAdd missing documentation for qemu-img -p
Jes Sorensen [Tue, 19 Jul 2011 13:01:34 +0000 (15:01 +0200)]
Add missing documentation for qemu-img -p

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqxl: upon reset, if spice worker is stopped, the command rings can be not empty
Yonit Halperin [Tue, 12 Jul 2011 08:51:58 +0000 (11:51 +0300)]
qxl: upon reset, if spice worker is stopped, the command rings can be not empty

Spice worker does no longer process commands when it is stopped.
Otherwise, it might crash during migration when attempting to process
commands while the guest is not completely loaded.

Cc: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agospice: add sanity check for spice ports
Gerd Hoffmann [Thu, 7 Jul 2011 15:04:17 +0000 (17:04 +0200)]
spice: add sanity check for spice ports

Make sure at least one port (port=.. or tls-port=...)
is specified.  Also apply range checks to the port numbers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoqcow2: Use Qcow2Cache in writeback mode during loadvm/savevm
Kevin Wolf [Tue, 19 Jul 2011 11:01:48 +0000 (13:01 +0200)]
qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm

In snapshotting there is no guest involved, so we can safely use a writeback
mode and do the flushes in the right place (i.e. at the very end). This
improves the time that creating/restoring an internal snapshot takes with an
image in writethrough mode.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: add bdrv_get_allocated_file_size() operation
Fam Zheng [Tue, 12 Jul 2011 11:56:39 +0000 (19:56 +0800)]
block: add bdrv_get_allocated_file_size() operation

qemu-img.c wants to count allocated file size of image. Previously it
counts a single bs->file by 'stat' or Window API. As VMDK introduces
multiple file support, the operation becomes format specific with
platform specific meanwhile.

The functions are moved to block/raw-{posix,win32}.c and qemu-img.c calls
bdrv_get_allocated_file_size to count the bs. And also added VMDK code
to count his own extents.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: fix coding style
Fam Zheng [Tue, 12 Jul 2011 11:56:38 +0000 (19:56 +0800)]
VMDK: fix coding style

Conform coding style in vmdk.c to pass scripts/checkpatch.pl checks.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: create different subformats
Fam Zheng [Tue, 19 Jul 2011 00:45:23 +0000 (08:45 +0800)]
VMDK: create different subformats

Add create option 'format', with enums:
    monolithicSparse
    monolithicFlat
    twoGbMaxExtentSparse
    twoGbMaxExtentFlat
Each creates a subformat image file. The default is monolithicSparse.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: open/read/write for monolithicFlat image
Fam Zheng [Tue, 19 Jul 2011 00:38:22 +0000 (08:38 +0800)]
VMDK: open/read/write for monolithicFlat image

Parse vmdk decriptor file and open mono flat image.
Read/write the flat extent.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: change get_cluster_offset return type
Fam Zheng [Tue, 12 Jul 2011 11:56:35 +0000 (19:56 +0800)]
VMDK: change get_cluster_offset return type

The return type of get_cluster_offset was an offset that use 0 to denote
'not allocated', this will be no longer true for flat extents, as we see
flat extent file as a single huge cluster whose offset is 0 and length
is the whole file length.
So now we use int return value, 0 means success and otherwise offset
invalid.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: move 'static' cid_update flag to bs field
Fam Zheng [Tue, 12 Jul 2011 11:56:34 +0000 (19:56 +0800)]
VMDK: move 'static' cid_update flag to bs field

Cid_update is the flag for updating CID on first write after opening the
image. This should be per image open rather than per program life cycle,
so change it from static var of vmdk_write to a field in BDRVVmdkState.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>