]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
11 years agopixman: pass extra cflags and ldflags
Gerd Hoffmann [Fri, 4 Jan 2013 09:15:53 +0000 (10:15 +0100)]
pixman: pass extra cflags and ldflags

Store --extra-cflags and --extra-ldflags in config-host.mak,
then pass them on to the pixman configure script.

Cc: Scott Wood <scottwood@freescale.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoMerge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 12 Jan 2013 12:47:07 +0000 (12:47 +0000)]
Merge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Fix SWI (SVC) instruction in M profile.
  target-arm: use type_register() instead of type_register_static()

11 years agoMerge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Sat, 12 Jan 2013 12:47:02 +0000 (12:47 +0000)]
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf

* 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf: (31 commits)
  PPC: linux-user: Calculate context pointer explicitly
  target-ppc: Error out for -cpu host on unknown PVR
  target-ppc: Slim conversion of model definitions to QOM subclasses
  PPC: Bring EPR support closer to reality
  PPC: KVM: set has-idle in guest device tree
  kvm: Update kernel headers
  openpic: fix CTPR and de-assertion of interrupts
  openpic: move IACK to its own function
  openpic: IRQ_check: search the queue a word at a time
  openpic: fix sense and priority bits
  openpic: add some bounds checking for IRQ numbers
  openpic: use standard bitmap operations
  Revert "openpic: Accelerate pending irq search"
  openpic: always call IRQ_check from IRQ_get_next
  openpic/fsl: critical interrupts ignore mask before v4.1
  openpic: make ctpr signed
  openpic: rework critical interrupt support
  openpic: make register names correspond better with hw docs
  ppc/booke: fix crit/mcheck/debug exceptions
  openpic: lower interrupt when reading the MSI register
  ...

11 years agoMerge branch 's390-reorg' of git://repo.or.cz/qemu/rth
Blue Swirl [Sat, 12 Jan 2013 12:46:57 +0000 (12:46 +0000)]
Merge branch 's390-reorg' of git://repo.or.cz/qemu/rth

* 's390-reorg' of git://repo.or.cz/qemu/rth: (149 commits)
  target-s390: Claim maintainership
  target-s390: Use noreturn for exception and load_psw
  target-s390: Use TCG_CALL_NO_WG for misc helpers
  target-s390: Use TCG_CALL_NO_WG for integer helpers
  target-s390: Use TCG_CALL_NO_WG for floating-point helpers
  target-s390: Use TCG_CALL_NO_WG for memory helpers
  target-s390: Perform COMPARE AND SWAP inline
  target-s390: Optimize get_address
  target-s390: Optimize ADDC/SUBB
  target-s390: Optimize ADDU/SUBU CC testing
  target-s390: Tidy comparisons
  target-s390: Optmize emitting discards
  target-s390: Optimize XC
  target-s390: Fix cpu_clone_regs
  target-s390: Implement LOAD/SET FP AND SIGNAL
  target-s390: Implement SET ROUNDING MODE
  target-s390: Use uint64_to_float128
  target-s390: Implement LCDFR
  target-s390: Check insn operand specifications
  target-s390: Implement CPSDR
  ...

11 years agohw/pc.c: add ULL suffix in ioport80_read and ioportF0_read return value
Julien Grall [Fri, 11 Jan 2013 16:41:43 +0000 (16:41 +0000)]
hw/pc.c: add ULL suffix in ioport80_read and ioportF0_read return value

The commit c02e1eac887b1b0aee7361b1fcf889e7d47fed9d broke the compilation
for i386. ULL need to be specify for uint64_t value.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-i386: use LEA for 3-operand 64-bit addition
Paolo Bonzini [Fri, 11 Jan 2013 23:05:06 +0000 (15:05 -0800)]
tcg-i386: use LEA for 3-operand 64-bit addition

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agopixman: fix warning
Gerd Hoffmann [Wed, 9 Jan 2013 09:17:08 +0000 (10:17 +0100)]
pixman: fix warning

Cc: afaerber@suse.de
Cc: agraf@suse.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agogcc: rename CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET to CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
Gerd Hoffmann [Wed, 9 Jan 2013 09:17:07 +0000 (10:17 +0100)]
gcc: rename CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET to CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agooptionrom: build with discrete CPP and AS steps
Blue Swirl [Sat, 5 Jan 2013 10:10:27 +0000 (10:10 +0000)]
optionrom: build with discrete CPP and AS steps

Build option ROM .S files with separate preprocessor and
assembler steps because the C compiler could be unsuitable.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoslirp: remove unused field tt
Blue Swirl [Sat, 5 Jan 2013 14:48:22 +0000 (14:48 +0000)]
slirp: remove unused field tt

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agouser: Consider symbolic links as possible directories
Richard Henderson [Sat, 5 Jan 2013 00:39:33 +0000 (16:39 -0800)]
user: Consider symbolic links as possible directories

Commit 2296f194dfde4c0a54f249d3fdb8c8ca21dc611b reduced the number
of syscalls performed during user emulation startup, but failed to
consider the use of symbolic links in creating directory structures.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoalpha-linux-user: Fix sigaction
Richard Henderson [Sat, 5 Jan 2013 00:39:32 +0000 (16:39 -0800)]
alpha-linux-user: Fix sigaction

Unconditional bswap replaced by __get_user/__put_user.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agolinux-user: Rewrite __get_user/__put_user with __builtin_choose_expr
Richard Henderson [Sat, 5 Jan 2013 00:39:31 +0000 (16:39 -0800)]
linux-user: Rewrite __get_user/__put_user with __builtin_choose_expr

The previous formuation with multiple assignments to __typeof(*hptr) falls
down when hptr is qualified const.  E.g. with const struct S *p, p->f is
also qualified const.

With this formulation, there's no assignment to any local variable.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agobswap: Rewrite cpu_to_<endian><type>u with {ld,st}<type>_<endian>_p
Richard Henderson [Sat, 5 Jan 2013 00:39:30 +0000 (16:39 -0800)]
bswap: Rewrite cpu_to_<endian><type>u with {ld,st}<type>_<endian>_p

We've now optimized the ld/st versions; reuse that for the "legacy"
versions.  Always use inlines so that we get the type checking that
we expect.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agobswap: Rewrite all ld<type>_<endian>_p functions
Richard Henderson [Sat, 5 Jan 2013 00:39:29 +0000 (16:39 -0800)]
bswap: Rewrite all ld<type>_<endian>_p functions

