]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/log
lisovros/qemu_apohw.git
10 years agoblock/raw-posix: bdrv_parse_filename() for floppy
Max Reitz [Fri, 7 Mar 2014 23:39:42 +0000 (00:39 +0100)]
block/raw-posix: bdrv_parse_filename() for floppy

The "host_floppy" protocol driver should strip the "host_floppy:" prefix
from filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/raw-posix: bdrv_parse_filename() for hdev
Max Reitz [Fri, 7 Mar 2014 23:39:41 +0000 (00:39 +0100)]
block/raw-posix: bdrv_parse_filename() for hdev

The "host_device" protocol driver should strip the "host_device:" prefix
from filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io: Fix warnings from static code analysis
Stefan Weil [Wed, 5 Mar 2014 21:23:00 +0000 (22:23 +0100)]
qemu-io: Fix warnings from static code analysis

Smatch complains about several global symbols which should be local.

Add the missing 'static' attributes and move the 'extern' declaration
of variable qemuio_misalign to qemu-io.h. This variable also changes
the type from 'int' to 'bool' which better fits documents its use.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Unlink temporary file
Max Reitz [Sat, 15 Feb 2014 17:03:21 +0000 (18:03 +0100)]
block: Unlink temporary file

If the image file cannot be opened and was created as a temporary file,
it should be deleted; thus, in this case, we should jump to the
"unlink_and_fail" label and not just to "fail".

Reported-by: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Don't write with BDRV_O_INCOMING
Kevin Wolf [Tue, 11 Mar 2014 14:15:03 +0000 (15:15 +0100)]
qcow2: Don't write with BDRV_O_INCOMING

qcow2_open() causes writes when repairing an image with the dirty flag
set and when clearing autoclear flags. It shouldn't do this when another
qemu instance is still actively working on this image file.

One effect of the bug is that images may have a cleared dirty flag while
the migration source host still has it in use with lazy refcounts
enabled, so refcounts are not accurate and the dirty flag must remain
set.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Keep option in qcow2_invalidate_cache()
Kevin Wolf [Tue, 11 Mar 2014 16:42:41 +0000 (17:42 +0100)]
qcow2: Keep option in qcow2_invalidate_cache()

Instead of manually building a list of all options from BDRVQcowState
values just reuse the options that were used to open the image.
qcow2_open() won't fully use all of the options in the QDict, but that's
okay.

This fixes all of the driver-specific options in qcow2, except for
lazy-refcounts, which was special cased before.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqmp: add query-iothreads command
Stefan Hajnoczi [Thu, 27 Feb 2014 10:48:42 +0000 (11:48 +0100)]
qmp: add query-iothreads command

The "query-iothreads" command returns a list of information about
iothreads.  See the patch for API documentation.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoiothread: stash thread ID away
Stefan Hajnoczi [Thu, 27 Feb 2014 10:48:41 +0000 (11:48 +0100)]
iothread: stash thread ID away

Keep the thread ID around so we can report it via QMP.

There's only one problem: qemu_get_thread_id() (gettid() wrapper on
Linux) must be called from the thread itself.  There is no way to get
the thread ID outside the thread.

This patch uses a condvar to wait for iothread_run() to populate the
thread_id inside the thread.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agodataplane: replace internal thread with IOThread
Stefan Hajnoczi [Mon, 3 Mar 2014 10:30:08 +0000 (11:30 +0100)]
dataplane: replace internal thread with IOThread

Today virtio-blk dataplane uses a 1:1 device-per-thread model.  Now that
IOThreads have been introduced we can generalize this to N:M devices per
threads.

This patch drops thread code from dataplane in favor of running inside
an IOThread AioContext.

As a bonus we solve the case where a guest keeps submitting I/O requests
while dataplane is trying to stop.  Previously the dataplane thread
would continue to process requests until the request gave it a break.
Now we can shut down in bounded time thanks to
aio_context_acquire/release.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoiothread: add "iothread" qdev property type
Stefan Hajnoczi [Mon, 3 Mar 2014 10:30:07 +0000 (11:30 +0100)]
iothread: add "iothread" qdev property type

Add a "iothread" qdev property type so devices can be hooked up to an
IOThread from the comand-line:

  qemu -object iothread,id=iothread0 \
       -device some-device,x-iothread=iothread0

Note that Paolo Bonzini <pbonzini@redhat.com> has suggested using QOM
links instead.  This way the relationship between the objects is
reflected in QOM.  There are currently shortcomings of
object_property_add_link() which prevent this use case.  I will attempt
to fix them and move to QOM links in a separate series.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqdev: make get_pointer() handle temporary strings
Igor Mammedov [Mon, 3 Mar 2014 10:30:06 +0000 (11:30 +0100)]
qdev: make get_pointer() handle temporary strings

get_pointer()'s print() callback might return a heap allocated
string, to avoid adding dedicated get_pointer_foo for this case
convert current print() callbacks to return temporary heap
allocated string and make get_pointer() free it.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoiothread: add I/O thread object
Stefan Hajnoczi [Mon, 3 Mar 2014 10:30:05 +0000 (11:30 +0100)]
iothread: add I/O thread object

This is a stand-in for Michael Roth's QContext.  I expect this to be
replaced once QContext is completed.

The IOThread object is an AioContext event loop thread.  This patch adds
the concept of multiple event loop threads, allowing users to define
them.

When SMP guests run on SMP hosts it makes sense to instantiate multiple
IOThreads.  This spreads event loop processing across multiple cores.
Note that additional patches are required to actually bind a device to
an IOThread.

[Andreas Färber <afaerber@suse.de> pointed out that the embedded parent
object instance should be called "parent_obj" and have a newline
afterwards.  This patch has been changed to reflect this.
-- Stefan]

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio: add aio_context_acquire() and aio_context_release()
Stefan Hajnoczi [Mon, 3 Mar 2014 10:30:04 +0000 (11:30 +0100)]
aio: add aio_context_acquire() and aio_context_release()

It can be useful to run an AioContext from a thread which normally does
not "own" the AioContext.  For example, request draining can be
implemented by acquiring the AioContext and looping aio_poll() until all
requests have been completed.

