]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoMerge remote-tracking branch 'alon/libcacard_ccid.2' into staging
Anthony Liguori [Mon, 29 Apr 2013 13:26:39 +0000 (08:26 -0500)]
Merge remote-tracking branch 'alon/libcacard_ccid.2' into staging

# By Cole Robinson
# Via Alon Levy
* alon/libcacard_ccid.2:
  ccid: Fix crash when backend isn't specified

Message-id: 20130426234357.GA12457@garlic.tami
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosparc64: use direct interrupt mapping for PCI devices
Artyom Tarasenko [Sat, 27 Apr 2013 05:55:13 +0000 (07:55 +0200)]
sparc64: use direct interrupt mapping for PCI devices

Every PCI Slot in PBM has 4 directly mapped IRQ lines.
Use the IRQ routing schema 0bssnn (Bus, Slot, interrupt Number)
described in Section 19.3.3 of UltraSPARC™-IIi User's Manual.

Please note that this patch requires the OpenBIOS counterpart patch.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosparc64: fix loosing interrupts
Artyom Tarasenko [Sat, 27 Apr 2013 05:55:12 +0000 (07:55 +0200)]
sparc64: fix loosing interrupts

- clear interrupts only on writing to the interrupt clear registers
- don't overwrite a currently active interrupt request
- use the correct addresses for the interrupt clear registers
  (section 19.3.3.3 of the UltraSPARC™-IIi User’s Manual)

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosparc64: allow 64 IRQ lines
Artyom Tarasenko [Sat, 27 Apr 2013 05:55:11 +0000 (07:55 +0200)]
sparc64: allow 64 IRQ lines

According to UltraSPARC™-IIi User’s Manual, PBM has 64 IRQ lines.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-arm: Remove long jump from tcg_out_goto_label
Richard Henderson [Tue, 23 Apr 2013 20:07:40 +0000 (13:07 -0700)]
tcg-arm: Remove long jump from tcg_out_goto_label

Branches within a TB will always be within 16MB.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Convert to CONFIG_QEMU_LDST_OPTIMIZATION
Richard Henderson [Wed, 13 Mar 2013 22:24:33 +0000 (15:24 -0700)]
tcg-arm: Convert to CONFIG_QEMU_LDST_OPTIMIZATION

Move the slow path out of line, as the TODO's mention.
This allows the fast path to be unconditional, which can
speed up the fast path as well, depending on the core.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Use movi32 + blx for calls on v7
Richard Henderson [Wed, 13 Mar 2013 20:40:43 +0000 (13:40 -0700)]
tcg-arm: Use movi32 + blx for calls on v7

Work better with branch predition when we have movw+movt,
as the size of the code is the same.  Perhaps re-evaluate
when we have a proper constant pool.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Delete the 'S' constraint
Richard Henderson [Tue, 23 Apr 2013 15:38:50 +0000 (08:38 -0700)]
tcg-arm: Delete the 'S' constraint

After the previous patch, 's' and 'S' are the same.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Improve scheduling of tcg_out_tlb_read
Richard Henderson [Wed, 13 Mar 2013 06:18:30 +0000 (23:18 -0700)]
tcg-arm: Improve scheduling of tcg_out_tlb_read

The schedule was fully serial, with no possibility for dual issue.
The old schedule had a minimal issue of 7 cycles; the new schedule
has a minimal issue of 5 cycles.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Split out tcg_out_tlb_read
Richard Henderson [Wed, 13 Mar 2013 01:18:07 +0000 (18:18 -0700)]
tcg-arm: Split out tcg_out_tlb_read

Share code between qemu_ld and qemu_st to process the tlb.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Cleanup most primitive load store subroutines
Richard Henderson [Tue, 12 Mar 2013 22:06:53 +0000 (15:06 -0700)]
tcg-arm: Cleanup most primitive load store subroutines

Use even more primitive helper functions to avoid lots of duplicated code.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Cleanup multiply subroutines
Richard Henderson [Tue, 12 Mar 2013 17:34:18 +0000 (10:34 -0700)]
tcg-arm: Cleanup multiply subroutines

Make the code more readable by only having one copy of the magic
numbers, swapping registers as needed prior to that.  Speed the
compiler by not applying the rd == rn avoidance for v6 or later.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Use R12 for the tcg temporary
Richard Henderson [Tue, 12 Mar 2013 16:50:25 +0000 (09:50 -0700)]
tcg-arm: Use R12 for the tcg temporary