Use the new host endian unaligned access functions instead of
open coding byte-by-byte references.  Remove assembly special
cases for i386 and ppc -- we've now exposed the operation to
the compiler sufficiently for these to be optimized automatically.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agobswap: Add host endian unaligned access functions
Richard Henderson [Sat, 5 Jan 2013 00:39:28 +0000 (16:39 -0800)]
bswap: Add host endian unaligned access functions

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agobswap: Tidy base definitions of bswapN
Richard Henderson [Sat, 5 Jan 2013 00:39:27 +0000 (16:39 -0800)]
bswap: Tidy base definitions of bswapN

Move the bswap_N -> bswapN wrappers inside CONFIG_BYTESWAP_H.

Change the ultimate fallback defintions from macros to inline functions.
The proper types recieved by the function arguments means we can remove
unnecessary casts, making the code more readable.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agofdt: Use bswapN instead of bswap_N
Richard Henderson [Sat, 5 Jan 2013 00:39:26 +0000 (16:39 -0800)]
fdt: Use bswapN instead of bswap_N

Fixes the libfdt enabled build for hosts that have <machine/bswap.h>.

The code at the beginning of qemu/bswap.h is attempting to standardize
on bswapN.  In the case of CONFIG_MACHINE_BSWAP_H, this is all we get.
In the case of CONFIG_BYTESWAP_H, we get bswap_N from the system header
and then wrap these with inline functions to get bswapN.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-arm: Fix SWI (SVC) instruction in M profile.
Alex_Rozenman@mentor.com [Fri, 11 Jan 2013 15:21:22 +0000 (15:21 +0000)]
target-arm: Fix SWI (SVC) instruction in M profile.

When do_interrupt_v7m is called with EXCP_SWI, the PC already
points to the next instruction. Don't modify it here.

Signed-off-by: Alex Rozenman <Alex_Rozenman@mentor.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agotarget-arm: use type_register() instead of type_register_static()
Eduardo Habkost [Fri, 11 Jan 2013 15:21:22 +0000 (15:21 +0000)]
target-arm: use type_register() instead of type_register_static()

The type_register_static() interface is documented as:

  type_register_static:
  @info: The #TypeInfo of the new type.

  @info and all of the strings it points to should exist for the life
  time that the type is registered.

But cpu_register() uses a stack variable for the 'info' argument, so it
has to use type_register() instead of type_register_static().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 11 Jan 2013 14:43:18 +0000 (08:43 -0600)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  hw/pc.c: Fix converting of ioport_register* to MemoryRegion
  Replace remaining gmtime, localtime by gmtime_r, localtime_r
  savevm: Remove MinGW specific code which is no longer needed
  qga/channel-posix.c: Explicitly include string.h
  configure: Fix comment (copy+paste bug)
  readline: avoid memcpy() of overlapping regions

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/q35.1' into staging
Anthony Liguori [Fri, 11 Jan 2013 14:36:52 +0000 (08:36 -0600)]
Merge remote-tracking branch 'kraxel/q35.1' into staging

* kraxel/q35.1:
  Makefile: install the "acpi-dsdt.aml" and "q35-acpi-dsdt.aml" blobs too
  pc: rename machine types
  q35: document chipset devices
  q35: add ich9 intel hda controller

Conflicts:
hw/intel-hda.c

aliguori: resolve conflict with static const change from Andreas.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber-or/prep-up' into staging
Anthony Liguori [Fri, 11 Jan 2013 14:23:16 +0000 (08:23 -0600)]
Merge remote-tracking branch 'afaerber-or/prep-up' into staging

* afaerber-or/prep-up:
  prep: Use pc87312 device instead of collection of random ISA devices
  prep: Add pc87312 Super I/O emulation
  prep: Include devices for ppc64 as well

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agohw/pc.c: Fix converting of ioport_register* to MemoryRegion
Julien Grall [Wed, 9 Jan 2013 18:10:22 +0000 (18:10 +0000)]
hw/pc.c: Fix converting of ioport_register* to MemoryRegion

The commit 258711 introduced MemoryRegion to replace ioport_region*
for ioport 80h and F0h.
A MemoryRegion needs to have both read and write callback otherwise a segfault
will occur when an access is made.

The previous behaviour of this both ioport is to return 0xffffffffffffffff.
So keep this behaviour.

Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoReplace remaining gmtime, localtime by gmtime_r, localtime_r
Stefan Weil [Mon, 7 Jan 2013 22:08:13 +0000 (23:08 +0100)]
Replace remaining gmtime, localtime by gmtime_r, localtime_r

This allows removing of MinGW specific code and improves
reentrancy for POSIX hosts.

[Removed unused ret variable in qemu_get_timedate() to fix warning:
vl.c: In function ‘qemu_get_timedate’:
vl.c:451:16: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]
-- Stefan Hajnoczi]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosavevm: Remove MinGW specific code which is no longer needed
Stefan Weil [Mon, 7 Jan 2013 21:20:27 +0000 (22:20 +0100)]
savevm: Remove MinGW specific code which is no longer needed

QEMU provides a portable function qemu_gettimeofday instead of
gettimeofday and also an implementation of localtime_r for MinGW.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqga/channel-posix.c: Explicitly include string.h
Peter Maydell [Mon, 7 Jan 2013 17:29:55 +0000 (17:29 +0000)]
qga/channel-posix.c: Explicitly include string.h

Explicitly include string.h to avoid warnings under MacOS X/clang
about implicit declarations of strerror() and strlen().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoconfigure: Fix comment (copy+paste bug)
Stefan Weil [Sat, 5 Jan 2013 11:17:38 +0000 (12:17 +0100)]
configure: Fix comment (copy+paste bug)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoMakefile: install the "acpi-dsdt.aml" and "q35-acpi-dsdt.aml" blobs too
Laszlo Ersek [Tue, 8 Jan 2013 18:52:20 +0000 (19:52 +0100)]
Makefile: install the "acpi-dsdt.aml" and "q35-acpi-dsdt.aml" blobs too

The WARNING message from commit f7e4dd6c made me notice.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopc: rename machine types
Gerd Hoffmann [Tue, 8 Jan 2013 07:53:13 +0000 (08:53 +0100)]
pc: rename machine types

