Skip to contentSkip to conversation

tpm, vhost, virtio: fixes for 2.6

GIT PULL Applied Michael S. Tsirkin 2 participants 8 messages Apr 14, 2016

lore
Share & tools
lore
#0 lore raw

The following changes since commit d44122ecd0fa62d20762bdd8f214f077cb8e011b:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-04-12 17:47:15 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 01310e2aa7ad87f101d56feb8c06898084c9b542:

hw/virtio/balloon: Replace TARGET_PAGE_SIZE with BALLOON_PAGE_SIZE (2016-04-14 16:44:42 +0300)

----------------------------------------------------------------
tpm, vhost, virtio: fixes for 2.6

Minor fixes all over the place.

----------------------------------------------------------------
Igor Mammedov (2):
pc: acpi: tpm: add missing MMIO resource to PCI0._CRS
tpm: acpi: remove IRQ from TPM's CRS to make Windows not see conflict

Marc-André Lureau (2):
specs/vhost-user: improve VHOST_SET_VRING_NUM documentation specs/vhost-user: spelling fix

Stefan Berger (1):
tpm: Fix write to file descriptor function

Thomas Huth (1):
hw/virtio/balloon: Replace TARGET_PAGE_SIZE with BALLOON_PAGE_SIZE

 hw/i386/acpi-build.c       | 12 +++++++++++-
 hw/tpm/tpm_passthrough.c   |  2 +-
 hw/virtio/virtio-balloon.c |  5 +++--
 docs/specs/vhost-user.txt  |  4 ++--
 4 files changed, 17 insertions(+), 6 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/6] specs/vhost-user: improve VHOST_SET_VRING_NUM documentation

From: Marc-André Lureau <[email protected]>

"number of vrings" doesn't help me understand the purpose of this message. My understanding is that it is rather the size of the queue (in modern terms).

---
 docs/specs/vhost-user.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/specs/vhost-user.txt +1 -1
index 0312d40..4778241 100644
@@ -364,7 +364,7 @@ Message types
       Equivalent ioctl: VHOST_SET_VRING_NUM
       Master payload: vring state description
 
-      Sets the number of vrings for this owner.
+      Set the size of the queue.
 
  * VHOST_USER_SET_VRING_ADDR
 
Signature · 1 line
MST
#2 lore raw

[Qemu-devel] [PULL 2/6] specs/vhost-user: spelling fix

In reply to Michael S. Tsirkin

From: Marc-André Lureau <[email protected]>

---
 docs/specs/vhost-user.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
docs/specs/vhost-user.txt +1 -1
index 4778241..777c49c 100644
@@ -438,7 +438,7 @@ Message types
       Slave payload: u64
 
       Query how many queues the backend supports. This request should be
-      sent only when VHOST_USER_PROTOCOL_F_MQ is set in quried protocol
+      sent only when VHOST_USER_PROTOCOL_F_MQ is set in queried protocol
       features by VHOST_USER_GET_PROTOCOL_FEATURES.
 
  * VHOST_USER_SET_VRING_ENABLE
Signature · 1 line
MST
#3 lore raw

[Qemu-devel] [PULL 4/6] tpm: acpi: remove IRQ from TPM's CRS to make Windows not see conflict

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

IRQ 5 used by TPM conflicts with PNP0C0F IRQs, as result Windows fails driver initialization with reason
'device cannot find enough free resources'
But if TPM._CRS.IRQ entry is commented out, Windows seems to initialize driver without errors as it doesn't notice possible conflict and it seems to work probably due to a link with IRQ 5 being unused/disabled.

So temporary comment out TPM._CRS.IRQ to 'fix' regression in TPM, with intent to fix it correctly later i.e.:
1. pick unused IRQ as default one for TPM
2. fetch IRQ value from device model so that user could override default one if it conflicts with some other device.

---
 hw/i386/acpi-build.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/i386/acpi-build.c +6 -1
index 784870e..6477003 100644
@@ -2348,7 +2348,12 @@ build_dsdt(GArray *table_data, GArray *linker,
                     crs = aml_resource_template();
                     aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
                                TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
-                    aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ));
+                    /*
+                        FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
+                        Rewrite to take IRQ from TPM device model and
+                        fix default IRQ value there to use some unused IRQ
+                     */
+                    /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
                     aml_append(dev, aml_name_decl("_CRS", crs));
                     aml_append(scope, dev);
                 }
Signature · 1 line
MST
#4 lore raw

