sdk/emulator/qemu.git
12 years agoes1370: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:09:44 +0000 (13:09 +0200)]
es1370: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agovirtio-pci: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:02:30 +0000 (13:02 +0200)]
virtio-pci: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoac97: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:02:20 +0000 (13:02 +0200)]
ac97: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Implement qemu initiated shutdowns using EPOW events
David Gibson [Mon, 8 Oct 2012 18:17:39 +0000 (18:17 +0000)]
pseries: Implement qemu initiated shutdowns using EPOW events

At present, using 'system_powerdown' from the monitor or otherwise
instructing qemu to (cleanly) shut down a pseries guest will not work,
because we did not have a method of signalling the shutdown request to the
guest.

PAPR does include a usable mechanism for this, though it is rather more
involved than the equivalent on x86.  This involves sending an EPOW
(Environmental and POwer Warning) event through the PAPR event and error
logging mechanism, which also has a number of other functions.

This patch implements just enough of the event/error logging functionality
to be able to send a shutdown event to the guest.  At least with modern
guest kernels and a userspace that is up and running, this means that
system_powerdown from the qemu monitor should now work correctly on pseries
guests.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-ppc: Rework storage of VPA registration state
David Gibson [Mon, 8 Oct 2012 18:17:38 +0000 (18:17 +0000)]
target-ppc: Rework storage of VPA registration state

With PAPR guests, hypercalls allow registration of the Virtual Processor
Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow
for certain communication between the guest and hypervisor.  Currently, we
store the addresses of the three areas and the size of the dtl in
CPUPPCState.

The SLB shadow and DTL are variable sized, with the size being retrieved
from within the registered memory area at the hypercall time.  This size
can later be overwritten with other information, however, so we need to
save the size as of registration time.  We already do this for the DTL,
but not for the SLB shadow, so this patch fixes that.

In addition, we change the storage of the VPA information to use fixed
size integer types which will make life easier for syncing this data with
KVM, which we will need in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Don't allow duplicate registration of hcalls or RTAS calls
David Gibson [Mon, 8 Oct 2012 18:17:36 +0000 (18:17 +0000)]
pseries: Don't allow duplicate registration of hcalls or RTAS calls

Currently the pseries machine code allows a callback to be registered
for a hypercall number twice, as long as it's the same callback the second
time.  We don't test for duplicate registrations of RTAS callbacks at all
so it will effectively be last registratiojn wins.

This was originally done because it was awkward to ensure that the
registration happened exactly once, but the code has since been
restructured so that's no longer the case.

Duplicate registration of a hypercall or RTAS call could well suggest
a duplicate initialization which could cause other problems, so this patch
makes duplicate registrations a bug, to prevent the old behaviour from
hiding other bugs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoAdd USB option in machine options
zhlcindy@gmail.com [Sun, 2 Sep 2012 19:25:28 +0000 (19:25 +0000)]
Add USB option in machine options

When -usb option is used, global varible usb_enabled is set.
And all the plaform will create one USB controller according
to this variable. In fact, global varibles make code hard
to read.

So this patch is to remove global variable usb_enabled and
add USB option in machine options. All the plaforms will get
USB option value from machine options.

USB option of machine options will be set either by:
  * -usb
  * -machine type=pseries,usb=on

Both these ways can work now. They both set USB option in
machine options. In the future, the first way will be removed.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoe500: Fix serial initialization
Bharat Bhushan [Mon, 8 Oct 2012 06:46:54 +0000 (06:46 +0000)]
e500: Fix serial initialization

it was wrongly using serial_hds[0] instead of serial_hds[1]

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: 440: Emulate DCBR0
Alexander Graf [Sat, 6 Oct 2012 20:54:25 +0000 (22:54 +0200)]
PPC: 440: Emulate DCBR0

The DCBR0 register on 440 is used to implement system reset. The same
register is used on 405 as well, so just reuse the code.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Bamboo: Fix memory size DT property
Alexander Graf [Sat, 6 Oct 2012 00:02:05 +0000 (02:02 +0200)]
PPC: Bamboo: Fix memory size DT property

Device tree properties need to be specified in big endian. Fix the
bamboo memory size property accordingly.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: qemu-stable@nongnu.org
12 years agoDrop unnecessary check of TARGET_PHYS_ADDR_SPACE_BITS
Peter Maydell [Fri, 5 Oct 2012 07:09:02 +0000 (07:09 +0000)]
Drop unnecessary check of TARGET_PHYS_ADDR_SPACE_BITS

For all our PPC targets the physical address space is at least
36 bits, so drop an unnecessary preprocessor conditional check
on TARGET_PHYS_ADDR_SPACE_BITS (erroneously introduced as part
of the change from target_phys_addr_t to hwaddr). This brings
this bit of code into line with the way we handle the other
cases which were originally checking TARGET_PHYS_ADDR_BITS in
order to avoid compiler complaints about overflowing a 32 bit type.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agohw/xtensa_sim: get rid of intermediate xtensa_sim_init
Max Filippov [Thu, 25 Oct 2012 11:37:52 +0000 (15:37 +0400)]
hw/xtensa_sim: get rid of intermediate xtensa_sim_init