Starting with release 1.4 we have a fully functional q35 machine type,
i.e. "qemu -M q35" JustWorks[tm].  Update machine type names to reflect
that:

  * pc-1.4 becomes pc-i440fx-1.4
  * q35-next becomes pc-q35-1.4

The pc-1.3 (+older) names are maintained for compatibility reasons.
For the same reason the "pc" and "q35" aliases are kept.  pc-piix-1.4
continues to be the default machine type, again for compatibility
reasons.

Also updated the description (shown by "qemu -M ?") with host bridge
name, south bridge name and chipset release year.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoq35: document chipset devices
Gerd Hoffmann [Tue, 8 Jan 2013 08:38:19 +0000 (09:38 +0100)]
q35: document chipset devices

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoq35: add ich9 intel hda controller
Gerd Hoffmann [Tue, 8 Jan 2013 08:25:16 +0000 (09:25 +0100)]
q35: add ich9 intel hda controller

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agovirtio-scsi: abort in-flight I/O when the device is reset
Paolo Bonzini [Thu, 10 Jan 2013 14:49:08 +0000 (15:49 +0100)]
virtio-scsi: abort in-flight I/O when the device is reset

When the device is reset, the SCSI bus should also be reset so
that in-flight I/O is cancelled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: add qbus_reset_all
Paolo Bonzini [Thu, 10 Jan 2013 14:49:07 +0000 (15:49 +0100)]
qdev: add qbus_reset_all

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMake all static TypeInfos const
Andreas Färber [Thu, 10 Jan 2013 15:19:07 +0000 (16:19 +0100)]
Make all static TypeInfos const

Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register all
types natively through QEMU Object Model), TypeInfo as used in
the common, non-iterative pattern is no longer amended with information
and should therefore be const.

Fix the documented QOM examples:

 sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h

Since frequently the wrong examples are being copied by contributors of
new devices, fix all types in the tree:

 sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c
 sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c

This also avoids to piggy-back these changes onto real functional
changes or other refactorings.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge branch 'master' of git://git.qemu.org/qemu into prep-up
Andreas Färber [Thu, 10 Jan 2013 20:52:28 +0000 (21:52 +0100)]
Merge branch 'master' of git://git.qemu.org/qemu into prep-up

Conflicts:
hw/Makefile.objs
hw/ppc_prep.c

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
11 years agoMerge remote-tracking branch 'kraxel/build.1' into staging
Anthony Liguori [Thu, 10 Jan 2013 19:26:31 +0000 (13:26 -0600)]
Merge remote-tracking branch 'kraxel/build.1' into staging

* kraxel/build.1:
  m48t59-test: don't touch watchdog
  rtc-test: skip year-2038 overflow check in case time_t is 32bit only

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'awilliam/tags/qemu-1.4-vfio-20130109.0' into staging
Anthony Liguori [Thu, 10 Jan 2013 19:26:12 +0000 (13:26 -0600)]
Merge remote-tracking branch 'awilliam/tags/qemu-1.4-vfio-20130109.0' into staging

vfio-pci: Fixes for qemu 1.4 & stable

* awilliam/tags/qemu-1.4-vfio-20130109.0:
  vfio-pci: Loosen sanity checks to allow future features
  vfio-pci: Make host MSI-X enable track guest

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agom48t59-test: don't touch watchdog
Gerd Hoffmann [Fri, 4 Jan 2013 16:12:18 +0000 (17:12 +0100)]
m48t59-test: don't touch watchdog

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agortc-test: skip year-2038 overflow check in case time_t is 32bit only
Gerd Hoffmann [Fri, 4 Jan 2013 09:37:50 +0000 (10:37 +0100)]
rtc-test: skip year-2038 overflow check in case time_t is 32bit only

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoCheck return values from g_poll and select
Fabien Chouteau [Tue, 8 Jan 2013 15:30:56 +0000 (16:30 +0100)]
Check return values from g_poll and select

The current implementation of os_host_main_loop_wait() on Windows,
returns 1 only when a g_poll() event occurs because the return value of
select() is overridden. This is wrong as we may skip a socket event, as
shown in this example:

1. select() returns 0
2. g_poll() returns 1  (socket event occurs)
3. os_host_main_loop_wait() returns 1
4. qemu_iohandler_poll() sees no socket event because select() has
   return before the event occurs
