Skip to content
Snippets Groups Projects
  1. Jul 03, 2020
    • David Hildenbrand's avatar
      virtio-mem: Migration sanity checks · 383ee445
      David Hildenbrand authored
      
      We want to make sure that certain properties don't change during
      migration, especially to catch user errors in a nice way. Let's migrate
      a temporary structure and validate that the properties didn't change.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-19-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      383ee445
    • David Hildenbrand's avatar
      virtio-pci: Send qapi events when the virtio-mem size changes · 722a3c78
      David Hildenbrand authored
      
      Let's register the notifier and trigger the qapi event with the right
      device id.
      
      MEMORY_DEVICE_SIZE_CHANGE is similar to BALLOON_CHANGE, however on a
      memory device level.
      
      Don't unregister the notifier (we neither have finalize() nor unrealize()
      for VirtIOPCIProxy, so it's not that simple to do it) - both devices are
      expected to vanish at the same time.
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-18-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      722a3c78
    • David Hildenbrand's avatar
      virtio-mem: Allow notifiers for size changes · c95b4437
      David Hildenbrand authored
      
      We want to send qapi events in case the size of a virtio-mem device
      changes. This allows upper layers to always know how much memory is
      actually currently consumed via a virtio-mem device.
      
      Unfortuantely, we have to report the id of our proxy device. Let's provide
      an easy way for our proxy device to register, so it can send the qapi
      events. Piggy-backing on the notifier infrastructure (although we'll
      only ever have one notifier registered) seems to be an easy way.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-17-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      c95b4437
    • David Hildenbrand's avatar
      pc: Support for virtio-mem-pci · 0ed48fd3
      David Hildenbrand authored
      
      Let's wire it up similar to virtio-pmem. Also disallow unplug, so it's
      harder for users to shoot themselves into the foot.
      
      Reviewed-by: default avatarPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-16-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      0ed48fd3
    • David Hildenbrand's avatar
      numa: Handle virtio-mem in NUMA stats · 16647a82
      David Hildenbrand authored
      
      Account the memory to the configured nid.
      
      Reviewed-by: default avatarPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-15-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      16647a82
    • David Hildenbrand's avatar
      hmp: Handle virtio-mem when printing memory device info · 2e70874b
      David Hildenbrand authored
      
      Print the memory device info just like for other memory devices.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-14-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      2e70874b
    • David Hildenbrand's avatar
      MAINTAINERS: Add myself as virtio-mem maintainer · 751c7bdd
      David Hildenbrand authored
      
      Let's make sure patches/bug reports find the right person.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-13-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      751c7bdd
    • David Hildenbrand's avatar
      virtio-pci: Proxy for virtio-mem · 0b9a2443
      David Hildenbrand authored
      
      Let's add a proxy for virtio-mem, make it a memory device, and
      pass-through the properties.
      
      Reviewed-by: default avatarPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-12-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      0b9a2443
    • David Hildenbrand's avatar
      virtio-mem: Paravirtualized memory hot(un)plug · 910b2576
      David Hildenbrand authored
      This is the very basic/initial version of virtio-mem. An introduction to
      virtio-mem can be found in the Linux kernel driver [1]. While it can be
      used in the current state for hotplug of a smaller amount of memory, it
      will heavily benefit from resizeable memory regions in the future.
      
      Each virtio-mem device manages a memory region (provided via a memory
      backend). After requested by the hypervisor ("requested-size"), the
      guest can try to plug/unplug blocks of memory within that region, in order
      to reach the requested size. Initially, and after a reboot, all memory is
      unplugged (except in special cases - reboot during postcopy).
      
      The guest may only try to plug/unplug blocks of memory within the usable
      region size. The usable region size is a little bigger than the
      requested size, to give the device driver some flexibility. The usable
      region size will only grow, except on reboots or when all memory is
      requested to get unplugged. The guest can never plug more memory than
      requested. Unplugged memory will get zapped/discarded, similar to in a
      balloon device.
      
      The block size is variable, however, it is always chosen in a way such that
      THP splits are avoided (e.g., 2MB). The state of each block
      (plugged/unplugged) is tracked in a bitmap.
      
      As virtio-mem devices (e.g., virtio-mem-pci) will be memory devices, we now
      expose "VirtioMEMDeviceInfo" via "query-memory-devices".
      
      --------------------------------------------------------------------------
      
      There are two important follow-up items that are in the works:
      1. Resizeable memory regions: Use resizeable allocations/RAM blocks to
         grow/shrink along with the usable region size. This avoids creating
         initially very big VMAs, RAM blocks, and KVM slots.
      2. Protection of unplugged memory: Make sure the gust cannot actually
         make use of unplugged memory.
      
      Other follow-up items that are in the works:
      1. Exclude unplugged memory during migration (via precopy notifier).
      2. Handle remapping of memory.
      3. Support for other architectures.
      
      --------------------------------------------------------------------------
      
      Example usage (virtio-mem-pci is introduced in follow-up patches):
      
      Start QEMU with two virtio-mem devices (one per NUMA node):
       $ qemu-system-x86_64 -m 4G,maxmem=20G \
        -smp sockets=2,cores=2 \
        -numa node,nodeid=0,cpus=0-1 -numa node,nodeid=1,cpus=2-3 \
        [...]
        -object memory-backend-ram,id=mem0,size=8G \
        -device virtio-mem-pci,id=vm0,memdev=mem0,node=0,requested-size=0M \
        -object memory-backend-ram,id=mem1,size=8G \
        -device virtio-mem-pci,id=vm1,memdev=mem1,node=1,requested-size=1G
      
      Query the configuration:
       (qemu) info memory-devices
       Memory device [virtio-mem]: "vm0"
         memaddr: 0x140000000
         node: 0
         requested-size: 0
         size: 0
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem0
       Memory device [virtio-mem]: "vm1"
         memaddr: 0x340000000
         node: 1
         requested-size: 1073741824
         size: 1073741824
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem1
      
      Add some memory to node 0:
       (qemu) qom-set vm0 requested-size 500M
      
      Remove some memory from node 1:
       (qemu) qom-set vm1 requested-size 200M
      
      Query the configuration again:
       (qemu) info memory-devices
       Memory device [virtio-mem]: "vm0"
         memaddr: 0x140000000
         node: 0
         requested-size: 524288000
         size: 524288000
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem0
       Memory device [virtio-mem]: "vm1"
         memaddr: 0x340000000
         node: 1
         requested-size: 209715200
         size: 209715200
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem1
      
      [1] https://lkml.kernel.org/r/20200311171422.10484-1-david@redhat.com
      
      
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-11-david@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      910b2576
  2. Jul 02, 2020
  3. Jul 01, 2020
  4. Jun 29, 2020
    • Philippe Mathieu-Daudé's avatar
      hw/misc/pca9552: Add missing TypeInfo::class_size field · fc1bff95
      Philippe Mathieu-Daudé authored
      
      When adding the generic PCA955xClass in commit 736132e4, we
      forgot to set the class_size field. Fill it now to avoid:
      
        (gdb) run -machine mcimx6ul-evk -m 128M -display none -serial stdio -kernel ./OS.elf
        Starting program: ../../qemu/qemu/arm-softmmu/qemu-system-arm -machine mcimx6ul-evk -m 128M -display none -serial stdio -kernel ./OS.elf
        double free or corruption (!prev)
        Thread 1 "qemu-system-arm" received signal SIGABRT, Aborted.
        __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
        (gdb) where
        #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
        #1  0x00007ffff75d8859 in __GI_abort () at abort.c:79
        #2  0x00007ffff76433ee in __libc_message
            (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff776d285 "%s\n")
            at ../sysdeps/posix/libc_fatal.c:155
        #3  0x00007ffff764b47c in malloc_printerr
            (str=str@entry=0x7ffff776f690 "double free or corruption (!prev)")
            at malloc.c:5347
        #4  0x00007ffff764d12c in _int_free
            (av=0x7ffff779eb80 <main_arena>, p=0x5555567a3990, have_lock=<optimized out>) at malloc.c:4317
        #5  0x0000555555c906c3 in type_initialize_interface
            (ti=ti@entry=0x5555565b8f40, interface_type=0x555556597ad0, parent_type=0x55555662ca10) at qom/object.c:259
        #6  0x0000555555c902da in type_initialize (ti=ti@entry=0x5555565b8f40)
            at qom/object.c:323
        #7  0x0000555555c90d20 in type_initialize (ti=0x5555565b8f40)
            at qom/object.c:1028
      
        $ valgrind --track-origins=yes qemu-system-arm -M mcimx6ul-evk -m 128M -display none -serial stdio -kernel ./OS.elf
        ==77479== Memcheck, a memory error detector
        ==77479== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
        ==77479== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
        ==77479== Command: qemu-system-arm -M mcimx6ul-evk -m 128M -display none -serial stdio -kernel ./OS.elf
        ==77479==
        ==77479== Invalid write of size 2
        ==77479==    at 0x6D8322: pca9552_class_init (pca9552.c:424)
        ==77479==    by 0x844D1F: type_initialize (object.c:1029)
        ==77479==    by 0x844D1F: object_class_foreach_tramp (object.c:1016)
        ==77479==    by 0x4AE1057: g_hash_table_foreach (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.2)
        ==77479==    by 0x8453A4: object_class_foreach (object.c:1038)
        ==77479==    by 0x8453A4: object_class_get_list (object.c:1095)
        ==77479==    by 0x556194: select_machine (vl.c:2416)
        ==77479==    by 0x556194: qemu_init (vl.c:3828)
        ==77479==    by 0x40AF9C: main (main.c:48)
        ==77479==  Address 0x583f108 is 0 bytes after a block of size 200 alloc'd
        ==77479==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==77479==    by 0x4AF8D30: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.2)
        ==77479==    by 0x844258: type_initialize.part.0 (object.c:306)
        ==77479==    by 0x844D1F: type_initialize (object.c:1029)
        ==77479==    by 0x844D1F: object_class_foreach_tramp (object.c:1016)
        ==77479==    by 0x4AE1057: g_hash_table_foreach (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.2)
        ==77479==    by 0x8453A4: object_class_foreach (object.c:1038)
        ==77479==    by 0x8453A4: object_class_get_list (object.c:1095)
        ==77479==    by 0x556194: select_machine (vl.c:2416)
        ==77479==    by 0x556194: qemu_init (vl.c:3828)
        ==77479==    by 0x40AF9C: main (main.c:48)
      
      Fixes: 736132e4 ("hw/misc/pca9552: Add generic PCA955xClass")
      Reported-by: default avatarJean-Christophe DUBOIS <jcd@tribudubois.net>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Tested-by: default avatarJean-Christophe DUBOIS <jcd@tribudubois.net>
      Message-id: 20200629074704.23028-1-f4bug@amsat.org
      Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      fc1bff95
  5. Jun 27, 2020
  6. Jun 26, 2020
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200626' into staging · 553cf5d7
      Peter Maydell authored
      
      target-arm queue:
       * hw/arm/aspeed: improve QOM usage
       * hw/misc/pca9552: trace GPIO change events
       * target/arm: Implement ARMv8.5-MemTag for system emulation
      
      # gpg: Signature made Fri 26 Jun 2020 16:13:27 BST
      # gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
      # gpg:                issuer "peter.maydell@linaro.org"
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20200626: (57 commits)
        target/arm: Enable MTE
        target/arm: Add allocation tag storage for system mode
        target/arm: Create tagged ram when MTE is enabled
        target/arm: Cache the Tagged bit for a page in MemTxAttrs
        target/arm: Always pass cacheattr to get_phys_addr
        target/arm: Set PSTATE.TCO on exception entry
        target/arm: Implement data cache set allocation tags
        target/arm: Complete TBI clearing for user-only for SVE
        target/arm: Add mte helpers for sve scatter/gather memory ops
        target/arm: Handle TBI for sve scalar + int memory ops
        target/arm: Add mte helpers for sve scalar + int ff/nf loads
        target/arm: Add mte helpers for sve scalar + int stores
        target/arm: Add mte helpers for sve scalar + int loads
        target/arm: Add arm_tlb_bti_gp
        target/arm: Tidy trans_LD1R_zpri
        target/arm: Use mte_check1 for sve LD1R
        target/arm: Use mte_checkN for sve unpredicated stores
        target/arm: Use mte_checkN for sve unpredicated loads
        target/arm: Add helper_mte_check_zva
        target/arm: Implement helper_mte_checkN
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      553cf5d7
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · 3591ddd3
      Peter Maydell authored
      
      * Various fixes
      * libdaxctl support to correctly align devdax character devices (Jingqi)
      * initial-all-set support for live migration (Jay)
      * forbid '-numa node, mem' for 5.1 and newer machine types (Igor)
      * x87 fixes (Joseph)
      * Tighten memory_region_access_valid (Michael) and fix fallout (myself)
      * Replay fixes (Pavel)
      
      # gpg: Signature made Fri 26 Jun 2020 14:42:17 BST
      # gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
      # gpg:                issuer "pbonzini@redhat.com"
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
      # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
      #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
      
      * remotes/bonzini/tags/for-upstream: (31 commits)
        i386: Mask SVM features if nested SVM is disabled
        ibex_uart: fix XOR-as-pow
        vmport: move compat properties to hw_compat_5_0
        hyperv: vmbus: Remove the 2nd IRQ
        kvm: i386: allow TSC to differ by NTP correction bounds without TSC scaling
        numa: forbid '-numa node, mem' for 5.1 and newer machine types
        osdep: Make MIN/MAX evaluate arguments only once
        target/i386: Add notes for versioned CPU models
        target/i386: reimplement fpatan using floatx80 operations
        target/i386: reimplement fyl2x using floatx80 operations
        target/i386: reimplement fyl2xp1 using floatx80 operations
        target/i386: reimplement fprem, fprem1 using floatx80 operations
        softfloat: return low bits of quotient from floatx80_modrem
        softfloat: do not set denominator high bit for floatx80 remainder
        softfloat: do not return pseudo-denormal from floatx80 remainder
        softfloat: fix floatx80 remainder pseudo-denormal check for zero
        softfloat: merge floatx80_mod and floatx80_rem
        target/i386: reimplement f2xm1 using floatx80 operations
        xen: Actually fix build without passthrough
        Makefile: Install qemu-[qmp/ga]-ref.* into the directory "interop"
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      3591ddd3
    • Eduardo Habkost's avatar
      i386: Mask SVM features if nested SVM is disabled · 730319ae
      Eduardo Habkost authored
      
      QEMU incorrectly validates FEAT_SVM feature flags against
      GET_SUPPORTED_CPUID even if SVM features are being masked out by
      cpu_x86_cpuid().  This can make QEMU print warnings on most AMD
      CPU models, even when SVM nesting is disabled (which is the
      default).
      
      This bug was never detected before because of a Linux KVM bug:
      until Linux v5.6, KVM was not filtering out SVM features in
      GET_SUPPORTED_CPUID when nested was disabled.  This KVM bug was
      fixed in Linux v5.7-rc1, on Linux commit a50718cc3f43 ("KVM:
      nSVM: Expose SVM features to L1 iff nested is enabled").
      
      Fix the problem by adding a CPUID_EXT3_SVM dependency to all
      FEAT_SVM feature flags in the feature_dependencies table.
      
      Reported-by: default avatarYanan Fu <yfu@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <20200623230116.277409-1-ehabkost@redhat.com>
      [Fix testcase. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      730319ae
    • Paolo Bonzini's avatar
      ibex_uart: fix XOR-as-pow · c8d7fd05
      Paolo Bonzini authored
      
      The xor-as-pow warning in clang actually detected a genuine bug.
      Fix it.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c8d7fd05
    • Paolo Bonzini's avatar
      vmport: move compat properties to hw_compat_5_0 · f983ff95
      Paolo Bonzini authored
      
      The patches that introduced the properties were submitted when QEMU 5.0
      had not been released yet, so they got merged under the wrong heading.
      Move them to hw_compat_5_0 so that 5.0 machine types get the pre-patch
      behavior.
      
      Fixes: b8892129 ("hw/i386/vmport: Propagate IOPort read to vCPU EAX register")
      Fixes: 0342ee76 ("hw/i386/vmport: Set EAX to -1 on failed and unsupported commands")
      Fixes: f8bdc550 ("hw/i386/vmport: Report vmware-vmx-type in CMD_GETVERSION")
      Fixes: aaacf1c1 ("hw/i386/vmport: Add support for CMD_GETBIOSUUID")
      Reported-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Cc: Liran Alon <liran.alon@oracle.com>
      Reviewed-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f983ff95
    • Jon Doron's avatar
      hyperv: vmbus: Remove the 2nd IRQ · 8f06f22f
      Jon Doron authored
      
      It seems like Windows does not really require 2 IRQs to have a
      functioning VMBus.
      
      Signed-off-by: default avatarJon Doron <arilou@gmail.com>
      Message-Id: <20200617160904.681845-2-arilou@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      8f06f22f
    • Marcelo Tosatti's avatar
      kvm: i386: allow TSC to differ by NTP correction bounds without TSC scaling · 74aaddc6
      Marcelo Tosatti authored
      
      The Linux TSC calibration procedure is subject to small variations
      (its common to see +-1 kHz difference between reboots on a given CPU, for example).
      
      So migrating a guest between two hosts with identical processor can fail, in case
      of a small variation in calibrated TSC between them.
      
      Allow a conservative 250ppm error between host TSC and VM TSC frequencies,
      rather than requiring an exact match. NTP daemon in the guest can
      correct this difference.
      
      Also change migration to accept this bound.
      
      KVM_SET_TSC_KHZ depends on a kernel interface change. Without this change,
      the behaviour remains the same: in case of a different frequency
      between host and VM, KVM_SET_TSC_KHZ will fail and QEMU will exit.
      
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      
      Message-Id: <20200616165805.GA324612@fuller.cnet>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      74aaddc6
    • Igor Mammedov's avatar
      numa: forbid '-numa node, mem' for 5.1 and newer machine types · 32a354dc
      Igor Mammedov authored
      
      Deprecation period is run out and it's a time to flip the switch
      introduced by cd5ff833.  Disable legacy option for new machine
      types (since 5.1) and amend documentation.
      
      '-numa node,memdev' shall be used instead of disabled option
      with new machine types.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Message-Id: <20200609135635.761587-1-imammedo@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      32a354dc
    • Eric Blake's avatar
      osdep: Make MIN/MAX evaluate arguments only once · f9919116
      Eric Blake authored
      I'm not aware of any immediate bugs in qemu where a second runtime
      evaluation of the arguments to MIN() or MAX() causes a problem, but
      proactively preventing such abuse is easier than falling prey to an
      unintended case down the road.  At any rate, here's the conversation
      that sparked the current patch:
      https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg05718.html
      
      
      
      Update the MIN/MAX macros to only evaluate their argument once at
      runtime; this uses typeof(1 ? (a) : (b)) to ensure that we are
      promoting the temporaries to the same type as the final comparison (we
      have to trigger type promotion, as typeof(bitfield) won't compile; and
      we can't use typeof((a) + (b)) or even typeof((a) + 0), as some of our
      uses of MAX are on void* pointers where such addition is undefined).
      
      However, we are unable to work around gcc refusing to compile ({}) in
      a constant context (such as the array length of a static variable),
      even when only used in the dead branch of a __builtin_choose_expr(),
      so we have to provide a second macro pair MIN_CONST and MAX_CONST for
      use when both arguments are known to be compile-time constants and
      where the result must also be usable as a constant; this second form
      evaluates arguments multiple times but that doesn't matter for
      constants.  By using a void expression as the expansion if a
      non-constant is presented to this second form, we can enlist the
      compiler to ensure the double evaluation is not attempted on
      non-constants.
      
      Alas, as both macros now rely on compiler intrinsics, they are no
      longer usable in preprocessor #if conditions; those will just have to
      be open-coded or the logic rewritten into #define or runtime 'if'
      conditions (but where the compiler dead-code-elimination will probably
      still apply).
      
      I tested that both gcc 10.1.1 and clang 10.0.0 produce errors for all
      forms of macro mis-use.  As the errors can sometimes be cryptic, I'm
      demonstrating the gcc output:
      
      Use of MIN when MIN_CONST is needed:
      
      In file included from /home/eblake/qemu/qemu-img.c:25:
      /home/eblake/qemu/include/qemu/osdep.h:249:5: error: braced-group within expression allowed only inside a function
        249 |     ({                                                  \
            |     ^
      /home/eblake/qemu/qemu-img.c:92:12: note: in expansion of macro ‘MIN’
         92 | char array[MIN(1, 2)] = "";
            |            ^~~
      
      Use of MIN_CONST when MIN is needed:
      
      /home/eblake/qemu/qemu-img.c: In function ‘is_allocated_sectors’:
      /home/eblake/qemu/qemu-img.c:1225:15: error: void value not ignored as it ought to be
       1225 |             i = MIN_CONST(i, n);
            |               ^
      
      Use of MIN in the preprocessor:
      
      In file included from /home/eblake/qemu/accel/tcg/translate-all.c:20:
      /home/eblake/qemu/accel/tcg/translate-all.c: In function ‘page_check_range’:
      /home/eblake/qemu/include/qemu/osdep.h:249:6: error: token "{" is not valid in preprocessor expressions
        249 |     ({                                                  \
            |      ^
      
      Fix the resulting callsites that used #if or computed a compile-time
      constant min or max to use the new macros.  cpu-defs.h is interesting,
      as CPU_TLB_DYN_MAX_BITS is sometimes used as a constant and sometimes
      dynamic.
      
      It may be worth improving glib's MIN/MAX definitions to be saner, but
      that is a task for another day.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Tested-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200625162602.700741-1-eblake@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f9919116
    • Tao Xu's avatar
      target/i386: Add notes for versioned CPU models · 47f0d11d
      Tao Xu authored
      
      Add which features are added or removed in this version.
      
      Signed-off-by: default avatarTao Xu <tao3.xu@intel.com>
      Message-Id: <20200324051034.30541-1-tao3.xu@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      47f0d11d
    • Joseph Myers's avatar
      target/i386: reimplement fpatan using floatx80 operations · ff57bb7b
      Joseph Myers authored
      
      The x87 fpatan emulation is currently based around conversion to
      double.  This is inherently unsuitable for a good emulation of any
      floatx80 operation.  Reimplement using the soft-float operations, as
      for other such instructions.
      
      Signed-off-by: default avatarJoseph Myers <joseph@codesourcery.com>
      
      Message-Id: <alpine.DEB.2.21.2006230000340.24721@digraph.polyomino.org.uk>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ff57bb7b
Loading