Remove xtensa_sim_init that only explodes machine init args, rename
sim_init to xtensa_sim_init.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/xtensa_lx60: don't prematurely explode QEMUMachineInitArgs
Max Filippov [Thu, 25 Oct 2012 11:37:51 +0000 (15:37 +0400)]
hw/xtensa_lx60: don't prematurely explode QEMUMachineInitArgs

Don't explode QEMUMachineInitArgs before passing it to lx_init.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMakefile: Forbid out-of-tree build from a source tree that has been built in
Peter Maydell [Fri, 19 Oct 2012 13:54:23 +0000 (14:54 +0100)]
Makefile: Forbid out-of-tree build from a source tree that has been built in

If we try to do an out-of-tree build but the source tree we're building from
has been used in the past for an in-tree build then things will go
confusingly wrong. Specifically, some parts of the build process will pull
in generated files from the old in-tree build (because SRC_PATH is on
the vpath). Diagnose this situation so we can produce a useful error
message and tell the user how to fix it (run distclean in the source tree).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotests/tcg: fix a few warnings
Catalin Patulea [Mon, 22 Oct 2012 23:18:35 +0000 (19:18 -0400)]
tests/tcg: fix a few warnings

Signed-off-by: Catalin Patulea <catalinp@google.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc64: disable VGA cirrus
Aurelien Jarno [Sun, 21 Oct 2012 22:50:58 +0000 (00:50 +0200)]
target-sparc64: disable VGA cirrus

OpenBIOS on sparc64 only support Standard VGA and not Cirrus VGA. Don't
build Cirrus VGA support so that it can't be selected.

This fixes the breakage introduced by commit f2898771.

Reported-by: Richard Henderson <rth@twiddle.net>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Richard Henderson <rth@twiddle.net>
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, 27 Oct 2012 14:21:37 +0000 (14:21 +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: Remove out of date FIXME regarding saturating arithmetic
  target-arm: Implement abs_i32 inline rather than as a helper
  target-arm: Use TCG operation for Neon 64 bit negation
  arm-semi.c: Handle get/put_user() failure accessing arguments

12 years agoconfigure: avoid compiler warning in pipe2 detection
Bruce Rogers [Mon, 20 Aug 2012 18:45:08 +0000 (12:45 -0600)]
configure: avoid compiler warning in pipe2 detection

When building qemu-kvm for openSUSE:Factory, I am getting a
warning in the pipe2 detection performed by configure, which
prevents using --enable-werror.

Change detection code to use return value of pipe2.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: Disable (clang) initializer-overrides warnings
Peter Maydell [Sun, 14 Oct 2012 20:00:39 +0000 (21:00 +0100)]
configure: Disable (clang) initializer-overrides warnings

Disable clang's initializer-overrides warnings, as QEMU makes significant
use of the pattern of initializing an array with a range-based default
entry like
    [0 ... 0x1ff] = { GPIO_NONE, 0 }
followed by specific entries which override that default, and clang
would otherwise warn "initializer overrides prior initialization of
this subobject" when it encountered the specific entry.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agowin32: fix broken build due to missing QEMU_MADV_HUGEPAGE
Luiz Capitulino [Wed, 24 Oct 2012 16:12:15 +0000 (14:12 -0200)]
win32: fix broken build due to missing QEMU_MADV_HUGEPAGE

Commit ad0b5321f1f797274603ebbe20108b0750baee94 forgot to add
QEMU_MADV_HUGEPAGE macros for when CONFIG_MADVISE is not defined.
This broke the build for Windows. Fix it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Wed, 24 Oct 2012 14:39:49 +0000 (09:39 -0500)]
Merge remote-tracking branch 'bonzini/nbd-next' into staging

* bonzini/nbd-next: (30 commits)
  qmp: add NBD server commands
  block: add close notifiers
  block: prepare code for adding block notifiers
  qemu-sockets: add socket_listen, socket_connect, socket_parse
  tests: do not include tools-obj-y Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  qemu-sockets: return InetSocketAddress from inet_parse
  qapi: add socket address types
  build: add QAPI files to the tools
  vnc: drop QERR_VNC_SERVER_FAILED
  qemu-sockets: add error propagation to Unix socket functions
  qemu-sockets: add error propagation to inet_parse
  qemu-sockets: add error propagation to inet_dgram_opts
  qemu-sockets: add error propagation to inet_connect_addr
  qemu-sockets: include strerror or gai_strerror output in error messages
  vnc: add error propagation to vnc_display_open
  vnc: reorganize code for reverse mode
  vnc: introduce a single label for error returns
  vnc: avoid Yoda conditionals
  qemu-ga: ask and print error information from qemu-sockets
  nbd: ask and print error information from qemu-sockets
  ...

12 years agotarget-arm: Remove out of date FIXME regarding saturating arithmetic
Peter Maydell [Fri, 19 Oct 2012 04:23:05 +0000 (04:23 +0000)]
target-arm: Remove out of date FIXME regarding saturating arithmetic

Remove an out of date FIXME regarding the saturating arithmetic helpers:
we now do pass a pointer to CPUARMState to these helpers, and since
the AREG0 changes went in there is no difference between helper.c
and op_helper.c and therefore no point in moving the functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Implement abs_i32 inline rather than as a helper
Peter Maydell [Thu, 18 Oct 2012 16:40:41 +0000 (17:40 +0100)]
target-arm: Implement abs_i32 inline rather than as a helper

