Skip to contentSkip to conversation

pci, pc, virtio: fixes, cleanups, features

GIT PULL Applied Michael S. Tsirkin 7 participants 42 messages Feb 4, 2019 – Feb 12, 2019 KVM

lore
Share & tools
lore
#0 lore raw

The following changes since commit b3fc0af1ff5e922d4dd7c875394dbd26dc7313b4:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-02-01 17:58:27 +0000)

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 5feab30ea98e30446361d184331b7b5ff94b4116:

contrib/libvhost-user: cleanup casts (2019-02-04 09:23:56 -0500)

----------------------------------------------------------------
pci, pc, virtio: fixes, cleanups, features

vhost user blk discard/write zeroes features
misc cleanups and fixes all over the place

----------------------------------------------------------------
Changpeng Liu (3):
contrib: compile vhost-user-blk tool by default contrib/vhost-user-blk: fix the compilation issue
vhost-user-blk: add discard/write zeroes features support

Dima Stepanov (1):
virtio: add checks for the size of the indirect table

Laszlo Ersek (1):
fw_cfg: fix the life cycle and the name of "qemu_extra_params_fw"

Li Qiang (1):
hw: virtio-pci: drop DO_UPCAST

Michael S. Tsirkin (3):
contrib/libvhost-user: switch to uint64_t
r2d: fix build on mingw
contrib/libvhost-user: cleanup casts

Murilo Opsfelder Araujo (2):
mmap-alloc: unfold qemu_ram_mmap()
mmap-alloc: fix hugetlbfs misaligned length in ppc64

Paolo Bonzini (7):
scripts/update-linux-headers.sh: adjust for Linux 4.21-rc1 (or 5.0-rc1)
include: update Linux headers to 4.21-rc1/5.0-rc1
vhost-net: move stubs to a separate file
vhost-net-user: add stubs for when no virtio-net device is present
vhost: restrict Linux dependency to kernel vhost
vhost-net: compile it on all targets that have virtio-net.
vhost-net: revamp configure logic

Peter Xu (4):
intel_iommu: fix operator in vtd_switch_address_space
intel_iommu: reset intr_enabled when system reset pci/msi: export msi_is_masked()
i386/kvm: ignore masked irqs when update msi routes

Stefan Berger (1):
acpi: Make TPM 2.0 with TIS available as MSFT0101

Thomas Huth (1):
hw/virtio: Use CONFIG_VIRTIO_PCI switch instead of CONFIG_PCI

Wei Yang (1):
i386, acpi: cleanup build_facs by removing second unused argument

 configure                                          |  105 +-
 default-configs/virtio.mak                         |    4 +-
 include/exec/poison.h                              |    1 -
 include/hw/pci/msi.h                               |    1 +
 include/qemu/mmap-alloc.h                          |    2 +-
 include/standard-headers/drm/drm_fourcc.h          |   63 ++
 include/standard-headers/linux/ethtool.h           |   19 +-
 include/standard-headers/linux/input-event-codes.h |   17 +
 include/standard-headers/linux/pci_regs.h          |    1 +
 include/standard-headers/linux/vhost_types.h       |  128 +++
 include/standard-headers/linux/virtio_balloon.h    |    8 +
 include/standard-headers/linux/virtio_blk.h        |   54 +
 include/standard-headers/linux/virtio_config.h     |    3 +
 include/standard-headers/linux/virtio_gpu.h        |   18 +
 include/standard-headers/linux/virtio_ring.h       |   52 +
 linux-headers/asm-arm/unistd-common.h              |    1 +
 linux-headers/asm-arm64/unistd.h                   |    1 +
 linux-headers/asm-generic/unistd.h                 |   10 +-
 linux-headers/asm-mips/sgidefs.h                   |    8 -
 linux-headers/asm-mips/unistd.h                    | 1074 +-------------------
 linux-headers/asm-mips/unistd_n32.h                |  338 ++++++
 linux-headers/asm-mips/unistd_n64.h                |  334 ++++++
 linux-headers/asm-mips/unistd_o32.h                |  374 +++++++
 linux-headers/asm-powerpc/unistd.h                 |  389 +------
 linux-headers/asm-powerpc/unistd_32.h              |  381 +++++++
 linux-headers/asm-powerpc/unistd_64.h              |  372 +++++++
 linux-headers/linux/kvm.h                          |   29 +
 linux-headers/linux/vfio.h                         |   92 ++
 linux-headers/linux/vhost.h                        |  113 +-
 linux-headers/linux/vhost_types.h                  |    1 +
 contrib/libvhost-user/libvhost-user.c              |    8 +-
 contrib/vhost-user-blk/vhost-user-blk.c            |  146 ++-
 exec.c                                             |    4 +-
 hw/block/vhost-user-blk.c                          |    4 +
 hw/i386/acpi-build.c                               |   16 +-
 hw/i386/intel_iommu.c                              |    3 +-
 hw/net/vhost_net-stub.c                            |   92 ++
 hw/net/vhost_net.c                                 |   85 +-
 hw/nvram/fw_cfg.c                                  |    9 +-
 hw/pci/msi.c                                       |    2 +-
 hw/sh4/r2d.c                                       |    2 +-
 hw/virtio/vhost-backend.c                          |   12 +-
 hw/virtio/vhost-user.c                             |   13 +-
 hw/virtio/vhost.c                                  |    2 +-
 hw/virtio/virtio-pci.c                             |    4 +-
 hw/virtio/virtio.c                                 |    4 +-
 net/net.c                                          |    2 +-
 net/vhost-user-stub.c                              |   23 +
 target/i386/kvm.c                                  |   14 +-
 tests/vhost-user-test.c                            |   16 +-
 util/mmap-alloc.c                                  |   71 +-
 util/oslib-posix.c                                 |    2 +-
 backends/Makefile.objs                             |    5 +-
 hw/net/Makefile.objs                               |    4 +-
 hw/virtio/Makefile.objs                            |    7 +-
 net/Makefile.objs                                  |    4 +-
 scripts/update-linux-headers.sh                    |   11 +
 tests/Makefile.include                             |    5 +-
 58 files changed, 2749 insertions(+), 1814 deletions(-)
 create mode 100644 include/standard-headers/linux/vhost_types.h
 create mode 100644 linux-headers/asm-mips/unistd_n32.h
 create mode 100644 linux-headers/asm-mips/unistd_n64.h
 create mode 100644 linux-headers/asm-mips/unistd_o32.h
 create mode 100644 linux-headers/asm-powerpc/unistd_32.h
 create mode 100644 linux-headers/asm-powerpc/unistd_64.h
 create mode 100644 linux-headers/linux/vhost_types.h
 create mode 100644 hw/net/vhost_net-stub.c
 create mode 100644 net/vhost-user-stub.c
#1 lore raw

[PULL 14/25] i386/kvm: ignore masked irqs when update msi routes

From: Peter Xu <[email protected]>

When we are with intel-iommu device and with IR on, KVM will register an IEC notifier to detect interrupt updates from the guest and we'll kick off kvm_update_msi_routes_all() when it happens to make sure kernel IRQ cache is matching the latest.

Though, kvm_update_msi_routes_all() is buggy in that it ignored the mask bit of either MSI/MSIX messages and it tries to translate the message even if the corresponding message was already masked by the guest driver (hence the MSI/MSIX message will be invalid).

Without this patch, we can receive an error message when we reboot a guest with both an assigned vfio-pci device and intel-iommu enabled:

qemu-system-x86_64: vtd_interrupt_remap_msi: MSI address low 32 bit invalid: 0x0

The error does not affect functionality of the guest since when we failed to translate we'll just silently continue (which makes sense since crashing the VM for this seems even worse), but still it's better to fix it up.

---
 target/i386/kvm.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