[Qemu-devel] [PULL 3/6] pc: acpi: tpm: add missing MMIO resource to PCI0._CRS

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Windows will fail initialize TMP driver with the reason:
'device cannot find enough free resources'
That happens because parent BUS doesn't describe MMIO resources used by TPM child device.
Fix it by describing it in top-most parent bus scope PCI0.

It was 'regressed' by commit
5cb18b3d TPM2 ACPI table support
with following fixup
9e472263 acpi: add missing ssdt
which did the right thing by moving TPM to BUS it belongs to but lacked a proper resource declaration.

---
 hw/i386/acpi-build.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/i386/acpi-build.c +5 -0
index 35180ef..784870e 100644
@@ -2167,6 +2167,11 @@ build_dsdt(GArray *table_data, GArray *linker,
                              0, pci->w64.begin, pci->w64.end - 1, 0,
                              pci->w64.end - pci->w64.begin));
     }
+
+    if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+        aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
+                   TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
+    }
     aml_append(scope, aml_name_decl("_CRS", crs));
 
     /* reserve GPE0 block resources */
Signature · 1 line
MST
#5 lore raw

[Qemu-devel] [PULL 5/6] tpm: Fix write to file descriptor function

In reply to Michael S. Tsirkin

From: Stefan Berger <[email protected]>

Fix a bug introduced in commit 46f296c while moving send_all to the tpm_passthrough code. Fix the name of the variable used in the loop.

---
 hw/tpm/tpm_passthrough.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_passthrough.c +1 -1
index e98efb7..e88c0d2 100644
@@ -86,7 +86,7 @@ static int tpm_passthrough_unix_write(int fd, const uint8_t *buf, uint32_t len)
     int ret, remain;
 
     remain = len;
-    while (len > 0) {
+    while (remain > 0) {
         ret = write(fd, buf, remain);
         if (ret < 0) {
             if (errno != EINTR && errno != EAGAIN) {
Signature · 1 line
MST
#6 lore raw

[Qemu-devel] [PULL 6/6] hw/virtio/balloon: Replace TARGET_PAGE_SIZE with BALLOON_PAGE_SIZE

In reply to Michael S. Tsirkin

From: Thomas Huth <[email protected]>

The balloon code currently calls madvise() with TARGET_PAGE_SIZE as length parameter. Since the virtio-balloon protocol is always based on 4k pages, no matter what the host and guest are using as page size, this could cause problems: If TARGET_PAGE_SIZE is bigger than 4k, the madvise call also destroys the 4k areas after the current one - which might be wrong since the guest did not want free that area yet (in case the guest used as smaller MMU page size than the hard-coded TARGET_PAGE_SIZE). So to fix this issue, introduce a proper define called BALLOON_PAGE_SIZE (which is 4096) to use this as the size parameter for the madvise() call instead.

---
 hw/virtio/virtio-balloon.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/virtio/virtio-balloon.c +3 -2
index c74101e..9dbe681 100644
@@ -19,7 +19,6 @@
 #include "qemu-common.h"
 #include "hw/virtio/virtio.h"
 #include "hw/i386/pc.h"
-#include "cpu.h"
 #include "sysemu/balloon.h"
 #include "hw/virtio/virtio-balloon.h"
 #include "sysemu/kvm.h"
@@ -35,12 +34,14 @@
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
 
+#define BALLOON_PAGE_SIZE  (1 << VIRTIO_BALLOON_PFN_SHIFT)
+
 static void balloon_page(void *addr, int deflate)
 {
 #if defined(__linux__)
     if (!qemu_balloon_is_inhibited() && (!kvm_enabled() ||
                                          kvm_has_sync_mmu())) {
-        qemu_madvise(addr, TARGET_PAGE_SIZE,
+        qemu_madvise(addr, BALLOON_PAGE_SIZE,
                 deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
     }
 #endif
Signature · 1 line
MST
#7 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin

The following changes since commit d44122ecd0fa62d20762bdd8f214f077cb8e011b:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-04-12 17:47:15 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 01310e2aa7ad87f101d56feb8c06898084c9b542:

Quoted 8 lines

hw/virtio/balloon: Replace TARGET_PAGE_SIZE with BALLOON_PAGE_SIZE (2016-04-14 16:44:42 +0300)

----------------------------------------------------------------
tpm, vhost, virtio: fixes for 2.6

Minor fixes all over the place.

Applied, thanks.

-- PMM