5. select() returns 1
6. g_poll() returns 0 (g_poll overrides select's return value)
7. os_host_main_loop_wait() returns 0
8. qemu_iohandler_poll() doesn't check for socket events because the
   return value of os_host_main_loop_wait() is zero.
9. goto 5

This patch use one variable for each of these return values, so we don't
miss a select() event anymore.

Also move the call to select() after g_poll(), this will improve latency
as we don't have to go through two os_host_main_loop_wait() calls to
detect a socket event.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mdroth/qga-pull-1-8-2013' into staging
Anthony Liguori [Wed, 9 Jan 2013 15:55:51 +0000 (09:55 -0600)]
Merge remote-tracking branch 'mdroth/qga-pull-1-8-2013' into staging

* mdroth/qga-pull-1-8-2013:
  qemu-ga: sample fsfreeze hooks
  qemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thaw
  qemu-ga: guest_suspend(): improve error reporting
  qemu-ga: bios_supports_mode(): improve error reporting
  qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() + error_set()
  qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set()
  qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()
  qemu-ga: build_fs_mount_list(): take an Error argument
  qemu-ga: qmp_guest_shutdown(): improve error reporting
  qemu-ga: qmp_guest_file_*: improve error reporting
  qemu-ga: qmp_guest_file_close(): fix fclose() error check
  qemu-ga: guest_file_handle_find(): take an Error argument

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-ga: sample fsfreeze hooks
Tomoki Sekiyama [Wed, 12 Dec 2012 03:55:57 +0000 (12:55 +0900)]
qemu-ga: sample fsfreeze hooks

Adds sample hook scripts for --fsfreeze-hook option of qemu-ga.
  - fsfreeze-hook : execute scripts in fsfreeze-hook.d/
  - fsfreeze-hook.d/mysql-flush.sh.sample : quiesce MySQL before snapshot

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thaw
Tomoki Sekiyama [Wed, 12 Dec 2012 03:55:55 +0000 (12:55 +0900)]
qemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thaw

To use the online disk snapshot for online-backup, application-level
consistency of the snapshot image is required. However, currently the
guest agent can provide only filesystem-level consistency, and the
snapshot may contain dirty data, for example, incomplete transactions.
This patch provides the opportunity to quiesce applications before
snapshot is taken.

If --fsfreeze-hook option is specified, the hook is executed with
"freeze" argument before the filesystem is frozen by fsfreeze-freeze
command. As for fsfreeze-thaw command, the hook is executed with "thaw"
argument after the filesystem is thawed.

This patch depends on patchset to improve error reporting by Luiz Capitulino:
  http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg03016.html

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
*clarified usage in help output

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: guest_suspend(): improve error reporting
Luiz Capitulino [Tue, 27 Nov 2012 13:02:04 +0000 (11:02 -0200)]
qemu-ga: guest_suspend(): improve error reporting

Most errors are QERR_UNDEFINED_ERROR today.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: bios_supports_mode(): improve error reporting
Luiz Capitulino [Tue, 27 Nov 2012 13:02:03 +0000 (11:02 -0200)]
qemu-ga: bios_supports_mode(): improve error reporting

Most errors are QERR_UNDEFINED_ERROR today.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() + error_set()
Luiz Capitulino [Tue, 27 Nov 2012 13:02:02 +0000 (11:02 -0200)]
qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() + error_set()

Convert them to error_setg_errno().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set()
Luiz Capitulino [Tue, 27 Nov 2012 13:02:01 +0000 (11:02 -0200)]
qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set()

Convert them to error_setg_errno().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()
Luiz Capitulino [Tue, 27 Nov 2012 13:02:00 +0000 (11:02 -0200)]
qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()

Convert them to error_setg_errno().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: build_fs_mount_list(): take an Error argument
Luiz Capitulino [Thu, 29 Nov 2012 17:29:11 +0000 (15:29 -0200)]
qemu-ga: build_fs_mount_list(): take an Error argument

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: qmp_guest_shutdown(): improve error reporting
Luiz Capitulino [Tue, 27 Nov 2012 13:01:58 +0000 (11:01 -0200)]
qemu-ga: qmp_guest_shutdown(): improve error reporting

Most errors are QERR_UNDEFINED_ERROR. Also, adds ga_wait_child() as
a future commit will use it too.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: qmp_guest_file_*: improve error reporting
Luiz Capitulino [Tue, 27 Nov 2012 13:01:57 +0000 (11:01 -0200)]
qemu-ga: qmp_guest_file_*: improve error reporting

Use error_setg_errno() when possible with an improved error description.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: qmp_guest_file_close(): fix fclose() error check
Luiz Capitulino [Tue, 27 Nov 2012 13:01:56 +0000 (11:01 -0200)]
qemu-ga: qmp_guest_file_close(): fix fclose() error check

fclose() returns EOF on error.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: guest_file_handle_find(): take an Error argument
Luiz Capitulino [Tue, 27 Nov 2012 13:01:55 +0000 (11:01 -0200)]
qemu-ga: guest_file_handle_find(): take an Error argument

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
*Fixed missing space character in error message

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Tue, 8 Jan 2013 21:15:57 +0000 (15:15 -0600)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

* afaerber/qom-cpu:
  target-i386: Explicitly set vendor for each built-in cpudef
  target-i386: Sanitize AMD's ext2_features at realize time
  target-i386: Filter out unsupported features at realize time
  qemu-common.h: Make qemu_init_vcpu() stub static inline
  target-i386: check/enforce: Eliminate check_feat field
  target-i386: check/enforce: Check SVM flag support as well
  target-i386: check/enforce: Check all CPUID.80000001H.EDX bits
  target-i386: check/enforce: Do not ignore "hypervisor" flag
  target-i386: check/enforce: Fix CPUID leaf numbers on error messages
  target-i386: kvm: Enable all supported KVM features for -cpu host
  target-i386: kvm: -cpu host: Use GET_SUPPORTED_CPUID for SVM features
  cpu: Change parent type to Device
  qdev: Don't assume existence of parent bus on unparenting
  qdev: Include qdev code into *-user, too
  libqemustub: sysbus_get_default() stub
  libqemustub: vmstate register/unregister stubs
  libqemustub: Add qemu_[un]register_reset() stubs

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovfio-pci: Loosen sanity checks to allow future features
Alex Williamson [Tue, 8 Jan 2013 21:10:03 +0000 (14:10 -0700)]
vfio-pci: Loosen sanity checks to allow future features

VFIO_PCI_NUM_REGIONS and VFIO_PCI_NUM_IRQS should never have been
used in this manner as it locks a specific kernel implementation.
Future features may introduce new regions or interrupt entries
(VGA may add legacy ranges, AER might add an IRQ for error
signalling).  Fix this before it gets us into trouble.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-stable@nongnu.org
11 years agovfio-pci: Make host MSI-X enable track guest
Alex Williamson [Tue, 8 Jan 2013 21:09:03 +0000 (14:09 -0700)]
vfio-pci: Make host MSI-X enable track guest

Guests typically enable MSI-X with all of the vectors in the MSI-X
vector table masked.  Only when the vector is enabled does the vector
get unmasked, resulting in a vector_use callback.  These two points,
enable and unmask, correspond to pci_enable_msix() and request_irq()
for Linux guests.  Some drivers rely on VF/PF or PF/fw communication
channels that expect the physical state of the device to match the
guest visible state of the device.  They don't appreciate lazily
enabling MSI-X on the physical device.

To solve this, enable MSI-X with a single vector when the MSI-X
capability is enabled and immediate disable the vector.  This leaves
the physical device in exactly the same state between host and guest.
Furthermore, the brief gap where we enable vector 0, it fires into
userspace, not KVM, so the guest doesn't get spurious interrupts.
Ideally we could call VFIO_DEVICE_SET_IRQS with the right parameters
to enable MSI-X with zero vectors, but this will currently return an
error as the Linux MSI-X interfaces do not allow it.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-stable@nongnu.org
11 years agotarget-i386: Explicitly set vendor for each built-in cpudef
Igor Mammedov [Fri, 28 Dec 2012 20:01:18 +0000 (21:01 +0100)]
target-i386: Explicitly set vendor for each built-in cpudef

Since cpudef config is not supported anymore and all remaining sources
now always set x86_def_t.vendor[123] fields, remove setting default
vendor to simplify future re-factoring.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Sanitize AMD's ext2_features at realize time
Igor Mammedov [Fri, 28 Dec 2012 20:01:17 +0000 (21:01 +0100)]
target-i386: Sanitize AMD's ext2_features at realize time

When CPU properties are implemented, ext2_features may change
between object_new(CPU) and cpu_realize_fn(). Sanitizing
ext2_features for AMD based CPU at realize() time will keep
current behavior after CPU features are converted to properties.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Filter out unsupported features at realize time
Igor Mammedov [Fri, 28 Dec 2012 20:01:16 +0000 (21:01 +0100)]
target-i386: Filter out unsupported features at realize time

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqemu-common.h: Make qemu_init_vcpu() stub static inline
Andreas Färber [Sat, 5 Jan 2013 13:44:08 +0000 (14:44 +0100)]
qemu-common.h: Make qemu_init_vcpu() stub static inline

Turn the *-user macro into a no-op inline function to avoid
unused-variable warnings and band-aiding #ifdef'ery.

This allows to drop an #ifdef for alpha and avoids more for unicore32
and other upcoming trivial realizefn implementations.

Suggested-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
11 years agotarget-i386: check/enforce: Eliminate check_feat field
Eduardo Habkost [Fri, 4 Jan 2013 22:01:10 +0000 (20:01 -0200)]
target-i386: check/enforce: Eliminate check_feat field

Now that all entries have check_feat=~0 in
kvm_check_features_against_host(), we can eliminate check_feat entirely
and make the code check all bits.

This patch shouldn't introduce any behavior change, as check_feat is set
to ~0 on all entries.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: check/enforce: Check SVM flag support as well
Eduardo Habkost [Fri, 4 Jan 2013 22:01:09 +0000 (20:01 -0200)]
target-i386: check/enforce: Check SVM flag support as well

When nested SVM is supported, the kernel returns the SVM flag on
GET_SUPPORTED_CPUID[1], so we can check the SVM flag safely in
kvm_check_features_against_host().

I don't know why the original code ignored the SVM flag. Maybe it was
because kvm_cpu_fill_host() used the CPUID instruction directly instead
of GET_SUPPORTED_CPUID

[1] Older kernels (before v2.6.37) returned the SVM flag even if nested
    SVM was _not_ supported. So the only cases where this patch should
    change behavior is when SVM is being requested by the user or the
    CPU model, but not supported by the host. And on these cases we
    really want QEMU to abort if the "enforce" option is set.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: check/enforce: Check all CPUID.80000001H.EDX bits
Eduardo Habkost [Fri, 4 Jan 2013 22:01:08 +0000 (20:01 -0200)]
target-i386: check/enforce: Check all CPUID.80000001H.EDX bits

I have no idea why PPRO_FEATURES was being ignored on the check of the
CPUID.80000001H.EDX bits. I believe it was a mistake, and it was
supposed to be ~(PPRO_FEATURES & CPUID_EXT2_AMD_ALIASES) or just
~CPUID_EXT2_AMD_ALIASES, because some time ago kvm_cpu_fill_host() used
the CPUID instruction directly (instead of
kvm_arch_get_supported_cpuid()).

But now kvm_cpu_fill_host() uses kvm_arch_get_supported_cpuid(), and
kvm_arch_get_supported_cpuid() returns all supported bits for
CPUID.80000001H.EDX, even the AMD aliases (that are explicitly copied
from CPUID.01H.EDX), so we can make the code check/enforce all the
CPUID.80000001H.EDX bits.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: check/enforce: Do not ignore "hypervisor" flag
Eduardo Habkost [Fri, 4 Jan 2013 22:01:07 +0000 (20:01 -0200)]
target-i386: check/enforce: Do not ignore "hypervisor" flag

We don't need any hack to ignore CPUID_EXT_HYPERVISOR anymore, because
kvm_arch_get_supported_cpuid() now sets CPUID_EXT_HYPERVISOR properly.
So, this shouldn't introduce any behavior change, but it makes the code
simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: check/enforce: Fix CPUID leaf numbers on error messages
Eduardo Habkost [Fri, 4 Jan 2013 22:01:06 +0000 (20:01 -0200)]
target-i386: check/enforce: Fix CPUID leaf numbers on error messages

The -cpu check/enforce warnings are printing incorrect information about the
missing flags. There are no feature flags on CPUID leaves 0 and 0x80000000, but
there were references to 0 and 0x80000000 in the table at
kvm_check_features_against_host().

This changes the model_features_t struct to contain the register number as
well, so the error messages print the correct CPUID leaf+register information,
instead of wrong CPUID leaf numbers.

This also changes the format of the error messages, so they follow the
"CPUID.<leaf>.<register>.<name> [bit <offset>]" convention used in Intel
documentation. Example output:

    $ qemu-system-x86_64 -machine pc-1.0,accel=kvm -cpu Opteron_G4,+ia64,enforce
    warning: host doesn't support requested feature: CPUID.01H:EDX.ia64 [bit 30]
    warning: host doesn't support requested feature: CPUID.01H:ECX.xsave [bit 26]
    warning: host doesn't support requested feature: CPUID.01H:ECX.avx [bit 28]
    warning: host doesn't support requested feature: CPUID.80000001H:ECX.abm [bit 5]
    warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]
    warning: host doesn't support requested feature: CPUID.80000001H:ECX.misalignsse [bit 7]
    warning: host doesn't support requested feature: CPUID.80000001H:ECX.3dnowprefetch [bit 8]
    warning: host doesn't support requested feature: CPUID.80000001H:ECX.xop [bit 11]
    warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16]
    Unable to find x86 CPU definition
    $

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: kvm: Enable all supported KVM features for -cpu host
Eduardo Habkost [Fri, 4 Jan 2013 22:01:05 +0000 (20:01 -0200)]
target-i386: kvm: Enable all supported KVM features for -cpu host