R12 is call clobbered, while R8 is call saved.  This change
gives tcg one more call saved register for real data.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Use TCG_REG_TMP name for the tcg temporary
Richard Henderson [Tue, 12 Mar 2013 16:49:04 +0000 (09:49 -0700)]
tcg-arm: Use TCG_REG_TMP name for the tcg temporary

Don't hard-code R8.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Implement division instructions
Richard Henderson [Tue, 12 Mar 2013 05:11:30 +0000 (22:11 -0700)]
tcg-arm: Implement division instructions

An armv7 extension implements division, present on Cortex A15.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Implement deposit for armv7
Richard Henderson [Tue, 5 Mar 2013 05:12:30 +0000 (21:12 -0800)]
tcg-arm: Implement deposit for armv7

We have BFI and BFC available for implementing it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Improve constant generation
Richard Henderson [Tue, 5 Mar 2013 07:16:24 +0000 (23:16 -0800)]
tcg-arm: Improve constant generation

Try fully rotated arguments to mov and mvn before trying movt
or full decomposition.  Begin decomposition with mvn when it
looks like it'll help.  Examples include

-:        mov   r9, #0x00000fa0
-:        orr   r9, r9, #0x000ee000
-:        orr   r9, r9, #0x0ff00000
-:        orr   r9, r9, #0xf0000000
+:        mvn   r9, #0x0000005f
+:        eor   r9, r9, #0x00011000

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Handle constant arguments to add2/sub2
Richard Henderson [Tue, 12 Mar 2013 02:51:56 +0000 (19:51 -0700)]
tcg-arm: Handle constant arguments to add2/sub2

We get to re-use the _rIN and _rIK subroutines to handle the various
combinations of add vs sub.  Fold the << 21 into the opcode enum values
so that we can explicitly add TO_CPSR as desired.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Use tcg_out_dat_rIN for compares
Richard Henderson [Tue, 12 Mar 2013 01:21:59 +0000 (18:21 -0700)]
tcg-arm: Use tcg_out_dat_rIN for compares

This allows us to emit CMN instructions.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Allow constant first argument to sub
Richard Henderson [Tue, 12 Mar 2013 01:04:14 +0000 (18:04 -0700)]
tcg-arm: Allow constant first argument to sub

This allows the generation of RSB instructions.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Handle negated constant arguments to and/sub
Richard Henderson [Tue, 5 Mar 2013 06:06:21 +0000 (22:06 -0800)]
tcg-arm: Handle negated constant arguments to and/sub

This greatly improves code generation for addition of small
negative constants.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Use bic to implement and with constant
Richard Henderson [Tue, 5 Mar 2013 05:36:45 +0000 (21:36 -0800)]
tcg-arm: Use bic to implement and with constant

This greatly improves the code we can produce for deposit
without armv7 support.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Log the contents of the prologue with -d out_asm
Richard Henderson [Sun, 31 Mar 2013 20:15:19 +0000 (13:15 -0700)]
tcg: Log the contents of the prologue with -d out_asm

This makes it easier to verify changes to the code
generating the prologue.

[Aurelien: change the format from %i to %zu]

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoccid: Fix crash when backend isn't specified
Cole Robinson [Sun, 14 Apr 2013 20:06:59 +0000 (16:06 -0400)]
ccid: Fix crash when backend isn't specified

Reproducer:

./x86_64-softmmu/qemu-system-x86_64 -device usb-ccid,id=ccid0 -usb -device ccid-card-emulated -monitor stdio

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agotcg-arm: Fix local stack frame
Richard Henderson [Wed, 13 Mar 2013 00:11:40 +0000 (17:11 -0700)]
tcg-arm: Fix local stack frame

We were not allocating TCG_STATIC_CALL_ARGS_SIZE, so this meant that
any helper with more than 4 arguments would clobber the saved regs.
Realizing that we're supposed to have this memory pre-allocated means
we can clean up the tcg_out_arg functions, which were trying to do
more stack allocation.

Allocate stack memory for the TCG temporaries while we're at it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: fix deposit_i64 op on 32-bit targets
Aurelien Jarno [Sat, 20 Apr 2013 22:42:56 +0000 (00:42 +0200)]
tcg: fix deposit_i64 op on 32-bit targets