The following pattern should work:

  /* Event loop thread */
  while (running) {
      aio_context_acquire(ctx);
      aio_poll(ctx, true);
      aio_context_release(ctx);
  }

  /* Another thread */
  aio_context_acquire(ctx);
  bdrv_read(bs, 0x1000, buf, 1);
  aio_context_release(ctx);

This patch implements aio_context_acquire() and aio_context_release().

Note that existing aio_poll() callers do not need to worry about
acquiring and releasing - it is only needed when multiple threads will
call aio_poll() on the same AioContext.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agorfifolock: add recursive FIFO lock
Stefan Hajnoczi [Mon, 3 Mar 2014 10:30:03 +0000 (11:30 +0100)]
rfifolock: add recursive FIFO lock

QemuMutex does not guarantee fairness and cannot be acquired
recursively:

Fairness means each locker gets a turn and the scheduler cannot cause
starvation.

Recursive locking is useful for composition, it allows a sequence of
locking operations to be invoked atomically by acquiring the lock around
them.

This patch adds RFifoLock, a recursive lock that guarantees FIFO order.
Its first user is added in the next patch.

RFifoLock has one additional feature: it can be initialized with an
optional contention callback.  The callback is invoked whenever a thread
must wait for the lock.  For example, it can be used to poke the current
owner so that they release the lock soon.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoobject: add object_get_canonical_path_component()
Stefan Hajnoczi [Mon, 3 Mar 2014 10:30:02 +0000 (11:30 +0100)]
object: add object_get_canonical_path_component()

It is often useful to find an object's child property name.  Also use
this new function to simplify the implementation of
object_get_canonical_path().

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Rewrite the snapshot authorization mechanism for block filters.
Benoît Canet [Mon, 3 Mar 2014 18:11:34 +0000 (19:11 +0100)]
block: Rewrite the snapshot authorization mechanism for block filters.

This patch keep the recursive way of doing things but simplify it by giving
two responsabilities to all block filters implementors.

They will need to do two things:

-Set the is_filter field of their block driver to true.

-Implement the bdrv_recurse_is_first_non_filter method of their block driver like
it is done on the Quorum block driver. (block/quorum.c)

[Paolo Bonzini <pbonzini@redhat.com> pointed out that this patch changes
the semantics of blkverify, which now recurses down both bs->file and
s->test_file.
-- Stefan]

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoiotests: Test corruption during COW request
Max Reitz [Mon, 10 Mar 2014 22:44:09 +0000 (23:44 +0100)]
iotests: Test corruption during COW request

Extend test file 060 by a test case for corruption occuring concurrently
to a COW request. QEMU should not crash but rather return an appropriate
error message.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: bs->drv may be NULL in bdrv_debug_resume()
Max Reitz [Mon, 10 Mar 2014 22:44:08 +0000 (23:44 +0100)]
block: bs->drv may be NULL in bdrv_debug_resume()

Currently, bdrv_debug_resume() requires every bs->drv in the BDS stack
to be NULL until a bs->drv with an implementation of bdrv_debug_resume()
is found. For a normal function, this would be fine, but this is a
function for debugging purposes and should therefore allow intermediate
BDS not to have a driver (i.e., be "ejected"). Otherwise, it is hard to
debug such situations.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Check bs->drv in copy_sectors()
Max Reitz [Mon, 10 Mar 2014 22:44:07 +0000 (23:44 +0100)]
qcow2: Check bs->drv in copy_sectors()

Before dereferencing bs->drv for a call to its member bdrv_co_readv(),
copy_sectors() should check whether that pointer is indeed valid, since
it may have been set to NULL by e.g. a concurrent write triggering the
corruption prevention mechanism.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Update image size in bdrv_invalidate_cache()
Kevin Wolf [Tue, 11 Mar 2014 09:58:39 +0000 (10:58 +0100)]
block: Update image size in bdrv_invalidate_cache()

After migration has completed, we call bdrv_invalidate_cache() so that
drivers which cache some data drop their stale copy of the data and
reread it from the image file to get a new version of data that the
source modified while the migration was running.

Reloading metadata from the image file is useless, though, if the size
of the image file stays stale (this is a value that is cached for all
image formats in block.c). Reads from (meta)data after the old EOF
return only zeroes, causing image corruption.