target/i386/kvm.c +11 -3
index 9af4542fb8..beae1b99da 100644
@@ -3894,7 +3894,7 @@ static QLIST_HEAD(, MSIRouteEntry) msi_route_list = \
 static void kvm_update_msi_routes_all(void *private, bool global,
                                       uint32_t index, uint32_t mask)
 {
-    int cnt = 0;
+    int cnt = 0, vector;
     MSIRouteEntry *entry;
     MSIMessage msg;
     PCIDevice *dev;
@@ -3902,11 +3902,19 @@ static void kvm_update_msi_routes_all(void *private, bool global,
     /* TODO: explicit route update */
     QLIST_FOREACH(entry, &msi_route_list, list) {
         cnt++;
+        vector = entry->vector;
         dev = entry->dev;
-        if (!msix_enabled(dev) && !msi_enabled(dev)) {
+        if (msix_enabled(dev) && !msix_is_masked(dev, vector)) {
+            msg = msix_get_message(dev, vector);
+        } else if (msi_enabled(dev) && !msi_is_masked(dev, vector)) {
+            msg = msi_get_message(dev, vector);
+        } else {
+            /*
+             * Either MSI/MSIX is disabled for the device, or the
+             * specific message was masked out.  Skip this one.
+             */
             continue;
         }
-        msg = pci_get_msi_message(dev, entry->vector);
         kvm_irqchip_update_msi_route(kvm_state, entry->virq, msg, dev);
     }
     kvm_irqchip_commit_routes(kvm_state);
Signature · 1 line
MST
#2 lore raw

[Qemu-devel] [PULL 24/25] r2d: fix build on mingw

In reply to Michael S. Tsirkin

Comment near strncpy explains kernel_cmdline does
not need to be 0-terminated.

Accordingly mark it as QEMU_NONSTRING.

Without this, gcc warns:
'strncpy' specified bound 256 equals destination size

---
 hw/sh4/r2d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/sh4/r2d.c +1 -1
index 5b399e7161..dcdb3728cb 100644
@@ -220,7 +220,7 @@ static struct QEMU_PACKED
 
     char pad[232];
 
-    char kernel_cmdline[256];
+    char kernel_cmdline[256] QEMU_NONSTRING;
 } boot_params;
 
 static void r2d_init(MachineState *machine)
Signature · 1 line
MST
#3 lore raw

[Qemu-devel] [PULL 21/25] i386, acpi: cleanup build_facs by removing second unused argument

In reply to Michael S. Tsirkin

From: Wei Yang <[email protected]>

The second argument of build_facs() is not used, just remove it.

---
 hw/i386/acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/i386/acpi-build.c +2 -2
index 26cef4af2d..9ecc96dcc7 100644
@@ -298,7 +298,7 @@ static void acpi_align_size(GArray *blob, unsigned align)
 
 /* FACS */
 static void
-build_facs(GArray *table_data, BIOSLinker *linker)
+build_facs(GArray *table_data)
 {
     AcpiFacsDescriptorRev1 *facs = acpi_data_push(table_data, sizeof *facs);
     memcpy(&facs->signature, "FACS", 4);
@@ -2637,7 +2637,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
      * requirements.
      */
     facs = tables_blob->len;
-    build_facs(tables_blob, tables->linker);
+    build_facs(tables_blob);
 
     /* DSDT is pointed to by FADT */
     dsdt = tables_blob->len;
Signature · 1 line
MST
#4 lore raw

[Qemu-devel] [PULL 22/25] mmap-alloc: unfold qemu_ram_mmap()

In reply to Michael S. Tsirkin

From: Murilo Opsfelder Araujo <[email protected]>

Unfold parts of qemu_ram_mmap() for the sake of understanding, moving declarations to the top, and keeping architecture-specifics in the ifdef-else blocks. No changes in the function behaviour.

Give ptr and ptr1 meaningful names:
ptr -> guardptr : pointer to the PROT_NONE guard region
ptr1 -> ptr : pointer to the mapped memory returned to caller

---
 util/mmap-alloc.c | 53 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 19 deletions(-)
util/mmap-alloc.c +34 -19
index fd329eccd8..f71ea038c8 100644
@@ -77,11 +77,19 @@ size_t qemu_mempath_getpagesize(const char *mem_path)
 
 void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
 {
+    int flags;
+    int guardfd;
+    size_t offset;
+    size_t total;
+    void *guardptr;
+    void *ptr;
+
     /*
      * Note: this always allocates at least one extra page of virtual address
      * space, even if size is already aligned.
      */
-    size_t total = size + align;
+    total = size + align;
+
 #if defined(__powerpc64__) && defined(__linux__)
     /* On ppc64 mappings in the same segment (aka slice) must share the same
      * page size. Since we will be re-allocating part of this segment
@@ -91,16 +99,22 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      * We do this unless we are using the system page size, in which case
      * anonymous memory is OK.
      */
-    int anonfd = fd == -1 || qemu_fd_getpagesize(fd) == getpagesize() ? -1 : fd;
-    int flags = anonfd == -1 ? MAP_ANONYMOUS : MAP_NORESERVE;
-    void *ptr = mmap(0, total, PROT_NONE, flags | MAP_PRIVATE, anonfd, 0);
+    flags = MAP_PRIVATE;
+    if (fd == -1 || qemu_fd_getpagesize(fd) == getpagesize()) {
+        guardfd = -1;
+        flags |= MAP_ANONYMOUS;
+    } else {
+        guardfd = fd;
+        flags |= MAP_NORESERVE;
+    }
 #else
-    void *ptr = mmap(0, total, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+    guardfd = -1;
+    flags = MAP_PRIVATE | MAP_ANONYMOUS;
 #endif
-    size_t offset;
-    void *ptr1;
 
-    if (ptr == MAP_FAILED) {
+    guardptr = mmap(0, total, PROT_NONE, flags, guardfd, 0);
+
+    if (guardptr == MAP_FAILED) {
         return MAP_FAILED;
     }
 
@@ -108,19 +122,20 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
     /* Always align to host page size */
     assert(align >= getpagesize());
 
-    offset = QEMU_ALIGN_UP((uintptr_t)ptr, align) - (uintptr_t)ptr;
-    ptr1 = mmap(ptr + offset, size, PROT_READ | PROT_WRITE,
-                MAP_FIXED |
-                (fd == -1 ? MAP_ANONYMOUS : 0) |
-                (shared ? MAP_SHARED : MAP_PRIVATE),
-                fd, 0);
-    if (ptr1 == MAP_FAILED) {
-        munmap(ptr, total);
+    flags = MAP_FIXED;
+    flags |= fd == -1 ? MAP_ANONYMOUS : 0;
+    flags |= shared ? MAP_SHARED : MAP_PRIVATE;
+    offset = QEMU_ALIGN_UP((uintptr_t)guardptr, align) - (uintptr_t)guardptr;
+
+    ptr = mmap(guardptr + offset, size, PROT_READ | PROT_WRITE, flags, fd, 0);
+
+    if (ptr == MAP_FAILED) {
+        munmap(guardptr, total);
         return MAP_FAILED;
     }
 
     if (offset > 0) {
-        munmap(ptr, offset);
+        munmap(guardptr, offset);
     }
 
     /*
@@ -129,10 +144,10 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      */
     total -= offset;
     if (total > size + getpagesize()) {
-        munmap(ptr1 + size + getpagesize(), total - size - getpagesize());
+        munmap(ptr + size + getpagesize(), total - size - getpagesize());
     }
 
-    return ptr1;
+    return ptr;
 }
 
 void qemu_ram_munmap(void *ptr, size_t size)
Signature · 1 line
MST
#5 lore raw

[Qemu-devel] [PULL 23/25] mmap-alloc: fix hugetlbfs misaligned length in ppc64

In reply to Michael S. Tsirkin

From: Murilo Opsfelder Araujo <[email protected]>

The commit 7197fb4058bcb68986bae2bb2c04d6370f3e7218 ("util/mmap-alloc:
fix hugetlb support on ppc64") fixed Huge TLB mappings on ppc64.

However, we still need to consider the underlying huge page size during munmap() because it requires that both address and length be a multiple of the underlying huge page size for Huge TLB mappings. Quote from "Huge page (Huge TLB) mappings" paragraph under NOTES section of the munmap(2) manual:

"For munmap(), addr and length must both be a multiple of the underlying huge page size."

On ppc64, the munmap() in qemu_ram_munmap() does not work for Huge TLB mappings because the mapped segment can be aligned with the underlying huge page size, not aligned with the native system page size, as returned by getpagesize().

This has the side effect of not releasing huge pages back to the pool after a hugetlbfs file-backed memory device is hot-unplugged.

This patch fixes the situation in qemu_ram_mmap() and qemu_ram_munmap() by considering the underlying page size on ppc64.

After this patch, memory hot-unplug releases huge pages back to the pool.

---
 include/qemu/mmap-alloc.h |  2 +-
 exec.c                    |  4 ++--
 util/mmap-alloc.c         | 22 ++++++++++++++++------
 util/oslib-posix.c        |  2 +-
 4 files changed, 20 insertions(+), 10 deletions(-)
include/qemu/mmap-alloc.h +1 -1
index 50385e3f81..ef04f0ed5b 100644
@@ -9,6 +9,6 @@ size_t qemu_mempath_getpagesize(const char *mem_path);
 
 void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared);
 
-void qemu_ram_munmap(void *ptr, size_t size);
+void qemu_ram_munmap(int fd, void *ptr, size_t size);
 
 #endif
exec.c +2 -2
index 25f3938a27..03dd673d36 100644
@@ -1873,7 +1873,7 @@ static void *file_ram_alloc(RAMBlock *block,
     if (mem_prealloc) {
         os_mem_prealloc(fd, area, memory, smp_cpus, errp);
         if (errp && *errp) {
-            qemu_ram_munmap(area, memory);
+            qemu_ram_munmap(fd, area, memory);
             return NULL;
         }
     }
@@ -2394,7 +2394,7 @@ static void reclaim_ramblock(RAMBlock *block)
         xen_invalidate_map_cache_entry(block->host);
 #ifndef _WIN32
     } else if (block->fd >= 0) {
-        qemu_ram_munmap(block->host, block->max_length);
+        qemu_ram_munmap(block->fd, block->host, block->max_length);
         close(block->fd);
 #endif
     } else {
util/mmap-alloc.c +16 -6
index f71ea038c8..8565885420 100644
@@ -80,6 +80,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
     int flags;
     int guardfd;
     size_t offset;
+    size_t pagesize;
     size_t total;
     void *guardptr;
     void *ptr;
@@ -100,7 +101,8 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      * anonymous memory is OK.
      */
     flags = MAP_PRIVATE;
-    if (fd == -1 || qemu_fd_getpagesize(fd) == getpagesize()) {
+    pagesize = qemu_fd_getpagesize(fd);
+    if (fd == -1 || pagesize == getpagesize()) {
         guardfd = -1;
         flags |= MAP_ANONYMOUS;
     } else {
@@ -109,6 +111,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
     }
 #else
     guardfd = -1;
+    pagesize = getpagesize();
     flags = MAP_PRIVATE | MAP_ANONYMOUS;
 #endif
 
@@ -120,7 +123,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
 
     assert(is_power_of_2(align));
     /* Always align to host page size */
-    assert(align >= getpagesize());
+    assert(align >= pagesize);
 
     flags = MAP_FIXED;
     flags |= fd == -1 ? MAP_ANONYMOUS : 0;
@@ -143,17 +146,24 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      * a guard page guarding against potential buffer overflows.
      */
     total -= offset;
-    if (total > size + getpagesize()) {
-        munmap(ptr + size + getpagesize(), total - size - getpagesize());
+    if (total > size + pagesize) {
+        munmap(ptr + size + pagesize, total - size - pagesize);
     }
 
     return ptr;
 }
 
-void qemu_ram_munmap(void *ptr, size_t size)
+void qemu_ram_munmap(int fd, void *ptr, size_t size)
 {
+    size_t pagesize;
+
     if (ptr) {
         /* Unmap both the RAM block and the guard page */
-        munmap(ptr, size + getpagesize());
+#if defined(__powerpc64__) && defined(__linux__)
+        pagesize = qemu_fd_getpagesize(fd);
+#else
+        pagesize = getpagesize();
+#endif
+        munmap(ptr, size + pagesize);
     }
 }
util/oslib-posix.c +1 -1
index 4ce1ba9ca4..37c5854b9c 100644
@@ -226,7 +226,7 @@ void qemu_vfree(void *ptr)
 void qemu_anon_ram_free(void *ptr, size_t size)
 {
     trace_qemu_anon_ram_free(ptr, size);
-    qemu_ram_munmap(ptr, size);
+    qemu_ram_munmap(-1, ptr, size);
 }
 
 void qemu_set_block(int fd)
Signature · 1 line
MST
#6 lore raw

Re: [Qemu-devel] [PULL 23/25] mmap-alloc: fix hugetlbfs misaligned length in ppc64

Hi Michael,

These two patches (22 and 23) from Murilo already got merged with a pull request from David earlier today.

Cheers,

--
Greg

Quoted 155 lines · On Mon, 4 Feb 2019 09:44:04 -0500 "Michael S. Tsirkin" <[email protected]> wrote:

From: Murilo Opsfelder Araujo <[email protected]>

The commit 7197fb4058bcb68986bae2bb2c04d6370f3e7218 ("util/mmap-alloc:
fix hugetlb support on ppc64") fixed Huge TLB mappings on ppc64.

However, we still need to consider the underlying huge page size during munmap() because it requires that both address and length be a multiple of the underlying huge page size for Huge TLB mappings. Quote from "Huge page (Huge TLB) mappings" paragraph under NOTES section of the munmap(2) manual:

"For munmap(), addr and length must both be a multiple of the underlying huge page size."

On ppc64, the munmap() in qemu_ram_munmap() does not work for Huge TLB mappings because the mapped segment can be aligned with the underlying huge page size, not aligned with the native system page size, as returned by getpagesize().

This has the side effect of not releasing huge pages back to the pool after a hugetlbfs file-backed memory device is hot-unplugged.

This patch fixes the situation in qemu_ram_mmap() and qemu_ram_munmap() by considering the underlying page size on ppc64.

After this patch, memory hot-unplug releases huge pages back to the pool.

---
 include/qemu/mmap-alloc.h |  2 +-
 exec.c                    |  4 ++--
 util/mmap-alloc.c         | 22 ++++++++++++++++------
 util/oslib-posix.c        |  2 +-
 4 files changed, 20 insertions(+), 10 deletions(-)
include/qemu/mmap-alloc.h +1 -1
index 50385e3f81..ef04f0ed5b 100644
@@ -9,6 +9,6 @@ size_t qemu_mempath_getpagesize(const char *mem_path);
 
 void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared);
 
-void qemu_ram_munmap(void *ptr, size_t size);
+void qemu_ram_munmap(int fd, void *ptr, size_t size);
 
 #endif
exec.c +2 -2
index 25f3938a27..03dd673d36 100644
@@ -1873,7 +1873,7 @@ static void *file_ram_alloc(RAMBlock *block,
     if (mem_prealloc) {
         os_mem_prealloc(fd, area, memory, smp_cpus, errp);
         if (errp && *errp) {
-            qemu_ram_munmap(area, memory);
+            qemu_ram_munmap(fd, area, memory);
             return NULL;
         }
     }
@@ -2394,7 +2394,7 @@ static void reclaim_ramblock(RAMBlock *block)
         xen_invalidate_map_cache_entry(block->host);
 #ifndef _WIN32
     } else if (block->fd >= 0) {
-        qemu_ram_munmap(block->host, block->max_length);
+        qemu_ram_munmap(block->fd, block->host, block->max_length);
         close(block->fd);
 #endif
     } else {
util/mmap-alloc.c +16 -6
index f71ea038c8..8565885420 100644
@@ -80,6 +80,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
     int flags;
     int guardfd;
     size_t offset;
+    size_t pagesize;
     size_t total;
     void *guardptr;
     void *ptr;
@@ -100,7 +101,8 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      * anonymous memory is OK.
      */
     flags = MAP_PRIVATE;
-    if (fd == -1 || qemu_fd_getpagesize(fd) == getpagesize()) {
+    pagesize = qemu_fd_getpagesize(fd);
+    if (fd == -1 || pagesize == getpagesize()) {
         guardfd = -1;
         flags |= MAP_ANONYMOUS;
     } else {
@@ -109,6 +111,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
     }
 #else
     guardfd = -1;
+    pagesize = getpagesize();
     flags = MAP_PRIVATE | MAP_ANONYMOUS;
 #endif
 
@@ -120,7 +123,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
 
     assert(is_power_of_2(align));
     /* Always align to host page size */
-    assert(align >= getpagesize());
+    assert(align >= pagesize);
 
     flags = MAP_FIXED;
     flags |= fd == -1 ? MAP_ANONYMOUS : 0;
@@ -143,17 +146,24 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      * a guard page guarding against potential buffer overflows.
      */
     total -= offset;
-    if (total > size + getpagesize()) {
-        munmap(ptr + size + getpagesize(), total - size - getpagesize());
+    if (total > size + pagesize) {
+        munmap(ptr + size + pagesize, total - size - pagesize);
     }
 
     return ptr;
 }
 
-void qemu_ram_munmap(void *ptr, size_t size)
+void qemu_ram_munmap(int fd, void *ptr, size_t size)
 {
+    size_t pagesize;
+
     if (ptr) {
         /* Unmap both the RAM block and the guard page */
-        munmap(ptr, size + getpagesize());
+#if defined(__powerpc64__) && defined(__linux__)
+        pagesize = qemu_fd_getpagesize(fd);
+#else
+        pagesize = getpagesize();
+#endif
+        munmap(ptr, size + pagesize);
     }
 }
util/oslib-posix.c +1 -1
index 4ce1ba9ca4..37c5854b9c 100644
@@ -226,7 +226,7 @@ void qemu_vfree(void *ptr)
 void qemu_anon_ram_free(void *ptr, size_t size)
 {
     trace_qemu_anon_ram_free(ptr, size);
-    qemu_ram_munmap(ptr, size);
+    qemu_ram_munmap(-1, ptr, size);
 }
 
 void qemu_set_block(int fd)
#7 lore raw

Re: [Qemu-devel] [PULL 23/25] mmap-alloc: fix hugetlbfs misaligned length in ppc64

I see. Well git should have no trouble resolving this.

Quoted 168 lines · Greg Kurz

Hi Michael,

These two patches (22 and 23) from Murilo already got merged with a pull request from David earlier today.

Cheers,

--
Greg

Quoted 155 lines · On Mon, 4 Feb 2019 09:44:04 -0500 "Michael S. Tsirkin" <[email protected]> wrote:

From: Murilo Opsfelder Araujo <[email protected]>

The commit 7197fb4058bcb68986bae2bb2c04d6370f3e7218 ("util/mmap-alloc:
fix hugetlb support on ppc64") fixed Huge TLB mappings on ppc64.

However, we still need to consider the underlying huge page size during munmap() because it requires that both address and length be a multiple of the underlying huge page size for Huge TLB mappings. Quote from "Huge page (Huge TLB) mappings" paragraph under NOTES section of the munmap(2) manual:

"For munmap(), addr and length must both be a multiple of the underlying huge page size."

On ppc64, the munmap() in qemu_ram_munmap() does not work for Huge TLB mappings because the mapped segment can be aligned with the underlying huge page size, not aligned with the native system page size, as returned by getpagesize().

This has the side effect of not releasing huge pages back to the pool after a hugetlbfs file-backed memory device is hot-unplugged.

This patch fixes the situation in qemu_ram_mmap() and qemu_ram_munmap() by considering the underlying page size on ppc64.

After this patch, memory hot-unplug releases huge pages back to the pool.

---
 include/qemu/mmap-alloc.h |  2 +-
 exec.c                    |  4 ++--
 util/mmap-alloc.c         | 22 ++++++++++++++++------
 util/oslib-posix.c        |  2 +-
 4 files changed, 20 insertions(+), 10 deletions(-)
include/qemu/mmap-alloc.h +1 -1
index 50385e3f81..ef04f0ed5b 100644
@@ -9,6 +9,6 @@ size_t qemu_mempath_getpagesize(const char *mem_path);
 
 void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared);
 
-void qemu_ram_munmap(void *ptr, size_t size);
+void qemu_ram_munmap(int fd, void *ptr, size_t size);
 
 #endif
exec.c +2 -2
index 25f3938a27..03dd673d36 100644
@@ -1873,7 +1873,7 @@ static void *file_ram_alloc(RAMBlock *block,
     if (mem_prealloc) {
         os_mem_prealloc(fd, area, memory, smp_cpus, errp);
         if (errp && *errp) {
-            qemu_ram_munmap(area, memory);
+            qemu_ram_munmap(fd, area, memory);
             return NULL;
         }
     }
@@ -2394,7 +2394,7 @@ static void reclaim_ramblock(RAMBlock *block)
         xen_invalidate_map_cache_entry(block->host);
 #ifndef _WIN32
     } else if (block->fd >= 0) {
-        qemu_ram_munmap(block->host, block->max_length);
+        qemu_ram_munmap(block->fd, block->host, block->max_length);
         close(block->fd);
 #endif
     } else {
util/mmap-alloc.c +16 -6
index f71ea038c8..8565885420 100644
@@ -80,6 +80,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
     int flags;
     int guardfd;
     size_t offset;
+    size_t pagesize;
     size_t total;
     void *guardptr;
     void *ptr;
@@ -100,7 +101,8 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      * anonymous memory is OK.
      */
     flags = MAP_PRIVATE;
-    if (fd == -1 || qemu_fd_getpagesize(fd) == getpagesize()) {
+    pagesize = qemu_fd_getpagesize(fd);
+    if (fd == -1 || pagesize == getpagesize()) {
         guardfd = -1;
         flags |= MAP_ANONYMOUS;
     } else {
@@ -109,6 +111,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
     }
 #else
     guardfd = -1;
+    pagesize = getpagesize();
     flags = MAP_PRIVATE | MAP_ANONYMOUS;
 #endif
 
@@ -120,7 +123,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
 
     assert(is_power_of_2(align));
     /* Always align to host page size */
-    assert(align >= getpagesize());
+    assert(align >= pagesize);
 
     flags = MAP_FIXED;
     flags |= fd == -1 ? MAP_ANONYMOUS : 0;
@@ -143,17 +146,24 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)
      * a guard page guarding against potential buffer overflows.
      */
     total -= offset;
-    if (total > size + getpagesize()) {
-        munmap(ptr + size + getpagesize(), total - size - getpagesize());
+    if (total > size + pagesize) {
+        munmap(ptr + size + pagesize, total - size - pagesize);
     }
 
     return ptr;
 }
 
-void qemu_ram_munmap(void *ptr, size_t size)
+void qemu_ram_munmap(int fd, void *ptr, size_t size)
 {
+    size_t pagesize;
+
     if (ptr) {
         /* Unmap both the RAM block and the guard page */
-        munmap(ptr, size + getpagesize());
+#if defined(__powerpc64__) && defined(__linux__)
+        pagesize = qemu_fd_getpagesize(fd);
+#else
+        pagesize = getpagesize();
+#endif
+        munmap(ptr, size + pagesize);
     }
 }
util/oslib-posix.c +1 -1
index 4ce1ba9ca4..37c5854b9c 100644
@@ -226,7 +226,7 @@ void qemu_vfree(void *ptr)
 void qemu_anon_ram_free(void *ptr, size_t size)
 {
     trace_qemu_anon_ram_free(ptr, size);
-    qemu_ram_munmap(ptr, size);
+    qemu_ram_munmap(-1, ptr, size);
 }
 
 void qemu_set_block(int fd)
#8 lore raw

[Qemu-devel] [PULL 20/25] fw_cfg: fix the life cycle and the name of "qemu_extra_params_fw"

In reply to Michael S. Tsirkin

From: Laszlo Ersek <[email protected]>

Commit 19bcc4bc3213 ("fw_cfg: Make qemu_extra_params_fw locally", 2019-01-04) changed the storage duration of the "qemu_extra_params_fw" array from static to automatic. This broke the interface contract on the fw_cfg_add_file() function, which is documented as follows, in "include/hw/nvram/fw_cfg.h":

Quoted 2 lines

[...] The data referenced by the starting pointer is only linked, NOT copied, into the data structure of the fw_cfg device. [...]

As a result, when guest firmware fetches the "etc/boot-menu-wait" fw_cfg file, it now sees garbage. Fix the regression by changing the storage duration to allocated. (The call is reached at most once, on the realize path of the board-specific fw_cfg sysbus device.)

While at it, clean up the name and the assignment of the object as well.

---
 hw/nvram/fw_cfg.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
hw/nvram/fw_cfg.c +5 -4
index 53e8e010a8..7fdf04adc9 100644
@@ -118,7 +118,6 @@ static void fw_cfg_bootsplash(FWCfgState *s)
 {
     const char *boot_splash_filename = NULL;
     const char *boot_splash_time = NULL;
-    uint8_t qemu_extra_params_fw[2];
     char *filename, *file_data;
     gsize file_size;
     int file_type;
@@ -132,6 +131,8 @@ static void fw_cfg_bootsplash(FWCfgState *s)
     /* insert splash time if user configurated */
     if (boot_splash_time) {
         int64_t bst_val = qemu_opt_get_number(opts, "splash-time", -1);
+        uint16_t bst_le16;
+
         /* validate the input */
         if (bst_val < 0 || bst_val > 0xffff) {
             error_report("splash-time is invalid,"
@@ -139,9 +140,9 @@ static void fw_cfg_bootsplash(FWCfgState *s)
             exit(1);
         }
         /* use little endian format */
-        qemu_extra_params_fw[0] = (uint8_t)(bst_val & 0xff);
-        qemu_extra_params_fw[1] = (uint8_t)((bst_val >> 8) & 0xff);
-        fw_cfg_add_file(s, "etc/boot-menu-wait", qemu_extra_params_fw, 2);
+        bst_le16 = cpu_to_le16(bst_val);
+        fw_cfg_add_file(s, "etc/boot-menu-wait",
+                        g_memdup(&bst_le16, sizeof bst_le16), sizeof bst_le16);
     }
 
     /* insert splash file if user configurated */
Signature · 1 line
MST
#9 lore raw

[Qemu-devel] [PULL 25/25] contrib/libvhost-user: cleanup casts

In reply to Michael S. Tsirkin

Now that field types are all properly uint64_t,
drop the un-necessary cast.

---
 contrib/libvhost-user/libvhost-user.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
contrib/libvhost-user/libvhost-user.c +4 -4
index c28ec84a11..3f14b4138b 100644
@@ -790,10 +790,10 @@ vu_set_vring_addr_exec(VuDev *dev, VhostUserMsg *vmsg)
     DPRINT("vhost_vring_addr:\n");
     DPRINT("    index:  %d\n", vra->index);
     DPRINT("    flags:  %d\n", vra->flags);
-    DPRINT("    desc_user_addr:   0x%016" PRIx64 "\n", (uint64_t)vra->desc_user_addr);
-    DPRINT("    used_user_addr:   0x%016" PRIx64 "\n", (uint64_t)vra->used_user_addr);
-    DPRINT("    avail_user_addr:  0x%016" PRIx64 "\n", (uint64_t)vra->avail_user_addr);
-    DPRINT("    log_guest_addr:   0x%016" PRIx64 "\n", (uint64_t)vra->log_guest_addr);
+    DPRINT("    desc_user_addr:   0x%016" PRIx64 "\n", vra->desc_user_addr);
+    DPRINT("    used_user_addr:   0x%016" PRIx64 "\n", vra->used_user_addr);
+    DPRINT("    avail_user_addr:  0x%016" PRIx64 "\n", vra->avail_user_addr);
+    DPRINT("    log_guest_addr:   0x%016" PRIx64 "\n", vra->log_guest_addr);
 
     vq->vring.flags = vra->flags;
     vq->vring.desc = qva_to_va(dev, vra->desc_user_addr);
Signature · 1 line
MST
#10 lore raw

[Qemu-devel] [PULL 18/25] hw/virtio: Use CONFIG_VIRTIO_PCI switch instead of CONFIG_PCI

In reply to Michael S. Tsirkin

From: Thomas Huth <[email protected]>

For downstream s390x builds, we'd like to be able to build QEMU with CONFIG_VIRTIO_PCI disabled (since virtio-ccw is used here instead), but still with CONFIG_PCI enabled. This currently fails since the virtio-*-pci.o files are still included in the build, but virtio-pci.o is missing. Use the right config switch CONFIG_VIRTIO_PCI to exclude the virtio-*-pci.o files from the build.

---
 hw/virtio/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/Makefile.objs +1 -1
index 16f8e1c154..757a45743e 100644
@@ -13,7 +13,7 @@ obj-$(CONFIG_VHOST_USER) += vhost-user.o
 obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL)) += vhost.o vhost-backend.o
 common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL))) += vhost-stub.o
 obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o
-ifeq ($(CONFIG_PCI),y)
+ifeq ($(CONFIG_VIRTIO_PCI),y)
 obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o
 obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o
 obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o
Signature · 1 line
MST
#11 lore raw

[Qemu-devel] [PULL 17/25] vhost-user-blk: add discard/write zeroes features support

In reply to Michael S. Tsirkin

From: Changpeng Liu <[email protected]>

Linux commit 1f23816b8 "virtio_blk: add discard and write zeroes support" added the support in the Guest kernel, while here also enable the features support with vhost-user-blk driver. Also enable the test example utility with DISCARD and WRITE ZEROES commands.

---
 include/standard-headers/linux/virtio_blk.h |  48 +++++++
 contrib/vhost-user-blk/vhost-user-blk.c     | 140 +++++++++++++++-----
 hw/block/vhost-user-blk.c                   |   4 +
 3 files changed, 159 insertions(+), 33 deletions(-)
include/standard-headers/linux/virtio_blk.h +48 -0
index ae6e865fee..0229b0fbe4 100644
@@ -38,6 +38,8 @@
 #define VIRTIO_BLK_F_BLK_SIZE	6	/* Block size of disk is available*/
 #define VIRTIO_BLK_F_TOPOLOGY	10	/* Topology information is available */
 #define VIRTIO_BLK_F_MQ		12	/* support more than one vq */
+#define VIRTIO_BLK_F_DISCARD	13	/* DISCARD is supported */
+#define VIRTIO_BLK_F_WRITE_ZEROES	14	/* WRITE ZEROES is supported */
 
 /* Legacy feature bits */
 #ifndef VIRTIO_BLK_NO_LEGACY
@@ -84,6 +86,39 @@ struct virtio_blk_config {
 
 	/* number of vqs, only available when VIRTIO_BLK_F_MQ is set */
 	uint16_t num_queues;
+
+	/* the next 3 entries are guarded by VIRTIO_BLK_F_DISCARD */
+	/*
+	 * The maximum discard sectors (in 512-byte sectors) for
+	 * one segment.
+	 */
+	uint32_t max_discard_sectors;
+	/*
+	 * The maximum number of discard segments in a
+	 * discard command.
+	 */
+	uint32_t max_discard_seg;
+	/* Discard commands must be aligned to this number of sectors. */
+	uint32_t discard_sector_alignment;
+
+	/* the next 3 entries are guarded by VIRTIO_BLK_F_WRITE_ZEROES */
+	/*
+	 * The maximum number of write zeroes sectors (in 512-byte sectors) in
+	 * one segment.
+	 */
+	uint32_t max_write_zeroes_sectors;
+	/*
+	 * The maximum number of segments in a write zeroes
+	 * command.
+	 */
+	uint32_t max_write_zeroes_seg;
+	/*
+	 * Set if a VIRTIO_BLK_T_WRITE_ZEROES request may result in the
+	 * deallocation of one or more of the sectors.
+	 */
+	uint8_t write_zeroes_may_unmap;
+
+	uint8_t unused1[3];
 } QEMU_PACKED;
 
 /*
@@ -137,6 +172,19 @@ struct virtio_blk_outhdr {
 	__virtio64 sector;
 };
 
+/* Unmap this range (only valid for write zeroes command) */
+#define VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP	0x00000001
+
+/* Discard/write zeroes range for each request. */
+struct virtio_blk_discard_write_zeroes {
+	/* discard/write zeroes start sector */
+	uint64_t sector;
+	/* number of discard/write zeroes sectors */
+	uint32_t num_sectors;
+	/* flags for this range */
+	uint32_t flags;
+};
+
 #ifndef VIRTIO_BLK_NO_LEGACY
 struct virtio_scsi_inhdr {
 	__virtio32 errors;
contrib/vhost-user-blk/vhost-user-blk.c +107 -33

175 lines not on this page · raw message

hw/block/vhost-user-blk.c +4 -0
index c3af28fad4..44ac814016 100644
@@ -38,6 +38,8 @@ static const int user_feature_bits[] = {
     VIRTIO_BLK_F_RO,
     VIRTIO_BLK_F_FLUSH,
     VIRTIO_BLK_F_CONFIG_WCE,
+    VIRTIO_BLK_F_DISCARD,
+    VIRTIO_BLK_F_WRITE_ZEROES,
     VIRTIO_F_VERSION_1,
     VIRTIO_RING_F_INDIRECT_DESC,
     VIRTIO_RING_F_EVENT_IDX,
@@ -204,6 +206,8 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
     virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
     virtio_add_feature(&features, VIRTIO_BLK_F_FLUSH);
     virtio_add_feature(&features, VIRTIO_BLK_F_RO);
+    virtio_add_feature(&features, VIRTIO_BLK_F_DISCARD);
+    virtio_add_feature(&features, VIRTIO_BLK_F_WRITE_ZEROES);
 
     if (s->config_wce) {
         virtio_add_feature(&features, VIRTIO_BLK_F_CONFIG_WCE);
Signature · 1 line
MST
#12 lore raw

[Qemu-devel] [PULL 19/25] acpi: Make TPM 2.0 with TIS available as MSFT0101

In reply to Michael S. Tsirkin

From: Stefan Berger <[email protected]>

This patch makes the a TPM 2.0 with TIS interface available under the HID 'MSF0101'. This is supported by Linux and also Windows now recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.

---
 hw/i386/acpi-build.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
hw/i386/acpi-build.c +10 -2
index d60603abd7..26cef4af2d 100644
@@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
 
             if (TPM_IS_TIS(tpm)) {
-                dev = aml_device("ISA.TPM");
-                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+                if (misc->tpm_version == TPM_VERSION_2_0) {
+                    dev = aml_device("TPM");
+                    aml_append(dev, aml_name_decl("_HID",
+                                                  aml_string("MSFT0101")));
+                } else {
+                    dev = aml_device("ISA.TPM");
+                    aml_append(dev, aml_name_decl("_HID",
+                                                  aml_eisaid("PNP0C31")));
+                }
+
                 aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
                 crs = aml_resource_template();
                 aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
Signature · 1 line
MST
#13 lore raw

[Qemu-devel] [PULL 13/25] pci/msi: export msi_is_masked()

In reply to Michael S. Tsirkin

From: Peter Xu <[email protected]>

It is going to be used later on outside MSI code to detect whether one MSI vector is masked out.

---
 include/hw/pci/msi.h | 1 +
 hw/pci/msi.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/pci/msi.h +1 -0
index 4837bcf490..8440eaee11 100644
@@ -39,6 +39,7 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
              bool msi_per_vector_mask, Error **errp);
 void msi_uninit(struct PCIDevice *dev);
 void msi_reset(PCIDevice *dev);
+bool msi_is_masked(const PCIDevice *dev, unsigned int vector);
 void msi_notify(PCIDevice *dev, unsigned int vector);
 void msi_send_message(PCIDevice *dev, MSIMessage msg);
 void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len);
hw/pci/msi.c +1 -1
index 5e05ce5ec2..47d2b0f33c 100644
@@ -286,7 +286,7 @@ void msi_reset(PCIDevice *dev)
     MSI_DEV_PRINTF(dev, "reset\n");
 }
 
-static bool msi_is_masked(const PCIDevice *dev, unsigned int vector)
+bool msi_is_masked(const PCIDevice *dev, unsigned int vector)
 {
     uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));
     uint32_t mask, data;
Signature · 1 line
MST
#14 lore raw

[Qemu-devel] [PULL 15/25] contrib: compile vhost-user-blk tool by default

In reply to Michael S. Tsirkin

From: Changpeng Liu <[email protected]>

---
 configure | 3 +++
 1 file changed, 3 insertions(+)
configure +3 -0
index 31cf6f584d..5c619d4e03 100755
@@ -5831,6 +5831,9 @@ if test "$want_tools" = "yes" ; then
   if [ "$posix" = "yes" ] && [ "$curl" = "yes" ]; then
     tools="elf2dmp $tools"
   fi
+  if [ "$linux" = "yes" ]; then
+    tools="vhost-user-blk\$(EXESUF) $tools"
+  fi
 fi
 if test "$softmmu" = yes ; then
   if test "$linux" = yes; then
Signature · 1 line
MST
#15 lore raw

Re: [Qemu-devel] [PULL 15/25] contrib: compile vhost-user-blk tool by default

No explanation of /why/ we want to build this by default ?

The source header calls it a demo application and it has no man page.

Given this IMHO we should *not* be building & installing it by default, as doing so defacto turns it into a user tool we have to support.

Quoted 28 lines · Michael S. Tsirkin

From: Changpeng Liu <[email protected]>

---
 configure | 3 +++
 1 file changed, 3 insertions(+)
configure +3 -0
index 31cf6f584d..5c619d4e03 100755
@@ -5831,6 +5831,9 @@ if test "$want_tools" = "yes" ; then
   if [ "$posix" = "yes" ] && [ "$curl" = "yes" ]; then
     tools="elf2dmp $tools"
   fi
+  if [ "$linux" = "yes" ]; then
+    tools="vhost-user-blk\$(EXESUF) $tools"
+  fi
 fi
 if test "$softmmu" = yes ; then
   if test "$linux" = yes; then
Signature · 1 line
MST

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#16 lore raw

Re: [Qemu-devel] [PULL 15/25] contrib: compile vhost-user-blk tool by default

Hmm I do think we want to build the contrib tools, otherwise they bitrot too quickly, witness follow-up patches that fix the compilation.

And I think we need tests that actually use them.

However I agree adding them to tools and installing is probably rushing things, e.g. there's no manpage even.

Changpeng Liu could you post a patch that moves this away from tools, so it builds but isn't installed? If it's tricky I think I will revert this one for now ..

Quoted 47 lines · Daniel P. Berrangé

No explanation of /why/ we want to build this by default ?

The source header calls it a demo application and it has no man page.

Given this IMHO we should *not* be building & installing it by default, as doing so defacto turns it into a user tool we have to support.

Quoted 28 lines · Michael S. Tsirkin

From: Changpeng Liu <[email protected]>

---
 configure | 3 +++
 1 file changed, 3 insertions(+)
configure +3 -0
index 31cf6f584d..5c619d4e03 100755
@@ -5831,6 +5831,9 @@ if test "$want_tools" = "yes" ; then
   if [ "$posix" = "yes" ] && [ "$curl" = "yes" ]; then
     tools="elf2dmp $tools"
   fi
+  if [ "$linux" = "yes" ]; then
+    tools="vhost-user-blk\$(EXESUF) $tools"
+  fi
 fi
 if test "$softmmu" = yes ; then
   if test "$linux" = yes; then
Signature · 1 line
MST

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#17 lore raw

Re: [Qemu-devel] [PULL 15/25] contrib: compile vhost-user-blk tool by default

Quoted 9 lines · Michael S. Tsirkin

Hmm I do think we want to build the contrib tools, otherwise they bitrot too quickly, witness follow-up patches that fix the compilation.

And I think we need tests that actually use them.

However I agree adding them to tools and installing is probably rushing things, e.g. there's no manpage even.

Yes, if we build, but do not install, the binary that would be ok

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#18 lore raw

Re: [Qemu-devel] [PULL 15/25] contrib: compile vhost-user-blk tool by default

Quoted 11 lines · Daniel P. Berrangé
Quoted 9 lines · Michael S. Tsirkin

Hmm I do think we want to build the contrib tools, otherwise they bitrot too quickly, witness follow-up patches that fix the compilation.

And I think we need tests that actually use them.

However I agree adding them to tools and installing is probably rushing things, e.g. there's no manpage even.

Quoted 5 lines

Yes, if we build, but do not install, the binary that would be ok

Regards,
Daniel

OK I reverted this for now.

Quoted 4 lines
Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#19 lore raw

Re: [Qemu-devel] [PULL 15/25] contrib: compile vhost-user-blk tool by default

Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Daniel P. Berrangé
Quoted 9 lines · Michael S. Tsirkin

Hmm I do think we want to build the contrib tools, otherwise they bitrot too quickly, witness follow-up patches that fix the compilation.

And I think we need tests that actually use them.

However I agree adding them to tools and installing is probably rushing things, e.g. there's no manpage even.

Quoted 7 lines
Quoted 5 lines

Yes, if we build, but do not install, the binary that would be ok

Regards,
Daniel

OK I reverted this for now.

Yes, I requested this patch to avoid further bitrot. Installing isn't necessary though.

Stefan

#20 lore raw

[Qemu-devel] [PULL 16/25] contrib/vhost-user-blk: fix the compilation issue

In reply to Michael S. Tsirkin

From: Changpeng Liu <[email protected]>

---
 contrib/vhost-user-blk/vhost-user-blk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
contrib/vhost-user-blk/vhost-user-blk.c +5 -1
index 858221ad95..49640dfdf2 100644
@@ -20,6 +20,10 @@
 #include "contrib/libvhost-user/libvhost-user-glib.h"
 #include "contrib/libvhost-user/libvhost-user.h"
 
+#if defined(__linux__)
+#include <linux/fs.h>
+#include <sys/ioctl.h>
+#endif
 
 struct virtio_blk_inhdr {
     unsigned char status;
@@ -454,7 +458,7 @@ vub_get_blocksize(int fd)
 
 #if defined(__linux__) && defined(BLKSSZGET)
     if (ioctl(fd, BLKSSZGET, &blocksize) == 0) {
-        return blocklen;
+        return blocksize;
     }
 #endif
 
Signature · 1 line
MST
#21 lore raw

[Qemu-devel] [PULL 10/25] hw: virtio-pci: drop DO_UPCAST

In reply to Michael S. Tsirkin

From: Li Qiang <[email protected]>

Use VIRTIO_PCI MACRO instead.

---
 hw/virtio/virtio-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/virtio-pci.c +2 -2
index b282109343..e978bfe760 100644
@@ -591,7 +591,7 @@ virtio_address_space_read(VirtIOPCIProxy *proxy, hwaddr addr,
 static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
                                 uint32_t val, int len)
 {
-    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
+    VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     struct virtio_pci_cfg_cap *cfg;
 
@@ -624,7 +624,7 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
 static uint32_t virtio_read_config(PCIDevice *pci_dev,
                                    uint32_t address, int len)
 {
-    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
+    VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
     struct virtio_pci_cfg_cap *cfg;
 
     if (proxy->config_cap &&
Signature · 1 line
MST
#22 lore raw

[Qemu-devel] [PULL 11/25] intel_iommu: fix operator in vtd_switch_address_space

In reply to Michael S. Tsirkin

From: Peter Xu <[email protected]>

When calculating use_iommu, we wanted to first detect whether DMAR is enabled, then check whether PT is enabled if DMAR is enabled. However in the current code we used "&" rather than "&&" so the ordering requirement is lost (instead it'll be an "AND" operation). This could introduce errors dumped in QEMU console when rebooting a guest with both assigned device and vIOMMU, like:

qemu-system-x86_64: vtd_dev_to_context_entry: invalid root entry:
rsvd=0xf000ff53f000e2c3, val=0xf000ff53f000ff53 (reserved nonzero)

---
 hw/i386/intel_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/intel_iommu.c +1 -1
index 8b72735650..6d5cc1d039 100644
@@ -1153,7 +1153,7 @@ static bool vtd_switch_address_space(VTDAddressSpace *as)
 
     assert(as);
 
-    use_iommu = as->iommu_state->dmar_enabled & !vtd_dev_pt_enabled(as);
+    use_iommu = as->iommu_state->dmar_enabled && !vtd_dev_pt_enabled(as);
 
     trace_vtd_switch_address_space(pci_bus_num(as->bus),
                                    VTD_PCI_SLOT(as->devfn),
Signature · 1 line
MST
#23 lore raw

[Qemu-devel] [PULL 12/25] intel_iommu: reset intr_enabled when system reset

In reply to Michael S. Tsirkin

From: Peter Xu <[email protected]>

This is found when I was debugging another problem. Until now no bug is reported with this but we'd better reset the IR status correctly after a system reset.

---
 hw/i386/intel_iommu.c | 1 +
 1 file changed, 1 insertion(+)
hw/i386/intel_iommu.c +1 -0
index 6d5cc1d039..ee22e754f0 100644
@@ -3138,6 +3138,7 @@ static void vtd_init(IntelIOMMUState *s)
     s->root = 0;
     s->root_extended = false;
     s->dmar_enabled = false;
+    s->intr_enabled = false;
     s->iq_head = 0;
     s->iq_tail = 0;
     s->iq = 0;
Signature · 1 line
MST
#24 lore raw

[Qemu-devel] [PULL 01/25] virtio: add checks for the size of the indirect table

In reply to Michael S. Tsirkin

From: Dima Stepanov <[email protected]>

The virtqueue_pop() and virtqueue_get_avail_bytes() routines can use the INDIRECT table to get the data. It is possible to create a packet which will lead to the assert message like:
include/exec/memory.h:1995: void address_space_read_cached(MemoryRegionCache *, hwaddr, void *, int):
Assertion `addr < cache->len && len <= cache->len - addr' failed. Aborted
To do it the first descriptor should have a link to the INDIRECT table and set the size of it to 0. It doesn't look good that the guest should be able to trigger the assert in qemu. Add additional check for the size of the INDIRECT table, which should not be 0.

---
 hw/virtio/virtio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/virtio.c +2 -2
index 22bd1ac34e..a1ff647a66 100644
@@ -646,7 +646,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,
         vring_desc_read(vdev, &desc, desc_cache, i);
 
         if (desc.flags & VRING_DESC_F_INDIRECT) {
-            if (desc.len % sizeof(VRingDesc)) {
+            if (!desc.len || (desc.len % sizeof(VRingDesc))) {
                 virtio_error(vdev, "Invalid size for indirect buffer table");
                 goto err;
             }
@@ -902,7 +902,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz)
     desc_cache = &caches->desc;
     vring_desc_read(vdev, &desc, desc_cache, i);
     if (desc.flags & VRING_DESC_F_INDIRECT) {
-        if (desc.len % sizeof(VRingDesc)) {
+        if (!desc.len || (desc.len % sizeof(VRingDesc))) {
             virtio_error(vdev, "Invalid size for indirect buffer table");
             goto done;
         }
Signature · 1 line
MST
#25 lore raw

[Qemu-devel] [PULL 02/25] contrib/libvhost-user: switch to uint64_t

In reply to Michael S. Tsirkin

contrib/libvhost-user is now using __u64 which is
a long long. New linux headers will use uint64_t.

These need to be printed differently: llx versus PRIx64.

For now cast to uint64_t for portability so the change does not break the build.

Casts will go away in the future.

---
 contrib/libvhost-user/libvhost-user.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
contrib/libvhost-user/libvhost-user.c +4 -4
index a6b46cdc03..c28ec84a11 100644
@@ -790,10 +790,10 @@ vu_set_vring_addr_exec(VuDev *dev, VhostUserMsg *vmsg)
     DPRINT("vhost_vring_addr:\n");
     DPRINT("    index:  %d\n", vra->index);
     DPRINT("    flags:  %d\n", vra->flags);
-    DPRINT("    desc_user_addr:   0x%016llx\n", vra->desc_user_addr);
-    DPRINT("    used_user_addr:   0x%016llx\n", vra->used_user_addr);
-    DPRINT("    avail_user_addr:  0x%016llx\n", vra->avail_user_addr);
-    DPRINT("    log_guest_addr:   0x%016llx\n", vra->log_guest_addr);
+    DPRINT("    desc_user_addr:   0x%016" PRIx64 "\n", (uint64_t)vra->desc_user_addr);
+    DPRINT("    used_user_addr:   0x%016" PRIx64 "\n", (uint64_t)vra->used_user_addr);
+    DPRINT("    avail_user_addr:  0x%016" PRIx64 "\n", (uint64_t)vra->avail_user_addr);
+    DPRINT("    log_guest_addr:   0x%016" PRIx64 "\n", (uint64_t)vra->log_guest_addr);
 
     vq->vring.flags = vra->flags;
     vq->vring.desc = qva_to_va(dev, vra->desc_user_addr);
Signature · 1 line
MST
#26 lore raw

[Qemu-devel] [PULL 03/25] scripts/update-linux-headers.sh: adjust for Linux 4.21-rc1 (or 5.0-rc1)

In reply to Michael S. Tsirkin

From: Paolo Bonzini <[email protected]>

There are three new indirect inclusions: vhost_types.h, which we'll shortly put to use as a portable header and thus is copied to standard-headers; and new per-subtarget versions of MIPS unistd.h and PowerPC unistd.h.

Because vhost.h includes vhost_types.h, we also need a proxy include from linux/vhost.h to standard-headers.

---
 scripts/update-linux-headers.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
scripts/update-linux-headers.sh +11 -0
index 0a964fe240..c933489cbc 100755
@@ -101,6 +101,13 @@ for arch in $ARCHLIST; do
 
     if [ $arch = mips ]; then
         cp "$tmpdir/include/asm/sgidefs.h" "$output/linux-headers/asm-mips/"
+        cp "$tmpdir/include/asm/unistd_o32.h" "$output/linux-headers/asm-mips/"
+        cp "$tmpdir/include/asm/unistd_n32.h" "$output/linux-headers/asm-mips/"
+        cp "$tmpdir/include/asm/unistd_n64.h" "$output/linux-headers/asm-mips/"
+    fi
+    if [ $arch = powerpc ]; then
+        cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-powerpc/"
+        cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-powerpc/"
     fi
 
     rm -rf "$output/include/standard-headers/asm-$arch"
@@ -162,6 +169,9 @@ EOF
 cat <<EOF >$output/linux-headers/linux/virtio_ring.h
 #include "standard-headers/linux/virtio_ring.h"
 EOF
+cat <<EOF >$output/linux-headers/linux/vhost_types.h
+#include "standard-headers/linux/vhost_types.h"
+EOF
 
 rm -rf "$output/include/standard-headers/linux"
 mkdir -p "$output/include/standard-headers/linux"
@@ -171,6 +181,7 @@ for i in "$tmpdir"/include/linux/*virtio*.h \
          "$tmpdir/include/linux/input-event-codes.h" \
          "$tmpdir/include/linux/pci_regs.h" \
          "$tmpdir/include/linux/ethtool.h" "$tmpdir/include/linux/kernel.h" \
+         "$tmpdir/include/linux/vhost_types.h" \
          "$tmpdir/include/linux/sysinfo.h"; do
     cp_portable "$i" "$output/include/standard-headers/linux"
 done
Signature · 1 line
MST
#27 lore raw

[Qemu-devel] [PULL 04/25] include: update Linux headers to 4.21-rc1/5.0-rc1

In reply to Michael S. Tsirkin

From: Paolo Bonzini <[email protected]>

This is simply running the newly-updated script on Linux, in order to obtain the new header files and all the other updates from the recent Linux merge window.

---
 include/standard-headers/drm/drm_fourcc.h     |   63 +
 include/standard-headers/linux/ethtool.h      |   19 +-
 .../linux/input-event-codes.h                 |   17 +
 include/standard-headers/linux/pci_regs.h     |    1 +
 include/standard-headers/linux/vhost_types.h  |  128 ++
 .../standard-headers/linux/virtio_balloon.h   |    8 +
 include/standard-headers/linux/virtio_blk.h   |    6 +
 .../standard-headers/linux/virtio_config.h    |    3 +
 include/standard-headers/linux/virtio_gpu.h   |   18 +
 include/standard-headers/linux/virtio_ring.h  |   52 +
 linux-headers/asm-arm/unistd-common.h         |    1 +
 linux-headers/asm-arm64/unistd.h              |    1 +
 linux-headers/asm-generic/unistd.h            |   10 +-
 linux-headers/asm-mips/sgidefs.h              |    8 -
 linux-headers/asm-mips/unistd.h               | 1074 +----------------
 linux-headers/asm-mips/unistd_n32.h           |  338 ++++++
 linux-headers/asm-mips/unistd_n64.h           |  334 +++++
 linux-headers/asm-mips/unistd_o32.h           |  374 ++++++
 linux-headers/asm-powerpc/unistd.h            |  389 +-----
 linux-headers/asm-powerpc/unistd_32.h         |  381 ++++++
 linux-headers/asm-powerpc/unistd_64.h         |  372 ++++++
 linux-headers/linux/kvm.h                     |   29 +
 linux-headers/linux/vfio.h                    |   92 ++
 linux-headers/linux/vhost.h                   |  113 +-
 linux-headers/linux/vhost_types.h             |    1 +
 25 files changed, 2243 insertions(+), 1589 deletions(-)
 create mode 100644 include/standard-headers/linux/vhost_types.h
 create mode 100644 linux-headers/asm-mips/unistd_n32.h
 create mode 100644 linux-headers/asm-mips/unistd_n64.h
 create mode 100644 linux-headers/asm-mips/unistd_o32.h
 create mode 100644 linux-headers/asm-powerpc/unistd_32.h
 create mode 100644 linux-headers/asm-powerpc/unistd_64.h
 create mode 100644 linux-headers/linux/vhost_types.h
include/standard-headers/drm/drm_fourcc.h +63 -0
index b53f8d7c8c..44490607f9 100644
@@ -29,11 +29,50 @@
 extern "C" {
 #endif
 
+/**
+ * DOC: overview
+ *
+ * In the DRM subsystem, framebuffer pixel formats are described using the
+ * fourcc codes defined in `include/uapi/drm/drm_fourcc.h`. In addition to the
+ * fourcc code, a Format Modifier may optionally be provided, in order to
+ * further describe the buffer's format - for example tiling or compression.
+ *
+ * Format Modifiers
+ * ----------------
+ *
+ * Format modifiers are used in conjunction with a fourcc code, forming a
+ * unique fourcc:modifier pair. This format:modifier pair must fully define the
+ * format and data layout of the buffer, and should be the only way to describe
+ * that particular buffer.
+ *
+ * Having multiple fourcc:modifier pairs which describe the same layout should
+ * be avoided, as such aliases run the risk of different drivers exposing
+ * different names for the same data format, forcing userspace to understand
+ * that they are aliases.
+ *
+ * Format modifiers may change any property of the buffer, including the number
+ * of planes and/or the required allocation size. Format modifiers are
+ * vendor-namespaced, and as such the relationship between a fourcc code and a
+ * modifier is specific to the modifer being used. For example, some modifiers
+ * may preserve meaning - such as number of planes - from the fourcc code,
+ * whereas others may not.
+ *
+ * Vendors should document their modifier usage in as much detail as
+ * possible, to ensure maximum compatibility across devices, drivers and
+ * applications.
+ *
+ * The authoritative list of format modifier codes is found in
+ * `include/uapi/drm/drm_fourcc.h`
+ */
+
 #define fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
 				 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
 
 #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
 
+/* Reserve 0 for the invalid format specifier */
+#define DRM_FORMAT_INVALID	0
+
 /* color index */
 #define DRM_FORMAT_C8		fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
 
@@ -111,6 +150,21 @@ extern "C" {
 #define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
 
 #define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XYUV8888		fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
+
+/*
+ * packed YCbCr420 2x2 tiled formats
+ * first 64 bits will contain Y,Cb,Cr components for a 2x2 tile
+ */
+/* [63:0]   A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0  1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
+#define DRM_FORMAT_Y0L0		fourcc_code('Y', '0', 'L', '0')
+/* [63:0]   X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0  1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
+#define DRM_FORMAT_X0L0		fourcc_code('X', '0', 'L', '0')
+
+/* [63:0]   A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian */
+#define DRM_FORMAT_Y0L2		fourcc_code('Y', '0', 'L', '2')
+/* [63:0]   X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian */
+#define DRM_FORMAT_X0L2		fourcc_code('X', '0', 'L', '2')
 
 /*
  * 2 plane RGB + A
@@ -298,6 +352,15 @@ extern "C" {
  */
 #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE	fourcc_mod_code(SAMSUNG, 1)
 
+/*
+ * Tiled, 16 (pixels) x 16 (lines) - sized macroblocks
+ *
+ * This is a simple tiled layout using tiles of 16x16 pixels in a row-major
+ * layout. For YCbCr formats Cb/Cr components are taken in such a way that
+ * they correspond to their 16x16 luma block.
+ */
+#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE	fourcc_mod_code(SAMSUNG, 2)
+
 /*
  * Qualcomm Compressed Format
  *
include/standard-headers/linux/ethtool.h +5 -14
index 57ffcb5341..063c814278 100644
@@ -91,10 +91,6 @@
  * %ETHTOOL_GSET to get the current values before making specific
  * changes and then applying them with %ETHTOOL_SSET.
  *
- * Drivers that implement set_settings() should validate all fields
- * other than @cmd that are not described as read-only or deprecated,
- * and must ignore all fields described as read-only.
- *
  * Deprecated fields should be ignored by both users and drivers.
  */
 struct ethtool_cmd {
@@ -886,7 +882,7 @@ struct ethtool_rx_flow_spec {
 	uint32_t		location;
 };
 
-/* How rings are layed out when accessing virtual functions or
+/* How rings are laid out when accessing virtual functions or
  * offloaded queues is device specific. To allow users to do flow
  * steering and specify these queues the ring cookie is partitioned
  * into a 32bit queue index with an 8 bit virtual function id.
@@ -895,7 +891,7 @@ struct ethtool_rx_flow_spec {
  * devices start supporting PCIe w/ARI. However at the moment I
  * do not know of any devices that support this so I do not reserve
  * space for this at this time. If a future patch consumes the next
- * byte it should be aware of this possiblity.
+ * byte it should be aware of this possibility.
  */
 #define ETHTOOL_RX_FLOW_SPEC_RING	0x00000000FFFFFFFFLL
 #define ETHTOOL_RX_FLOW_SPEC_RING_VF	0x000000FF00000000LL
@@ -1800,14 +1796,9 @@ enum ethtool_reset_flags {
  * rejected.
  *
  * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
- * are not available in %ethtool_link_settings. Until all drivers are
- * converted to ignore them or to the new %ethtool_link_settings API,
- * for both queries and changes, users should always try
- * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick
- * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it
- * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and
- * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing
- * either %ethtool_cmd or %ethtool_link_settings).
+ * are not available in %ethtool_link_settings. These fields will be
+ * always set to zero in %ETHTOOL_GSET reply and %ETHTOOL_SSET will
+ * fail if any of them is set to non-zero value.
  *
  * Users should assume that all fields not marked read-only are
  * writable and subject to validation by the driver.  They should use
include/standard-headers/linux/input-event-codes.h +17 -0
index 9e6a8ba4ce..871ac933eb 100644
@@ -708,6 +708,14 @@
 #define REL_DIAL		0x07
 #define REL_WHEEL		0x08
 #define REL_MISC		0x09
+/*
+ * 0x0a is reserved and should not be used in input drivers.
+ * It was used by HID as REL_MISC+1 and userspace needs to detect if
+ * the next REL_* event is correct or is just REL_MISC + n.
+ * We define here REL_RESERVED so userspace can rely on it and detect
+ * the situation described above.
+ */
+#define REL_RESERVED		0x0a
 #define REL_MAX			0x0f
 #define REL_CNT			(REL_MAX+1)
 
@@ -744,6 +752,15 @@
 
 #define ABS_MISC		0x28
 
+/*
+ * 0x2e is reserved and should not be used in input drivers.
+ * It was used by HID as ABS_MISC+6 and userspace needs to detect if
+ * the next ABS_* event is correct or is just ABS_MISC + n.
+ * We define here ABS_RESERVED so userspace can rely on it and detect
+ * the situation described above.
+ */
+#define ABS_RESERVED		0x2e
+
 #define ABS_MT_SLOT		0x2f	/* MT slot being modified */
 #define ABS_MT_TOUCH_MAJOR	0x30	/* Major axis of touching ellipse */
 #define ABS_MT_TOUCH_MINOR	0x31	/* Minor axis (omit if circular) */
include/standard-headers/linux/pci_regs.h +1 -0
index ee556ccc93..e1e9888c85 100644
@@ -52,6 +52,7 @@
 #define  PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
 
 #define PCI_STATUS		0x06	/* 16 bits */
+#define  PCI_STATUS_IMM_READY	0x01	/* Immediate Readiness */
 #define  PCI_STATUS_INTERRUPT	0x08	/* Interrupt status */
 #define  PCI_STATUS_CAP_LIST	0x10	/* Support Capability List */
 #define  PCI_STATUS_66MHZ	0x20	/* Support 66 MHz PCI 2.1 bus */
include/standard-headers/linux/vhost_types.h new file +128 -0

128 lines not on this page · raw message

include/standard-headers/linux/virtio_balloon.h +8 -0
index 4dbb7dc6c0..9375ca2a70 100644
@@ -34,15 +34,23 @@
 #define VIRTIO_BALLOON_F_MUST_TELL_HOST	0 /* Tell before reclaiming pages */
 #define VIRTIO_BALLOON_F_STATS_VQ	1 /* Memory Stats virtqueue */
 #define VIRTIO_BALLOON_F_DEFLATE_ON_OOM	2 /* Deflate balloon on OOM */
+#define VIRTIO_BALLOON_F_FREE_PAGE_HINT	3 /* VQ to report free pages */
+#define VIRTIO_BALLOON_F_PAGE_POISON	4 /* Guest is using page poisoning */
 
 /* Size of a PFN in the balloon interface. */
 #define VIRTIO_BALLOON_PFN_SHIFT 12
 
+#define VIRTIO_BALLOON_CMD_ID_STOP	0
+#define VIRTIO_BALLOON_CMD_ID_DONE	1
 struct virtio_balloon_config {
 	/* Number of pages host wants Guest to give up. */
 	uint32_t num_pages;
 	/* Number of pages we've actually got in balloon. */
 	uint32_t actual;
+	/* Free page report command id, readonly by guest */
+	uint32_t free_page_report_cmd_id;
+	/* Stores PAGE_POISON if page poisoning is in use */
+	uint32_t poison_val;
 };
 
 #define VIRTIO_BALLOON_S_SWAP_IN  0   /* Amount of memory swapped in */
include/standard-headers/linux/virtio_blk.h +6 -0
index ab16ec5fd2..ae6e865fee 100644
@@ -112,6 +112,12 @@ struct virtio_blk_config {
 /* Get device ID command */
 #define VIRTIO_BLK_T_GET_ID    8
 
+/* Discard command */
+#define VIRTIO_BLK_T_DISCARD	11
+
+/* Write zeroes command */
+#define VIRTIO_BLK_T_WRITE_ZEROES	13
+
 #ifndef VIRTIO_BLK_NO_LEGACY
 /* Barrier before this op. */
 #define VIRTIO_BLK_T_BARRIER	0x80000000
include/standard-headers/linux/virtio_config.h +3 -0
index 0b194365a0..24e30af5ec 100644
@@ -75,6 +75,9 @@
  */
 #define VIRTIO_F_IOMMU_PLATFORM		33
 
+/* This feature indicates support for the packed virtqueue layout. */
+#define VIRTIO_F_RING_PACKED		34
+
 /*
  * Does the device support Single Root I/O Virtualization?
  */
include/standard-headers/linux/virtio_gpu.h +18 -0
index 52a830dcf8..27bb5111f9 100644
@@ -41,6 +41,7 @@
 #include "standard-headers/linux/types.h"
 
 #define VIRTIO_GPU_F_VIRGL 0
+#define VIRTIO_GPU_F_EDID  1
 
 enum virtio_gpu_ctrl_type {
 	VIRTIO_GPU_UNDEFINED = 0,
@@ -56,6 +57,7 @@ enum virtio_gpu_ctrl_type {
 	VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING,
 	VIRTIO_GPU_CMD_GET_CAPSET_INFO,
 	VIRTIO_GPU_CMD_GET_CAPSET,
+	VIRTIO_GPU_CMD_GET_EDID,
 
 	/* 3d commands */
 	VIRTIO_GPU_CMD_CTX_CREATE = 0x0200,
@@ -76,6 +78,7 @@ enum virtio_gpu_ctrl_type {
 	VIRTIO_GPU_RESP_OK_DISPLAY_INFO,
 	VIRTIO_GPU_RESP_OK_CAPSET_INFO,
 	VIRTIO_GPU_RESP_OK_CAPSET,
+	VIRTIO_GPU_RESP_OK_EDID,
 
 	/* error responses */
 	VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200,
@@ -291,6 +294,21 @@ struct virtio_gpu_resp_capset {
 	uint8_t capset_data[];
 };
 
+/* VIRTIO_GPU_CMD_GET_EDID */
+struct virtio_gpu_cmd_get_edid {
+	struct virtio_gpu_ctrl_hdr hdr;
+	uint32_t scanout;
+	uint32_t padding;
+};
+
+/* VIRTIO_GPU_RESP_OK_EDID */
+struct virtio_gpu_resp_edid {
+	struct virtio_gpu_ctrl_hdr hdr;
+	uint32_t size;
+	uint32_t padding;
+	uint8_t edid[1024];
+};
+
 #define VIRTIO_GPU_EVENT_DISPLAY (1 << 0)
 
 struct virtio_gpu_config {
include/standard-headers/linux/virtio_ring.h +52 -0

68 lines not on this page · raw message

linux-headers/asm-arm/unistd-common.h +1 -0
index 60c2d931d0..8c84bcf10f 100644
@@ -355,5 +355,6 @@
 #define __NR_pkey_free (__NR_SYSCALL_BASE + 396)
 #define __NR_statx (__NR_SYSCALL_BASE + 397)
 #define __NR_rseq (__NR_SYSCALL_BASE + 398)
+#define __NR_io_pgetevents (__NR_SYSCALL_BASE + 399)
 
 #endif /* _ASM_ARM_UNISTD_COMMON_H */
linux-headers/asm-arm64/unistd.h +1 -0
index 5072cbd15c..dae1584cf0 100644
@@ -16,5 +16,6 @@
  */
 
 #define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_NEW_STAT
 
 #include <asm-generic/unistd.h>
linux-headers/asm-generic/unistd.h +9 -1
index df4bedb9b0..d90127298f 100644
@@ -242,10 +242,12 @@ __SYSCALL(__NR_tee, sys_tee)
 /* fs/stat.c */
 #define __NR_readlinkat 78
 __SYSCALL(__NR_readlinkat, sys_readlinkat)
+#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
 #define __NR3264_fstatat 79
 __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
 #define __NR3264_fstat 80
 __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
+#endif
 
 /* fs/sync.c */
 #define __NR_sync 81
@@ -736,9 +738,11 @@ __SYSCALL(__NR_statx,     sys_statx)
 __SC_COMP(__NR_io_pgetevents, sys_io_pgetevents, compat_sys_io_pgetevents)
 #define __NR_rseq 293
 __SYSCALL(__NR_rseq, sys_rseq)
+#define __NR_kexec_file_load 294
+__SYSCALL(__NR_kexec_file_load,     sys_kexec_file_load)
 
 #undef __NR_syscalls
-#define __NR_syscalls 294
+#define __NR_syscalls 295
 
 /*
  * 32 bit systems traditionally used different
@@ -758,8 +762,10 @@ __SYSCALL(__NR_rseq, sys_rseq)
 #define __NR_ftruncate __NR3264_ftruncate
 #define __NR_lseek __NR3264_lseek
 #define __NR_sendfile __NR3264_sendfile
+#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
 #define __NR_newfstatat __NR3264_fstatat
 #define __NR_fstat __NR3264_fstat
+#endif
 #define __NR_mmap __NR3264_mmap
 #define __NR_fadvise64 __NR3264_fadvise64
 #ifdef __NR3264_stat
@@ -774,8 +780,10 @@ __SYSCALL(__NR_rseq, sys_rseq)
 #define __NR_ftruncate64 __NR3264_ftruncate
 #define __NR_llseek __NR3264_lseek
 #define __NR_sendfile64 __NR3264_sendfile
+#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
 #define __NR_fstatat64 __NR3264_fstatat
 #define __NR_fstat64 __NR3264_fstat
+#endif
 #define __NR_mmap2 __NR3264_mmap
 #define __NR_fadvise64_64 __NR3264_fadvise64
 #ifdef __NR3264_stat
linux-headers/asm-mips/sgidefs.h +0 -8
index 26143e3b7c..69c3de90c5 100644
@@ -11,14 +11,6 @@
 #ifndef __ASM_SGIDEFS_H
 #define __ASM_SGIDEFS_H
 
-/*
- * Using a Linux compiler for building Linux seems logic but not to
- * everybody.
- */
-#ifndef __linux__
-#error Use a Linux compiler or give up.
-#endif
-
 /*
  * Definitions for the ISA levels
  *
linux-headers/asm-mips/unistd.h +6 -1068

1,091 lines not on this page · raw message

linux-headers/asm-mips/unistd_n32.h new file +338 -0

338 lines not on this page · raw message

linux-headers/asm-mips/unistd_n64.h new file +334 -0

334 lines not on this page · raw message

linux-headers/asm-mips/unistd_o32.h new file +374 -0

374 lines not on this page · raw message

linux-headers/asm-powerpc/unistd.h +2 -387

346 lines not on this page · raw message

linux-headers/asm-powerpc/unistd_32.h new file +381 -0

381 lines not on this page · raw message

linux-headers/asm-powerpc/unistd_64.h new file +372 -0

372 lines not on this page · raw message

linux-headers/linux/kvm.h +29 -0
index f11a7eb49c..b53ee59748 100644

Lines of this file are not shown. View the raw message.

linux-headers/linux/vfio.h +92 -0

92 lines not on this page · raw message

linux-headers/linux/vhost.h +2 -111

113 lines not on this page · raw message

linux-headers/linux/vhost_types.h new file +1 -0
new file mode 100644
index 0000000000..473e3c0d81

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
MST

Part of the diff is not shown here. View the raw message.

#28 lore raw
In reply to Michael S. Tsirkin
Quoted 13 lines · Michael S. Tsirkin

The following changes since commit b3fc0af1ff5e922d4dd7c875394dbd26dc7313b4:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-02-01 17:58:27 +0000)

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 5feab30ea98e30446361d184331b7b5ff94b4116:

contrib/libvhost-user: cleanup casts (2019-02-04 09:23:56 -0500)

Quoted 7 lines

----------------------------------------------------------------
pci, pc, virtio: fixes, cleanups, features

vhost user blk discard/write zeroes features
misc cleanups and fixes all over the place

Hi; I'm afraid this failed build/test on various platforms.

Format string issues on ppc64 host:

/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function ‘vu_set_mem_table_exec_postcopy’:
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:636:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ [-Werror=format=]
DPRINT("%s: region %d: Registered userfault for %llx + %llx\n", ^
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:636:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘__u64’ [-Werror=format=]

Compilation failure on 32-bit:

/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c: In function 'vu_set_mem_table_exec_postcopy':
/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c:594:23:
error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

         ret = madvise((void *)dev_region->mmap_addr,
                       ^
/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c:606:23:
error: cast to pointer from integer of different size
[-Werror=int-to-pointer-cast]
         ret = madvise((void *)dev_region->mmap_addr,
                       ^
/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c:639:22:
error: cast to pointer from integer of different size
[-Werror=int-to-pointer-cast]
         if (mprotect((void *)dev_region->mmap_addr,
                      ^

More format string issues on 32-bit:

/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c: In function 'vub_readv':
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:146:25:
error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n",
^
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c: In function 'vub_writev':
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:169:25:
error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n",
^
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c: In function 'vub_discard_write_zeroes':
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:188:25:
error: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t {aka int}' [-Werror=format=]

         fprintf(stderr, "Invalid size %ld, expect %ld\n", size, sizeof(*desc));
                         ^

/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:188:25:
error: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Werror=format=]

Compiler warning in a test case on the BSDs and OSX:

tests/vhost-user-test.c: In function 'main':
tests/vhost-user-test.c:942:17: warning: unused variable 'hugefs' [-Wunused-variable]

     const char *hugefs;
                 ^

Test failures on sparc host due to an assert:

ERROR:/home/pm215/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
Aborted

and the same on s390x, with a bit more detail:

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/vhost-user-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="vhost-user-test"
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
** ERROR:/home/linux1/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
Aborted (core dumped)
ERROR - too few tests run (expected 4, got 0) /home/linux1/qemu/tests/Makefile.include:858: recipe for target 'check-qtest-i386' failed

New warnings about taking address of packed member on the clang
build: these aren't compile failures but we are very close to being able to make them compile failures, so please don't add new ones:

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:515:32:
warning: taking address
of packed member 'payload' of class or structure 'VhostUserMsg' may
result in an unaligned pointer value [
-Waddress-of-packed-member]

    VhostUserMemory *memory = &vmsg->payload.memory;
                               ^~~~~~~~~~~~~~~~~~~~

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:657:32:
warning: taking address
of packed member 'payload' of class or structure 'VhostUserMsg' may
result in an unaligned pointer value [
-Waddress-of-packed-member]

    VhostUserMemory *memory = &vmsg->payload.memory;
                               ^~~~~~~~~~~~~~~~~~~~

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:786:37:
warning: taking address
of packed member 'payload' of class or structure 'VhostUserMsg' may
result in an unaligned pointer value [
-Waddress-of-packed-member]

    struct vhost_vring_addr *vra = &vmsg->payload.addr;
                                    ^~~~~~~~~~~~~~~~~~

Compile error on the clang build:

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:953:20:
error: implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest' (aka 'enum VhostUserRequest') [-Werror,-Wenum-conversion]
.request = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

thanks
-- PMM

#29 lore raw
Quoted 160 lines · Peter Maydell
Quoted 13 lines · Michael S. Tsirkin

The following changes since commit b3fc0af1ff5e922d4dd7c875394dbd26dc7313b4:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-02-01 17:58:27 +0000)

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 5feab30ea98e30446361d184331b7b5ff94b4116:

contrib/libvhost-user: cleanup casts (2019-02-04 09:23:56 -0500)

Quoted 7 lines

----------------------------------------------------------------
pci, pc, virtio: fixes, cleanups, features

vhost user blk discard/write zeroes features
misc cleanups and fixes all over the place

Hi; I'm afraid this failed build/test on various platforms.

Format string issues on ppc64 host:

/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function ‘vu_set_mem_table_exec_postcopy’:
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:636:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ [-Werror=format=]
DPRINT("%s: region %d: Registered userfault for %llx + %llx\n", ^
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:636:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘__u64’ [-Werror=format=]

Compilation failure on 32-bit:

/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c: In function 'vu_set_mem_table_exec_postcopy':
/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c:594:23:
error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

         ret = madvise((void *)dev_region->mmap_addr,
                       ^
/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c:606:23:
error: cast to pointer from integer of different size
[-Werror=int-to-pointer-cast]
         ret = madvise((void *)dev_region->mmap_addr,
                       ^
/home/peter.maydell/qemu/contrib/libvhost-user/libvhost-user.c:639:22:
error: cast to pointer from integer of different size
[-Werror=int-to-pointer-cast]
         if (mprotect((void *)dev_region->mmap_addr,
                      ^

More format string issues on 32-bit:

/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c: In function 'vub_readv':
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:146:25:
error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n",
^
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c: In function 'vub_writev':
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:169:25:
error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n",
^
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c: In function 'vub_discard_write_zeroes':
/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:188:25:
error: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t {aka int}' [-Werror=format=]

         fprintf(stderr, "Invalid size %ld, expect %ld\n", size, sizeof(*desc));
                         ^

/home/peter.maydell/qemu/contrib/vhost-user-blk/vhost-user-blk.c:188:25:
error: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Werror=format=]

Compiler warning in a test case on the BSDs and OSX:

tests/vhost-user-test.c: In function 'main':
tests/vhost-user-test.c:942:17: warning: unused variable 'hugefs' [-Wunused-variable]

     const char *hugefs;
                 ^

Test failures on sparc host due to an assert:

ERROR:/home/pm215/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
Aborted

and the same on s390x, with a bit more detail:

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/vhost-user-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="vhost-user-test"
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
** ERROR:/home/linux1/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
Aborted (core dumped)
ERROR - too few tests run (expected 4, got 0) /home/linux1/qemu/tests/Makefile.include:858: recipe for target 'check-qtest-i386' failed

New warnings about taking address of packed member on the clang
build: these aren't compile failures but we are very close to being able to make them compile failures, so please don't add new ones:

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:515:32:
warning: taking address
of packed member 'payload' of class or structure 'VhostUserMsg' may
result in an unaligned pointer value [
-Waddress-of-packed-member]

    VhostUserMemory *memory = &vmsg->payload.memory;
                               ^~~~~~~~~~~~~~~~~~~~

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:657:32:
warning: taking address
of packed member 'payload' of class or structure 'VhostUserMsg' may
result in an unaligned pointer value [
-Waddress-of-packed-member]

    VhostUserMemory *memory = &vmsg->payload.memory;
                               ^~~~~~~~~~~~~~~~~~~~

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:786:37:
warning: taking address
of packed member 'payload' of class or structure 'VhostUserMsg' may
result in an unaligned pointer value [
-Waddress-of-packed-member]

    struct vhost_vring_addr *vra = &vmsg->payload.addr;
                                    ^~~~~~~~~~~~~~~~~~

Compile error on the clang build:

/home/petmay01/linaro/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:953:20:
error: implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest' (aka 'enum VhostUserRequest') [-Werror,-Wenum-conversion]
.request = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 2 lines

thanks
-- PMM

OK I dropped the utility from build and repushed.
That should fix most of the issues, except I am
not sure sparc/s390.

Do you mind trying the same tag please and letting me know?

#30 lore raw
In reply to Peter Maydell
Quoted 24 lines · Peter Maydell
Quoted 13 lines · Michael S. Tsirkin

The following changes since commit b3fc0af1ff5e922d4dd7c875394dbd26dc7313b4:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-02-01 17:58:27 +0000)

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 5feab30ea98e30446361d184331b7b5ff94b4116:

contrib/libvhost-user: cleanup casts (2019-02-04 09:23:56 -0500)

Quoted 7 lines

----------------------------------------------------------------
pci, pc, virtio: fixes, cleanups, features

vhost user blk discard/write zeroes features
misc cleanups and fixes all over the place

Hi; I'm afraid this failed build/test on various platforms.

...

Quoted 9 lines

Test failures on sparc host due to an assert:

ERROR:/home/pm215/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
Aborted

and the same on s390x, with a bit more detail:

Quoted 15 lines

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/vhost-user-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="vhost-user-test"
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
** ERROR:/home/linux1/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
Aborted (core dumped)
ERROR - too few tests run (expected 4, got 0) /home/linux1/qemu/tests/Makefile.include:858: recipe for target 'check-qtest-i386' failed

Cornelia do you happen to have a system where you can help me debug this?

Signature · 1 line
MST
#31 lore raw
In reply to Peter Maydell
Quoted 27 lines · Peter Maydell
Quoted 13 lines · Michael S. Tsirkin

The following changes since commit b3fc0af1ff5e922d4dd7c875394dbd26dc7313b4:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-02-01 17:58:27 +0000)

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 5feab30ea98e30446361d184331b7b5ff94b4116:

contrib/libvhost-user: cleanup casts (2019-02-04 09:23:56 -0500)

Quoted 7 lines

----------------------------------------------------------------
pci, pc, virtio: fixes, cleanups, features

vhost user blk discard/write zeroes features
misc cleanups and fixes all over the place

Hi; I'm afraid this failed build/test on various platforms.

Format string issues on ppc64 host:

Quoted 10 lines

/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c: In function ‘vu_set_mem_table_exec_postcopy’:
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:636:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ [-Werror=format=]
DPRINT("%s: region %d: Registered userfault for %llx + %llx\n", ^
/home/pm215/qemu/contrib/libvhost-user/libvhost-user.c:636:9: error:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘__u64’ [-Werror=format=]

So I think I fixed the build errors. And who knows maybe that will fix the runtime ones somehow ..
Could you try pls? Re-pushed to same tag.

Signature · 1 line
MST
#32 lore raw
Quoted 3 lines · Michael S. Tsirkin

So I think I fixed the build errors. And who knows maybe that will fix the runtime ones somehow ..
Could you try pls? Re-pushed to same tag.

these failures still remain:

unused variable for OSX and the BSDs:

tests/vhost-user-test.c:942:17: warning: unused variable 'hugefs' [-Wunused-variable]

    const char *hugefs;
                ^

Assertion failure on sparc, s390x and PPC64 hosts:

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/vhost-user-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="vhost-user-test"
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
** ERROR:/home/pm215/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
ERROR - too few tests run (expected 4, got 0)

Given the set of hosts affected this is almost certainly a big-endian-host specific bug.

thanks
-- PMM

#33 lore raw
Quoted 29 lines · Peter Maydell
Quoted 3 lines · Michael S. Tsirkin

So I think I fixed the build errors. And who knows maybe that will fix the runtime ones somehow ..
Could you try pls? Re-pushed to same tag.

these failures still remain:

unused variable for OSX and the BSDs:

tests/vhost-user-test.c:942:17: warning: unused variable 'hugefs' [-Wunused-variable]

    const char *hugefs;
                ^

Assertion failure on sparc, s390x and PPC64 hosts:

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/vhost-user-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="vhost-user-test"
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
** ERROR:/home/pm215/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
ERROR - too few tests run (expected 4, got 0)

Quoted 5 lines

Given the set of hosts affected this is almost certainly a big-endian-host specific bug.

thanks
-- PMM

You were right.

OK I reverted the whole part dealing with vhost-user and reposted.

I'm sure it's fine now.

Signature · 1 line
MST
#34 lore raw
Quoted 3 lines · Michael S. Tsirkin

OK I reverted the whole part dealing with vhost-user and reposted.

I'm sure it's fine now.

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM

#35 lore raw
In reply to Michael S. Tsirkin
Quoted 33 lines · Michael S. Tsirkin
Quoted 32 lines · Peter Maydell
Quoted 3 lines · Michael S. Tsirkin

So I think I fixed the build errors. And who knows maybe that will fix the runtime ones somehow ..
Could you try pls? Re-pushed to same tag.

these failures still remain:

unused variable for OSX and the BSDs:

tests/vhost-user-test.c:942:17: warning: unused variable 'hugefs' [-Wunused-variable]

    const char *hugefs;
                ^

Assertion failure on sparc, s390x and PPC64 hosts:

MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/vhost-user-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="vhost-user-test"
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
qemu-system-i386: backend does not support LE vnet headers; falling back on userspace virtio
** ERROR:/home/pm215/qemu/tests/vhost-user-test.c:243:wait_for_fds:
assertion failed: (s->fds_num)
ERROR - too few tests run (expected 4, got 0)

Given the set of hosts affected this is almost certainly a big-endian-host specific bug.

Quoted 6 lines
Quoted 2 lines

thanks
-- PMM

You were right.

OK I reverted the whole part dealing with vhost-user and reposted.

I noticed that the merged pull request could possibly have squashed the below two patches (in previous pull) into one super patch (a56de056c91f87e1e):

i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue

Here, the first patch lost its commit message, and the last patch lost its real author. ;)

Regards,

Signature · 1 line
Peter Xu
#36 lore raw
Quoted 8 lines · Peter Xu
Quoted 2 lines · Michael S. Tsirkin

OK I reverted the whole part dealing with vhost-user and reposted.

I noticed that the merged pull request could possibly have squashed the below two patches (in previous pull) into one super patch (a56de056c91f87e1e):

Quoted 5 lines

i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue

Here, the first patch lost its commit message, and the last patch lost its real author. ;)

I suggest we revert a56de056c9 ASAP and reapply the both patches, this will ease cherry-picking/downstream workflow.

#37 lore raw
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Peter Xu
Quoted 2 lines · Michael S. Tsirkin

OK I reverted the whole part dealing with vhost-user and reposted.

I noticed that the merged pull request could possibly have squashed the below two patches (in previous pull) into one super patch (a56de056c91f87e1e):

Quoted 8 lines
Quoted 5 lines

i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue

Here, the first patch lost its commit message, and the last patch lost its real author. ;)

I suggest we revert a56de056c9 ASAP and reapply the both patches, this will ease cherry-picking/downstream workflow.

I don't see why does it help upstream.

Signature · 1 line
MST
#38 lore raw
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Peter Xu
Quoted 2 lines · Michael S. Tsirkin

OK I reverted the whole part dealing with vhost-user and reposted.

I noticed that the merged pull request could possibly have squashed the below two patches (in previous pull) into one super patch (a56de056c91f87e1e):

i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Here, the first patch lost its commit message, and the last patch lost its real author. ;)

I suggest we revert a56de056c9 ASAP and reapply the both patches, this will ease cherry-picking/downstream workflow.

I don't see why does it help upstream.

I'd have suggested the same if I had no idea what 'downstream workflow' mean, simply to keep the tree clear and avoid to have unrelated changes squashed altogether.
Commit a56de056c9 really looks messy. MSI/MSIX changes described by "fix vhost-user-blk compilation".
Hopefully it won't trigger any problem which requires bisecting to it, then contact Changpeng Liu asking him what he intented to do with his commit.
Your call anyway :)

Regards,

Phil.

#39 lore raw
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Peter Xu
Quoted 2 lines · Michael S. Tsirkin

OK I reverted the whole part dealing with vhost-user and reposted.

I noticed that the merged pull request could possibly have squashed the below two patches (in previous pull) into one super patch (a56de056c91f87e1e):

i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Here, the first patch lost its commit message, and the last patch lost its real author. ;)

I suggest we revert a56de056c9 ASAP and reapply the both patches, this will ease cherry-picking/downstream workflow.

I don't see why does it help upstream.

I'd have suggested the same if I had no idea what 'downstream workflow' mean, simply to keep the tree clear and avoid to have unrelated changes squashed altogether.
Commit a56de056c9 really looks messy. MSI/MSIX changes described by "fix vhost-user-blk compilation".
Hopefully it won't trigger any problem which requires bisecting to it, then contact Changpeng Liu asking him what he intented to do with his commit.
Your call anyway :)

Quoted 3 lines

Regards,

Phil.

OK these are good points. I'm not sure what happened but it looks like I screwed up when resolving some conflicts. Care posting a patchset looking sane?

Signature · 1 line
MST
#40 lore raw
Quoted 33 lines · Michael S. Tsirkin
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Peter Xu
Quoted 2 lines · Michael S. Tsirkin

OK I reverted the whole part dealing with vhost-user and reposted.

I noticed that the merged pull request could possibly have squashed the below two patches (in previous pull) into one super patch (a56de056c91f87e1e):

i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Here, the first patch lost its commit message, and the last patch lost its real author. ;)

I suggest we revert a56de056c9 ASAP and reapply the both patches, this will ease cherry-picking/downstream workflow.

I don't see why does it help upstream.

I'd have suggested the same if I had no idea what 'downstream workflow' mean, simply to keep the tree clear and avoid to have unrelated changes squashed altogether.
Commit a56de056c9 really looks messy. MSI/MSIX changes described by "fix vhost-user-blk compilation".
Hopefully it won't trigger any problem which requires bisecting to it, then contact Changpeng Liu asking him what he intented to do with his commit.
Your call anyway :)

Quoted 8 lines
Quoted 3 lines

Regards,

Phil.

OK these are good points. I'm not sure what happened but it looks like I screwed up when resolving some conflicts. Care posting a patchset looking sane?

Yes, will do.

#41 lore raw
Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 35 lines · Michael S. Tsirkin
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Peter Xu
Quoted 2 lines · Michael S. Tsirkin

OK I reverted the whole part dealing with vhost-user and reposted.

I noticed that the merged pull request could possibly have squashed the below two patches (in previous pull) into one super patch (a56de056c91f87e1e):

i386/kvm: ignore masked irqs when update msi routes contrib/vhost-user-blk: fix the compilation issue

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Here, the first patch lost its commit message, and the last patch lost its real author. ;)

I suggest we revert a56de056c9 ASAP and reapply the both patches, this will ease cherry-picking/downstream workflow.

I don't see why does it help upstream.

I'd have suggested the same if I had no idea what 'downstream workflow' mean, simply to keep the tree clear and avoid to have unrelated changes squashed altogether.
Commit a56de056c9 really looks messy. MSI/MSIX changes described by "fix vhost-user-blk compilation".
Hopefully it won't trigger any problem which requires bisecting to it, then contact Changpeng Liu asking him what he intented to do with his commit.
Your call anyway :)

Regards,

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Phil.

OK these are good points. I'm not sure what happened but it looks like I screwed up when resolving some conflicts. Care posting a patchset looking sane?

Yes, will do.

Thanks! Include the reverts in it pls.

Signature · 1 line
MST