]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agoasync: Use bool for boolean struct members and remove a hole
Stefan Weil [Sun, 29 Apr 2012 17:08:45 +0000 (19:08 +0200)]
async: Use bool for boolean struct members and remove a hole

Using bool reduces the size of the structure and improves readability.
A hole in the structure was removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoconfigure: Fix creation of symbolic links for MinGW toolchain
Stefan Weil [Mon, 19 Mar 2012 12:20:47 +0000 (13:20 +0100)]
configure: Fix creation of symbolic links for MinGW toolchain

The MinGW toolchain on w32/w64 hosts does not create symbolic links,
but implements 'ln -s' similar to 'cp -r'.

In incremental out of tree builds, this resulted in files which
were not updated when their counterparts in the QEMU source tree
changed. Especially for Makefile* this happened very often.

With this patch, the 'symlinked' files are now always updated for
out of tree builds. Similar code was already used for the symbolic
link of libcacard/Makefile.

The symlink macro always removes the target before it is created
again, therefore the rm command for libcacard/Makefile was redundant
and is removed now.

Macro symlink is also used with directories. To remove them on w32
hosts, a recursive rm is needed.

v2:
Quote arguments in shell function symlink, and also quote any argument
which is passed to symlink and which contains macros. This should reduce
the chance of accidents caused by rm -rf.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agomain-loop: Fix build for w32 and w64
Stefan Weil [Fri, 27 Apr 2012 15:02:08 +0000 (17:02 +0200)]
main-loop: Fix build for w32 and w64

This patch fixes a build regression with MinGW which was introduced by
commit 7c7db75576bd5a31508208f153c5aada64b2c8df.

The 3rd argument of g_main_context_query must point to a gint value.
Using a pointer to an uint32_t value is wrong.

The timeout argument of function os_host_main_loop_wait was never
used for w32 / w64.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: Don't build bsd-user on Mac OS X by default
Andreas Färber [Thu, 26 Apr 2012 09:57:39 +0000 (11:57 +0200)]
configure: Don't build bsd-user on Mac OS X by default

Fixes the build when combined with the drop of darwin-user.
Enthusiasts can still try building it using --enable-bsd-user.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Bernhard Walle <bernhard@bwalle.de>
Tested-by: Bernhard Walle <bernhard@bwalle.de> [Mac OS 10.7.3]
Acked-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: Replace int16 type with int_fast16_t
Andreas Färber [Wed, 25 Apr 2012 22:15:56 +0000 (00:15 +0200)]
softfloat: Replace int16 type with int_fast16_t

Based on the following Coccinelle patch:

@@
typedef int16, int_fast16_t;
@@
-int16
+int_fast16_t

Avoids a workaround for AIX.

Add typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: Replace uint16 type with uint_fast16_t
Andreas Färber [Wed, 25 Apr 2012 22:15:55 +0000 (00:15 +0200)]
softfloat: Replace uint16 type with uint_fast16_t

Based on the following Coccinelle patch:

@@
typedef uint16, uint_fast16_t;
@@
-uint16
+uint_fast16_t

Fixes the build of the Cocoa frontend on Mac OS X and avoids a
workaround for AIX.

For pre-10 Solaris include osdep.h.

Reported-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Reported-by: Rui Carmo <rui.carmo@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Juan Pineda <juan@logician.com>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-mips: Move definition of uint_fast{8, 16}_t to osdep.h
Andreas Färber [Wed, 25 Apr 2012 22:15:54 +0000 (00:15 +0200)]
target-mips: Move definition of uint_fast{8, 16}_t to osdep.h

osdep.h is included via qemu-common.h.

Prepares for use of [u]int_fast*_t types in softfloat code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Cc: Aurélien Jarno <aurelien@aurel32.net>
Cc: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: Fix mixups of int and int16
Andreas Färber [Wed, 25 Apr 2012 22:15:53 +0000 (00:15 +0200)]
softfloat: Fix mixups of int and int16

normalizeFloat{32,64}Subnormal() expect the exponent as int16, not int.
This went unnoticed since int16 and uint16 were both typedef'ed to int.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 28 Apr 2012 08:57:56 +0000 (08:57 +0000)]
Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Make SETEND respect bswap_code (BE8) setting
  target-arm: Move A9 config_base_address reset value to ARMCPU
  target-arm: Change cpu_arm_init() return type to ARMCPU

12 years agoMerge branch 'timer' of git://qemu.weilnetz.de/qemu
Blue Swirl [Sat, 28 Apr 2012 08:19:50 +0000 (08:19 +0000)]
Merge branch 'timer' of git://qemu.weilnetz.de/qemu