On 32-bit TCG targets, when emulating deposit_i64 with a mov_i32 +
deposit_i32, care should be taken to not overwrite the low part of
the second argument before the deposit when it is the same the
destination.

This fixes the shld instruction in qemu-system-x86_64, which in turns
fixes booting "system rescue CD version 2.8.0" on this target.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-ppc: slightly optimize lfiwax
Aurelien Jarno [Fri, 26 Apr 2013 22:37:46 +0000 (00:37 +0200)]
target-ppc: slightly optimize lfiwax

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoMerge branch 'ppc-for-upstream' of git://github.com/agraf/qemu
Aurelien Jarno [Fri, 26 Apr 2013 22:33:23 +0000 (00:33 +0200)]
Merge branch 'ppc-for-upstream' of git://github.com/agraf/qemu

* 'ppc-for-upstream' of git://github.com/agraf/qemu: (30 commits)
  target-ppc: add support for extended mtfsf/mtfsfi forms
  target-ppc: emulate store doubleword pair instructions
  target-ppc: emulate load doubleword pair instructions
  target-ppc: emulate lfiwax instruction
  target-ppc: emulate fcpsgn instruction
  target-ppc: emulate prtyw and prtyd instructions
  target-ppc: emulate cmpb instruction
  target-ppc: add instruction flags for Book I 2.05
  disas: Disassemble all ppc insns for the guest
  target-ppc: optimize fabs, fnabs, fneg
  PPC: Fix dcbz for linux-user on 970
  powerpc: correctly handle fpu exceptions.
  pseries: Generate device paths for VIO devices
  pseries: Convert VIO code to QOM style type safe(ish) casts
  target-ppc: Synchronize VPA state with KVM
  pseries: Fix some small errors in XICS logic
  target-ppc: Add more stubs for POWER7 PMU registers
  pseries: Fixes and enhancements to L1 cache properties
  pseries: Fix incorrect calculation of RMA size in certain configurations
  PPC: Fix compile with profiling enabled
  ...

11 years agotarget-ppc: add support for extended mtfsf/mtfsfi forms
Aurelien Jarno [Sat, 20 Apr 2013 08:56:22 +0000 (08:56 +0000)]
target-ppc: add support for extended mtfsf/mtfsfi forms

Power ISA 2.05 adds support for extended mtfsf/mtfsfi form, with a new
W field to select the upper part of the FPCSR register.

For that the helper is changed to handle 64-bit input values and mask with
up to 16 bits. The mtfsf/mtfsfi instructions do not have the W bit
marked as invalid anymore. Instead this is checked in the helper, which
therefore needs to access to the insns/insns_flags2. They are added in
the DisasContext struct. Finally change all accesses to the opcode fields
through extract helpers, prefixed with FP for consistency.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: emulate store doubleword pair instructions
Aurelien Jarno [Sat, 20 Apr 2013 08:56:21 +0000 (08:56 +0000)]
target-ppc: emulate store doubleword pair instructions

Needed for Power ISA version 2.05 compliance. The check for odd register
pairs is done using the invalid bits.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: emulate load doubleword pair instructions
Aurelien Jarno [Sat, 20 Apr 2013 08:56:20 +0000 (08:56 +0000)]
target-ppc: emulate load doubleword pair instructions

Needed for Power ISA version 2.05 compliance. The check for odd register
pairs is done using the invalid bits.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: emulate lfiwax instruction
Aurelien Jarno [Sat, 20 Apr 2013 08:56:19 +0000 (08:56 +0000)]
target-ppc: emulate lfiwax instruction

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
[agraf: fix tcg debug error]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: emulate fcpsgn instruction
Aurelien Jarno [Sat, 20 Apr 2013 08:56:18 +0000 (08:56 +0000)]
target-ppc: emulate fcpsgn instruction

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: emulate prtyw and prtyd instructions
Aurelien Jarno [Sat, 20 Apr 2013 08:56:17 +0000 (08:56 +0000)]
target-ppc: emulate prtyw and prtyd instructions

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
[agraf: fix 32-bit host compile, simplify code]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: emulate cmpb instruction
Aurelien Jarno [Sat, 20 Apr 2013 08:56:16 +0000 (08:56 +0000)]
target-ppc: emulate cmpb instruction

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: add instruction flags for Book I 2.05
Aurelien Jarno [Sat, 20 Apr 2013 08:56:15 +0000 (08:56 +0000)]
target-ppc: add instruction flags for Book I 2.05

