sdk/emulator/qemu.git
11 years agotarget-ppc: optimize fabs, fnabs, fneg
Aurelien Jarno [Sat, 20 Apr 2013 08:56:13 +0000 (08:56 +0000)]
target-ppc: optimize fabs, fnabs, fneg

fabs, fnabs and fneg are just flipping the bit sign of an FP register,
this can be implemented in TCG instead of using softfloat.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Fix dcbz for linux-user on 970
Alexander Graf [Fri, 26 Apr 2013 07:18:58 +0000 (09:18 +0200)]
PPC: Fix dcbz for linux-user on 970

The default with linux-user for dcbz on 970 is to emulate 32 byte clears.
However, redoing the dcbzl support we added a check to not honor the bit
in HID5 that sets this.

Remove the #ifdef check on linux user, so that we get 32 byte clears again.

Reported-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopowerpc: correctly handle fpu exceptions.
Tristan Gingold [Tue, 9 Apr 2013 05:00:55 +0000 (05:00 +0000)]
powerpc: correctly handle fpu exceptions.

Raise the exception on the first occurence, do not wait for the next
floating point operation.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Generate device paths for VIO devices
David Gibson [Sun, 7 Apr 2013 19:08:17 +0000 (19:08 +0000)]
pseries: Generate device paths for VIO devices

This patch implements a get_dev_path qdev hook for the pseries paravirtual
VIO bus.  With upcoming savevm support, this will become very important for
scsi disks hanging of VIO virtual SCSI adapters.  scsibus_get_dev_path
uses the get_dev_path of the parent adapter if available, but otherwise
just uses a local channel/target/lun number to identify the device.  So if
two disks are present in the system having the same target and lun on
seperate VIO scsi adapters, savevm cannot distinguish them.  Since the
conventional way of using VSCSI adapters is to have just one disk per
adapter, such a conflict is very likely.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Convert VIO code to QOM style type safe(ish) casts
David Gibson [Sun, 7 Apr 2013 19:08:16 +0000 (19:08 +0000)]
pseries: Convert VIO code to QOM style type safe(ish) casts

Curerntly the pseries VIO device code contains quite a few explicit
uses of DO_UPCAST and plain C casts.  This is (obviously) type unsafe,
and not the conventional way of doing things in the QOM model.  This
patch converts the code to use the QOM convention of per-type macros
to do verified casts with OBJECT_CHECK().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Synchronize VPA state with KVM
David Gibson [Sun, 7 Apr 2013 19:08:22 +0000 (19:08 +0000)]
target-ppc: Synchronize VPA state with KVM

