Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: 6db03ccc7f4c
Choose a base ref
...
head repository: qemu/qemu
compare: 9400601a689a
Choose a head ref
  • 17 commits
  • 12 files changed
  • 5 contributors

Commits on Aug 5, 2023

  1. accel/tcg: Adjust parameters and locking with do_{ld,st}_mmio_*

    Replace MMULookupPageData* with CPUTLBEntryFull, addr, size.
    Move QEMU_IOTHREAD_LOCK_GUARD to the caller.
    
    This simplifies the usage from do_ld16_beN and do_st16_leN, where
    we weren't locking the entire operation, and required hoop jumping
    for passing addr and size.
    
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 5, 2023
    Copy the full SHA
    1966855 View commit details
    Browse the repository at this point in the history
  2. accel/tcg: Issue wider aligned i/o in do_{ld,st}_mmio_*

    If the address and size are aligned, send larger chunks
    to the memory subsystem.  This will be required to make
    more use of these helpers.
    
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 5, 2023
    Copy the full SHA
    190aba8 View commit details
    Browse the repository at this point in the history
  3. accel/tcg: Do not issue misaligned i/o

    In the single-page case we were issuing misaligned i/o to
    the memory subsystem, which does not handle it properly.
    Split such accesses via do_{ld,st}_mmio_*.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1800
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 5, 2023
    Copy the full SHA
    f7eaf9d View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2023

  1. accel/tcg: Call save_iotlb_data from io_readx as well

    Apply save_iotlb_data() to io_readx() as well as to io_writex().
    This fixes SEGFAULT on qemu_plugin_hwaddr_phys_addr() call plugins
    for addresses inside of MMIO region.
    
    Signed-off-by: Dmitriy Solovev <d.solovev@yadro.com>
    Signed-off-by: Mikhail Tyutin <m.tyutin@yadro.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20230804110903.19968-1-m.tyutin@yadro.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    mtyutin authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    c30d0b8 View commit details
    Browse the repository at this point in the history
  2. gdbstub: use 0 ("any process") on packets with no PID

    Previously, qemu-user would always report PID 1 to GDB. This was changed
    at dc14a7a (gdbstub: Report the actual qemu-user pid, 2023-06-30),
    but read_thread_id() still considers GDB packets with "no PID" as "PID
    1", which is not the qemu-user PID. Fix that by parsing "no PID" as "0",
    which the GDB Remote Protocol defines as "any process".
    
    Note that this should have no effect for system emulation as, in this
    case, gdb_create_default_process() will assign PID 1 for the first
    process and that is what the gdbstub uses for GDB requests with no PID,
    or PID 0.
    
    This issue was found with hexagon-lldb, which sends a "Hg" packet with
    only the thread-id, but no process-id, leading to the invalid usage of
    "PID 1" by qemu-hexagon and a subsequent "E22" reply.
    
    Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
    Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <78a3b06f6ab90a7ff8e73ae14a996eb27ec76c85.1690904195.git.quic_mathbern@quicinc.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    quic-mathbern authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    6c78de6 View commit details
    Browse the repository at this point in the history
  3. configure: Fix linux-user host detection for riscv64

    Mirror the host_arch variable from meson.build, so that we
    probe for the correct linux-user/include/host/ directory.
    
    Fixes: e3e477c ("configure: Fix cross-building for RISCV host")
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 6, 2023
    Copy the full SHA
    89e5b79 View commit details
    Browse the repository at this point in the history
  4. linux-user/elfload: Set V in ELF_HWCAP for RISC-V

    Set V bit for hwcap if misa is set.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1793
    Signed-off-by: Nathan Egge <negge@xiph.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230803131424.40744-1-negge@xiph.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    negge authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    4333f09 View commit details
    Browse the repository at this point in the history
  5. linux-user: Unset MAP_FIXED_NOREPLACE for host

    Passing MAP_FIXED_NOREPLACE to host will fail for reserved_va because
    the address space is reserved with mmap.  Replace it with MAP_FIXED
    in that case.
    
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-Id: <20230802071754.14876-2-akihiko.odaki@daynix.com>
    [rth: Expand inline commentary.]
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    akihikodaki authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    c3dd50d View commit details
    Browse the repository at this point in the history
  6. linux-user: Fix MAP_FIXED_NOREPLACE on old kernels

    The man page states:
    > Note that older kernels which do not recognize the MAP_FIXED_NOREPLACE
    > flag will typically (upon detecting a collision with a preexisting
    > mapping) fall back to a “non-MAP_FIXED” type of behavior: they will
    > return an address that is different from the requested address.
    > Therefore, backward-compatible software should check the returned
    > address against the requested address.
    https://man7.org/linux/man-pages/man2/mmap.2.html
    
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-Id: <20230802071754.14876-3-akihiko.odaki@daynix.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    akihikodaki authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    ddcdd8c View commit details
    Browse the repository at this point in the history
  7. linux-user: Do not call get_errno() in do_brk()

    Later the returned value is compared with -1, and negated errno is not
    expected.
    
    Fixes: 00faf08 ("linux-user: Don't use MAP_FIXED in do_brk()")
    Reviewed-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-Id: <20230802071754.14876-4-akihiko.odaki@daynix.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    akihikodaki authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    c6cc059 View commit details
    Browse the repository at this point in the history
  8. linux-user: Use MAP_FIXED_NOREPLACE for do_brk()

    MAP_FIXED_NOREPLACE can ensure the mapped address is fixed without
    concerning that the new mapping overwrites something else.
    
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-Id: <20230802071754.14876-5-akihiko.odaki@daynix.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    akihikodaki authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    e69e032 View commit details
    Browse the repository at this point in the history
  9. linux-user: Do nothing if too small brk is specified

    Linux 6.4.7 does nothing when a value smaller than the initial brk is
    specified.
    
    Fixes: 86f0473 ("linux-user: Fix brk() to release pages")
    Reviewed-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-Id: <20230802071754.14876-6-akihiko.odaki@daynix.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    akihikodaki authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    cb9d5d1 View commit details
    Browse the repository at this point in the history
  10. linux-user: Do not align brk with host page size

    do_brk() minimizes calls into target_mmap() by aligning the address
    with host page size, which is potentially larger than the target page
    size. However, the current implementation of this optimization has two
    bugs:
    
    - The start of brk is rounded up with the host page size while brk
      advertises an address aligned with the target page size as the
      beginning of brk. This makes the beginning of brk unmapped.
    - Content clearing after mapping is flawed. The size to clear is
      specified as HOST_PAGE_ALIGN(brk_page) - brk_page, but brk_page is
      aligned with the host page size so it is always zero.
    
    This optimization actually has no practical benefit. It makes difference
    when brk() is called multiple times with values in a range of the host
    page size. However, sophisticated memory allocators try to avoid to
    make such frequent brk() calls. For example, glibc 2.37 calls brk() to
    shrink the heap only when there is a room more than 128 KiB. It is
    rare to have a page size larger than 128 KiB if it happens.
    
    Let's remove the optimization to fix the bugs and make the code simpler.
    
    Fixes: 86f0473 ("linux-user: Fix brk() to release pages")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1616
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-Id: <20230802071754.14876-7-akihiko.odaki@daynix.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    akihikodaki authored and rth7680 committed Aug 6, 2023
    Copy the full SHA
    2aea137 View commit details
    Browse the repository at this point in the history
  11. linux-user: Properly set image_info.brk in flatload

    The heap starts at "brk" not "start_brk".  With this fixed,
    image_info.start_brk is unused and may be removed.
    
    Tested-by: Helge Deller <deller@gmx.de>
    Reviewed-by: Helge Deller <deller@gmx.de>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 6, 2023
    Copy the full SHA
    0662a62 View commit details
    Browse the repository at this point in the history
  12. linux-user: Remove last_brk

    This variable is unused.
    
    Reviewed-by: Helge Deller <deller@gmx.de>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 6, 2023
    Copy the full SHA
    62cbf08 View commit details
    Browse the repository at this point in the history
  13. bsd-user: Remove last_brk

    This variable is unused.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 6, 2023
    Copy the full SHA
    3c4a8a8 View commit details
    Browse the repository at this point in the history
  14. Merge tag 'pull-tcg-20230806-3' of https://gitlab.com/rth7680/qemu in…

    …to staging
    
    accel/tcg: Do not issue misaligned i/o
    accel/tcg: Call save_iotlb_data from io_readx
    gdbstub: use 0 ("any process") on packets with no PID
    linux-user: Fixes for MAP_FIXED_NOREPLACE
    linux-user: Fixes for brk
    linux-user: Set V in ELF_HWCAP for RISC-V
    *-user: Remove last_brk as unused
    
    # -----BEGIN PGP SIGNATURE-----
    #
    # iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmTQMPsdHHJpY2hhcmQu
    # aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/rmQf/az6d6X4iom0Hch19
    # U4BkoNP7NQB2Rue/avjP6Vy6yATDEPgIA5vcPcub+jYsCyEasRRCD1d4odxZp7Cr
    # MLoeX6dC+iGg0N7i3S1DSpZBqsRv/4+YE5ibPjYnZlv0F7re1L89yw4doj5OPN1w
    # 1p8bpTxA2+s/FOxgfKLSyZR4yMJ4jWKeH+em6qjEBXEAMSiE6u0S+Kt3bAO8amdo
    # 86e5d16F4sjs4kXMTEp9myNoXN/aRsWd1stzebQK+uV6qQQsdkIkMLZmZ8+o158A
    # QEuWpV8yoMxhXUsnjkNGbL5S3r2WDJpM6WbWxtjs1xOAaygYCOicXh+sqRefgyH/
    # 0NQQRw==
    # =4I5/
    # -----END PGP SIGNATURE-----
    # gpg: Signature made Sun 06 Aug 2023 04:47:07 PM PDT
    # gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
    # gpg:                issuer "richard.henderson@linaro.org"
    # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]
    
    * tag 'pull-tcg-20230806-3' of https://gitlab.com/rth7680/qemu:
      bsd-user: Remove last_brk
      linux-user: Remove last_brk
      linux-user: Properly set image_info.brk in flatload
      linux-user: Do not align brk with host page size
      linux-user: Do nothing if too small brk is specified
      linux-user: Use MAP_FIXED_NOREPLACE for do_brk()
      linux-user: Do not call get_errno() in do_brk()
      linux-user: Fix MAP_FIXED_NOREPLACE on old kernels
      linux-user: Unset MAP_FIXED_NOREPLACE for host
      linux-user/elfload: Set V in ELF_HWCAP for RISC-V
      configure: Fix linux-user host detection for riscv64
      gdbstub: use 0 ("any process") on packets with no PID
      accel/tcg: Call save_iotlb_data from io_readx as well
      accel/tcg: Do not issue misaligned i/o
      accel/tcg: Issue wider aligned i/o in do_{ld,st}_mmio_*
      accel/tcg: Adjust parameters and locking with do_{ld,st}_mmio_*
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Aug 6, 2023
    Copy the full SHA
    9400601 View commit details
    Browse the repository at this point in the history