.. and enable it on POWER7 CPU.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agodisas: Disassemble all ppc insns for the guest
Aurelien Jarno [Sat, 20 Apr 2013 08:56:14 +0000 (08:56 +0000)]
disas: Disassemble all ppc insns for the guest

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
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 agovirtio-rng-s390: add properties.
KONRAD Frederic [Sun, 14 Apr 2013 03:14:49 +0000 (03:14 +0000)]
virtio-rng-s390: add properties.

I don't see any reason why these properties are missing.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Note: Need to apply virtio-rng-refactoring first!
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoUtilize selective runtime reg sync for hot code paths
Jason J. Herne [Thu, 25 Apr 2013 04:25:51 +0000 (04:25 +0000)]
Utilize selective runtime reg sync for hot code paths

Make use of new kvm_s390_get_registers_partial() for kvm_handle_css_inst() and
handle_hypercall() since they only need registers from the partial set and they
are called quite frequently.

Signed-off-by: Jason J. Herne <jjherne@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoAllow selective runtime register synchronization
Jason J. Herne [Thu, 25 Apr 2013 04:25:50 +0000 (04:25 +0000)]
Allow selective runtime register synchronization

We want to avoid expensive register synchronization IOCTL's on the hot path so
a new kvm_s390_get_registers_partial() is introduced as a compliment to
kvm_arch_get_registers().  The new function is called on the hot path, and
kvm_arch_get_registers() is called when we need the complete runtime register
state.

kvm_arch_put_registers() is updated to only sync the partial runtime set when
we've only dirtied the partial runtime set.  This is to avoid sending bad data
back to KVM if we've only partially synced the runtime register set.

Signed-off-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoCommon: Add quick access to first boot device
Dominik Dingel [Fri, 26 Apr 2013 02:12:49 +0000 (02:12 +0000)]
Common: Add quick access to first boot device

Instead of manually parsing the boot_list as character stream,
we can access the nth boot device, specified by the position in the
boot order.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: CCW: Use new, working firmware by default
Alexander Graf [Mon, 22 Apr 2013 19:12:54 +0000 (21:12 +0200)]
S390: CCW: Use new, working firmware by default

Since we now have working firmware for s390-ccw in the tree, we can
default to it on our s390-ccw machine, rendering it more useful.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add compiled blob
Alexander Graf [Mon, 22 Apr 2013 19:10:50 +0000 (21:10 +0200)]
S390: ccw firmware: Add compiled blob

Now that we have all the source code ready, add a compiled blob into
the QEMU source tree, so that people without access to an s390 compiler
can run the s390-ccw firmware.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: Get queue config from host.
Cornelia Huck [Fri, 26 Apr 2013 02:12:55 +0000 (02:12 +0000)]
s390-ccw.img: Get queue config from host.

Ask the host about the configuration instead of guessing it.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: Rudimentary error checking.
Cornelia Huck [Fri, 26 Apr 2013 02:12:54 +0000 (02:12 +0000)]
s390-ccw.img: Rudimentary error checking.

Try to handle at least some of the errors that may happen.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: Enhance drain_irqs().
Cornelia Huck [Fri, 26 Apr 2013 02:12:53 +0000 (02:12 +0000)]
s390-ccw.img: Enhance drain_irqs().

- Use tpi + tsch to get interrupts.
- Return an error if the irb indicates problems.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: Detect devices with stsch.
Cornelia Huck [Fri, 26 Apr 2013 02:12:52 +0000 (02:12 +0000)]
s390-ccw.img: Detect devices with stsch.

stsch is the canonical way to detect devices. As a bonus, we can
abort the loop if we get cc 3, and we need to check only the valid
devices (dnv set).

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: Fix compile warning in s390 ccw virtio code
Christian Borntraeger [Tue, 23 Apr 2013 01:23:04 +0000 (01:23 +0000)]
s390-ccw.img: Fix compile warning in s390 ccw virtio code

Lets fix this gcc warning:

