Commit graph

14617 commits

Author SHA1 Message Date
Jan Kiszka 97ffbd8d9d Break up user and system cpu_interrupt implementations
Both have only two lines in common, and we will convert the system
service into a callback which is of no use for user mode operation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-05-02 09:38:35 -03:00
Glauber Costa 450fb75c47 kvm: create kvmclock when one of the flags are present
kvmclock presence can be signalled by two different flags. So for
device creation, we have to test for both.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-05-02 09:38:35 -03:00
Glauber Costa 642258c6c7 kvm: add kvmclock to its second bit
We have two bits that can represent kvmclock in cpuid.
They signal the guest which msr set to use. When we tweak flags
involving this value - specially when we use "-", we have to act on both.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-05-02 09:38:35 -03:00
Jan Kiszka e41e0fc61a x86: Allow multiple cpu feature matches of lookup_feature
kvmclock is represented by two feature bits. Therefore, lookup_feature
needs to continue its search even after the first match. Enhance it
accordingly and switch to a bool return type at this chance.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-05-02 09:38:35 -03:00
Glauber Costa 0c31b744f6 kvm: use kernel-provided para_features instead of statically coming up with new capabilities
Use the features provided by KVM_GET_SUPPORTED_CPUID directly to
mask out features from guest-visible cpuid.

The old get_para_features() mechanism is kept for older kernels that do not implement it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-05-02 08:24:42 -03:00
Mike McCormack cd18f05e24 Don't zero out buffer in sched_getaffinity
The kernel doesn't fill the buffer provided to sched_getaffinity
with zero bytes, so neither should QEMU.

Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-05-02 10:00:01 +03:00
Mike McCormack e95d3bf04d Fix buffer overrun in sched_getaffinity
Zeroing of the cpu array should start from &cpus[kernel_ret]
not &cpus[num_zeros_to_fill].

This fixes a crash in EFL's edje_cc running under qemu-arm.

Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-05-02 10:00:01 +03:00
Stefan Weil 6f11f013a5 linux-user: Fix compilation for "old" linux versions
Debian Lenny and other installations with older linux versions
failed to compile linux-user because some CLONE_xxx macros are
undefined.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-05-02 10:00:01 +03:00
Blue Swirl 08ab2ccb08 Merge branch 'patches' of git://qemu.weilnetz.de/git/qemu
* 'patches' of git://qemu.weilnetz.de/git/qemu:
  qemu-timer: Fix timers for w32
  qemu-timer: Avoid type casts
  qemu-timer: Remove unneeded include statement (w32)
  qemu-timer: Add and use new function qemu_timer_expired_ns
2011-04-29 20:01:51 +00:00
Anthony Liguori 642cfd4d31 virtfs: fix build due from rename
The latest virtfs pull broke the cris-softmmu target.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-04-28 12:40:54 -05:00
Anthony Liguori 71ef18e1f2 Merge remote-tracking branch 'amitshah/for-anthony' into staging 2011-04-28 08:37:54 -05:00
Anthony Liguori e77976a247 Merge remote-tracking branch 'jvrao/for-anthony' into staging 2011-04-28 08:25:45 -05:00
Alexey Kardashevskiy 5c1c9bb24b virtio-serial: Fix endianness bug in the config space
The virtio serial specification requres that the values in the config
space are encoded in native endian of the guest.

The qemu virtio-serial code did not do conversion to the guest endian
format what caused problems when host and guest use different format.

This patch corrects the qemu side, correctly doing host-native <->
guest-native conversions when accessing the config space. This won't
break any setups that aren't already broken, and fixes the case
of different host and guest endianness.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-04-28 12:35:49 +05:30
Amit Shah da7d998bbb char: Detect chardev release by NULL handlers as well as NULL opaque
Juan says he prefers these extra checks to ensure a user of a chardev is
releasing it.

Requested-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-04-28 11:11:04 +05:30
Kusanagi Kouichi d5b27167e1 char: Allow devices to use a single multiplexed chardev.
This fixes regression caused by commit
2d6c1ef40f
("char: Prevent multiple devices opening same chardev"):