Implement abs_i32 inline (with movcond) rather than using a helper
function.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Use TCG operation for Neon 64 bit negation
Peter Maydell [Thu, 18 Oct 2012 15:58:52 +0000 (16:58 +0100)]
target-arm: Use TCG operation for Neon 64 bit negation

Use the TCG operation to do Neon 64 bit negations rather than calling
a helper routine for it.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoarm-semi.c: Handle get/put_user() failure accessing arguments
Peter Maydell [Sun, 14 Oct 2012 09:52:27 +0000 (09:52 +0000)]
arm-semi.c: Handle get/put_user() failure accessing arguments

Rework the handling of arguments to ARM semihosting calls so that we
handle a possible failure return from get_user_ual() or put_user_ual().
(This incidentally silences a lot of warnings from clang about
"expression result unused").

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoqmp: add NBD server commands
Paolo Bonzini [Wed, 22 Aug 2012 14:43:07 +0000 (16:43 +0200)]
qmp: add NBD server commands

Adding an NBD server inside QEMU is trivial, since all the logic is
in nbd.c and can be shared easily between qemu-nbd and QEMU itself.
The main difference is that qemu-nbd serves a single unnamed export,
while QEMU serves named exports.

Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoblock: add close notifiers
Paolo Bonzini [Thu, 23 Aug 2012 09:20:36 +0000 (11:20 +0200)]
block: add close notifiers

The first user of close notifiers will be the embedded NBD server.
It would be possible to use them to do some of the ad hoc processing
(e.g. for block jobs and I/O limits) that is currently done by
bdrv_close.

Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoblock: prepare code for adding block notifiers
Paolo Bonzini [Fri, 19 Oct 2012 09:36:48 +0000 (11:36 +0200)]
block: prepare code for adding block notifiers

There is no reason in principle to skip job cancellation and draining
of pending I/O when there is no medium in the disk.  Do these unconditionally,
which also prepares the code for the next patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: add socket_listen, socket_connect, socket_parse
Paolo Bonzini [Tue, 23 Oct 2012 19:31:53 +0000 (21:31 +0200)]
qemu-sockets: add socket_listen, socket_connect, socket_parse

These are QAPI-friendly versions of the qemu-sockets functions.  They
support IP sockets, Unix sockets, and named file descriptors, using a
QAPI union to dispatch to the correct function.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agotests: do not include tools-obj-y
Paolo Bonzini [Tue, 23 Oct 2012 20:36:08 +0000 (22:36 +0200)]
tests: do not include tools-obj-y
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: return InetSocketAddress from inet_parse
Paolo Bonzini [Wed, 19 Sep 2012 11:51:46 +0000 (13:51 +0200)]
qemu-sockets: return InetSocketAddress from inet_parse

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqapi: add socket address types
Paolo Bonzini [Wed, 19 Sep 2012 12:03:35 +0000 (14:03 +0200)]
qapi: add socket address types

Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agobuild: add QAPI files to the tools
Paolo Bonzini [Wed, 19 Sep 2012 13:11:05 +0000 (15:11 +0200)]
build: add QAPI files to the tools

We need them because qemu-sockets will soon be using SocketAddress.

Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoRename target_phys_addr_t to hwaddr
Avi Kivity [Tue, 23 Oct 2012 10:30:10 +0000 (12:30 +0200)]
Rename target_phys_addr_t to hwaddr

target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
reserved) and its purpose doesn't match the name (most target_phys_addr_t
addresses are not target specific).  Replace it with a finger-friendly,
standards conformant hwaddr.

Outstanding patchsets can be fixed up with the command

  git rebase -i --exec 'find -name "*.[ch]"
                        | xargs s/target_phys_addr_t/hwaddr/g' origin

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovnc: drop QERR_VNC_SERVER_FAILED
Paolo Bonzini [Fri, 19 Oct 2012 09:34:18 +0000 (11:34 +0200)]
vnc: drop QERR_VNC_SERVER_FAILED

We now always return "nice" error messages in errp when we goto fail.
Drop the default error message.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: add error propagation to Unix socket functions
Paolo Bonzini [Wed, 19 Sep 2012 11:54:39 +0000 (13:54 +0200)]
qemu-sockets: add error propagation to Unix socket functions

Before:

    $ qemu-system-x86_64 -monitor unix:/vvv,server=off
    connect(unix:/vvv): No such file or directory
    chardev: opening backend "socket" failed

After:

    $ x86_64-softmmu/qemu-system-x86_64 -monitor unix:/vvv,server=off
    qemu-system-x86_64: -monitor unix:/vvv,server=off: Failed to connect to socket: No such file or directory
    chardev: opening backend "socket" failed

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: add error propagation to inet_parse
Paolo Bonzini [Wed, 19 Sep 2012 11:22:21 +0000 (13:22 +0200)]
qemu-sockets: add error propagation to inet_parse

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: add error propagation to inet_dgram_opts
Paolo Bonzini [Tue, 2 Oct 2012 07:25:14 +0000 (09:25 +0200)]
qemu-sockets: add error propagation to inet_dgram_opts

Before:

    $ qemu-system-x86_64 -monitor udp:localhost:631@localhost:631
    inet_dgram_opts: bind(ipv4,127.0.0.1,631): OK
    inet_dgram_opts failed
    chardev: opening backend "udp" failed