When using -cpu host, we don't need to use the kvm_default_features
variable, as the user is explicitly asking QEMU to enable all feature
supported by the host.

This changes the kvm_cpu_fill_host() code to use GET_SUPPORTED_CPUID to
initialize the kvm_features field, so we get all host KVM features
enabled.

This will also allow us to properly check/enforce KVM features inside
kvm_check_features_against_host() later. For example, we will be able to
make this:

  $ qemu-system-x86_64 -cpu ...,+kvm_pv_eoi,enforce

refuse to start if kvm_pv_eoi is not supported by the host (after we fix
kvm_check_features_against_host() to check KVM flags as well).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: kvm: -cpu host: Use GET_SUPPORTED_CPUID for SVM features
Eduardo Habkost [Fri, 4 Jan 2013 22:01:04 +0000 (20:01 -0200)]
target-i386: kvm: -cpu host: Use GET_SUPPORTED_CPUID for SVM features

The existing -cpu host code simply sets every bit inside svm_features
(initializing it to -1), and that makes it impossible to make the
enforce/check options work properly when the user asks for SVM features
explicitly in the command-line.

So, instead of initializing svm_features to -1, use GET_SUPPORTED_CPUID
to fill only the bits that are supported by the host (just like we do
for all other CPUID feature words inside kvm_cpu_fill_host()).