For PAPR guests, KVM tracks the various areas registered with the
H_REGISTER_VPA hypercall.  For full emulation, of course, these are tracked
within qemu.  At present these values are not synchronized.  This is a
problem for reset (qemu's reset of the VPA address is not pushed to KVM)
and will also be a problem for savevm / migration.

The kernel now supports accessing the VPA state via the ONE_REG interface,
this patch adds code to qemu to use that interface to keep the qemu and
KVM ideas of the VPA state synchronized.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Fix some small errors in XICS logic
David Gibson [Sun, 7 Apr 2013 19:08:21 +0000 (19:08 +0000)]
pseries: Fix some small errors in XICS logic

Under certain circumstances the emulation for the pseries "XICS" interrupt
controller was clearing a pending interrupt from the XISR register, without
also clearing the corresponding priority variable.  This will cause
problems later when can trigger sanity checks in the under-development
in-kernel XICS implementation.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Add more stubs for POWER7 PMU registers
David Gibson [Sun, 7 Apr 2013 19:08:20 +0000 (19:08 +0000)]
target-ppc: Add more stubs for POWER7 PMU registers

In addition to the performance monitor registers found on nearly all
6xx chips, the POWER7 has two additional counters (PMC5 & PMC6) and an
extra control register (MMCRA).  This patch adds stub support for them to
qemu - the registers won't do anything, but with this change won't cause
illegal instruction traps accessing them.  They're also registered with
their ONE_REG ids, so their value will be kept in sync with KVM where
appropriate.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Fixes and enhancements to L1 cache properties
David Gibson [Sun, 7 Apr 2013 19:08:19 +0000 (19:08 +0000)]
pseries: Fixes and enhancements to L1 cache properties

PAPR requires that the device tree's CPU nodes have several properties
with information about the L1 cache.  We already create two of these
properties, but with incorrect names - "[id]cache-block-size" instead
of "[id]-cache-block-size" (note the extra hyphen).

We were also missing some of the required cache properties.  This
patch adds the [id]-cache-line-size properties (which have the same
values as the block size properties in all current cases).  We also
add the [id]-cache-size properties.

Adding the cache sizes requires some extra infrastructure in the
general target-ppc code to (optionally) set the cache sizes for
various CPUs.  The CPU family descriptions in translate_init.c can set
these sizes - this patch adds correct information for POWER7, I'm
leaving other CPU types to people who have a physical example to
verify against.  In addition, for -cpu host we take the values
advertised by the host (if available) and use those to override the
information based on PVR.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Fix incorrect calculation of RMA size in certain configurations
David Gibson [Sun, 7 Apr 2013 19:08:18 +0000 (19:08 +0000)]
pseries: Fix incorrect calculation of RMA size in certain configurations

For the pseries machine, we need to advertise to the guest the size of its
RMA - that is the amount of memory it can access with the MMU off.  For HV
KVM, this is constrained by the hardware limitations on the virtual RMA of
one hash PTE per PTE group in the hash page table.  We already had code to
calculate this, but it was assuming the VRMA page size was the same as the
(host) backing page size for guest RAM.

In the case of a host kernel configured for 64k base page size, but running
on hardware (or firmware) which only allows 4k pages, the hose will do all
its allocations with a 64k page size, but still use 4k hardware pages for
actual mappings.  Usually that's transparent to things running under the
host, but in the case of the maximum VRMA size it's not.

This patch refines the RMA size calculation to instead use the largest
available hardware page size (as reported by the SMMU_INFO call) which is
less than or equal to the backing page size.  This now gives the correct
RMA size in all cases I've tested.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Fix compile with profiling enabled
Alexander Graf [Fri, 19 Apr 2013 00:35:08 +0000 (02:35 +0200)]
PPC: Fix compile with profiling enabled

When using profiling, we rely on profile_getclock() being available
at our disposal. Somehow that function got moved from an indirect
include we used to have in translate-init.c, so that we were now
left not properly compiling anymore.

Add an explicit include to timer.h which defines profile_getclock,
so that we can compile again.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: mac newworld: fix cpu NIP reset value
Alexander Graf [Thu, 4 Apr 2013 16:45:07 +0000 (18:45 +0200)]
PPC: mac newworld: fix cpu NIP reset value

On -M mac99, we can run 970 CPUs. However, these CPUs define the initial
instruction pointer they start execution at as part of their bootup protocol,
so effectively it's up to the board to decide where they start.

This went unnoticed, because they used to boot at the same location our flash
was mapped to, but due to the recent reset changes our 970 CPUs want to reset
to 0x100 now, which is always a 0 instruction.

Set the initial IP to something reasonable for -M mac99.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Fabien Chouteau <chouteau@adacore.com>
11 years agoEnable kvm emulated watchdog
Bharat Bhushan [Sun, 24 Feb 2013 18:16:21 +0000 (18:16 +0000)]
Enable kvm emulated watchdog

Enable the KVM emulated watchdog if KVM supports (use the
capability enablement in watchdog handler). Also watchdog exit
(KVM_EXIT_WATCHDOG) handling is added.
Watchdog state machine is cleared whenever VM state changes to running.
This is to handle the cases like return from debug halt etc.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
[agraf: rebase to current code base, fix non-kvm cases]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agolinux-headers: Update to kvm/queue
Alexander Graf [Thu, 4 Apr 2013 13:40:44 +0000 (15:40 +0200)]
linux-headers: Update to kvm/queue

Based on kvm.git queue branch with commit e1e2e605.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Fix narrow-mode add/sub carry output
Richard Henderson [Wed, 3 Apr 2013 10:56:45 +0000 (10:56 +0000)]
target-ppc: Fix narrow-mode add/sub carry output

Broken in b5a73f8d8a57e940f9bbeb399a9e47897522ee9a, the carry itself was
fixed in 79482e5ab38a05ca8869040b0d8b8f451f16ff62.  But we still need to
produce the full 64-bit addition.

Simplify the conditions at the top of the functions for when we need a
new temporary.  Only plain addition is important enough to warrent avoiding
the temporary, and the extra tcg move op that would come with it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Add breakpoint registers for 603 and e300
Fabien Chouteau [Wed, 3 Apr 2013 04:03:38 +0000 (04:03 +0000)]
PPC: Add breakpoint registers for 603 and e300

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: fix hreset_vector for 60x, 7x0, 7x5, G2, MPC8xx, MPC5xx, 7400 and 7450
Fabien Chouteau [Fri, 29 Mar 2013 02:06:28 +0000 (02:06 +0000)]
PPC: fix hreset_vector for 60x, 7x0, 7x5, G2, MPC8xx, MPC5xx, 7400 and 7450

According to the different user's manuals, the vector offset for system
reset (both /HRESET and /SRESET) is 0x00100.

This patch may break support of some executables, as the power-on start
address may change. For a specific board, if the power-on start address
is different than HRESET vector (i.e. 0x00000100 or 0xfff00100), this
should be fixed in board's initialization code.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: fix nego and subf*o instructions
Aurelien Jarno [Sun, 31 Mar 2013 14:33:16 +0000 (14:33 +0000)]
target-ppc: fix nego and subf*o instructions

The overflow computation of nego and subf*o instructions has been broken
in commit ffe30937. Contrary to other targets, the instruction is subtract
from an not subtract on PowerPC.

This patch fixes the issue by using the correct argument in the xor
computation. Thanks to Peter Maydell for the hint.

With this change the PPC emulation passes the Gwenole Beauchesne
testsuite again.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Remove env->hreset_excp_prefix
Fabien Chouteau [Fri, 29 Mar 2013 02:06:27 +0000 (02:06 +0000)]
PPC: Remove env->hreset_excp_prefix

This value is not needed if we use correctly the MSR[IP] bit.

excp_prefix is always 0x00000000, except when the MSR[IP] bit is
implemented and set to 1, in that case excp_prefix is 0xfff00000.

The handling of MSR[IP] was already implemented but not used at reset
because the value of env->msr was changed "manually".

The patch uses the function hreg_store_msr() to set env->msr, this
ensures a good handling of MSR[IP] at reset, and therefore a good value
for excp_prefix.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: e500: advertise 4.2 MPIC only if KVM supports EPR
Stuart Yoder [Sat, 30 Mar 2013 06:40:49 +0000 (06:40 +0000)]
PPC: e500: advertise 4.2 MPIC only if KVM supports EPR

Older KVM versions don't support EPR which breaks guests when we announce
MPIC variants that support EPR.

Catch that case and expose only MPIC version 2.0 which tells the guest that
we don't support the EPR capability yet.

Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
[agraf: Add comment, route cap check through kvm_ppc.c]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Enable ISEL on POWER7
Aurelien Jarno [Mon, 1 Apr 2013 05:06:23 +0000 (05:06 +0000)]
target-ppc: Enable ISEL on POWER7

ISEL is a Power ISA 2.06 instruction and thus is available on POWER7.
Given this is trapped and emulated by the Linux kernel, I guess it went
unnoticed.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agogtk: refactor menu creation
Anthony Liguori [Fri, 26 Apr 2013 13:48:46 +0000 (08:48 -0500)]
gtk: refactor menu creation

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Fri, 26 Apr 2013 13:32:17 +0000 (08:32 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Liu Yuan (4) and others
# Via Stefan Hajnoczi
* stefanha/block:
  sheepdog: fix loadvm operation
  sheepdog: resend write requests when SD_RES_READONLY is received
  sheepdog: add helper function to reload inode
  sheepdog: add SD_RES_READONLY result code
  sheepdog: cleanup find_vdi_name
  rbd: Fix use after free in rbd_open()
  block: Disable driver-specific options for 1.5
  sheepdog: implement .bdrv_co_is_allocated()
  sheepdog: use BDRV_SECTOR_SIZE
  sheepdog: add discard/trim support for sheepdog
  block/ssh: Require libssh2 >= 1.2.8.

Message-id: 1366976682-10251-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 26 Apr 2013 13:32:13 +0000 (08:32 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

# By Ed Maste (2) and others
# Via Stefan Hajnoczi
* stefanha/trivial-patches:
  bsd-user: Track change in FreeBSD SYSCTL(9) types
  virtio: Fix compilation without CONFIG_VHOST_SCSI
  qemu-doc: Option -ignore-environment removed.
  s390x: use CONFIG_INT128 to detect __uint128_t
  linux-user: fix compile error due to stray colon at end of #ifdef line

Message-id: 1366975563-16216-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosheepdog: fix loadvm operation
Liu Yuan [Thu, 25 Apr 2013 12:49:39 +0000 (20:49 +0800)]
sheepdog: fix loadvm operation

Currently the 'loadvm' opertaion works as following:
1. switch to the snapshot
2. mark current working VDI as a snapshot
3. rely on sd_create_branch to create a new working VDI based on the snapshot

This works not the same as other format as QCOW2. For e.g,

qemu > savevm # get a live snapshot snap1
qemu > savevm # snap2
qemu > loadvm 1 # This will steally create snap3 of the working VDI

Which will result in following snapshot chain:

base <-- snap1 <-- snap2 <-- snap3
          ^
          |
      working VDI

snap3 was unnecessarily created and might be annoying users.

This patch discard the unnecessary 'snap3' creation. and implement
rollback(loadvm) operation to the specified snapshot by
1. switch to the snapshot
2. delete working VDI
3. rely on sd_create_branch to create a new working VDI based on the snapshot

The snapshot chain for above example will be:

base <-- snap1 <-- snap2
          ^
          |
      working VDI

Cc: qemu-devel@nongnu.org
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: resend write requests when SD_RES_READONLY is received
MORITA Kazutaka [Thu, 25 Apr 2013 16:19:54 +0000 (01:19 +0900)]
sheepdog: resend write requests when SD_RES_READONLY is received

When a snapshot is taken from out side of qemu (e.g. qemu-img
snapshot), write requests to the current vdi return SD_RES_READONLY.
In this case, the sheepdog block driver needs to update the current
inode to the latest one and resend the write requests.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: add helper function to reload inode
MORITA Kazutaka [Thu, 25 Apr 2013 16:19:53 +0000 (01:19 +0900)]
sheepdog: add helper function to reload inode

This adds a helper function to update the current inode state with the
specified vdi object.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: add SD_RES_READONLY result code
MORITA Kazutaka [Thu, 25 Apr 2013 16:19:52 +0000 (01:19 +0900)]
sheepdog: add SD_RES_READONLY result code

Sheepdog returns SD_RES_READONLY when qemu sends write requests to the
snapshot vdi.  This adds the result code and makes sd_strerror() print
its error reason.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: cleanup find_vdi_name
MORITA Kazutaka [Thu, 25 Apr 2013 16:19:51 +0000 (01:19 +0900)]
sheepdog: cleanup find_vdi_name

This makes 'filename' and 'tag' constant variables, and renames
'for_snapshot' to 'lock' to clear how it works.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agorbd: Fix use after free in rbd_open()
Kevin Wolf [Thu, 25 Apr 2013 13:59:27 +0000 (15:59 +0200)]
rbd: Fix use after free in rbd_open()

Commit a9ccedc3 frees the QemuOpts for the driver-specific options
immediately, even though it still needs the filename string that is
contained there. This doesn't work. Move the deletion of the QemuOpts to
the end of the function where its content isn't needed any more.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Disable driver-specific options for 1.5
Kevin Wolf [Wed, 24 Apr 2013 13:29:29 +0000 (15:29 +0200)]
block: Disable driver-specific options for 1.5

We don't want to commit to the API yet before everything is worked out.
Disable it for the 1.5 release. This commit is meant to be reverted
after the 1.5 release.

The disabling of the driver-specific options is achieved by applying the
old checks while parsing the command line.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: implement .bdrv_co_is_allocated()
Liu Yuan [Tue, 23 Apr 2013 06:03:35 +0000 (14:03 +0800)]
sheepdog: implement .bdrv_co_is_allocated()

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: use BDRV_SECTOR_SIZE
Liu Yuan [Tue, 23 Apr 2013 06:03:34 +0000 (14:03 +0800)]
sheepdog: use BDRV_SECTOR_SIZE

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosheepdog: add discard/trim support for sheepdog
Liu Yuan [Tue, 23 Apr 2013 06:03:33 +0000 (14:03 +0800)]
sheepdog: add discard/trim support for sheepdog

The 'TRIM' command from VM that is to release underlying data storage for
better thin-provision is already supported by the Sheepdog.

This patch adds the TRIM support at QEMU part.

For older Sheepdog that doesn't support it, we return 0(success) to upper layer.

Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock/ssh: Require libssh2 >= 1.2.8.
Richard W.M. Jones [Fri, 19 Apr 2013 08:16:39 +0000 (09:16 +0100)]
block/ssh: Require libssh2 >= 1.2.8.

libssh2 >= 1.2.8 is required to enable this block device (because
that version introduced the libssh2_session_handshake call).

Change the test to use pkg-config exclusively.  If the user requests
--enable-libssh2 and the minimum version is not available, then the
following error is displayed:

  $ ./configure --enable-libssh2

  ERROR: libssh2 >= 1.2.8 required for --enable-libssh2

If --enable-libssh2 is not specified, then the feature is silently
disabled if sufficiently new libssh2 is not available.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agobsd-user: Track change in FreeBSD SYSCTL(9) types
Ed Maste [Thu, 25 Apr 2013 17:59:41 +0000 (13:59 -0400)]
bsd-user: Track change in FreeBSD SYSCTL(9) types

Originally from Garrett Cooper in FreeBSD PR ports/155558
http://www.freebsd.org/cgi/query-pr.cgi?pr=155558

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovirtio: Fix compilation without CONFIG_VHOST_SCSI
Ed Maste [Thu, 25 Apr 2013 17:38:28 +0000 (13:38 -0400)]
virtio: Fix compilation without CONFIG_VHOST_SCSI

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-doc: Option -ignore-environment removed.
Thomas Schwinge [Thu, 25 Apr 2013 16:41:16 +0000 (18:41 +0200)]
qemu-doc: Option -ignore-environment removed.

Has been removed in commit fc9c54124d134dbd76338a92a91804dab2df8166.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agos390x: use CONFIG_INT128 to detect __uint128_t
Gabriel Kerneis [Tue, 23 Apr 2013 17:15:12 +0000 (18:15 +0100)]
s390x: use CONFIG_INT128 to detect __uint128_t

Target s390x uses ad-hoc macro magic to guess if the compiler
supports the GCC extension __uint128_t.  This patch uses the
the dedicated macro CONFIG_INT128 defined by configure instead.

This fixes compilation with the CIL source code analyzer, which
uses GCC as a preprocessor but does not support __uint128_t.

Signed-off-by: Gabriel Kerneis <gabriel@kerneis.info>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agolinux-user: fix compile error due to stray colon at end of #ifdef line
Peter Maydell [Sun, 21 Apr 2013 12:30:03 +0000 (13:30 +0100)]
linux-user: fix compile error due to stray colon at end of #ifdef line

Remove a stray colon from the end of a #ifdef line. Some versions
of gcc complain about this:
 linux-user/syscall.c: In function ‘do_syscall’:
 linux-user/syscall.c:7606:28: error: extra tokens at end of #ifdef directive [-Werror]

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agomicroblaze: Add internal base vectors reg
Edgar E. Iglesias [Tue, 23 Apr 2013 12:27:09 +0000 (14:27 +0200)]
microblaze: Add internal base vectors reg

Configurable at CPU synthesis/instantiation.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoMakefile: Use QEMU_FLAGS for DTC compilation
Peter Crosthwaite [Mon, 22 Apr 2013 04:41:28 +0000 (14:41 +1000)]
Makefile: Use QEMU_FLAGS for DTC compilation

Build DTC as QEMU is built. Fixes the issue with mingw build which can't
handles DTC's default CFLAGS.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoMakefile: Don't build shared libfdt
Peter Crosthwaite [Mon, 22 Apr 2013 04:40:49 +0000 (14:40 +1000)]
Makefile: Don't build shared libfdt

The submodule DTC should just build and use DTC as static (the whole
motivation for using submod is lack of widespread distro support).

The .so causes build failures on some platforms, so adjust the make
target to just build the static lib.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Thu, 25 Apr 2013 20:57:27 +0000 (15:57 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Amos Kong
# Via Luiz Capitulino
* luiz/queue/qmp:
  monitor: introduce query-command-line-options

Message-id: 1366922656-32545-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: Set foo_tag = 0 when returning FALSE from callbacks
Hans de Goede [Thu, 25 Apr 2013 11:53:02 +0000 (13:53 +0200)]
qemu-char: Set foo_tag = 0 when returning FALSE from callbacks

While reviewing some patches I found this problem where tcp_chr_accept
does not clear listen_tag when returning FALSE, leading to a double
g_source_remove of the underlying source. Not really a problem unless the id
gets re-used in between, but still something we should fix.

While at it I've also reviewed all the other code in qemu-char.c for
similar problems and found that pty_chr_timer has the same problem.

Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1366890782-10311-1-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoRemove unnecessary FreeBSD #include
Ed Maste [Thu, 25 Apr 2013 16:17:11 +0000 (12:17 -0400)]
Remove unnecessary FreeBSD #include

sys/param.h was included to define __FreeBSD_version, but the conditional
using it was removed by commit d05ef160453e98546a4197496dc8a3cb2defac53
(Brad Smith, "Allow clock_gettime() monotonic clock to be utilized on more
OS's"), so the include is no longer needed here.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1366906631-2680-1-git-send-email-emaste@freebsd.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconsole: add dummy surface for guests without graphic card
Gerd Hoffmann [Thu, 25 Apr 2013 07:33:19 +0000 (09:33 +0200)]
console: add dummy surface for guests without graphic card

So users get a notification instead of a crash.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: zap ds arg from register_displaychangelistener
Gerd Hoffmann [Tue, 23 Apr 2013 13:44:31 +0000 (15:44 +0200)]
console: zap ds arg from register_displaychangelistener

We don't have multiple DisplayStates any more,
so passing it in as argument is not needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: switch ppm_save to qemu_open
Gerd Hoffmann [Tue, 23 Apr 2013 11:26:59 +0000 (13:26 +0200)]
console: switch ppm_save to qemu_open

... so it works with fdset.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: add qemu_console_lookup_by_device
Gerd Hoffmann [Thu, 18 Apr 2013 05:30:40 +0000 (07:30 +0200)]
console: add qemu_console_lookup_by_device

Look up the QemuConsole for a given device, using the new link.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: add device link to QemuConsoles
Gerd Hoffmann [Wed, 17 Apr 2013 08:21:27 +0000 (10:21 +0200)]
console: add device link to QemuConsoles

So it is possible to figure which qemu console displays which device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoconsole: qom-ify QemuConsole
Gerd Hoffmann [Wed, 17 Apr 2013 07:45:10 +0000 (09:45 +0200)]
console: qom-ify QemuConsole

Just the minimal bits to turn QemuConsoles into Objects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agomonitor: introduce query-command-line-options
Amos Kong [Thu, 25 Apr 2013 09:50:35 +0000 (17:50 +0800)]
monitor: introduce query-command-line-options

Libvirt has no way to probe if an option or property is supported,
This patch introduces a new qmp command to query command line
option information. hmp command isn't added because it's not needed.

Signed-off-by: Amos Kong <akong@redhat.com>
CC: Luiz Capitulino <lcapitulino@redhat.com>
CC: Osier Yang <jyang@redhat.com>
CC: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agovirtio-ccw: Check indicators location.
Cornelia Huck [Tue, 23 Apr 2013 15:15:19 +0000 (17:15 +0200)]
virtio-ccw: Check indicators location.

If a guest neglected to register (secondary) indicators but still runs
with notifications enabled, we might end up writing to guest zero;
avoid this by checking for valid indicators and only writing to the
guest and generating an interrupt if indicators have been setup.

Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
11 years agopc: Kill the "use flash device for BIOS unless KVM" misfeature
Markus Armbruster [Fri, 12 Apr 2013 15:25:03 +0000 (17:25 +0200)]
pc: Kill the "use flash device for BIOS unless KVM" misfeature

Use of a flash memory device for the BIOS was added in series "[PATCH
v10 0/8] PC system flash support", commit 4732dca..1b89faf, v1.1.

Flash vs. ROM is a guest-visible difference.  Thus, flash use had to
be suppressed for machine types pc-1.0 and older.  This was
accomplished by adding a dummy device "pc-sysfw" with property
"rom_only":

* Non-zero rom_only means "use ROM".  Default for pc-1.0 and older.
* Zero rom_only means "maybe use flash".  Default for newer machines.

Not only is the dummy device ugly, it was also retroactively added to
the older machine types!  Fortunately, it's not guest-visible (thus no
immediate guest ABI breakage), and has no vmstate (thus no immediate
migration breakage).  Breakage occurs only if the user unwisely
enables flash by setting rom_only to zero.  Patch review FAIL #1.

Why "maybe use flash"?  Flash didn't (and still doesn't) work with
KVM.  Therefore, rom_only=0 really means "use flash, except when KVM
is enabled, use ROM".  This is a Bad Idea, because it makes enabling/
disabling KVM guest-visible.  Patch review FAIL #2.

Aside: it also precludes migrating between KVM on and off, but that's
not possible for other reasons anyway.

Fix as follows:

1. Change the meaning of rom_only=0 to mean "use flash, no ifs, buts,
or maybes" for pc-i440fx-1.5 and pc-q35-1.5.  Don't change anything
for older machines (to remain bug-compatible).

2. Change the default value from 0 to 1 for these machines.
Necessary, because 0 doesn't work with KVM.  Once it does, we can flip
the default back to 0.

3. Don't revert the retroactive addition of device "pc-sysfw" to older
machine types.  Seems not worth the trouble.

4. Add a TODO comment asking for device "pc-sysfw" to be dropped once
flash works with KVM.

Net effect is that you get a BIOS ROM again even when KVM is disabled,
just like for machines predating the introduction of flash.

To get flash instead, use "--global pc-sysfw.rom_only=0".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc: Split pc_init_pci_1_0() off pc_init_pci_1_2()
Markus Armbruster [Fri, 12 Apr 2013 15:25:02 +0000 (17:25 +0200)]
pc: Split pc_init_pci_1_0() off pc_init_pci_1_2()

Just to make the next commit easier to review.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc: Inline pc_init_pci_1_3() into pc_init_pci_1_2()
Markus Armbruster [Fri, 12 Apr 2013 15:25:01 +0000 (17:25 +0200)]
pc: Inline pc_init_pci_1_3() into pc_init_pci_1_2()

Just to make the commit after next easier to review.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365780303-26398-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'alon/libcacard_ccid.1' into staging
Anthony Liguori [Wed, 24 Apr 2013 18:23:26 +0000 (13:23 -0500)]
Merge remote-tracking branch 'alon/libcacard_ccid.1' into staging

# By Alon Levy (15) and others
# Via Alon Levy
* alon/libcacard_ccid.1: (28 commits)
  libcacard/cac: change big switch functions to single return point
  dev-smartcard-reader: empty implementation for Mechanical (fail correctly)
  libcacard: move atr setting from macro to function
  libcacard/vreader: add debugging messages for apdu
  dev-smartcard-reader: copy atr protocol to ccid parameters
  dev-smartcard-reader: change default protocol to T=0
  dev-smartcard-reader: define structs for CCID_Parameter internals
  ccid-card-passthru, dev-smartcard-reader: add debug environment variables
  ccid-card-passthru: add atr check
  libcacard: change default ATR
  dev-smartcard-reader: reuse usb.h definitions
  dev-smartcard-reader: support windows guest
  dev-smartcard-reader: remove aborts (never triggered, but just in case)
  dev-smartcard-reader: nicer debug messages
  dev-smartcard-reader: white space fixes
  libcacard: remove default libcoolkey loading
  libcacard: remove sql: prefix
  libcacard: teach vscclient to use GMainLoop for portability
  libcacard: vscclient to use QemuThread for portability
  libcacard: split vscclient main() from socket reading
  ...

Message-id: 921423767.1475937.1366790789930.JavaMail.root@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agobuild: include config-{, all-}devices.mak after defining CONFIG_SOFTMMU and CONFIG_US...
Paolo Bonzini [Tue, 16 Apr 2013 08:50:38 +0000 (10:50 +0200)]
build: include config-{, all-}devices.mak after defining CONFIG_SOFTMMU and CONFIG_USER_ONLY

Moving the inclusions closer to Makefile, and before rules.mak, makes
Makefile and Makefile.target more consistent with each other.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1366102238-12374-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: drop unused function prototypes.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:23 +0000 (10:21 +0200)]
virtio: drop unused function prototypes.

This removes the unused prototypes in virtio.h.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-8-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: cleanup: init and exit function.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:22 +0000 (10:21 +0200)]
virtio: cleanup: init and exit function.