After:

    $ x86_64-softmmu/qemu-system-x86_64 -monitor udp:localhost:631@localhost:631
    qemu-system-x86_64: -monitor udp:localhost:631@localhost:631: Failed to bind socket: Address already in use
    chardev: opening backend "udp" failed

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: add error propagation to inet_connect_addr
Paolo Bonzini [Tue, 2 Oct 2012 07:19:01 +0000 (09:19 +0200)]
qemu-sockets: add error propagation to inet_connect_addr

perror and fprintf can be removed because all clients can now consume
Errors properly.  However, we'll need to change the non-blocking connect
handlers to take an Error, in order to improve error handling for
migration with the TCP protocol.

This is a minor degradation in error reporting for outgoing migration.
However, until 1.2 this case just failed without even attempting to
connect, so it is still an improvement as far as overall QoI is
concerned.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: include strerror or gai_strerror output in error messages
Paolo Bonzini [Tue, 2 Oct 2012 07:18:02 +0000 (09:18 +0200)]
qemu-sockets: include strerror or gai_strerror output in error messages

Among others, before:

    $ qemu-system-x86_64 -chardev socket,port=12345,id=char
    inet_connect: host and/or port not specified
    chardev: opening backend "socket" failed

After:

    $ x86_64-softmmu/qemu-system-x86_64 -chardev socket,port=12345,id=char
    qemu-system-x86_64: -chardev socket,port=12345,id=char: host and/or port not specified
    chardev: opening backend "socket" failed

perror and fprintf can be removed because all clients can now
consume Errors properly.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovnc: add error propagation to vnc_display_open
Paolo Bonzini [Tue, 2 Oct 2012 08:17:21 +0000 (10:17 +0200)]
vnc: add error propagation to vnc_display_open

Before:

    $ qemu-system-x86_64 -vnc foo.bar:12345
    getaddrinfo(foo.bar,18245): Name or service not known
    Failed to start VNC server on `foo.bar:12345'

    $ qemu-system-x86_64 -vnc localhost:12345,reverse=on
    inet_connect_opts: connect(ipv4,yakj.usersys.redhat.com,127.0.0.1,12345): Connection refused
    Failed to start VNC server on `localhost:12345,reverse=on'

After:

    $ x86_64-softmmu/qemu-system-x86_64 -vnc foo.bar:12345
    Failed to start VNC server on `foo.bar:12345': address resolution failed for foo.bar:18245: Name or service not known

    $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:12345,reverse=on
    Failed to start VNC server on `localhost:12345,reverse=on': Failed to connect to socket: Connection refused

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovnc: reorganize code for reverse mode
Paolo Bonzini [Thu, 18 Oct 2012 07:01:01 +0000 (09:01 +0200)]
vnc: reorganize code for reverse mode

Avoid the dance between csock and vs->lsock.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovnc: introduce a single label for error returns
Paolo Bonzini [Thu, 18 Oct 2012 07:07:05 +0000 (09:07 +0200)]
vnc: introduce a single label for error returns

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovnc: avoid Yoda conditionals
Paolo Bonzini [Thu, 18 Oct 2012 07:06:21 +0000 (09:06 +0200)]
vnc: avoid Yoda conditionals

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-ga: ask and print error information from qemu-sockets
Paolo Bonzini [Tue, 2 Oct 2012 08:09:14 +0000 (10:09 +0200)]
qemu-ga: ask and print error information from qemu-sockets

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agonbd: ask and print error information from qemu-sockets
Paolo Bonzini [Tue, 2 Oct 2012 08:07:21 +0000 (10:07 +0200)]
nbd: ask and print error information from qemu-sockets

Before:

    $ qemu-system-x86_64 nbd:localhost:12345
    inet_connect_opts: connect(ipv4,yakj.usersys.redhat.com,127.0.0.1,12345): Connection refused
    qemu-system-x86_64: could not open disk image nbd:localhost:12345: Connection refused

After:

    $ x86_64-softmmu/qemu-system-x86_64 nbd:localhost:12345
    qemu-system-x86_64: Failed to connect to socket: Connection refused
    qemu-system-x86_64: could not open disk image nbd:localhost:12345: Connection refused

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-char: ask and print error information from qemu-sockets
Paolo Bonzini [Tue, 2 Oct 2012 07:16:49 +0000 (09:16 +0200)]
qemu-char: ask and print error information from qemu-sockets

Before:

    $ qemu-system-x86_64 -monitor tcp:localhost:6000
    (starts despite error)

    $ qemu-system-x86_64 -monitor tcp:foo.bar:12345
    getaddrinfo(foo.bar,12345): Name or service not known
    chardev: opening backend "socket" failed

    $ qemu-system-x86_64 -monitor tcp:localhost:443,server=on
    inet_listen_opts: bind(ipv4,127.0.0.1,443): Permission denied
    inet_listen_opts: FAILED
    chardev: opening backend "socket" failed

