OSDN Git Service

qmiga/qemu.git
9 years agolinux-user: Fix ioctl cmd type mismatch on 64-bit targets
Ed Swierk [Tue, 16 Dec 2014 20:55:31 +0000 (12:55 -0800)]
linux-user: Fix ioctl cmd type mismatch on 64-bit targets

linux-user passes the cmd argument of the ioctl syscall as a signed long,
but compares it to an unsigned int when iterating through the ioctl_entries
list.  When the cmd is a large value like 0x80047476 (TARGET_TIOCSWINSZ on
mips64) it gets sign-extended to 0xffffffff80047476, causing the comparison
to fail and resulting in lots of spurious "Unsupported ioctl" errors.
Changing the target_cmd field in the ioctl_entries list to a signed int
causes those values to be sign-extended as well during the comparison.

Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: translate resource also for prlimit64
Felix Janda [Tue, 2 Dec 2014 21:11:17 +0000 (22:11 +0100)]
linux-user: translate resource also for prlimit64

The resource argument is translated from host to target for
[gs]etprlimit but not for prlimit64. Fix this.

Signed-off-by: Felix Janda <felix.janda@posteo.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user
Peter Maydell [Thu, 8 Jan 2015 12:19:48 +0000 (12:19 +0000)]
linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user

The function copy_siginfo_to_user() just calls tswap_siginfo(), so
call the latter function directly and delete the wrapper function.
The wrapper is actually misleading since it implies that the
semantics are like the kernel function with the same name which
copies the data to a guest user-space address. In fact tswap_siginfo()
just does data-structure conversion between two structures whose
addresses are host addresses (the copy to userspace is handled
in QEMU by the lock_user/unlock_user calls).

This also fixes clang complaints about the wrapper being unused
in some configs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user/main.c: Mark end_exclusive() as possibly unused
Peter Maydell [Thu, 8 Jan 2015 12:19:47 +0000 (12:19 +0000)]
linux-user/main.c: Mark end_exclusive() as possibly unused

The function end_exclusive() isn't used on all targets; mark it as
such to avoid a clang warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user/main.c: Call cpu_exec_start/end on all target archs
Peter Maydell [Thu, 8 Jan 2015 12:19:46 +0000 (12:19 +0000)]
linux-user/main.c: Call cpu_exec_start/end on all target archs

The start_exclusive() infrastructure is used on all target
architectures, even if only to do the "stop all CPUs before
dumping core" in force_sig(), so be consistent and call
cpu_exec_start/end in the main loop of every target.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user/arm/nwfpe: Delete unused aCC array
Peter Maydell [Thu, 8 Jan 2015 12:19:45 +0000 (12:19 +0000)]
linux-user/arm/nwfpe: Delete unused aCC array

The aCC array in fpopcode.c is completely unused in QEMU; delete
it (silencing a clang warning).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user/alpha: Add define for NR_shmat to enable shmat syscall
Peter Maydell [Thu, 8 Jan 2015 12:19:44 +0000 (12:19 +0000)]
linux-user/alpha: Add define for NR_shmat to enable shmat syscall

For historical reasons, the define for the shmat() syscall on Alpha is
NR_osf_shmat; however it has the same semantics as this syscall does
on all other architectures, so define TARGET_NR_shmat as well so that
QEMU's code for the syscall is enabled.