-nodefaults -nographic -chardev stdio,id=stdio,mux=on,signal=off \
 -mon stdio -device virtio-serial-pci \
 -device virtconsole,chardev=stdio -device isa-serial,chardev=stdio

fails with:

qemu-system-x86_64: -device isa-serial,chardev=stdio: Property 'isa-serial.chardev' can't take value 'stdio', it's in use

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-04-28 11:03:07 +05:30
Hans de Goede cd8f7df289 spice-chardev: listen to frontend guest open / close
Note the vmc_register_interface() in spice_chr_write is left in place
in case someone uses spice-chardev with a frontend which does not have
guest open / close notification.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-04-28 11:02:31 +05:30
Hans de Goede 0b6d2266e3 virtio-console: notify backend of guest open / close
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-04-28 11:02:28 +05:30
Hans de Goede 7c32c4feeb chardev: Allow frontends to notify backends of guest open / close
Some frontends know when the guest has opened the "channel" and is actively
listening to it, for example virtio-serial. This patch adds 2 new qemu-chardev
functions which can be used by frontends to signal guest open / close, and
allows interested backends to listen to this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-04-28 11:02:21 +05:30
Peter Maydell a7d3970d06 target-arm: Don't update base register on abort in Thumb T1 LDM
Make sure the base register isn't updated if it is in the load list
for a Thumb LDM (T1 encoding) which aborts partway through the load.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-27 20:14:34 +02:00
YuYeon Oh 5856d44eb5 target-arm: fix LDMIA bug on page boundary
target-arm: fix LDMIA bug on page boundary

When consecutive memory locations are on page boundary, a base register may be
loaded before page fault occurs. After page fault handling, it losts the memory
location information. To solve this problem, loading a base register has to put back.

Signed-off-by: Yuyeon Oh <yuyeon.oh@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-27 20:13:26 +02:00
Jan Kiszka 47f7be394a ioapic: Do not set irr for masked edge IRQs
So far we set IRR for edge IRQs even if the pin is masked. If the guest
later on unmasks and switches the pin to level-triggered mode, irr will
remain set, causing an IRQ storm. The point is that setting IRR is not
correct in this case according to the spec, and avoiding this resolves
the issue.

Reported-and-tested-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-27 20:04:51 +02:00
Stefan Hajnoczi e14ea479b3 vl.c: Replace -virtfs string manipulation with QemuOpts
The -virtfs option creates an fsdev representing the pass-through file
system and a guest-visible virtio-9p-pci device that can access this
file system.  This patch replaces the string manipulation used to build
and reparse option lists with direct QemuOpts calls.  Removing the
string manipulation code makes it easier to maintain and less error
prone.

An error message is also updated to use "mount_tag" instead of
"mnt_tag".

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:31:29 -07:00
Harsh Prateek Bora 4f8dee2dec v9fs_walk: As per 9p2000 RFC, MAXWELEM >= nwnames >= 0.
The nwnames field in TWALK message is assumed to be >=0 and <= MAXWELEM
which is defined as macro P9_MAXWELEM (16) in virtio-9p.h as per 9p2000
RFC. Appropriate changes are required in V9fsWalkState and v9fs_walk.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:27:25 -07:00
Harsh Prateek Bora f35bde2f8f hw/virtio-9p-local.c: Remove unnecessary null char in symlink file
This patch removes the addition of null char in symlink file
which is being appended to file in case of mapped security model.
Without this patch, the extra null char causes LTP testcase lstat03
to fail and hence this fix is required.

Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:27:01 -07:00
M. Mohan Kumar 1d810aeb4e virtio-9p: Bugfix to send correct iounit
LCREATE function packs address of iounit in the pdu, fix that to send
actual iounit itself.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Acked-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:26:29 -07:00
Aneesh Kumar K.V a09947617c virtio-9p: removexattr on default acl should return 0
If we don't have default acl, removexattr on default acl
should return 0

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:26:05 -07:00
Aneesh Kumar K.V 3979251518 virtio-9p: Print the pdu details on return
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:25:35 -07:00
Aneesh Kumar K.V 353ac78d49 virtio-9p: move 9p files around
Now that we start adding more files related to 9pfs
it make sense to move them to a separate directory

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:24:37 -07:00
Jan Kiszka 661bfc80e8 pflash: Restore & fix lazy ROMD switching
Commit 5145b3d1cc revealed a bug in the lazy ROMD switch-back logic, but
resolved it by breaking that feature. This approach addresses the issue
by switching back to ROMD after a certain amount of read accesses
without further unlock sequences.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-27 16:31:12 +02:00
Stefan Weil 70afb8ff90 darwin-user: Remove unneeded null pointer check
cppcheck reports this error:

commpage.c:223: error: Possible null pointer dereference:
value - otherwise it is redundant to check if value is null at line 214

The null pointer check in line 214 is indeed not needed.
If value were null, the code would crash in line 223.
See do_compare_and_swap64 were for a reference.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-27 16:28:09 +02:00
Aurelien Jarno aa348082d8 Merge branch 'for-anthony' of git://repo.or.cz/qemu/kevin
* 'for-anthony' of git://repo.or.cz/qemu/kevin:
  Remove obsolete 'enabled' variable from progress state
  Add dd-style SIGUSR1 progress reporting
  qed: Fix consistency check on 32-bit hosts
  ide/atapi: Introduce CHECK_READY flag for commands
  ide/atapi: Replace bdrv_get_geometry calls by s->nb_sectors
  ide/atapi: Use table instead of switch for commands
  ide/atapi: Factor commands out
  ide: Split atapi.c out
  Improve accuracy of block migration bandwidth calculation
  atapi: Add 'medium ready' to 'medium not ready' transition on cd change
  qemu-img: allow rebase to a NULL backing file when unsafe
2011-04-27 16:26:18 +02:00
Stefan Weil c6a0487b1f rtl8139: Fix compilation for w32/w64
Compilation for Windows needs a different declaration for the
printf format attribute, so use the macro which was defined for
this purpose.

Cc: Benjamin Poirier <benjamin.poirier@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-27 16:22:37 +02:00
Jes Sorensen df6e008a88 Remove obsolete 'enabled' variable from progress state
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:21:00 +02:00
Jes Sorensen a55c73ba3f Add dd-style SIGUSR1 progress reporting
This introduces support for dd-style progress reporting on POSIX
systems, if the user hasn't specified -p to report progress. If sent a
SIGUSR1, qemu-img will report current progress for commands that
support progress reporting.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:21:00 +02:00
Stefan Hajnoczi 19dfc44a94 qed: Fix consistency check on 32-bit hosts
The qed_bytes_to_clusters() function is normally used with size_t
lengths.  Consistency check used it with file size length and therefore
failed on 32-bit hosts when the image file is 4 GB or more.

Make qed_bytes_to_clusters() explicitly 64-bit and update consistency
check to keep 64-bit cluster counts.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:21:00 +02:00
Kevin Wolf 7a2c4b8234 ide/atapi: Introduce CHECK_READY flag for commands
Some commands are supposed to report a Not Ready Condition (i.e. they require
a medium to be present in order to execute successfully). Instead of
duplicating the check in each command implementation, let's add a flag and
check it before calling the command.

This patch only converts existing checks, it does not introduce new checks for
any of the other commands that can/should report a Not Ready Condition.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:21:00 +02:00
Kevin Wolf e119bcaceb ide/atapi: Replace bdrv_get_geometry calls by s->nb_sectors
The disk size can only change when the medium is changed, and the change
callback takes care of updating s->nb_sectors in this case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:20:59 +02:00
Kevin Wolf e1a064f982 ide/atapi: Use table instead of switch for commands
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:20:59 +02:00
Kevin Wolf a60cf7e7eb ide/atapi: Factor commands out
In preparation for a table of function pointers, factor each command out from
ide_atapi_cmd() into its own function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:20:59 +02:00
Kevin Wolf 33231e0e22 ide: Split atapi.c out
Besides moving code, this patch only fixes some whitespace issues in the moved
code and makes all functions in atapi.c static which can be static.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 16:20:27 +02:00
Avishay Traeger ff5c52a379 Improve accuracy of block migration bandwidth calculation
block_mig_state.total_time is currently the sum of the read request
latencies.  This is not very accurate because block migration uses aio and
so several requests can be submitted at once.  Bandwidth should be computed
with wall-clock time, not by adding the latencies.  In this case,
"total_time" has a higher value than it should, and so the computed
bandwidth is lower than it is in reality.  This means that migration can
take longer than it needs to.
However, we don't want to use pure wall-clock time here.  We are computing
bandwidth in the asynchronous phase, where the migration repeatedly wakes
up and sends some aio requests.  The computed bandwidth will be used for
synchronous transfer.