This will keep the existing behavior (as filter_features_for_kvm()
already uses GET_SUPPORTED_CPUID to filter svm_features), but will allow
us to properly check for KVM features inside
kvm_check_features_against_host() later.

For example, we will be able to make this:

  $ qemu-system-x86_64 -cpu ...,+pfthreshold,enforce

refuse to start if the SVM "pfthreshold" feature is not supported by the
host (after we fix kvm_check_features_against_host() to check SVM flags
as well).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agocpu: Change parent type to Device
Eduardo Habkost [Wed, 5 Dec 2012 16:49:13 +0000 (14:49 -0200)]
cpu: Change parent type to Device

This finally makes the CPU class a subclass of the Device class,
allowing us to start using DeviceState properties on CPU subclasses.

It has no_user=1, as creating CPUs using -device doesn't work yet.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqdev: Don't assume existence of parent bus on unparenting
Andreas Färber [Fri, 4 Jan 2013 17:13:00 +0000 (18:13 +0100)]
qdev: Don't assume existence of parent bus on unparenting

Commit 667d22d1ae59da46b4c1fbd094ca61145f19b8c3 (qdev: move bus removal
to object_unparent) made the assumption that at unparenting time
parent_bus is not NULL. This assumption is unjustified since
object_unparent() may well be called directly after object_initialize(),
without any qdev_set_parent_bus().

This did not cause any issues yet because qdev_[try_]create() does call
qdev_set_parent_bus(), falling back to SysBus if unsupplied.

While at it, ensure that this new function uses the device_ prefix and
make the name more neutral in light of this semantic change.

Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Igor Mammedov <imammedo@redhat.com>
11 years agoqdev: Include qdev code into *-user, too
Eduardo Habkost [Wed, 5 Dec 2012 16:49:12 +0000 (14:49 -0200)]
qdev: Include qdev code into *-user, too

The code depends on some functions from qemu-option.o, so add
qemu-option.o to universal-obj-y to make sure it's included.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agolibqemustub: sysbus_get_default() stub
Eduardo Habkost [Wed, 5 Dec 2012 16:49:09 +0000 (14:49 -0200)]
libqemustub: sysbus_get_default() stub

The stub will be used on cases where sysbus.c is not compiled in (e.g.
*-user).

Note that code that uses NULL as the bus with qdev{_try,}_create()
implicitly uses sysbus_get_default() as the bus, and will still require
sysbus.c to be compiled in.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agolibqemustub: vmstate register/unregister stubs
Eduardo Habkost [Wed, 5 Dec 2012 16:49:08 +0000 (14:49 -0200)]
libqemustub: vmstate register/unregister stubs

Add vmstate stub functions, so that qdev.o can be used without savevm.o
when vmstate support is not necessary (i.e. by *-user).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agolibqemustub: Add qemu_[un]register_reset() stubs
Eduardo Habkost [Wed, 5 Dec 2012 16:49:07 +0000 (14:49 -0200)]
libqemustub: Add qemu_[un]register_reset() stubs

This will be useful for code that don't call qemu_devices_reset() (e.g.
*-user). If qemu_devices_reset() is never called, it means we don't need
to keep track of the reset handler list.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoMerge remote-tracking branch 'kraxel/usb.75' into staging
Anthony Liguori [Tue, 8 Jan 2013 16:36:20 +0000 (10:36 -0600)]
Merge remote-tracking branch 'kraxel/usb.75' into staging

* kraxel/usb.75: (32 commits)
  uhci: stop using portio lists
  usbredir: Add support for buffered bulk input (v2)
  exynos4210: Add EHCI support
  usb/ehci: Add SysBus EHCI device for Exynos4210
  usb/ehci: Move capsbase and opregbase into SysBus EHCI class
  usb/ehci: Clean up SysBus and PCI EHCI split
  xhci: call set-address with dummy usbpacket
  usb-redir: Add debugging to bufpq save / restore
  usbredir: Add usbredir_init_endpoints() helper
  usbredir: Verify we have 32 bits bulk length cap when redirecting to xhci
  usbredir: Add ep_stopped USBDevice method
  usbredir: Add USBEP2I and I2USBEP helper macros
  usbredir: Add an usbredir_stop_ep helper function
  usb: Add an usb_device_ep_stopped USBDevice method
  usb: Fix usb_ep_find_packet_by_id
  hid: Change idle handling to use a timer
  uhci: Maximize how many frames we catch up when behind
  uhci: Limit amount of frames processed in one go
  uhci: Add a QH_VALID define
  uhci: Fix pending interrupts getting lost on migration
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Tue, 8 Jan 2013 16:36:13 +0000 (10:36 -0600)]
Merge remote-tracking branch 'stefanha/net' into staging

* stefanha/net:
  rtl8139: preserve link state across device reset
  e1000: no need auto-negotiation if link was down
  net: clean up network at qemu process termination
  e1000: Discard oversized packets based on SBP|LPE

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-mips: Fix helper and tests for dot/cross-dot product instructions
Petar Jovanovic [Wed, 2 Jan 2013 04:08:48 +0000 (05:08 +0100)]
target-mips: Fix helper and tests for dot/cross-dot product instructions

