Skip to content
Snippets Groups Projects
  1. May 08, 2018
    • Paolo Bonzini's avatar
      exec: reintroduce MemoryRegion caching · 48564041
      Paolo Bonzini authored
      
      MemoryRegionCache was reverted to "normal" address_space_* operations
      for 2.9, due to lack of support for IOMMUs.  Reinstate the
      optimizations, caching only the IOMMU translation at address_cache_init
      but not the IOMMU lookup and target AddressSpace translation are not
      cached; now that MemoryRegionCache supports IOMMUs, it becomes more widely
      applicable too.
      
      The inlined fast path is defined in memory_ldst_cached.inc.h, while the
      slow path uses memory_ldst.inc.c as before.  The smaller fast path causes
      a little code size reduction in MemoryRegionCache users:
      
          hw/virtio/virtio.o text size before: 32373
          hw/virtio/virtio.o text size after: 31941
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      48564041
    • Paolo Bonzini's avatar
      exec: extract address_space_translate_iommu, fix page_mask corner case · a411c84b
      Paolo Bonzini authored
      
      This will be used to process IOMMUs in a MemoryRegionCache.  This
      includes a small bugfix, in that the returned page_mask is now
      correctly -1 if the IOMMU memory region maps the entire address
      space directly.  Previously, address_space_get_iotlb_entry would
      return ~TARGET_PAGE_MASK.
      
      Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a411c84b
    • Paolo Bonzini's avatar
      exec: small changes to flatview_do_translate · ad2804d9
      Paolo Bonzini authored
      
      Prepare for extracting the IOMMU part to a separate function.  Mostly
      cosmetic; the only semantic change is that, if there is more than one
      cascaded IOMMU and the second one fails to translate, *plen_out is now
      adjusted according to the page mask of the first IOMMU.
      
      Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ad2804d9
  2. Apr 27, 2018
  3. Apr 03, 2018
  4. Mar 20, 2018
  5. Mar 19, 2018
    • Igor Mammedov's avatar
      Use cpu_create(type) instead of cpu_init(cpu_model) · 2278b939
      Igor Mammedov authored
      
      With all targets defining CPU_RESOLVING_TYPE, refactor
      cpu_parse_cpu_model(type, cpu_model) to parse_cpu_model(cpu_model)
      so that callers won't have to know internal resolving cpu
      type. Place it in exec.c so it could be called from both
      target independed vl.c and *-user/main.c.
      
      That allows us to stop abusing cpu type from
        MachineClass::default_cpu_type
      as resolver class in vl.c which were confusing part of
      cpu_parse_cpu_model().
      
      Also with new parse_cpu_model(), the last users of cpu_init()
      in null-machine.c and bsd/linux-user targets could be switched
      to cpu_create() API and cpu_init() API will be removed by
      follow up patch.
      
      With no longer users left remove MachineState::cpu_model field,
      new code should use MachineState::cpu_type instead and
      leave cpu_model parsing to generic code in vl.c.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1518000027-274608-5-git-send-email-imammedo@redhat.com>
      [ehabkost: Fix bsd-user build error]
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      2278b939
  6. Mar 09, 2018
  7. Mar 06, 2018
  8. Feb 19, 2018
    • Marcel Apfelbaum's avatar
      mem: add share parameter to memory-backend-ram · 06329cce
      Marcel Apfelbaum authored
      
      Currently only file backed memory backend can
      be created with a "share" flag in order to allow
      sharing guest RAM with other processes in the host.
      
      Add the "share" flag also to RAM Memory Backend
      in order to allow remapping parts of the guest RAM
      to different host virtual addresses. This is needed
      by the RDMA devices in order to remap non-contiguous
      QEMU virtual addresses to a contiguous virtual address range.
      
      Moved the "share" flag to the Host Memory base class,
      modified phys_mem_alloc to include the new parameter
      and a new interface memory_region_init_ram_shared_nomigrate.
      
      There are no functional changes if the new flag is not used.
      
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarMarcel Apfelbaum <marcel@redhat.com>
      06329cce
  9. Feb 06, 2018
    • Alistair Francis's avatar
      tcg: Replace fprintf(stderr, "*\n" with error_report() · 493d89bf
      Alistair Francis authored
      
      Replace a large number of the fprintf(stderr, "*\n" calls with
      error_report(). The functions were renamed with these commands and then
      compiler issues where manually fixed.
      
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      
      Signed-off-by: default avatarAlistair Francis <alistair.francis@xilinx.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Stefan Weil <sw@weilnetz.de>
      
      Conversions that aren't followed by exit() dropped, because they might
      be inappropriate.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <20180203084315.20497-14-armbru@redhat.com>
      Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
      493d89bf
  10. Jan 19, 2018
    • Haozhong Zhang's avatar
      hostmem-file: add "align" option · 98376843
      Haozhong Zhang authored
      
      When mmap(2) the backend files, QEMU uses the host page size
      (getpagesize(2)) by default as the alignment of mapping address.
      However, some backends may require alignments different than the page
      size. For example, mmap a device DAX (e.g., /dev/dax0.0) on Linux
      kernel 4.13 to an address, which is 4K-aligned but not 2M-aligned,
      fails with a kernel message like
      
      [617494.969768] dax dax0.0: qemu-system-x86: dax_mmap: fail, unaligned vma (0x7fa37c579000 - 0x7fa43c579000, 0x1fffff)
      
      Because there is no common approach to get such alignment requirement,
      we add the 'align' option to 'memory-backend-file', so that users or
      management utils, which have enough knowledge about the backend, can
      specify a proper alignment via this option.
      
      Signed-off-by: default avatarHaozhong Zhang <haozhong.zhang@intel.com>
      Message-Id: <20171211072806.2812-2-haozhong.zhang@intel.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      [ehabkost: fixed typo, fixed error_setg() format string]
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      98376843
  11. Jan 16, 2018
    • Pavel Dovgaluk's avatar
      cpu: flush TB cache when loading VMState · 15a356c4
      Pavel Dovgaluk authored
      
      Flushing TB cache is required because TBs key in the cache may match
      different code which existed in the previous state.
      
      Signed-off-by: default avatarPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Signed-off-by: default avatarMaria Klimushenkova <maria.klimushenkova@ispras.ru>
      Message-Id: <20180110134846.12940.99993.stgit@pasha-VirtualBox>
      [Add comment suggested by Peter Maydell. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
      15a356c4
    • Dr. David Alan Gilbert's avatar
      find_ram_offset: Align ram_addr_t allocation on long boundaries · 801110ab
      Dr. David Alan Gilbert authored
      
      The dirty bitmaps are built from 'long's and there is fast-path code
      for synchronising the case where the RAMBlock is aligned to the start
      of a long boundary.  Align the allocation to this boundary
      to cause the fast path to be used.
      
      Offsets before change:
      11398@1515169675.018566:find_ram_offset size: 0x1e0000 @ 0x8000000
      11398@1515169675.020064:find_ram_offset size: 0x20000 @ 0x81e0000
      11398@1515169675.020244:find_ram_offset size: 0x20000 @ 0x8200000
      11398@1515169675.024343:find_ram_offset size: 0x1000000 @ 0x8220000
      11398@1515169675.025154:find_ram_offset size: 0x10000 @ 0x9220000
      11398@1515169675.027682:find_ram_offset size: 0x40000 @ 0x9230000
      11398@1515169675.032921:find_ram_offset size: 0x200000 @ 0x9270000
      11398@1515169675.033307:find_ram_offset size: 0x1000 @ 0x9470000
      11398@1515169675.033601:find_ram_offset size: 0x1000 @ 0x9471000
      
      after change:
      10923@1515169108.818245:find_ram_offset size: 0x1e0000 @ 0x8000000
      10923@1515169108.819410:find_ram_offset size: 0x20000 @ 0x8200000
      10923@1515169108.819587:find_ram_offset size: 0x20000 @ 0x8240000
      10923@1515169108.823708:find_ram_offset size: 0x1000000 @ 0x8280000
      10923@1515169108.824503:find_ram_offset size: 0x10000 @ 0x9280000
      10923@1515169108.827093:find_ram_offset size: 0x40000 @ 0x92c0000
      10923@1515169108.833045:find_ram_offset size: 0x200000 @ 0x9300000
      10923@1515169108.833504:find_ram_offset size: 0x1000 @ 0x9500000
      10923@1515169108.833787:find_ram_offset size: 0x1000 @ 0x9540000
      
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20180105170138.23357-3-dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      801110ab
    • Dr. David Alan Gilbert's avatar
      find_ram_offset: Add comments and tracing · 154cc9ea
      Dr. David Alan Gilbert authored
      
      Add some comments so I can understand the various nested loops.
      Add some tracing so I can see what they're doing.
      
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20180105170138.23357-2-dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      154cc9ea
  12. Dec 21, 2017
  13. Dec 18, 2017
  14. Nov 21, 2017
    • Peter Maydell's avatar
      exec.c: Factor out before/after actions for notdirty memory writes · 27266271
      Peter Maydell authored
      
      The function notdirty_mem_write() has a sequence of actions
      it has to do before and after the actual business of writing
      data to host RAM to ensure that dirty flags are correctly
      updated and we flush any TCG translations for the region.
      We need to do this also in other places that write directly
      to host RAM, most notably the TCG atomic helper functions.
      Pull out the before and after pieces into their own functions.
      
      We use an API where the prepare function stashes the various
      bits of information about the write into a struct for the
      complete function to use, because in the calls for the atomic
      helpers the place where the complete function will be called
      doesn't have the information to hand.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1511201308-23580-2-git-send-email-peter.maydell@linaro.org
      27266271
  15. Nov 15, 2017
  16. Nov 13, 2017
  17. Oct 24, 2017
  18. Oct 18, 2017
  19. Oct 12, 2017
    • Peter Xu's avatar
      exec: simplify address_space_get_iotlb_entry · 076a93d7
      Peter Xu authored
      
      This patch let address_space_get_iotlb_entry() to use the newly
      introduced page_mask parameter in flatview_do_translate(). Then we
      will be sure the IOTLB can be aligned to page mask, also we should
      nicely support huge pages now when introducing a764040c.
      
      Fixes: a764040c ("exec: abstract address_space_do_translate()")
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarMaxime Coquelin <maxime.coquelin@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <20171010094247.10173-3-maxime.coquelin@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      076a93d7
    • Peter Xu's avatar
      exec: add page_mask for flatview_do_translate · d5e5fafd
      Peter Xu authored
      
      The function is originally used for flatview_space_translate() and what
      we care about most is (xlat, plen) range. However for iotlb requests, we
      don't really care about "plen", but the size of the page that "xlat" is
      located on. While, plen cannot really contain this information.
      
      A simple example to show why "plen" is not good for IOTLB translations:
      
      E.g., for huge pages, it is possible that guest mapped 1G huge page on
      device side that used this GPA range:
      
        0x100000000 - 0x13fffffff
      
      Then let's say we want to translate one IOVA that finally mapped to GPA
      0x13ffffe00 (which is located on this 1G huge page). Then here we'll
      get:
      
        (xlat, plen) = (0x13fffe00, 0x200)
      
      So the IOTLB would be only covering a very small range since from
      "plen" (which is 0x200 bytes) we cannot tell the size of the page.
      
      Actually we can really know that this is a huge page - we just throw the
      information away in flatview_do_translate().
      
      This patch introduced "page_mask" optional parameter to capture that
      page mask info. Also, I made "plen" an optional parameter as well, with
      some comments for the whole function.
      
      No functional change yet.
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarMaxime Coquelin <maxime.coquelin@redhat.com>
      Message-Id: <20171010094247.10173-2-maxime.coquelin@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d5e5fafd
  20. Oct 10, 2017
  21. Sep 21, 2017
Loading