sdk/emulator/qemu.git
9 years agovhost-user: fix mmap offset calculation
Michael S. Tsirkin [Sun, 2 Nov 2014 18:00:28 +0000 (20:00 +0200)]
vhost-user: fix mmap offset calculation

qemu_get_ram_block_host_ptr should get ram_addr_t,
vhost-user passes in GPA.
That's very wrong.

Reported-by: Linhaifeng <haifeng.lin@huawei.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/i386/acpi-build.c: Fix memory leak in acpi_build_tables_cleanup()
Nikita Belov [Wed, 29 Oct 2014 14:07:02 +0000 (18:07 +0400)]
hw/i386/acpi-build.c: Fix memory leak in acpi_build_tables_cleanup()

There are three ACPI tables: 'linker_data', 'rsdp' and 'table_data'. They are
used differently. Two of them are being copied before using and only the copy
is used later. But the third is used directly. Because of that we need to free
two tables completely and delete only wrapper for the third one.

Valgrind output:
==23931== 131,072 bytes in 1 blocks are definitely lost in loss record 7,729 of 7,734
==23931==    at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23931==    by 0x2EA920: realloc_and_trace (vl.c:2811)
==23931==    by 0x509E6AE: g_realloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==23931==    by 0x506DB32: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==23931==    by 0x506E463: g_array_set_size (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==23931==    by 0x256A4F: acpi_align_size (acpi-build.c:487)
==23931==    by 0x259F92: acpi_build (acpi-build.c:1601)
==23931==    by 0x25A212: acpi_setup (acpi-build.c:1682)
==23931==    by 0x24F346: pc_guest_info_machine_done (pc.c:1110)
==23931==    by 0x55FAAB: notifier_list_notify (notify.c:39)
==23931==    by 0x2EA704: qemu_run_machine_init_done_notifiers (vl.c:2759)
==23931==    by 0x2EEC3C: main (vl.c:4504)

Signed-off-by: Nikita Belov <zodiac@ispras.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
9 years agosmbios: Encode UUID according to SMBIOS specification
Eduardo Habkost [Wed, 29 Oct 2014 13:26:08 +0000 (11:26 -0200)]
smbios: Encode UUID according to SMBIOS specification

Differently from older versions, SMBIOS version 2.6 is explicit about
the encoding of UUID fields:

> Although RFC 4122 recommends network byte order for all fields, the PC
> industry (including the ACPI, UEFI, and Microsoft specifications) has
> consistently used little-endian byte encoding for the first three fields:
> time_low, time_mid, time_hi_and_version. The same encoding, also known as
> wire format, should also be used for the SMBIOS representation of the UUID.
>
> The UUID {00112233-4455-6677-8899-AABBCCDDEEFF} would thus be represented
> as 33 22 11 00 55 44 77 66 88 99 AA BB CC DD EE FF.

The dmidecode tool implements this and decodes the above "wire format"
when SMBIOS version >= 2.6. We moved from SMBIOS version 2.4 to 2.8 when
we started building the SMBIOS entry point inside QEMU, on commit
c97294ec1b9e36887e119589d456557d72ab37b5.

Change smbios_build_type_1_table() to encode the UUID as specified.

To make sure we won't change the guest-visible UUID when upgrading to a
newer QEMU version, keep the old behavior on pc-*-2.1 and older.

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>
9 years agopc: Add pc_compat_2_1() function
Eduardo Habkost [Wed, 29 Oct 2014 13:26:07 +0000 (11:26 -0200)]
pc: Add pc_compat_2_1() function

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>
9 years agohw/virtio/vring/event_idx: fix the vring_avail_event error
Bin Wu [Fri, 31 Oct 2014 00:40:16 +0000 (00:40 +0000)]
hw/virtio/vring/event_idx: fix the vring_avail_event error

The event idx in virtio is an effective way to reduce the number of
interrupts and exits of the guest. When the guest puts an request
into the virtio ring, it doesn't exit immediately to inform the
backend. Instead, the guest checks the "avail" event idx to determine
the notification.

In virtqueue_pop, when a request is poped, the current avail event
idx should be set to the number of vq->last_avail_idx.

Signed-off-by: Bin Wu <wu.wubin@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agohw/pci: fixed hotplug crash when using rombar=0 with devices having romfile
Marcel Apfelbaum [Mon, 27 Oct 2014 17:34:42 +0000 (19:34 +0200)]
hw/pci: fixed hotplug crash when using rombar=0 with devices having romfile

Hot-plugging a device that has a romfile (either supplied by user
or built-in) using rombar=0 option is a user error,
do not allow the device to be hot-plugged.

Reviewed-by: Eric Blake <eblake@redhat.com>
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>
9 years agohw/pci: fixed error flow in pci_qdev_init
Marcel Apfelbaum [Mon, 27 Oct 2014 17:34:41 +0000 (19:34 +0200)]
hw/pci: fixed error flow in pci_qdev_init

Verify return code for pci_add_option_rom.

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>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9 years ago-machine vmport=off: Allow disabling of VMWare ioport emulation
Dr. David Alan Gilbert [Fri, 3 Oct 2014 21:33:37 +0000 (17:33 -0400)]
-machine vmport=off: Allow disabling of VMWare ioport emulation

This is a pc & q35 only machine opt.

VMWare apparently doesn't like running under QEMU due to our
incomplete emulation of it's special IO Port.  This adds a
pc & q35 property to allow it to be turned off.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Don Slutz <dslutz@verizon.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>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
9 years agoacpi/cpu-hotplug: introduce helper function to keep bit setting in one place
Gu Zheng [Wed, 22 Oct 2014 03:24:32 +0000 (11:24 +0800)]
acpi/cpu-hotplug: introduce helper function to keep bit setting in one place

Introduce helper function acpi_set_cpu_present_bit() to simplify acpi_cpu_plug_cb
and acpi_cpu_hotplug_init, so that we can keep bit setting in one place.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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 agocpu-hotplug: rename function for better readability
Gu Zheng [Wed, 22 Oct 2014 03:24:31 +0000 (11:24 +0800)]
cpu-hotplug: rename function for better readability

Rename:
AcpiCpuHotplug_init --> acpi_cpu_hotplug_init
AcpiCpuHotplug_ops --> acpi_cpu_hotplug_ops
for better readability, just cleanup.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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 agoqom/cpu: remove the unused CPU hot-plug notifier
Gu Zheng [Wed, 22 Oct 2014 03:24:30 +0000 (11:24 +0800)]
qom/cpu: remove the unused CPU hot-plug notifier

Remove the unused CPU hot-plug notifier.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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: Update rtc_cmos in pc_cpu_plug
Gu Zheng [Wed, 22 Oct 2014 03:24:29 +0000 (11:24 +0800)]
pc: Update rtc_cmos in pc_cpu_plug

Update rtc_cmos in pc_cpu_plug() directly, instead of the notifier.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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: add cpu hotplug handler to PC_MACHINE
Gu Zheng [Wed, 22 Oct 2014 03:24:28 +0000 (11:24 +0800)]
pc: add cpu hotplug handler to PC_MACHINE

Add cpu hotplug handler to PC_MACHINE, which will perform the acpi
cpu hotplug callback via hotplug_handler API.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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 agoacpi:piix4: convert cpu hotplug to hotplug_handler API
Gu Zheng [Wed, 22 Oct 2014 03:24:27 +0000 (11:24 +0800)]
acpi:piix4: convert cpu hotplug to hotplug_handler API

Convert notifier based hotplug to hotplug_handler API,
and remove the unused AcpiCpuHotplug_add().

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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 agoacpi:ich9: convert cpu hotplug to hotplug_handler API
Gu Zheng [Wed, 22 Oct 2014 03:24:26 +0000 (11:24 +0800)]
acpi:ich9: convert cpu hotplug to hotplug_handler API

Convert notifier based hotplug to hotplug_handler API.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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 agoacpi/cpu: add cpu hotplug callback function to match hotplug_handler API
Gu Zheng [Wed, 22 Oct 2014 03:24:25 +0000 (11:24 +0800)]
acpi/cpu: add cpu hotplug callback function to match hotplug_handler API

Add cpu hotplug callback function (acpi_cpu_plug_cb) to match hotplug_handler API.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-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 agoacpi: create separate file for TCPA log
Stefan Berger [Fri, 24 Oct 2014 17:21:04 +0000 (13:21 -0400)]
acpi: create separate file for TCPA log

Create the TCPA log in a separate file rather than allocating
ACPI table memory for it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotests: fix rebuild-expected-aml.sh for acpi-test rename
Paolo Bonzini [Wed, 15 Oct 2014 07:45:45 +0000 (09:45 +0200)]
tests: fix rebuild-expected-aml.sh for acpi-test rename

This is now called bios-tables-test.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agointel_iommu: fix VTD_SID_TO_BUS
Michael S. Tsirkin [Mon, 20 Oct 2014 09:37:23 +0000 (12:37 +0300)]
intel_iommu: fix VTD_SID_TO_BUS

(((sid) >> 8) && 0xff)  makes no sense
(((sid) >> 8) & 0xff) seems to be what was meant.

https://bugs.launchpad.net/qemu/+bug/1382477

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: fix migration for pci bus master
Michael S. Tsirkin [Tue, 14 Oct 2014 16:40:06 +0000 (19:40 +0300)]
virtio-pci: fix migration for pci bus master

Current support for bus master (clearing OK bit) together with the need to
support guests which do not enable PCI bus mastering, leads to extra state in
VIRTIO_PCI_FLAG_BUS_MASTER_BUG bit, which isn't robust in case of cross-version
migration for the case when guests use the device before setting DRIVER_OK.

Rip out this code, and replace it:
-   Modern QEMU doesn't need VIRTIO_PCI_FLAG_BUS_MASTER_BUG
    so just drop it for latest machine type.
-   For compat machine types, set PCI_COMMAND if DRIVER_OK
    is set.

As this is needed for 2.1 for both pc and ppc, move PC_COMPAT macros from pc.h
to a new common header.

Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
9 years agopcie: change confused comment clearer
Gonglei [Tue, 7 Oct 2014 06:53:48 +0000 (14:53 +0800)]
pcie: change confused comment clearer

This comment applies to all functions below it.
It is not appropriate that called capability allocation
functions, change it into capability list management functions.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoi386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive.
Gal Hammer [Wed, 17 Sep 2014 11:39:51 +0000 (14:39 +0300)]
i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive.

Add a 16-bytes buffer to allow storing a 128-bit UUID value in an
ACPI table.

Signed-off-by: Gal Hammer <ghammer@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: Fix disabling of vapic for compat PC models
Jan Kiszka [Wed, 30 Jul 2014 07:01:59 +0000 (09:01 +0200)]
pc: Fix disabling of vapic for compat PC models

We used to be able to address both the QEMU and the KVM APIC via "apic".
This doesn't work anymore. So we need to use their parent class to turn
off the vapic on machines that should not expose them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoi386/pc: add piix and q35 machtypes to sorting families for -M \?
Laszlo Ersek [Mon, 22 Sep 2014 20:38:36 +0000 (22:38 +0200)]
i386/pc: add piix and q35 machtypes to sorting families for -M \?

With this patch applied, the output of -M \? is

> Supported machines are:
> pc                   Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> pc-i440fx-2.2        Standard PC (i440FX + PIIX, 1996) (default)
> pc-i440fx-2.1        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.0        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.7        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.6        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.5        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.4        Standard PC (i440FX + PIIX, 1996)
> pc-1.3               Standard PC (i440FX + PIIX, 1996)
> pc-1.2               Standard PC (i440FX + PIIX, 1996)
> pc-1.1               Standard PC (i440FX + PIIX, 1996)
> pc-1.0               Standard PC (i440FX + PIIX, 1996)
> pc-0.15              Standard PC (i440FX + PIIX, 1996)
> pc-0.14              Standard PC (i440FX + PIIX, 1996)
> pc-0.13              Standard PC (i440FX + PIIX, 1996)
> pc-0.12              Standard PC (i440FX + PIIX, 1996)
> pc-0.11              Standard PC (i440FX + PIIX, 1996)
> pc-0.10              Standard PC (i440FX + PIIX, 1996)
> q35                  Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> pc-q35-2.2           Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.1           Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.0           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.7           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.6           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.5           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.4           Standard PC (Q35 + ICH9, 2009)
> isapc                ISA-only PC
> none                 empty machine

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1145042
Signed-off-by: Laszlo Ersek <lersek@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>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
9 years agowell-defined listing order for machine types
Laszlo Ersek [Mon, 22 Sep 2014 20:38:35 +0000 (22:38 +0200)]
well-defined listing order for machine types

Commit 261747f1 ("vl: Use MachineClass instead of global QEMUMachine
list") broke the ordering of the machine types in the user-visible output
of

  qemu-system-XXXX -M \?

This occurred because registration was rebased from a manually maintained
linked list to GLib hash tables:

  qemu_register_machine()
    type_register()
      type_register_internal()
        type_table_add()
          g_hash_table_insert()

and because the listing was rebased accordingly, from the traversal of the
list to the traversal of the hash table (rendered as an ad-hoc list):

  machine_parse()
    object_class_get_list(TYPE_MACHINE)
      object_class_foreach()
        g_hash_table_foreach()

The current order is a "random" one, for practical purposes, which is
annoying for users.

Introduce new members QEMUMachine.family and MachineClass.family, allowing
machine types to be "clustered". Introduce a comparator function that
establishes a total ordering between machine types, ordering machine types
in the same family next to each other. In machine_parse(), list the
supported machine types sorted with the comparator function.

The comparator function:
- sorts whole families before standalone machine types,
- sorts whole families between each other in alphabetically increasing
  order,
- sorts machine types inside the same family in alphabetically decreasing
  order,
- sorts standalone machine types between each other in alphabetically
  increasing order.

After this patch, all machine types are considered standalone, and
accordingly, the output is alphabetically ascending. This will be refined
in the following patches.

Effects on the x86_64 output:

Before:

> Supported machines are:
> pc-0.13              Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.0        Standard PC (i440FX + PIIX, 1996)
> pc-1.0               Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.1        Standard PC (i440FX + PIIX, 1996)
> pc-q35-1.7           Standard PC (Q35 + ICH9, 2009)
> pc-1.1               Standard PC (i440FX + PIIX, 1996)
> pc-0.14              Standard PC (i440FX + PIIX, 1996)
> pc-q35-2.0           Standard PC (Q35 + ICH9, 2009)
> pc-i440fx-1.4        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.5        Standard PC (i440FX + PIIX, 1996)
> pc-0.15              Standard PC (i440FX + PIIX, 1996)
> pc-q35-1.4           Standard PC (Q35 + ICH9, 2009)
> isapc                ISA-only PC
> pc                   Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> pc-i440fx-2.2        Standard PC (i440FX + PIIX, 1996) (default)
> pc-1.2               Standard PC (i440FX + PIIX, 1996)
> pc-0.10              Standard PC (i440FX + PIIX, 1996)
> pc-0.11              Standard PC (i440FX + PIIX, 1996)
> pc-q35-2.1           Standard PC (Q35 + ICH9, 2009)
> q35                  Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> pc-q35-2.2           Standard PC (Q35 + ICH9, 2009)
> pc-i440fx-1.6        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.7        Standard PC (i440FX + PIIX, 1996)
> none                 empty machine
> pc-q35-1.5           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.6           Standard PC (Q35 + ICH9, 2009)
> pc-0.12              Standard PC (i440FX + PIIX, 1996)
> pc-1.3               Standard PC (i440FX + PIIX, 1996)

After:

> Supported machines are:
> isapc                ISA-only PC
> none                 empty machine
> pc-0.10              Standard PC (i440FX + PIIX, 1996)
> pc-0.11              Standard PC (i440FX + PIIX, 1996)
> pc-0.12              Standard PC (i440FX + PIIX, 1996)
> pc-0.13              Standard PC (i440FX + PIIX, 1996)
> pc-0.14              Standard PC (i440FX + PIIX, 1996)
> pc-0.15              Standard PC (i440FX + PIIX, 1996)
> pc-1.0               Standard PC (i440FX + PIIX, 1996)
> pc-1.1               Standard PC (i440FX + PIIX, 1996)
> pc-1.2               Standard PC (i440FX + PIIX, 1996)
> pc-1.3               Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.4        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.5        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.6        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.7        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.0        Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.1        Standard PC (i440FX + PIIX, 1996)
> pc                   Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> pc-i440fx-2.2        Standard PC (i440FX + PIIX, 1996) (default)
> pc-q35-1.4           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.5           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.6           Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.7           Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.0           Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.1           Standard PC (Q35 + ICH9, 2009)
> q35                  Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> pc-q35-2.2           Standard PC (Q35 + ICH9, 2009)

Effects on the aarch64 output:

Before:

> Supported machines are:
> lm3s811evb           Stellaris LM3S811EVB
> canon-a1100          Canon PowerShot A1100 IS
> vexpress-a15         ARM Versatile Express for Cortex-A15
> vexpress-a9          ARM Versatile Express for Cortex-A9
> xilinx-zynq-a9       Xilinx Zynq Platform Baseboard for Cortex-A9
> connex               Gumstix Connex (PXA255)
> n800                 Nokia N800 tablet aka. RX-34 (OMAP2420)
> lm3s6965evb          Stellaris LM3S6965EVB
> versatileab          ARM Versatile/AB (ARM926EJ-S)
> borzoi               Borzoi PDA (PXA270)
> tosa                 Tosa PDA (PXA255)
> cheetah              Palm Tungsten|E aka. Cheetah PDA (OMAP310)
> midway               Calxeda Midway (ECX-2000)
> mainstone            Mainstone II (PXA27x)
> n810                 Nokia N810 tablet aka. RX-44 (OMAP2420)
> terrier              Terrier PDA (PXA270)
> highbank             Calxeda Highbank (ECX-1000)
> cubieboard           cubietech cubieboard
> sx1-v1               Siemens SX1 (OMAP310) V1
> sx1                  Siemens SX1 (OMAP310) V2
> realview-eb-mpcore   ARM RealView Emulation Baseboard (ARM11MPCore)
> kzm                  ARM KZM Emulation Baseboard (ARM1136)
> akita                Akita PDA (PXA270)
> z2                   Zipit Z2 (PXA27x)
> musicpal             Marvell 88w8618 / MusicPal (ARM926EJ-S)
> realview-pb-a8       ARM RealView Platform Baseboard for Cortex-A8
> versatilepb          ARM Versatile/PB (ARM926EJ-S)
> realview-eb          ARM RealView Emulation Baseboard (ARM926EJ-S)
> realview-pbx-a9      ARM RealView Platform Baseboard Explore for Cortex-A9
> spitz                Spitz PDA (PXA270)
> none                 empty machine
> virt                 ARM Virtual Machine
> collie               Collie PDA (SA-1110)
> smdkc210             Samsung SMDKC210 board (Exynos4210)
> verdex               Gumstix Verdex (PXA270)
> nuri                 Samsung NURI board (Exynos4210)
> integratorcp         ARM Integrator/CP (ARM926EJ-S)

After:

> Supported machines are:
> akita                Akita PDA (PXA270)
> borzoi               Borzoi PDA (PXA270)
> canon-a1100          Canon PowerShot A1100 IS
> cheetah              Palm Tungsten|E aka. Cheetah PDA (OMAP310)
> collie               Collie PDA (SA-1110)
> connex               Gumstix Connex (PXA255)
> cubieboard           cubietech cubieboard
> highbank             Calxeda Highbank (ECX-1000)
> integratorcp         ARM Integrator/CP (ARM926EJ-S)
> kzm                  ARM KZM Emulation Baseboard (ARM1136)
> lm3s6965evb          Stellaris LM3S6965EVB
> lm3s811evb           Stellaris LM3S811EVB
> mainstone            Mainstone II (PXA27x)
> midway               Calxeda Midway (ECX-2000)
> musicpal             Marvell 88w8618 / MusicPal (ARM926EJ-S)
> n800                 Nokia N800 tablet aka. RX-34 (OMAP2420)
> n810                 Nokia N810 tablet aka. RX-44 (OMAP2420)
> none                 empty machine
> nuri                 Samsung NURI board (Exynos4210)
> realview-eb          ARM RealView Emulation Baseboard (ARM926EJ-S)
> realview-eb-mpcore   ARM RealView Emulation Baseboard (ARM11MPCore)
> realview-pb-a8       ARM RealView Platform Baseboard for Cortex-A8
> realview-pbx-a9      ARM RealView Platform Baseboard Explore for Cortex-A9
> smdkc210             Samsung SMDKC210 board (Exynos4210)
> spitz                Spitz PDA (PXA270)
> sx1                  Siemens SX1 (OMAP310) V2
> sx1-v1               Siemens SX1 (OMAP310) V1
> terrier              Terrier PDA (PXA270)
> tosa                 Tosa PDA (PXA255)
> verdex               Gumstix Verdex (PXA270)
> versatileab          ARM Versatile/AB (ARM926EJ-S)
> versatilepb          ARM Versatile/PB (ARM926EJ-S)
> vexpress-a15         ARM Versatile Express for Cortex-A15
> vexpress-a9          ARM Versatile Express for Cortex-A9
> virt                 ARM Virtual Machine
> xilinx-zynq-a9       Xilinx Zynq Platform Baseboard for Cortex-A9
> z2                   Zipit Z2 (PXA27x)

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1145042
Signed-off-by: Laszlo Ersek <lersek@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>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
9 years agosmbios: Fix assertion on socket count calculation
Eduardo Habkost [Tue, 30 Sep 2014 01:21:45 +0000 (22:21 -0300)]
smbios: Fix assertion on socket count calculation

QEMU currently allows the number of VCPUs to not be a multiple of the
number of threads per socket, but the smbios socket count calculation
introduced by commit c97294ec1b9e36887e119589d456557d72ab37b5 doesn't
take that into account, triggering an assertion. e.g.:

  $ ./x86_64-softmmu/qemu-system-x86_64 -smp 4,sockets=2,cores=6,threads=1
  qemu-system-x86_64: /home/ehabkost/rh/proj/virt/qemu/hw/i386/smbios.c:825: smbios_get_tables: Assertion `smbios_smp_sockets >= 1' failed.
  Aborted (core dumped)

Socket count calculation doesn't belong to smbios.c and should
eventually be moved to the main SMP topology configuration code. But
while we don't move the code, at least make it correct by rounding up
the division.

Cc: Gabriel Somlo <somlo@cmu.edu>
Cc: qemu-stable@nongnu.org
Signed-off-by: Eduardo Habkost <ehabkost@redhat.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 agoMerge remote-tracking branch 'remotes/sstabellini/xen-2014-10-30' into staging
Peter Maydell [Thu, 30 Oct 2014 20:28:09 +0000 (20:28 +0000)]
Merge remote-tracking branch 'remotes/sstabellini/xen-2014-10-30' into staging

* remotes/sstabellini/xen-2014-10-30:
  fix off-by-one error in pci_piix3_xen_ide_unplug
  xen-hvm.c: Add support for Xen access to vmport

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-cve-2014-3689-20141029-1'...
Peter Maydell [Thu, 30 Oct 2014 19:11:24 +0000 (19:11 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-cve-2014-3689-20141029-1' into staging

vmware-vga: add rectangle verification (CVE-2014-3689)

# gpg: Signature made Wed 29 Oct 2014 11:45: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-cve-2014-3689-20141029-1:
  vmware-vga: use vmsvga_verify_rect in vmsvga_fill_rect
  vmware-vga: use vmsvga_verify_rect in vmsvga_copy_rect
  vmware-vga: use vmsvga_verify_rect in vmsvga_update_rect
  vmware-vga: add vmsvga_verify_rect
  vmware-vga: CVE-2014-3689: turn off hw accel

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20141028-1' into staging
Peter Maydell [Thu, 30 Oct 2014 18:21:25 +0000 (18:21 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20141028-1' into staging

vnc: return directly if no vnc client connected
vnc: sanitize bits_per_pixel from the client (CVE-2014-7815)

# gpg: Signature made Tue 28 Oct 2014 10:52:31 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-20141028-1:
  vnc: return directly if no vnc client connected
  vnc: sanitize bits_per_pixel from the client

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20141028-1' into staging
Peter Maydell [Thu, 30 Oct 2014 17:04:29 +0000 (17:04 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20141028-1' into staging

Fixes for libcacard (usb smartcard emulation), xhci and uhci.

# gpg: Signature made Tue 28 Oct 2014 10:39:52 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-usb-20141028-1:
  uhci: remove useless DEBUG
  xhci: add property to turn on/off streams support
  libcacard: don't free sign buffer while sign op is pending
  libcacard: Lock NSS cert db when selecting an applet on an emulated card
  libcacard: introduce new vcard_emul_logout

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20141028-1' into staging
Peter Maydell [Thu, 30 Oct 2014 14:45:53 +0000 (14:45 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20141028-1' into staging

gtk: fix two warnings with gtk 3.14+

# gpg: Signature made Tue 28 Oct 2014 10:25:52 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-gtk-20141028-1:
  gtk: avoid gd_widget_reparent with gtk 3.14+
  gtk: drop gtk_widget_set_double_buffered call

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agofix off-by-one error in pci_piix3_xen_ide_unplug
James Harper [Thu, 30 Oct 2014 10:08:28 +0000 (10:08 +0000)]
fix off-by-one error in pci_piix3_xen_ide_unplug

Fix off-by-one error when unplugging disks, which would otherwise leave the last ATA disk plugged, with obvious consequences. Also rewrite loop to be more readable.

Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen-hvm.c: Add support for Xen access to vmport
Don Slutz [Mon, 20 Oct 2014 19:49:12 +0000 (15:49 -0400)]
xen-hvm.c: Add support for Xen access to vmport

This adds synchronisation of the 6 vcpu registers (only 32bits of
them) that vmport.c needs between Xen and QEMU.

This is to avoid a 2nd and 3rd exchange between QEMU and Xen to
fetch and put these 6 vcpu registers used by the code in vmport.c
and vmmouse.c

The registers are passed in the new shared page provided by
HVM_PARAM_VMPORT_REGS_PFN.

Add new array to XenIOState that allows selection of current_cpu by
vcpu id.

Now pass XenIOState to handle_ioreq().

Add new routines regs_to_cpu(), regs_from_cpu(), and
handle_vmport_ioreq().

Signed-off-by: Don Slutz <dslutz@verizon.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Thu, 30 Oct 2014 13:35:12 +0000 (13:35 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

virtio-scsi fixes, the first part of dynamic sysbus devices,
MAINTAINERS updates, and AVX512 support.

# gpg: Signature made Mon 27 Oct 2014 15:12:13 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: (28 commits)
  aio / timers: De-document -clock
  hw/scsi/virtio-scsi.c: fix the "type" use error in virtio_scsi_handle_ctrl
  virtio-scsi: sense in virtio_scsi_command_complete
  target-i386: add Intel AVX-512 support
  get_maintainer.pl: restrict cases where it falls back to --git
  get_maintainer.pl: move git loop under "if ($email) {"
  qtest: fix qtest log fd should be initialized before qtest chardev
  MAINTAINERS: avoid M entries that point to mailing lists
  MAINTAINERS: add some tests directories
  MAINTAINERS: Add more TCG files
  MAINTAINERS: add myself for X86
  MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer
  MAINTAINERS: grab more files from Anthony's pile
  target-i386: warns users when CPU threads>1 for non-Intel CPUs
  sysbus: Use TYPE_DEVICE GPIO functionality
  qdev: gpio: Define qdev_pass_gpios()
  qdev: gpio: Remove qdev_init_gpio_out x1 restriction
  qdev: gpio: delete NamedGPIOList::out
  irq: Remove qemu_irq_intercept_out
  qtest/irq: Rework IRQ interception
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agovirtio: link the rng backend through an alias property
Paolo Bonzini [Wed, 29 Oct 2014 10:17:19 +0000 (11:17 +0100)]
virtio: link the rng backend through an alias property

The virtio-rng backend is currently linked twice, once in the proxy
device (e.g. virtio-rng-pci) and once in virtio-rng-device.  This causes
a double unref of the backend when the parent device is unplugged.

To fix this, make the proxy device use an alias, similar to what is
already being done for the iothread link.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Message-id: 1414577839-18695-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agovmware-vga: use vmsvga_verify_rect in vmsvga_fill_rect
Gerd Hoffmann [Mon, 6 Oct 2014 09:59:51 +0000 (11:59 +0200)]
vmware-vga: use vmsvga_verify_rect in vmsvga_fill_rect

Add verification to vmsvga_fill_rect, re-enable HW_FILL_ACCEL.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Don Koch <dkoch@verizon.com>
9 years agovmware-vga: use vmsvga_verify_rect in vmsvga_copy_rect
Gerd Hoffmann [Mon, 6 Oct 2014 09:58:51 +0000 (11:58 +0200)]
vmware-vga: use vmsvga_verify_rect in vmsvga_copy_rect

Add verification to vmsvga_copy_rect, re-enable HW_RECT_ACCEL.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Don Koch <dkoch@verizon.com>
9 years agovnc: return directly if no vnc client connected
ChenLiang [Mon, 29 Sep 2014 07:00:40 +0000 (15:00 +0800)]
vnc: return directly if no vnc client connected

graphic_hw_update and vnc_refresh_server_surface aren't
need to do when no vnc client connected. It can reduce
lock contention, because vnc_refresh will hold global big
lock two millisecond every three seconds.

Signed-off-by: ChenLiang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovnc: sanitize bits_per_pixel from the client
Petr Matousek [Mon, 27 Oct 2014 11:41:44 +0000 (12:41 +0100)]
vnc: sanitize bits_per_pixel from the client

bits_per_pixel that are less than 8 could result in accessing
non-initialized buffers later in the code due to the expectation
that bytes_per_pixel value that is used to initialize these buffers is
never zero.

To fix this check that bits_per_pixel from the client is one of the
values that the rfb protocol specification allows.

This is CVE-2014-7815.

Signed-off-by: Petr Matousek <pmatouse@redhat.com>
[ kraxel: apply codestyle fix ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agouhci: remove useless DEBUG
Gonglei [Mon, 27 Oct 2014 10:20:17 +0000 (18:20 +0800)]
uhci: remove useless DEBUG

commit 50dcc0f8 (uhci: tracing support) had removed
DPRINTF, the DEBUG marco is useless now, remove it.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoxhci: add property to turn on/off streams support
Gerd Hoffmann [Tue, 21 Oct 2014 10:29:33 +0000 (12:29 +0200)]
xhci: add property to turn on/off streams support

streams support in usb-redir and usb-host works only with recent enough
versions of the support libraries (libusbredir and libusbx).  Failure
mode is rather unelegant:  Any stream usb transfers will throw stall
errors.  Turning off support for streams in the xhci host controller
will work better as the guest can figure beforehand that streams are
not going to work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agolibcacard: don't free sign buffer while sign op is pending
Ray Strode [Sun, 19 Oct 2014 02:12:49 +0000 (22:12 -0400)]
libcacard: don't free sign buffer while sign op is pending

commit 57f97834efe0c208ffadc9d2959f3d3d55580e52 cleaned up
the cac_applet_pki_process_apdu function to have a single
exit point. Unfortunately, that commit introduced a bug
where the sign buffer can get free'd and nullified while
it's still being used.

This commit corrects the bug by introducing a boolean to
track whether or not the sign buffer should be freed in
the function exit path.

Signed-off-by: Ray Strode <rstrode@redhat.com>
Reviewed-by: Alon Levy <alon@pobox.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agolibcacard: Lock NSS cert db when selecting an applet on an emulated card
Ray Strode [Sun, 19 Oct 2014 02:12:48 +0000 (22:12 -0400)]
libcacard: Lock NSS cert db when selecting an applet on an emulated card

When a process in a guest uses an emulated smartcard, libcacard running
on the host passes the PIN from the guest to the PK11_Authenticate NSS
function. The first time PK11_Authenticate is called the passed in PIN
is used to unlock the certificate database. Subsequent calls to
PK11_Authenticate will transparently succeed, regardless of the passed in
PIN. This is a convenience for applications provided by NSS.

Of course, the guest may have many applications using the one emulated
smart card all driven from the same host QEMU process.  That means if a
user enters the right PIN in one program in the guest, and then enters the
wrong PIN in another program in the guest, the wrong PIN will still
successfully unlock the virtual smartcard.

This commit forces the NSS certificate database to be locked anytime an
applet is selected on an emulated smartcard by calling vcard_emul_logout.

Signed-off-by: Ray Strode <rstrode@redhat.com>
Reviewed-By: Robert Relyea <rrelyea@redhat.com>
Reviewed-By: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agolibcacard: introduce new vcard_emul_logout
Ray Strode [Sun, 19 Oct 2014 02:12:47 +0000 (22:12 -0400)]
libcacard: introduce new vcard_emul_logout

vcard_emul_reset currently only logs NSS out, but there is a TODO
for potentially sending insertion/removal events when powering down
or powering up.

For clarity, this commit moves the current guts of vcard_emul_reset to
a new vcard_emul_logout function which will never send insertion/removal
events. The vcard_emul_reset function now just calls vcard_emul_logout,
but also retains its TODO for watching power state transitions and sending
insertion/removal events.

Signed-off-by: Ray Strode <rstrode@redhat.com>
Reviewed-By: Robert Relyea <rrelyea@redhat.com>
Reviewed-By: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agogtk: avoid gd_widget_reparent with gtk 3.14+
Gerd Hoffmann [Thu, 23 Oct 2014 15:21:00 +0000 (17:21 +0200)]
gtk: avoid gd_widget_reparent with gtk 3.14+

gtk_widget_reparent is depricated in gtk 3.14, stop using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agogtk: drop gtk_widget_set_double_buffered call
Gerd Hoffmann [Thu, 23 Oct 2014 13:29:37 +0000 (15:29 +0200)]
gtk: drop gtk_widget_set_double_buffered call

Dunno why it is here.  Removing it seems to have no ill side effects.
It is depricated in 3.14+.  In some cases it has no effect since 3.10
according to the docs:

https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-double-buffered

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovmware-vga: use vmsvga_verify_rect in vmsvga_update_rect
Gerd Hoffmann [Mon, 6 Oct 2014 09:58:22 +0000 (11:58 +0200)]
vmware-vga: use vmsvga_verify_rect in vmsvga_update_rect

Switch vmsvga_update_rect over to use vmsvga_verify_rect.  Slight change
in behavior:  We don't try to automatically fixup rectangles any more.
In case we find invalid update requests we'll do a full-screen update
instead.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Don Koch <dkoch@verizon.com>
9 years agovmware-vga: add vmsvga_verify_rect
Gerd Hoffmann [Mon, 6 Oct 2014 09:51:54 +0000 (11:51 +0200)]
vmware-vga: add vmsvga_verify_rect

Add verification function for rectangles, returning
true if verification passes and false otherwise.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Don Koch <dkoch@verizon.com>
9 years agovmware-vga: CVE-2014-3689: turn off hw accel
Gerd Hoffmann [Mon, 6 Oct 2014 09:42:34 +0000 (11:42 +0200)]
vmware-vga: CVE-2014-3689: turn off hw accel

Quick & easy stopgap for CVE-2014-3689:  We just compile out the
hardware acceleration functions which lack sanity checks.  Thankfully
we have capability bits for them (SVGA_CAP_RECT_COPY and
SVGA_CAP_RECT_FILL), so guests should deal just fine, in theory.

Subsequent patches will add the missing checks and re-enable the
hardware acceleration emulation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Don Koch <dkoch@verizon.com>
9 years agoaio / timers: De-document -clock
Markus Armbruster [Mon, 6 Oct 2014 14:19:07 +0000 (16:19 +0200)]
aio / timers: De-document -clock

Commit 6d32717 "aio / timers: Remove alarm timers" has issues:

1. It silently ignores -clock for backward compatibility.
Incompatible change: -clock help no longer terminates the program.
Tolerable.

2. Failed to update option documentation.  In particular, -help still
advises users to try -clock help for available timers.  Drop all
documentation on -clock.

3. The 'query-alarm-clock' example in docs/writing-commands.txt no
longer works, and needs to be redone.  Can't do that right now, so I
just stick in a FIXME.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agohw/scsi/virtio-scsi.c: fix the "type" use error in virtio_scsi_handle_ctrl
Bin Wu [Sat, 25 Oct 2014 02:43:44 +0000 (02:43 +0000)]
hw/scsi/virtio-scsi.c: fix the "type" use error in virtio_scsi_handle_ctrl

The local variable "type" in virtio_scsi_handle_ctl represents the tmf
command type from the guest and it has the same meaning as the
req->req.tmf.type. However, before the invoking of virtio_scsi_parse_req
the req->req.tmf.type doesn't has the correct value(just initialized to
zero). Therefore, we need to use the "type" variable to judge the case.

Cc: qemu-stable@nongnu.org
Signed-off-by: Bin Wu <wu.wubin@huawei.com>
[Actually make it compile, "type" must be uint32_t in order to pass
 it to virtio_tswap32s. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agovirtio-scsi: sense in virtio_scsi_command_complete
Ting Wang [Mon, 27 Oct 2014 08:51:41 +0000 (16:51 +0800)]
virtio-scsi: sense in virtio_scsi_command_complete

If req->resp.cmd.status is not GOOD, the address of sense for
qemu_iovec_from_buf should be modified from &req->resp to sense.

Cc: qemu-stable@nongnu.org
Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoRevert "main-loop.c: Handle SIGINT, SIGHUP and SIGTERM synchronously"
Jan Kiszka [Mon, 27 Oct 2014 14:13:02 +0000 (14:13 +0000)]
Revert "main-loop.c: Handle SIGINT, SIGHUP and SIGTERM synchronously"

This reverts commit 15124e142034d21341ec9f1a304a1dc5a6c25681. It breaks
debuggability of qemu and is no longer needed as the problem has
now been addressed in a different way.

Instead we provide a comment about why these signals must be
handled asynchronously.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
[PMM: added comment]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMake qemu_shutdown_requested signal-safe
Jan Kiszka [Mon, 27 Oct 2014 14:05:10 +0000 (14:05 +0000)]
Make qemu_shutdown_requested signal-safe

qemu_shutdown_requested may be interrupted by qemu_system_killed. If the
latter sets shutdown_requested after qemu_shutdown_requested has read it
but before it was cleared, the shutdown event is lost. Fix this by using
atomic_xchg.

This provides a different fix for the problem which commit 15124e142
attempts to deal with. That commit breaks use of ^C to drop into gdb,
and so this approach is better (and 15124e142 can be reverted).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
[PMM: commit message tweak]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-i386: add Intel AVX-512 support
Chao Peng [Thu, 23 Oct 2014 03:02:43 +0000 (11:02 +0800)]
target-i386: add Intel AVX-512 support

Add AVX512 feature bits, register definition and corresponding
xsave/vmstate support.

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMAINTAINERS: add myself under 'general project admin' section
Peter Maydell [Wed, 15 Oct 2014 20:30:52 +0000 (21:30 +0100)]
MAINTAINERS: add myself under 'general project admin' section

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1413405052-4527-1-git-send-email-peter.maydell@linaro.org

9 years agoMAINTAINERS: add myself as MIPS guest cores co-maintainer
Leon Alrae [Thu, 16 Oct 2014 11:38:07 +0000 (12:38 +0100)]
MAINTAINERS: add myself as MIPS guest cores co-maintainer

Add myself to the maintainer list for MIPS guest cores and update the status
from "Odd Fixes" to "Maintained".

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Message-id: 1413459487-13658-1-git-send-email-leon.alrae@imgtec.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-mips: add ULL suffix in bitswap to avoid compiler warning
Leon Alrae [Wed, 22 Oct 2014 13:00:29 +0000 (14:00 +0100)]
target-mips: add ULL suffix in bitswap to avoid compiler warning

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Message-id: 1413982829-27225-1-git-send-email-leon.alrae@imgtec.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20141024' into...
Peter Maydell [Fri, 24 Oct 2014 11:40:28 +0000 (12:40 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20141024' into staging

target-arm queue:
 * remove pointless 'info pcmcia' and a lot of now-dead code
 * register ARM cpu reset handlers even if not using -kernel
 * update to libvixl 1.6
 * various minor code cleanups
 * support PSCI under TCG ('virt' machine can now be shut down,
   SMP configurations work)
 * correct the sense of the AArch64 DCZID DZP bit
 * report a valid L1Ip field in CTR_EL0 for CPU type "any"
 * correctly UNDEF writes to FPINST/FPINST2 from EL0
 * more preparatory code refactoring for EL2/EL3 support

# gpg: Signature made Fri 24 Oct 2014 12:35:52 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20141024: (23 commits)
  target-arm: A32: Emulate the SMC instruction
  target-arm: make arm_current_el() return EL3
  target-arm: rename arm_current_pl to arm_current_el
  target-arm: reject switching to monitor mode
  target-arm: add arm_is_secure() function
  target-arm: increase arrays of registers R13 & R14
  target-arm: correctly UNDEF writes to FPINST/FPINST2 from EL0
  target-arm: Report a valid L1Ip field in CTR_EL0 for CPU type "any"
  target-arm: Correct sense of the DCZID DZP bit
  arm/virt: enable PSCI emulation support for system emulation
  target-arm: add emulation of PSCI calls for system emulation
  target-arm: Add support for A32 and T32 HVC and SMC insns
  target-arm: Handle SMC/HVC undef-if-no-ELx in pre_* helpers
  target-arm: add missing PSCI constants needed for PSCI emulation
  target-arm: do not set do_interrupt handlers for ARM and AArch64 user modes
  target-arm: add powered off cpu state
  omap_gpmc.c: Remove duplicate assignment
  disas/libvixl/a64/instructions-a64.h: Remove unused constants
  arm_gic: remove unused parameter.
  disas/libvixl: Update to libvixl 1.6
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: A32: Emulate the SMC instruction
Fabian Aggeler [Fri, 24 Oct 2014 11:19:15 +0000 (12:19 +0100)]
target-arm: A32: Emulate the SMC instruction

Implements SMC instruction in AArch32 using the A32 syndrome. When executing
SMC instruction from monitor CPU mode SCR.NS bit is reset.

Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com>
Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Message-id: 1413910544-20150-7-git-send-email-greg.bellows@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: make arm_current_el() return EL3
Fabian Aggeler [Fri, 24 Oct 2014 11:19:14 +0000 (12:19 +0100)]
target-arm: make arm_current_el() return EL3

Make arm_current_el() return EL3 for secure PL1 and monitor mode.
Increase MMU modes since mmu_index is directly inferred from arm_
current_el(). Change assertion in arm_el_is_aa64() to allow EL3.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1413910544-20150-6-git-send-email-greg.bellows@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: rename arm_current_pl to arm_current_el
Greg Bellows [Fri, 24 Oct 2014 11:19:14 +0000 (12:19 +0100)]
target-arm: rename arm_current_pl to arm_current_el

Renamed the arm_current_pl CPU function to more accurately represent that it
returns the ARMv8 EL rather than ARMv7 PL.

Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1413910544-20150-5-git-send-email-greg.bellows@linaro.org
[PMM: fixed a minor merge resolution error in a couple of hunks]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: reject switching to monitor mode
Sergey Fedorov [Fri, 24 Oct 2014 11:19:14 +0000 (12:19 +0100)]
target-arm: reject switching to monitor mode

Reject switching to monitor mode from non-secure state.

Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com>
Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1413910544-20150-4-git-send-email-greg.bellows@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: add arm_is_secure() function
Fabian Aggeler [Fri, 24 Oct 2014 11:19:14 +0000 (12:19 +0100)]
target-arm: add arm_is_secure() function

arm_is_secure() function allows to determine CPU security state
if the CPU implements Security Extensions/EL3.
arm_is_secure_below_el3() returns true if CPU is in secure state
below EL3.

Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com>
Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1413910544-20150-3-git-send-email-greg.bellows@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: increase arrays of registers R13 & R14
Fabian Aggeler [Fri, 24 Oct 2014 11:19:14 +0000 (12:19 +0100)]
target-arm: increase arrays of registers R13 & R14

Increasing banked_r13 and banked_r14 to store LR_mon and SP_mon (bank
index 7).

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1413910544-20150-2-git-send-email-greg.bellows@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: correctly UNDEF writes to FPINST/FPINST2 from EL0
Peter Maydell [Fri, 24 Oct 2014 11:19:14 +0000 (12:19 +0100)]
target-arm: correctly UNDEF writes to FPINST/FPINST2 from EL0

The ARM ARM requires that the FPINST and FPINST2 VFP control
registers are not accessible to code at EL0. We were already
correctly implementing this for reads of these registers; add
the missing check for the write code path.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 1412967447-20931-1-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: Report a valid L1Ip field in CTR_EL0 for CPU type "any"
Peter Maydell [Fri, 24 Oct 2014 11:19:13 +0000 (12:19 +0100)]
target-arm: Report a valid L1Ip field in CTR_EL0 for CPU type "any"

For the CPU type "any" (only used with linux-user) we were reporting
the L1Ip field as 0b00, which is reserved. Change this field to 0b10
instead, indicating a VIPT icache as the comment describes.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Message-id: 1412966807-20844-1-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: Correct sense of the DCZID DZP bit
Peter Maydell [Fri, 24 Oct 2014 11:19:13 +0000 (12:19 +0100)]
target-arm: Correct sense of the DCZID DZP bit

The DZP bit in the DCZID system register should be set if
the control bits which prohibit use of the DC ZVA instruction
have been set (it stands for Data Zero Prohibited). However
we had the sense of the test inverted; fix this so that the
bit reads correctly.

To avoid this regressing the behaviour of the user-mode
emulator, we must set the DZE bit in the SCTLR for that
config so that userspace continues to see DZP as zero (it
was getting the correct result by accident previously).

Reported-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Message-id: 1412959792-20708-1-git-send-email-peter.maydell@linaro.org

9 years agoarm/virt: enable PSCI emulation support for system emulation
Rob Herring [Fri, 24 Oct 2014 11:19:13 +0000 (12:19 +0100)]
arm/virt: enable PSCI emulation support for system emulation

Now that we have PSCI emulation, enable it for the virt platform.
This simplifies the virt machine a bit now that PSCI no longer
needs to be a KVM only feature.

Signed-off-by: Rob Herring <rob.herring@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412865028-17725-8-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: add emulation of PSCI calls for system emulation
Rob Herring [Fri, 24 Oct 2014 11:19:13 +0000 (12:19 +0100)]
target-arm: add emulation of PSCI calls for system emulation

Add support for handling PSCI calls in system emulation. Both version
0.1 and 0.2 of the PSCI spec are supported. Platforms can enable support
by setting the "psci-conduit" QOM property on the cpus to SMC or HVC
emulation and having a PSCI binding in their dtb.

Signed-off-by: Rob Herring <rob.herring@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412865028-17725-7-git-send-email-peter.maydell@linaro.org
[PMM: made system reset/off PSCI functions power down the CPU so
 we obey the PSCI API requirement never to return from them;
 rearranged how the code is plumbed into the exception system,
 so that we split "is this a valid call?" from "do the call"]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-arm: Add support for A32 and T32 HVC and SMC insns
Peter Maydell [Fri, 24 Oct 2014 11:19:13 +0000 (12:19 +0100)]
target-arm: Add support for A32 and T32 HVC and SMC insns

Add support for HVC and SMC instructions to the A32 and
T32 decoder. Using these for real exceptions to EL2 or EL3
is currently not supported (the do_interrupt routine does
not handle them) but we require the instruction support to
implement PSCI.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412865028-17725-6-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: Handle SMC/HVC undef-if-no-ELx in pre_* helpers
Peter Maydell [Fri, 24 Oct 2014 11:19:12 +0000 (12:19 +0100)]
target-arm: Handle SMC/HVC undef-if-no-ELx in pre_* helpers

SMC must UNDEF if EL3 is not implemented; similarly HVC UNDEFs
if EL2 is not implemented. Move the handling of this from
translate-a64.c into the pre_smc and pre_hvc helper functions.
This is necessary because use of these instructions for PSCI
takes precedence over this UNDEF case, and we can't tell if
this is a PSCI call until runtime.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412865028-17725-5-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: add missing PSCI constants needed for PSCI emulation
Ard Biesheuvel [Fri, 24 Oct 2014 11:19:12 +0000 (12:19 +0100)]
target-arm: add missing PSCI constants needed for PSCI emulation

This adds some PSCI function IDs and symbolic return codes that are needed
to implement PSCI emulation in TCG mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412865028-17725-4-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: do not set do_interrupt handlers for ARM and AArch64 user modes
Rob Herring [Fri, 24 Oct 2014 11:19:12 +0000 (12:19 +0100)]
target-arm: do not set do_interrupt handlers for ARM and AArch64 user modes

User mode emulation should never get interrupts and thus should not
use the system emulation exception handler function. Remove the reference,
and '#ifndef USER_MODE_ONLY' the function itself as well, so that we can add
system mode only functionality to it.

Signed-off-by: Rob Herring <rob.herring@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412865028-17725-3-git-send-email-peter.maydell@linaro.org

9 years agotarget-arm: add powered off cpu state
Rob Herring [Fri, 24 Oct 2014 11:19:12 +0000 (12:19 +0100)]
target-arm: add powered off cpu state

Add tracking of cpu power state in order to support powering off of
cores in system emuluation. The initial state is determined by the
start-powered-off QOM property.

Signed-off-by: Rob Herring <rob.herring@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412865028-17725-2-git-send-email-peter.maydell@linaro.org

9 years agoomap_gpmc.c: Remove duplicate assignment
Dr. David Alan Gilbert [Fri, 24 Oct 2014 11:19:12 +0000 (12:19 +0100)]
omap_gpmc.c: Remove duplicate assignment

This looks like an old merge error and should have no effect.
(Build tested only)

Found by Coccinelle using Julia Lawall's script:
https://lkml.org/lkml/2014/8/23/128

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: 1414055855-6688-1-git-send-email-dgilbert@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agodisas/libvixl/a64/instructions-a64.h: Remove unused constants
Chen Gang [Fri, 24 Oct 2014 11:19:12 +0000 (12:19 +0100)]
disas/libvixl/a64/instructions-a64.h: Remove unused constants

The instructions-a64.h header defines a number of floating point
constants whose initializers are function calls. gcc 5 will warn
if these constants are not used by the C or C++ file which includes
the header, because they imply a runtime cost. Since for the files
QEMU uses from libvixl we don't use these constants at all, just
remove them.

Upstream intend to fix these by shifting to an 'extern const' in
the header plus definition in a suitable source file, so we can
drop this patch when we sync with the upcoming libvixl 1.7.

The related compiling error:

    CXX   disas/arm-a64.o
  In file included from /upstream/qemu/disas/libvixl/a64/disasm-a64.h:32:0,
                   from disas/arm-a64.cc:20:
  disas/libvixl/a64/instructions-a64.h:98:13: error: 'vixl::kFP32PositiveInfinity' defined but not used [-Werror=unused-variable]
   const float kFP32PositiveInfinity = rawbits_to_float(0x7f800000);
               ^
  disas/libvixl/a64/instructions-a64.h:99:13: error: 'vixl::kFP32NegativeInfinity' defined but not used [-Werror=unused-variable]
   const float kFP32NegativeInfinity = rawbits_to_float(0xff800000);
               ^
  disas/libvixl/a64/instructions-a64.h:100:14: error: 'vixl::kFP64PositiveInfinity' defined but not used [-Werror=unused-variable]
   const double kFP64PositiveInfinity =
                ^
  disas/libvixl/a64/instructions-a64.h:102:14: error: 'vixl::kFP64NegativeInfinity' defined but not used [-Werror=unused-variable]
   const double kFP64NegativeInfinity =
                ^
  disas/libvixl/a64/instructions-a64.h:107:21: error: 'vixl::kFP64SignallingNaN' defined but not used [-Werror=unused-variable]
   static const double kFP64SignallingNaN =
                       ^
  disas/libvixl/a64/instructions-a64.h:109:20: error: 'vixl::kFP32SignallingNaN' defined but not used [-Werror=unused-variable]
   static const float kFP32SignallingNaN = rawbits_to_float(0x7f800001);
                      ^
  disas/libvixl/a64/instructions-a64.h:112:21: error: 'vixl::kFP64QuietNaN' defined but not used [-Werror=unused-variable]
   static const double kFP64QuietNaN =
                       ^
  disas/libvixl/a64/instructions-a64.h:114:20: error: 'vixl::kFP32QuietNaN' defined but not used [-Werror=unused-variable]
   static const float kFP32QuietNaN = rawbits_to_float(0x7fc00001);
                      ^
  disas/libvixl/a64/instructions-a64.h:117:21: error: 'vixl::kFP64DefaultNaN' defined but not used [-Werror=unused-variable]
   static const double kFP64DefaultNaN =
                       ^
  disas/libvixl/a64/instructions-a64.h:119:20: error: 'vixl::kFP32DefaultNaN' defined but not used [-Werror=unused-variable]
   static const float kFP32DefaultNaN = rawbits_to_float(0x7fc00000);
                      ^
  cc1plus: all warnings being treated as errors
  make: *** [disas/arm-a64.o] Error 1

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
[PMM: Rewrote the commit message a little]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoarm_gic: remove unused parameter.
KONRAD Frederic [Fri, 24 Oct 2014 11:19:11 +0000 (12:19 +0100)]
arm_gic: remove unused parameter.

This removes num_irq parameter from gic_init_irqs_and_distributor as it is not
used.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1412859651-15060-1-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agodisas/libvixl: Update to libvixl 1.6
Peter Maydell [Fri, 24 Oct 2014 11:19:11 +0000 (12:19 +0100)]
disas/libvixl: Update to libvixl 1.6

Update our copy of libvixl to upstream 1.6. There are no
changes of any particular interest to QEMU, so this is simply
keeping up with current upstream.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1412091418-25744-1-git-send-email-peter.maydell@linaro.org

9 years agohw/arm/boot: register cpu reset handlers if using -bios
Ard Biesheuvel [Fri, 24 Oct 2014 11:19:11 +0000 (12:19 +0100)]
hw/arm/boot: register cpu reset handlers if using -bios

Move the registering of CPU reset handlers to before the point where
we leave the function in the -bios (not -kernel) case, so CPU reset
works correctly with -bios as well.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt: mark timer in fdt as v8-compatible
Claudio Fontana [Fri, 24 Oct 2014 11:19:11 +0000 (12:19 +0100)]
hw/arm/virt: mark timer in fdt as v8-compatible

check if the first cpu is an armv8 cpu, and if so, put
arm,armv8-timer in the compatible string list.

Note that due to this check, this patch moves the creation
of the timer fdt node to after the cpu creation loop.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Message-id: 1411736960-24206-1-git-send-email-hw.claudio@gmail.com
[PMM: updated to list arm,armv8-timer first]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohmp: Remove "info pcmcia"
Markus Armbruster [Fri, 24 Oct 2014 11:19:11 +0000 (12:19 +0100)]
hmp: Remove "info pcmcia"

This command lists PCMCIA sockets and cards.  Only a few ARM boards
have sockets (akita, borzoi, connex, mainstone, spitz, terrier, tosa,
verdex, z2), the only card is the DSCM-1xxxx Hitachi Microdrive (qdev
"microdrive"), and it is only inserted during machine init, if ever.
So this command doesn't really tell anybody anything new so far.

Moreover, pcmcia_socket_unregister() has a use-after-free bug, flagged
by Coverity.  Has never been used, because there has never been code
to eject a PCMCIA card.

Not worth fixing & converting to QMP.  Remove it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
Message-id: 1411144812-22958-1-git-send-email-armbru@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 24 Oct 2014 10:33:46 +0000 (11:33 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches

# gpg: Signature made Thu 23 Oct 2014 18:56:05 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (32 commits)
  qemu-img: Print error if check failed
  block: char devices on FreeBSD are not behind a pager
  iotests: Add test for qcow2 L1 table update
  qcow2: Do not overflow when writing an L1 sector
  iotests: Add test for map commands
  qemu-io: Respect early image end for map
  block: Respect underlying file's EOF
  docs/qcow2: Limit refcount_order to [0, 6]
  docs/qcow2: Correct refcount_block_entries
  qcow2: Drop REFCOUNT_SHIFT
  iotests: Add test for potentially damaging repairs
  iotests: Fix test outputs
  qcow2: Clean up after refcount rebuild
  qcow2: Rebuild refcount structure during check
  qcow2: Do not perform potentially damaging repairs
  qcow2: Fix refcount blocks beyond image end
  qcow2: Reuse refcount table in calculate_refcounts()
  qcow2: Let inc_refcounts() resize the reftable
  qcow2: Let inc_refcounts() return -errno
  qcow2: Split fail code in L1 and L2 checks
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'mreitz/block' into queue-block
Kevin Wolf [Thu, 23 Oct 2014 17:55:55 +0000 (19:55 +0200)]
Merge remote-tracking branch 'mreitz/block' into queue-block

* mreitz/block:
  qemu-img: Print error if check failed
  block: char devices on FreeBSD are not behind a pager

9 years agoqemu-img: Print error if check failed
Max Reitz [Thu, 23 Oct 2014 13:29:12 +0000 (15:29 +0200)]
qemu-img: Print error if check failed

Currently, if bdrv_check() fails either by returning -errno or having
check_errors set, qemu-img check just exits with 1 after having told the
user that there were no errors on the image. This is bad.

Instead of printing the check result if there were internal errors which
were so bad that bdrv_check() could not even complete with 0 as a return
value, qemu-img check should inform the user about the error.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging
Peter Maydell [Thu, 23 Oct 2014 16:05:15 +0000 (17:05 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging

QMP patches

# gpg: Signature made Thu 23 Oct 2014 16:05:52 BST using RSA key ID E24ED5A7
# gpg: Good signature from "Luiz Capitulino <lcapitulino@gmail.com>"

* remotes/qmp-unstable/tags/for-upstream:
  monitor: delete device_del_bus_completion
  monitor: add del completion for peripheral device
  qdev: add qdev_build_hotpluggable_device_list helper
  MAINTAINERS: add entry for qobject files
  dump: Turn some functions to void to make code cleaner
  dump: Propagate errors into qmp_dump_guest_memory()
  virtio-balloon: Tweak recent fix for integer overflow

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoblock: char devices on FreeBSD are not behind a pager
Roger Pau Monne [Tue, 21 Oct 2014 14:03:03 +0000 (16:03 +0200)]
block: char devices on FreeBSD are not behind a pager

Introduce a new flag to mark devices that require requests to be aligned and
replace the usage of BDRV_O_NOCACHE and O_DIRECT with this flag when
appropriate.

If a character device is used as a backend on a FreeBSD host set this flag
unconditionally.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
9 years agoget_maintainer.pl: restrict cases where it falls back to --git
Paolo Bonzini [Wed, 22 Oct 2014 08:41:16 +0000 (10:41 +0200)]
get_maintainer.pl: restrict cases where it falls back to --git

The list emitted by --git-fallback often leads inexperienced contributors
to add pointless CCs.  While not discouraging usage of --git-fallback,
we want to:

1) disable the fallback if only some files lack a maintainer

    $ scripts/get_maintainer.pl -f util/cutils.c hw/ide/core.c
    Kevin Wolf <kwolf@redhat.com> (odd fixer:IDE)
    Stefan Hajnoczi <stefanha@redhat.com> (odd fixer:IDE)

This behavior is taken even if --git-fallback is specified.

2) warn the contributors about what we're doing, asking them to use their
common sense:

    $ scripts/get_maintainer.pl -f util/cutils.c
    get_maintainer.pl: No maintainers found, printing recent contributors.
    get_maintainer.pl: Do not blindly cc: them on patches!  Use common sense.

    Luiz Capitulino <lcapitulino@redhat.com> (commit_signer:1/2=50%)
    ...
    $

Explicitly disabling the fallback will not result in the warning message:

    $ scripts/get_maintainer.pl -f util/cutils.c   --no-git-fallback
    $ echo $?
    0

(Returning 1 would break usage of scripts/get_maintainer.pl as a cccmd
for git-send-email).

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoget_maintainer.pl: move git loop under "if ($email) {"
Paolo Bonzini [Wed, 22 Oct 2014 08:38:27 +0000 (10:38 +0200)]
get_maintainer.pl: move git loop under "if ($email) {"

All checks in the loop are guarded by that condition, and there is a
handy "if" just below.  Simplify the code.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoqtest: fix qtest log fd should be initialized before qtest chardev
Li Liu [Wed, 22 Oct 2014 02:26:47 +0000 (10:26 +0800)]
qtest: fix qtest log fd should be initialized before qtest chardev

qtest_log_fp should be inited before qemu_chr_add_handlers.
If not the log dumped from callback functions may be lost.

easy to reproduce it by command:
"QTEST_LOG=1 QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64
gtester -k --verbose -m=quick tests/qdev-monitor-test"

The log "[I xxxxxx] OPENED" should be printed out by
qtest_event, but does not.

Signed-off-by: Li Liu <john.liuli@huawei.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMAINTAINERS: avoid M entries that point to mailing lists
Paolo Bonzini [Wed, 22 Oct 2014 08:53:22 +0000 (10:53 +0200)]
MAINTAINERS: avoid M entries that point to mailing lists

"L" entries that point to qemu-devel are not much better either, but at least
the get_maintainer.pl output is clearer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMAINTAINERS: add some tests directories
Paolo Bonzini [Tue, 21 Oct 2014 22:31:28 +0000 (00:31 +0200)]
MAINTAINERS: add some tests directories

Low-hanging fruit...

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMAINTAINERS: Add more TCG files
Paolo Bonzini [Tue, 21 Oct 2014 22:18:01 +0000 (00:18 +0200)]
MAINTAINERS: Add more TCG files

Unfortunately, TCG files do not really have a maintainer yet.
But at least there will be fewer unmaintained files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMAINTAINERS: add myself for X86
Paolo Bonzini [Tue, 21 Oct 2014 13:16:06 +0000 (15:16 +0200)]
MAINTAINERS: add myself for X86

Still not moving it beyond "Odd fixes".  Richard Henderson also has
reviewed a bunch of X86 TCG patches, so add him as well.  All we want
is to avoid that patches fall on the floor.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer
Paolo Bonzini [Wed, 22 Oct 2014 12:53:32 +0000 (14:53 +0200)]
MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainer

He wrote "I've written mostly all of usb-serial.c and baum.c, and keep
maintaining them, since I use them regularly."

Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMAINTAINERS: grab more files from Anthony's pile
Paolo Bonzini [Tue, 21 Oct 2014 13:12:57 +0000 (15:12 +0200)]
MAINTAINERS: grab more files from Anthony's pile

I am picking up character devices and the main loop, as agreed during
QEMU Summit.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agotarget-i386: warns users when CPU threads>1 for non-Intel CPUs
Wei Huang [Tue, 21 Oct 2014 15:00:45 +0000 (11:00 -0400)]
target-i386: warns users when CPU threads>1 for non-Intel CPUs

Only Intel CPUs support hyperthreading. When users select threads>1 in
-smp option, QEMU fixes it by adjusting CPUID_0000_0001_EBX and
CPUID_8000_0008_ECX based on inputs (sockets, cores, threads);
so guest VM can boot correctly. However it is still better to gives
users a warning when such case happens.

Signed-off-by: Wei Huang <wei@redhat.com>
[As suggested by Eduardo, check for !IS_INTEL instead of AMD. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agosysbus: Use TYPE_DEVICE GPIO functionality
Peter Crosthwaite [Fri, 26 Sep 2014 05:24:15 +0000 (22:24 -0700)]
sysbus: Use TYPE_DEVICE GPIO functionality

Re-implement the Sysbus GPIOs to use the existing TYPE_DEVICE
GPIO named framework. A constant string name is chosen to avoid
conflicts with existing unnamed GPIOs.

This unifies GPIOs are IRQs for sysbus devices and allows removal
of all Sysbus state for GPIOs.

Any existing and future-added functionality for GPIOs is now
also available for sysbus IRQs.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoqdev: gpio: Define qdev_pass_gpios()
Peter Crosthwaite [Fri, 26 Sep 2014 05:23:42 +0000 (22:23 -0700)]
qdev: gpio: Define qdev_pass_gpios()

Allows a container to take ownership of GPIOs in a contained
device and automatically connect them as GPIOs to the container.

This prepares for deprecation of the SYSBUS IRQ functionality, which
has this feature. We push it up to the device level instead of sysbus
level. There's nothing sysbus specific about passing GPIOs to
containers so its a legitimate device-level generic feature.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoqdev: gpio: Remove qdev_init_gpio_out x1 restriction
Peter Crosthwaite [Fri, 26 Sep 2014 05:23:09 +0000 (22:23 -0700)]
qdev: gpio: Remove qdev_init_gpio_out x1 restriction

Previously this was restricted to a single call per-dev/per-name. With
the conversion of the GPIO output state to QOM the implementation can
now handle repeated calls. Remove the restriction.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>