Helper function for dpa_w_ph, dpax_w_ph, dps_w_ph and dpsx_w_ph incorrectly
defines halfword vector elements as unsigned values. This results in wrong
output which is not triggered in the tests as they also follow this logic.

Signed-off-by: Petar Jovanovic <petarj@mips.com>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Replace macros by inline functions
Stefan Weil [Tue, 1 Jan 2013 18:44:31 +0000 (19:44 +0100)]
target-mips: Replace macros by inline functions

The macros RESTORE_ROUNDING_MODE and RESTORE_FLUSH_MODE silently used
variable env from their callers. Using inline functions with env passed
as a function argument is more transparent.

This modification was proposed by Peter Maydell.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Allow DSP access to be disabled once enabled.
Eric Johnson [Tue, 8 Jan 2013 06:26:44 +0000 (22:26 -0800)]
target-mips: Allow DSP access to be disabled once enabled.

Clear the DSP hflags at the start of compute_hflags.  Otherwise access
is not properly disabled once enabled.

Signed-off-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agolinux-user: fix mips 32-on-64 prealloc case
Alexander Graf [Thu, 3 Jan 2013 13:17:18 +0000 (14:17 +0100)]
linux-user: fix mips 32-on-64 prealloc case

MIPS only supports 31 bits of virtual address space for user space, so let's
make sure we stay within that limit with our preallocated memory block.

This fixes the MIPS user space targets when executed without command line
option.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agouhci: stop using portio lists
Gerd Hoffmann [Thu, 3 Jan 2013 11:29:41 +0000 (12:29 +0100)]
uhci: stop using portio lists

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousbredir: Add support for buffered bulk input (v2)
Hans de Goede [Wed, 19 Dec 2012 14:08:33 +0000 (15:08 +0100)]
usbredir: Add support for buffered bulk input (v2)

Buffered bulk mode is intended for bulk *input* endpoints, where the data is
of a streaming nature (not part of a command-response protocol). These
endpoints' input buffer may overflow if data is not read quickly enough.
So in buffered bulk mode the usb-host takes care of the submitting and
re-submitting of bulk transfers.

Buffered bulk mode is necessary for reliable operation with the bulk in
endpoints of usb to serial convertors. Unfortunatelty buffered bulk input
mode will only work with certain devices, therefor this patch also adds a
usb-id table to enable it for devices which need it, while leaving the
bulk ep handling for other devices unmodified.

Note that the bumping of the required usbredir from 0.5.3 to 0.6 does
not mean that we will now need a newer usbredir release then qemu-1.3,
.pc files reporting 0.5.3 have only ever existed in usbredir builds directly
from git, so qemu-1.3 needs the 0.6 release too.

Changes in v2:
-Split of quirk handling into quirks.c

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
11 years agoreadline: avoid memcpy() of overlapping regions
Nickolai Zeldovich [Mon, 7 Jan 2013 20:38:39 +0000 (15:38 -0500)]
readline: avoid memcpy() of overlapping regions

memcpy() for overlapping regions is undefined behavior; use memmove()
instead in readline_hist_add().

[Keep tab characters since surrounding code still uses them -- Stefan]

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoPPC: linux-user: Calculate context pointer explicitly
Samuel Seay [Fri, 4 Jan 2013 14:35:48 +0000 (14:35 +0000)]
PPC: linux-user: Calculate context pointer explicitly

Peter Maydell recommended the change to be more proper. The result was tested
and shows coming up with the same proper value.

Signed-off-by: Samuel Seay <LightningTH@GMail.com>
[agraf: change subject]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Error out for -cpu host on unknown PVR
Andreas Färber [Sun, 6 Jan 2013 08:31:31 +0000 (08:31 +0000)]
target-ppc: Error out for -cpu host on unknown PVR

Previously we silently exited, with subclasses we got an opcode warning.
Instead, explicitly tell the user what's wrong.

An indication for this is -cpu ? showing "host" with an all-zero PVR.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Slim conversion of model definitions to QOM subclasses
Andreas Färber [Sun, 6 Jan 2013 08:31:30 +0000 (08:31 +0000)]
target-ppc: Slim conversion of model definitions to QOM subclasses

Since the model list is highly macrofied, keep ppc_def_t for now and
save a pointer to it in PowerPCCPUClass. This results in a flat list of
subclasses including aliases, to be refined later.

Move cpu_ppc_init() to translate_init.c and drop helper.c.
Long-term the idea is to turn translate_init.c into a standalone cpu.c.

Inline cpu_ppc_usable() into type registration.

Split cpu_ppc_register() in two by code movement into the initfn and
by turning the remaining part into a realizefn.
Move qemu_init_vcpu() call into the new realizefn and adapt
create_ppc_opcodes() to return an Error.

Change ppc_find_by_pvr() -> ppc_cpu_class_by_pvr().
Change ppc_find_by_name() -> ppc_cpu_class_by_name().

Turn -cpu host into its own subclass. This requires to move the
kvm_enabled() check in ppc_cpu_class_by_name() to avoid the class being
found via the normal name lookup in the !kvm_enabled() case.
Turn kvmppc_host_cpu_def() into the class_init and add an initfn that
asserts KVM is in fact enabled.

Implement -cpu ? and the QMP equivalent in terms of subclasses.
This newly exposes -cpu host to the user, ordered last for -cpu ?.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Bring EPR support closer to reality
Alexander Graf [Fri, 4 Jan 2013 10:21:04 +0000 (11:21 +0100)]
PPC: Bring EPR support closer to reality

We already used to support the external proxy facility of FSL MPICs,
but only implemented it halfway correctly.

This patch adds support for

  * dynamic enablement of the EPR facility
  * interrupt acknowledgement only when the interrupt is delivered

This way the implementation now is closer to real hardware.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: KVM: set has-idle in guest device tree
Stuart Yoder [Thu, 3 Jan 2013 12:37:02 +0000 (12:37 +0000)]
PPC: KVM: set has-idle in guest device tree

On e500mc, the platform doesn't provide a way for the CPU to go idle.

To still not uselessly burn CPU time, expose an idle hypercall to the guest
if kvm supports it.

Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
[agraf: adjust for current code base, add patch description, fix non-kvm case]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agokvm: Update kernel headers
Alexander Graf [Fri, 4 Jan 2013 09:04:19 +0000 (10:04 +0100)]
kvm: Update kernel headers

