]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 16 Jul 2019 14:08:29 +0000 (15:08 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 16 Jul 2019 14:08:29 +0000 (15:08 +0100)
* VFIO bugfix for AMD SEV (Alex)
* Kconfig improvements (Julio, Philippe)
* MemoryRegion reference counting bugfix (King Wang)
* Build system cleanups (Marc-AndrĂ©, myself)
* rdmacm-mux off-by-one (Marc-AndrĂ©)
* ZBC passthrough fixes (Shinichiro, myself)
* WHPX build fix (Stefan)
* char-pty fix (Wei Yang)

# gpg: Signature made Tue 16 Jul 2019 08:31:27 BST
# gpg:                using RSA key BFFBD25F78C7AE83
# 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:
  vl: make sure char-pty message displayed by moving setbuf to the beginning
  create_config: remove $(CONFIG_SOFTMMU) hack
  Makefile: do not repeat $(CONFIG_SOFTMMU) in hw/Makefile.objs
  hw/usb/Kconfig: USB_XHCI_NEC requires USB_XHCI
  hw/usb/Kconfig: Add CONFIG_USB_EHCI_PCI
  target/i386: sev: Do not unpin ram device memory region
  checkpatch: detect doubly-encoded UTF-8
  hw/lm32/Kconfig: Milkymist One provides a USB 1.1 Controller
  util: merge main-loop.c and iohandler.c
  Fix broken build with WHPX enabled
  memory: unref the memory region in simplify flatview
  hw/i386: turn off vmport if CONFIG_VMPORT is disabled
  rdmacm-mux: fix strcpy string warning
  build-sys: remove slirp cflags from main-loop.o
  iscsi: base all handling of check condition on scsi_sense_to_errno
  iscsi: fix busy/timeout/task set full
  scsi: add guest-recoverable ZBC errors
  scsi: explicitly list guest-recoverable sense codes
  scsi-disk: pass sense correctly for guest-recoverable errors

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
1  2 
memory.c

diff --combined memory.c
index beac26e173d21be03d06654d6622c0f541c79fd9,d8d42bdff8b2abc176e848fc348325613ef4f235..d4579bbaec3a90b171a0ab5f1654254d763f5069
+++ b/memory.c
@@@ -38,7 -38,7 +38,7 @@@
  static unsigned memory_region_transaction_depth;
  static bool memory_region_update_pending;
  static bool ioeventfd_update_pending;
 -static bool global_dirty_log = false;
 +bool global_dirty_log;
  
  static QTAILQ_HEAD(, MemoryListener) memory_listeners
      = QTAILQ_HEAD_INITIALIZER(memory_listeners);
@@@ -321,7 -321,7 +321,7 @@@ static bool can_merge(FlatRange *r1, Fl
  /* Attempt to simplify a view by merging adjacent ranges */
  static void flatview_simplify(FlatView *view)
  {
-     unsigned i, j;
+     unsigned i, j, k;
  
      i = 0;
      while (i < view->nr) {
              ++j;
          }
          ++i;
+         for (k = i; k < j; k++) {
+             memory_region_unref(view->ranges[k].mr);
+         }
          memmove(&view->ranges[i], &view->ranges[j],
                  (view->nr - j) * sizeof(view->ranges[j]));
          view->nr -= j - i;
@@@ -2064,57 -2067,6 +2067,57 @@@ static void memory_region_sync_dirty_bi
      }
  }
  
 +void memory_region_clear_dirty_bitmap(MemoryRegion *mr, hwaddr start,
 +                                      hwaddr len)
 +{
 +    MemoryRegionSection mrs;
 +    MemoryListener *listener;
 +    AddressSpace *as;
 +    FlatView *view;
 +    FlatRange *fr;
 +    hwaddr sec_start, sec_end, sec_size;
 +
 +    QTAILQ_FOREACH(listener, &memory_listeners, link) {
 +        if (!listener->log_clear) {
 +            continue;
 +        }
 +        as = listener->address_space;
 +        view = address_space_get_flatview(as);
 +        FOR_EACH_FLAT_RANGE(fr, view) {
 +            if (!fr->dirty_log_mask || fr->mr != mr) {
 +                /*
 +                 * Clear dirty bitmap operation only applies to those
 +                 * regions whose dirty logging is at least enabled
 +                 */
 +                continue;
 +            }
 +
 +            mrs = section_from_flat_range(fr, view);
 +
 +            sec_start = MAX(mrs.offset_within_region, start);
 +            sec_end = mrs.offset_within_region + int128_get64(mrs.size);
 +            sec_end = MIN(sec_end, start + len);
 +
 +            if (sec_start >= sec_end) {
 +                /*
 +                 * If this memory region section has no intersection
 +                 * with the requested range, skip.
 +                 */
 +                continue;
 +            }
 +
 +            /* Valid case; shrink the section if needed */
 +            mrs.offset_within_address_space +=
 +                sec_start - mrs.offset_within_region;
 +            mrs.offset_within_region = sec_start;
 +            sec_size = sec_end - sec_start;
 +            mrs.size = int128_make64(sec_size);
 +            listener->log_clear(listener, &mrs);
 +        }
 +        flatview_unref(view);
 +    }
 +}
 +
  DirtyBitmapSnapshot *memory_region_snapshot_and_clear_dirty(MemoryRegion *mr,
                                                              hwaddr addr,
                                                              hwaddr size,
  {
      assert(mr->ram_block);
      memory_region_sync_dirty_bitmap(mr);
 -    return cpu_physical_memory_snapshot_and_clear_dirty(
 -                memory_region_get_ram_addr(mr) + addr, size, client);
 +    return cpu_physical_memory_snapshot_and_clear_dirty(mr, addr, size, client);
  }
  
  bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapshot *snap,