After:

    $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:localhost:6000
    x86_64-softmmu/qemu-system-x86_64: -monitor tcp:localhost:6000: Failed to connect to socket: Connection refused
    chardev: opening backend "socket" failed

    $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:foo.bar:12345
    qemu-system-x86_64: -monitor tcp:foo.bar:12345: address resolution failed for foo.bar:12345: Name or service not known
    chardev: opening backend "socket" failed

    $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:localhost:443,server=on
    qemu-system-x86_64: -monitor tcp:localhost:443,server=on: Failed to bind socket: Permission denied
    chardev: opening backend "socket" failed

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomigration (incoming): add error propagation to fd and exec protocols
Paolo Bonzini [Tue, 2 Oct 2012 16:21:18 +0000 (18:21 +0200)]
migration (incoming): add error propagation to fd and exec protocols

And remove the superfluous integer return value.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomigration (outgoing): add error propagation for all protocols
Paolo Bonzini [Tue, 2 Oct 2012 08:02:46 +0000 (10:02 +0200)]
migration (outgoing): add error propagation for all protocols

Error propagation is already there for socket backends.  Add it to other
protocols, simplifying code that tests for errors that will never happen.
With all protocols understanding Error, the code can be simplified
further by removing the return value.

Unfortunately, the quality of error messages varies depending
on where the error is detected, because no Error is passed to the
NonBlockingConnectHandler.  Thus, the exact error message still cannot
be sent to the user if the OS reports it asynchronously via SO_ERROR.
If NonBlockingConnectHandler received an Error**, we could for
example report the error class and/or message via a new field of the
query-migration command even if it is reported asynchronously.

Before:

    (qemu) migrate fd:ffff
    migrate: An undefined error has occurred
    (qemu) info migrate
    (qemu)

After:

    (qemu) migrate fd:ffff
    migrate: File descriptor named 'ffff' has not been found
    (qemu) info migrate
    capabilities: xbzrle: off
    Migration status: failed
    total time: 0 milliseconds

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomigration: use qemu-sockets to establish Unix sockets
Paolo Bonzini [Wed, 3 Oct 2012 12:05:49 +0000 (14:05 +0200)]
migration: use qemu-sockets to establish Unix sockets

This makes migration-unix.c again a cut-and-paste job from migration-tcp.c,
exactly as it was in the beginning. :)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomigration: centralize call to migrate_fd_error()
Paolo Bonzini [Tue, 2 Oct 2012 07:59:38 +0000 (09:59 +0200)]
migration: centralize call to migrate_fd_error()

The call to migrate_fd_error() was missing for non-socket backends, so
centralize it in qmp_migrate().

Before:

    (qemu) migrate fd:ffff
    migrate: An undefined error has occurred
    (qemu) info migrate
    (qemu)

After:

    (qemu) migrate fd:ffff
    migrate: An undefined error has occurred
    (qemu) info migrate
    capabilities: xbzrle: off
    Migration status: failed
    total time: 0 milliseconds

(The awful error message will be fixed later in the series).

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomigration: avoid using error_is_set and thus relying on errp != NULL
Paolo Bonzini [Wed, 3 Oct 2012 12:34:33 +0000 (14:34 +0200)]
migration: avoid using error_is_set and thus relying on errp != NULL

The migration code is using errp to detect "internal" errors, this means
that it relies on errp being non-NULL.

No impact so far because our only QMP clients (the QMP marshaller and HMP)
never pass a NULL Error **.  But if we had others, this patch would make
sure that migration can work with a NULL Error **.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: add nonblocking connect for Unix sockets
Paolo Bonzini [Wed, 3 Oct 2012 11:37:46 +0000 (13:37 +0200)]
qemu-sockets: add nonblocking connect for Unix sockets

This patch mostly mimics what was done to TCP sockets, but simpler
because there is only one address to try.  It also includes a free EINTR
bug fix.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: unix_listen and unix_connect are portable
Paolo Bonzini [Thu, 18 Oct 2012 06:44:00 +0000 (08:44 +0200)]
qemu-sockets: unix_listen and unix_connect are portable

They are just wrappers and do not need a Win32-specific version.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-sockets: add Error ** to all functions
Paolo Bonzini [Tue, 2 Oct 2012 07:35:32 +0000 (09:35 +0200)]
qemu-sockets: add Error ** to all functions

This lets me adjust the clients to do proper error propagation first,
thus avoiding temporary regressions in the quality of the error messages.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoerror: add error_set_errno and error_setg_errno
Paolo Bonzini [Tue, 2 Oct 2012 07:00:45 +0000 (09:00 +0200)]
error: add error_set_errno and error_setg_errno

These functions help maintaining homogeneous formatting of error
messages that include strerror values.

Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoMerge remote-tracking branch 'qemu-kvm/memory/urgent' into staging
Anthony Liguori [Mon, 22 Oct 2012 19:49:18 +0000 (14:49 -0500)]
Merge remote-tracking branch 'qemu-kvm/memory/urgent' into staging

* qemu-kvm/memory/urgent:
  memory: abort if a memory region is destroyed during a transaction
  i440fx: avoid destroying memory regions within a transaction
  memory: Make eventfd adhere to device endianness

12 years agoMerge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20121017.0' into staging
Anthony Liguori [Mon, 22 Oct 2012 19:48:23 +0000 (14:48 -0500)]
Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20121017.0' into staging

* awilliam/tags/vfio-pci-for-qemu-20121017.0:
  vfio-pci: Mark non-migratable
  vfio-pci: Fix debug build