This clean the init and the exit functions and rename virtio_common_cleanup
to virtio_cleanup.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: remove virtiobindings.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:21 +0000 (10:21 +0200)]
virtio: remove virtiobindings.

This remove virtio-bindings, and use class instead.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: remove the function pointer.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:20 +0000 (10:21 +0200)]
virtio: remove the function pointer.

This remove the function pointer in VirtIODevice, and use only
VirtioDeviceClass function pointer.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-pci: cleanup.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:19 +0000 (10:21 +0200)]
virtio-pci: cleanup.

This remove the init, exit functions as they are no longer used.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-bus: make virtio_x_bus_new static.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:18 +0000 (10:21 +0200)]
virtio-bus: make virtio_x_bus_new static.

virtio_x_bus_new are only used in file scope.
So this make them static.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-bus: add new functions.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:17 +0000 (10:21 +0200)]
virtio-bus: add new functions.

This add two functions:
   * virtio_bus_set_vdev_config.
   * virtio_bus_set_vdev_feature.

Needed by virtio-ccw.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: cleanup: use QOM casts.
KONRAD Frederic [Wed, 24 Apr 2013 08:08:01 +0000 (10:08 +0200)]
virtio-rng: cleanup: use QOM casts.

As the virtio-rng-pci, virtio-rng-s390 and virtio-rng-ccw are
switched to the new API, we can use QOM casts.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-9-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: cleanup: remove qdev field.
KONRAD Frederic [Wed, 24 Apr 2013 08:08:00 +0000 (10:08 +0200)]
virtio-rng: cleanup: remove qdev field.

