sdk/emulator/qemu.git
10 years agoacpi-build: fix misaligned access
Michael S. Tsirkin [Wed, 12 Mar 2014 14:13:58 +0000 (16:13 +0200)]
acpi-build: fix misaligned access

clang build reported a misaligned access:
    runtime error: store to misaligned address 0x2b5aa47dfb19 for type
    'uint16_t' (aka 'unsigned short'), which requires 2 byte alignment
    0x2b5aa47dfb19: note: pointer points here
     45 53 54  0b ff ff 5b 80 50 45 4f  52 01 50 45 53 54 01 5b  81 0b 50
    45 4f 52 01 50  45 50 54 08 14

fix this up

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-test: update expected SSDT files
Michael S. Tsirkin [Mon, 10 Mar 2014 19:13:59 +0000 (21:13 +0200)]
acpi-test: update expected SSDT files

SSDT doesn't have _SUN for non hotpluggable slots
anymore.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-build: don't access unaligned addresses
Michael S. Tsirkin [Mon, 10 Mar 2014 19:30:16 +0000 (21:30 +0200)]
acpi-build: don't access unaligned addresses

casting an unaligned address to e.g.
uint32_t can trigger undefined behaviour in C.
Replace cast + assignment with memcpy.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoq35: Correct typo BRDIGE -> BRIDGE
BALATON Zoltan [Fri, 28 Feb 2014 10:28:03 +0000 (11:28 +0100)]
q35: Correct typo BRDIGE -> BRIDGE

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoconfigure: don't modify .status on error
Michael S. Tsirkin [Sun, 9 Mar 2014 15:37:49 +0000 (17:37 +0200)]
configure: don't modify .status on error

./configure --help
make

will try to re-run configure with --help
which isn't what was intended.

The reason is that config.status was written
even on configure error.
Defer writing config.status until configure
has completed successfully.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10 years agopc: avoid duplicate names for ROM MRs
Michael S. Tsirkin [Thu, 6 Mar 2014 12:57:09 +0000 (14:57 +0200)]
pc: avoid duplicate names for ROM MRs

Since
commit 04920fc0faa4760f9c4fc0e73b992b768099be70
    loader: store FW CFG ROM files in RAM
RAM MRs including ROM files in FW CFGs are created
and named using the file basename.

This becomes problematic if these names are
supplied by user, since the basename might not
be unique.

There are two cases we care about:
- option-rom flag.
- option ROM for devices. This triggers e.g. when
  using rombar=0.

At the moment we get an assert. E.g
qemu -option-rom /usr/share/ipxe/8086100e.rom -option-rom
/usr/share/ipxe.efi/8086100e.rom
RAMBlock "/rom@genroms/8086100e.rom" already registered, abort!

This is a regression from 1.6.

For now let's keep it simple and just avoid creating the
MRs in case of option ROMs.

when using 1.7 machine types, enable
option ROMs in RAM to match that version.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoloader: rename in_ram/has_mr
Michael S. Tsirkin [Sun, 9 Mar 2014 16:42:06 +0000 (18:42 +0200)]
loader: rename in_ram/has_mr

we put copy of ROMs in MR for migration.
but the name rom_in_ram makes one think we
load it in guest RAM.
Rename has_mr to make intent clearer.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqemu: x86: ignore ioapic polarity
Gabriel L. Somlo [Fri, 28 Feb 2014 18:57:19 +0000 (13:57 -0500)]
qemu: x86: ignore ioapic polarity

Both QEMU and KVM have already accumulated a significant number of
optimizations based on the hard-coded assumption that ioapic polarity
will always use the ActiveHigh convention, where the logical and
physical states of level-triggered irq lines always match (i.e.,
active(asserted) == high == 1, inactive == low == 0). QEMU guests
are expected to follow directions given via ACPI and configure the
ioapic with polarity 0 (ActiveHigh). However, even when misbehaving
guests (e.g. OS X <= 10.9) set the ioapic polarity to 1 (ActiveLow),
QEMU will still use the ActiveHigh signaling convention when
interfacing with the emulated ioapic.

This patch modifies the emulated ioapic to completely ignore polarity
as set by the guest OS, enabling misbehaving guests to work alongside
those which comply with the ActiveHigh polarity specified by QEMU's
ACPI tables.

Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopckbd: return 'keyboard enabled' on read input port command
Hervé Poussineau [Tue, 11 Feb 2014 22:46:03 +0000 (23:46 +0100)]
pckbd: return 'keyboard enabled' on read input port command

Bit 7 of Input Port is the keyboard inhibit switch.
0 means keyboard inhibited, while 1 means keyboard enabled.

Incidentaly, this also fixes an error encountered while booting
an Award BIOS: "Keyboard is locked out - Unlock the key".

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopam: partly fix write-only mode
Hervé Poussineau [Tue, 11 Feb 2014 22:46:02 +0000 (23:46 +0100)]
pam: partly fix write-only mode

In write-only mode, writes are forwarded to RAM, while reads should not be
handled (ie should return 0xff).
Assume that in this mode, no read access is ever done, as they shouldn't
give any sensible result.

So, in write-only mode, alias PAM region to RAM, instead of PCI memory
(which can even be mapped to some device!)

This fixes Award BIOS, which use this mode to shadow system BIOS and video BIOS.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-test: issue errors instead of warnings when possible
Marcel Apfelbaum [Thu, 27 Feb 2014 14:17:32 +0000 (16:17 +0200)]
acpi-test: issue errors instead of warnings when possible

If the expected (offline) acpi tables loaded correctly,
it is safe to assume the iasl installation is OK and
issue an error if the actual tables failed to load.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-test: retain both asl and aml files on failure
Marcel Apfelbaum [Thu, 27 Feb 2014 14:17:31 +0000 (16:17 +0200)]
acpi-test: retain both asl and aml files on failure

Updated the error message while at it.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMAINTAINERS: drop an out of date address
Michael S. Tsirkin [Wed, 19 Feb 2014 13:46:07 +0000 (15:46 +0200)]
MAINTAINERS: drop an out of date address