Corresponding kvm.git hash: 18eb54cf4a

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: fix CTPR and de-assertion of interrupts
Scott Wood [Thu, 3 Jan 2013 13:25:40 +0000 (13:25 +0000)]
openpic: fix CTPR and de-assertion of interrupts

Properly implement level-triggered interrupts by withdrawing an
interrupt from the raised queue if the interrupt source de-asserts.
Also withdraw from the raised queue if the interrupt becomes masked.

When CTPR is written, check whether we need to raise or lower the
interrupt output.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: move IACK to its own function
Scott Wood [Thu, 3 Jan 2013 13:25:39 +0000 (13:25 +0000)]
openpic: move IACK to its own function

Besides making the code cleaner, we will need a separate way to access
IACK in order to implement EPR (external proxy) interrupt delivery.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: IRQ_check: search the queue a word at a time
Scott Wood [Thu, 3 Jan 2013 13:25:38 +0000 (13:25 +0000)]
openpic: IRQ_check: search the queue a word at a time

Search the queue more efficiently by first looking for a non-zero word,
and then using the common bit-searching function to find the bit within
the word.  It would be even nicer if bitops_ffsl() could be hooked up
to the compiler intrinsic so that bit-searching instructions could be
used, but that's another matter.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: fix sense and priority bits
Scott Wood [Thu, 3 Jan 2013 13:25:37 +0000 (13:25 +0000)]
openpic: fix sense and priority bits

Previously, the sense and priority bits were masked off when writing
to IVPR, and all interrupts were treated as edge-triggered (despite
the existence of code for handling level-triggered interrupts).

Polarity is implemented only as storage.  We don't simulate the
bad effects that you'd get on real hardware if you set this incorrectly,
but at least the guest sees the right thing when it reads back the register.

Sense now controls level/edge on FSL external interrupts (and all
interrupts on non-FSL MPIC).  FSL internal interrupts do not have a sense
bit (reads as zero), but are level.  FSL timers and IPIs do not have
sense or polarity bits (read as zero), and are edge-triggered.  To
accommodate FSL internal interrupts, QEMU's internal notion of whether an
interrupt is level-triggered is separated from the IVPR bit.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: add some bounds checking for IRQ numbers
Scott Wood [Fri, 21 Dec 2012 16:15:50 +0000 (16:15 +0000)]
openpic: add some bounds checking for IRQ numbers

The two checks with abort() guard against potential QEMU-internal
problems, but the EOI check stops the guest from causing updates to queue
position -1 and other havoc if it writes EOI with no interrupt in
service.

Signed-off-by: Scott Wood <scottwood@freescale.com>
[agraf: remove hunk in code that didn't get applied yet]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: use standard bitmap operations
Scott Wood [Fri, 21 Dec 2012 16:15:48 +0000 (16:15 +0000)]
openpic: use standard bitmap operations

Besides the private implementation being redundant, namespace collisions
prevented the use of other things in bitops.h.

Serialization does get a bit more awkward, unfortunately, since the
standard bitmap operations are "unsigned long" rather than "uint32_t",
though in exchange we will get faster queue lookups on 64-bit hosts once
we search a word at a time.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoRevert "openpic: Accelerate pending irq search"
Scott Wood [Fri, 21 Dec 2012 16:15:47 +0000 (16:15 +0000)]
Revert "openpic: Accelerate pending irq search"

This reverts commit a9bd83f4c65de0058659ede009fa1a241f379edd.

This counting approach is not robust against setting a bit that
was already set, or clearing a bit that was already clear.  Perhaps
that is considered a bug, but besides the lack of any documentation
for that restriction, it's a pretty unpleasant way for the problem
to manifest itself.

It could be made more robust by testing the current value of the
bit before changing the count, but a later patch speeds up IRQ_check
in all cases, not just when there's nothing pending.  Hopefully that
should be adequate to address performance concerns.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: always call IRQ_check from IRQ_get_next
Scott Wood [Fri, 21 Dec 2012 16:15:46 +0000 (16:15 +0000)]
openpic: always call IRQ_check from IRQ_get_next

Previously the code relied on the queue's "next" field getting
set to -1 sometime between an update to the bitmap, and the next
call to IRQ_get_next.  Sometimes this happened after the update.
Sometimes it happened before the check.  Sometimes it didn't happen
at all.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic/fsl: critical interrupts ignore mask before v4.1
Scott Wood [Fri, 21 Dec 2012 16:15:45 +0000 (16:15 +0000)]
openpic/fsl: critical interrupts ignore mask before v4.1

Signed-off-by: Scott Wood <scottwood@freescale.com>
[agraf: make bool :1]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: make ctpr signed
Scott Wood [Fri, 21 Dec 2012 16:15:44 +0000 (16:15 +0000)]
openpic: make ctpr signed

Other priorities are signed, so avoid comparisons between
signed and unsigned.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoopenpic: rework critical interrupt support
Scott Wood [Fri, 21 Dec 2012 16:15:43 +0000 (16:15 +0000)]
openpic: rework critical interrupt support

Critical interrupts on FSL MPIC are not supposed to pay
attention to priority, IACK, EOI, etc.  On the currently modeled
version it's not supposed to pay attention to the mask bit either.

Also reorganize to make it easier to implement newer FSL MPIC models,
which encode interrupt level information differently and support
mcheck as well as crit, and to reduce problems for later patches
in this set.

Still missing is the ability to lower the CINT signal to the core,
as IACK/EOI is not used.  This will come with general IRQ-source-driven
lowering in the next patch.

New state is added which is not serialized, but instead is recomputed
in openpic_load() by calling the appropriate write_IRQreg function.
This should have the side effect of causing the IRQ outputs to be
raised appropriately on load, which was missing.

The serialization format is altered by swapping ivpr and idr (we'd like
IDR to be restored before we run the IVPR logic), and moving interrupts
to the end (so that other state has been restored by the time we run the
IDR/IVPR logic.  Serialization for this driver is not yet in a state
where backwards compatibility is reasonable (assuming it works at all),
and the current serialization format was not built for extensibility.

Signed-off-by: Scott Wood <scottwood@freescale.com>
[agraf: fix for current code state]
Signed-off-by: Alexander Graf <agraf@suse.de>