qemu: backport RISC-V TLB page flushing patches
PATCH 1/1 qemu: backport RISC-V TLB page flushing patches
The QEMU TCG framework currently does an unconditional flush on TLBs regardless of vaddr and asid values, adding a lot of overhead to RISC-V runtimes. Backport some patches from the qemu-devel mailing list which improve this part of the TCG logic. For more info:
https://lists.gnu.org/archive/html/qemu-devel/2026-08/msg08496.html
Here is an example of the kind of runtime speed-up these changes help with (taken from the upstream link):
|============================================================================ |Testsuite summary for GNU coreutils 9.11 |============================================================================ |# TOTAL: 733 |# PASS: 561 |# SKIP: 172 |# XFAIL: 0 |# FAIL: 0 |# XPASS: 0 |# ERROR: 0 |============================================================================ |make[1]: Leaving directory '/usr/lib/coreutils/ptest' |DURATION: 1049 |END: /usr/lib/coreutils/ptest |2026-08-31T17:23 |STOP: ptest-runner |TOTAL: 1 FAIL: 0
versus:
|============================================================================ |Testsuite summary for GNU coreutils 9.11 |============================================================================ |# TOTAL: 733 |# PASS: 561 |# SKIP: 172 |# XFAIL: 0 |# FAIL: 0 |# XPASS: 0 |# ERROR: 0 |============================================================================ |make[1]: Leaving directory '/usr/lib/coreutils/ptest' |DURATION: 646 |END: /usr/lib/coreutils/ptest |2026-08-31T16:10 |STOP: ptest-runner |TOTAL: 1 FAIL: 0 |root@qemuriscv64:~#
Signed-off-by Trevor Gamblin <[email protected]>
--- meta/recipes-devtools/qemu/qemu.inc | 3 + ...ract-sfence_vma_allowed-from-helper_.patch | 56 +++++++++++++++++++ ...rget-riscv-add-helper_tlb_flush_page.patch | 50 +++++++++++++++++ ...-a-targeted-TLB-page-flush-for-sfenc.patch | 47 ++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemu/0001-target-riscv-extract-sfence_vma_allowed-from-helper_.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0002-target-riscv-add-helper_tlb_flush_page.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0003-target-riscv-use-a-targeted-TLB-page-flush-for-sfenc.patch
meta/recipes-devtools/qemu/qemu.inc +3 -0
@@ -35,6 +35,9 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://qemu-guest-agent.init \ file://qemu-guest-agent.udev \ file://0001-ui-sdl2.c-force-disable-SDL_HINT_VIDEO_X11_FORCE_EGL.patch \ + file://0001-target-riscv-extract-sfence_vma_allowed-from-helper_.patch \ + file://0002-target-riscv-add-helper_tlb_flush_page.patch \ + file://0003-target-riscv-use-a-targeted-TLB-page-flush-for-sfenc.patch \ " # file index at download.qemu.org isn't reliable: https://gitlab.com/qemu-project/qemu-web/-/issues/9 UPSTREAM_CHECK_URI = "https://www.qemu.org"
meta/recipes-devtools/qemu/qemu/0001-target-riscv-extract-sfence_vma_allowed-from-helper_.patch new file +56 -0
56 lines not on this page · raw message
meta/recipes-devtools/qemu/qemu/0002-target-riscv-add-helper_tlb_flush_page.patch new file +50 -0
50 lines not on this page · raw message
meta/recipes-devtools/qemu/qemu/0003-target-riscv-use-a-targeted-TLB-page-flush-for-sfenc.patch new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.55.0