The qdev field is no longer needed, just drop it.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-8-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: cleanup: init and exit functions.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:59 +0000 (10:07 +0200)]
virtio-rng: cleanup: init and exit functions.

This remove old init and exit function as they are no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng-ccw: switch to the new API.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:58 +0000 (10:07 +0200)]
virtio-rng-ccw: switch to the new API.

Here the virtio-rng-ccw is modified for the new API. The device
virtio-rng-pci extends virtio-pci. It creates and connects a virtio-rng-device
during the init. The properties are not changed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng-s390: switch to the new API.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:57 +0000 (10:07 +0200)]
virtio-rng-s390: switch to the new API.

Here the virtio-rng-s390 is modified for the new API. The device
virtio-rng-s390 extends virtio-s390-device as before. It creates and
connects a virtio-rng during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng-pci: switch to the new API.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:56 +0000 (10:07 +0200)]
virtio-rng-pci: switch to the new API.

Here the virtio-rng-pci is modified for the new API. The device
virtio-rng-pci extends virtio-pci. It creates and connects a virtio-rng-device
during the init. The properties are not changed.

The virtio_pci_reset function, is removed as no longer used.
The virtio_pci_rst function, is renamed virtio_pci_reset.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: add virtio-rng device.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:55 +0000 (10:07 +0200)]
virtio-rng: add virtio-rng device.

