Skip to content
Snippets Groups Projects
  1. Oct 08, 2020
  2. Oct 06, 2020
  3. Oct 05, 2020
  4. Oct 03, 2020
  5. Sep 30, 2020
  6. Sep 23, 2020
    • Stefan Hajnoczi's avatar
      qemu/atomic.h: rename atomic_ to qatomic_ · d73415a3
      Stefan Hajnoczi authored
      
      clang's C11 atomic_fetch_*() functions only take a C11 atomic type
      pointer argument. QEMU uses direct types (int, etc) and this causes a
      compiler error when a QEMU code calls these functions in a source file
      that also included <stdatomic.h> via a system header file:
      
        $ CC=clang CXX=clang++ ./configure ... && make
        ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      
      Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
      used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h
      and <stdatomic.h> can co-exist. I checked /usr/include on my machine and
      searched GitHub for existing "qatomic_" users but there seem to be none.
      
      This patch was generated using:
      
        $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \
          sort -u >/tmp/changed_identifiers
        $ for identifier in $(</tmp/changed_identifiers); do
              sed -i "s%\<$identifier\>%q$identifier%g" \
                  $(git grep -I -l "\<$identifier\>")
          done
      
      I manually fixed line-wrap issues and misaligned rST tables.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
      d73415a3
  7. Sep 17, 2020
  8. Sep 16, 2020
  9. Sep 09, 2020
  10. Sep 08, 2020
  11. Sep 03, 2020
    • Richard Henderson's avatar
      cputlb: Make store_helper less fragile to compiler optimizations · 6b8b622e
      Richard Henderson authored
      
      This has no functional change.
      
      The current function structure is:
      
          inline QEMU_ALWAYSINLINE
          store_memop() {
              switch () {
                  ...
              default:
                  qemu_build_not_reached();
              }
          }
          inline QEMU_ALWAYSINLINE
          store_helper() {
              ...
              if (span_two_pages_or_io) {
                  ...
                  helper_ret_stb_mmu();
              }
              store_memop();
          }
          helper_ret_stb_mmu() {
              store_helper();
          }
      
      Whereas GCC will generate an error at compile-time when an always_inline
      function is not inlined, Clang does not.  Nor does Clang prioritize the
      inlining of always_inline functions.  Both of these are arguably bugs.
      
      Both `store_memop` and `store_helper` need to be inlined and allow
      constant propogations to eliminate the `qemu_build_not_reached` call.
      
      However, if the compiler instead chooses to inline helper_ret_stb_mmu
      into store_helper, then store_helper is now self-recursive and the
      compiler is no longer able to propagate the constant in the same way.
      
      This does not produce at current QEMU head, but was reproducible
      at v4.2.0 with `clang-10 -O2 -fexperimental-new-pass-manager`.
      
      The inline recursion problem can be fixed solely by marking
      helper_ret_stb_mmu as noinline, so the compiler does not make an
      incorrect decision about which functions to inline.
      
      In addition, extract store_helper_unaligned as a noinline subroutine
      that can be shared by all of the helpers.  This saves about 6k code
      size in an optimized x86_64 build.
      
      Reported-by: default avatarShu-Chun Weng <scw@google.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      6b8b622e
  12. Aug 21, 2020
    • Marc-André Lureau's avatar
      meson: accel · 1a82878a
      Marc-André Lureau authored
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      1a82878a
    • Paolo Bonzini's avatar
      meson: rename included C source files to .c.inc · 139c1837
      Paolo Bonzini authored
      
      With Makefiles that have automatically generated dependencies, you
      generated includes are set as dependencies of the Makefile, so that they
      are built before everything else and they are available when first
      building the .c files.
      
      Alternatively you can use a fine-grained dependency, e.g.
      
              target/arm/translate.o: target/arm/decode-neon-shared.inc.c
      
      With Meson you have only one choice and it is a third option, namely
      "build at the beginning of the corresponding target"; the way you
      express it is to list the includes in the sources of that target.
      
      The problem is that Meson decides if something is a source vs. a
      generated include by looking at the extension: '.c', '.cc', '.m', '.C'
      are sources, while everything else is considered an include---including
      '.inc.c'.
      
      Use '.c.inc' to avoid this, as it is consistent with our other convention
      of using '.rst.inc' for included reStructuredText files.  The editorconfig
      file is adjusted.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      139c1837
    • Paolo Bonzini's avatar
      trace: switch position of headers to what Meson requires · 243af022
      Paolo Bonzini authored
      
      Meson doesn't enjoy the same flexibility we have with Make in choosing
      the include path.  In particular the tracing headers are using
      $(build_root)/$(<D).
      
      In order to keep the include directives unchanged,
      the simplest solution is to generate headers with patterns like
      "trace/trace-audio.h" and place forwarding headers in the source tree
      such that for example "audio/trace.h" includes "trace/trace-audio.h".
      
      This patch is too ugly to be applied to the Makefiles now.  It's only
      a way to separate the changes to the tracing header files from the
      Meson rewrite of the tracing logic.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      243af022
  13. Aug 04, 2020
  14. Jul 27, 2020
  15. Jul 24, 2020
  16. Jul 17, 2020
  17. Jul 16, 2020
    • Luc Michel's avatar
      tcg/cpu-exec: precise single-stepping after an exception · a7ba744f
      Luc Michel authored
      When single-stepping with a debugger attached to QEMU, and when an
      exception is raised, the debugger misses the first instruction after the
      exception:
      
      $ qemu-system-aarch64 -M virt -display none -cpu cortex-a53 -s -S
      
      $ aarch64-linux-gnu-gdb
      GNU gdb (GDB) 9.2
      [...]
      (gdb) tar rem :1234
      Remote debugging using :1234
      warning: No executable has been specified and target does not support
      determining executable automatically.  Try using the "file" command.
      0x0000000000000000 in ?? ()
      (gdb) # writing nop insns to 0x200 and 0x204
      (gdb) set *0x200 = 0xd503201f
      (gdb) set *0x204 = 0xd503201f
      (gdb) # 0x0 address contains 0 which is an invalid opcode.
      (gdb) # The CPU should raise an exception and jump to 0x200
      (gdb) si
      0x0000000000000204 in ?? ()
      
      With this commit, the same run steps correctly on the first instruction
      of the exception vector:
      
      (gdb) si
      0x0000000000000200 in ?? ()
      
      Buglink: https://bugs.launchpad.net/qemu/+bug/757702
      
      
      Signed-off-by: default avatarLuc Michel <luc.michel@greensocs.com>
      Message-Id: <20200716193947.3058389-1-luc.michel@greensocs.com>
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      a7ba744f
  18. Jul 15, 2020
  19. Jul 10, 2020
Loading