1. 21 4月, 2017 3 次提交
  2. 24 3月, 2017 1 次提交
    • X
      clear pending status before calling memory commit · ade9c1aa
      Xu, Anthony 提交于
      clear pending status before calling memory commit.
      Otherwise when memory_region_finalize is called,
      memory_region_transaction_depth is 0 and
      memory_region_update_pending is true.
      That's wrong.
      
      Signed-off -by: Anthony Xu <anthony.xu@intel.com>
      
      Message-Id: <4712D8F4B26E034E80552F30A67BE0B1A2E3D5@ORSMSX112.amr.corp.intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ade9c1aa
  3. 14 3月, 2017 1 次提交
  4. 03 3月, 2017 2 次提交
    • P
      memory: show region offset and ROM/RAM type in "info mtree -f" · 377a07aa
      Paolo Bonzini 提交于
      "info mtree -f" output is currently hard to use for large RAM regions, because
      there is no hint as to what part of the region is being mapped.  Add the offset
      if it is nonzero.
      
      Secondly, FlatView has a readonly field, that can override the MemoryRegion
      in the presence of aliases.  Take it into account.
      
      Together, with this patch this:
      
      address-space (flat view): KVM-SMRAM
        0000000000000000-00000000000bffff (prio 0, ram): pc.ram
        00000000000c0000-00000000000c9fff (prio 0, ram): pc.ram
        00000000000ca000-00000000000ccfff (prio 0, ram): pc.ram
        00000000000cd000-00000000000ebfff (prio 0, ram): pc.ram
        00000000000ec000-00000000000effff (prio 0, ram): pc.ram
        00000000000f0000-00000000000fffff (prio 0, ram): pc.ram
        0000000000100000-00000000bfffffff (prio 0, ram): pc.ram
        00000000fd000000-00000000fdffffff (prio 1, ram): vga.vram
        00000000febc0000-00000000febdffff (prio 1, i/o): e1000-mmio
        00000000febf0400-00000000febf041f (prio 0, i/o): vga ioports remapped
        00000000febf0500-00000000febf0515 (prio 0, i/o): bochs dispi interface
        00000000febf0600-00000000febf0607 (prio 0, i/o): qemu extended regs
        00000000fec00000-00000000fec00fff (prio 0, i/o): kvm-ioapic
        00000000fed00000-00000000fed003ff (prio 0, i/o): hpet
        00000000fee00000-00000000feefffff (prio 4096, i/o): kvm-apic-msi
        00000000fffc0000-00000000ffffffff (prio 0, rom): pc.bios
        0000000100000000-000000013fffffff (prio 0, ram): pc.ram
      
      becomes this:
      
      address-space (flat view): KVM-SMRAM
        0000000000000000-00000000000bffff (prio 0, ram): pc.ram
        00000000000c0000-00000000000c9fff (prio 0, rom): pc.ram @00000000000c0000
        00000000000ca000-00000000000ccfff (prio 0, ram): pc.ram @00000000000ca000
        00000000000cd000-00000000000ebfff (prio 0, rom): pc.ram @00000000000cd000
        00000000000ec000-00000000000effff (prio 0, ram): pc.ram @00000000000ec000
        00000000000f0000-00000000000fffff (prio 0, rom): pc.ram @00000000000f0000
        0000000000100000-00000000bfffffff (prio 0, ram): pc.ram @0000000000100000
        00000000fd000000-00000000fdffffff (prio 1, ram): vga.vram
        00000000febc0000-00000000febdffff (prio 1, i/o): e1000-mmio
        00000000febf0400-00000000febf041f (prio 0, i/o): vga ioports remapped
        00000000febf0500-00000000febf0515 (prio 0, i/o): bochs dispi interface
        00000000febf0600-00000000febf0607 (prio 0, i/o): qemu extended regs
        00000000fec00000-00000000fec00fff (prio 0, i/o): kvm-ioapic
        00000000fed00000-00000000fed003ff (prio 0, i/o): hpet
        00000000fee00000-00000000feefffff (prio 4096, i/o): kvm-apic-msi
        00000000fffc0000-00000000ffffffff (prio 0, rom): pc.bios
        0000000100000000-000000013fffffff (prio 0, ram): pc.ram @00000000c0000000
      
      This should make it easier to understand what's going on.
      
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "William Tambe" <tambewilliam@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      377a07aa
    • Y
      memory: Introduce DEVICE_HOST_ENDIAN for ram device · c99a29e7
      Yongji Xie 提交于
      At the moment ram device's memory regions are DEVICE_NATIVE_ENDIAN. It's
      incorrect. This memory region is backed by a MMIO area in host, so the
      uint64_t data that MemoryRegionOps read from/write to this area should be
      host-endian rather than target-endian. Hence, current code does not work
      when target and host endianness are different which is the most common case
      on PPC64. To fix it, this introduces DEVICE_HOST_ENDIAN for the ram device.
      
      This has been tested on PPC64 BE/LE host/guest in all possible combinations
      including TCG.
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NYongji Xie <xyjxie@linux.vnet.ibm.com>
      Message-Id: <1488171164-28319-1-git-send-email-xyjxie@linux.vnet.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c99a29e7
  5. 24 2月, 2017 1 次提交
    • J
      tcg: drop global lock during TCG code execution · 8d04fb55
      Jan Kiszka 提交于
      This finally allows TCG to benefit from the iothread introduction: Drop
      the global mutex while running pure TCG CPU code. Reacquire the lock
      when entering MMIO or PIO emulation, or when leaving the TCG loop.
      
      We have to revert a few optimization for the current TCG threading
      model, namely kicking the TCG thread in qemu_mutex_lock_iothread and not
      kicking it in qemu_cpu_kick. We also need to disable RAM block
      reordering until we have a more efficient locking mechanism at hand.
      
      Still, a Linux x86 UP guest and my Musicpal ARM model boot fine here.
      These numbers demonstrate where we gain something:
      
      20338 jan       20   0  331m  75m 6904 R   99  0.9   0:50.95 qemu-system-arm
      20337 jan       20   0  331m  75m 6904 S   20  0.9   0:26.50 qemu-system-arm
      
      The guest CPU was fully loaded, but the iothread could still run mostly
      independent on a second core. Without the patch we don't get beyond
      
      32206 jan       20   0  330m  73m 7036 R   82  0.9   1:06.00 qemu-system-arm
      32204 jan       20   0  330m  73m 7036 S   21  0.9   0:17.03 qemu-system-arm
      
      We don't benefit significantly, though, when the guest is not fully
      loading a host CPU.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Message-Id: <1439220437-23957-10-git-send-email-fred.konrad@greensocs.com>
      [FK: Rebase, fix qemu_devices_reset deadlock, rm address_space_* mutex]
      Signed-off-by: NKONRAD Frederic <fred.konrad@greensocs.com>
      [EGC: fixed iothread lock for cpu-exec IRQ handling]
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      [AJB: -smp single-threaded fix, clean commit msg, BQL fixes]
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Reviewed-by: NPranith Kumar <bobby.prani@gmail.com>
      [PM: target-arm changes]
      Acked-by: NPeter Maydell <peter.maydell@linaro.org>
      8d04fb55
  6. 18 2月, 2017 1 次提交
  7. 01 2月, 2017 1 次提交
  8. 28 1月, 2017 2 次提交
  9. 10 1月, 2017 1 次提交
  10. 31 10月, 2016 2 次提交
    • A
      memory: Don't use memcpy for ram_device regions · 4a2e242b
      Alex Williamson 提交于
      With a vfio assigned device we lay down a base MemoryRegion registered
      as an IO region, giving us read & write accessors.  If the region
      supports mmap, we lay down a higher priority sub-region MemoryRegion
      on top of the base layer initialized as a RAM device pointer to the
      mmap.  Finally, if we have any quirks for the device (ie. address
      ranges that need additional virtualization support), we put another IO
      sub-region on top of the mmap MemoryRegion.  When this is flattened,
      we now potentially have sub-page mmap MemoryRegions exposed which
      cannot be directly mapped through KVM.
      
      This is as expected, but a subtle detail of this is that we end up
      with two different access mechanisms through QEMU.  If we disable the
      mmap MemoryRegion, we make use of the IO MemoryRegion and service
      accesses using pread and pwrite to the vfio device file descriptor.
      If the mmap MemoryRegion is enabled and results in one of these
      sub-page gaps, QEMU handles the access as RAM, using memcpy to the
      mmap.  Using either pread/pwrite or the mmap directly should be
      correct, but using memcpy causes us problems.  I expect that not only
      does memcpy not necessarily honor the original width and alignment in
      performing a copy, but it potentially also uses processor instructions
      not intended for MMIO spaces.  It turns out that this has been a
      problem for Realtek NIC assignment, which has such a quirk that
      creates a sub-page mmap MemoryRegion access.
      
      To resolve this, we disable memory_access_is_direct() for ram_device
      regions since QEMU assumes that it can use memcpy for those regions.
      Instead we access through MemoryRegionOps, which replaces the memcpy
      with simple de-references of standard sizes to the host memory.
      
      With this patch we attempt to provide unrestricted access to the RAM
      device, allowing byte through qword access as well as unaligned
      access.  The assumption here is that accesses initiated by the VM are
      driven by a device specific driver, which knows the device
      capabilities.  If unaligned accesses are not supported by the device,
      we don't want them to work in a VM by performing multiple aligned
      accesses to compose the unaligned access.  A down-side of this
      philosophy is that the xp command from the monitor attempts to use
      the largest available access weidth, unaware of the underlying
      device.  Using memcpy had this same restriction, but at least now an
      operator can dump individual registers, even if blocks of device
      memory may result in access widths beyond the capabilities of a
      given device (RTL NICs only support up to dword).
      Reported-by: NThorsten Kohfeldt <thorsten.kohfeldt@gmx.de>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      4a2e242b
    • A
      memory: Replace skip_dump flag with "ram_device" · 21e00fa5
      Alex Williamson 提交于
      Setting skip_dump on a MemoryRegion allows us to modify one specific
      code path, but the restriction we're trying to address encompasses
      more than that.  If we have a RAM MemoryRegion backed by a physical
      device, it not only restricts our ability to dump that region, but
      also affects how we should manipulate it.  Here we recognize that
      MemoryRegions do not change to sometimes allow dumps and other times
      not, so we replace setting the skip_dump flag with a new initializer
      so that we know exactly the type of region to which we're applying
      this behavior.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      21e00fa5
  11. 24 10月, 2016 4 次提交
  12. 27 9月, 2016 3 次提交
    • P
      migration: sync all address spaces · 9c1f8f44
      Paolo Bonzini 提交于
      Migrating a VM during reboot sometimes results in differences
      between the source and destination in the SMRAM area.
      
      This is because migration_bitmap_sync() only fetches from KVM
      the dirty log of address_space_memory.  SMRAM memory slots
      are ignored and the modifications to SMRAM are not sent to the
      destination.
      Reported-by: NHe Rongguang <herongguang.he@huawei.com>
      Reviewed-by: NHe Rongguang <herongguang.he@huawei.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9c1f8f44
    • P
      memory: introduce IOMMUOps.notify_flag_changed · 5bf3d319
      Peter Xu 提交于
      The new interface can be used to replace the old notify_started() and
      notify_stopped(). Meanwhile it provides explicit flags so that IOMMUs
      can know what kind of notifications it is requested for.
      Acked-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <1474606948-14391-3-git-send-email-peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5bf3d319
    • P
      memory: introduce IOMMUNotifier and its caps · cdb30812
      Peter Xu 提交于
      IOMMU Notifier list is used for notifying IO address mapping changes.
      Currently VFIO is the only user.
      
      However it is possible that future consumer like vhost would like to
      only listen to part of its notifications (e.g., cache invalidations).
      
      This patch introduced IOMMUNotifier and IOMMUNotfierFlag bits for a
      finer grained control of it.
      
      IOMMUNotifier contains a bitfield for the notify consumer describing
      what kind of notification it is interested in. Currently two kinds of
      notifications are defined:
      
      - IOMMU_NOTIFIER_MAP:    for newly mapped entries (additions)
      - IOMMU_NOTIFIER_UNMAP:  for entries to be removed (cache invalidates)
      
      When registering the IOMMU notifier, we need to specify one or multiple
      types of messages to listen to.
      
      When notifications are triggered, its type will be checked against the
      notifier's type bits, and only notifiers with registered bits will be
      notified.
      
      (For any IOMMU implementation, an in-place mapping change should be
       notified with an UNMAP followed by a MAP.)
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <1474606948-14391-2-git-send-email-peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      cdb30812
  13. 14 9月, 2016 1 次提交
  14. 04 7月, 2016 2 次提交
    • P
      memory: Assert that memory_region_init_rom_device() ops aren't NULL · 39e0b03d
      Peter Maydell 提交于
      It doesn't make sense to pass a NULL ops argument to
      memory_region_init_rom_device(), because the effect will
      be that if the guest tries to write to the memory region
      then QEMU will segfault. Catch the bug earlier by sanity
      checking the arguments to this function, and remove the
      misleading documentation that suggests that passing NULL
      might be sensible.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1467122287-24974-4-git-send-email-peter.maydell@linaro.org
      39e0b03d
    • P
      memory: Provide memory_region_init_rom() · a1777f7f
      Peter Maydell 提交于
      Provide a new helper function memory_region_init_rom() for memory
      regions which are read-only (and unlike those created by
      memory_region_init_rom_device() don't have special behaviour
      for writes). This has the same behaviour as calling
      memory_region_init_ram() and then memory_region_set_readonly()
      (which is what we do today in boards with pure ROMs) but is a
      more easily discoverable API for the purpose.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1467122287-24974-2-git-send-email-peter.maydell@linaro.org
      a1777f7f
  15. 01 7月, 2016 1 次提交
  16. 22 6月, 2016 1 次提交
  17. 29 5月, 2016 4 次提交
  18. 23 5月, 2016 4 次提交
  19. 19 5月, 2016 1 次提交
  20. 23 3月, 2016 1 次提交
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  21. 14 3月, 2016 2 次提交
  22. 07 3月, 2016 1 次提交