alpha-linux-user: Translate fcntl l_type

The values of F_RDLCK, F_WRLCK, F_UNLCK, F_EXLCK, F_SHLCK
differ between alpha and other linux architectures.

This patch allows to run "dpkg" (database lock).

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <rth@twiddle.net>
alpha-linux-user: Correct select

Alpha, like s390x, passes all select arguments in registers.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <rth@twiddle.net>
bswap: improve gluing

OpenBSD system compiler (gcc 4.2.1) has problems with concatenation
of macro arguments in macro functions:
  CC    aes.o
In file included from /src/qemu/include/qemu-common.h:126,
                 from /src/qemu/aes.c:30:
/src/qemu/include/qemu/bswap.h: In function 'leul_to_cpu':
/src/qemu/include/qemu/bswap.h:461: warning: implicit declaration of function 'bswapHOST_LONG_BITS'
/src/qemu/include/qemu/bswap.h:461: warning: nested extern declaration of 'bswapHOST_LONG_BITS'

Function leul_to_cpu() is only used in kvm-all.c, so the warnings
are not fatal on OpenBSD without -Werror.

Fix by applying glue(). Also add do {} while(0) wrapping and fix
semicolon use while at it.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
HMP: add QDict to info callback handler

  This patch change all info call back function to take
additional QDict * parameter, which allow those command
take parameter. Now it is set to NULL at default case.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
HMP: delete info handler

  Now cmd and info handler have same format, so delete info handler.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
HMP: add infrastructure for sub command

  This patch make parsing of hmp command aware of that it may
have sub command. Also discard simple encapsulation function
monitor_find_command(). For case "@command ", space after
@command is filtered out.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
HMP: move define of mon_cmds

  Because mon_cmds may use info_cmds, so adjust the declare sequence
of them.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
HMP: add sub command table to info

  Now info command takes a table of sub info commands,
and changed do_info() to do_info_help() to do help funtion
only.
 Note that now "info <unknown-topic>" returns error instead
of list of info topics.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Makefile: drop recursive libcacard clean

Commit eb8eb53e5846a957cf333f2e1ec8cb6e0c04 ("libcacard: rewrite
Makefile in non-recursive style") refactored libcacard/Makefile so it
can be included by the top-level Makefile.

The top-level clean target still loops over subdirectories, including
libcacard/, to invoke recursive clean.  Remove libcacard from the
recursive clean since its files are already included at the top level.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: Extend documentation on QOM method concepts

Add a documentation section "Methods" and discuss among others how to
handle overriding virtual methods.

Clarify DeviceClass::realize documentation and refer to the above.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-pci: fix irqfd cleanup argument order

Order of arguments of kvm_virtio_pci_irqfd_release
got mixed up in all calls.
As a result users see assertions during cleanup.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Wenchao Xia
# Via Luiz Capitulino
* luiz/queue/qmp:
  HMP: add sub command table to info
  HMP: move define of mon_cmds
  HMP: add infrastructure for sub command
  HMP: delete info handler
  HMP: add QDict to info callback handler
openpic: move gcr write into a function

The GCR register contains too much functionality to be covered inside
of the register switch statement. Move it out into a separate function.

Signed-off-by: Alexander Graf <agraf@suse.de>
openpic: unify gcr mode mask updates

The mode mask already masks out bits we don't care about, so the
actual handling code can stay intact regardless.

Signed-off-by: Alexander Graf <agraf@suse.de>
openpic: set mixed mode as supported

The Raven MPIC implementation supports the "Mixed" mode to work with
an i8259. While we don't implement mixed mode, we should mark it as
a supported mode in the mode bitmap.

Signed-off-by: Alexander Graf <agraf@suse.de>
PPC: E500: Calculate loading blob offsets properly

We have 3 blobs we need to load when booting the system:

  - kernel
  - initrd
  - dtb

We place them in physical memory in that order. At least we should.
This patch fixes the location calculation up to take any module into
account, fixing the dtb offset along the way.

Reported-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
PPC: Provide zero SVR for -cpu e500mc and e5500

Even though our -cpu types for e500mc and e5500 are no real CPUs that
actually have version registers, a guest might still want to access
said version register and that has to succeed for a guest to be happy.

So let's expose a zero SVR value on E500_SVR SPR reads.

Signed-off-by: Alexander Graf <agraf@suse.de>
PPC: e500: Change in-memory order of load blobs

Today, we load

  <kernel> <initrd> <dtb>

into memory in that order. However, Linux has a bug where it can only
handle the dtb if it's within the first 64MB of where <kernel> starts.

So instead, let's change the order to

  <kernel> <dtb> <initrd>

making Linux happy.

Signed-off-by: Alexander Graf <agraf@suse.de>
Update Linux kernel headers

Based on kvm.git a843fac (next) plus dfdebc24 (master).

Signed-off-by: Alexander Graf <agraf@suse.de>
openpic: export e500 epr enable into a ppc.c function

Enabling and disabling the EPR capability (mpic_proxy) is a system
wide operation. As such, it belongs into the ppc.c file, since that's
where PPC specific machine wide logic happens.

Signed-off-by: Alexander Graf <agraf@suse.de>