virtio.c: In function ‘vring_send_buf’:
virtio.c:125:35: error: operation on ‘vr->next_idx’ may be undefined
[-Werror=sequence-point]

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: Take care of the elf->img transition
Christian Borntraeger [Tue, 23 Apr 2013 01:23:05 +0000 (01:23 +0000)]
s390-ccw.img: Take care of the elf->img transition

We have to call strip with s390-ccw.elf as input and
s390-ccw.img as output

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: build s390-ccw rom on s3900 system by default
Christian Borntraeger [Tue, 23 Apr 2013 01:23:03 +0000 (01:23 +0000)]
s390-ccw.img: build s390-ccw rom on s3900 system by default

Lets build the s390-ccw rom if on s390. Also fix the separate build
folder case.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390-ccw.img: replace while loop with a disabled wait on s390 bios
Christian Borntraeger [Tue, 23 Apr 2013 01:23:02 +0000 (01:23 +0000)]
s390-ccw.img: replace while loop with a disabled wait on s390 bios

dont waste cpu power on an error condition. Lets stop the guest
with a disabled wait.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add Makefile
Alexander Graf [Mon, 22 Apr 2013 19:03:39 +0000 (21:03 +0200)]
S390: ccw firmware: Add Makefile

This patch adds a makefile, so we can build our ccw firmware. Also
add the resulting binaries to .gitignore, so that nobody is annoyed
they might be in the tree.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add bootmap interpreter
Alexander Graf [Mon, 22 Apr 2013 19:02:49 +0000 (21:02 +0200)]
S390: ccw firmware: Add bootmap interpreter

On s390, there is an architected boot map format that we can read to
boot a certain entry off the disk. Implement a simple reader for this
that always boots the first (default) entry.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add glue header
Alexander Graf [Mon, 22 Apr 2013 19:01:49 +0000 (21:01 +0200)]
S390: ccw firmware: Add glue header

Like all great programs, we have to call between different functions in
different object files. And all of them need a common ground of defines.

Provide a file that provides these defines.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add virtio device drivers
Alexander Graf [Mon, 22 Apr 2013 19:01:00 +0000 (21:01 +0200)]
S390: ccw firmware: Add virtio device drivers

In order to boot, we need to be able to access a virtio-blk device through
the CCW bus. Implement support for this.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add sclp output
Alexander Graf [Mon, 22 Apr 2013 18:59:25 +0000 (20:59 +0200)]
S390: ccw firmware: Add sclp output

In order to communicate with the user, we need an I/O mechanism that he
can read. Implement SCLP ASCII support, which happens to be the default
in the s390 ccw machine.

This file is missing read support for now. It can only print messages.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add main program
Alexander Graf [Mon, 22 Apr 2013 18:57:58 +0000 (20:57 +0200)]
S390: ccw firmware: Add main program

This C file is the main driving piece of the s390 ccw firmware. It
provides a search for a workable block device, sets it as the default
to boot off of and boots from it.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: ccw firmware: Add start assembly
Alexander Graf [Mon, 22 Apr 2013 18:56:08 +0000 (20:56 +0200)]
S390: ccw firmware: Add start assembly

We want to write most of our code in C, so add a small assembly
stub that jumps straight into C code for us to continue booting.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: IPL: Use different firmware for different machines
Alexander Graf [Mon, 22 Apr 2013 14:52:53 +0000 (16:52 +0200)]
S390: IPL: Use different firmware for different machines

We have a virtio-s390 and a virtio-ccw machine in QEMU. Both use vastly
different ways to do I/O. Having the same firmware blob for both doesn't
really make any sense.

Instead, let's parametrize the firmware file name, so that we can have
different blobs for different machines.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: IPL: Support ELF firmware
Alexander Graf [Mon, 22 Apr 2013 14:47:32 +0000 (16:47 +0200)]
S390: IPL: Support ELF firmware

Our firmware blob is always a raw file that we load at a fixed address today.
Support loading an ELF blob instead that we can map high up in memory.

This way we don't have to be so conscious about size constraints.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoS390: Make IPL reset address dynamic
Alexander Graf [Mon, 22 Apr 2013 14:44:39 +0000 (16:44 +0200)]
S390: Make IPL reset address dynamic

We can have different load addresses for different blobs we boot with.
Make the reset IP dynamic, so that we can handle things more flexibly.

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>