* 'timer' of git://qemu.weilnetz.de/qemu:
  qemu-timer: Optimize data structures
  qemu-timer: Remove function alarm_has_dynticks
  qemu-timer: Use bool, false, true for boolean values
  qemu-timer: Remove unused function qemu_alarm_pending
  qemu-timer: Remove redundant include statements

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Fri, 27 Apr 2012 17:00:06 +0000 (12:00 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi: fix qmp_balloon() conversion
  qemu-iotests: add block-stream speed value test case
  block: add 'speed' optional parameter to block-stream
  block: change block-job-set-speed argument from 'value' to 'speed'
  block: use Error mechanism instead of -errno for block_job_set_speed()
  block: use Error mechanism instead of -errno for block_job_create()

12 years agoqapi: fix qmp_balloon() conversion
Luiz Capitulino [Thu, 26 Apr 2012 20:15:02 +0000 (17:15 -0300)]
qapi: fix qmp_balloon() conversion

Commit d72f326431 forgot to convert a call from qerror_report() to
error_set(). Fix it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-iotests: add block-stream speed value test case
Stefan Hajnoczi [Wed, 25 Apr 2012 15:51:04 +0000 (16:51 +0100)]
qemu-iotests: add block-stream speed value test case

Add tests to exercise the InvalidParameter 'speed' error code path, as
well as the regular success case for setting the speed.  The
block-stream 'speed' parameter allows the speed limit of the job to be
applied immediately when the job starts instead of issuing a separate
block-job-set-speed command later.  If the parameter has an invalid
value we expect to get an error and the job is not created.

It turns out that cancelling a block job is a common operation in these
test cases, let's extract a cancel_and_wait() function instead of
duplicating the QMP commands.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: add 'speed' optional parameter to block-stream
Stefan Hajnoczi [Wed, 25 Apr 2012 15:51:03 +0000 (16:51 +0100)]
block: add 'speed' optional parameter to block-stream

Allow streaming operations to be started with an initial speed limit.
This eliminates the window of time between starting streaming and
issuing block-job-set-speed.  Users should use the new optional 'speed'
parameter instead so that speed limits are in effect immediately when
the job starts.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: change block-job-set-speed argument from 'value' to 'speed'
Stefan Hajnoczi [Wed, 25 Apr 2012 15:51:02 +0000 (16:51 +0100)]
block: change block-job-set-speed argument from 'value' to 'speed'

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: use Error mechanism instead of -errno for block_job_set_speed()
Stefan Hajnoczi [Wed, 25 Apr 2012 15:51:01 +0000 (16:51 +0100)]
block: use Error mechanism instead of -errno for block_job_set_speed()

There are at least two different errors that can occur in
block_job_set_speed(): the job might not support setting speeds or the
value might be invalid.

Use the Error mechanism to report the error where it occurs.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: use Error mechanism instead of -errno for block_job_create()
Stefan Hajnoczi [Wed, 25 Apr 2012 15:51:00 +0000 (16:51 +0100)]
block: use Error mechanism instead of -errno for block_job_create()

The block job API uses -errno return values internally and we convert
these to Error in the QMP functions.  This is ugly because the Error
should be created at the point where we still have all the relevant
information.  More importantly, it is hard to add new error cases to
this case since we quickly run out of -errno values without losing
information.

Go ahead and use Error directly and don't convert later.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agotarget-arm: Make SETEND respect bswap_code (BE8) setting
Peter Maydell [Tue, 24 Apr 2012 18:05:05 +0000 (18:05 +0000)]
target-arm: Make SETEND respect bswap_code (BE8) setting

Make the SETEND instruction respect the setting of bswap_code,
so that in BE8 mode we UNDEF for attempts to switch into
little-endian mode and nop for attempts to stay in big-endian
mode. (This is the inverse of the existing handling of SETEND
in the more common little-endian setup, which we use since
we don't implement the architecturally-mandated dynamic
endianness switching.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Move A9 config_base_address reset value to ARMCPU
Peter Maydell [Fri, 20 Apr 2012 07:39:15 +0000 (07:39 +0000)]
target-arm: Move A9 config_base_address reset value to ARMCPU

Move the A9 config_base_address cp15 register reset value to
ARMCPU. This should become a QOM property so that the Highbank
board can set it without having to pull in cpu-qom.h, but at
least this avoids the implicit dependency on reset ordering
that the previous workaround had.

Cc: Mark Langsdorf <mark.langsdorf@calxeda.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Change cpu_arm_init() return type to ARMCPU
Andreas Färber [Fri, 20 Apr 2012 07:39:14 +0000 (07:39 +0000)]
target-arm: Change cpu_arm_init() return type to ARMCPU

Make cpu_arm_init() return a QOM ARMCPU, so that we don't need to
obtain an ARMCPU through arm_env_get_cpu() in machine init code.
This requires to adjust the inclusion site of cpu-qom.h and in turn,
forward-looking, to homogenize its include order.

cpu_init() must still return a CPUARMState for backwards and
cross-target compatibility, so adjust the cpu_init macro.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoqemu-timer: Optimize data structures
Stefan Weil [Fri, 20 Apr 2012 09:51:58 +0000 (11:51 +0200)]
qemu-timer: Optimize data structures

Remove all holes which were found by pahole on Linux x86_64
(and replace "struct QEMUTimer" by "QEMUTimer").

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoqemu-timer: Remove function alarm_has_dynticks
Stefan Weil [Fri, 20 Apr 2012 09:27:24 +0000 (11:27 +0200)]
qemu-timer: Remove function alarm_has_dynticks

Some time ago, the last time which did not have dynticks was removed,
so now all timers have dynticks.

I also removed a misleading error message for the dynticks timer.
If timer_create fails, there is already an error message, and
QEMU will use the unix timer which also provides dynamic ticks,
therefore dynamic ticks are not disabled.

v2:
Remove two if statements because they were always true
(thanks to Paolo Bonzini for this correction).

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoqemu-timer: Use bool, false, true for boolean values
Stefan Weil [Fri, 20 Apr 2012 08:45:48 +0000 (10:45 +0200)]
qemu-timer: Use bool, false, true for boolean values

This avoids conversions between int and bool / char.

It also makes the code more readable.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoqemu-timer: Remove unused function qemu_alarm_pending
Stefan Weil [Fri, 20 Apr 2012 08:50:55 +0000 (10:50 +0200)]
qemu-timer: Remove unused function qemu_alarm_pending

The last user of this function was removed by commit
12d4536f7d911b6d87a766ad7300482ea663cea2.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoqemu-timer: Remove redundant include statements
Stefan Weil [Fri, 20 Apr 2012 08:27:06 +0000 (10:27 +0200)]
qemu-timer: Remove redundant include statements

qemu-timer.h includes qemu-common.h which already includes time.h,
sys/time.h, windows.h, unistd.h, fcntl.h, errno.h and signal.h.

Therefore those include statements are redundant and can be removed.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Thu, 26 Apr 2012 20:22:07 +0000 (15:22 -0500)]
Merge remote-tracking branch 'bonzini/nbd-next' into staging

* bonzini/nbd-next:
  nbd: Fix uninitialised use of s->sock

12 years agoMerge remote-tracking branch 'kraxel/usb.49' into staging
Anthony Liguori [Thu, 26 Apr 2012 20:21:52 +0000 (15:21 -0500)]
Merge remote-tracking branch 'kraxel/usb.49' into staging

* kraxel/usb.49:
  usb-uhci: update irq line on reset
  usb: add serial number generator
  usb-redir: Not finding an async urb id is not an error
  usb-redir: Reset device address and speed on disconnect
  usb-redir: An interface count of 0 is a valid value
  usb-xhci: fix bit test
  usb-xhci: Use PCI DMA helper functions
  usb-host: fix zero-length packets
  usb-host: don't dereference invalid iovecs
  usb-storage: fix request canceling
  usb-ehci: Ensure frindex writes leave a valid frindex value
  usb-ehci: add missing usb_packet_init() call
  usb-ehci: remove hack

12 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Thu, 26 Apr 2012 20:21:01 +0000 (15:21 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

* stefanha/tracing:
  Beautify makefile commands for generation of files with tracetool
  Generic elimination of auto-generated files

12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Thu, 26 Apr 2012 20:20:33 +0000 (15:20 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  e1000: set E1000_ICR_INT_ASSERTED only for 8257x
  e1000: link auto-negotiation emulation
  e1000: introduce bit for debugging PHY emulation
  e1000: introduce helpers to manipulate link status
  e1000: PHY loopback mode support
  e1000: conditionally raise irq at the end of MDI cycle
  e1000: introduce bits of PHY control register
  eepro100: Fix multicast regression
  virtio: order index/descriptor reads
  virtio: add missing mb() on enable notification
  virtio: add missing mb() on notification
  e1000: move reset function earlier in file

12 years agoMerge remote-tracking branch 'afaerber/qom-cpu-x86-prop.v3' into staging
Anthony Liguori [Thu, 26 Apr 2012 20:18:06 +0000 (15:18 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu-x86-prop.v3' into staging

* afaerber/qom-cpu-x86-prop.v3:
  target-i386: Introduce "tsc-frequency" property for X86CPU
  target-i386: Prepare "vendor" property for X86CPU
  target-i386: Introduce "xlevel" property for X86CPU
  target-i386: Introduce "level" property for X86CPU
  target-i386: Add property getter for CPU model-id
  target-i386: Add property getter for CPU stepping
  target-i386: Add property getter for CPU model
  target-i386: Add property getter for CPU family
  target-i386: Add "model-id" property to X86CPU
  target-i386: Add "stepping" property to X86CPU
  target-i386: Add "model" property to X86CPU
  target-i386: Add "family" property to X86CPU
  target-i386: Add range check for -cpu ,family=x
  target-i386: Pass X86CPU to cpu_x86_register()
  target-i386: Fix x86_cpuid_set_model_id()

12 years agoMerge remote-tracking branch 'amit/master' into staging
Anthony Liguori [Thu, 26 Apr 2012 20:16:24 +0000 (15:16 -0500)]
Merge remote-tracking branch 'amit/master' into staging

* amit/master:
  virtio-serial-bus: Unset guest_connected at reset and driver reset
  virtio-serial-bus: fix guest_connected init before driver init

12 years agoRevert "configure: Virtfs doesn't require libcap."
Anthony Liguori [Wed, 25 Apr 2012 19:19:05 +0000 (14:19 -0500)]
Revert "configure: Virtfs doesn't require libcap."

This reverts commit d10f9056bacf7991fd6a5f63ac2e0190e84ea3a7 due to a build
breakage.

See http://spunk.home.kraxel.org/bb/builders/ubuntu-default/builds/52

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoos-posix: Fix build on FreeBSD
Nathan Whitehorn [Sat, 14 Apr 2012 14:01:00 +0000 (16:01 +0200)]
os-posix: Fix build on FreeBSD

Add an include for a header required to build on recent FreeBSD.

Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomain_loop_wait: block indefinitely
Stefano Stabellini [Fri, 13 Apr 2012 18:35:04 +0000 (19:35 +0100)]
main_loop_wait: block indefinitely

- remove qemu_calculate_timeout;

- explicitly size timeout to uint32_t;

- introduce slirp_update_timeout;

- pass NULL as timeout argument to select in case timeout is the maximum
value;

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Paul Brook <paul@codesourcery.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu_next_alarm_deadline: check the expire time of a clock only if it is enabled
Stefano Stabellini [Fri, 13 Apr 2012 18:35:03 +0000 (19:35 +0100)]
qemu_next_alarm_deadline: check the expire time of a clock only if it is enabled

Also delta in qemu_next_alarm_deadline is a 64 bit value so set the
default to INT64_MAX instead of INT32_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotimers: the rearm function should be able to handle delta = INT64_MAX
Stefano Stabellini [Fri, 13 Apr 2012 18:35:02 +0000 (19:35 +0100)]
timers: the rearm function should be able to handle delta = INT64_MAX

Fix win32_rearm_timer and mm_rearm_timer: they should be able to handle
INT64_MAX as a delta parameter without overflowing.
Also, the next deadline in ms should be calculated rounding down rather
than up (see unix_rearm_timer and dynticks_rearm_timer).

Finally ChangeTimerQueueTimer takes an unsigned long and timeSetEvent
takes an unsigned int as delta, so cast the ms delta to the appropriate
unsigned integer.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: Fix x86_cpuid_set_model_id()
Andreas Färber [Tue, 24 Apr 2012 14:22:31 +0000 (16:22 +0200)]
target-i386: Fix x86_cpuid_set_model_id()

Don't assume zeroed cpuid_model[] fields.

This didn't break anything yet but QOM properties should be able to set
the value to something else without setting an intermediate zero string.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqtest: Fix more format errors with qtest_sendf
Stefan Weil [Mon, 23 Apr 2012 19:40:08 +0000 (21:40 +0200)]
qtest: Fix more format errors with qtest_sendf

After adding GCC_FMT_ATTR to qtest_sendf, more format errors are reported
by the compiler. These are fixed here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosdl: Add QEMU mascot icon for use with SDL
Stefan Weil [Fri, 13 Apr 2012 20:24:42 +0000 (22:24 +0200)]
sdl: Add QEMU mascot icon for use with SDL

This is a bitmap file (32x32x4) derived from the official QEMU mascot
(which was designed by Benoît Canet). I stripped the text from the SVG
to get a nearly square image and converted the result to BMP without
any manual optimization.

The bitmap is currently used by QEMU's SDL interface and replaces the
default X icon.

v2: Add qemu-icon.bmp to Makefile.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: quick and dirty QOM filesystem based on FUSE
Anthony Liguori [Wed, 18 Apr 2012 22:37:04 +0000 (17:37 -0500)]
qom: quick and dirty QOM filesystem based on FUSE

Here's an example session:

anthony@titi:~/git/qemu/QMP$ QMP_SERVER=/tmp/server.sock ./qom-fuse tmp
anthony@titi:~/git/qemu/QMP$ ls tmp
machine  sysbus  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine
i440fx  peripheral  peripheral-anon  type  unattached
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx
ioapic  parent_bus  pci.0  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx/pci.0
child[0]  child[1]  child[2]  child[3]  child[4]  child[5]  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx/pci.0/child[4]
addr                 legacy-addr                 multifunction  type
command_serr_enable  legacy-command_serr_enable  parent_bus
ide.0                legacy-multifunction        rombar
ide.1                legacy-romfile              romfile
anthony@titi:~/git/qemu/QMP$ cat tmp/machine/i440fx/pci.0/child[4]/type
piix3-ide
anthony@titi:~/git/qemu/QMP$ ls -al tmp/machine/i440fx/pci.0/child\[4\]/parent_bus
lrwxr-xr-x 2 anthony anthony 4096 1969-12-31 18:00 tmp/machine/i440fx/pci.0/child[4]/parent_bus -> ../../../machine/i440fx/pci.0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopc-sysfw: make sure to call qdev_init
Anthony Liguori [Wed, 18 Apr 2012 22:33:15 +0000 (17:33 -0500)]
pc-sysfw: make sure to call qdev_init

We're not actually calling qdev_init for the pc-sysfw device.  Since we create
the canonical path during realize, this was causing an assert to trigger when
attempting to read a link pointing to pc-sysfw.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agonbd: Fix uninitialised use of s->sock
Kevin Wolf [Thu, 26 Apr 2012 11:45:30 +0000 (13:45 +0200)]
nbd: Fix uninitialised use of s->sock

s->sock is assigned only afterwards, so we're really registering an
aio_fd_handler for file descriptor 0 here. Not exactly what we intended.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agousb-uhci: update irq line on reset
Gerd Hoffmann [Fri, 20 Apr 2012 13:13:24 +0000 (15:13 +0200)]
usb-uhci: update irq line on reset

uhci_reset() clears irq mask and irq status registers, but doesn't
update the irq line.  Which may result in suspious IRQs after uhci
reset.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: add serial number generator
Gerd Hoffmann [Fri, 20 Apr 2012 10:33:30 +0000 (12:33 +0200)]
usb: add serial number generator

This patch adds a function which creates unique serial numbers for usb
devices and puts it into use.  Windows guests tend to become unhappy if
they find two identical usb devices in the system.  Effects range from
non-functional devices (with yellow exclamation mark in device manager)
to BSODs.  Handing out unique serial numbers to devices fixes this.

With this patch applied almost all emulated devices get a generated,
unique serial number.  There are two exceptions:

 * usb-storage devices will prefer a user-specified serial number
   and will only get a generated number in case the serial property
   is unset.
 * usb-hid devices keep the fixed serial number "42" as it is used
   to signal "remote wakeup actually works".
   See commit 7b074a22dab4bdda9864b933f1bc811a3db42845

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Not finding an async urb id is not an error
Hans de Goede [Sat, 31 Mar 2012 15:14:23 +0000 (17:14 +0200)]
usb-redir: Not finding an async urb id is not an error

We clear our pending async urb list on device disconnect and we may still
receive "packet complete" packets from our peer after this, which will then
refer to packet ids no longer in our list.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Reset device address and speed on disconnect
Hans de Goede [Sat, 31 Mar 2012 15:14:22 +0000 (17:14 +0200)]
usb-redir: Reset device address and speed on disconnect

Without this disconnected devices look like the last redirected device
in the monitor in "info usb".

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: An interface count of 0 is a valid value
Hans de Goede [Sat, 31 Mar 2012 15:14:21 +0000 (17:14 +0200)]
usb-redir: An interface count of 0 is a valid value

An interface-count of 0 happens when a device is in unconfigured state when
it gets redirected. So we should not use 0 to detect not having received
interface info from our peer.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-xhci: fix bit test
Lai Jiangshan [Mon, 2 Apr 2012 06:35:30 +0000 (14:35 +0800)]
usb-xhci: fix bit test

use & instead of the wrong &&

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-xhci: Use PCI DMA helper functions
David Gibson [Wed, 4 Apr 2012 00:15:58 +0000 (10:15 +1000)]
usb-xhci: Use PCI DMA helper functions

Shortly before 1.0, we added helper functions / wrappers for doing PCI DMA
from individual devices.  This makes what's going on clearer and means that
when we add IOMMU support somewhere in the future, only the general PCI
code will have to change, not every device that uses PCI DMA.

However, usb-xhci is not using these wrappers, despite being a PCI only
device.  This patch remedies the situation, using the pci dma functions
instead of direct calls to cpu_physical_memory_{read,write}().  Likewise
address parameters for DMA are changed to dma_addr_t instead of
target_phys_addr_t.

[ kraxel: removed #ifdefs ]

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-host: fix zero-length packets
Gerd Hoffmann [Thu, 19 Apr 2012 11:36:40 +0000 (13:36 +0200)]
usb-host: fix zero-length packets

usb-host optimizes away zero-length packets by not entering the
processing loop at all.  Which isn't correct, we should submit a
zero-length urb to the host devicein that case.  This patch makes
sure we run the processing loop at least once.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-host: don't dereference invalid iovecs
Gerd Hoffmann [Thu, 19 Apr 2012 11:35:07 +0000 (13:35 +0200)]
usb-host: don't dereference invalid iovecs

usb-host assumes the first iovec element is always valid.
In case of a zero-length packet this isn't true though.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-storage: fix request canceling
Gerd Hoffmann [Wed, 18 Apr 2012 10:08:29 +0000 (12:08 +0200)]
usb-storage: fix request canceling

Little fix for usb packet handling on i/o cancelation.  The
usb packet pointer (s->packet) is cleared at the wrong place:
The scsi request cancel handler does it.  When a usb packet
is canceled the usb-storage emulation canceles the scsi request
if present.  In most cases there is one, so usually s->packet
is cleared as needed even with the code sitting at the wrong
place.

If there is no scsi request in flight s->packet is not cleared
though.  The usb-storage emulation will then try to complete an
usb packet which is not in flight any more and thereby trigger
an assert() in the usb core.

Fix this by clearing s->packet at the correct place, which is
the usb packet cancel header.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-ehci: Ensure frindex writes leave a valid frindex value
Hans de Goede [Tue, 3 Apr 2012 12:21:47 +0000 (14:21 +0200)]
usb-ehci: Ensure frindex writes leave a valid frindex value

frindex is a 14 bits counter, so bits 31-14 should always be 0, and
after the commit titled "usb-ehci: frindex always is a 14 bits counter"
we rely on frindex always being a multiple of 8. I've not seen this in
practice, but theoretically a guest can write a value >= 0x4000 or a value
which is not a multiple of 8 value to frindex, this patch ensures that
things will still work when that happens.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-ehci: add missing usb_packet_init() call
Gerd Hoffmann [Thu, 19 Apr 2012 11:07:54 +0000 (13:07 +0200)]
usb-ehci: add missing usb_packet_init() call

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-ehci: remove hack
Gerd Hoffmann [Tue, 17 Apr 2012 10:33:58 +0000 (12:33 +0200)]
usb-ehci: remove hack

To answer the question in the comment removed by this patch:  I think
this was needed because several places in the ehci emulation did not
check the T bit of link entries correctly and thus might have followed
invalid references.  See commit 2a5ff735dc1074171a0cbb1dc228d6d6e907f571

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agohda: fix codec ids
Gerd Hoffmann [Thu, 26 Apr 2012 07:15:04 +0000 (09:15 +0200)]
hda: fix codec ids

Our hda codecs exist in two variants:  With CONFIG_MIXEMU=y they expose
amplifiers for volume control to the guest, with CONFIG_MIXEMU=n they
don't.

This patch changes the codec ids, they are different now for these two
cases.  This makes sure windows guests will notice the difference.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agohda: add hda-micro codec
Gerd Hoffmann [Thu, 26 Apr 2012 07:15:03 +0000 (09:15 +0200)]
hda: add hda-micro codec

It's identical to the hda-duplex codec, except that it advertises the
input as microphone instead of line-in and the output as speaker instead
of line-out.  Some guest apps (microsoft netmeeting being one) are picky
when it comes to selecting the recording source and don't accept
line-in, so give them what they expect.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agohda: move input widgets from duplex to common
Gerd Hoffmann [Thu, 26 Apr 2012 07:15:02 +0000 (09:15 +0200)]
hda: move input widgets from duplex to common

Preparing for a new user of the input widget definitions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agofix paaudio.c warnings
Gerd Hoffmann [Wed, 25 Apr 2012 16:19:41 +0000 (18:19 +0200)]
fix paaudio.c warnings

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoBeautify makefile commands for generation of files with tracetool
Lluís Vilanova [Wed, 18 Apr 2012 18:15:45 +0000 (20:15 +0200)]
Beautify makefile commands for generation of files with tracetool

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoGeneric elimination of auto-generated files
Lluís Vilanova [Wed, 18 Apr 2012 18:15:39 +0000 (20:15 +0200)]
Generic elimination of auto-generated files

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agovirtio-serial-bus: Unset guest_connected at reset and driver reset
Amit Shah [Tue, 24 Apr 2012 14:03:59 +0000 (19:33 +0530)]
virtio-serial-bus: Unset guest_connected at reset and driver reset

When a guest driver resets the virtio status to not ready, or when qemu
is reset, reset all ports' guest_connected bit and let port users know
of this event if they have the guest_close() callback registered.

Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
12 years agovirtio-serial-bus: fix guest_connected init before driver init
Alon Levy [Mon, 23 Apr 2012 15:23:10 +0000 (18:23 +0300)]
virtio-serial-bus: fix guest_connected init before driver init

guest_connected should be false before guest driver initialization, and
true after, both for multiport aware and non multiport aware drivers.

Don't set it before the guest_features are available; instead use
set_status which is called by io to VIRTIO_PCI_STATUS with
VIRTIO_CONFIG_S_DRIVER_OK by even older non multiport drivers.

[Amit: Add comment, tweak summary, only set guest_connected and not
       reset it as a side-effect.]

Signed-off-by: Alon Levy <alevy@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
12 years agotarget-i386: Introduce "tsc-frequency" property for X86CPU
Andreas Färber [Tue, 17 Apr 2012 22:12:23 +0000 (00:12 +0200)]
target-i386: Introduce "tsc-frequency" property for X86CPU

Use Hz as unit.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Prepare "vendor" property for X86CPU
Andreas Färber [Tue, 17 Apr 2012 17:22:58 +0000 (19:22 +0200)]
target-i386: Prepare "vendor" property for X86CPU

Using it now would incur converting the three x86_def_t vendor words
into a string for object_property_set_str(), then back to three words
in the "vendor" setter.
The built-in CPU definitions use numeric preprocessor defines to
initialize the three words in a charset-safe way, so do not change the
fields to char[12] just to use the setter.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Introduce "xlevel" property for X86CPU
Andreas Färber [Tue, 17 Apr 2012 16:44:07 +0000 (18:44 +0200)]
target-i386: Introduce "xlevel" property for X86CPU

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Introduce "level" property for X86CPU
Andreas Färber [Tue, 17 Apr 2012 16:41:40 +0000 (18:41 +0200)]
target-i386: Introduce "level" property for X86CPU

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add property getter for CPU model-id
Andreas Färber [Tue, 17 Apr 2012 21:02:26 +0000 (23:02 +0200)]
target-i386: Add property getter for CPU model-id

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add property getter for CPU stepping
Andreas Färber [Tue, 17 Apr 2012 12:50:53 +0000 (14:50 +0200)]
target-i386: Add property getter for CPU stepping

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add property getter for CPU model
Andreas Färber [Tue, 17 Apr 2012 12:48:14 +0000 (14:48 +0200)]
target-i386: Add property getter for CPU model

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-i386: Add property getter for CPU family
Andreas Färber [Tue, 17 Apr 2012 12:42:22 +0000 (14:42 +0200)]
target-i386: Add property getter for CPU family

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add "model-id" property to X86CPU
Andreas Färber [Tue, 17 Apr 2012 13:17:27 +0000 (15:17 +0200)]
target-i386: Add "model-id" property to X86CPU

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add "stepping" property to X86CPU
Andreas Färber [Tue, 17 Apr 2012 12:14:18 +0000 (14:14 +0200)]
target-i386: Add "stepping" property to X86CPU

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add "model" property to X86CPU
Andreas Färber [Tue, 17 Apr 2012 10:16:39 +0000 (12:16 +0200)]
target-i386: Add "model" property to X86CPU

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add "family" property to X86CPU
Andreas Färber [Tue, 17 Apr 2012 10:10:29 +0000 (12:10 +0200)]
target-i386: Add "family" property to X86CPU

Add the property early in the initfn so that it can be used in helpers
such as mce_init().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
[AF: Add an error_free(), spotted by Michael Roth]
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Add range check for -cpu ,family=x
Andreas Färber [Tue, 17 Apr 2012 14:15:15 +0000 (16:15 +0200)]
target-i386: Add range check for -cpu ,family=x

A family field value of 0xf and extended family field value of 0xff is
the maximum representable unsigned family number.
All other CPUID property values are bounds-checked, so add a check here
for symmetry before we adopt it in a property setter.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Pass X86CPU to cpu_x86_register()
Andreas Färber [Tue, 17 Apr 2012 10:00:51 +0000 (12:00 +0200)]
target-i386: Pass X86CPU to cpu_x86_register()

Avoids an x86_env_get_cpu() call there, to work with QOM properties.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12 years agotarget-i386: Fix x86_cpuid_set_model_id()
Andreas Färber [Tue, 17 Apr 2012 16:21:52 +0000 (18:21 +0200)]
target-i386: Fix x86_cpuid_set_model_id()

Don't assume zeroed cpuid_model[] fields.

This didn't break anything yet but QOM properties should be able to set
the value to something else without setting an intermediate zero string.

Reviewed-by: Eduardo Habhost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
[AF: Use memset() instead of for loop, suggested by Igor]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoe1000: set E1000_ICR_INT_ASSERTED only for 8257x
Jason Wang [Thu, 22 Mar 2012 10:02:34 +0000 (18:02 +0800)]
e1000: set E1000_ICR_INT_ASSERTED only for 8257x

E1000_ICR_INT_ASSERTED were introduced only for 8257x, so we need to
check the E1000_DEVID before setting this bit in ICS.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoe1000: link auto-negotiation emulation
Jason Wang [Thu, 22 Mar 2012 10:02:24 +0000 (18:02 +0800)]
e1000: link auto-negotiation emulation

Indeed, there's nothing else except for the time spent on the
negotiation needs to be emulated. This is needed for resuming windows
guest from hibernation, as without a proper delay, qemu would send the
packet too early ( guest even does not have a proper intr handler),
which could lead windows guest hang.

This patch first introduces an array of function pointers to make it
possible to emulate per-register write behavior. Then traps the
PHY_CTRL register write and when guest want to restart the link auto
negotiation, we would down the link and mark the auto negotiation in
progress in PHY_STATUS register. After time, a timer with 500 ms (
which is the minimum timeout of auto-negotation specified in 802.3
spec). The link would be up when timer expired.

Test with resuming windows guest plus flood ping and linux ethtool
linkstatus test.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoe1000: introduce bit for debugging PHY emulation
Jason Wang [Thu, 22 Mar 2012 10:02:16 +0000 (18:02 +0800)]
e1000: introduce bit for debugging PHY emulation

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoe1000: introduce helpers to manipulate link status
Jason Wang [Thu, 22 Mar 2012 10:02:07 +0000 (18:02 +0800)]
e1000: introduce helpers to manipulate link status

This patch introduces helpers to change link status bit for phy/mac
register. This would help to reduce code duplication and would be used
by following patches.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoe1000: PHY loopback mode support
Jason Wang [Thu, 22 Mar 2012 10:01:59 +0000 (18:01 +0800)]
e1000: PHY loopback mode support

The missing of loopback mode prevent the running of self diagnosis
program in guest. This patch adds this support.

After this patch, loopback test of ethtool were passed in guest.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoe1000: conditionally raise irq at the end of MDI cycle
Jason Wang [Thu, 22 Mar 2012 10:01:50 +0000 (18:01 +0800)]
e1000: conditionally raise irq at the end of MDI cycle

According to the spec:

"When set to 1b by software, it causes an Interrupt to be
asserted to indicate the end of an MDI cycle."

We need check the Interrupt Enable bit and raise irq only when it is
set.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoe1000: introduce bits of PHY control register
Jason Wang [Thu, 22 Mar 2012 10:01:42 +0000 (18:01 +0800)]
e1000: introduce bits of PHY control register

This would be used be following patches.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoeepro100: Fix multicast regression
Stefan Weil [Tue, 10 Apr 2012 18:48:54 +0000 (20:48 +0200)]
eepro100: Fix multicast regression

Commit 7fc8d918b9674c3e9233d6d25da2457345d414a0 removed code from
eepro100.c and replaced it by different code: the code in net.c
returns bits 31...26, but eepro100 needs bits 7...2.

This patch partially reverts 7fc8d918b9674c3e9233d6d25da2457345d414a0.
To avoid future problems, I renamed the function and changed the comment.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agovirtio: order index/descriptor reads
Michael S. Tsirkin [Mon, 23 Apr 2012 12:46:22 +0000 (15:46 +0300)]
virtio: order index/descriptor reads

virtio has the equivalent of:

if (vq->last_avail_index != vring_avail_idx(vq)) {
read descriptor head at vq->last_avail_index;
}

In theory, processor can reorder descriptor head
read to happen speculatively before the index read.
this would trigger the following race:

host descriptor head read <- reads invalid head from ring
guest writes valid descriptor head
guest writes avail index
host avail index read <- observes valid index

as a result host will use an invalid head value.
This was not observed in the field by me but after
the experience with the previous two races
I think it is prudent to address this theoretical race condition.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agovirtio: add missing mb() on enable notification
Michael S. Tsirkin [Mon, 23 Apr 2012 11:11:14 +0000 (14:11 +0300)]
virtio: add missing mb() on enable notification

This fixes an issue dual to the one fixed by
patch 'virtio: add missing mb() on notification'
and applies on top.

In this case, to enable vq kick to exit to host,
qemu writes out used flag then reads the
avail index. if these are reordered we get a race:

    host avail index read: ring is empty
     guest avail index write
     guest flag read: exit disabled
    host used flag write: enable exit

which results in a lost exit: host will never be notified about the
avail index update.  Again, happens in the field but only seems to
trigger on some specific hardware.

Insert an smp_mb barrier operation to ensure the correct ordering.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agovirtio: add missing mb() on notification
Michael S. Tsirkin [Sun, 22 Apr 2012 13:45:53 +0000 (16:45 +0300)]
virtio: add missing mb() on notification

During normal operation, virtio first writes a used index
and then checks whether it should interrupt the guest
by reading guest avail index/flag values.

Guest does the reverse: writes the index/flag,
then checks the used ring.

The ordering is important: if host avail flag read bypasses the used
index write, we could in effect get this timing:

host avail flag read
guest enable interrupts: avail flag write
guest check used ring: ring is empty
host used index write

which results in a lost interrupt: guest will never be notified
about the used ring update.

This actually can happen when using kvm with an io thread,
such that the guest vcpu and qemu run on different host cpus,
and this has actually been observed in the field
(but only seems to trigger on very specific processor types)
with userspace virtio: vhost has the necessary smp_mb()
in place to prevent the regordering, so the same workload stalls
forever waiting for an interrupt with vhost=off but works
fine with vhost=on.

Insert an smp_mb barrier operation in userspace virtio to
ensure the correct ordering.
Applying this patch fixed the race condition we have observed.
Tested on x86_64. I checked the code generated by the new macro
for i386 and ppc but didn't run virtio.

Note: mb could in theory be implemented by __sync_synchronize, but this
would make us hit old GCC bugs. Besides old GCC
not implementing __sync_synchronize at all, there were bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36793
in this functionality as recently as in 4.3.

As we need asm for rmb,wmb anyway, it's just as well to
use it for mb.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoe1000: move reset function earlier in file
Michael S. Tsirkin [Sun, 12 Feb 2012 13:11:53 +0000 (15:11 +0200)]
e1000: move reset function earlier in file

Make it easier to reuse this function.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoLimit ptimer rate to something achievable
Peter Chubb [Fri, 20 Apr 2012 05:32:30 +0000 (15:32 +1000)]
Limit ptimer rate to something achievable

If a guest sets very short timeouts, and asks for a timer to be reloaded on
timeout, QEMU can go to 100%CPU utilisation and become unresponsive,
as it is spending all its time generating timeout interrupts.  On real
hardware this doesn't matter, as the interrupts are just coalesced,
and the effect is to have the interrupt asserted all the time.

This patch is a band-aid, that prevents timeouts less than 10
microseconds from being set.  10 microseconds is a limit that was
determined empirically on a variety of machines as the shortest that
allowed QEMU to pick up a control-a c sequence to get at the monitor.

Reported-by: Anna Lyons <anna.lyons@nicta.com.au>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: Refine container_get() to allow using a custom root
Andreas Färber [Thu, 5 Apr 2012 11:21:46 +0000 (13:21 +0200)]
qom: Refine container_get() to allow using a custom root

Specify the root to search from as argument. This avoids hardcoding
"/machine" in some places and makes it more flexible.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqtest: Fix tv_usec != long
Richard Henderson [Thu, 19 Apr 2012 12:09:33 +0000 (07:09 -0500)]
qtest: Fix tv_usec != long

Sparc Debian 5.0.8 does not define __suseconds_t as long,
but FMT_timeval expects %ld.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRemove extra pthread switch
Peter Portante [Fri, 20 Apr 2012 14:36:12 +0000 (10:36 -0400)]
Remove extra pthread switch

  remove the extra pthread switch which might be there
  from the package config check for gthreads.

Signed-off-by: Peter Portante <peter.portante@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: Virtfs doesn't require libcap.
Kusanagi Kouichi [Sun, 22 Apr 2012 10:16:05 +0000 (19:16 +0900)]
configure: Virtfs doesn't require libcap.

Only proxy helper does.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: Fix crash when switching consoles
Stefan Weil [Thu, 19 Apr 2012 20:27:14 +0000 (22:27 +0200)]
qemu-char: Fix crash when switching consoles

qemu-system-arm (and other system emulations) crashes with SDL when
the user switches consoles (Alt-Ctrl-F4).

We already check for NULL pointers in qemu_chr_fe_ioctl,
qemu_chr_be_can_write and other functions, so do this also
for s->chr_read in qemu_chr_be_write. This fixes the crash.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: add --with-confsuffix option
Eduardo Habkost [Wed, 18 Apr 2012 19:55:50 +0000 (16:55 -0300)]
configure: add --with-confsuffix option

This will allow the user to make Qemu use a different subdirectory name
inside $datadir and $sysconfdir, instead of "/qemu".

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: change meaning of --datadir to Autoconf convention
Eduardo Habkost [Wed, 18 Apr 2012 19:55:49 +0000 (16:55 -0300)]
configure: change meaning of --datadir to Autoconf convention

Autoconf uses --datadir for the /usr/share directory, not the
program-specific subdirectory inside /usr/share. This changes configure
to match autoconf behavior.

Note that this will break compatibility with existing build scripts.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocreate_config: simplify prefix=* block, remove CONFIG_QEMU_PREFIX
Eduardo Habkost [Wed, 18 Apr 2012 19:55:48 +0000 (16:55 -0300)]
create_config: simplify prefix=* block, remove CONFIG_QEMU_PREFIX

As now that block handles only the prefix variable, the code can be much
simpler. This also removes the CONFIG_QEMU_PREFIX define as it is not
used by any C code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocreate_config: remove *dir block
Eduardo Habkost [Wed, 18 Apr 2012 19:55:47 +0000 (16:55 -0300)]
create_config: remove *dir block

Now only the qemu_*dir variables will become #defines. The other
directory names aren't used by the C code.

That means the following #defines won't be available in C code anymore:

 - CONFIG_QEMU_BINDIR
 - CONFIG_QEMU_LIBDIR
 - CONFIG_QEMU_INCLUDEDIR
 - CONFIG_QEMU_MANDIR
 - CONFIG_QEMU_SYSCONFDIR
 - CONFIG_QEMU_LIBEXECDIR

The following #defines are going to be kept because they are handled by
the qemu_* block on create_config:

 - CONFIG_QEMU_CONFDIR
 - CONFIG_QEMU_DATADIR
 - CONFIG_QEMU_DOCDIR

This one will be kept because it is set directly by ./configure:

 - CONFIG_QEMU_HELPERDIR

This patch keeps the 'prefix=*' (CONFIG_QEMU_PREFIX) pattern because
other variables may use $prefix on their config-host.mak definitions.
The remaining code will be simplified on a further patch.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>