Create virtio-rng-device which extends virtio-device, so it can be connected on
virtio-bus.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: don't use pointer for configuration.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:54 +0000 (10:07 +0200)]
virtio-rng: don't use pointer for configuration.

The configuration field must not be a pointer as it will be used for
virtio-rng properties. So *conf is replaced by conf.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoinput: introduce keyboard handler list
Gerd Hoffmann [Wed, 24 Apr 2013 10:08:38 +0000 (12:08 +0200)]
input: introduce keyboard handler list

Add a linked list of keyboard handlers.  Added handlers will go
to the head of the list.  Removed handlers will be zapped from
the list.  The head of the list will be used for events.

This fixes the keyboard-dead-after-usb-kbd-unplug issue, key events
will be re-routed to the ps/2 kbd instead of being discarded.

[ v2: fix cut+paste bug found my Markus ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1366798118-3248-3-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoinput: make QEMUPutLEDEntry + QEMUPutMouseEntry private
Gerd Hoffmann [Wed, 24 Apr 2013 10:08:37 +0000 (12:08 +0200)]
input: make QEMUPutLEDEntry + QEMUPutMouseEntry private

There is no need for anybody outside ui/input.c to access the
struct elements.  Move the definitions, leaving only the typedefs
in the header files.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1366798118-3248-2-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoich9: kill cmos_s3
Hu Tao [Wed, 24 Apr 2013 10:37:22 +0000 (18:37 +0800)]
ich9: kill cmos_s3

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1366799842-18550-1-git-send-email-hutao@cn.fujitsu.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agolibcacard/cac: change big switch functions to single return point
Alon Levy [Mon, 4 Mar 2013 19:43:36 +0000 (21:43 +0200)]
libcacard/cac: change big switch functions to single return point

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: empty implementation for Mechanical (fail correctly)
Alon Levy [Tue, 5 Mar 2013 15:31:10 +0000 (17:31 +0200)]
dev-smartcard-reader: empty implementation for Mechanical (fail correctly)

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard: move atr setting from macro to function
Alon Levy [Tue, 5 Mar 2013 14:27:43 +0000 (16:27 +0200)]
libcacard: move atr setting from macro to function

Only because qemu's checkpatch complains about it.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard/vreader: add debugging messages for apdu
Alon Levy [Tue, 5 Mar 2013 13:32:19 +0000 (15:32 +0200)]
libcacard/vreader: add debugging messages for apdu

Using g_debug with log domain libcacard

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: copy atr protocol to ccid parameters
Alon Levy [Mon, 4 Mar 2013 16:58:29 +0000 (18:58 +0200)]
dev-smartcard-reader: copy atr protocol to ccid parameters

Adds todos.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: change default protocol to T=0
Alon Levy [Wed, 27 Mar 2013 08:14:15 +0000 (10:14 +0200)]
dev-smartcard-reader: change default protocol to T=0

We don't support T=1 so we shouldn't advertise it by default.

Two independent changes:
* Default ATR
 sets T=0. This gets overwritten by the client provided ATR later.
* Class descriptor
 changes dwAdvertise dwProtocols.PPPP to 0x1 and dwProtocols.RRRR=0 per spec.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: define structs for CCID_Parameter internals
Alon Levy [Mon, 4 Mar 2013 16:57:45 +0000 (18:57 +0200)]
dev-smartcard-reader: define structs for CCID_Parameter internals

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agoccid-card-passthru, dev-smartcard-reader: add debug environment variables
Alon Levy [Mon, 4 Mar 2013 16:41:28 +0000 (18:41 +0200)]
ccid-card-passthru, dev-smartcard-reader: add debug environment variables

Introduces a new utility function: parse_debug_env to avoid code
duplication.

This overrides whatever debug value is set on the corresponding devices
from the command line, and is meant to ease the usage with any
management stack. For libvirt you can set environment variables by
extending the dom namespace, i.e:

<domain type='kvm' id='3' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <qemu:commandline>
    <qemu:env name='QEMU_CCID_PASSTHRU_DEBUG' value='4'/>
    <qemu:env name='QEMU_CCID_DEBUG' value='4'/>
  </qemu:commandline>
</domain>

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agoccid-card-passthru: add atr check
Alon Levy [Mon, 4 Mar 2013 16:39:09 +0000 (18:39 +0200)]
ccid-card-passthru: add atr check

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard: change default ATR
Alon Levy [Tue, 5 Mar 2013 13:35:24 +0000 (15:35 +0200)]
libcacard: change default ATR

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: reuse usb.h definitions
Alon Levy [Tue, 5 Mar 2013 13:31:26 +0000 (15:31 +0200)]
dev-smartcard-reader: reuse usb.h definitions

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: support windows guest
Alon Levy [Mon, 4 Mar 2013 19:40:53 +0000 (21:40 +0200)]
dev-smartcard-reader: support windows guest

By not advertising USB wakeup support (which we don't).

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: remove aborts (never triggered, but just in case)
Alon Levy [Mon, 4 Mar 2013 16:55:07 +0000 (18:55 +0200)]
dev-smartcard-reader: remove aborts (never triggered, but just in case)

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: nicer debug messages
Alon Levy [Mon, 4 Mar 2013 16:50:33 +0000 (18:50 +0200)]
dev-smartcard-reader: nicer debug messages

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: white space fixes
Alon Levy [Mon, 4 Mar 2013 16:45:49 +0000 (18:45 +0200)]
dev-smartcard-reader: white space fixes

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard: remove default libcoolkey loading
Marc-André Lureau [Wed, 20 Mar 2013 13:07:49 +0000 (14:07 +0100)]
libcacard: remove default libcoolkey loading

Use only the modules defined in the NSS database.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: remove sql: prefix
Marc-André Lureau [Wed, 20 Mar 2013 13:07:48 +0000 (14:07 +0100)]
libcacard: remove sql: prefix

For some reason, with sql:/ prefix, the PKCS11 modules are not loaded.

This patch goes on top of Alon smartcard series.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: teach vscclient to use GMainLoop for portability
Marc-André Lureau [Mon, 25 Feb 2013 22:31:16 +0000 (23:31 +0100)]
libcacard: teach vscclient to use GMainLoop for portability

This version handles non-blocking sending and receiving from the
socket.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: vscclient to use QemuThread for portability
Marc-André Lureau [Mon, 25 Feb 2013 22:31:15 +0000 (23:31 +0100)]
libcacard: vscclient to use QemuThread for portability

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: split vscclient main() from socket reading
Marc-André Lureau [Mon, 25 Feb 2013 22:31:14 +0000 (23:31 +0100)]
libcacard: split vscclient main() from socket reading

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: fix mingw64 cross-compilation
Marc-André Lureau [Mon, 25 Feb 2013 22:31:13 +0000 (23:31 +0100)]
libcacard: fix mingw64 cross-compilation

Compile and link with version.lo

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agobuild-sys: must link with -fstack-protector
Marc-André Lureau [Mon, 25 Feb 2013 22:31:12 +0000 (23:31 +0100)]
build-sys: must link with -fstack-protector

It is needed to give that flag to the linker as well, but latest
libtool 2.4.2 still swallows that argument, so let's pass it with
libtool -Wc argument.

qemu-1.4.0/stubs/arch-query-cpu-def.c:6: undefined reference to `__stack_chk_guard'

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agoutil: move socket_init() to osdep.c
Marc-André Lureau [Mon, 25 Feb 2013 22:31:11 +0000 (23:31 +0100)]
util: move socket_init() to osdep.c

vscclient needs to call socket_init() for portability.
Moving to osdep.c since it has no internal dependency.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>