Gleb's address seems to be out of date.  Since it stayed like that for a
while now, I'm guessing he's no longer interested in getting mail.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoAdd a 'name' parameter to qemu_thread_create
Dr. David Alan Gilbert [Thu, 30 Jan 2014 10:20:32 +0000 (10:20 +0000)]
Add a 'name' parameter to qemu_thread_create

If enabled, set the thread name at creation (on GNU systems with
  pthread_set_np)
Fix up all the callers with a thread name

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoAdd 'debug-threads' suboption to --name
Dr. David Alan Gilbert [Thu, 30 Jan 2014 10:20:31 +0000 (10:20 +0000)]
Add 'debug-threads' suboption to --name

Add flag storage to qemu-thread-* to store the namethreads flag

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoRework --name to use QemuOpts
Dr. David Alan Gilbert [Thu, 30 Jan 2014 10:20:30 +0000 (10:20 +0000)]
Rework --name to use QemuOpts

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoPCIE: fix regression with coldplugged multifunction device
Igor Mammedov [Mon, 17 Feb 2014 14:00:06 +0000 (15:00 +0100)]
PCIE: fix regression with coldplugged multifunction device

PCIE is causing asserts each time a multifunction device is added
on command line (coldplug).

This is caused by
commit a66e657e18cd9b70e9f57ae5512c07faf2bc508f
    pci/pcie: convert PCIE hotplug to use hotplug-handler API
QEMU abort is caused by misplaced assertion, which should
be checked only when device is hotplugged.

Reference to regression report:
 http://www.mail-archive.com/qemu-devel@nongnu.org/msg216226.html

Fixes: a66e657e18cd9b70e9f57ae5512c07faf2bc508f
Reported-By: Nigel Kukard <nkukard+qemu@lbsd.net>
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>
10 years agomemory_region_present: return false if address is not found in child MemoryRegion
Igor Mammedov [Thu, 6 Feb 2014 10:24:33 +0000 (11:24 +0100)]
memory_region_present: return false if address is not found in child MemoryRegion

Windows XP shows COM2 port as non functional in
"Device Manager" although no COM2 port backing device
is present in QEMU.

This regression is really due to
3bb28b7208b349e7a1b326e3c6ef9efac1d462bf?
    memory: Provide separate handling of unassigned io ports accesses

That is caused by the fact that QEMU reports to
OSPM that device is present by setting 5th bit in
PII4XPM.pci_conf[0x67] register when COM2 doesn't
exist.

It happens due to memory_region_present(io_as, 0x2f8)
returning false positive since 0x2f8 address eventually
translates into catchall io_as address space.

Fix memory_region_present(parent, addr) by returning
true only if addr maps into a MemoryRegion within
parent (excluding parent itself), to match its
doc comment.

While at it fix copy/paste error in
memory_region_present() doc comment.

Note: this is a temporary hack: we really need better handling for
unassigned regions, we should avoid fallback regions since they are bad
for performance (breaking radix tree assumption that the data structure
is sparsely populated); for memory we need to fix this to implement PCI
master abort properly, anyway.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
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>
10 years agovirtio-net: remove function calls from assert
Joel Stanley [Tue, 11 Feb 2014 00:12:02 +0000 (10:42 +1030)]
virtio-net: remove function calls from assert

peer_{de,at}tach were called from inside assert().
We don't support building without NDEBUG but it's not tidy.
Rearrange to attach peer outside assert calls.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-test-data: update expected files
Michael S. Tsirkin [Mon, 17 Feb 2014 04:42:11 +0000 (06:42 +0200)]
acpi-test-data: update expected files

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-build: append description for non-hotplug
Michael S. Tsirkin [Tue, 4 Feb 2014 15:43:47 +0000 (17:43 +0200)]
acpi-build: append description for non-hotplug

As reported in
http://article.gmane.org/gmane.comp.emulators.qemu/253987
Mac OSX actually requires describing all occupied slots
in ACPI - even if hotplug isn't enabled.

I didn't expect this so I dropped description of all
non hotpluggable slots from ACPI.
As a result: before
commit 99fd437dee468609de8218f0eb3b16621fb6a9c9 (enable
hotplug for pci bridges), PCI cards show up in the "device tree" of OS X
(System Information). E.g., on MountainLion users have:

Hardware -> PCI Cards:

  Card          Type                 Driver Installed  Slot
 *ethernet      Ethernet Controller  Yes               PCI Slot 2
  pci8086,2934  USB UHC              Yes               PCI Slot 29

  ethernet:
    Type:                 Ethernet Controller
    Driver Installed:     Yes
    MSI:                  No
    Bus:                  PCI
    Slot                  PCI Slot 2
    Vendor ID:            0x8086
    Device ID:            0x100e
    Subsystem Vendor ID:  0x1af4
    Subsystem ID:         0x1100
    Revision ID:          0x0003

Hardware -> Ethernet Cards

  ethernet:
    Type:                 Ethernet Controller
    Bus:                  PCI
    Slot                  PCI Slot 2
    Vendor ID:            0x8086
    Device ID:            0x100e
    Subsystem Vendor ID:  0x1af4
    Subsystem ID:         0x1100
    Revision ID:          0x0003
    BSD name:             en0
    Kext name:            AppleIntel8254XEthernet.kext
    Location:             /System/Library/Extensions/...
    Version:              3.1.1b1

After commit 99fd437dee468609de8218f0eb3b16621fb6a9c9, users get:

Hardware -> PCI Cards:

  This computer doesn't contain any PCI cards. If you installed PCI
  cards, make sure they're properly installed.

Hardware -> Ethernet Cards

  ethernet:
    Type:                 Ethernet Controller
    Bus:                  PCI
    Vendor ID:            0x8086
    Device ID:            0x100e
    Subsystem Vendor ID:  0x1af4
    Subsystem ID:         0x1100
    Revision ID:          0x0003
    BSD name:             en0
    Kext name:            AppleIntel8254XEthernet.kext
    Location:             /System/Library/Extensions/...
    Version:              3.1.1b1

