[PATCH 0/5] accel/tcg: Restrict WatchPoint API to TCG

Philippe Mathieu-Daudé posted 5 patches 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260106231908.16756-1-philmd@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Riku Voipio <riku.voipio@iki.fi>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Peter Maydell <peter.maydell@linaro.org>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Thomas Huth <thuth@redhat.com>, Max Filippov <jcmvbkbc@gmail.com>
MAINTAINERS                         |   1 -
include/accel/tcg/cpu-ops.h         |  45 +-----------
include/accel/tcg/watchpoint.h      |  57 ++++++++++++++++
include/exec/breakpoint.h           |  10 ---
include/exec/watchpoint.h           |  41 -----------
include/hw/core/cpu.h               |   3 +-
target/arm/internals.h              |   2 +-
target/ppc/internal.h               |   2 +-
target/riscv/debug.h                |   2 +-
target/s390x/s390x-internal.h       |   1 -
target/s390x/tcg/tcg_s390x.h        |   4 ++
accel/tcg/cputlb.c                  |   1 +
accel/tcg/tcg-accel-ops.c           |   2 +-
accel/tcg/user-exec-stub.c          |  32 +++++++++
accel/tcg/watchpoint.c              |  83 +++++++++++++++++++++-
system/watchpoint.c                 | 102 ----------------------------
target/arm/debug_helper.c           |   2 +-
target/arm/tcg/mte_helper.c         |   2 +-
target/arm/tcg/sve_helper.c         |   2 +-
target/i386/cpu.c                   |   6 +-
target/i386/machine.c               |   2 +-
target/i386/tcg/system/bpt_helper.c |   2 +-
target/ppc/cpu.c                    |  83 +---------------------
target/ppc/cpu_init.c               |   2 +-
target/ppc/watchpoint.c             |  93 +++++++++++++++++++++++++
target/riscv/cpu_helper.c           |   2 +-
target/riscv/debug.c                |   2 +-
target/s390x/cpu.c                  |  30 ++++----
target/s390x/helper.c               |  40 +----------
target/s390x/tcg/debug.c            |  53 +++++++++++++++
target/s390x/tcg/excp_helper.c      |   2 +-
target/s390x/tcg/mem_helper.c       |   1 +
target/xtensa/dbg_helper.c          |   2 +-
system/meson.build                  |   1 -
target/ppc/meson.build              |   1 +
target/s390x/tcg/meson.build        |   3 +
36 files changed, 366 insertions(+), 353 deletions(-)
create mode 100644 include/accel/tcg/watchpoint.h
delete mode 100644 include/exec/watchpoint.h
delete mode 100644 system/watchpoint.c
create mode 100644 target/ppc/watchpoint.c
create mode 100644 target/s390x/tcg/debug.c
[PATCH 0/5] accel/tcg: Restrict WatchPoint API to TCG
Posted by Philippe Mathieu-Daudé 1 month ago
Hi,

This series is related to single binary, where we want
to build compilation units once. Headers using the
'CONFIG_USER_ONLY' definition are "poisoned", except if
we duplicate the meson source set, in that case we define
COMPILING_SYSTEM_VS_USER and CONFIG_USER_ONLY is no more
poisoned.

Looking at the watchpoint API, CONFIG_USER_ONLY is only
used to avoid stubs, so it can easily be reworked to avoid
the need of duplicated source set.

Since here, we also restrict the API to TCG, and unify it
in a single header: "accel/tcg/watchpoint.h", since it is
distinct to the BreakPoint API which can be used by hardware
accelerators.

Philippe Mathieu-Daudé (5):
  target/i386: Restrict WatchPoint API to TCG
  target/ppc: Restrict WatchPoint API to TCG
  target/s390x: Restrict WatchPoint API to TCG
  accel/tcg: Un-inline WatchPoint API user-emulation stubs
  accel/tcg: Unify watchpoint API

 MAINTAINERS                         |   1 -
 include/accel/tcg/cpu-ops.h         |  45 +-----------
 include/accel/tcg/watchpoint.h      |  57 ++++++++++++++++
 include/exec/breakpoint.h           |  10 ---
 include/exec/watchpoint.h           |  41 -----------
 include/hw/core/cpu.h               |   3 +-
 target/arm/internals.h              |   2 +-
 target/ppc/internal.h               |   2 +-
 target/riscv/debug.h                |   2 +-
 target/s390x/s390x-internal.h       |   1 -
 target/s390x/tcg/tcg_s390x.h        |   4 ++
 accel/tcg/cputlb.c                  |   1 +
 accel/tcg/tcg-accel-ops.c           |   2 +-
 accel/tcg/user-exec-stub.c          |  32 +++++++++
 accel/tcg/watchpoint.c              |  83 +++++++++++++++++++++-
 system/watchpoint.c                 | 102 ----------------------------
 target/arm/debug_helper.c           |   2 +-
 target/arm/tcg/mte_helper.c         |   2 +-
 target/arm/tcg/sve_helper.c         |   2 +-
 target/i386/cpu.c                   |   6 +-
 target/i386/machine.c               |   2 +-
 target/i386/tcg/system/bpt_helper.c |   2 +-
 target/ppc/cpu.c                    |  83 +---------------------
 target/ppc/cpu_init.c               |   2 +-
 target/ppc/watchpoint.c             |  93 +++++++++++++++++++++++++
 target/riscv/cpu_helper.c           |   2 +-
 target/riscv/debug.c                |   2 +-
 target/s390x/cpu.c                  |  30 ++++----
 target/s390x/helper.c               |  40 +----------
 target/s390x/tcg/debug.c            |  53 +++++++++++++++
 target/s390x/tcg/excp_helper.c      |   2 +-
 target/s390x/tcg/mem_helper.c       |   1 +
 target/xtensa/dbg_helper.c          |   2 +-
 system/meson.build                  |   1 -
 target/ppc/meson.build              |   1 +
 target/s390x/tcg/meson.build        |   3 +
 36 files changed, 366 insertions(+), 353 deletions(-)
 create mode 100644 include/accel/tcg/watchpoint.h
 delete mode 100644 include/exec/watchpoint.h
 delete mode 100644 system/watchpoint.c
 create mode 100644 target/ppc/watchpoint.c
 create mode 100644 target/s390x/tcg/debug.c

-- 
2.52.0


Re: [PATCH 0/5] accel/tcg: Restrict WatchPoint API to TCG
Posted by Richard Henderson 4 weeks ago
On 1/7/26 10:19, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> This series is related to single binary, where we want
> to build compilation units once. Headers using the
> 'CONFIG_USER_ONLY' definition are "poisoned", except if
> we duplicate the meson source set, in that case we define
> COMPILING_SYSTEM_VS_USER and CONFIG_USER_ONLY is no more
> poisoned.
> 
> Looking at the watchpoint API, CONFIG_USER_ONLY is only
> used to avoid stubs, so it can easily be reworked to avoid
> the need of duplicated source set.
> 
> Since here, we also restrict the API to TCG, and unify it
> in a single header: "accel/tcg/watchpoint.h", since it is
> distinct to the BreakPoint API which can be used by hardware
> accelerators.

Watchpoints could be used on aarch64 kvm.

They probably could be used on other kvm, with modifications to kvm -- at present the api 
presented to the hypervisor is breakpoint specific, and I'm not sure why.

I think it would be shame to preclude other accelerators from handling watchpoints, even 
if none currently do so.


r~