12 years agousb-serial: only expose device in guest when the chardev is open
Gerd Hoffmann [Wed, 17 Oct 2012 07:54:25 +0000 (09:54 +0200)]
usb-serial: only expose device in guest when the chardev is open

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-serial: don't magically zap chardev on umplug
Gerd Hoffmann [Wed, 17 Oct 2012 07:54:24 +0000 (09:54 +0200)]
usb-serial: don't magically zap chardev on umplug

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoserial: add pci-serial documentation
Gerd Hoffmann [Wed, 17 Oct 2012 07:54:23 +0000 (09:54 +0200)]
serial: add pci-serial documentation

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoserial: add 2x + 4x pci variant
Gerd Hoffmann [Wed, 17 Oct 2012 07:54:22 +0000 (09:54 +0200)]
serial: add 2x + 4x pci variant

Add multiport serial card implementation, with two variants, one
featuring two and one featuring four ports.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoserial: add windows inf file for the pci card to docs
Gerd Hoffmann [Wed, 17 Oct 2012 07:54:21 +0000 (09:54 +0200)]
serial: add windows inf file for the pci card to docs

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoserial: add pci variant
Gerd Hoffmann [Wed, 17 Oct 2012 07:54:20 +0000 (09:54 +0200)]
serial: add pci variant

So we get a hot-pluggable 16550 uart.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoserial: split serial.c
Gerd Hoffmann [Wed, 17 Oct 2012 07:54:19 +0000 (09:54 +0200)]
serial: split serial.c

Split serial.c into serial.c, serial.h and serial-isa.c.  While being at
creating a serial.h header file move the serial prototypes from pc.h to
the new serial.h.  The latter leads to s/pc.h/serial.h/ in tons of
boards which just want the serial bits from pc.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoCall MADV_HUGEPAGE for guest RAM allocations
Luiz Capitulino [Fri, 5 Oct 2012 19:47:57 +0000 (16:47 -0300)]
Call MADV_HUGEPAGE for guest RAM allocations

This makes it possible for QEMU to use transparent huge pages (THP)
when transparent_hugepage/enabled=madvise. Otherwise THP is only
used when it's enabled system wide.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'quintela/migration-next-20121017' into staging
Anthony Liguori [Mon, 22 Oct 2012 18:26:23 +0000 (13:26 -0500)]
Merge remote-tracking branch 'quintela/migration-next-20121017' into staging

* quintela/migration-next-20121017: (41 commits)
  cpus: create qemu_in_vcpu_thread()
  savevm: make qemu_file_put_notify() return errors
  savevm: un-export qemu_file_set_error()
  block-migration: handle errors with the return codes correctly
  block-migration:  Switch meaning of return value
  block-migration: make flush_blks() return errors
  buffered_file: buffered_put_buffer() don't need to set last_error
  savevm: Only qemu_fflush() can generate errors
  savevm: make qemu_fill_buffer() be consistent
  savevm: unexport qemu_ftell()
  savevm: unfold qemu_fclose_internal()
  savevm: make qemu_fflush() return an error code
  savevm: Remove qemu_fseek()
  virtio-net: use qemu_get_buffer() in a temp buffer
  savevm: unexport qemu_fflush
  migration: make migrate_fd_wait_for_unfreeze() return errors
  buffered_file: make buffered_flush return the error code
  buffered_file: callers of buffered_flush() already check for errors
  buffered_file: We can access directly to bandwidth_limit
  buffered_file: unfold migrate_fd_close
  ...

12 years agoMerge remote-tracking branch 'qemu-kvm/memory/dma' into staging
Anthony Liguori [Mon, 22 Oct 2012 18:26:07 +0000 (13:26 -0500)]
Merge remote-tracking branch 'qemu-kvm/memory/dma' into staging

* qemu-kvm/memory/dma: (23 commits)
  pci: honor PCI_COMMAND_MASTER
  pci: give each device its own address space
  memory: add address_space_destroy()
  dma: make dma access its own address space
  memory: per-AddressSpace dispatch
  s390: avoid reaching into memory core internals
  memory: use AddressSpace for MemoryListener filtering
  memory: move tcg flush into a tcg memory listener
  memory: move address_space_memory and address_space_io out of memory core
  memory: manage coalesced mmio via a MemoryListener
  xen: drop no-op MemoryListener callbacks
  kvm: drop no-op MemoryListener callbacks
  xen_pt: drop no-op MemoryListener callbacks
  vfio: drop no-op MemoryListener callbacks
  memory: drop no-op MemoryListener callbacks
  memory: provide defaults for MemoryListener operations
  memory: maintain a list of address spaces
  memory: export AddressSpace
  memory: prepare AddressSpace for exporting
  xen_pt: use separate MemoryListeners for memory and I/O
  ...

12 years agopci: honor PCI_COMMAND_MASTER
Avi Kivity [Wed, 3 Oct 2012 15:42:58 +0000 (17:42 +0200)]
pci: honor PCI_COMMAND_MASTER

Currently we ignore PCI_COMMAND_MASTER completely: DMA succeeds even when
the bit is clear.

Honor PCI_COMMAND_MASTER by inserting a memory region into the device's
bus master address space, and tying its enable status to PCI_COMMAND_MASTER.

Tested using

  setpci -s 03 COMMAND=3