Ethernet still works, but it's not showing up on the PCI bus, and it
no longer thinks it's plugged in to slot #2, as it used to before the
change.

To fix, append description for all occupied non hotpluggable PCI slots.

One need to be careful when doing this: VGA devices
are now described in SSDT, so we need to drop description from DSDT.
And ISA devices are used in DSDT so drop them from SSDT.

Reported-by: Gabriel L. Somlo <gsomlo@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Also update generated dsdt and pcihp hex dump files.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/kvaneesh/for-upstream' into staging
Peter Maydell [Sat, 8 Mar 2014 12:38:43 +0000 (12:38 +0000)]
Merge remote-tracking branch 'remotes/kvaneesh/for-upstream' into staging

* remotes/kvaneesh/for-upstream:
  hw/9pfs: Include virtio-9p-device.o in build
  hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation
  hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()
  hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:"
  fsdev: Fix overrun after readlink() fills buffer completely

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Sat, 8 Mar 2014 12:17:17 +0000 (12:17 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches

# gpg: Signature made Fri 07 Mar 2014 13:30:04 GMT using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  block: qemu-iotests 085 - live snapshots tests
  hw/ide/ahci.h: Avoid shifting left into sign bit
  block: Fix error path segfault in bdrv_open()
  qemu-iotests: Test a few blockdev-add error cases
  blockdev: Fix NULL pointer dereference in blockdev-add
  blockdev: Fail blockdev-add with encrypted images
  block/raw-win32: Strip "file:" prefix on creation
  block/raw-win32: Implement bdrv_parse_filename()
  block/raw-posix: Strip "file:" prefix on creation
  block/raw-posix: Implement bdrv_parse_filename()
  block: Keep "filename" option after parsing
  block: mirror - remove code cruft that has no function
  block: make bdrv_swap rebuild the bs graph node list field.
  block: Fix bs->request_alignment assertion for bs->sg=1
  iscsi: Use bs->sg for everything else than disks
  qemu-iotests: Test progress output for conversion
  qemu-img convert: Fix progress output
  gluster: Remove unused defines and header include
  gluster: Change licence to GPLv2+

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agobuild: Fix installation of target-dependent files
Lluís Vilanova [Mon, 20 Jan 2014 11:21:54 +0000 (12:21 +0100)]
build: Fix installation of target-dependent files

Pass all the relevant sub-directory make variables.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20140120112153.5685.30949.stgit@fimbulvetr.bsc.es

10 years agoxenfb: Fix graphic_console_init() build failure
Andreas Färber [Fri, 7 Mar 2014 21:42:08 +0000 (22:42 +0100)]
xenfb: Fix graphic_console_init() build failure

In commit 5643706a095044d75df1c0588aac553a595b972b (console: add head
to index to qemu consoles.) graphic_console_init() was extended to take
an additional argument, but xenfb was not updated accordingly. Fix it.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1394228528-31625-1-git-send-email-afaerber@suse.de

10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-4' into staging
Peter Maydell [Fri, 7 Mar 2014 18:29:32 +0000 (18:29 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-4' into staging

Input handling rewrite.
SDL2 support.

# gpg: Signature made Wed 05 Mar 2014 11:16:08 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-4: (38 commits)
  ui/sdl2 : initial port to SDL 2.0 (v2.0)
  console: add QemuUIInfo
  console: add head to index to qemu consoles.
  input: remove index_from_keycode (no users)
  input: move do_mouse_set to new core
  input: move qmp_query_mice to new core
  input: add input_mouse_mode tracepoint
  input: move mouse mode notifier to new core
  input-legacy: remove kbd_mouse_event
  input-legacy: remove kbd_mouse_is_absolute
  input-legacy: remove kbd_mouse_has_absolute
  input-legacy: remove kbd_put_keycode
  input: trace events
  input: mouse: switch cocoa ui to new core
  input: keyboard: switch cocoa ui to new core
  input: mouse: switch monitor to new core
  input: mouse: switch spice ui to new core
  input: mouse: switch vnc ui to new core
  input: mouse: switch sdl ui to new core
  input: mouse: switch gtk ui to new core
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging
Peter Maydell [Fri, 7 Mar 2014 16:36:37 +0000 (16:36 +0000)]
Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging

Patch queue for ppc - 2014-03-05

This pull request includes:

  - VSX emulation support
  - book3s pr/hv selection
  - some bug fixes
  - qdev stable numbering
  - eTSEC emulation

# gpg: Signature made Wed 05 Mar 2014 02:14:19 GMT using RSA key ID 03FEDC60
# gpg: Can't check signature: public key not found

* remotes/agraf/tags/signed-ppc-for-upstream: (130 commits)
  target-ppc: spapr: e500: fix to use cpu_dt_id
  target-ppc: add PowerPCCPU::cpu_dt_id
  target-ppc: Introduce hypervisor call H_GET_TCE
  target-ppc: Update ppc_hash64_store_hpte to support updating in-kernel htab
  target-ppc: Change the hpte store API
  target-ppc: Fix page table lookup with kvm enabled
  target-ppc: Fix htab_mask calculation
  target-ppc: Use Additional Temporary in stqcx Case
  target-ppc: Fix Compiler Warnings Due to 64-Bit Constants Declared as UL
  PPC: sPAPR: Only use getpagesize() when we run with kvm
  target-ppc/translate.c: Use ULL suffix for 64 bit constants
  spapr-vlan: flush queue whenever can_receive can go from false to true
  target-ppc: Altivec 2.07: Vector Permute and Exclusive OR
  target-ppc: Altivec 2.07: Vector SHA Sigma Instructions
  target-ppc: Altivec 2.07: AES Instructions
  target-ppc: Altivec 2.07: Binary Coded Decimal Instructions
  target-ppc: Altivec 2.07: Vector Polynomial Multiply Sum
  target-ppc: Altivec 2.07: Vector Gather Bits by Bytes
  target-ppc: Altivec 2.07: Doubleword Compares
  target-ppc: Altivec 2.07: vbpermq Instruction
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/virtio-ccw-20140305' into staging
Peter Maydell [Fri, 7 Mar 2014 15:58:27 +0000 (15:58 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/virtio-ccw-20140305' into staging

One patch introducing support for adapter interrupts in virtio-ccw.

This improves performance for those guests that issue the new
CCW_CMD_SET_IND_ADAPTER channel command.

# gpg: Signature made Wed 05 Mar 2014 08:48:18 GMT using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/virtio-ccw-20140305:
  s390x/virtio-ccw: Adapter interrupt support.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoblock: qemu-iotests 085 - live snapshots tests
Jeff Cody [Sat, 1 Mar 2014 02:08:11 +0000 (21:08 -0500)]
block: qemu-iotests 085 - live snapshots tests

This adds tests for live snapshots, both through the single
snapshot command, and the transaction group snapshot command.

The snapshots are done through the QMP interface, using the
following commands for snapshots:

Single snapshot:
{ 'execute': 'blockdev-snapshot-sync', 'arguments':
             { 'device': 'virtio0', 'snapshot-file':'...',
               'format': 'qcow2' } }"

Group snapshot:
{ 'execute': 'transaction', 'arguments':
              {'actions': [
                  { 'type': 'blockdev-snapshot-sync', 'data' :
                    { 'device': 'virtio0', 'snapshot-file': '...' } },
                  { 'type': 'blockdev-snapshot-sync', 'data' :
                    { 'device': 'virtio1', 'snapshot-file': '...' } } ]
             } }

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agohw/ide/ahci.h: Avoid shifting left into sign bit
Peter Maydell [Fri, 21 Feb 2014 14:03:01 +0000 (14:03 +0000)]
hw/ide/ahci.h: Avoid shifting left into sign bit

Add 'U' suffixes to avoid undefined behaviour shifting left into
the signed bit of a signed integer type. Clang's sanitizer will
warn about this:

 hw/ide/ahci.c:1210:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoconfigure: Always build with -fno-common
Peter Maydell [Wed, 26 Feb 2014 21:53:30 +0000 (21:53 +0000)]
configure: Always build with -fno-common

MacOSX doesn't pull .o files from .a archives if the symbol that it
requires is one which the .o file defines as a common symbol.
(Common symbols are those declared without "extern"; the linker
will merge together common symbols with the same name, so
redeclaring the same variable in two compilation units results in
them referring to the same symbol rather than a compilation error).

This MacOSX difference from traditional linker behaviour means that
"make check" produces link errors:

Undefined symbols for architecture x86_64:
  "_cur_mon", referenced from:
      _error_vprintf in libqemuutil.a(qemu-error.o)
      _error_printf in libqemuutil.a(qemu-error.o)
      _error_printf_unless_qmp in libqemuutil.a(qemu-error.o)
      _error_print_loc in libqemuutil.a(qemu-error.o)
      _error_report in libqemuutil.a(qemu-error.o)
ld: symbol(s) not found for architecture x86_64

in this case because "cur_mon" is a common symbol in
libqemustub.a(mon-set-error.o).

In QEMU we don't make any use at all of the common symbol
functionality, so we can avoid this problem entirely simply
by compiling with -fno-common. Enable this option for all
builds, not just MacOSX, so that if we ever inadvertently
introduce multiple definitions of some variable that will
be immediately spotted as a build error rather than only
breaking the MacOSX build.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 1393451610-24617-1-git-send-email-peter.maydell@linaro.org

10 years agoconfigure: Make C++ test work with --enable-werror
Peter Maydell [Tue, 25 Feb 2014 18:27:49 +0000 (18:27 +0000)]
configure: Make C++ test work with --enable-werror

gcc's C++ compiler complains about being passed some -W options
which make sense for C but not for C++. This means we mustn't try
a C++ compile with QEMU_CFLAGS, but only with a filtered version
that removes the offending options. This filtering was already being
done for uses of C++ in the build itself, but was omitted for the
"does C++ work?" configure test. This only showed up when doing
builds which explicitly enabled -Werror with --enable-werror,
because the "do the compilers work" tests were mistakenly placed
above the "default werror based on whether compiling from git" code.
Another error in this category is that clang warns if you ask it to
compile C++ code from a file named "foo.c". Further, because we
were running do_cc in a subshell in the condition part of an "if",
the error_exit inside do_compiler wouldn't terminate configure and
we would plunge on regardless. Fix this complex of errors:

1. Move the default-werror code up so that there are no invocations
of compile_object and friends between it and the point where we
set $werror explicitly based on the --enable-werror command line
option.

2. Provide a mechanism for filtering QEMU_CFLAGS to create
QEMU_CXXFLAGS, and use it for the test we run here.

3. Provide a do_cxx function to run a test with the C++ compiler
rather than doing cute tricks with subshells and do_cc.

4. Use a new temporary file TMPCXX for the C++ program fragment.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1393352869-22257-1-git-send-email-peter.maydell@linaro.org
Tested-by: Andreas Färber <afaerber@suse.de>
10 years agoblock: Fix error path segfault in bdrv_open()
Kevin Wolf [Thu, 6 Mar 2014 15:34:46 +0000 (16:34 +0100)]
block: Fix error path segfault in bdrv_open()

Using an invalid option for a block device that is opened with
BDRV_O_PROTOCOL led to drv = NULL, and when trying to include the driver
name in the error message, qemu dereferenced it:

    $ x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/test.qcow2,file.foo=bar
    Segmentation fault (core dumped)

With this patch applied, the expected error message is printed:

    $ x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/test.qcow2,file.foo=bar
    qemu-system-x86_64: -drive file=/tmp/test.qcow2,file.foo=bar: could
    not open disk image /tmp/test.qcow2: Block protocol 'file' doesn't
    support the option 'foo'

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
10 years agoqemu-iotests: Test a few blockdev-add error cases
Kevin Wolf [Thu, 6 Mar 2014 14:52:14 +0000 (15:52 +0100)]
qemu-iotests: Test a few blockdev-add error cases

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
10 years agoblockdev: Fix NULL pointer dereference in blockdev-add
Kevin Wolf [Thu, 6 Mar 2014 14:47:32 +0000 (15:47 +0100)]
blockdev: Fix NULL pointer dereference in blockdev-add

If aio=native, we check that cache.direct is set as well. If however
cache wasn't specified at all, qemu just segfaulted.

The old condition didn't make any sense anyway because it effectively
only checked for the default cache mode case, but not for an explicitly
set cache.direct=off mode.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblockdev: Fail blockdev-add with encrypted images
Kevin Wolf [Thu, 6 Mar 2014 14:43:42 +0000 (15:43 +0100)]
blockdev: Fail blockdev-add with encrypted images

Encrypted images need a password before they can be used, and we don't
want blockdev-add to create BDSes that aren't fully initialised. So for
now simply forbid encrypted images; we can come back to it later if we
need the functionality.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock/raw-win32: Strip "file:" prefix on creation
Max Reitz [Wed, 5 Mar 2014 21:41:40 +0000 (22:41 +0100)]
block/raw-win32: Strip "file:" prefix on creation

The bdrv_create() implementation of the block/raw-win32 "file" protocol
driver should strip the "file:" prefix from filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/raw-win32: Implement bdrv_parse_filename()
Max Reitz [Wed, 5 Mar 2014 21:41:39 +0000 (22:41 +0100)]
block/raw-win32: Implement bdrv_parse_filename()

The "file" protocol driver should strip the "file:" prefix from
filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/raw-posix: Strip "file:" prefix on creation
Max Reitz [Wed, 5 Mar 2014 21:41:38 +0000 (22:41 +0100)]
block/raw-posix: Strip "file:" prefix on creation

The bdrv_create() implementation of the block/raw-posix "file" protocol
driver should strip the "file:" prefix from filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/raw-posix: Implement bdrv_parse_filename()
Max Reitz [Wed, 5 Mar 2014 21:41:37 +0000 (22:41 +0100)]
block/raw-posix: Implement bdrv_parse_filename()

The "file" protocol driver should strip the "file:" prefix from
filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Keep "filename" option after parsing
Max Reitz [Wed, 5 Mar 2014 21:41:36 +0000 (22:41 +0100)]
block: Keep "filename" option after parsing

Currently, bdrv_file_open() always removes the "filename" option from
the options QDict after bdrv_parse_filename() has been (successfully)
called. However, for drivers with bdrv_needs_filename, it makes more
sense for bdrv_parse_filename() to overwrite the "filename" option and
for bdrv_file_open() to fetch the filename from there.

Since there currently are no drivers that implement
bdrv_parse_filename() and have bdrv_needs_filename set, this does not
change current behavior.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: mirror - remove code cruft that has no function
Jeff Cody [Tue, 4 Mar 2014 15:35:48 +0000 (10:35 -0500)]
block: mirror - remove code cruft that has no function

Originally, this built up the error message with the backing filename,
so that errp was set as follows:
    error_set(errp, QERR_OPEN_FILE_FAILED, backing_filename);

However, we now propagate the local_error from the
bdrv_open_backing_file() call instead, making these 2 lines useless
code.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: make bdrv_swap rebuild the bs graph node list field.
Benoît Canet [Wed, 5 Mar 2014 22:48:29 +0000 (23:48 +0100)]
block: make bdrv_swap rebuild the bs graph node list field.

Moving only the node_name one field could lead to some inconsitencies where a
node_name was defined on a bs which was not registered in the graph node list.

bdrv_swap between a named node bs and a non named node bs would lead to this.

bdrv_make_anon would then crash because it would try to remove the bs from the
graph node list while it is not in it.

This patch remove named node bses from the graph node list before doing the swap
then insert them back.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Fix bs->request_alignment assertion for bs->sg=1
Kevin Wolf [Wed, 5 Mar 2014 14:49:55 +0000 (15:49 +0100)]
block: Fix bs->request_alignment assertion for bs->sg=1

For sg backends, bs->request_alignment is meaningless and may be 0.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoiscsi: Use bs->sg for everything else than disks
Kevin Wolf [Wed, 5 Mar 2014 14:45:00 +0000 (15:45 +0100)]
iscsi: Use bs->sg for everything else than disks

The current iscsi block driver code makes the rather arbitrary decision
that TYPE_MEDIUM_CHANGER and TYPE_TAPE devices have bs->sg = 1 and all
other device types are disks.

Instead of this, check for TYPE_DISK to expose the disk interface and
make everything else bs->sg = 1. In particular, this includes devices
with TYPE_STORAGE_ARRAY, which is what LUN 0 of an iscsi target is.
(See https://bugzilla.redhat.com/show_bug.cgi?id=1067784 for the exact
scenario.)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoqemu-iotests: Test progress output for conversion
Kevin Wolf [Mon, 3 Mar 2014 13:53:04 +0000 (14:53 +0100)]
qemu-iotests: Test progress output for conversion

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-img convert: Fix progress output
Kevin Wolf [Mon, 3 Mar 2014 13:54:07 +0000 (14:54 +0100)]
qemu-img convert: Fix progress output

Initialise progress output only when the -p and -q options have already
been parsed, otherwise it's always disabled.

Reported-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agogluster: Remove unused defines and header include
Bharata B Rao [Wed, 29 Jan 2014 14:29:56 +0000 (19:59 +0530)]
gluster: Remove unused defines and header include

Remove the definitions of GLUSTER_FD_WRITE and GLUSTER_FD_READ which are
no longer used. Also sockets.h isn't needed any more.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agogluster: Change licence to GPLv2+
Bharata B Rao [Wed, 29 Jan 2014 14:29:55 +0000 (19:59 +0530)]
gluster: Change licence to GPLv2+

Pipe handling mechanism in gluster driver was based on similar implementation
in RBD driver and hence had GPLv2 and associated copyright information.
After changing gluster driver to coroutine based implementation, the pipe
handling code no longer exists and hence change gluster driver's licence to
GPLv2+ and remove RBD copyrights.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoui/sdl2 : initial port to SDL 2.0 (v2.0)
Dave Airlie [Tue, 10 Dec 2013 04:05:51 +0000 (14:05 +1000)]
ui/sdl2 : initial port to SDL 2.0 (v2.0)

I've ported the SDL1.2 code over, and rewritten it to use the SDL2 interface.

The biggest changes were in the input handling, where SDL2 has done a major
overhaul, and I've had to include a generated translation file to get from
SDL2 codes back to qemu compatible ones. I'm still not sure how the keyboard
layout code works in qemu, so there may be further work if someone can point
me a test case that works with SDL1.2 and doesn't with SDL2.

Some SDL env vars we used to set are no longer used by SDL2,
Windows, OSX support is untested,

I don't think we can link to SDL1.2 and SDL2 at the same time, so I felt
using --with-sdlabi=2.0 to select the new code should be fine, like how
gtk does it.

v1.1: fix keys in text console
v1.2: fix shutdown, cleanups a bit of code, support ARGB cursor

v2.0: merge the SDL multihead patch into this, g_new the number of consoles
needed, wrap DCL inside per-console structure.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Fixes & improvements by kraxel:
 * baum build fix
 * remove text console logic
 * adapt to new input core
 * codestyle fixups

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoconsole: add QemuUIInfo
Gerd Hoffmann [Fri, 24 Jan 2014 16:38:20 +0000 (17:38 +0100)]
console: add QemuUIInfo

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoconsole: add head to index to qemu consoles.
Gerd Hoffmann [Fri, 24 Jan 2014 14:35:21 +0000 (15:35 +0100)]
console: add head to index to qemu consoles.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: remove index_from_keycode (no users)
Gerd Hoffmann [Tue, 10 Dec 2013 16:30:15 +0000 (17:30 +0100)]
input: remove index_from_keycode (no users)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: move do_mouse_set to new core
Gerd Hoffmann [Tue, 10 Dec 2013 16:16:03 +0000 (17:16 +0100)]
input: move do_mouse_set to new core

This removes the last user of the lecagy input mouse handler list,
so we can remove more legacy bits with this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: move qmp_query_mice to new core
Gerd Hoffmann [Tue, 10 Dec 2013 16:09:36 +0000 (17:09 +0100)]
input: move qmp_query_mice to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: add input_mouse_mode tracepoint
Gerd Hoffmann [Thu, 5 Dec 2013 10:24:14 +0000 (11:24 +0100)]
input: add input_mouse_mode tracepoint

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: move mouse mode notifier to new core
Gerd Hoffmann [Thu, 5 Dec 2013 10:23:42 +0000 (11:23 +0100)]
input: move mouse mode notifier to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput-legacy: remove kbd_mouse_event
Gerd Hoffmann [Thu, 5 Dec 2013 10:21:21 +0000 (11:21 +0100)]
input-legacy: remove kbd_mouse_event

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput-legacy: remove kbd_mouse_is_absolute
Gerd Hoffmann [Thu, 5 Dec 2013 10:20:39 +0000 (11:20 +0100)]
input-legacy: remove kbd_mouse_is_absolute

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput-legacy: remove kbd_mouse_has_absolute
Gerd Hoffmann [Thu, 5 Dec 2013 07:19:02 +0000 (08:19 +0100)]
input-legacy: remove kbd_mouse_has_absolute

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput-legacy: remove kbd_put_keycode
Gerd Hoffmann [Thu, 5 Dec 2013 07:12:19 +0000 (08:12 +0100)]
input-legacy: remove kbd_put_keycode

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: trace events
Gerd Hoffmann [Wed, 4 Dec 2013 14:20:05 +0000 (15:20 +0100)]
input: trace events

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: switch cocoa ui to new core
Gerd Hoffmann [Wed, 4 Dec 2013 13:08:04 +0000 (14:08 +0100)]
input: mouse: switch cocoa ui to new core

Build fixes by Peter Maydell.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch cocoa ui to new core
Gerd Hoffmann [Wed, 4 Dec 2013 11:53:44 +0000 (12:53 +0100)]
input: keyboard: switch cocoa ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: switch monitor to new core
Gerd Hoffmann [Wed, 4 Dec 2013 14:02:28 +0000 (15:02 +0100)]
input: mouse: switch monitor to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: switch spice ui to new core
Gerd Hoffmann [Wed, 4 Dec 2013 11:46:34 +0000 (12:46 +0100)]
input: mouse: switch spice ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: switch vnc ui to new core
Gerd Hoffmann [Mon, 2 Dec 2013 14:17:45 +0000 (15:17 +0100)]
input: mouse: switch vnc ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: switch sdl ui to new core
Gerd Hoffmann [Thu, 28 Nov 2013 11:27:40 +0000 (12:27 +0100)]
input: mouse: switch sdl ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: switch gtk ui to new core
Gerd Hoffmann [Thu, 28 Nov 2013 11:06:04 +0000 (12:06 +0100)]
input: mouse: switch gtk ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: switch legacy handlers to new core
Gerd Hoffmann [Wed, 27 Nov 2013 16:41:40 +0000 (17:41 +0100)]
input: mouse: switch legacy handlers to new core

legacy mouse event handlers are registered in the new core,
so they receive events submitted to the new input core.

legacy kbd_mouse_event() continues to use the old code paths.
So new-core event handlers wouldn't see events submitted via
kbd_mouse_event.

This leads to the constrain that we we must transition all
kbd_mouse_event() users first to keep things working.  But
that is easier to handle than translating legacy mouse events
into new-core mouse events ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: add qemu_input_is_absolute()
Gerd Hoffmann [Thu, 28 Nov 2013 10:31:09 +0000 (11:31 +0100)]
input: mouse: add qemu_input_is_absolute()

Same as kbd_mouse_is_absolute(), but using new input core.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: add graphic_rotate support
Gerd Hoffmann [Thu, 28 Nov 2013 10:29:33 +0000 (11:29 +0100)]
input: mouse: add graphic_rotate support

Transform absolute mouse events according to graphic_rotate.

Legacy input code does it for both absolute and relative events,
but the logic is broken for relative coordinates, so this is
most likely not used anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: mouse: add helpers functions to core
Gerd Hoffmann [Wed, 27 Nov 2013 17:24:29 +0000 (18:24 +0100)]
input: mouse: add helpers functions to core

Likewise a bunch of helper functions to manage mouse button
and movement events, again to make life easier for the ui code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch curses ui to new core
Gerd Hoffmann [Wed, 4 Dec 2013 12:40:20 +0000 (13:40 +0100)]
input: keyboard: switch curses ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch spice ui to new core
Gerd Hoffmann [Wed, 4 Dec 2013 11:23:54 +0000 (12:23 +0100)]
input: keyboard: switch spice ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch vnc ui to new core
Gerd Hoffmann [Mon, 2 Dec 2013 13:27:18 +0000 (14:27 +0100)]
input: keyboard: switch vnc ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch sdl ui to new core
Gerd Hoffmann [Thu, 28 Nov 2013 11:17:35 +0000 (12:17 +0100)]
input: keyboard: switch sdl ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch gtk ui to new core
Gerd Hoffmann [Thu, 28 Nov 2013 10:40:27 +0000 (11:40 +0100)]
input: keyboard: switch gtk ui to new core

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch qmp_send_key() to new core.
Gerd Hoffmann [Wed, 27 Nov 2013 11:11:13 +0000 (12:11 +0100)]
input: keyboard: switch qmp_send_key() to new core.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: switch legacy handlers to new core
Gerd Hoffmann [Wed, 27 Nov 2013 10:59:25 +0000 (11:59 +0100)]
input: keyboard: switch legacy handlers to new core

legacy kbd event handlers are registered in the new core,
so they receive events from the new input core code.
keycode -> scancode translation needed here.

legacy kbd_put_keycode() sends events to the new core.
scancode -> keycode translation needed here.

So with this patch the new input core is fully functional
for keyboard events.  New + legacy interfaces can be mixed
in any way.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: keyboard: add helper functions to core
Gerd Hoffmann [Wed, 27 Nov 2013 10:38:47 +0000 (11:38 +0100)]
input: keyboard: add helper functions to core

A bunch of helper functions to manage keyboard events,
to make life simpler for the ui code when submitting
keyboard events.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: add core bits of the new input layer
Gerd Hoffmann [Wed, 27 Nov 2013 09:35:26 +0000 (10:35 +0100)]
input: add core bits of the new input layer

Register and unregister handlers.
Event dispatcher code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoinput: qapi: add pause key
Gerd Hoffmann [Mon, 16 Dec 2013 09:34:53 +0000 (10:34 +0100)]
input: qapi: add pause key

It's missing.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoinput: qapi: add unmapped key
Gerd Hoffmann [Fri, 13 Dec 2013 11:10:14 +0000 (12:10 +0100)]
input: qapi: add unmapped key

Simplifies building something -> QkeyCode mapping tables.
Uninitialized entries can easily identified then.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoinput: qapi: define event types
Gerd Hoffmann [Wed, 27 Nov 2013 08:08:40 +0000 (09:08 +0100)]
input: qapi: define event types

Define input event types, using qapi.  So we get nicely autogenerated
types for our input events.  And when it comes to qmp support some day
things will be a lot easier.

Types are modeled after the linux input layer.  There are separate
event types for each value.  There is a sync to indicate the end
of a event group.

Mouse events are split into motion events (one for each axis) and
button events, which are grouped by sync.

Keyboard events are using the existing KeyValue type.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoinput: rename file to legacy
Gerd Hoffmann [Wed, 27 Nov 2013 08:29:27 +0000 (09:29 +0100)]
input: rename file to legacy

Rename ui/input.c to ui/input-legacy.c.
We are going to replace it step by step.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoconsole: export QemuConsole index,width,height
Gerd Hoffmann [Thu, 28 Nov 2013 08:58:18 +0000 (09:58 +0100)]
console: export QemuConsole index,width,height

Add functions to query QemuConsole properties.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agos390x/virtio-ccw: Adapter interrupt support.
Cornelia Huck [Wed, 6 Feb 2013 09:31:37 +0000 (10:31 +0100)]
s390x/virtio-ccw: Adapter interrupt support.

Handle the new CCW_CMD_SET_IND_ADAPTER command enabling adapter interrupts
on guest request. When active, host->guest notifications will be handled
via global_indicator -> queue indicators instead of queue indicators +
subchannel I/O interrupt. Indicators for virtqueues may be present at an
offset.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agotarget-ppc: spapr: e500: fix to use cpu_dt_id
Alexey Kardashevskiy [Sat, 1 Feb 2014 14:45:52 +0000 (01:45 +1100)]
target-ppc: spapr: e500: fix to use cpu_dt_id

This makes use of @cpu_dt_id and related API in:
1. emulated XICS hypercall handlers as they receive fixed CPU indexes;
2. XICS-KVM to enable in-kernel XICS on right CPU;
3. device-tree renderer.

This removes @cpu_index fixup as @cpu_dt_id is used instead so QEMU monitor
can accept command-line CPU indexes again.

This changes kvm_arch_vcpu_id() to use ppc_get_vcpu_dt_id() as at the moment
KVM CPU id and device tree ID are calculated using the same algorithm.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Mike Day <ncmike@ncultra.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: add PowerPCCPU::cpu_dt_id
Alexey Kardashevskiy [Sat, 1 Feb 2014 14:45:51 +0000 (01:45 +1100)]
target-ppc: add PowerPCCPU::cpu_dt_id

Normally CPUState::cpu_index is used to pick the right CPU for various
operations. However default consecutive numbering does not always work
for POWERPC.

These indexes are reflected in /proc/device-tree/cpus/PowerPC,POWER7@XX
and used to call KVM VCPU's ioctls. In order to achieve this,
kvmppc_fixup_cpu() was introduced. Roughly speaking, it multiplies
cpu_index by the number of threads per core.

This approach has disadvantages such as:
1. NUMA configuration stays broken after the fixup;
2. CPU-targeted commands from the QEMU Monitor do not work properly as
CPU indexes have been fixed and there is no clear way for the user to
know what the new CPU indexes are.

This introduces a @cpu_dt_id field in the CPUPPCState struct which
is initialized from @cpu_index by default and can be fixed later
to meet the device tree requirements.

This adds an API to handle @cpu_dt_id.

This removes kvmppc_fixup_cpu() as it is not more needed, @cpu_dt_id
is calculated in ppc_cpu_realize().

This will be used later in machine code.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Mike Day <ncmike@ncultra.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Introduce hypervisor call H_GET_TCE
Laurent Dufour [Fri, 21 Feb 2014 09:29:06 +0000 (10:29 +0100)]
target-ppc: Introduce hypervisor call H_GET_TCE

This patch introduces the hypervisor call H_GET_TCE which is basically the
reverse of H_PUT_TCE, as defined in the Power Architecture Platform
Requirements (PAPR).

The hcall H_GET_TCE is required by the kdump kernel which is calling it to
retrieve the TCE set up by the panicing kernel.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Update ppc_hash64_store_hpte to support updating in-kernel htab
Aneesh Kumar K.V [Thu, 20 Feb 2014 17:52:38 +0000 (18:52 +0100)]
target-ppc: Update ppc_hash64_store_hpte to support updating in-kernel htab

This support updating htab managed by the hypervisor. Currently we don't have
any user for this feature. This actually bring the store_hpte interface
in-line with the load_hpte one. We may want to use this when we want to
emulate henter hcall in qemu for HV kvm.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[ folded fix for the "warn_unused_result" build break in
  kvmppc_hash64_write_pte(), Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Change the hpte store API
Aneesh Kumar K.V [Thu, 20 Feb 2014 17:52:31 +0000 (18:52 +0100)]
target-ppc: Change the hpte store API

For updating in kernel htab we need to provide both pte0 and pte1, hence update
the interface to take pte0 and pte1 together

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[ ldq_phys() API change, Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Fix page table lookup with kvm enabled
Aneesh Kumar K.V [Thu, 20 Feb 2014 17:52:24 +0000 (18:52 +0100)]
target-ppc: Fix page table lookup with kvm enabled

With kvm enabled, we store the hash page table information in the hypervisor.
Use ioctl to read the htab contents. Without this we get the below error when
trying to read the guest address

 (gdb) x/10 do_fork
 0xc000000000098660 <do_fork>:   Cannot access memory at address 0xc000000000098660
 (gdb)

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[ fixes for 32 bit build (casts!), ldq_phys() API change,
  Greg Kurz <gkurz@linux.vnet.ibm.com ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Fix htab_mask calculation
Aneesh Kumar K.V [Thu, 20 Feb 2014 17:52:17 +0000 (18:52 +0100)]
target-ppc: Fix htab_mask calculation

Correctly update the htab_mask using the return value of
KVM_PPC_ALLOCATE_HTAB ioctl. Also we don't update sdr1
on GET_SREGS for HV. We check for external htab and if
found true, we don't need to update sdr1

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[ fixed pte group offset computation in ppc_hash64_htab_lookup() that
  caused TCG to fail, Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Use Additional Temporary in stqcx Case
Tom Musta [Mon, 24 Feb 2014 14:16:16 +0000 (08:16 -0600)]
target-ppc: Use Additional Temporary in stqcx Case

Per Alex Graf's suggestion, the recently added case to gen_conditional_store
for stqcx should use an additional temporary when accessing the second
doubleword.  This avoids the mutation of the EA argument to the function,
which is counter intuitive.

Signed-off-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Fix Compiler Warnings Due to 64-Bit Constants Declared as UL
Tom Musta [Mon, 24 Feb 2014 14:12:13 +0000 (08:12 -0600)]
target-ppc: Fix Compiler Warnings Due to 64-Bit Constants Declared as UL

This patch fixes 64 bit constants that were erroneously declared as "ul" instead of
"ull".  The preferred form "ULL" is used.

Signed-off-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoPPC: sPAPR: Only use getpagesize() when we run with kvm
Alexander Graf [Fri, 21 Feb 2014 09:38:51 +0000 (10:38 +0100)]
PPC: sPAPR: Only use getpagesize() when we run with kvm

We currently size the msi window trap page according to the host's page
size so that we poke a working hole into a memory slot in case we overlap.

However, this is only ever necessary with KVM active. Without KVM, we should
rather try to be host platform agnostic and use a constant size: 4k.

This fixes a build breakage on win32 hosts.

Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc/translate.c: Use ULL suffix for 64 bit constants
Peter Maydell [Thu, 20 Feb 2014 19:47:27 +0000 (19:47 +0000)]
target-ppc/translate.c: Use ULL suffix for 64 bit constants

64 bit constants need the "ULL" suffix, not just "UL", because
on 32 bit platforms 'long' is not large enough and this will
cause a compiler warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr-vlan: flush queue whenever can_receive can go from false to true
Alexey Kardashevskiy [Fri, 14 Feb 2014 01:27:04 +0000 (12:27 +1100)]
spapr-vlan: flush queue whenever can_receive can go from false to true

When the guests adds buffers to receive queue, the network device
should flush its queue of pending packets. This is done with
qemu_flush_queued_packets.

This adds a call to qemu_flush_queued_packets() which wakes up the main
loop and let QEMU update the network device status which now is "can
receive". The patch basically does the same thing as e8b4c68 does.

Suggested-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>