Signed-off-by: Avishay Traeger <avishay@il.ibm.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 14:36:57 +02:00
Amit Shah 4b9b7092b4 atapi: Add 'medium ready' to 'medium not ready' transition on cd change
MMC-5 Table F.1 lists errors that can be thrown for the TEST_UNIT_READY
command.  Going from medium not ready to medium ready states is
communicated by throwing an error.

This adds the missing 'tray opened' event that we fail to report to
guests.  After doing this, older Linux guests properly revalidate a disc
on the change command.  HSM violation errors, which caused Linux guests
to do a soft-reset of the link, also go away:

ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6
sr 1:0:0:0: CDB: Test Unit Ready: 00 00 00 00 00 00
ata2.00: cmd a0/00:00:00:00:00/00:00:00:00:00/a0 tag 0
         res 01/60:00:00:00:00/00:00:00:00:00/a0 Emask 0x3 (HSM violation)
ata2.00: status: { ERR }
ata2: soft resetting link
ata2.00: configured for MWDMA2
ata2: EH complete

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 14:36:57 +02:00
Stefan Weil 2f9cba0c14 qemu-timer: Fix timers for w32
Commit 68c23e5520 removed the
multimedia timer, but this timer is needed for certain
Linux kernels. Otherwise Linux boot stops with this error:

    MP-BIOS bug: 8254 timer not connected to IO-APIC

So the multimedia timer is added again here.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-27 13:30:18 +02:00
Stefan Weil cd0544ee55 qemu-timer: Avoid type casts
The type casts are no longer needed after some small changes
in struct qemu_alarm_timer. This also improves readability
of the code.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-27 13:30:18 +02:00
Stefan Weil 2821d0f3ab qemu-timer: Remove unneeded include statement (w32)
mmsystem.h is not needed in qemu-timer.h, so remove it.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-27 13:30:18 +02:00
Stefan Weil 45c7b37fb9 qemu-timer: Add and use new function qemu_timer_expired_ns
This simply moves code which is used three times
into a new function thus improving readability.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-27 13:30:18 +02:00
Anthony Liguori 9a9d9dba3e qemu-img: allow rebase to a NULL backing file when unsafe
QEMU can drop a backing file so that an image file no longer depends on
the backing file, but this feature has not been exposed in qemu-img.
This is useful in an image streaming usecase or when an image file has
been fully allocated and no reads can hit the backing file anymore.

Since the dropping the backing file can make the image unusable, only
allow this when the unsafe flag has been set.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-27 11:12:50 +02:00
Michael Walle 430a3c1806 configure: reenable opengl by default
Because the opengl library is only linked to for the lm32 target, we can
now safely enable opengl by default again.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-26 23:26:49 +02:00
Michael Walle de3a354a83 configure: support target dependent linking
This patch is the first attempt to make configure more intelligent with
regard to how it links to libraries. It divides the softmmu libraries into
two lists, a general one and a list which depends on the target
architecture.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-26 23:26:48 +02:00
Aurelien Jarno 1a924df620 Merge branch 'linux-user-for-upstream' of git://gitorious.org/qemu-maemo/qemu
* 'linux-user-for-upstream' of git://gitorious.org/qemu-maemo/qemu:
  linux-user: untie syscalls from UID16
  linux-user: add s390x to llseek list
  linux-user: add ioctl(SIOCGIWNAME, ...) support.
  linux-user: convert ioctl(SIOCGIFCONF, ...) result.
  linux-user: improve traces
  [v2] linux-user: bigger default stack
2011-04-26 23:23:02 +02:00