This patch brings our behaviour on the LTP shmat tests into line
with that for ARM (still not a perfect pass rate but not "this syscall
is completely broken" as we had before).

(Problem detected via a clang warning that the do_shmat() function
was unused on Alpha.)

Cc: Richard Henderson <rth@twiddle.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user/signal.c: Remove current_exec_domain_sig()
Peter Maydell [Thu, 8 Jan 2015 12:19:43 +0000 (12:19 +0000)]
linux-user/signal.c: Remove current_exec_domain_sig()

Remove the function current_exec_domain_sig(), which always returns
its argument. This was intended as a stub for supporting the kernel's
exec_domain handling, but:
 * we don't have any of the other code for execution domains
 * in the kernel this handling is architecture-specific, not generic
 * we only call this function in the x86, ppc and sh4 signal code paths,
   and the PPC one is wrong anyway because the PPC kernel doesn't
   have this signal-remapping code

So it's best to simply delete the function; any future attempt to
implement exec domains will be better served by adding the correct
code from scratch based on the kernel sources at that time.

This change also fixes some clang warnings about the function being
defined but not used for some target architectures.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Tue, 27 Jan 2015 13:17:30 +0000 (13:17 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pci, pc, virtio fixes and cleanups

A bunch of fixes all over the place.  Also, beginning to generalize acpi build
code for reuse by ARM.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Tue 27 Jan 2015 13:12:25 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  pc-dimm: Add Error argument to pc_existing_dimms_capacity
  pc-dimm: Make pc_existing_dimms_capacity global
  pc: Fix DIMMs capacity calculation
  smbios: Don't report unknown CPU speed (fix SVVP regression)
  smbios: Fix dimm size calculation when RAM is multiple of 16GB
  bios-linker-loader: move source to common location
  bios-linker-loader: move header to common location
  virtio: fix feature bit checks
  bios-tables-test: split piix4 and q35 tests
  acpi: build_append_nameseg(): add padding if necessary
  acpi: update generated hex files
  acpi-test: update expected DSDT
  pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled
  pci: Split pcie_host_mmcfg_map()
  Add some trace calls to pci.c.
  ich9: add disable_s3, disable_s4, s4_val properties

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agopc-dimm: Add Error argument to pc_existing_dimms_capacity
Bharata B Rao [Tue, 27 Jan 2015 04:05:02 +0000 (09:35 +0530)]
pc-dimm: Add Error argument to pc_existing_dimms_capacity

Now that pc_existing_dimms_capacity() is an API, include Error pointer
as an argument and modify the caller appropriately.

Suggested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9 years agopc-dimm: Make pc_existing_dimms_capacity global
Bharata B Rao [Tue, 27 Jan 2015 04:05:01 +0000 (09:35 +0530)]
pc-dimm: Make pc_existing_dimms_capacity global

Move pc_existing_dimms_capacity() to pc-dimm.c since it would be needed
by PowerPC memory hotplug code too.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: Fix DIMMs capacity calculation
Bharata B Rao [Tue, 27 Jan 2015 04:05:00 +0000 (09:35 +0530)]
pc: Fix DIMMs capacity calculation

pc_existing_dimms_capacity() is returning DIMMs count rather than capacity.
Fix this to return the capacity. Also consider only realized devices for
capacity calculation.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agosmbios: Don't report unknown CPU speed (fix SVVP regression)
Eduardo Habkost [Wed, 7 Jan 2015 17:36:34 +0000 (15:36 -0200)]
smbios: Don't report unknown CPU speed (fix SVVP regression)

SVVP requires processor speed on Type 4 structures to not be unknown.
This was fixed in SeaBIOS 0.5.0 (in 2009), but the bug was reintroduced
in QEMU 2.1.

Revert to old behavior and report CPU speed as 2000 MHz instead of
unknown.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agosmbios: Fix dimm size calculation when RAM is multiple of 16GB
Eduardo Habkost [Wed, 7 Jan 2015 17:36:33 +0000 (15:36 -0200)]
smbios: Fix dimm size calculation when RAM is multiple of 16GB

The Memory Device size calculation logic is broken when the RAM size is
a multiple of 16GB, making the size of the last entry be 0 instead of
16GB. Fix the logic to handle that case correctly.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agobios-linker-loader: move source to common location
Michael S. Tsirkin [Mon, 19 Jan 2015 21:58:55 +0000 (23:58 +0200)]
bios-linker-loader: move source to common location

There are plans to use bios linker by MIPS, ARM.

It's only used by ACPI ATM, so put it in hw/acpi
and make it depend on CONFIG_ACPI.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agobios-linker-loader: move header to common location
Michael S. Tsirkin [Mon, 19 Jan 2015 21:58:55 +0000 (23:58 +0200)]
bios-linker-loader: move header to common location

Will be usable by MIPS, ARM.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: fix feature bit checks
Cornelia Huck [Fri, 12 Dec 2014 09:01:46 +0000 (10:01 +0100)]
virtio: fix feature bit checks

Several places check against the feature bit number instead of against
the feature bit. Fix them.

Cc: qemu-stable@nongnu.org
Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agobios-tables-test: split piix4 and q35 tests
Paolo Bonzini [Mon, 19 Jan 2015 16:50:38 +0000 (17:50 +0100)]
bios-tables-test: split piix4 and q35 tests

This makes it clear which one is failing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
9 years agoacpi: build_append_nameseg(): add padding if necessary
Igor Mammedov [Fri, 19 Dec 2014 11:47:00 +0000 (11:47 +0000)]
acpi: build_append_nameseg(): add padding if necessary

According to ACPI spec NameSeg shorter than 4 characters
must be padded up to 4 characters with "_" symbol.
ACPI 5.0:  20.2.2 "Name Objects Encoding"

Do it in build_append_nameseg() so that caller shouldn't know
or care about it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: update generated hex files
Michael S. Tsirkin [Tue, 27 Jan 2015 12:40:44 +0000 (14:40 +0200)]
acpi: update generated hex files

Previous patch
    pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled
changed DSDT, update hex files for non-iasl builds.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi-test: update expected DSDT
Michael S. Tsirkin [Tue, 27 Jan 2015 12:40:44 +0000 (14:40 +0200)]
acpi-test: update expected DSDT

Previous patch
    pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled
changed DSDT, update expected test files.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150127' into...
Peter Maydell [Tue, 27 Jan 2015 11:15:09 +0000 (11:15 +0000)]
Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150127' into staging

tricore bugfixes and RR1, RR2, RRPW and RRR insn

# gpg: Signature made Tue 27 Jan 2015 12:02:06 GMT using RSA key ID 6B69CA14
# gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>"

* remotes/bkoppelmann/tags/pull-tricore-20150127:
  target-tricore: Add instructions of RRR opcode format
  target-tricore: Add instructions of RRPW opcode format
  target-tricore: Add instructions of RR2 opcode format
  target-tricore: Add instructions of RR1 opcode format, that have 0x93 as first opcode
  target-tricore: split up suov32 into suov32_pos and suov32_neg
  target-tricore: Fix bugs found by coverity
  target-tricore: calculate av bits before saturation
  target-tricore: Several translator and cpu model fixes
  target-tricore: Add missing ULL suffix on 64 bit constant

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-tricore: Add instructions of RRR opcode format
Bastian Koppelmann [Mon, 19 Jan 2015 15:43:07 +0000 (15:43 +0000)]
target-tricore: Add instructions of RRR opcode format

Add microcode generator function gen_cond_sub.

Add helper functions:
    * ixmax/ixmin: search for the max/min value and its related index in a
                   vector of 16-bit values.
    * pack: dack two data registers into an IEEE-754 single precision floating
            point format number.
    * dvadj: divide-adjust the result after dvstep instructions.
    * dvstep: divide a reg by a divisor, producing 8-bits of quotient at a time.

OPCM_32_RRR_FLOAT -> OPCM_32_RRR_DIVIDE

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agotarget-tricore: Add instructions of RRPW opcode format
Bastian Koppelmann [Mon, 19 Jan 2015 15:13:00 +0000 (15:13 +0000)]
target-tricore: Add instructions of RRPW opcode format

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agotarget-tricore: Add instructions of RR2 opcode format
Bastian Koppelmann [Mon, 19 Jan 2015 15:05:01 +0000 (15:05 +0000)]
target-tricore: Add instructions of RR2 opcode format

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agotarget-tricore: Add instructions of RR1 opcode format, that have 0x93 as first opcode
Bastian Koppelmann [Mon, 19 Jan 2015 14:58:42 +0000 (14:58 +0000)]
target-tricore: Add instructions of RR1 opcode format, that have 0x93 as first opcode

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agotarget-tricore: split up suov32 into suov32_pos and suov32_neg
Bastian Koppelmann [Mon, 19 Jan 2015 14:28:59 +0000 (14:28 +0000)]
target-tricore: split up suov32 into suov32_pos and suov32_neg

suov checks unsigned for an overflow and an underflow, after some arithmetic
operations and saturates the result to either max_uint32 or 0. So far we
handled this by expanding to the next bigger data type and compare whether
the result is > max_uint32 or < 0.

However this approach can fail for an 32 bit multiplication, if both operands of
the multiplication are 0x80000000. This sets the sign bit of the 64 bit integer
and would result in a false saturation to 0.

Since unsigned operations, e.g add, sub, mul always result in either a positive
or negative overflow, we split the functions for suov32 up into two functions
(suov32_pos, suov32_neg) for each case.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: Fix bugs found by coverity
Bastian Koppelmann [Wed, 21 Jan 2015 16:16:01 +0000 (16:16 +0000)]
target-tricore: Fix bugs found by coverity

This fixes one bug and one false positive found by coverity. The bug is,
that gen_mtcr was missing a mask to check the flag, which resulted in dead code.

The false positive is a intentional missing break for a jump and link address
insn followed by a jump and link insn. This adds a fall through comment to avoid
the false positive in the future.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: calculate av bits before saturation
Bastian Koppelmann [Wed, 21 Jan 2015 15:55:15 +0000 (15:55 +0000)]
target-tricore: calculate av bits before saturation

64 bit mac instructions calculated the av bits after the saturation, which
resulted in a wrong PSW. This moves the av bit calculation before the
saturation.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: Several translator and cpu model fixes
Bastian Koppelmann [Sat, 17 Jan 2015 22:34:27 +0000 (22:34 +0000)]
target-tricore: Several translator and cpu model fixes

Fix tc1796 cpu model using wrong ISA version.
Fix cond_add sometimes writing back wrong result.
Fix RCR_SEL and RCR_SELN using wrong registers for result and cond.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: Add missing ULL suffix on 64 bit constant
Peter Maydell [Tue, 23 Dec 2014 22:24:09 +0000 (22:24 +0000)]
target-tricore: Add missing ULL suffix on 64 bit constant

Add a missing ULL suffix to a 64 bit constant: this suppresses a
compiler warning from mingw32 gcc.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agopc: acpi: fix WindowsXP BSOD when memory hotplug is enabled
Igor Mammedov [Fri, 19 Dec 2014 11:46:57 +0000 (11:46 +0000)]
pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled

ACPI parser in XP considers PNP0A06 devices of CPU and
memory hotplug as duplicates. Adding unique _UID
to CPU hotplug device fixes BSOD.

Cc: qemu-stable@nongnu.org
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopci: Split pcie_host_mmcfg_map()
Alexander Graf [Tue, 6 Jan 2015 16:03:08 +0000 (17:03 +0100)]
pci: Split pcie_host_mmcfg_map()

The mmcfg space is a memory region that allows access to PCI config space
in the PCIe world. To maintain abstraction layers, I would like to expose
the mmcfg space as a sysbus mmio region rather than have it mapped straight
into the system's memory address space though.

So this patch splits the initialization of the mmcfg space from the actual
mapping, allowing us to only have an mmfg memory region without the map.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
9 years agoAdd some trace calls to pci.c.
Don Koch [Fri, 16 Jan 2015 19:20:51 +0000 (14:20 -0500)]
Add some trace calls to pci.c.

Signed-off-by: Don Koch <dkoch@verizon.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoich9: add disable_s3, disable_s4, s4_val properties
Amit Shah [Mon, 12 Jan 2015 12:00:14 +0000 (17:30 +0530)]
ich9: add disable_s3, disable_s4, s4_val properties

PIIX4 has disable_s3 and disable_s4 properties to enable or disable PM
functions.  Add such properties to the ICH9 chipset as well for the Q35
machine type.

S3 / S4 are not guaranteed to always work (needs work in the guest as
well as QEMU for things to work properly), and disabling advertising of
these features ensures guests don't go into zombie state if something
isn't working right.

The defaults are kept the same as in PIIX4: both S3 and S4 are enabled
by default.

These can be disabled via the cmdline:

  ... -global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1

Note: some guests can fake hibernation by writing a hibernate image and
doing a shutdown instead of S4 if S4 isn't available; there's nothing we
can do guests to stop doing this, and this patch can't affect that
functionality.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
9 years agoqemu-timer.c: Trim list of included headers
Peter Maydell [Tue, 20 Jan 2015 16:16:40 +0000 (16:16 +0000)]
qemu-timer.c: Trim list of included headers

qemu-timer.c was including a lot more headers than it needed to,
presumably for historical reasons. In particular, it included
ui/console.h; this now tries to pull in <pixman.h>, which will
cause a compilation failure in --disable-tools --disable-system
configurations when running "make check" (which builds qemu-timer.c,
even though the linux-user binaries themselves don't need it).

Fix this build failure by trimming down the set of included
headers severely -- we only really need main-loop.h and timer.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1421770600-17525-1-git-send-email-peter.maydell@linaro.org

9 years agoMerge remote-tracking branch 'remotes/sstabellini/xen-2015-01-26' into staging
Peter Maydell [Mon, 26 Jan 2015 13:11:16 +0000 (13:11 +0000)]
Merge remote-tracking branch 'remotes/sstabellini/xen-2015-01-26' into staging

* remotes/sstabellini/xen-2015-01-26:
  fix QEMU build on Xen/ARM

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agofix QEMU build on Xen/ARM
Stefano Stabellini [Fri, 23 Jan 2015 12:09:47 +0000 (12:09 +0000)]
fix QEMU build on Xen/ARM

xen_get_vmport_regs_pfn should take a xen_pfn_t argument, not an
unsigned long argument (in fact xen_pfn_t is defined as uint64_t on
ARM).

Also use xc_hvm_param_get instead of the deprecated xc_get_hvm_param.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Don Slutz <dslutz@verizon.com>
9 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Mon, 26 Jan 2015 11:50:29 +0000 (11:50 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

- Many fixes from the floor as usual
- New "edu" device (v1->v2: fix 32-bit compilation)
- Disabling HLE and RTM on Haswell & Broadwell
- kvm_stat updates
- Added --enable-modules to Travis, in preparation for switching
  the default

# gpg: Signature made Mon 26 Jan 2015 11:44:40 GMT using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream:
  kvm_stat: Add RESET support for perf event ioctl
  target-i386: Disable HLE and RTM on Haswell & Broadwell
  sparse: Fix build with sparse on .S files
  exec: fix madvise of NULL pointer
  .travis.yml: Add "--enable-modules"
  apic: do not dereference pointer before it is checked for NULL
  kvm_stat: Print errno when syscall to perf_event_open() fails
  kvm_stat: Update exit reasons to the latest defintion
  kvm_stat: Add aarch64 support
  hw: misc, add educational driver
  vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR*
  qemu-timer: introduce timer_deinit
  qemu-timer: add timer_init and timer_init_ns/us/ms
  target-i386: make xmm_regs 512-bit wide
  target-i386: use vmstate_offset_sub_array for AVX registers
  tests/multiboot: Add test for modules
  multiboot: Fix offset of bootloader name
  tests/multiboot: Update reference output
  pc: fix KVM features in pc-1.3 and earlier machine types

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agokvm_stat: Add RESET support for perf event ioctl
Wei Huang [Fri, 23 Jan 2015 20:56:04 +0000 (15:56 -0500)]
kvm_stat: Add RESET support for perf event ioctl

While running kvm_stat using tracepoint on ARM64 hardware (e.g. "kvm_stat
-1 -t"), the initial values of some kvm_userspace_exit counters were found
to be very suspecious. For instance the tracing tool showed that S390_TSCH
was called many times on ARM64 machine, which apparently was wrong.

This patch adds RESET ioctl support for perf monitoring. Before calling
ioctl to enable a perf event, this patch resets the counter first. With
this patch, the init counter values become correct on ARM64 hardware.

Example:

==== before patch ====
kvm_userspace_exit(S390_SIEIC)      1426         0
kvm_userspace_exit(S390_TSCH)       339         0

==== after patch ====
kvm_userspace_exit(S390_SIEIC)         0         0
kvm_userspace_exit(S390_TSCH)         0         0

Signed-off-by: Wei Huang <wei@redhat.com>
9 years agotarget-i386: Disable HLE and RTM on Haswell & Broadwell
Eduardo Habkost [Thu, 22 Jan 2015 19:22:54 +0000 (17:22 -0200)]
target-i386: Disable HLE and RTM on Haswell & Broadwell

All Haswell CPUs and some Broadwell CPUs were updated by Intel to have
the HLE and RTM features disabled. This will prevent
"-cpu Haswell,enforce" and "-cpu Broadwell,enforce" from running out of
the box on those CPUs.

Disable those features by default on Broadwell and Haswell CPU models,
starting on pc-*-2.3. Users who want to use those features can enable
them explicitly on the command-line.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agosparse: Fix build with sparse on .S files
Christian Borntraeger [Thu, 22 Jan 2015 09:53:46 +0000 (10:53 +0100)]
sparse: Fix build with sparse on .S files

rules.mak has a rule for .S files using CPP. This will result in
errors like
  CPP   s390-ccw/start.asm
 cc: error: unrecognized command line option '-Wbitwise'

Lets also redefine CPP in case of --enable-sparse.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoexec: fix madvise of NULL pointer
Paolo Bonzini [Wed, 21 Jan 2015 15:18:35 +0000 (16:18 +0100)]
exec: fix madvise of NULL pointer

Coverity flags this as "dereference after null check".  Not quite a
dereference, since it will just EFAULT, but still nice to fix.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years ago.travis.yml: Add "--enable-modules"
Paolo Bonzini [Fri, 23 Jan 2015 09:43:49 +0000 (10:43 +0100)]
.travis.yml: Add "--enable-modules"

We will change the default to "--enable-modules", let's cover it before
the switch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoapic: do not dereference pointer before it is checked for NULL
Paolo Bonzini [Tue, 20 Jan 2015 10:07:09 +0000 (11:07 +0100)]
apic: do not dereference pointer before it is checked for NULL

Right now you only get to apic_init_reset if you have an APIC
(do_cpu_init is reached only if CPU_INTERRUPT_INIT is set and
that only happens in hw/intc/apic.c).  However, this is wrong
because for example a port 92 or keyboard controller reset is
really an INIT, and that can happen also with no APIC.  So
keep the check and fix the error that Coverity reported.

Reported-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agokvm_stat: Print errno when syscall to perf_event_open() fails
Wei Huang [Wed, 21 Jan 2015 21:15:31 +0000 (16:15 -0500)]
kvm_stat: Print errno when syscall to perf_event_open() fails

kvm_stat uses syscall() to call perf_event_open(). If this function
call fails, the returned value is -1, which doesn't tell the details
of such failure (i.e. ENOSYS or EINVAL). This patch retrieves errno
and prints it when syscall() fails. The error message will look like
"Exception: perf_event_open failed, errno = 38".

Signed-off-by: Wei Huang <wei@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agokvm_stat: Update exit reasons to the latest defintion
Wei Huang [Wed, 21 Jan 2015 21:15:30 +0000 (16:15 -0500)]
kvm_stat: Update exit reasons to the latest defintion

This patch updates the exit reasons for x86_vmx, x86_svm, and userspace
to the latest definition.

Signed-off-by: Wei Huang <wei@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agokvm_stat: Add aarch64 support
Wei Huang [Wed, 21 Jan 2015 21:15:29 +0000 (16:15 -0500)]
kvm_stat: Add aarch64 support

This patch enables aarch64 support for kvm_stat. The platform detection
is based on OS uname.

Signed-off-by: Wei Huang <wei@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agohw: misc, add educational driver
Jiri Slaby [Wed, 21 Jan 2015 16:48:33 +0000 (17:48 +0100)]
hw: misc, add educational driver

I am using qemu for teaching the Linux kernel at our university. I
wrote a simple PCI device that can answer to writes/reads, generate
interrupts and perform DMA. As I am dragging it locally over 2 years,
I am sending it to you now.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
[Fix 32-bit compilation. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agovmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR*
Paolo Bonzini [Thu, 8 Jan 2015 09:18:59 +0000 (10:18 +0100)]
vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR*

Old users of VMSTATE_TIMER* are mechanically changed to VMSTATE_TIMER_PTR
variants.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoqemu-timer: introduce timer_deinit
Paolo Bonzini [Wed, 24 Dec 2014 09:57:04 +0000 (10:57 +0100)]
qemu-timer: introduce timer_deinit

In some cases, a timer was set to NULL so that we could check if it is
initialized.  Use the timer_list field instead, and add a timer_deinit
function that NULLs it.

It then makes sense that timer_del be a no-op (instead of a crasher) on
such a de-initialized timer.  It avoids the need to poke at the timerlist
field to check if the timers are initialized.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoqemu-timer: add timer_init and timer_init_ns/us/ms
Paolo Bonzini [Tue, 23 Dec 2014 20:40:55 +0000 (21:40 +0100)]
qemu-timer: add timer_init and timer_init_ns/us/ms

These functions for the main loop TimerListGroup will replace
timer_new and timer_new_ns/us/ms.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agotarget-i386: make xmm_regs 512-bit wide
Paolo Bonzini [Fri, 24 Oct 2014 07:50:21 +0000 (09:50 +0200)]
target-i386: make xmm_regs 512-bit wide

Right now, the AVX512 registers are split in many different fields:
xmm_regs for the low 128 bits of the first 16 registers, ymmh_regs
for the next 128 bits of the same first 16 registers, zmmh_regs
for the next 256 bits of the same first 16 registers, and finally
hi16_zmm_regs for the full 512 bits of the second 16 bit registers.

This makes it simple to move data in and out of the xsave region,
but would be a nightmare for a hypothetical TCG implementation and
leads to a proliferation of [XYZ]MM_[BWLSQD] macros.  Instead,
this patch marshals data manually from the xsave region to a single
32x512-bit array, simplifying the macro jungle and clarifying which
bits are in which vmstate subsection.

The migration format is unaffected.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agotarget-i386: use vmstate_offset_sub_array for AVX registers
Paolo Bonzini [Fri, 24 Oct 2014 08:18:38 +0000 (10:18 +0200)]
target-i386: use vmstate_offset_sub_array for AVX registers

After the next patch, each vmstate field will extract parts of a larger
(32x512-bit) array, so we cannot check the vmstate field against the
type of the array.

While changing this, change the macros to accept the index of the first
element (which will not be 0 for Hi16_ZMM_REGS) instead of the number
of elements (which is always CPU_NB_REGS).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agotests/multiboot: Add test for modules
Kevin Wolf [Thu, 15 Jan 2015 11:26:44 +0000 (12:26 +0100)]
tests/multiboot: Add test for modules

This test case is meant to detect corruptions of the Multiboot modules
as well as the multiboot modules list and the module command lines.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agomultiboot: Fix offset of bootloader name
Kevin Wolf [Thu, 15 Jan 2015 11:26:43 +0000 (12:26 +0100)]
multiboot: Fix offset of bootloader name

This fixes a bug introduced in commit 5eba5a66 ('Add bootloader name to
multiboot implementation').

The calculation of the bootloader name offset didn't consider space
occupied by module command lines, so some unlucky module got its command
line partially overwritten with a "qemu" string.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agotests/multiboot: Update reference output
Kevin Wolf [Thu, 15 Jan 2015 11:26:42 +0000 (12:26 +0100)]
tests/multiboot: Update reference output

The changes look okay (larger PCI hole, some rounding differences), so
just update the reference output of the test case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agopc: fix KVM features in pc-1.3 and earlier machine types
Paolo Bonzini [Wed, 14 Jan 2015 16:53:55 +0000 (17:53 +0100)]
pc: fix KVM features in pc-1.3 and earlier machine types

Due to a typo, instead of disabling KVM_FEATURE_PV_EOI (bit
6) these machine types are disabling bits 1 and 2, which are
KVM_FEATURE_NOP_IO_DELAY and KVM_FEATURE_MMU_OP.  Not a big deal
because they aren't very important and KVM_FEATURE_MMU_OP is
disabled anyway.  The worst part is actually that KVM_FEATURE_PV_EOI
is remaining enabled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 23 Jan 2015 18:25:30 +0000 (18:25 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches for 2.3

# gpg: Signature made Fri 23 Jan 2015 17:53:06 GMT using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  iotests: Lower 064's memory usage
  block: vhdx - force FileOffsetMB field to '0' for certain block states
  block: update string sizes for filename,backing_file,exact_filename
  block: mirror - change string allocation to 2-bytes
  block: remove unused variable in bdrv_commit
  block: qapi - move string allocation from stack to the heap
  block: vmdk - move string allocations from stack to the heap
  block: vmdk - make ret variable usage clear
  iotests: Add tests for more corruption cases
  qcow2: Add two more unalignment checks
  virtio-blk: Use blk_aio_ioctl
  virtio-blk: Pass req to virtio_blk_handle_scsi_req

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'mreitz/block' into queue-block
Kevin Wolf [Fri, 23 Jan 2015 17:51:47 +0000 (18:51 +0100)]
Merge remote-tracking branch 'mreitz/block' into queue-block

* mreitz/block:
  iotests: Lower 064's memory usage
  block: vhdx - force FileOffsetMB field to '0' for certain block states

9 years agoiotests: Lower 064's memory usage
Max Reitz [Fri, 23 Jan 2015 14:59:45 +0000 (09:59 -0500)]
iotests: Lower 064's memory usage

Test 064 reads a lot of data at once which currently results in qemu-io
having to allocate up to about 1 GB of memory (958 MB, to be exact).
This patch lowers that amount to 128 MB by making the test read smaller
chunks.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 1422025185-25229-1-git-send-email-mreitz@redhat.com

9 years agoblock: vhdx - force FileOffsetMB field to '0' for certain block states
Jeff Cody [Tue, 20 Jan 2015 21:01:43 +0000 (16:01 -0500)]
block: vhdx - force FileOffsetMB field to '0' for certain block states

The v1.0.0 spec calls out PAYLOAD_BLOCK_ZERO FileOffsetMB field as being
'reserved'.  In practice, this means that Hyper-V will fail to read a
disk image with PAYLOAD_BLOCK_ZERO block states with a FileOffsetMB
value other than 0.

The other states that indicate a block that is not there
(PAYLOAD_BLOCK_UNDEFINED, PAYLOAD_BLOCK_NOT_PRESENT,
 PAYLOAD_BLOCK_UNMAPPED) have multiple options for what FileOffsetMB may
be set to, and '0' is explicitly called out as an option.

For all the above states, we will also just set the FileOffsetMB value
to 0.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: a9fe92f53f07e6ab1693811e4312c0d1e958500b.1421787566.git.jcody@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
9 years agoblock: update string sizes for filename,backing_file,exact_filename
Jeff Cody [Thu, 22 Jan 2015 13:03:30 +0000 (08:03 -0500)]
block: update string sizes for filename,backing_file,exact_filename

The string field entries 'filename', 'backing_file', and
'exact_filename' in the BlockDriverState struct are defined as 1024
bytes.

However, many places that use these values accept a maximum of PATH_MAX
bytes, so we have a mixture of 1024 byte and PATH_MAX byte allocations.
This patch makes the BlockDriverStruct field string sizes match usage.

This patch also does a few fixes related to the size that needs to
happen now:

    * the block qapi driver is updated to use PATH_MAX bytes
    * the qcow and qcow2 drivers have an additional safety check
    * the block vvfat driver is updated to use PATH_MAX bytes
      for the size of backing_file, for systems where PATH_MAX is < 1024
      bytes.
    * qemu-img uses PATH_MAX rather than 1024.  These instances were not
      changed to be dynamically allocated, however, as the extra
      temporary 3K in stack usage for qemu-img does not seem worrisome.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: mirror - change string allocation to 2-bytes
Jeff Cody [Thu, 22 Jan 2015 13:03:29 +0000 (08:03 -0500)]
block: mirror - change string allocation to 2-bytes

The backing_filename string in mirror_run() is only used to check
for a NULL string, so we don't need to allocate 1024 bytes (or, later,
PATH_MAX bytes), when we only need to copy the first 2 characters.

We technically only need 1 byte, as we are just checking for NULL, but
since backing_filename[] is populated by bdrv_get_backing_filename(), a
string size of 1 will always only return '\0';

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: remove unused variable in bdrv_commit
Jeff Cody [Thu, 22 Jan 2015 13:03:28 +0000 (08:03 -0500)]
block: remove unused variable in bdrv_commit

As Stefan pointed out, the variable 'filename' in bdrv_commit is unused,
despite being maintained in previous patches.

With this patch, get rid of the variable for good.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: qapi - move string allocation from stack to the heap
Jeff Cody [Thu, 22 Jan 2015 13:03:27 +0000 (08:03 -0500)]
block: qapi - move string allocation from stack to the heap

Rather than declaring 'backing_filename2' on the stack in
bdrv_query_image_info(), dynamically allocate it on the heap.

Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: vmdk - move string allocations from stack to the heap
Jeff Cody [Thu, 22 Jan 2015 13:03:26 +0000 (08:03 -0500)]
block: vmdk - move string allocations from stack to the heap

Functions 'vmdk_parse_extents' and 'vmdk_create' allocate several
PATH_MAX sized arrays on the stack.  Make these dynamically allocated.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoblock: vmdk - make ret variable usage clear
Jeff Cody [Thu, 22 Jan 2015 13:03:25 +0000 (08:03 -0500)]
block: vmdk - make ret variable usage clear

Keep the variable 'ret' something that is returned by the function it is
defined in.  For the return value of 'sscanf', use a more meaningful
variable name.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoiotests: Add tests for more corruption cases
Max Reitz [Mon, 19 Jan 2015 20:49:04 +0000 (15:49 -0500)]
iotests: Add tests for more corruption cases

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoqcow2: Add two more unalignment checks
Max Reitz [Mon, 19 Jan 2015 20:49:03 +0000 (15:49 -0500)]
qcow2: Add two more unalignment checks

This adds checks for unaligned L2 table offsets and unaligned data
cluster offsets (actually the preallocated offsets for zero clusters) to
the zero cluster expansion function.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agovirtio-blk: Use blk_aio_ioctl
Fam Zheng [Tue, 20 Jan 2015 03:28:47 +0000 (11:28 +0800)]
virtio-blk: Use blk_aio_ioctl

Use the asynchronous interface of ioctl. This will not make the VM
unresponsive if the ioctl takes a long time.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agovirtio-blk: Pass req to virtio_blk_handle_scsi_req
Fam Zheng [Tue, 20 Jan 2015 03:28:46 +0000 (11:28 +0800)]
virtio-blk: Pass req to virtio_blk_handle_scsi_req

In preparation for calling blk_aio_ioctl. Also make the function static
as no other files need it.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/otubo/tags/pull-seccomp-20150123' into staging
Peter Maydell [Fri, 23 Jan 2015 13:24:17 +0000 (13:24 +0000)]
Merge remote-tracking branch 'remotes/otubo/tags/pull-seccomp-20150123' into staging

seccomp branch queue

# gpg: Signature made Fri 23 Jan 2015 13:11:05 GMT using RSA key ID 12F8BD2F
# gpg: Can't check signature: public key not found

* remotes/otubo/tags/pull-seccomp-20150123:
  seccomp: add mlockall to whitelist

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoseccomp: add mlockall to whitelist
Paolo Bonzini [Tue, 20 Jan 2015 13:32:33 +0000 (14:32 +0100)]
seccomp: add mlockall to whitelist

This is used by "-realtime mlock=on".

Signed-off-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20150122-1' into staging
Peter Maydell [Thu, 22 Jan 2015 18:57:36 +0000 (18:57 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20150122-1' into staging

b16: fix interrupt acknowledgement

# gpg: Signature made Thu 22 Jan 2015 11:38:29 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-audio-20150122-1:
  sb16: fix interrupt acknowledgement

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150122-1' into staging
Peter Maydell [Thu, 22 Jan 2015 17:41:59 +0000 (17:41 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150122-1' into staging

input: misc fixes.

# gpg: Signature made Thu 22 Jan 2015 11:27:37 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-input-20150122-1:
  hw/input/hid.c Fix capslock hid code
  hid: handle full ptr queues in post_load
  input: improve docs for input-send-event qmp command

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/spice/tags/pull-spice-20150122-1' into staging
Peter Maydell [Thu, 22 Jan 2015 13:56:11 +0000 (13:56 +0000)]
Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20150122-1' into staging

spice: fix coverity defect, add unix address support

# gpg: Signature made Thu 22 Jan 2015 11:17:24 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-20150122-1:
  spice: fix coverity reported defect in display code
  spice: add unix address support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20150122-1' into staging
Peter Maydell [Thu, 22 Jan 2015 12:14:19 +0000 (12:14 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20150122-1' into staging

vnc: add support for multiple vnc displays

# gpg: Signature made Thu 22 Jan 2015 11:00:54 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vnc-20150122-1:
  monitor: add vnc websockets
  monitor: add query-vnc-servers command
  vnc: factor out qmp_query_client_list
  vnc: track & limit connections
  vnc: update docs/multiseat.txt
  vnc: allow binding servers to qemu consoles
  vnc: switch to QemuOpts, allow multiple servers
  vnc: add display id to acl names
  vnc: remove unused DisplayState parameter, add id instead.
  vnc: remove vnc_display global

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/input/hid.c Fix capslock hid code
Dinar Valeev [Wed, 21 Jan 2015 22:48:41 +0000 (23:48 +0100)]
hw/input/hid.c Fix capslock hid code

When ever USB keyboard is used, e.g. '-usbdevice keyboard' pressing
caps lock key send 0x32 hid code, which is treated as backslash.
Instead it should be 0x39 code. This affects sending uppercase keys,
as they typed whith caps lock active.

While on x86 this can be workarounded by using ps/2 protocol. On
Power it is crusial as we don't have anything else than USB.

This is fixes guest automation tasts over vnc.

Signed-off-by: Dinar Valeev <dvaleev@suse.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agohid: handle full ptr queues in post_load
Gerd Hoffmann [Thu, 27 Nov 2014 09:02:35 +0000 (10:02 +0100)]
hid: handle full ptr queues in post_load

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
9 years agoinput: improve docs for input-send-event qmp command
Gerd Hoffmann [Fri, 21 Nov 2014 09:25:57 +0000 (10:25 +0100)]
input: improve docs for input-send-event qmp command

Text partly suggested by Markus Armbruster <armbru@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging
Peter Maydell [Thu, 22 Jan 2015 11:16:20 +0000 (11:16 +0000)]
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging

qemu-sparc update

# gpg: Signature made Wed 21 Jan 2015 16:56:31 GMT using RSA key ID AE0F321F
# gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>"

* remotes/mcayland/tags/qemu-sparc-signed:
  disas/sparc: Remove unused data sparc_opcode_archs[]
  target-sparc: Mark gen_load_trap_state_at_tl() as !CONFIG_USER_ONLY
  target-sparc: is_translating_asi() is TARGET_SPARC64 only
  target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64 only
  target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agomonitor: add vnc websockets
Gerd Hoffmann [Wed, 10 Dec 2014 08:49:39 +0000 (09:49 +0100)]
monitor: add vnc websockets

Add websockets bool to VncBasicInfo, report websocket server sockets,
flag websocket client connections.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agomonitor: add query-vnc-servers command
Gerd Hoffmann [Wed, 17 Dec 2014 14:49:44 +0000 (15:49 +0100)]
monitor: add query-vnc-servers command

Add new query vnc qmp command, for the lack of better ideas just name it
"query-vnc-servers".  Changes over query-vnc:

 * It returns a list of vnc servers, so multiple vnc server instances
   are covered.
 * Each vnc server returns a list of server sockets.  Followup patch
   will use that to also report websockets.  In case we add support for
   multiple server sockets server sockets (to better support ipv4+ipv6
   dualstack) we can add them to the list too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovnc: factor out qmp_query_client_list
Gerd Hoffmann [Tue, 9 Dec 2014 14:27:39 +0000 (15:27 +0100)]
vnc: factor out qmp_query_client_list

so we can reuse it for the new vnc query command.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovnc: track & limit connections
Gerd Hoffmann [Thu, 2 Oct 2014 10:09:34 +0000 (12:09 +0200)]
vnc: track & limit connections

Also track the number of connections in "connecting" and "shared" state
(in addition to the "exclusive" state).  Apply a configurable limit to
these connections.

The logic to apply the limit to connections in "shared" state is pretty
simple:  When the limit is reached no new connections are allowed.

The logic to apply the limit to connections in "connecting" state (this
is the state you are in *before* successful authentication) is
slightly different:  A new connect kicks out the oldest client which is
still in "connecting" state.  This avoids a easy DoS by unauthenticated
users by simply opening connections until the limit is reached.

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovnc: update docs/multiseat.txt
Gerd Hoffmann [Thu, 2 Oct 2014 13:53:37 +0000 (15:53 +0200)]
vnc: update docs/multiseat.txt

vnc joins the party ;)
Also some s/head/seat/ to clarify.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovnc: allow binding servers to qemu consoles
Gerd Hoffmann [Thu, 18 Sep 2014 10:54:49 +0000 (12:54 +0200)]
vnc: allow binding servers to qemu consoles

This patch adds a display= parameter to the vnc options.  This allows to
bind a vnc server instance to a specific display, allowing to create a
multiseat setup with a vnc server for each seat.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovnc: switch to QemuOpts, allow multiple servers
Gerd Hoffmann [Tue, 16 Sep 2014 10:33:03 +0000 (12:33 +0200)]
vnc: switch to QemuOpts, allow multiple servers

This patch switches vnc over to QemuOpts, and it (more or less
as side effect) allows multiple vnc server instances.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovnc: add display id to acl names
Gerd Hoffmann [Tue, 21 Oct 2014 12:50:42 +0000 (14:50 +0200)]
vnc: add display id to acl names

In case the display id is "default" (which is the one you get if you
don't explicitly assign one) we keep the old name scheme, without
display, for backward compatibility reasons.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
9 years agovnc: remove unused DisplayState parameter, add id instead.
Gerd Hoffmann [Tue, 29 Jul 2014 10:24:55 +0000 (12:24 +0200)]
vnc: remove unused DisplayState parameter, add id instead.

DisplayState isn't used anywhere, drop it.  Add the vnc server ID as
parameter instead, so it is possible to specify the server instance.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
9 years agovnc: remove vnc_display global
Gerd Hoffmann [Tue, 29 Jul 2014 10:14:08 +0000 (12:14 +0200)]
vnc: remove vnc_display global

Replace with a vnc_displays list, so we can have multiple vnc server
instances.  Add vnc_server_find function to lookup a display by id.
With no id supplied return the first vnc server, for backward
compatibility reasons.

It is not possible (yet) to actually create multiple vnc server
instances.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
9 years agospice: fix coverity reported defect in display code
Gerd Hoffmann [Thu, 15 Jan 2015 11:06:16 +0000 (12:06 +0100)]
spice: fix coverity reported defect in display code

Report:

1. Condition surface, taking false branch
406    if (surface && ssd->surface &&
407        surface_width(surface) == pixman_image_get_width(ssd->surface) &&
408        surface_height(surface) == pixman_image_get_height(ssd->surface)) {
409        /* no-resize fast path: just swap backing store */
...

10. alias_transfer: Assigning: ssd->ds = surface.
440    ssd->ds = surface;

11. var_deref_op: Dereferencing null pointer ssd->ds.
CID 1264334 (#1 of 1): Dereference after null check (FORWARD_NULL)
441    ssd->surface = pixman_image_ref(ssd->ds->image);

Fix:

Move code block dereferencing ssd->ds into the already existing
if (ssd->ds) { ... } block.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agospice: add unix address support
Marc-André Lureau [Tue, 13 Jan 2015 16:57:51 +0000 (17:57 +0100)]
spice: add unix address support

Teach qemu to set up a Spice server with a UNIX socket using the
following arguments -spice unix,addr=path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agosb16: fix interrupt acknowledgement
Paolo Bonzini [Tue, 20 Jan 2015 16:23:48 +0000 (17:23 +0100)]
sb16: fix interrupt acknowledgement

SoundBlaster 16 emulation is very broken and consumes a lot of CPU, but a
small fix was suggested offlist and it is enough to fix some games.  I
got Epic Pinball to work with the "SoundBlaster Clone" option.

The processing of the interrupt register is wrong due to two missing
"not"s.  This causes the interrupt flag to remain set even after the
Acknowledge ports have been read (0x0e and 0x0f).

The line was introduced by commit 85571bc (audio merge (malc), 2004-11-07),
but the code might have been broken before because I did not look closely
at the huge patches from 10 years ago.

Reported-by: Joshua Bair <j_bair@bellsouth.net>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agodisas/sparc: Remove unused data sparc_opcode_archs[]
Peter Maydell [Tue, 23 Dec 2014 22:11:21 +0000 (22:11 +0000)]
disas/sparc: Remove unused data sparc_opcode_archs[]

Remove sparc_opcode_archs and the macros which use it, because we don't
use them in QEMU and they provoke clang warnings:

disas/sparc.c:307:39: warning: unused variable 'sparc_opcode_archs' [-Wunused-const-variable]
static const struct sparc_opcode_arch sparc_opcode_archs[] =
                                      ^

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
9 years agotarget-sparc: Mark gen_load_trap_state_at_tl() as !CONFIG_USER_ONLY
Peter Maydell [Tue, 23 Dec 2014 22:11:20 +0000 (22:11 +0000)]
target-sparc: Mark gen_load_trap_state_at_tl() as !CONFIG_USER_ONLY

The function gen_load_trap_state_at_tl() is only used in the softmmu
configs; wrap it in #ifndef CONFIG_USER_ONLY to avoid clang compiler
warnings in linux-user builds.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
9 years agotarget-sparc: is_translating_asi() is TARGET_SPARC64 only
Peter Maydell [Tue, 23 Dec 2014 22:11:19 +0000 (22:11 +0000)]
target-sparc: is_translating_asi() is TARGET_SPARC64 only

Move the is_translating_asi() inside the TARGET_SPARC64 ifdef (and remove
the unimplemented 32-bit codepath), as it is only called from TARGET_SPARC64
code. This fixes a clang 3.4 unused-function warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
9 years agotarget-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64 only
Peter Maydell [Tue, 23 Dec 2014 22:11:18 +0000 (22:11 +0000)]
target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64 only

The address_mask() and asi_address_mask() functions are only used in
TARGET_SPARC64 configs, so guard with ifdefs to avoid warnings about
unused functions in 32-bit builds.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
9 years agotarget-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc
Peter Maydell [Tue, 23 Dec 2014 22:11:17 +0000 (22:11 +0000)]
target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc

The functions gen_op_addi_cc() and gen_op_subi_cc() are unused; remove them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>