Commit Graph

39030 Commits

Author SHA1 Message Date
Eduardo Habkost 38e5c119c2 target-i386: Register QOM properties for feature flags
This uses the feature name arrays to register QOM properties for feature
flags. This simply adds properties that can be configured using -global,
but doesn't change x86_cpu_parse_featurestr() to use them yet.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-06-02 15:15:52 -03:00
Zhu Guihua be9f8a0872 apic: convert ->busdev.qdev casts to C casts
Use C casts to avoid accessing ICCDevice's qdev field
directly.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-06-02 15:15:52 -03:00
Eduardo Habkost 458cf469f4 target-i386: Fix signedness of MSR_IA32_APICBASE_BASE
Existing definition triggers the following when using clang
-fsanitize=undefined:

    hw/intc/apic_common.c:314:55: runtime error: left shift of 1048575 by 12
        places cannot be represented in type 'int'

Fix it so we won't try to shift a 1 to the sign bit of a signed integer.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-06-02 15:15:52 -03:00
Andreas Färber 0e3bd56294 pc: Ensure non-zero CPU ref count after attaching to ICC bus
Setting the parent bus of a device increases its ref count, which we
ultimately want to level out. However it is only safe to do so after the
last reference to the device in local code, as qom-set or similar operations
might decrease the ref count.

Therefore move the object_unref() from pc_new_cpu() into its callers.

The APIC operations on the last CPU in pc_cpus_init() are still potentially
insecure, but that is beyond the scope of this code movement.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-06-02 15:15:52 -03:00
Peter Maydell 42d58e7c67 XSA 128 129 130 131
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJVbc/eAAoJEIlPj0hw4a6QGg8P/jUwi4GqK4cbKrTJpcCVJ3OW
 n87uvaTWqUOtx5c88KcTHJeu1B7CigNgJaNbbYcvmbuPt8Sjo+bUUYCvBi3cZHq0
 MOvdtbSX8KOK7R1Dal6Hf0S3gxxlfCpbys6Bu50SZcKeXYu6Gij0njHypxC8Y5NK
 P+JIAyWRrt+XeOO302dzX1KR8NirCLbzFYcglm4fETiGG5ucfeFqScYs8jrM4Mmg
 cd1MBAdDhRuazG6Q2p1HldruC6KgNArYBU0dxPbMlvrxaePVnq7hWQOLXM1n+7Ue
 rXA9eUHFLQqvqtipBHFjPgUIikP/gw+JkAltwnbunkfx1n9DtaF+HYRWMBTiDXwO
 tnKTOylXyC5GnMJlf6EkbH1esmmWReCVl3NYRFSWm8c5sJT1AvaVsIAiWStwcg0x
 4sPebrYEjWffCSDtgP2ooI7JIVKeefYUzJLpkpkEZQ2XGwaQKn7KVLUlCFdyEHgH
 FJMNt4KrYTUMzItGqzLv2H7qL4VyeT08HkZbYYXxvILnmSDUG+lNptQauNx0MnnN
 77SdVsEm0JyI9oBsOvECILOY+drI7IXDbxDqxhi2K3GOUOVwPWlWbylgcNXMtzRn
 df7o7u5iFg7JWWWHpnEbED+U3RRjJTWNwCLxVoOq5FzPD6MxaxYE57OZMFvQoLsv
 MMi/VoURdXahAKpQIphv
 =ThTq
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/sstabellini/tags/xen-15-06-02-tag' into staging

XSA 128 129 130 131

# gpg: Signature made Tue Jun  2 16:46:38 2015 BST using RSA key ID 70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"