We need to update bs->total_sectors in all layers that could potentially
have changed their size (i.e. backing files are not a concern - if they
are changed, we're in bigger trouble)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2-refcount: Sanitize refcount table entry
Max Reitz [Fri, 7 Mar 2014 22:10:12 +0000 (23:10 +0100)]
qcow2-refcount: Sanitize refcount table entry

When reading the refcount table entry in get_refcount(), only bits which
are actually significant for the refcount block offset should be taken
into account.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/afaerber/tags/prep-for-upstream' into staging
Peter Maydell [Wed, 12 Mar 2014 17:53:37 +0000 (17:53 +0000)]
Merge remote-tracking branch 'remotes/afaerber/tags/prep-for-upstream' into staging

PReP machine and devices

* ppc_rom.bin update and submodule

# gpg: Signature made Wed 12 Mar 2014 17:32:40 GMT using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/prep-for-upstream:
  prep: Update ppc_rom.bin
  Add OpenHack'Ware submodule

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Wed, 12 Mar 2014 16:45:25 +0000 (16:45 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

Net patches

# gpg: Signature made Wed 12 Mar 2014 13:48:20 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/net-pull-request:
  tap: avoid deadlocking rx

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoprep: Update ppc_rom.bin
Andreas Färber [Sun, 2 Mar 2014 21:27:14 +0000 (22:27 +0100)]
prep: Update ppc_rom.bin

Functionally, this is a revert of Jocelyn's r3309 /
55aa45ddde3283cdd781326d001f7456bf02f684 (Quickly hack PowerPC BIOS
able to boot on CDROM again.), for which we do not have the sources.

Therefore the sources used are v0.4.1 plus pc-bios/ohw.diff plus a
workaround turning IDE errors into warnings.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
10 years agoAdd OpenHack'Ware submodule
Andreas Färber [Wed, 12 Mar 2014 16:16:56 +0000 (17:16 +0100)]
Add OpenHack'Ware submodule

This replaces the ohw.diff file on top of v0.4.1.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Peter Maydell [Wed, 12 Mar 2014 15:46:43 +0000 (15:46 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

Tracing pull request

# gpg: Signature made Wed 12 Mar 2014 13:20:10 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/tracing-pull-request:
  trace: Fix build warnings for Win32 build

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-misc-1' into staging
Peter Maydell [Wed, 12 Mar 2014 15:03:42 +0000 (15:03 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-misc-1' into staging

Docs: Introduce multiport serial support in qemupciserial.inf.

# gpg: Signature made Wed 12 Mar 2014 09:35:55 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-misc-1:
  Docs: Introduce multiport serial support in qemupciserial.inf.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotrace: Fix build warnings for Win32 build
Peter Maydell [Thu, 20 Feb 2014 19:44:25 +0000 (19:44 +0000)]
trace: Fix build warnings for Win32 build

The Win32 build warns about trace/control-internal.h:

warning: 'trace_event_count' declared inline after being called

Fix this by simply reordering trace_event_id() and
trace_event_count().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/kiszka/queues/slirp' into staging
Peter Maydell [Wed, 12 Mar 2014 12:47:26 +0000 (12:47 +0000)]
Merge remote-tracking branch 'remotes/kiszka/queues/slirp' into staging

* remotes/kiszka/queues/slirp:
  slirp smb with modern win guests when samba is also running on host
  qemu/slirp: Fix SMB security configuration on newer samba versions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging
Peter Maydell [Wed, 12 Mar 2014 11:44:59 +0000 (11:44 +0000)]
Merge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging

* remotes/mcayland/qemu-sparc:
  target-sparc: Add and use CPU_FEATURE_CASA

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Wed, 12 Mar 2014 10:47:07 +0000 (10:47 +0000)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  tests: test-qmp-commands: Fix double free
  qapi script: do not add "_" for every capitalized char in enum
  qapi script: do not allow string discriminator
  qapi: convert BlockdevOptions to use enum discriminator
  qapi script: support enum type as discriminator in union
  qapi script: use same function to generate enum string
  qapi script: code move for generate_enum_name()
  qapi script: check correctness of union
  qapi script: remember line number in schema parsing
  qapi script: add check for duplicated key
  qapi script: remember explicitly defined enum values

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoDocs: Introduce multiport serial support in qemupciserial.inf.
Miki Mishael [Sun, 19 Jan 2014 16:43:05 +0000 (11:43 -0500)]
Docs: Introduce multiport serial support in qemupciserial.inf.

      Support for pci-serial-2x and pci-serial-4x
      was added to the inf file.
      Standard Windows driver mf.sys used to
      split single function device into per-port nodes.

Signed-off-by: Miki Mishael <mmishael@redhat.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agotap: avoid deadlocking rx
Stefan Hajnoczi [Sat, 8 Mar 2014 15:00:43 +0000 (16:00 +0100)]
tap: avoid deadlocking rx

The net subsystem has a control flow mechanism so peer NetClientStates
can tell each other to stop sending packets.  This is used to stop
monitoring the tap file descriptor for incoming packets if the guest rx
ring has no spare buffers.

There is a corner case when tap_can_send() is true at the beginning of
an event loop iteration but becomes false before the tap_send() fd
handler is invoked.

tap_send() will read the packet from the tap file descriptor and attempt
to send it.  The net queue will hold on to the packet and return 0,
indicating that further I/O is not possible.  tap then stops monitoring
the file descriptor for reads.

This is unlike the normal case where tap_can_send() is the same before
and during the event loop iteration.  The event loop would simply not
monitor the file descriptor if tap_can_send() returns true.  Upon next
iteration it would check tap_can_send() again and begin monitoring if we
can send.

The deadlock happens because tap_send() explicitly disabled read_poll.
This is done with the expectation that the peer will call
qemu_net_queue_flush().  But hw/net/virtio-net.c does not monitor
vm_running transitions and issue the flush.  Hence we're left with a
broken tap device.

Cc: qemu-stable@nongnu.org
Reported-by: Neil Skrypuch <neil@tembosocial.com>
Tested-by: Neil Skrypuch <neil@tembosocial.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoslirp smb with modern win guests when samba is also running on host
Michael Tokarev [Thu, 28 Nov 2013 19:32:55 +0000 (23:32 +0400)]
slirp smb with modern win guests when samba is also running on host

After numerous reports that -smb (or -netdev user,smb=foo) not working
with modern windows (win7 and vista are reported as non-working), I
started digging myself.  And found that indeed it doesn't work, and
why.

The thing is that modern win tries to connect to port 445 (microsoft-ds)
first, and if that fails, it falls back to old port 139 (netbios-ssn).

slirp code in qemu only redirects port 139, it does not touch port 445.

So the prob is that if samba is also running on the host, guest will try
to communicate using port 445, and that will succed, but ofcourse guest
will not talk with our samba but with samba running on the host.

If samba is not running on the host, guest will fall back to port 139,
and will reach the redirecting rule and qemu will spawn smbd correctly.

The solution is to redirect both ports (139 and 445), and the fix is
a one-liner, adding second call to slirp_add_exec() at the end of
net/slirp.c:slirp_smb() function (provided below).

But it looks like that is not a proper fix really, since in theory
we should redirect both ports to the SAME, single samba instance,
but I'm not sure this is possible with slirp.  Well, even if two
smbd processes will be run on the same config dir, it should not
be a problem.

The one-liner (not exactly 1 since it touches previous line too) is like
this:

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
10 years agoqemu/slirp: Fix SMB security configuration on newer samba versions
Michael Buesch [Fri, 1 Nov 2013 11:23:49 +0000 (12:23 +0100)]
qemu/slirp: Fix SMB security configuration on newer samba versions

The smb.conf automatically generated by qemu's -smb option fails on current
samba, because smbd rejects the security=share option with the following warning:

>   WARNING: Ignoring invalid value 'share' for parameter 'security'

Which makes it fall back to security=user without guest login.
This results in being unable to login to the samba server from the guest OS.

This fixes it by selecting 'user' explicitly and mapping
unknown users to guest logins.

Signed-off-by: Michael Buesch <m@bues.ch>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
10 years agotarget-sparc: Add and use CPU_FEATURE_CASA
Sebastian Huber [Tue, 11 Mar 2014 09:36:00 +0000 (10:36 +0100)]
target-sparc: Add and use CPU_FEATURE_CASA

The LEON3 processor has support for the CASA instruction which is
normally only available for SPARC V9 processors.  Binutils 2.24
and GCC 4.9 will support this instruction for LEON3.  GCC uses it to
generate C11 atomic operations.

The CAS synthetic instruction uses an ASI of 0x80.  If TARGET_SPARC64 is
not defined use a supervisor data load/store for an ASI of 0x80 in
helper_ld_asi()/helper_st_asi().  The supervisor data load/store was
choosen according to the LEON3 documentation.

The ASI 0x80 is defined in the SPARC V9 manual, Table 12—Address Space
Identifiers (ASIs).  Here we have: 0x80, ASI_PRIMARY, Unrestricted
access, Primary address space.

Tested with the following program:

  #include <assert.h>
  #include <stdatomic.h>

  void test(void)
  {
    atomic_int a;
    int e;
    _Bool b;

    atomic_store(&a, 1);
    e = 1;
    b = atomic_compare_exchange_strong(&a, &e, 2);
    assert(b);
    assert(atomic_load(&a) == 2);

    atomic_store(&a, 3);
    e = 4;
    b = atomic_compare_exchange_strong(&a, &e, 5);
    assert(!b);
    assert(atomic_load(&a) == 3);
  }

Tested also on a NGMP board with a LEON4 processor.

Reviewed-by: Fabien Chouteau <chouteau@adacore.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Tue, 11 Mar 2014 19:52:32 +0000 (19:52 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

acpi,pc,test bug fixes

More small fixes: the issues annoy developers so
I thought they are worth fixing quickly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Tue 11 Mar 2014 11:27:44 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  acpi-test: update expected SSDT files
  acpi-build: don't access unaligned addresses
  q35: Correct typo BRDIGE -> BRIDGE
  configure: don't modify .status on error
  pc: avoid duplicate names for ROM MRs
  loader: rename in_ram/has_mr

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kvm/uq/master' into staging
Peter Maydell [Tue, 11 Mar 2014 19:39:17 +0000 (19:39 +0000)]
Merge remote-tracking branch 'remotes/kvm/uq/master' into staging

* remotes/kvm/uq/master:
  target-i386: bugfix of Intel MPX
  file_ram_alloc: unify mem-path,mem-prealloc error handling
  kvm-all: exit in case max vcpus exceeded

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoqemu-thread-posix: Fix build against older glibc version
Jan Kiszka [Tue, 11 Mar 2014 15:49:23 +0000 (16:49 +0100)]
qemu-thread-posix: Fix build against older glibc version

pthread_setname_np was introduced with 2.12.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140310' into...
Peter Maydell [Tue, 11 Mar 2014 13:20:23 +0000 (13:20 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140310' into staging

target-arm queue:
 * implement WFE as yield (improves performance with emulated SMP)
 * fixes to avoid undefined behaviour shifting left into sign bit
 * libvixl format string fixes for 32 bit hosts
 * fix build error when intptr_t and tcg_target_long are different
   sizes (eg x32)
 * implement PMCCNTR register
 * fix incorrect setting of E bit in CPSR (broke booting under
   KVM on ARM)

# gpg: Signature made Mon 10 Mar 2014 15:05:25 GMT using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20140310:
  target-arm: Implement WFE as a yield operation
  hw/arm/musicpal: Avoid shifting left into sign bit
  hw/ssi/xilinx_spips.c: Avoid shifting left into sign bit
  hw/arm/omap1.c: Avoid shifting left into sign bit
  pxa2xx: Don't shift into sign bit
  libvixl: Fix format strings for several int64_t values
  target-arm: Fix intptr_t vs tcg_target_long
  target-arm: Implements the ARM PMCCNTR register
  target-arm: Fix incorrect setting of E bit in CPSR

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotests: test-qmp-commands: Fix double free
Luiz Capitulino [Sat, 8 Mar 2014 17:20:06 +0000 (12:20 -0500)]
tests: test-qmp-commands: Fix double free

The ret variable is freed twice, but on the second time we actually want
to free ret3 instead. Don't know why this didn't explode.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: do not add "_" for every capitalized char in enum
Wenchao Xia [Wed, 5 Mar 2014 02:44:40 +0000 (18:44 -0800)]
qapi script: do not add "_" for every capitalized char in enum

Now "enum AIOContext" will generate AIO_CONTEXT instead of A_I_O_CONTEXT,
"X86CPU" will generate X86_CPU instead of X86_C_P_U.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: do not allow string discriminator
Wenchao Xia [Wed, 5 Mar 2014 02:44:39 +0000 (18:44 -0800)]
qapi script: do not allow string discriminator

Since enum based discriminators provide better type-safety and
ensure that future qapi additions do not forget to adjust dependent
unions, forbid using string as discriminator from now on.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: convert BlockdevOptions to use enum discriminator
Wenchao Xia [Wed, 5 Mar 2014 02:44:38 +0000 (18:44 -0800)]
qapi: convert BlockdevOptions to use enum discriminator

After this patch, hidden enum type BlockdevOptionsKind will not
be generated, and other API can use enum BlockdevDriver.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: support enum type as discriminator in union
Wenchao Xia [Fri, 7 Mar 2014 01:08:56 +0000 (17:08 -0800)]
qapi script: support enum type as discriminator in union

By default, any union will automatically generate a enum type as
"[UnionName]Kind" in C code, and it is duplicated when the discriminator
is specified as a pre-defined enum type in schema. After this patch,
the pre-defined enum type will be really used as the switch case
condition in generated C code, if discriminator is an enum field.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: use same function to generate enum string
Wenchao Xia [Wed, 5 Mar 2014 02:44:36 +0000 (18:44 -0800)]
qapi script: use same function to generate enum string

Prior to this patch, qapi-visit.py used custom code to generate enum
names used for handling a qapi union. Fix it to instead reuse common
code, with identical generated results, and allowing future updates to
generation to only need to touch one place.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: code move for generate_enum_name()
Wenchao Xia [Wed, 5 Mar 2014 02:44:35 +0000 (18:44 -0800)]
qapi script: code move for generate_enum_name()

Later both qapi-types.py and qapi-visit.py need a common function
for enum name generation.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: check correctness of union
Wenchao Xia [Wed, 5 Mar 2014 02:44:34 +0000 (18:44 -0800)]
qapi script: check correctness of union

Since line info is remembered as QAPISchema.line now, this patch
uses it as additional info for every expr in QAPISchema inside qapi.py,
then improves error message with it in checking of exprs.

For common union the patch will check whether base is a valid complex
type if specified. For flat union it will check whether base presents,
whether discriminator is found in base, whether the key of every branch
is correct when discriminator is an enum type.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: remember line number in schema parsing
Wenchao Xia [Wed, 5 Mar 2014 02:44:33 +0000 (18:44 -0800)]
qapi script: remember line number in schema parsing

Before this patch, 'QAPISchemaError' scans whole input until 'pos'
to get error line number. After this patch, the scan is avoided since
line number is remembered in schema parsing. This patch also benefits
other error report functions, which would be introduced later.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: add check for duplicated key
Wenchao Xia [Wed, 5 Mar 2014 02:44:32 +0000 (18:44 -0800)]
qapi script: add check for duplicated key

It is bad that same key was specified twice, especially when a union has
two branches with same condition. This patch can prevent it.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: remember explicitly defined enum values
Wenchao Xia [Wed, 5 Mar 2014 02:44:31 +0000 (18:44 -0800)]
qapi script: remember explicitly defined enum values

Later other scripts will need to check the enum values.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/spice/tags/pull-spice-4' into staging
Peter Maydell [Tue, 11 Mar 2014 13:03:21 +0000 (13:03 +0000)]
Merge remote-tracking branch 'remotes/spice/tags/pull-spice-4' into staging

minor spice patches.

# gpg: Signature made Mon 10 Mar 2014 13:13:14 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-4:
  configure: Prettify message for hosts without spice support
  spice: QemuUIInfo windup
  spice: fix simple display surface handling

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-5' into staging
Peter Maydell [Tue, 11 Mar 2014 12:52:08 +0000 (12:52 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-5' into staging

input: fixes for the rewrite.

# gpg: Signature made Mon 10 Mar 2014 12:50:25 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-input-5:
  input: map INPUT_BUTTON_WHEEL_{UP,DOWN} to legacy input z axis moves.
  input: sdl: fix guest_cursor logic.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoacpi-test: update expected SSDT files
Michael S. Tsirkin [Mon, 10 Mar 2014 19:13:59 +0000 (21:13 +0200)]
acpi-test: update expected SSDT files

SSDT doesn't have _SUN for non hotpluggable slots
anymore.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-build: don't access unaligned addresses
Michael S. Tsirkin [Mon, 10 Mar 2014 19:30:16 +0000 (21:30 +0200)]
acpi-build: don't access unaligned addresses

casting an unaligned address to e.g.
uint32_t can trigger undefined behaviour in C.
Replace cast + assignment with memcpy.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoq35: Correct typo BRDIGE -> BRIDGE
BALATON Zoltan [Fri, 28 Feb 2014 10:28:03 +0000 (11:28 +0100)]
q35: Correct typo BRDIGE -> BRIDGE

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoconfigure: don't modify .status on error
Michael S. Tsirkin [Sun, 9 Mar 2014 15:37:49 +0000 (17:37 +0200)]
configure: don't modify .status on error

./configure --help
make

will try to re-run configure with --help
which isn't what was intended.

The reason is that config.status was written
even on configure error.
Defer writing config.status until configure
has completed successfully.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10 years agopc: avoid duplicate names for ROM MRs
Michael S. Tsirkin [Thu, 6 Mar 2014 12:57:09 +0000 (14:57 +0200)]
pc: avoid duplicate names for ROM MRs

Since
commit 04920fc0faa4760f9c4fc0e73b992b768099be70
    loader: store FW CFG ROM files in RAM
RAM MRs including ROM files in FW CFGs are created
and named using the file basename.

This becomes problematic if these names are
supplied by user, since the basename might not
be unique.

There are two cases we care about:
- option-rom flag.
- option ROM for devices. This triggers e.g. when
  using rombar=0.

At the moment we get an assert. E.g
qemu -option-rom /usr/share/ipxe/8086100e.rom -option-rom
/usr/share/ipxe.efi/8086100e.rom
RAMBlock "/rom@genroms/8086100e.rom" already registered, abort!

This is a regression from 1.6.

For now let's keep it simple and just avoid creating the
MRs in case of option ROMs.

when using 1.7 machine types, enable
option ROMs in RAM to match that version.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-1' into staging
Peter Maydell [Tue, 11 Mar 2014 10:53:17 +0000 (10:53 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-1' into staging

vnc dirty tracking optinizations.
various vnc bugfixes.

# gpg: Signature made Mon 10 Mar 2014 12:39:54 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vnc-1:
  ui/vnc: disable adaptive update calculations if not needed
  ui/vnc: optimize setting in vnc_dpy_update()
  ui/vnc: optimize clearing in find_and_clear_dirty_height()
  ui/vnc: optimize dirty bitmap tracking
  ui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BIT
  ui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macro
  vnc: fix use-after-free in vnc_update_client_sync
  vnc: Fix qemu crashed when vnc client disconnect suddenly
  vnc: Fix tight_detect_smooth_image() for lossless case

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-i386: bugfix of Intel MPX
Liu, Jinsong [Mon, 3 Mar 2014 05:24:14 +0000 (05:24 +0000)]
target-i386: bugfix of Intel MPX

The correct size of cpuid 0x0d sub-leaf 4 is 0x40, not 0x10.
This is confirmed by Anvin H Peter and Mallick Asit K.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Asit K Mallick <asit.k.mallick@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Mon, 10 Mar 2014 19:14:11 +0000 (19:14 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

acpi,pc,pci,virtio,memory bug fixes

This collects several small fixes from all over the place.
Additionally, Marcel's changes make acpi unit tests more robust.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sun 09 Mar 2014 19:14:57 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  qemu: x86: ignore ioapic polarity
  pckbd: return 'keyboard enabled' on read input port command
  pam: partly fix write-only mode
  acpi-test: issue errors instead of warnings when possible
  acpi-test: retain both asl and aml files on failure
  MAINTAINERS: drop an out of date address
  Add a 'name' parameter to qemu_thread_create
  Add 'debug-threads' suboption to --name
  Rework --name to use QemuOpts
  PCIE: fix regression with coldplugged multifunction device
  memory_region_present: return false if address is not found in child MemoryRegion
  virtio-net: remove function calls from assert
  acpi-test-data: update expected files
  acpi-build: append description for non-hotplug

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agos390/kvm: Add Maintainers for s390/kvm
Christian Borntraeger [Thu, 6 Mar 2014 08:49:25 +0000 (09:49 +0100)]
s390/kvm: Add Maintainers for s390/kvm

Lets add Conny and myself as maintainers for s390/kvm and
related code. This does not include any tcg related code,
which is maintained by Richard and Alex.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Message-id: 1394095765-29686-2-git-send-email-borntraeger@de.ibm.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging
Peter Maydell [Mon, 10 Mar 2014 16:22:39 +0000 (16:22 +0000)]
Merge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging

* remotes/riku/linux-user-for-upstream:
  linux-user: set minimum kernel version to 2.6.32
  linux-user: correct handling of break exception for MIPS
  linux-user: translate signal number on return from sigtimedwait
  linux-user: Implement sendmmsg syscall
  linux-user: Fix getresuid, getresgid if !USE_UID16
  linux-user: Don't use UID16 on AArch64
  linux-user: AArch64: Implement SA_RESTORER for signal handlers
  linux-user/signal.c: Fix AArch64 big-endian FP register restore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mcayland/qemu-openbios' into staging
Peter Maydell [Mon, 10 Mar 2014 15:36:12 +0000 (15:36 +0000)]
Merge remote-tracking branch 'remotes/mcayland/qemu-openbios' into staging

* remotes/mcayland/qemu-openbios:
  Update OpenBIOS images

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Implement WFE as a yield operation
Peter Maydell [Mon, 10 Mar 2014 14:56:30 +0000 (14:56 +0000)]
target-arm: Implement WFE as a yield operation

Implement WFE to yield our timeslice to the next CPU.
This avoids slowdowns in multicore configurations caused
by one core busy-waiting on a spinlock which can't possibly
be unlocked until the other core has an opportunity to run.
This speeds up my test case A15 dual-core boot by a factor
of three (though it is still four or five times slower than
a single-core boot).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1393339545-22111-1-git-send-email-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Rob Herring <rob.herring@linaro.org>
10 years agohw/arm/musicpal: Avoid shifting left into sign bit
Peter Maydell [Mon, 10 Mar 2014 14:56:30 +0000 (14:56 +0000)]
hw/arm/musicpal: Avoid shifting left into sign bit

Add missing 'U' suffixes to avoid shifting left into sign
bit of a signed integer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1392988008-15938-5-git-send-email-peter.maydell@linaro.org

10 years agohw/ssi/xilinx_spips.c: Avoid shifting left into sign bit
Peter Maydell [Mon, 10 Mar 2014 14:56:30 +0000 (14:56 +0000)]
hw/ssi/xilinx_spips.c: Avoid shifting left into sign bit

Add missing 'U' suffix to avoid shifting left into sign bit of
a signed integer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1392988008-15938-4-git-send-email-peter.maydell@linaro.org

10 years agohw/arm/omap1.c: Avoid shifting left into sign bit
Peter Maydell [Mon, 10 Mar 2014 14:56:29 +0000 (14:56 +0000)]
hw/arm/omap1.c: Avoid shifting left into sign bit

Add missing 'U' suffix to avoid shifting left into sign bit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1392988008-15938-3-git-send-email-peter.maydell@linaro.org

10 years agopxa2xx: Don't shift into sign bit
Peter Maydell [Mon, 10 Mar 2014 14:56:29 +0000 (14:56 +0000)]
pxa2xx: Don't shift into sign bit

Add  missing 'U' suffixes to avoid potentially shifting into
the sign bit of a signed integer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1392988008-15938-2-git-send-email-peter.maydell@linaro.org

10 years agolibvixl: Fix format strings for several int64_t values
Stefan Weil [Mon, 10 Mar 2014 14:56:29 +0000 (14:56 +0000)]
libvixl: Fix format strings for several int64_t values

"%d" or "%x" won't work on hosts where int values are smaller than 64 bit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1394219753-26106-1-git-send-email-sw@weilnetz.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Fix intptr_t vs tcg_target_long
Richard Henderson [Mon, 10 Mar 2014 14:56:29 +0000 (14:56 +0000)]
target-arm: Fix intptr_t vs tcg_target_long

Fixes a build error when these are different, e.g. x32.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-id: 1394043257-4800-1-git-send-email-rth@twiddle.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Implements the ARM PMCCNTR register
Alistair Francis [Mon, 10 Mar 2014 14:56:28 +0000 (14:56 +0000)]
target-arm: Implements the ARM PMCCNTR register

This patch implements the ARM PMCCNTR register including
the disable and reset components of the PMCR register.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: bbf405e1feaf352cf39d5db402c9efcbd0f57c78.1393459802.git.alistair.francis@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Fix incorrect setting of E bit in CPSR
Peter Maydell [Mon, 10 Mar 2014 14:56:28 +0000 (14:56 +0000)]
target-arm: Fix incorrect setting of E bit in CPSR

Commit 4cc35614a moved the exception mask bits out of env->uncached_cpsr
and into env->daif. However the env->daif contents are AArch64 style
mask bits, which include not just the AArch32 AIF bits but also the
new D bit (masks debug exceptions). This means that when reconstructing
the AArch32 CPSR value we must not allow the D bit in env->daif to get
into the CPSR, because the corresponding bit in the CPSR is E, the
endianness bit.

This bug didn't affect execution under TCG because we don't implement
endianness-swapping and so simply ignored the E bit; however it meant
that kernel booting under KVM failed, because KVM does honour the E bit.

Reported-by: Alexey Ignatov <lexszero@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoconfigure: Prettify message for hosts without spice support
Stefan Weil [Thu, 6 Mar 2014 17:13:33 +0000 (18:13 +0100)]
configure: Prettify message for hosts without spice support

Instead of

    spice support     no (/)

configure now prints

    spice support     no

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agospice: QemuUIInfo windup
Gerd Hoffmann [Fri, 24 Jan 2014 17:47:20 +0000 (18:47 +0100)]
spice: QemuUIInfo windup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agospice: fix simple display surface handling
Gerd Hoffmann [Fri, 24 Jan 2014 09:48:58 +0000 (10:48 +0100)]
spice: fix simple display surface handling

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: map INPUT_BUTTON_WHEEL_{UP,DOWN} to legacy input z axis moves.
Gerd Hoffmann [Mon, 10 Mar 2014 08:31:01 +0000 (09:31 +0100)]
input: map INPUT_BUTTON_WHEEL_{UP,DOWN} to legacy input z axis moves.

Unbreaks mouse wheel.

Reported-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: sdl: fix guest_cursor logic.
Gerd Hoffmann [Mon, 10 Mar 2014 08:22:16 +0000 (09:22 +0100)]
input: sdl: fix guest_cursor logic.

Unbreaks relative mouse mode with SDL.

Reported-by: Gabriel L. Somlo <gsomlo@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/rth/tcg-aarch-6-1' into staging
Peter Maydell [Mon, 10 Mar 2014 12:34:41 +0000 (12:34 +0000)]
Merge remote-tracking branch 'remotes/rth/tcg-aarch-6-1' into staging

* remotes/rth/tcg-aarch-6-1:
  tcg-aarch64: Remove nop from qemu_st slow path
  tcg-aarch64: Simplify tcg_out_ldst_9 encoding
  tcg-aarch64: Use intptr_t apropriately
  tcg-aarch64: Remove the shift_imm parameter from tcg_out_cmp
  tcg-aarch64: Hoist common argument loads in tcg_out_op
  tcg-aarch64: Don't handle mov/movi in tcg_out_op
  tcg-aarch64: Set ext based on TCG_OPF_64BIT
  tcg-aarch64: Change all ext variables to TCGType
  tcg-aarch64: Remove redundant CPU_TLB_ENTRY_BITS check
  tcg-aarch64: Enable builtin disassembler

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agolinux-user: set minimum kernel version to 2.6.32
Riku Voipio [Wed, 19 Feb 2014 12:50:41 +0000 (14:50 +0200)]
linux-user: set minimum kernel version to 2.6.32

Popular glibc based distributions[1] require minimum
2.6.32 as kernel version. For some targets 2.6.18
would be enough, but dropping so low would mean some
suboptimal system calls could get used.

Set the minimum kernel advertized to 2.6.32 for
all architectures but aarch64 to ensure working qemu
linux-user in case host kernel is older.

[1] https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/921078

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20140308-1' into...
Peter Maydell [Mon, 10 Mar 2014 11:48:42 +0000 (11:48 +0000)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20140308-1' into staging

migration/next for 20140308

# gpg: Signature made Sat 08 Mar 2014 21:26:01 GMT using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* remotes/juanquintela/tags/migration/20140308-1:
  migration: extend section_start/end traces
  vl: add system_wakeup_request tracepoint
  qemu_file: Fix mismerge of "use fwrite() correctly"
  XBZRLE: Fix qemu crash when resize the xbzrle cache

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoui/vnc: disable adaptive update calculations if not needed
Peter Lieven [Wed, 8 Jan 2014 09:08:38 +0000 (10:08 +0100)]
ui/vnc: disable adaptive update calculations if not needed

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoui/vnc: optimize setting in vnc_dpy_update()
Peter Lieven [Wed, 8 Jan 2014 09:08:37 +0000 (10:08 +0100)]
ui/vnc: optimize setting in vnc_dpy_update()

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoui/vnc: optimize clearing in find_and_clear_dirty_height()
Peter Lieven [Wed, 8 Jan 2014 09:08:36 +0000 (10:08 +0100)]
ui/vnc: optimize clearing in find_and_clear_dirty_height()

The following artifical test (just the bitmap operation part) running
vnc_update_client 65536 times on a 2560x2048 surface illustrates the
performance difference:

All bits clean - vnc_update_client_new: 0.07 secs
                 vnc_update_client_new2: 0.07 secs
                 vnc_update_client_old: 10.98 secs

All bits dirty - vnc_update_client_new: 11.26 secs
               - vnc_update_client_new2: 0.29 secs
                 vnc_update_client_old: 20.19 secs

Few bits dirty - vnc_update_client_new: 0.07 secs
               - vnc_update_client_new2: 0.07 secs
                 vnc_update_client_old: 10.98 secs

vnc_update_client_new2 shows the performance of vnc_update_client
with this patch added.

Comparing with the test run of the last patch the performance
is at least unchanged while it is significantly improved
for the all bits dirty case.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoui/vnc: optimize dirty bitmap tracking
Peter Lieven [Wed, 8 Jan 2014 09:08:35 +0000 (10:08 +0100)]
ui/vnc: optimize dirty bitmap tracking

vnc_update_client currently scans the dirty bitmap of each client
bitwise which is a very costly operation if only few bits are dirty.
vnc_refresh_server_surface does almost the same.
this patch optimizes both by utilizing the heavily optimized
function find_next_bit to find the offset of the next dirty
bit in the dirty bitmaps.

The following artifical test (just the bitmap operation part) running
vnc_update_client 65536 times on a 2560x2048 surface illustrates the
performance difference:

All bits clean - vnc_update_client_new: 0.07 secs
 vnc_update_client_old: 10.98 secs

All bits dirty - vnc_update_client_new: 11.26 secs
 vnc_update_client_old: 20.19 secs

Few bits dirty - vnc_update_client_new: 0.08 secs
 vnc_update_client_old: 10.98 secs

The case for all bits dirty is still rather slow, this
is due to the implementation of find_and_clear_dirty_height.
This will be addresses in a separate patch.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BIT
Peter Lieven [Wed, 8 Jan 2014 09:08:34 +0000 (10:08 +0100)]
ui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BIT

this allows for setting VNC_DIRTY_PIXELS_PER_BIT to different
values than 16 if desired.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macro
Peter Lieven [Wed, 8 Jan 2014 09:08:33 +0000 (10:08 +0100)]
ui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macro

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agovnc: fix use-after-free in vnc_update_client_sync
Gerd Hoffmann [Thu, 6 Mar 2014 12:54:28 +0000 (13:54 +0100)]
vnc: fix use-after-free in vnc_update_client_sync

Spotted by Coverity:

876     static int vnc_update_client_sync(VncState *vs, int has_dirty)
877     {

(1) Event freed_arg:    "vnc_update_client(VncState *, int)" frees "vs".  [details]
Also see events:        [deref_arg]

878         int ret = vnc_update_client(vs, has_dirty);

(2) Event deref_arg:    Calling "vnc_jobs_join(VncState *)" dereferences freed pointer "vs". [details]
Also see events:        [freed_arg]

879         vnc_jobs_join(vs);
880         return ret;
881     }

Remove vnc_update_client_sync wrapper, replace it with an additional
argument to vnc_update_client, so we can so the sync properly in
vnc_update_client (i.e. skip it in case of a client disconnect).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
10 years agovnc: Fix qemu crashed when vnc client disconnect suddenly
Gonglei (Arei) [Thu, 23 Jan 2014 13:30:57 +0000 (13:30 +0000)]
vnc: Fix qemu crashed when vnc client disconnect suddenly

Hi,

When I use RealVNC viewer client (http://www.realvnc.com/) to connect vnc server,
the client disconnect suddenly, and I click reconnect button immediately, then the Qemu crashed.

In the function vnc_worker_thread_loop, will call vnc_async_encoding_start
to set the local vs->output buffer by global queue's buffer. Then send rectangles to
the vnc client call function vnc_send_framebuffer_update. Finally, Under normal circumstances,
call vnc_async_encoding_end to set the global queue'buffer by the local vs->output conversely.

When the vnc client disconnect, the job->vs->csock will be set to -1. And the current prcoess
logic will goto disconnected partion without call function vnc_async_encoding_end.
But, the function vnc_send_framebuffer_update will call buffer_reserve, which
maybe call g_realloc reset the local vs's buffer, meaning the global queue's buffer is modified also.
If anyone use the original global queue's buffer memory will cause corruption and then crash qemu.

This patch assure the function vnc_async_encoding_end being called
even though the vnc client disconnect suddenly.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agovnc: Fix tight_detect_smooth_image() for lossless case
Markus Armbruster [Fri, 21 Feb 2014 15:42:52 +0000 (16:42 +0100)]
vnc: Fix tight_detect_smooth_image() for lossless case

VncTight member uint8_t quality is either (uint8_t)-1 for lossless or
less than 10 for lossy.

tight_detect_smooth_image() first promotes it to int, then compares
with -1.  Always unequal, so we always execute the lossy code.  Reads
beyond tight_conf[] and returns crap when quality is actually
lossless.

Compare to (uint8_t)-1 instead, like we do elsewhere.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoUpdate OpenBIOS images
Mark Cave-Ayland [Mon, 10 Mar 2014 08:48:31 +0000 (08:48 +0000)]
Update OpenBIOS images

Update OpenBIOS images to SVN r1280 built from submodule.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
10 years agoloader: rename in_ram/has_mr
Michael S. Tsirkin [Sun, 9 Mar 2014 16:42:06 +0000 (18:42 +0200)]
loader: rename in_ram/has_mr

we put copy of ROMs in MR for migration.
but the name rom_in_ram makes one think we
load it in guest RAM.
Rename has_mr to make intent clearer.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqemu: x86: ignore ioapic polarity
Gabriel L. Somlo [Fri, 28 Feb 2014 18:57:19 +0000 (13:57 -0500)]
qemu: x86: ignore ioapic polarity

Both QEMU and KVM have already accumulated a significant number of
optimizations based on the hard-coded assumption that ioapic polarity
will always use the ActiveHigh convention, where the logical and
physical states of level-triggered irq lines always match (i.e.,
active(asserted) == high == 1, inactive == low == 0). QEMU guests
are expected to follow directions given via ACPI and configure the
ioapic with polarity 0 (ActiveHigh). However, even when misbehaving
guests (e.g. OS X <= 10.9) set the ioapic polarity to 1 (ActiveLow),
QEMU will still use the ActiveHigh signaling convention when
interfacing with the emulated ioapic.

This patch modifies the emulated ioapic to completely ignore polarity
as set by the guest OS, enabling misbehaving guests to work alongside
those which comply with the ActiveHigh polarity specified by QEMU's
ACPI tables.

Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopckbd: return 'keyboard enabled' on read input port command
Hervé Poussineau [Tue, 11 Feb 2014 22:46:03 +0000 (23:46 +0100)]
pckbd: return 'keyboard enabled' on read input port command

Bit 7 of Input Port is the keyboard inhibit switch.
0 means keyboard inhibited, while 1 means keyboard enabled.

Incidentaly, this also fixes an error encountered while booting
an Award BIOS: "Keyboard is locked out - Unlock the key".

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopam: partly fix write-only mode
Hervé Poussineau [Tue, 11 Feb 2014 22:46:02 +0000 (23:46 +0100)]
pam: partly fix write-only mode

In write-only mode, writes are forwarded to RAM, while reads should not be
handled (ie should return 0xff).
Assume that in this mode, no read access is ever done, as they shouldn't
give any sensible result.

So, in write-only mode, alias PAM region to RAM, instead of PCI memory
(which can even be mapped to some device!)

This fixes Award BIOS, which use this mode to shadow system BIOS and video BIOS.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-test: issue errors instead of warnings when possible
Marcel Apfelbaum [Thu, 27 Feb 2014 14:17:32 +0000 (16:17 +0200)]
acpi-test: issue errors instead of warnings when possible

If the expected (offline) acpi tables loaded correctly,
it is safe to assume the iasl installation is OK and
issue an error if the actual tables failed to load.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-test: retain both asl and aml files on failure
Marcel Apfelbaum [Thu, 27 Feb 2014 14:17:31 +0000 (16:17 +0200)]
acpi-test: retain both asl and aml files on failure

Updated the error message while at it.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMAINTAINERS: drop an out of date address
Michael S. Tsirkin [Wed, 19 Feb 2014 13:46:07 +0000 (15:46 +0200)]
MAINTAINERS: drop an out of date address

Gleb's address seems to be out of date.  Since it stayed like that for a
while now, I'm guessing he's no longer interested in getting mail.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoAdd a 'name' parameter to qemu_thread_create
Dr. David Alan Gilbert [Thu, 30 Jan 2014 10:20:32 +0000 (10:20 +0000)]
Add a 'name' parameter to qemu_thread_create

If enabled, set the thread name at creation (on GNU systems with
  pthread_set_np)
Fix up all the callers with a thread name

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoAdd 'debug-threads' suboption to --name
Dr. David Alan Gilbert [Thu, 30 Jan 2014 10:20:31 +0000 (10:20 +0000)]
Add 'debug-threads' suboption to --name

Add flag storage to qemu-thread-* to store the namethreads flag

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>