while a ping was running on a NIC in slot 3.  The kernel (Linux) detected
the stall and recovered after the command

  setpci -s 03 COMMAND=7

was issued.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agopci: give each device its own address space
Avi Kivity [Wed, 3 Oct 2012 15:17:27 +0000 (17:17 +0200)]
pci: give each device its own address space

Accesses from different devices can resolve differently
(depending on bridge settings, iommus, and PCI_COMMAND_MASTER), so
set up an address space for each device.

Currently iommus are expressed outside the memory API, so this doesn't
work if an iommu is present.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: add address_space_destroy()
Avi Kivity [Sun, 7 Oct 2012 10:59:55 +0000 (12:59 +0200)]
memory: add address_space_destroy()

Since address spaces can be created dynamically by device hotplug, they
can also be destroyed dynamically.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agodma: make dma access its own address space
Avi Kivity [Wed, 3 Oct 2012 14:42:37 +0000 (16:42 +0200)]
dma: make dma access its own address space

Instead of accessing the cpu address space, use an address space
configured by the caller.

Eventually all dma functionality will be folded into AddressSpace,
but we have to start from something.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: per-AddressSpace dispatch
Avi Kivity [Wed, 3 Oct 2012 14:22:53 +0000 (16:22 +0200)]
memory: per-AddressSpace dispatch

Currently we use a global radix tree to dispatch memory access.  This only
works with a single address space; to support multiple address spaces we
make the radix tree a member of AddressSpace (via an intermediate structure
AddressSpaceDispatch to avoid exposing too many internals).

A side effect is that address_space_io also gains a dispatch table.  When
we remove all the pre-memory-API I/O registrations, we can use that for
dispatching I/O and get rid of the original I/O dispatch.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agos390: avoid reaching into memory core internals
Avi Kivity [Wed, 3 Oct 2012 14:14:23 +0000 (16:14 +0200)]
s390: avoid reaching into memory core internals

use cpu_physical_memory_is_io() instead.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: use AddressSpace for MemoryListener filtering
Avi Kivity [Tue, 2 Oct 2012 18:13:51 +0000 (20:13 +0200)]
memory: use AddressSpace for MemoryListener filtering

Using the AddressSpace type reduces confusion, as you can't accidentally
supply the MemoryRegion you're interested in.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: move tcg flush into a tcg memory listener
Avi Kivity [Tue, 2 Oct 2012 16:54:45 +0000 (18:54 +0200)]
memory: move tcg flush into a tcg memory listener

We plan to make the core listener listen to all address spaces; this
will cause many more flushes than necessary.  Prepare for that by
moving the flush into a tcg-specific listener.

Later we can avoid registering the listener if tcg is disabled.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: move address_space_memory and address_space_io out of memory core
Avi Kivity [Tue, 2 Oct 2012 16:49:28 +0000 (18:49 +0200)]
memory: move address_space_memory and address_space_io out of memory core

With this change, memory.c no longer knows anything about special address
spaces, so it is prepared for AddressSpace based DMA.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: manage coalesced mmio via a MemoryListener
Avi Kivity [Tue, 2 Oct 2012 16:21:54 +0000 (18:21 +0200)]
memory: manage coalesced mmio via a MemoryListener

Instead of calling a global function on coalesced mmio changes, which
routes the call to kvm if enabled, add coalesced mmio hooks to
MemoryListener and make kvm use that instead.

The motivation is support for multiple address spaces (which means we
we need to filter the call on the right address space) but the result
is cleaner as well.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agofix CONFIG_QEMU_HELPERDIR generation again
Michael Tokarev [Sun, 21 Oct 2012 18:52:54 +0000 (22:52 +0400)]
fix CONFIG_QEMU_HELPERDIR generation again

commit 38f419f35225 fixed a breakage with CONFIG_QEMU_HELPERDIR
which has been introduced by 8bf188aa18ef7a8.  But while techinically
that fix has been correct, all other similar variables are handled
differently.  Make it consistent, and let scripts/create_config
expand and capitalize the variable properly like for all other
qemu_*dir variables.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
12 years agotarget-sparc: fix FMOVr instruction
Aurelien Jarno [Tue, 16 Oct 2012 23:28:35 +0000 (01:28 +0200)]
target-sparc: fix FMOVr instruction

Like the MOVr instruction, the FMOVr instruction has the condition
encoded between bits 10 and 12.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/pl031: Use LOG_GUEST_ERROR
Peter Maydell [Thu, 18 Oct 2012 13:11:42 +0000 (14:11 +0100)]
hw/pl031: Use LOG_GUEST_ERROR

Use LOG_GUEST_ERROR rather than hw_error or direct fprintf.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/pl022: Use LOG_UNIMP and LOG_GUEST_ERROR
Peter Maydell [Thu, 18 Oct 2012 13:11:41 +0000 (14:11 +0100)]
hw/pl022: Use LOG_UNIMP and LOG_GUEST_ERROR

Use LOG_UNIMP and LOG_GUEST_ERROR where appropriate rather
than hw_error().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/pl011: Use LOG_UNIMP and LOG_GUEST_ERROR
Peter Maydell [Thu, 18 Oct 2012 13:11:40 +0000 (14:11 +0100)]
hw/pl011: Use LOG_UNIMP and LOG_GUEST_ERROR