* remotes/sstabellini/tags/xen-15-06-02-tag:
  xen/pt: unknown PCI config space fields should be read-only
  xen/pt: add a few PCI config space field descriptions
  xen/pt: mark reserved bits in PCI config space fields
  xen/pt: mark all PCIe capability bits read-only
  xen/pt: split out calculation of throughable mask in PCI config space handling
  xen/pt: correctly handle PM status bit
  xen/pt: consolidate PM capability emu_mask
  xen/MSI: don't open-code pass-through of enable bit modifications
  xen/MSI-X: limit error messages
  xen: don't allow guest to control MSI mask register
  xen: properly gate host writes of modified PCI CFG contents

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-02 16:47:31 +01:00
Jan Beulich c25bbf1545 xen/pt: unknown PCI config space fields should be read-only
... by default. Add a per-device "permissive" mode similar to pciback's
to allow restoring previous behavior (and hence break security again,
i.e. should be used only for trusted guests).

This is part of XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>)
2015-06-02 15:07:01 +00:00
Jan Beulich a88a3f8871 xen/pt: add a few PCI config space field descriptions
Since the next patch will turn all not explicitly described fields
read-only by default, those fields that have guest writable bits need
to be given explicit descriptors.

This is a preparatory patch for XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2015-06-02 15:07:01 +00:00
Jan Beulich 0ad3393ad0 xen/pt: mark reserved bits in PCI config space fields
The adjustments are solely to make the subsequent patches work right
(and hence make the patch set consistent), namely if permissive mode
(introduced by the last patch) gets used (as both reserved registers
and reserved fields must be similarly protected from guest access in
default mode, but the guest should be allowed access to them in
permissive mode).

This is a preparatory patch for XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2015-06-02 15:07:01 +00:00
Jan Beulich 45ebe3916a xen/pt: mark all PCIe capability bits read-only
xen_pt_emu_reg_pcie[]'s PCI_EXP_DEVCAP needs to cover all bits as read-
only to avoid unintended write-back (just a precaution, the field ought
to be read-only in hardware).

This is a preparatory patch for XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-06-02 15:07:01 +00:00
Jan Beulich 0e7ef22136 xen/pt: split out calculation of throughable mask in PCI config space handling
This is just to avoid having to adjust that calculation later in
multiple places.

Note that including ->ro_mask in get_throughable_mask()'s calculation
is only an apparent (i.e. benign) behavioral change: For r/o fields it
doesn't matter > whether they get passed through - either the same flag
is also set in emu_mask (then there's no change at all) or the field is
r/o in hardware (and hence a write won't change it anyway).

This is a preparatory patch for XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
2015-06-02 15:07:01 +00:00
Jan Beulich c4ff1e68c6 xen/pt: correctly handle PM status bit
xen_pt_pmcsr_reg_write() needs an adjustment to deal with the RW1C
nature of the not passed through bit 15 (PCI_PM_CTRL_PME_STATUS).

This is a preparatory patch for XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-06-02 15:07:01 +00:00
Jan Beulich d61bb2482d xen/pt: consolidate PM capability emu_mask
There's no point in xen_pt_pmcsr_reg_{read,write}() each ORing
PCI_PM_CTRL_STATE_MASK and PCI_PM_CTRL_NO_SOFT_RESET into a local
emu_mask variable - we can have the same effect by setting the field
descriptor's emu_mask member suitably right away. Note that
xen_pt_pmcsr_reg_write() is being retained in order to allow later
patches to be less intrusive.

This is a preparatory patch for XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-06-02 15:07:01 +00:00
Jan Beulich d1d35cf4ff xen/MSI: don't open-code pass-through of enable bit modifications
Without this the actual XSA-131 fix would cause the enable bit to not
get set anymore (due to the write back getting suppressed there based
on the OR of emu_mask, ro_mask, and res_mask).

Note that the fiddling with the enable bit shouldn't really be done by
qemu, but making this work right (via libxc and the hypervisor) will
require more extensive changes, which can be postponed until after the
security issue got addressed.

This is a preparatory patch for XSA-131.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-06-02 15:07:01 +00:00
Jan Beulich b38ec5ee7a xen/MSI-X: limit error messages
Limit error messages resulting from bad guest behavior to avoid allowing
the guest to cause the control domain's disk to fill.

The first message in pci_msix_write() can simply be deleted, as this
is indeed bad guest behavior, but such out of bounds writes don't
really need to be logged.

The second one is more problematic, as there guest behavior may only
appear to be wrong: For one, the old logic didn't take the mask-all bit
into account. And then this shouldn't depend on host device state (i.e.
the host may have masked the entry without the guest having done so).
Plus these writes shouldn't be dropped even when an entry is unmasked.
Instead, if they can't be made take effect right away, they should take
effect on the next unmasking or enabling operation - the specification
explicitly describes such caching behavior. Until we can validly drop
the message (implementing such caching/latching behavior), issue the
message just once per MSI-X table entry.

Note that the log message in pci_msix_read() similar to the one being
removed here is not an issue: "addr" being of unsigned type, and the
maximum size of the MSI-X table being 32k, entry_nr simply can't be
negative and hence the conditonal guarding issuing of the message will
never be true.

This is XSA-130.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-06-02 15:07:00 +00:00
Jan Beulich 7611dae8a6 xen: don't allow guest to control MSI mask register
It's being used by the hypervisor. For now simply mimic a device not
capable of masking, and fully emulate any accesses a guest may issue
nevertheless as simple reads/writes without side effects.

This is XSA-129.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-06-02 15:07:00 +00:00
Jan Beulich 5c83b2f5b4 xen: properly gate host writes of modified PCI CFG contents
The old logic didn't work as intended when an access spanned multiple
fields (for example a 32-bit access to the location of the MSI Message
Data field with the high 16 bits not being covered by any known field).
Remove it and derive which fields not to write to from the accessed
fields' emulation masks: When they're all ones, there's no point in
doing any host write.

This fixes a secondary issue at once: We obviously shouldn't make any
host write attempt when already the host read failed.

This is XSA-128.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-06-02 15:07:00 +00:00
Edgar E. Iglesias 3fc827d591 target-arm: Correct check for non-EL3
This fixes a compile warning from clang 3.5 (the assertion
could never fire).

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1432881807-18164-2-git-send-email-edgar.iglesias@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
[PMM: added note in commit message that this is fixing a build warning]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-02 13:22:29 +01:00
Peter Maydell 25611aa12b virtio-input: two small fixups
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVbWozAAoJEEy22O7T6HE4MsIQALUNpRUD2vEll2Qq1d9Ayljb
 sXNYG7iT84CrP5cI3I0ZMJIwPbZrem69B8UIZq065FO3APZODnY5dW8g45BP8xpk
 d6B1ie+lPdOo1EgRABXDRIMtbLb81etcSLL0vnYzqVFA2jUE6wveRWqXhvIC8weT
 r7nKsUu+WzsaTO0T9y9oypeoscPP/Bkv75EbzoTAPZYq8fiSb4Qvh4OJ6cDef7J+
 JGSxEgbiXlXNynDuhdc3TYpQ9F5NaSEjJHG4QqCQ+MvE5I6yXf4zkc+4JKBCbXrW
 kDenjOmY+5cm396A4e6a1uJ289cwFzInVH9jn2NGnPPO++QQHrheFVjfw4QzW9bQ
 ERjJ1EofyvB+BoiOoU86ttCKipdDsjVm1hOW1xsxudH4cjNLw57kqSRsPZwXQJQS
 Sx6wnu9L14Nnb12rxB8peDkSNN6XSAloo2zFsbJavynzMfBfShQdQm5gc+sX8/2q
 Co15inAOwVtK9it2XZL635Ve09ZSWVg0t5iFx0JuqqgDSyjj5xqCmscEFKSUBrqo
 A7EfGvMX6Fbbl3JXtV5i2BqmmV1hwaU6MV2GK6TPNapfuPpxoIr3BIocm6JJqiBS
 qt2ISAsVuzaWcBJCwa+8Xf5Vd/yeh88AU+qxMho5yZTmpJtvCG6fOA4oQX9n6rwM
 egSwmUjW4AHNpTtuVaVY
 =/GX3
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150602-1' into staging

virtio-input: two small fixups

# gpg: Signature made Tue Jun  2 09:32:51 2015 BST 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-20150602-1:
  virtio-input: make virtio devices follow usual naming convention
  virtio-input: const_le16 and const_le32 not build time constant

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-02 11:25:12 +01:00
Peter Maydell ef99b3ee06 pc build fix
My last pull breaks build on systems with iasl.
 Fix this up.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVbLVUAAoJECgfDbjSjVRpk5gH/jW70lEDqSpqVZ2cmn4ki2jG
 QTbuWELGm1qyuVBGU6RQ5V6L6WJbzLVy9hxgzs9bF7pQ3Q7N16aDBwwHeR5VVZuf
 09htYH7V+5Lrx7rcCguoneOikSGgM5mGQrETDf8hp9ECyxj9jsEbCJUB2Wy7fIGA
 KalnxP0sbdpUYyIbDRQUDNtU4MuhGKF0WzjNIUZ3H+L2JW2NBZMSrBQ5dSClPq6B
 nVHSvjMtuAlkwCsH6F2FXFldxqMdgByZBzZ6H4ZMssGsIYKnbXhR/3vsdVdS4nef
 YTzGtSRAPhDR3zKpV7+VsuOD+xPHDsparKlk8TDo2uKeJVB9Q0vBdv43vNyvnH8=
 =Bqzz
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc build fix

My last pull breaks build on systems with iasl.
Fix this up.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Mon Jun  1 20:41:08 2015 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  acpi: add missing ssdt

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-02 10:20:03 +01:00
Gerd Hoffmann e63d114b8a virtio-input: make virtio devices follow usual naming convention
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-02 10:31:29 +02:00
Michael Mueller 16c9d46d32 virtio-input: const_le16 and const_le32 not build time constant
As the implementation of const_le16 and const_le32 is not build time constant
on big endian systems this need to be fixed.

  CC    hw/input/virtio-input-hid.o
hw/input/virtio-input-hid.c:340:13: error: initializer element is not constant
hw/input/virtio-input-hid.c:340:13: error: (near initialization for ‘virtio_keyboard_config[1].u.ids.bustype’)
...

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-02 10:29:54 +02:00
Michael S. Tsirkin 9e472263b0 acpi: add missing ssdt
commit 5cb18b3d7b
    TPM2 ACPI table support

was missing a file, so build with iasl fails
(build without iasl works since it uses the generated
 hex files).

Reported-by: "Daniel P. Berrange" <berrange@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 21:40:22 +02:00
Peter Maydell b821cbe274 pc, pci, tpm, virtio, vhost enhancements and fixes
A bunch of cleanups and fixes all over the place,
 enhancements in TPM, virtio and vhost.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVbE3kAAoJECgfDbjSjVRphV4H/jEnq16oMP72H6xgbAIKjvrP
 uEx4jgkj9qGfgqLQJURPKemgzNbP+dXjd4LkIdgbUvlknCgFeKyJVPxzCCIhjc7R
 5D70Aptg1CdVNaMeqsIOyJIYe0hIXQjbF7a/jtxf8nR9+kLIOpcQ200oRJtxpGVu
 VfzWnBj48PRXi/W03OinWYrkqeAqx0BNHRxXQ5Ylr/DxTBoJKmmp13wW/5U+Xtmi
 g5hDS5IF/qqrIKftisR7sDEfXENJf3ZulqP/2N8Lvufyj1lQxGkEGTKD5FDzeaj6
 X0/UvUv7I2OzCbcTyeCwzF1GfZOgGceiXxopEp359SkvyoJILF7/C0Na5LY/fiw=
 =fckd
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc, pci, tpm, virtio, vhost enhancements and fixes

A bunch of cleanups and fixes all over the place,
enhancements in TPM, virtio and vhost.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Mon Jun  1 13:19:48 2015 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (60 commits)
  vhost-user: add multi queue support
  virtio: make features 64bit wide
  qdev: add 64bit properties
  virtio-mmio: ioeventfd support
  hw/acpi/aml-build: Fix memory leak
  acpi: add aml_while() term
  acpi: add aml_increment() term
  acpi: add aml_shiftright() term
  acpi: add aml_shiftleft() term
  acpi: add aml_index() term
  acpi: add aml_lless() term
  acpi: add aml_add() term
  TPM2 ACPI table support
  tpm: Probe for connected TPM 1.2 or TPM 2
  Extend TPM TIS interface to support TPM 2
  Add stream ID to MSI write
  acpi: Simplify printing to dynamic string
  i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted
  i386/pc_q35: don't insist on board FDC if there's no default floppy
  i386/pc: '-drive if=floppy' should imply a board-default FDC
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-01 15:22:46 +01:00
Ouyang Changchun 830d70db69 vhost-user: add multi queue support
Based on patch by Nikolay Nikolaev:
Vhost-user will implement the multi queue support in a similar way
to what vhost already has - a separate thread for each queue.
To enable the multi queue functionality - a new command line parameter
"queues" is introduced for the vhost-user netdev.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 14:18:55 +02:00
Gerd Hoffmann 019a3edbb2 virtio: make features 64bit wide
Make features 64bit wide everywhere.

On migration a full 64bit guest_features field is sent if one of the
high bits is set, in addition to the lower 32bit guest_features field
which must stay for compatibility reasons.  That way we send the lower
32 feature bits twice, but the code is simpler because we don't have
to split and compose the 64bit features into two 32bit fields.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 14:18:55 +02:00
Gerd Hoffmann fdba6d967e qdev: add 64bit properties
Needed for virtio features which go from 32bit to 64bit with virtio 1.0

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 14:18:55 +02:00
Ying-Shiuan Pan 434027badb virtio-mmio: ioeventfd support
set_host_notifier and set_guest_notifiers supported by virtio-mmio now.
Most code copied from virtio-pci.

This makes it possible to use vhost-net with virtio-mmio,
improving performance by about 30%.

The kvm-arm does not yet support irqfd, need to fix the hard-coded part after
kvm-arm gets irqfd support.

Signed-off-by: Ying-Shiuan Pan <yingshiuan.pan@gmail.com>
Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 14:18:55 +02:00
Shannon Zhao afcf905cff hw/acpi/aml-build: Fix memory leak
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2015-06-01 14:18:54 +02:00
Marcel Apfelbaum 68e6b0af78 acpi: add aml_while() term
Add encoding for ACPI DefWhile Opcode.

Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 14:18:54 +02:00
Marcel Apfelbaum af39d5363f acpi: add aml_increment() term
Add encoding for ACPI DefIncrement Opcode.

Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 14:18:54 +02:00
Marcel Apfelbaum f7bd7b8eb6 acpi: add aml_shiftright() term
Add encoding for ACPI DefShiftRight Opcode.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
2015-06-01 14:18:54 +02:00
Marcel Apfelbaum a57dddddd2 acpi: add aml_shiftleft() term
Add encoding for ACPI DefShiftLeft Opcode.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
2015-06-01 14:18:54 +02:00
Marcel Apfelbaum 928b899657 acpi: add aml_index() term
Add encoding for ACPI DefIndex Opcode.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
2015-06-01 14:18:54 +02:00
Marcel Apfelbaum 96396e2858 acpi: add aml_lless() term
Add encoding for ACPI DefLLess Opcode.

Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01 14:18:54 +02:00
Marcel Apfelbaum c08cf07042 acpi: add aml_add() term
Add encoding for ACPI DefAdd Opcode.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
2015-06-01 14:18:54 +02:00
Stefan Berger 5cb18b3d7b TPM2 ACPI table support
Add a TPM2 ACPI table if a TPM 2 is used in the backend.
Also add an SSDT for the TPM 2.

Rename tpm_find() to tpm_get_version() and have this function
return the version of the TPM found, TPMVersion_Unspec if
no TPM is found. Use the version number to build version
specific ACPI tables.

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>
2015-06-01 14:18:54 +02:00
Peter Maydell 9657cafceb TriCore bugfixes
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCgAGBQJVac5JAAoJEArSxjlracoUiZwP/jRnAm/5kn+MVMVe4RUGBvZQ
 Ltb1TpAwKMJRjMS8HTjmJsRCMih2xqli29ETx7LO0+pAaujn0WF2QhOyD1Qh3dPh
 22AUO3M0RT3y+lYyh28eUksUKUhQMr+xehiv5wTQzylfC0tls5QuFSGJpeQBoBW4
 LJuoSZ6JnfzGxs1ep6lIczj8Zkms/Fvmlxbi2aAY2nLJPAXSYlBymBim4wWsuh70
 kHlXHXEgdHZl8TiEwYWseNezuiM7k26uU5390uIZ2FCnNrPDCML6wy4pLh8s+j3O
 T9iQ/jMIYXnHubSktpOq8rVnBMe4RWvz9zN4MeCf018ZOPz/10y7kCKJTk7ULMO5
 p2P3uMZtjXmYazhETnqRE+lhMysj7rPZUYMpJTVFRqORyzxJEZODUKIRcIoc3tgT
 x4OBgTUHea5f+Kp2lsVVKXaceODD4kOSa1tt91uVK1cSnIsPwBozIqmjFWjEcXhA
 vVYNIHxndk5nB5w+hED7/SPgMtDFUAIdPuzX0447equLivFvOU8tnIw1vdaZchYK
 2E7MMd0ZZuBJ6Zls5PnBYjk2NLvEwG9tEV0wwVmIE/evmlRde+OhNXa8C0zeM1it
 ELkF/4PqgeJ8UyVVRclz0EKeRIbCccTD9bTkmx7jukQ9ca+J+VbByxD8bxGL9Qi3
 8ZHtUZUW82eCP96PM1Oc
 =PvTG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150530' into staging

TriCore bugfixes

# gpg: Signature made Sat May 30 15:50:49 2015 BST using RSA key ID 6B69CA14
# gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>"

* remotes/bkoppelmann/tags/pull-tricore-20150530:
  target-tricore: fix BOL_ST_H_LONGOFF using ld
  target-tricore: fix msub32_q producing the wrong overflow bit
  target-tricore: fix OPC2_32_RR_DVINIT_HU having write before use on the result

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-01 11:29:37 +01:00
Stefan Berger 56a3c24ffc tpm: Probe for connected TPM 1.2 or TPM 2
In the TPM passthrough backend driver, modify the probing code so
that we can check whether a TPM 1.2 or TPM 2 is being used
and adapt the behavior of the TPM TIS accordingly.

Move the code that tested for a TPM 1.2 into tpm_utils.c
and extend it with test for probing for TPM 2. Have the
function return the version of TPM found.

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>
2015-05-31 20:29:02 +02:00
Stefan Berger 116694c34a Extend TPM TIS interface to support TPM 2
Following the recent upgrade to version 1.3, extend the TPM TIS
interface with capabilities introduced for support of a TPM 2.

TPM TIS for TPM 2 introduced the following extensions beyond the
TPM TIS 1.3 (used for TPM 1.2):

- A new 32bit interface Id register was introduced.
- New flags for the status (STS) register were defined.
- New flags for the capability flags were defined.

Support the above if a TPM TIS 1.3 for TPM 2 is used with a TPM 2
on the backend side. Support the old TPM TIS 1.3 configuration if a
TPM 1.2 is being used. A subsequent patch will then determine which
TPM version is being used in the backend.

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>
2015-05-31 20:29:02 +02:00
Pavel Fedin 38d40ff10f Add stream ID to MSI write
GICv3 ITS distinguishes between devices by using hardwired device IDs passed on the bus.
This patch implements passing these IDs in qemu.
SMMU is also known to use stream IDs, therefore this addition can also be useful for
implementing platforms with SMMU.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

 Changes from v1:
- Added bus number to the stream ID
- Added stream ID not only to MSI-X, but also to plain MSI. Some common code was made into
msi_send_message() function.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-05-31 20:29:02 +02:00
Markus Armbruster c3bdc56c18 acpi: Simplify printing to dynamic string
build_append_namestringv() and aml_string() first calculate the
resulting string's length with vsnprintf(NULL, ...), then allocate,
then print for real.  Simply use g_strdup_vprintf() or g_vasprintf()
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2015-05-31 20:24:07 +02:00
Laszlo Ersek ea96bc629c i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted
It is Very annoying to carry forward an outdatEd coNtroller with a mOdern
Machine type.

Hence, let us not instantiate the FDC when all of the following apply:
- the machine type is pc-q35-2.4 or later,
- "-device isa-fdc" is not passed on the command line (nor in the config
  file),
- no "-drive if=floppy,..." is requested.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
2015-05-31 20:24:07 +02:00
Laszlo Ersek 6cd2234ccb i386/pc_q35: don't insist on board FDC if there's no default floppy
The "no_floppy = 1" machine class setting causes "default_floppy" in
main() to become zero. Consequently, default_drive() will not call
drive_add() and drive_new() for IF_FLOPPY, index=0, meaning that no
default floppy drive will be created for the virtual machine. In that
case, board code should also not insist on the creation of the
board-default FDC.

The board-default FDC will still be created if the user requests a floppy
drive with "-drive if=floppy".

Additionally, separate FDCs can be specified manually with "-device
isa-fdc". They allow the

  -device isa-fdc,driveA=...

syntax that is more flexible than the one required by the board-default
FDC:

  -global isa-fdc.driveA=...

This patch doesn't change the behavior observably, as all Q35 machine
types have "no_floppy = 0".

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
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: Markus Armbruster <armbru@redhat.com>
2015-05-31 20:24:06 +02:00
Laszlo Ersek 936a7c1cf7 i386/pc: '-drive if=floppy' should imply a board-default FDC
Even if board code decides not to request the creation of the FDC (keyed
off board-level factors, to be determined later), we should create the FDC
nevertheless if the user passes '-drive if=floppy' on the command line.

Otherwise '-drive if=floppy' would break without explicit '-device
isa-fdc' on such boards.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
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: Markus Armbruster <armbru@redhat.com>
2015-05-31 20:24:06 +02:00
Laszlo Ersek fd53c87cf6 i386/pc: pc_basic_device_init(): delegate FDC creation request
This patch introduces no observable change, but it allows the callers of
pc_basic_device_init(), ie. pc_init1() and pc_q35_init(), to request (or
not request) the creation of the FDC explicitly.

At the moment both callers pass constant create_fdctrl=true (hence no
observable change).

Assuming a board passes create_fdctrl=false, "floppy" will be NULL on
output, and (beyond the FDC not being created) that NULL will be passed on
to pc_cmos_init(). Luckily, pc_cmos_init() already handles that case.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
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: Markus Armbruster <armbru@redhat.com>
2015-05-31 20:24:06 +02:00
Jason Wang b829c2a98f virtio: increase the queue limit to 1024
Increase the queue limit to 1024. But virtio-ccw and s390-virtio won't
support this, this is done through failing device_plugged() for those
two transports if the number of virtqueues is greater than 64.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-05-31 16:50:10 +02:00
Jason Wang 87b3bd1c85 virtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAX
VIRTIO_PCI_QUEUE_MAX is not only used for pci, so rename it be generic.

Cc: Amit Shah <amit.shah@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-05-31 16:50:10 +02:00
Jason Wang d820331a0b virtio-s390: introduce virtio_s390_device_plugged()
This patch introduce a virtio-s390 specific device_plugged() function
and doing the number of virtqueue validation inside.

Cc: Alexander Graf <agraf@suse.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-05-31 16:47:50 +02:00
Jason Wang 74c85296dc virtio-s390: introduce virito s390 queue limit
Cc: Alexander Graf <agraf@suse.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-05-31 16:45:38 +02:00
Jason Wang 10ceaa1e8f virtio-ccw: validate the number of queues against bus limitation
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-05-31 16:45:38 +02:00