Use the new LOG_UNIMP and LOG_GUEST_ERROR logging types rather
than hw_error().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/pl190: Use LOG_GUEST_ERROR
Peter Maydell [Thu, 18 Oct 2012 13:11:39 +0000 (14:11 +0100)]
hw/pl190: Use LOG_GUEST_ERROR

If the guest attempts an offset to a nonexistent register, just
log this via LOG_GUEST_ERROR rather than killing QEMU with a hw_error.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/pl041: Use LOG_UNIMP
Peter Maydell [Thu, 18 Oct 2012 13:11:38 +0000 (14:11 +0100)]
hw/pl041: Use LOG_UNIMP

Use the new LOG_UNIMP tracing to report unimplemented
features.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/pl181: Use LOG_UNIMP and LOG_GUEST_ERROR
Peter Maydell [Thu, 18 Oct 2012 13:11:37 +0000 (14:11 +0100)]
hw/pl181: Use LOG_UNIMP and LOG_GUEST_ERROR

Rather than a mix of direct printing to stderr and aborting
via hw_error(), use LOG_UNIMP and LOG_GUEST_ERROR.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/hw.h: Add include of qemu-log.h
Peter Maydell [Thu, 18 Oct 2012 13:11:36 +0000 (14:11 +0100)]
hw/hw.h: Add include of qemu-log.h

Add an include of qemu-log.h to hw.h, so that device model
code has access to these logging functions without the need
to directly include qemu-log.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqemu-log: Add new log category for guest bugs
Peter Maydell [Thu, 18 Oct 2012 13:11:35 +0000 (14:11 +0100)]
qemu-log: Add new log category for guest bugs

Add a new category for device models to log guest behaviour
which is likely to be a guest bug of some kind (accessing
nonexistent registers, reading 32 bit wide registers with
a byte access, etc). Making this its own log category allows
those who care (mostly guest OS authors) to see the complaints
without bothering most users.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Remove cpu_tmp0 as a global
Richard Henderson [Tue, 16 Oct 2012 09:32:31 +0000 (19:32 +1000)]
target-sparc: Remove cpu_tmp0 as a global

Subroutines do their own local temporary management.
Within disas_sparc_insn we limit the existance of the variable
to OP=2 insns, and delay initialization as late as is reasonable
for the specific XOP.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Make cpu_dst local to OP=2 insns
Richard Henderson [Tue, 16 Oct 2012 09:32:30 +0000 (19:32 +1000)]
target-sparc: Make cpu_dst local to OP=2 insns

And initialize it such that it (may) write directly to rd.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Only use cpu_dst for eventual writes to a gpr
Richard Henderson [Tue, 16 Oct 2012 09:32:29 +0000 (19:32 +1000)]
target-sparc: Only use cpu_dst for eventual writes to a gpr

Use cpu_tmp0 for other stuff, like Write Priv Register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Remove last uses of cpu_tmp64
Richard Henderson [Tue, 16 Oct 2012 09:32:28 +0000 (19:32 +1000)]
target-sparc: Remove last uses of cpu_tmp64

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Remove cpu_tmp64 use from softint insns
Richard Henderson [Tue, 16 Oct 2012 09:32:27 +0000 (19:32 +1000)]
target-sparc: Remove cpu_tmp64 use from softint insns

The use of "tl" functions and a tmp64 is logically incompatible.
Use cpu_tmp0 instead.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Don't use a temporary for gen_dest_fpr_D
Richard Henderson [Tue, 16 Oct 2012 09:32:26 +0000 (19:32 +1000)]
target-sparc: Don't use a temporary for gen_dest_fpr_D

In all cases we don't have write-before-read problems.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Remove usage of cpu_tmp64 from most helper functions
Richard Henderson [Tue, 16 Oct 2012 09:32:25 +0000 (19:32 +1000)]
target-sparc: Remove usage of cpu_tmp64 from most helper functions

Use a locally allocated temporary instead.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Tidy ldfsr, stfsr
Richard Henderson [Tue, 16 Oct 2012 09:32:24 +0000 (19:32 +1000)]
target-sparc: Tidy ldfsr, stfsr

Remove the last uses of cpu_tmp32.  Unify the code between sparc64
and sparc32 by using the proper "tl" functions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Avoid cpu_tmp32 in Write Priv Register
Richard Henderson [Tue, 16 Oct 2012 09:32:23 +0000 (19:32 +1000)]
target-sparc: Avoid cpu_tmp32 in Write Priv Register

No need to copy to a temporary to store 32 bits.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Avoid cpu_tmp32 in Read Priv Register
Richard Henderson [Tue, 16 Oct 2012 09:32:22 +0000 (19:32 +1000)]
target-sparc: Avoid cpu_tmp32 in Read Priv Register

We don't need another temporary here.  Load directly into the
register we want to set.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Use get_temp_i32 in gen_dest_fpr_F
Richard Henderson [Tue, 16 Oct 2012 09:32:21 +0000 (19:32 +1000)]
target-sparc: Use get_temp_i32 in gen_dest_fpr_F

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Split out get_temp_i32
Richard Henderson [Tue, 16 Oct 2012 09:32:20 +0000 (19:32 +1000)]
target-sparc: Split out get_temp_i32

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>