From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717329; cv=none; d=zohomail.com; s=zohoarc; b=Wt7Opoa9wQPWco/p5wz8Scgg1GXcPT/YvDkarYIcReguYxLP/kMDaQUD5rkuxfnjq4+1STb/O/RO9qMda3tzUtTTI//acLwzNU/JN6FBtt9tHBZ8CgNdTOBHP+ZsrwfAcUl8c4ThHQrLnI6de8GIMoekn37vh0s2yGyXW2fvPhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717329; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ucbFAGOvuTx7WbCTzKLfC8IZsapegrE1iJdMSD7fJ38=; b=DeL9qaE//fuxSopfmHSm5O7XRNQiE3NKZLtk9017lAcdneAe8/CCO3A/3/OiF2kM/JfjZmXkqyh4FVVBHZ4SF/s7C0RJaImrt60zBVr9FSpGdQyk5YVdmMfsTMq3mpPqR8eHgA9kzRxUYTViU+7aQ/s9u1IW9/zkuUkN0CCqtvg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717329842691.346653895752; Fri, 10 Jul 2026 14:02:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEf-00015I-DE; Fri, 10 Jul 2026 16:54:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEd-00012z-E7 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:11 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEY-0000bB-2m for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:11 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-8485bd28dd0so1438819b3a.2 for ; Fri, 10 Jul 2026 13:54:05 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716845; x=1784321645; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ucbFAGOvuTx7WbCTzKLfC8IZsapegrE1iJdMSD7fJ38=; b=yFz9JfMhfUFHy01LqeVCS5RvLHGMfZicJOdo5rh6dmjZVFtd+PdPi3lscGw56Ma2VG QuQb1TUNzU1tNLBK+w+6AXlP2iOw+SF2HQwKjqI70nlPJiUUBx1TY5yjEAq0vDCcnXLp W1wNuukdHpkgSm1jfQVHZW8fFmSbTZIInh4qRYhxneUf0L7Z14YZsjvdU/knOQNZ4k14 qO/7SsCKs88VCFgeiuYU7Xn+B3KpFflqJFY3PlcD/BfR+pNgjGDasoKcS/qRxiOu4eFa rrcQTi+msRMDOfN3Nz7+siA1Lblgj4U+qHuqsJN/ekIhGt5sOW3U3v3nKfWnf7GaAiwz KAow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716845; x=1784321645; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ucbFAGOvuTx7WbCTzKLfC8IZsapegrE1iJdMSD7fJ38=; b=Ln9JTWJ+OurCo9QHnFmC4hjs3S6Lgq9ILIKJ48/cSY69h7Z7eqNJ/iHLpPaLYjsPK6 m4GtqTQcnNYw1xyP8Oxx/O2U+EsncBZFGeerVH8CBDfcdjTvZCvx3VL59N29T4vtuORf 2krdYFwQ2yIO7zcIAui/BUxTM6SGvBF9l0mT7xZ5lsXf99FMbo7czQSdwD6eyEsIKP+h dxBUdvvRm5Mj+EDrZMWmCJ7pMdwHov3UR/WYWC8gSGk5k3xWscN1CFl8Mo8MBp6Gj76V 0Ge+2GappvWlUFMlgzmGCugDzAMa/JaHHtVwau9rKmxRoiElhJ95vZWLE0buDzScB8ZN ga3A== X-Gm-Message-State: AOJu0Ywl1CJlzARnftxSOFYxzCaT+DwnLxTzHLPS5cwgXQulv7uCJ74P yEiy13PYTtQmJhPhQBpUo/bfeZmmyGAZ1Ukg5pJ2XAPInmnFtnTQR6JZzKcATg3X4dd3nV8ogvE +E5Pf X-Gm-Gg: AfdE7ckrlTAWRvfsBglYsgXV+dqqVz5YGydzaxWJEA2k7B6i0ebpsFJGczLyDhE4c0m ATumr9y0ehul6RqpX6nAZyKzaT1e0QhrOrudd7/Jtj2GLPk3lEaN3qE1kuXf+8gD4kNsn8jpham rR03Un6koMaCP3LbTYB0f18AlBtaJ1qYBFbKWZkEgKUfhVmgDwl9fvLAwBzuNl2Eko1aMMvzsR8 1pAjz4NTV1ZUG7CFqeGdhfRjSke8QARk4pml+K7Tv6zRZiJUnVdwx1T/wVjPqQgH/sxhq/S5bo1 T2qhKDgMZLb6O2mqvc2yZq4JsHN07/JHohiSeJZ+Rsk9rWTM6OB/FT8G2cKtxASypSuXzBCL0DC VSYZ6pmlTsrO8gK/Y4nhsn3995xfBO02eR4W1X2qWodNOVXig72wssPnphd6mrURpX4Pbr2ho2v vr5cpPzlAXZOiypRYfmg== X-Received: by 2002:a05:6a00:4484:b0:848:57f3:8f8f with SMTP id d2e1a72fcca58-8488974efcfmr484701b3a.51.1783716844432; Fri, 10 Jul 2026 13:54:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza Subject: [PATCH v3 01/51] cpu: Define BreakpointFlags type Date: Fri, 10 Jul 2026 13:53:11 -0700 Message-ID: <20260710205401.836304-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717330657158500 From: Philippe Mathieu-Daud=C3=A9 Use the BreakpointFlags typedef to better follow when we deal with breakpoint flags (BP_*). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson [rth: Don't rename mask variables to flags] Message-ID: <20260630220100.1289-19-philmd@oss.qualcomm.com> --- include/accel/tcg/cpu-ops.h | 6 ++++-- include/exec/breakpoint.h | 4 +++- include/exec/watchpoint.h | 8 +++++--- include/hw/core/cpu.h | 8 ++++---- accel/tcg/cputlb.c | 12 +++++++----- accel/tcg/tcg-accel-ops.c | 10 +++++----- accel/tcg/user-exec-stub.c | 11 ++++++----- accel/tcg/watchpoint.c | 9 +++++---- cpu-common.c | 8 ++++---- system/watchpoint.c | 6 +++--- target/arm/tcg/debug.c | 4 ++-- target/arm/tcg/mte_helper.c | 3 ++- target/ppc/cpu.c | 2 +- target/ppc/kvm.c | 5 +++-- target/riscv/cpu_helper.c | 2 +- target/riscv/debug.c | 6 +++--- target/s390x/tcg/debug.c | 3 ++- target/xtensa/dbg_helper.c | 2 +- 18 files changed, 61 insertions(+), 48 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 3ff6e6810e..568d82cdd3 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -297,7 +297,8 @@ struct TCGCPUOps { * specified by @flags. Exit via exception with a hit. */ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, - MemTxAttrs attrs, int flags, uintptr_t ra); + MemTxAttrs attrs, BreakpointFlags flags, + uintptr_t ra); =20 /** * cpu_watchpoint_address_matches: @@ -308,7 +309,8 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, va= ddr len, * Return the watchpoint flags that apply to [addr, addr+len). * If no watchpoint is registered for the range, the result is 0. */ -int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len); +BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu, + vaddr addr, vaddr len); =20 /* * Common pointer_wrap implementations. diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index cc6fedd09f..df772dfc70 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -12,6 +12,8 @@ #include "exec/vaddr.h" #include "exec/memattrs.h" =20 +typedef uint32_t BreakpointFlags; + /* Breakpoint/watchpoint flags */ #define BP_MEM_READ 0x01 #define BP_MEM_WRITE 0x02 @@ -28,7 +30,7 @@ =20 typedef struct CPUBreakpoint { vaddr pc; - int flags; /* BP_* */ + BreakpointFlags flags; QTAILQ_ENTRY(CPUBreakpoint) entry; } CPUBreakpoint; =20 diff --git a/include/exec/watchpoint.h b/include/exec/watchpoint.h index c4d069425b..a09daf47f1 100644 --- a/include/exec/watchpoint.h +++ b/include/exec/watchpoint.h @@ -8,11 +8,13 @@ #ifndef EXEC_WATCHPOINT_H #define EXEC_WATCHPOINT_H =20 +#include "exec/breakpoint.h" + int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - int flags, CPUWatchpoint **watchpoint); + BreakpointFlags flags, CPUWatchpoint **watchpoin= t); int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, - vaddr len, int flags); + vaddr len, BreakpointFlags flags); void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint= ); -void cpu_watchpoint_remove_all(CPUState *cpu, int mask); +void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags mask); =20 #endif /* EXEC_WATCHPOINT_H */ diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index b54035fb13..82b5136088 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1149,12 +1149,12 @@ static inline bool cpu_single_stepping(const CPUSta= te *cpu) return cpu->singlestep_flags & SSTEP_ENABLE; } =20 -int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags, +int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, CPUBreakpoint **breakpoint); -int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags); +int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags); void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint= ); -void cpu_breakpoint_remove_all(CPUState *cpu, int mask); -bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask); +void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); +bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); =20 /** * cpu_get_address_space: diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 7f7c208ba1..e2911e3aac 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1033,7 +1033,8 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx, CPUTLBEntry *te, tn; hwaddr iotlb, xlat, sz, paddr_page; vaddr addr_page; - int asidx, wp_flags, prot; + int asidx, prot; + BreakpointFlags wp_flags; bool is_ram, is_romd; =20 assert_cpu_is_self(cpu); @@ -1499,8 +1500,8 @@ void *probe_access(CPUArchState *env, vaddr addr, int= size, if (unlikely(flags & (TLB_NOTDIRTY | TLB_WATCHPOINT))) { /* Handle watchpoints. */ if (flags & TLB_WATCHPOINT) { - int wp_access =3D (access_type =3D=3D MMU_DATA_STORE - ? BP_MEM_WRITE : BP_MEM_READ); + BreakpointFlags wp_access =3D (access_type =3D=3D MMU_DATA_STO= RE + ? BP_MEM_WRITE : BP_MEM_READ); cpu_check_watchpoint(env_cpu(env), addr, size, full->attrs, wp_access, retaddr); } @@ -1702,7 +1703,8 @@ static void mmu_watch_or_dirty(CPUState *cpu, MMULook= upPageData *data, =20 /* On watchpoint hit, this will longjmp out. */ if (flags & TLB_WATCHPOINT) { - int wp =3D access_type =3D=3D MMU_DATA_STORE ? BP_MEM_WRITE : BP_M= EM_READ; + BreakpointFlags wp =3D access_type =3D=3D MMU_DATA_STORE ? BP_MEM_= WRITE + : BP_MEM_READ; cpu_check_watchpoint(cpu, addr, size, full->attrs, wp, ra); flags &=3D ~TLB_WATCHPOINT; } @@ -1885,7 +1887,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr a= ddr, MemOpIdx oi, } =20 if (unlikely(tlb_addr & TLB_WATCHPOINT)) { - int wp_flags =3D 0; + BreakpointFlags wp_flags =3D 0; =20 if (full->slow_flags[MMU_DATA_STORE] & TLB_WATCHPOINT) { wp_flags |=3D BP_MEM_WRITE; diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 560fe2554b..0aba254b81 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -110,20 +110,20 @@ void tcg_handle_interrupt(CPUState *cpu, int mask) } =20 /* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */ -static inline int xlat_gdb_type(CPUState *cpu, GdbBreakpointType gdbtype) +static BreakpointFlags xlat_gdb_type(CPUState *cpu, GdbBreakpointType gdbt= ype) { - static const int xlat[] =3D { + static const BreakpointFlags xlat[] =3D { [GDB_WATCHPOINT_WRITE] =3D BP_GDB | BP_MEM_WRITE, [GDB_WATCHPOINT_READ] =3D BP_GDB | BP_MEM_READ, [GDB_WATCHPOINT_ACCESS] =3D BP_GDB | BP_MEM_ACCESS, }; =20 - int cputype =3D xlat[gdbtype]; + BreakpointFlags cpuflags =3D xlat[gdbtype]; =20 if (cpu->cc->gdb_stop_before_watchpoint) { - cputype |=3D BP_STOP_BEFORE_ACCESS; + cpuflags |=3D BP_STOP_BEFORE_ACCESS; } - return cputype; + return cpuflags; } =20 static int tcg_insert_gdbstub_breakpoint(CPUState *cs, GdbBreakpointType t= ype, diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c index 28286e11a6..a10ff03922 100644 --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -22,13 +22,13 @@ void cpu_exec_reset_hold(CPUState *cpu) } =20 int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - int flags, CPUWatchpoint **watchpoint) + BreakpointFlags flags, CPUWatchpoint **watchpoin= t) { return -ENOSYS; } =20 int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, - vaddr len, int flags) + vaddr len, BreakpointFlags flags) { return -ENOSYS; } @@ -37,17 +37,18 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWat= chpoint *wp) { } =20 -void cpu_watchpoint_remove_all(CPUState *cpu, int mask) +void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags mask) { } =20 -int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len) +BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu, + vaddr addr, vaddr len) { return 0; } =20 void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, - MemTxAttrs atr, int fl, uintptr_t ra) + MemTxAttrs atr, BreakpointFlags flags, uintptr_t= ra) { } =20 diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index c75ed27845..5ea66e9763 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -52,10 +52,11 @@ static inline bool watchpoint_address_matches(CPUWatchp= oint *wp, } =20 /* Return flags for watchpoints that match addr + prot. */ -int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len) +BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu, + vaddr addr, vaddr len) { CPUWatchpoint *wp; - int ret =3D 0; + BreakpointFlags ret =3D 0; =20 QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { if (watchpoint_address_matches(wp, addr, len)) { @@ -67,7 +68,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr a= ddr, vaddr len) =20 /* Generate a debug exception if a watchpoint has been hit. */ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, - MemTxAttrs attrs, int flags, uintptr_t ra) + MemTxAttrs attrs, BreakpointFlags flags, uintptr= _t ra) { CPUWatchpoint *wp; =20 @@ -91,7 +92,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vadd= r len, =20 assert((flags & ~BP_MEM_ACCESS) =3D=3D 0); QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { - int hit_flags =3D wp->flags & flags; + BreakpointFlags hit_flags =3D wp->flags & flags; =20 if (hit_flags && watchpoint_address_matches(wp, addr, len)) { if (replay_running_debug()) { diff --git a/cpu-common.c b/cpu-common.c index adb76b3a78..ba2676cbad 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -389,7 +389,7 @@ void process_queued_cpu_work(CPUState *cpu) } =20 /* Return true if PC matches an installed breakpoint. */ -bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask) +bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask) { CPUBreakpoint *bp; =20 @@ -404,7 +404,7 @@ bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int m= ask) } =20 /* Add a breakpoint. */ -int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags, +int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, CPUBreakpoint **breakpoint) { CPUBreakpoint *bp; @@ -434,7 +434,7 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int = flags, } =20 /* Remove a specific breakpoint. */ -int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags) +int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags) { CPUBreakpoint *bp; =20 @@ -461,7 +461,7 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBre= akpoint *bp) } =20 /* Remove all matching breakpoints. */ -void cpu_breakpoint_remove_all(CPUState *cpu, int mask) +void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask) { CPUBreakpoint *bp, *next; =20 diff --git a/system/watchpoint.c b/system/watchpoint.c index 21d0bb36ca..3785ffff46 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -26,7 +26,7 @@ =20 /* Add a watchpoint. */ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - int flags, CPUWatchpoint **watchpoint) + BreakpointFlags flags, CPUWatchpoint **watchpoin= t) { CPUWatchpoint *wp; vaddr in_page; @@ -65,7 +65,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vadd= r len, =20 /* Remove a specific watchpoint. */ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, - int flags) + BreakpointFlags flags) { CPUWatchpoint *wp; =20 @@ -90,7 +90,7 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatch= point *watchpoint) } =20 /* Remove all matching watchpoints. */ -void cpu_watchpoint_remove_all(CPUState *cpu, int mask) +void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags mask) { CPUWatchpoint *wp, *next; =20 diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 528d2889c3..7171501d40 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -544,7 +544,7 @@ void hw_watchpoint_update(ARMCPU *cpu, int n) vaddr wvr =3D env->cp15.dbgwvr[n]; uint64_t wcr =3D env->cp15.dbgwcr[n]; int mask; - int flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; + BreakpointFlags flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; =20 if (env->cpu_watchpoint[n]) { cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[n]); @@ -650,7 +650,7 @@ void hw_breakpoint_update(ARMCPU *cpu, int n) uint64_t bcr =3D env->cp15.dbgbcr[n]; vaddr addr; int bt; - int flags =3D BP_CPU; + BreakpointFlags flags =3D BP_CPU; =20 if (env->cpu_breakpoint[n]) { cpu_breakpoint_remove_by_ref(CPU(cpu), env->cpu_breakpoint[n]); diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c index dca4ef5a94..17f920b3f3 100644 --- a/target/arm/tcg/mte_helper.c +++ b/target/arm/tcg/mte_helper.c @@ -190,7 +190,8 @@ uint8_t *allocation_tag_mem_probe(CPUARMState *env, int= ptr_mmu_idx, =20 /* Any debug exception has priority over a tag check exception. */ if (!probe && unlikely(flags & TLB_WATCHPOINT)) { - int wp =3D ptr_access =3D=3D MMU_DATA_LOAD ? BP_MEM_READ : BP_MEM_= WRITE; + BreakpointFlags wp =3D ptr_access =3D=3D MMU_DATA_LOAD ? BP_MEM_RE= AD + : BP_MEM_WRITE; assert(ra !=3D 0); cpu_check_watchpoint(env_cpu(env), ptr, ptr_size, attrs, wp, ra); } diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 47467ee163..36e1209119 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -145,7 +145,7 @@ void ppc_update_daw(CPUPPCState *env, int rid) bool sv =3D extract32(dawrx, PPC_BIT_NR(62), 1); bool pr =3D extract32(dawrx, PPC_BIT_NR(62), 1); vaddr len; - int flags; + BreakpointFlags flags; =20 assert(tcg_enabled()); =20 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 116b39a00f..aa21cab50e 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1429,7 +1429,7 @@ static int find_hw_breakpoint(target_ulong addr, GdbB= reakpointType type) return -1; } =20 -static int find_hw_watchpoint(target_ulong addr, int *flag) +static int find_hw_watchpoint(target_ulong addr, BreakpointFlags *flag) { int n; =20 @@ -1577,7 +1577,6 @@ static int kvm_handle_hw_breakpoint(CPUState *cs, { int handle =3D DEBUG_RETURN_GUEST; int n; - int flag =3D 0; =20 if (nb_hw_breakpoint + nb_hw_watchpoint > 0) { if (arch_info->status & KVMPPC_DEBUG_BREAKPOINT) { @@ -1587,6 +1586,8 @@ static int kvm_handle_hw_breakpoint(CPUState *cs, } } else if (arch_info->status & (KVMPPC_DEBUG_WATCH_READ | KVMPPC_DEBUG_WATCH_WRITE)) { + BreakpointFlags flag =3D 0; + n =3D find_hw_watchpoint(arch_info->address, &flag); if (n >=3D 0) { handle =3D DEBUG_RETURN_GDB; diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 2db07f5dfb..c318dcd633 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -2000,7 +2000,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, = int size, } else if (probe) { return false; } else { - int wp_access =3D 0; + BreakpointFlags wp_access =3D 0; =20 if (access_type =3D=3D MMU_DATA_LOAD) { wp_access |=3D BP_MEM_READ; diff --git a/target/riscv/debug.c b/target/riscv/debug.c index ba5bc6ae13..fa47b2724e 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -480,7 +480,7 @@ static void type2_breakpoint_insert(CPURISCVState *env,= target_ulong index) target_ulong addr =3D env->tdata2[index]; bool enabled =3D type2_breakpoint_enabled(ctrl); CPUState *cs =3D env_cpu(env); - int flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; + BreakpointFlags flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; uint32_t size, def_size; =20 if (!enabled) { @@ -605,7 +605,7 @@ static void type6_breakpoint_insert(CPURISCVState *env,= target_ulong index) target_ulong addr =3D env->tdata2[index]; bool enabled =3D type6_breakpoint_enabled(ctrl); CPUState *cs =3D env_cpu(env); - int flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; + BreakpointFlags flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; uint32_t size; =20 if (!enabled) { @@ -994,7 +994,7 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPU= Watchpoint *wp) target_ulong ctrl; target_ulong addr; int trigger_type; - int flags; + BreakpointFlags flags; int i; =20 for (i =3D 0; i < env->num_triggers; i++) { diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index 99140b1ac9..d10e9ed892 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -14,7 +14,8 @@ =20 void s390_cpu_recompute_watchpoints(CPUState *cs) { - const int wp_flags =3D BP_CPU | BP_MEM_WRITE | BP_STOP_BEFORE_ACCESS; + const BreakpointFlags wp_flags =3D BP_CPU | BP_MEM_WRITE + | BP_STOP_BEFORE_ACCESS; CPUS390XState *env =3D cpu_env(cs); =20 /* We are called when the watchpoints have changed. First diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index 3b91f7c38a..990012f60e 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -85,7 +85,7 @@ static void set_dbreak(CPUXtensaState *env, unsigned i, u= int32_t dbreaka, uint32_t dbreakc) { CPUState *cs =3D env_cpu(env); - int flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; + BreakpointFlags flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; uint32_t mask =3D dbreakc | ~DBREAKC_MASK; =20 if (env->cpu_watchpoint[i]) { --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783716902; cv=none; d=zohomail.com; s=zohoarc; b=TYVE1+t359ftMhrhBn7K5+AuyStkWkH9sID9Te3Pnxn0cvEjdwKJTVfn8M8APzjPGeyRakAmJ3YphanYwMGtbtaGKV+/5LJf+I3EiI6oOJUjHxDpRfWqC4klBXvgLaHOgOoHs3Ohxd2fwG4cM70tPySGnWpSUxFqTsb4MCtW1ik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783716902; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NCYrAVPYzdovZO0+mJzi1+ftzAz885Lyc3ZdMCVw2Io=; b=i9zYGQmhDEDRMho5e8d/zkDe23WPpUAKary2qnlJQTziY1IHY56r6Hwdk1nO3/siTpeY6T6oSqmhl2sy8fHhVFpinRT1JASmLsRCHk/t3oVzKTBstTjk9/awON70nJuMDyneXGnPHj1CKKxP6h0kovf6eyJEgkR28yuOsSOe50c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783716902238507.4733627791762; Fri, 10 Jul 2026 13:55:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEi-00017o-69; Fri, 10 Jul 2026 16:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEf-00015l-JA for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:13 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEZ-0000ba-FI for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:13 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-8478fe07f0fso1455558b3a.0 for ; Fri, 10 Jul 2026 13:54:06 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716846; x=1784321646; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NCYrAVPYzdovZO0+mJzi1+ftzAz885Lyc3ZdMCVw2Io=; b=IKMJpf2fH/2vq6PvheUOQvIvlD1mpLE69m9GA2Nx4R99Z2VytosV6EcP0USP89/7vR Wyx7mOpBI620l3Ecc5zu1gm9e/5WT/mgoVjLlwO3yA6JwAffgSRrUIbOYBoccoRmCMyB kKOoEV8EStb1wlC+heeudxrzhmv0ZSr6BxABdwzccs0DsJEjx9mCi8O8nN5Ri7tr3R3D TK0BG0mRXdC+MzvpOCeMn84iiyOhZbJYpxciyGnsEONNbQk6Qsfal9ZgkOSFjF/5a5lQ 5SdDOyYetThICPxxUhzXt2V6BU4HihVTq4CMh7biUPHP+ky1ivZvSmd3+m73/8L1Foh7 Tq5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716846; x=1784321646; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=NCYrAVPYzdovZO0+mJzi1+ftzAz885Lyc3ZdMCVw2Io=; b=cFoHNs+Jb9NrRtTTLRYagBghAIPKsd7DUtzoSen1CI36tXu9wU+sWHkfJ+T/I4Jdoq NFPaI/EyP95Eo8MXslrLhYdkTSduwxoKoxivUSrVuYfDVUPTlPruOKzepYklM/Pg0PQ4 PXT9qAHA6+ibqFh3SoYlA2MRGYJ+q6/SaQXmOU9M4c88OV/q6n3O9YAp+Yk5Z8Iewcnz TBa+UUm522sF3ZMC22mym7DIs/rTItrAmfYg/BRr91PPPakd9eXeanRIkWd0FziDSeOa heJ/iVVvSUJoC7cKVKaFS/v0IRiKLKpDJNGJ6pCe4GK1ypkCHJcIPOhjzBNlp35WxFfj VsZg== X-Gm-Message-State: AOJu0Yyc++kudjy6A4G0OlEPtZmyrsTsn0a8DWNpzV0pt6UMO37rQ0S1 SPPUtfZMFHYK6lkIiqmXBmnFElXWdIqgORFl9GnVjKTxFrwvdYTsuOZxJhBQN7tREfPXN2yi7E7 oBPsq X-Gm-Gg: AfdE7ck1V4htQ9R/0llX0zrQnrsIJp0VjCh1zo+8t8nmFkr1eI6CV3uI6gfto3LdwgQ tyyfc38XNuXcdIWLO4315+xtkbBv9SO+i/cQQV1S4SNM0MRuCvM0IoLrtyoSlG5ERIAimRg+OyU RVd9GJ3KJxXnwND8BPlv15uETi6FzHgUrSL+nvypF5jUSIDoNMXMePvVTONPGgHA4ZFkUOxxbY6 b8f9lnu4EVtOTp/JZuTBpjgnIJ0HLIpDl5bO2FxOSw3me7sFiz+bWit0yN/DHH5eoo4y4fN1B5Z AEd0pfZHujDds278tBErRpNl5L4epFgO3wE2WiiRmMM1IHN0v09Dtg58E4OoFqhOirNkhapYuyu KIhPQHs736hiYMpXCljdN2+/T2SBa0Y4LB6rJoCuBYfmld83G9wO8fH19w76EsmO+hIjze5KswM QueBj81i2a3CkUfNjderSsyT7eBawk X-Received: by 2002:a05:6a00:1d09:b0:848:51b3:f3c2 with SMTP id d2e1a72fcca58-848897ebf6fmr461615b3a.33.1783716845907; Fri, 10 Jul 2026 13:54:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 02/51] exec/breakpoint: Move BP declarations from hw/core/cpu.h Date: Fri, 10 Jul 2026 13:53:12 -0700 Message-ID: <20260710205401.836304-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783716904277158500 Content-Type: text/plain; charset="utf-8" Move cpu_breakpoint_* declarations to exec/breakpoint.h. Signed-off-by: Richard Henderson --- include/exec/breakpoint.h | 7 +++++++ include/hw/core/cpu.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index df772dfc70..e6aa630d17 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -43,4 +43,11 @@ typedef struct CPUWatchpoint { QTAILQ_ENTRY(CPUWatchpoint) entry; } CPUWatchpoint; =20 +int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, + CPUBreakpoint **breakpoint); +int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags); +void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint= ); +void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); +bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); + #endif diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 82b5136088..786e9b8aad 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1149,13 +1149,6 @@ static inline bool cpu_single_stepping(const CPUStat= e *cpu) return cpu->singlestep_flags & SSTEP_ENABLE; } =20 -int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, - CPUBreakpoint **breakpoint); -int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags); -void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint= ); -void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); -bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); - /** * cpu_get_address_space: * @cpu: CPU to get address space from --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717008; cv=none; d=zohomail.com; s=zohoarc; b=GlbnzD7uL2ycpXPxmpwo/7AloubI5+0lNah1cmHtmmBTH6n3+gUn/ECVjE0vAlygr0CdHwC+NqEZ5Iqa5KDOOeafXUosCg8VVDvkzTf+VflpVBSmteI+rWiqUt7af/5VYS7fLEN9lP0rN4qmBLmwx8mReIgdmf5P2yRdKSLAKFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717008; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Fk3aaqwEL447TLAUxQvRMrNROG8iRdVw/mnS/h1SzDM=; b=d7Z4SU+jZajgxKm6j8h7708hD6XGTs9AnZ0fXkB17qgplTR8CmWTMLIodRx/6v5tS1DrFEFqGKKNCZbcHDMCXbSxbKriTWM6whkDQNCHFeODjpjfKqqpYuFqzQzNHN49nVCLa4eZ+vnX+Tjv0eihRCOuJe4SzMxXCggUeKcJIuk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717008167836.8973243970323; Fri, 10 Jul 2026 13:56:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEm-0001C8-54; Fri, 10 Jul 2026 16:54:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEh-00016u-8L for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:15 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEb-0000cH-Jl for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:14 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-84862b0d5f8so1161417b3a.3 for ; Fri, 10 Jul 2026 13:54:09 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716848; x=1784321648; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Fk3aaqwEL447TLAUxQvRMrNROG8iRdVw/mnS/h1SzDM=; b=l94OAmaKL0EIKtarLCm8pkrzcHzJ7IUidHjNxh6HjPu0R71u1cnXbhaZQSuWIy0yr6 73Jm0GW5S6+0eeEkQc0arLgI9vHfiJxHgnnhf078xQCz2CNB5f0f+vlmYcMKlTUGECSr v/l0gR6Iqr3PBOA+AkRaD9i/PptYVZys7THM97b6Ko+rCXoDTjeeb/Ojru4//QR6rHh/ VhXqmhvp3TxiMhFpKL0M34yS9bv1Rjfv6IfzrCxhI1mb72vw3zWTSnITi5pe27OM4wJ0 IZoGKCLQk49UFQVjjd/y4/PCeuEBtYZQw+tFusOIoGpnoncbJA6gu1lu2JrWhKA6z0Ng wyOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716848; x=1784321648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Fk3aaqwEL447TLAUxQvRMrNROG8iRdVw/mnS/h1SzDM=; b=d83G8viNEYtcOMQJnCuFOlzVqiCmwkoKDPQKGXWvPmYlpW1cZkjYLnzFOuaNq9yRif /+WgTmXwdCfdSDPnjIQwYn2wYtKWwgKaSwowaq0IJN52wmara9FJG/cpvNqhZLjGXuB6 7oZSfc8bUaoKYRKDgpk40YkYqLTCyxfBWshYxhAicoGn/Asnq22zm91zKBgHMZ7/eDjG BcUO/y6sIOAXGkid7md6euLa0QYWgPD8qDNGUfz/0PXJj0lqelKZ/DDQCON+EnGKair/ icI6wo5zZhdQ15OnH1mhItfMwoTVNHOk2Peyn8HFuw76GkOKfMORgGciOvfkuDdwixgq YXhg== X-Gm-Message-State: AOJu0YyysHdIYPB9Ba+MUrp7e5aWAugj1svYa3vsocjS2+jlK6TkM9cB 69zzuklsvsXrDIVKMyNsjm2DW4Lm1jEaSmbKd1zdx6fuwXjNVKnSVSbKZR9GtxkWTmKBRXbFm4a Nx5Z8 X-Gm-Gg: AfdE7cl6daIbIPEbBoGTSS/1rZ4Txyh0anxkSX/3If1uv7jWGio1Zgkb6JsJZTmjSRW 5JjIKVtukgpgiSZRyk32OejJfzGRSxN+4Q6Uh2yXOBPwUac+RvCX41rmC/o+sq66Qzcq+7QH0LC BntsKnZrKkDYicGRZcAW+A3fmCBg/a9IPLuL3arFwRGaFiJjV+IAqlFQVoCfg+FElkveu8HRdG6 SejRJqTDBVpODK6ccPP+Qv8bUpQZdqBCAiwj2e3/Z5ohEl5ydIItt2XPg66oYtaC6jJACEn9ZPm Yntt/X7t8PiBfyvlC/zOuD3D+ymEesWlPBM7GLbVKteb3goZfTAucbQfpwcRF8babEqHEC+ua0k qDt8SVIqiyPZaDjZfcB/KysM6Zf/nPzSDDwJ8PV5jsfrdYyHisgSLCgAvU9T/J15UR/0fI7VBRe n4WaHUUJ3uanEn3BWEKA== X-Received: by 2002:aa7:88c8:0:b0:842:5bf3:c53c with SMTP id d2e1a72fcca58-848895db20bmr576161b3a.2.1783716847914; Fri, 10 Jul 2026 13:54:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 03/51] exec/breakpoint: Merge watchpoint.h Date: Fri, 10 Jul 2026 13:53:13 -0700 Message-ID: <20260710205401.836304-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717010507158501 Content-Type: text/plain; charset="utf-8" Move the contents of watchpoint.h into breakpoint.h. Adjust all users of exec/watchpoint.h. Signed-off-by: Richard Henderson --- include/exec/breakpoint.h | 7 +++++++ include/exec/watchpoint.h | 20 -------------------- accel/tcg/tcg-accel-ops.c | 2 +- accel/tcg/user-exec-stub.c | 2 +- system/watchpoint.c | 2 +- target/arm/debug_helper.c | 2 +- target/arm/tcg/debug.c | 2 +- target/i386/cpu.c | 2 +- target/i386/machine.c | 2 +- target/i386/tcg/system/bpt_helper.c | 2 +- target/ppc/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +- target/riscv/debug.c | 2 +- target/s390x/helper.c | 1 - target/s390x/tcg/debug.c | 1 - target/xtensa/dbg_helper.c | 2 +- 16 files changed, 19 insertions(+), 34 deletions(-) delete mode 100644 include/exec/watchpoint.h diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index e6aa630d17..c886f3afb7 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -50,4 +50,11 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBrea= kpoint *breakpoint); void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); =20 +int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, + BreakpointFlags flags, CPUWatchpoint **watchpoin= t); +int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, + vaddr len, BreakpointFlags flags); +void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint= ); +void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags mask); + #endif diff --git a/include/exec/watchpoint.h b/include/exec/watchpoint.h deleted file mode 100644 index a09daf47f1..0000000000 --- a/include/exec/watchpoint.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * CPU watchpoints - * - * Copyright (c) 2012 SUSE LINUX Products GmbH - * SPDX-License-Identifier: LGPL-2.1-or-later - */ - -#ifndef EXEC_WATCHPOINT_H -#define EXEC_WATCHPOINT_H - -#include "exec/breakpoint.h" - -int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - BreakpointFlags flags, CPUWatchpoint **watchpoin= t); -int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, - vaddr len, BreakpointFlags flags); -void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint= ); -void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags mask); - -#endif /* EXEC_WATCHPOINT_H */ diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 0aba254b81..c59ab85606 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -39,7 +39,7 @@ #include "exec/hwaddr.h" #include "exec/tb-flush.h" #include "exec/translation-block.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "gdbstub/enums.h" =20 #include "hw/core/cpu.h" diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c index a10ff03922..973bdbcd7a 100644 --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -2,7 +2,7 @@ #include "hw/core/cpu.h" #include "accel/tcg/cpu-ops.h" #include "exec/replay-core.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "internal-common.h" =20 void cpu_resume(CPUState *cpu) diff --git a/system/watchpoint.c b/system/watchpoint.c index 3785ffff46..67e4560e78 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -21,7 +21,7 @@ #include "qemu/error-report.h" #include "exec/cputlb.h" #include "exec/target_page.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "hw/core/cpu.h" =20 /* Add a watchpoint. */ diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 8477ca5def..2c3a56c7d5 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -11,7 +11,7 @@ #include "internals.h" #include "cpu-features.h" #include "cpregs.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "system/tcg.h" =20 /* diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 7171501d40..f245d5b072 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -12,7 +12,7 @@ #include "internals.h" #include "cpu-features.h" #include "cpregs.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "system/tcg.h" =20 /* Return the Exception Level targeted by debug exceptions. */ diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 5805d33ab9..7a7cd38b14 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -39,7 +39,7 @@ #include "standard-headers/asm-x86/kvm_para.h" #include "hw/core/qdev-properties.h" #include "hw/i386/topology.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #ifndef CONFIG_USER_ONLY #include "confidential-guest.h" #include "monitor/hmp.h" diff --git a/target/i386/machine.c b/target/i386/machine.c index df0e0c178e..390ccfa3f8 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -7,7 +7,7 @@ #include "hw/i386/x86.h" #include "kvm/kvm_i386.h" #include "hw/xen/xen.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "system/kvm.h" #include "system/kvm_xen.h" #include "system/tcg.h" diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index 2feea69c8a..0ba2f01016 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -21,7 +21,7 @@ #include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "exec/helper-proto.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "tcg/helper-tcg.h" =20 =20 diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 36e1209119..7ff352b11b 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -22,7 +22,7 @@ #include "cpu-models.h" #include "cpu-qom.h" #include "exec/log.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "fpu/softfloat-helpers.h" #include "mmu-hash64.h" #include "helper_regs.h" diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index f404c7e549..9dd91ae95a 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -41,7 +41,7 @@ #include "disas/capstone.h" #include "fpu/softfloat.h" #include "exec/page-protection.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "helper_regs.h" #include "internal.h" #include "spr_common.h" diff --git a/target/riscv/debug.c b/target/riscv/debug.c index fa47b2724e..b8fea64bec 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -31,7 +31,7 @@ #include "target/riscv/debug.h" #include "trace.h" #include "exec/helper-proto.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "system/cpu-timers.h" #include "exec/icount.h" =20 diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 1a2658eaf9..dabf8571cd 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -27,7 +27,6 @@ #include "system/memory.h" #include "system/runstate.h" #include "exec/target_page.h" -#include "exec/watchpoint.h" =20 void s390x_tod_timer(void *opaque) { diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index d10e9ed892..7a838775ec 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -6,7 +6,6 @@ =20 #include "qemu/osdep.h" #include "exec/breakpoint.h" -#include "exec/watchpoint.h" #include "accel/tcg/cpu-loop.h" #include "target/s390x/cpu.h" #include "target/s390x/s390x-internal.h" diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index 990012f60e..e180096b42 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -30,7 +30,7 @@ #include "cpu.h" #include "exec/helper-proto.h" #include "qemu/host-utils.h" -#include "exec/watchpoint.h" +#include "exec/breakpoint.h" #include "system/address-spaces.h" =20 void HELPER(wsr_ibreakenable)(CPUXtensaState *env, uint32_t v) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717342; cv=none; d=zohomail.com; s=zohoarc; b=CL12Tnbti4+cWglg6BHQevvPG/eewJ5VI4Fw+OqX+AYfs31Pf3fmP30tpvL2fL3+juhvuLgwS0rUIRUaoGx0tduL9mUhYsg2YZYtfaqljeOiaHgypSYv2OdSZVkDD98rDEDOX+3P2KU1i4pLPAjrt3DhGLcjJPqAWVoD0XXbq08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717342; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OV4mwuDsn3z8Z/dPHFM9BZdKpLpXqp3lTFEeDocPdGc=; b=Zp9Xy3ETMQtFZee8bvkSbrDW6H1kxR0Pi69P+Z6mFB9XW6Sij+kWJH5W09mJaWvZSb8NdHkBFekXOjndbn0ohLsfz+F3ZiYDWUUSjZb2mriYHekmqyr3shahwDJ97hnW2IiAn84bpUQKJyEuhioawEC3W+d/O1W7pegjW32qMzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717342216772.6134671852865; Fri, 10 Jul 2026 14:02:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEl-00019a-35; Fri, 10 Jul 2026 16:54:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEi-00018X-PJ for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:16 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEc-0000cz-Tv for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:16 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-84867f07d63so1546403b3a.2 for ; Fri, 10 Jul 2026 13:54:10 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716849; x=1784321649; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OV4mwuDsn3z8Z/dPHFM9BZdKpLpXqp3lTFEeDocPdGc=; b=UlorlOHBHM92YmlIm/ywMVPGGNyMAoSCCTqX2eVoymkHh/hTa3EbJP+k/RF7S3o8pU AIG4CzOPfGhO6ZqOT6cr29SYnoyqUUaph5NIIukIj8GQc4mSH6qHylFoElH1B5B7KbHq dX8avpBN1JF7GXFxirLCeGMHLJK2rctN4PGC9oISxUu3ZhVT1ArJcfCGjJzTWFx7UA4f zOykBuRYC3RUEC51OWv3/UHoqlwdyV4KlrcIQR82k7+Ikeh8NDg5xvFvdHeFU3SoLfNX cP73NisInEKyHzy4D+vVBt+HRSGcXbNbqUEkGocj3mKNuwD8OdM4ueR1Dx117ICOAlJ0 vucA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716849; x=1784321649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=OV4mwuDsn3z8Z/dPHFM9BZdKpLpXqp3lTFEeDocPdGc=; b=U2IBuDVpmtsUAEGv2rR7jlRT4ANmApOJLqE9msYcPy93cKSUjJJfCHuwFCnR9nwDfj Io+pFwx4i6nwEhwU/BDE2vTFWxMQ5EVPdiPkZ8WzT5CAXac8VQ6qIQ81K/pdotdvRr8O UbEYeZxc0ENQ4XcK2QyfBHPeNj2t4yR/7K8J1GYgy2EcrelwtHFxdoz0KO4s/p2dLuta l0DQUSLz38UMnHCvFju7VxCex4tytgZIHapsyBQBgo6bBVjyYpRoToMas75gqi/0LcWi nPjoVldoEwQ1hrE8yNwUH4GMgvIL9D8T1kCKetkugCu/Afmvq3/ubt/tDDRVLfkuAJE4 g9Cw== X-Gm-Message-State: AOJu0Yyzg4Z/YJIAdhmWhMVczbY6VXKO+KWlhYpQZIoiy97WsoF9Q1Si xLZiiuDBhKR/rHqONSjVGDafMytIGUTNoXUG5tIlPl8qPqADHApZ1VhoN1QJLEMKHz21ZN+bNVk dw32F X-Gm-Gg: AfdE7cn3Xa565kaxxmf3zGx7XneKfufKOhLq/azNknQSE7k8MhUHJnOrXHIQIC0gGno acLx0ce3ETbYx83pdAkAbRQA1A2L42WLmlhkZzUAgNeHH42oLygtDGoIfZp9ImLP+Ye1kUG2ZCn RlMgHi/fuXQ/40u39F8MHzEEe77gHUd4tSazXMJVXz3c28P6RpW2RRxJAC/ySAFFI+qUbdfD6JV 2wrTZaPI1g2hxvq9KrKRQ34PUsv8+0IyPwgsjuSwNxppUKpzOSW/rpmG3Y9pkKZBm+aBECEAF0A 6DAEcsO407W9Mj5QBAYGJtIgLKK3gOnjkD8JW6MXuPPrD/DXPreNzoCqJuXQyw6++pO/O0sSn62 geHEEI70/BKUIpHVRjpbLlCZDU0Ls3SimxtxwQie428myEsKWMIFTy8z6eNDhQWJPcInR3rcz0R M++xBPqqU6jOG/5dN90g== X-Received: by 2002:a05:6a00:a27:b0:848:2f7a:2e5e with SMTP id d2e1a72fcca58-8488976671amr487362b3a.77.1783716849246; Fri, 10 Jul 2026 13:54:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 04/51] qemu/typedefs: Declare CPUBreakpoint and CPUWatchpoint globally Date: Fri, 10 Jul 2026 13:53:14 -0700 Message-ID: <20260710205401.836304-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717344475158500 Content-Type: text/plain; charset="utf-8" Adjust all uses of 'struct' in the uses of this type. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/breakpoint.h | 8 ++++---- include/hw/core/cpu.h | 2 -- include/qemu/typedefs.h | 2 ++ target/arm/cpu.h | 4 ++-- target/i386/cpu.h | 4 ++-- target/ppc/cpu.h | 4 ++-- target/riscv/cpu.h | 4 ++-- target/xtensa/cpu.h | 4 ++-- target/riscv/debug.c | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index c886f3afb7..f1186b909f 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -28,20 +28,20 @@ typedef uint32_t BreakpointFlags; #define BP_WATCHPOINT_HIT_WRITE (BP_MEM_WRITE << BP_HIT_SHIFT) #define BP_WATCHPOINT_HIT (BP_MEM_ACCESS << BP_HIT_SHIFT) =20 -typedef struct CPUBreakpoint { +struct CPUBreakpoint { vaddr pc; BreakpointFlags flags; QTAILQ_ENTRY(CPUBreakpoint) entry; -} CPUBreakpoint; +}; =20 -typedef struct CPUWatchpoint { +struct CPUWatchpoint { vaddr vaddr; vaddr len; vaddr hitaddr; MemTxAttrs hitattrs; int flags; /* BP_* */ QTAILQ_ENTRY(CPUWatchpoint) entry; -} CPUWatchpoint; +}; =20 int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, CPUBreakpoint **breakpoint); diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 786e9b8aad..481646f5b9 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -84,8 +84,6 @@ DECLARE_CLASS_CHECKERS(CPUClass, CPU, typedef struct ArchCPU CpuInstanceType; \ OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME); =20 -typedef struct CPUWatchpoint CPUWatchpoint; - /* see physmem.c */ struct CPUAddressSpace; =20 diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 2344c92182..919fe8ebff 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -39,9 +39,11 @@ typedef struct Chardev Chardev; typedef struct Clock Clock; typedef struct ConfidentialGuestSupport ConfidentialGuestSupport; typedef struct CPUArchState CPUArchState; +typedef struct CPUBreakpoint CPUBreakpoint; typedef struct CPUPluginState CPUPluginState; typedef struct CPUState CPUState; typedef struct CPUTLBEntryFull CPUTLBEntryFull; +typedef struct CPUWatchpoint CPUWatchpoint; typedef struct DeviceState DeviceState; typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot; typedef struct DisasContextBase DisasContextBase; diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 03a30afcbe..f0b4599d7a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -754,8 +754,8 @@ typedef struct CPUArchState { ARMVectorReg za[ARM_MAX_VQ * 16]; } za_state; =20 - struct CPUBreakpoint *cpu_breakpoint[16]; - struct CPUWatchpoint *cpu_watchpoint[16]; + CPUBreakpoint *cpu_breakpoint[16]; + CPUWatchpoint *cpu_watchpoint[16]; =20 /* Optional fault info across tlb lookup. */ ARMMMUFaultInfo *tlb_fi; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index e6a197602d..9dbfa7c9b9 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2185,8 +2185,8 @@ typedef struct CPUArchState { target_ulong exception_next_eip; target_ulong dr[8]; /* debug registers; note dr4 and dr5 are unused */ union { - struct CPUBreakpoint *cpu_breakpoint[4]; - struct CPUWatchpoint *cpu_watchpoint[4]; + CPUBreakpoint *cpu_breakpoint[4]; + CPUWatchpoint *cpu_watchpoint[4]; }; /* break/watchpoints for dr[0..3] */ int old_exception; /* exception in flight */ =20 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index cbd5964b1a..bda8ad16ad 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1320,8 +1320,8 @@ struct CPUArchState { /* MMU context, only relevant for full system emulation */ #if defined(TARGET_PPC64) ppc_slb_t slb[MAX_SLB_ENTRIES]; /* PowerPC 64 SLB area */ - struct CPUBreakpoint *ciabr_breakpoint; - struct CPUWatchpoint *dawr_watchpoint[2]; + CPUBreakpoint *ciabr_breakpoint; + CPUWatchpoint *dawr_watchpoint[2]; #endif target_ulong sr[32]; /* segment registers */ uint32_t nb_BATs; /* number of BATs */ diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index bdd28d329b..9cd38d10a3 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -491,8 +491,8 @@ struct CPUArchState { uint64_t *tdata1; uint64_t *tdata2; uint64_t *tdata3; - struct CPUBreakpoint **cpu_breakpoint; - struct CPUWatchpoint **cpu_watchpoint; + CPUBreakpoint **cpu_breakpoint; + CPUWatchpoint **cpu_watchpoint; QEMUTimer **itrigger_timer; int64_t last_icount; bool itrigger_enabled; diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 442e98bd1b..ab42b4be00 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -545,9 +545,9 @@ struct CPUArchState { unsigned static_vectors; =20 /* Watchpoints for DBREAK registers */ - struct CPUWatchpoint *cpu_watchpoint[MAX_NDBREAK]; + CPUWatchpoint *cpu_watchpoint[MAX_NDBREAK]; /* Breakpoints for IBREAK registers */ - struct CPUBreakpoint *cpu_breakpoint[MAX_NIBREAK]; + CPUBreakpoint *cpu_breakpoint[MAX_NIBREAK]; }; =20 /** diff --git a/target/riscv/debug.c b/target/riscv/debug.c index b8fea64bec..67c09b1a53 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -1060,8 +1060,8 @@ void riscv_trigger_realize(CPURISCVState *env) env->tdata1 =3D g_new0(uint64_t, env->num_triggers); env->tdata2 =3D g_new0(uint64_t, env->num_triggers); env->tdata3 =3D g_new0(uint64_t, env->num_triggers); - env->cpu_breakpoint =3D g_new0(struct CPUBreakpoint *, env->num_trigge= rs); - env->cpu_watchpoint =3D g_new0(struct CPUWatchpoint *, env->num_trigge= rs); + env->cpu_breakpoint =3D g_new0(CPUBreakpoint *, env->num_triggers); + env->cpu_watchpoint =3D g_new0(CPUWatchpoint *, env->num_triggers); env->itrigger_timer =3D g_new0(QEMUTimer *, env->num_triggers); =20 for (i =3D 0; i < env->num_triggers; i++) { --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717278; cv=none; d=zohomail.com; s=zohoarc; b=PcAYCpqnaoHfAdAXYWYb2lwkydVOMB0hvYcE8bXgDiNpP5hBDcrI+NqUQhg1ztYntx3NGWDo7m9giag3aRjGMJYJs6d2xkboM9oibjuEtBCifJeXkcNV8aGZXY3/zIAYbJZCKxur3Lea3PW+d6KHxxkWoTpUvVHi6YfIV8DG2L0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717278; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gkaJCNX67B3j7ndloFDN5kylCYvx7pNXiMbKUrJ80tc=; b=RvfcOdcDUg7aebELdfglORBiTiFkxun8gsqIZJF81MJsNjde3hiQmKmjhhVpj1p0VzeekmRQJLK8qEkJXaJci6rLztZ9apAM5HiC98LQPWh2FhM2y+tbCopvtHEFXqDSGEwJCDf6htQH2Q9n1JxvaiI73KnrypEHs/t7TN/xF6Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717278662240.15534730731713; Fri, 10 Jul 2026 14:01:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEm-0001DZ-Rw; Fri, 10 Jul 2026 16:54:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEk-00019X-AA for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:18 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEd-0000dN-M9 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:17 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-84867f07d63so1546409b3a.2 for ; Fri, 10 Jul 2026 13:54:11 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716850; x=1784321650; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gkaJCNX67B3j7ndloFDN5kylCYvx7pNXiMbKUrJ80tc=; b=tfh08xfnK67VgfddWUo+s1dlhHRgF/MPn50vxksRQoI+UbScFdrhL5YvYNNMIC3fxW Tt0wDJzLm7liaXUB2RhASjxVLsT5/D3K6UJY8956hO6EJ2e1lXBwy05Q9F9XbDxKq55s l9BXIO7q8pLgsXriXsprAauhEZvtJE3WHQ8Exq0qMiYSnjUiw/zoCgECZePsILhLNXOB NzHFXw8LMSRN2swNhizxjE1PO2gW8avUpKQUIAmoY2peZ0S1c6szy8rTqdmyJYBaEIAd N+zuzUq3arsWwU4pUpzDmqpu4P86FeiiBEUW1b0YLhKNlVgCPUjORH/7xYEKCXQZW983 M/8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716850; x=1784321650; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=gkaJCNX67B3j7ndloFDN5kylCYvx7pNXiMbKUrJ80tc=; b=TWlx/57BYRUisdcoPYvm/+02r3k6li/Sc8tE199bACLWPDxRdzCF+ukdx13KGyqxGk cJ+ER6qSmUlu05STeUuEWy+Bz7/maQjffVthQybojXn9dMbeeIN6RAPYWC2iNZzd1kEP wyhRg1akFUtNqNFnvVXbq9PfdHvBQTFURWm28gPp2Wero1M1Qsm5GFmxM4PtKDAQvpE5 /f5ay673R184GjDZ6HvWnbrOGT8uKzVerdtOHKcFHHFMrQyIlZigQDeSqH6aoCia8ra5 WMHhn22NAJrJAI3U7tDxaXJ61WfgYfitEJg8I+grPg1ehAwHrjtIPCsKJzAurWAN55AI Clqw== X-Gm-Message-State: AOJu0YzJvwsUEwq6tpdk4OU53v2J3GGjfLFxML7o5V7nETaInkdTon6k O6sW2U3O+rL/GZK75pKg063hhc3VrWfsJpHS+20dfhPqwssvPBavvZlC0R7b+OQNAIIhf56mrrv yOmKa X-Gm-Gg: AfdE7cnHhm0FFG2nE/Y2pMjnKD2C5moW7O2oKxgXk8fcXIa+NtzjQoSxeCs7RZ9rEoR ISMlRqvOjfjktY6YwURO2zSu8aQjhUg1UpE4+t9z5cLe+I7y0s0pY1FdNzjR2f7buaGvdnd+7Uu BFZlPXKpXO+PPbPXGRJ6VjiNVsJMgh3J7V6c7nXr2PMVLVDgdgbiuwR7F9PtnBV7ThkDK3eRCZh SKOEWc00JzSGjU+TRecz/iSk4Fsb08mviAKHwMW888a+h3Ypx8lu/vI7AWnuykF/P4itYBqSyFI 77h/IZOWddXXKSMtscRRm4y0S4895x39nvfDLamsLZ5H9ZFliwGLm6Saq8Df8jAsCIQgBY8OMJ/ k760U2i2k2et5R/uuGbJVQsY2FexeT3u91JBoFvrHxTbIWUe9Z8iNvCvuId9NQJ8IizIyTUXyu2 a7zDx8ffqKQGva0GeUJADyP8OmLzBZ X-Received: by 2002:a05:6a00:f08:b0:848:4859:a45 with SMTP id d2e1a72fcca58-848895dc4b9mr564447b3a.2.1783716850013; Fri, 10 Jul 2026 13:54:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 05/51] hw/core/cpu: Remove exec/breakpoint.h include Date: Fri, 10 Jul 2026 13:53:15 -0700 Message-ID: <20260710205401.836304-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717280203158501 Content-Type: text/plain; charset="utf-8" This is no longer required in the generic header. Add includes where required elsewhere in the code base. Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 1 - accel/tcg/tcg-accel-ops.c | 1 + cpu-common.c | 1 + gdbstub/system.c | 1 + gdbstub/user.c | 1 + target/i386/kvm/kvm.c | 1 + target/ppc/kvm.c | 1 + target/s390x/kvm/kvm.c | 1 + target/xtensa/helper.c | 1 + 9 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 481646f5b9..5c01908f83 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -22,7 +22,6 @@ =20 #include "hw/core/qdev.h" #include "disas/dis-asm.h" -#include "exec/breakpoint.h" #include "exec/hwaddr.h" #include "exec/vaddr.h" #include "exec/memattrs.h" diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index c59ab85606..76af8d67c0 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -31,6 +31,7 @@ #include "accel/tcg/cpu-loop.h" #include "system/tcg.h" #include "system/replay.h" +#include "exec/breakpoint.h" #include "exec/icount.h" #include "qemu/main-loop.h" #include "qemu/guest-random.h" diff --git a/cpu-common.c b/cpu-common.c index ba2676cbad..af64bb1126 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" #include "exec/cpu-common.h" +#include "exec/breakpoint.h" #include "hw/core/cpu.h" #include "qemu/lockable.h" #include "trace/trace-root.h" diff --git a/gdbstub/system.c b/gdbstub/system.c index c77d067ab4..724fd24c00 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -15,6 +15,7 @@ #include "qemu/error-report.h" #include "qemu/cutils.h" #include "exec/gdbstub.h" +#include "exec/breakpoint.h" #include "gdbstub/syscalls.h" #include "gdbstub/commands.h" #include "exec/hwaddr.h" diff --git a/gdbstub/user.c b/gdbstub/user.c index 9e6f9a6f37..0a61bd7d92 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -14,6 +14,7 @@ #include "qemu/cutils.h" #include "qemu/sockets.h" #include "qapi/error.h" +#include "exec/breakpoint.h" #include "exec/hwaddr.h" #include "exec/gdbstub.h" #include "gdbstub/commands.h" diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 4272b6770c..8161831de2 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -68,6 +68,7 @@ #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "migration/blocker.h" +#include "exec/breakpoint.h" #include "exec/memattrs.h" #include "exec/target_page.h" #include "trace.h" diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index aa21cab50e..1a093e1f83 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -40,6 +40,7 @@ #include "system/watchdog.h" #include "trace.h" #include "gdbstub/enums.h" +#include "exec/breakpoint.h" #include "exec/memattrs.h" #include "system/ramblock.h" #include "system/hostmem.h" diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 72031a5714..6f7f75f601 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -48,6 +48,7 @@ #include "hw/s390x/s390-pci-bus.h" #include "hw/s390x/ipl.h" #include "hw/s390x/ebcdic.h" +#include "exec/breakpoint.h" #include "exec/memattrs.h" #include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/s390-hypercall.h" diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 5a0e865514..0db5502287 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -30,6 +30,7 @@ #include "cpu.h" #include "exec/cputlb.h" #include "exec/target_page.h" +#include "exec/breakpoint.h" #include "gdbstub/helpers.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-loop.h" --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717350; cv=none; d=zohomail.com; s=zohoarc; b=XhYDKQkShIIgDZbUWORnuTO+ibgi2tzP3WVFU9rCBrmwXneRDlsyMcWDQ3KE09eQmYZRqvb84RIqk8lzY0Yx6GeL6pSrl+vixt7MDWdpxD6X2bOpTGkxBtgxEcKRQwon9nC/sDDQOX78vvc2NUPpFzvAwSQYJsyQlLJofDjZxug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717350; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5Sl9CN/SnyE3WUHBhyqJEZay/mST/u8iTGy3+RgSrEA=; b=VF095xk+KzvXkhMxT7n66eMuBB5jOWtBUdPcRnUuUXjJFy/ucruZBQYBPPzfRdHsDdQlp0GR2XdnOYtv3CMTj+XU6sGEYOONHdMcC4frVkU0XbJPU3Paoqa/GovEDrxECJiReuFReqn0pDyRUC0upGcIs8+JGXkqnwikN8TL14o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717350303633.0232591734056; Fri, 10 Jul 2026 14:02:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEs-0001It-3R; Fri, 10 Jul 2026 16:54:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEl-0001Ao-8I for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:19 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEe-0000ds-28 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:18 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-8487214ad2bso1789536b3a.1 for ; Fri, 10 Jul 2026 13:54:11 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716851; x=1784321651; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=5Sl9CN/SnyE3WUHBhyqJEZay/mST/u8iTGy3+RgSrEA=; b=tRm92BI1vqqrL39ziWegKow6j+2YDaxNoSjL3xAdqmTrO47+8czJNZb4OE7QZtGsnQ 0ix9CbPe8C1cnEfPvD15eBjOxkUbX8pwsSJPznE3FspOWFdJikfgD3G0C8nJ3jMS/tT2 fmUHGpJMoNFDypJwUU9KzGJyJd+mRN2vsHHLePxlSc4gnk6GS1F4S/+Hv48gesxBBS/N wmnvM4r/AVVUMRIiUXUQ3TxCUJAk75kGiNEeJzTBNOSlgYXSZMjoG97MOcSHI9L5IYek Gwn6NuhiFBrt/BlAwT1/hOtztI22xCA6bmAhSiMQ+r7Q97M3eORz3OOAHopvS/5wEF04 UDGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716851; x=1784321651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=5Sl9CN/SnyE3WUHBhyqJEZay/mST/u8iTGy3+RgSrEA=; b=K6z7hqIOdoUoOgRFLMg+cuU4N9RTqZTIxxycHBpjKBjS6M0j0TtJHCVC5kFf9voFCF 3tI25FMrd4NZ5+HHpzV/9Gwt7X26MoetZaBN6FmkL4CUZVGOj0b6/EXGiWd2wdTRBclh bt2LcW/IxLqjyT+oxhGPKnOZsRyvAtUhfLVoHb9JQHOj02/zvDGUuGmAIng+yu8g9Pt6 bq01GEFZ2dr2CZKW9AfZubLDSvmq4++LNZLvlTRbyg4t6fwRKBH2PObBGWQYodOT+0Ai fGzdZcnA7uTEnz6owOBsZR/Avh08iIL/9R2WKMGjciutdFVDwxwD6B/Tmx8U1Irz+XUc 5+oQ== X-Gm-Message-State: AOJu0YwWNEtdMQzEEymelsgtNwdIpbWtDpp5MVDhYTncmBzUjfrb8NF2 HF8fUnSU6+l/uSz6wOnt5Ix6wFVu2VKmLd8jVsmiKOxR5ZIAEDN2VtT4/y9qm+78z0M9s+d9m2O 7LCbm X-Gm-Gg: AfdE7ckVEh76yHPZB6OzWAwlstHt/58yD3bfBu2jjMAcMm2cr8Parp4lBQnxhXWVuWF qtQEIicmuWLlvOXPUio9qLpcclM3I6CLLYRH7yCyeMbjQXPAbNcdvfg4rWYLcPXLf2thuV5VeCD rc96gz7LYPw3psUaFS3itjMFml86dv4OHcN5Ercri0PzqbHAAc0yfQCn9I4shJewwRzY4QoYdcd GbXI9TPjj7C3afm9JveZuzF/xTyLC7lSKkU8MzdNTXNUPkVSuxZGjNCEMwlzQPQyvcJtuMa3MYi jDWpQg0fYLIrgAH1ZRhqTR8hyZbZzzEMdNPAGWq5N4EB6wFTGlhEscbXp5HYHoosoISSM6XIibz wmcvW5dJ04GhaIJEZPKB465o7+a+pW69f8uz303Gx/6FBTGJj236n+sbjMIRJw+AZTHgpyN0w2W URZSc0+yc1KRN0/Nh7NA== X-Received: by 2002:a05:6a00:234b:b0:845:d284:9e14 with SMTP id d2e1a72fcca58-84889758af8mr621526b3a.59.1783716850689; Fri, 10 Jul 2026 13:54:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 06/51] exec/breakpoint: Add CPUBreakpoint.id Date: Fri, 10 Jul 2026 13:53:16 -0700 Message-ID: <20260710205401.836304-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717350579158500 Content-Type: text/plain; charset="utf-8" Add an identifier for use by targets with BP_CPU. For all targets the index of the hardware breakpoint resource is to hand. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/breakpoint.h | 3 ++- accel/tcg/tcg-accel-ops.c | 2 +- cpu-common.c | 3 ++- gdbstub/user.c | 2 +- linux-user/main.c | 2 +- target/arm/tcg/debug.c | 2 +- target/i386/tcg/system/bpt_helper.c | 2 +- target/ppc/cpu.c | 2 +- target/riscv/debug.c | 5 +++-- target/xtensa/dbg_helper.c | 4 ++-- 10 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index f1186b909f..588ff13fe1 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -31,6 +31,7 @@ typedef uint32_t BreakpointFlags; struct CPUBreakpoint { vaddr pc; BreakpointFlags flags; + unsigned id; QTAILQ_ENTRY(CPUBreakpoint) entry; }; =20 @@ -44,7 +45,7 @@ struct CPUWatchpoint { }; =20 int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, - CPUBreakpoint **breakpoint); + unsigned id, CPUBreakpoint **breakpoint); int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags); void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint= ); void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 76af8d67c0..88d0c093eb 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -137,7 +137,7 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs, = GdbBreakpointType type, case GDB_BREAKPOINT_SW: case GDB_BREAKPOINT_HW: CPU_FOREACH(cpu) { - err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL); + err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, 0, NULL); if (err) { break; } diff --git a/cpu-common.c b/cpu-common.c index af64bb1126..9476bb612a 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -406,7 +406,7 @@ bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, Break= pointFlags mask) =20 /* Add a breakpoint. */ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, - CPUBreakpoint **breakpoint) + unsigned id, CPUBreakpoint **breakpoint) { CPUBreakpoint *bp; =20 @@ -418,6 +418,7 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, Brea= kpointFlags flags, =20 bp->pc =3D pc; bp->flags =3D flags; + bp->id =3D id; =20 /* keep all GDB-injected breakpoints in front */ if (flags & BP_GDB) { diff --git a/gdbstub/user.c b/gdbstub/user.c index 0a61bd7d92..ed0e88d169 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -801,7 +801,7 @@ int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointTy= pe type, case GDB_BREAKPOINT_SW: case GDB_BREAKPOINT_HW: CPU_FOREACH(cpu) { - err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL); + err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, 0, NULL); if (err) { break; } diff --git a/linux-user/main.c b/linux-user/main.c index c08c73fd80..83b9c88ac4 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -260,7 +260,7 @@ CPUArchState *cpu_copy(CPUArchState *env) BP_CPU break/watchpoints are handled correctly on clone. */ QTAILQ_INIT(&new_cpu->breakpoints); QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - cpu_breakpoint_insert(new_cpu, bp->pc, bp->flags, NULL); + cpu_breakpoint_insert(new_cpu, bp->pc, bp->flags, 0, NULL); } =20 return new_env; diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index f245d5b072..73d694ca4f 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -726,7 +726,7 @@ void hw_breakpoint_update(ARMCPU *cpu, int n) return; } =20 - cpu_breakpoint_insert(CPU(cpu), addr, flags, &env->cpu_breakpoint[n]); + cpu_breakpoint_insert(CPU(cpu), addr, flags, n, &env->cpu_breakpoint[n= ]); } =20 void hw_breakpoint_update_all(ARMCPU *cpu) diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index 0ba2f01016..d847d77d71 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -62,7 +62,7 @@ static int hw_breakpoint_insert(CPUX86State *env, int ind= ex) switch (hw_breakpoint_type(dr7, index)) { case DR7_TYPE_BP_INST: if (hw_breakpoint_enabled(dr7, index)) { - err =3D cpu_breakpoint_insert(cs, drN, BP_CPU, + err =3D cpu_breakpoint_insert(cs, drN, BP_CPU, index, &env->cpu_breakpoint[index]); } break; diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 7ff352b11b..020c8126b3 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -121,7 +121,7 @@ void ppc_update_ciabr(CPUPPCState *env) } =20 if (priv) { - cpu_breakpoint_insert(cs, ciea, BP_CPU, &env->ciabr_breakpoint); + cpu_breakpoint_insert(cs, ciea, BP_CPU, 0, &env->ciabr_breakpoint); } } =20 diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 67c09b1a53..bf9accf6e8 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -488,7 +488,7 @@ static void type2_breakpoint_insert(CPURISCVState *env,= target_ulong index) } =20 if (ctrl & TYPE2_EXEC) { - cpu_breakpoint_insert(cs, addr, flags, &env->cpu_breakpoint[index]= ); + cpu_breakpoint_insert(cs, addr, flags, 0, &env->cpu_breakpoint[ind= ex]); } =20 if (ctrl & TYPE2_LOAD) { @@ -613,7 +613,8 @@ static void type6_breakpoint_insert(CPURISCVState *env,= target_ulong index) } =20 if (ctrl & TYPE6_EXEC) { - cpu_breakpoint_insert(cs, addr, flags, &env->cpu_breakpoint[index]= ); + cpu_breakpoint_insert(cs, addr, flags, index, + &env->cpu_breakpoint[index]); } =20 if (ctrl & TYPE6_LOAD) { diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index e180096b42..4cf147bbfb 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -43,7 +43,7 @@ void HELPER(wsr_ibreakenable)(CPUXtensaState *env, uint32= _t v) if (change & (1 << i)) { if (v & (1 << i)) { cpu_breakpoint_insert(cs, env->sregs[IBREAKA + i], - BP_CPU, &env->cpu_breakpoint[i]); + BP_CPU, i, &env->cpu_breakpoint[i]); } else { cpu_breakpoint_remove_by_ref(cs, env->cpu_breakpoint[i]); env->cpu_breakpoint[i] =3D NULL; @@ -59,7 +59,7 @@ void HELPER(wsr_ibreaka)(CPUXtensaState *env, uint32_t i,= uint32_t v) CPUState *cs =3D env_cpu(env); =20 cpu_breakpoint_remove_by_ref(cs, env->cpu_breakpoint[i]); - cpu_breakpoint_insert(cs, v, BP_CPU, &env->cpu_breakpoint[i]); + cpu_breakpoint_insert(cs, v, BP_CPU, i, &env->cpu_breakpoint[i]); } env->sregs[IBREAKA + i] =3D v; } --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717045; cv=none; d=zohomail.com; s=zohoarc; b=oHEDKnXoCs6S6C3lXDCG9mU2envjQWX0zfxa23yfIBc//xJ4j9KwJd4/9rdcr2OfcsB0WSwCLsewft+ifcBxALyXwVE9bRKgoIfIISayqvs8Z97YQNMnyx8/A/m6Il0mTBP5mTKNz0wIDVre8x+6//Qh1DN6dJiPnj91xnMViF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717045; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ljn/yVxdDHENjIfYHhJCyU1c+qAG4dmbxzH4PmdcUfQ=; b=eofJjVYj4hIqHwuHvTLgfGZ8ijGNyJB67heI1RJYtsu41+bQrDOPEtzMWeLhPVYH20Jb4wGXCUgWhono1w3BIrSJkRNYWtuy6KJC7PZKw0LFAtAUaYa9HjGVZC/+8iQZL5fTtBgbN3GqVIf03fNfIcilkv9J/QmtupJxkGwXiaI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178371704540328.298032526099064; Fri, 10 Jul 2026 13:57:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEp-0001GY-Lq; Fri, 10 Jul 2026 16:54:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEn-0001E3-26 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:21 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEe-0000eV-Us for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:20 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-848593533cbso1076684b3a.3 for ; Fri, 10 Jul 2026 13:54:12 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716851; x=1784321651; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ljn/yVxdDHENjIfYHhJCyU1c+qAG4dmbxzH4PmdcUfQ=; b=G86MH8gvtRvLoAUIl9k7YzL3l/VCXLWETAJGV6efpvpfmMZfFYTe26+dLjzyNB9Dtw MnXxHe4zNkVfXsJX9HEzdVZpDVkHrD6Np9yq54d0TZC77vBMY/VZ7KbEZ29UAQcrtLIf dtEKrPuevJ2+SAxDvoxMm0kzbLISrDEiveffOLGrKTGCMyQB+a1DsnuKWobMtMeeOO0u FbofBnswBo2zR7XVPvPq0grA64ivOVMZT9/GrY1R98PPwG6jx3Tvav3mlfHvxxEytNoZ pTia2rL4m6BqE15+xy9NArU/Mf0o+2JoSlGe5fdaYcEXTmWwRtT7SzGpgO9ua8pATbLL +fXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716851; x=1784321651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ljn/yVxdDHENjIfYHhJCyU1c+qAG4dmbxzH4PmdcUfQ=; b=ElLuQS2CbFc1oTQ2ibJ3YTDXGB+fWwu8Ot6Qgq+Z1mbCvJe7iCqPVc+Z+FEyH8Ha53 VRtPgNZ+ejnVJ2Gz01j8reBDtO0cJCx2TNLgY30oG9Iqkbny/LTMtaxZP0kYR8sYhkho NNrfHMFMpYqwaOQdAPeUraPjLHAe0VEzUUrmmeQZacQ8+kA8e++EcfJJGH5m71C/zDTj QZdMHRpOzvyCO25nTKYHwPdZVUBeQSuDf8SWfKLC8BvQ5M4Mk15CEBkfJdcRSifHD/kK ucLwyaMQpO4752Wnv7XYysGPztrsmu93M0iGm5Ub7BcOMUOVfsVyESE0Bze/DG0BIrss cMog== X-Gm-Message-State: AOJu0YxeYLvuGyqbxDqonWd5TVjpyTXzOp5OFMT4Ov5qhIzf2gFV6zWs klruUElOFQZ/ihNPYbXWgg8miaGD4Z7LuGu9HEP3HJvEqR2b5T8C0SiAolIWphklFCet+tH/Baa fDzwY X-Gm-Gg: AfdE7ck1LCGOs0k8joR8x2C6OuU4HYAdaeNYART2CcL/eo04Th1lKJ8JpeXgoZoE216 +Getv5TEuMXTbl4Si5TcxvzcpER1TdwLwQuYUey2Qea0MWytqhE4TOmzV4B0X3XuD9uCRGgxmnn p444IKc4M/2g+L38sdTIsULLEzHe1ce9VnufiEVwAvJq0NMmyhSOGVOoBIvuUbeBcVwcWfNWPJp 9yVQFdG/imXcOp8PtAcqH8E8J4prxWthz/fJe1ovqjuU4uUQOewW5DFUgoM4bVIyL04UCfPkdyT TAcXZN8pxjhVoGQsv6BmbrEtxOCdMIFB19KYKSz4ed5b3+7QtO3ylz4OrRAg/Q2/hGUuGsD8BB9 umQfBLjytgqDt7QOjRTvqRCOXv77asoTTWkx+qOBc0tSBlMND3Im80vOe9GlC9nN6zJboKf103M 9wLdzyK+UjHygU1Ubzn769/nxR16cR X-Received: by 2002:a05:6a00:f89:b0:842:2419:6c0b with SMTP id d2e1a72fcca58-84889637ff9mr468318b3a.10.1783716851410; Fri, 10 Jul 2026 13:54:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 07/51] exec/watchpoint: Add CPUWatchpoint.id Date: Fri, 10 Jul 2026 13:53:17 -0700 Message-ID: <20260710205401.836304-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717046675158500 Content-Type: text/plain; charset="utf-8" Add an identifier for use by targets with BP_CPU. For most targets the index of the hardware breakpoint resource is to hand. For s390x, there is only one resource so use id 0. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/breakpoint.h | 4 +++- accel/tcg/tcg-accel-ops.c | 2 +- accel/tcg/user-exec-stub.c | 3 ++- system/watchpoint.c | 3 ++- target/arm/tcg/debug.c | 2 +- target/i386/tcg/system/bpt_helper.c | 4 ++-- target/ppc/cpu.c | 3 ++- target/riscv/debug.c | 8 ++++---- target/s390x/tcg/debug.c | 11 +++++------ target/xtensa/dbg_helper.c | 2 +- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index 588ff13fe1..6da8a007df 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -41,6 +41,7 @@ struct CPUWatchpoint { vaddr hitaddr; MemTxAttrs hitattrs; int flags; /* BP_* */ + unsigned id; QTAILQ_ENTRY(CPUWatchpoint) entry; }; =20 @@ -52,7 +53,8 @@ void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointF= lags mask); bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); =20 int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - BreakpointFlags flags, CPUWatchpoint **watchpoin= t); + BreakpointFlags flags, unsigned id, + CPUWatchpoint **watchpoint); int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags); void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint= ); diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 88d0c093eb..afac859b8d 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -148,7 +148,7 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs, = GdbBreakpointType type, case GDB_WATCHPOINT_ACCESS: CPU_FOREACH(cpu) { err =3D cpu_watchpoint_insert(cpu, addr, len, - xlat_gdb_type(cpu, type), NULL); + xlat_gdb_type(cpu, type), 0, NULL); if (err) { break; } diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c index 973bdbcd7a..42e4861868 100644 --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -22,7 +22,8 @@ void cpu_exec_reset_hold(CPUState *cpu) } =20 int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - BreakpointFlags flags, CPUWatchpoint **watchpoin= t) + BreakpointFlags flags, unsigned id, + CPUWatchpoint **watchpoint) { return -ENOSYS; } diff --git a/system/watchpoint.c b/system/watchpoint.c index 67e4560e78..a618bb5acd 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -26,7 +26,8 @@ =20 /* Add a watchpoint. */ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - BreakpointFlags flags, CPUWatchpoint **watchpoin= t) + BreakpointFlags flags, unsigned id, + CPUWatchpoint **watchpoint) { CPUWatchpoint *wp; vaddr in_page; diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 73d694ca4f..50b90ad675 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -622,7 +622,7 @@ void hw_watchpoint_update(ARMCPU *cpu, int n) wvr +=3D basstart; } =20 - cpu_watchpoint_insert(CPU(cpu), wvr, len, flags, + cpu_watchpoint_insert(CPU(cpu), wvr, len, flags, n, &env->cpu_watchpoint[n]); } =20 diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index d847d77d71..662ffbacfc 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -76,7 +76,7 @@ static int hw_breakpoint_insert(CPUX86State *env, int ind= ex) if (hw_breakpoint_enabled(dr7, index)) { err =3D cpu_watchpoint_insert(cs, drN, hw_breakpoint_len(dr7, index), - BP_CPU | BP_MEM_WRITE, + BP_CPU | BP_MEM_WRITE, index, &env->cpu_watchpoint[index]); } break; @@ -85,7 +85,7 @@ static int hw_breakpoint_insert(CPUX86State *env, int ind= ex) if (hw_breakpoint_enabled(dr7, index)) { err =3D cpu_watchpoint_insert(cs, drN, hw_breakpoint_len(dr7, index), - BP_CPU | BP_MEM_ACCESS, + BP_CPU | BP_MEM_ACCESS, index, &env->cpu_watchpoint[index]); } break; diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 020c8126b3..581fa6a575 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -171,7 +171,8 @@ void ppc_update_daw(CPUPPCState *env, int rid) flags |=3D BP_MEM_WRITE; } =20 - cpu_watchpoint_insert(cs, deaw, len, flags, &env->dawr_watchpoint[rid]= ); + cpu_watchpoint_insert(cs, deaw, len, flags, rid, + &env->dawr_watchpoint[rid]); } =20 void ppc_store_dawr0(CPUPPCState *env, target_ulong val) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index bf9accf6e8..1b88cd136c 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -501,12 +501,12 @@ static void type2_breakpoint_insert(CPURISCVState *en= v, target_ulong index) if (flags & BP_MEM_ACCESS) { size =3D type2_breakpoint_size(env, ctrl); if (size !=3D 0) { - cpu_watchpoint_insert(cs, addr, size, flags, + cpu_watchpoint_insert(cs, addr, size, flags, index, &env->cpu_watchpoint[index]); } else { def_size =3D riscv_cpu_mxl(env) =3D=3D MXL_RV64 ? 8 : 4; =20 - cpu_watchpoint_insert(cs, addr, def_size, flags, + cpu_watchpoint_insert(cs, addr, def_size, flags, index, &env->cpu_watchpoint[index]); } } @@ -628,10 +628,10 @@ static void type6_breakpoint_insert(CPURISCVState *en= v, target_ulong index) if (flags & BP_MEM_ACCESS) { size =3D extract32(ctrl, 16, 4); if (size !=3D 0) { - cpu_watchpoint_insert(cs, addr, size, flags, + cpu_watchpoint_insert(cs, addr, size, flags, index, &env->cpu_watchpoint[index]); } else { - cpu_watchpoint_insert(cs, addr, 8, flags, + cpu_watchpoint_insert(cs, addr, 8, flags, index, &env->cpu_watchpoint[index]); } } diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index 7a838775ec..25968d9a3c 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -34,19 +34,18 @@ void s390_cpu_recompute_watchpoints(CPUState *cs) if (env->cregs[10] =3D=3D 0 && env->cregs[11] =3D=3D -1LL) { /* We can't create a watchoint spanning the whole memory range, so split it in two parts. */ - cpu_watchpoint_insert(cs, 0, 1ULL << 63, wp_flags, NULL); - cpu_watchpoint_insert(cs, 1ULL << 63, 1ULL << 63, wp_flags, NULL); + cpu_watchpoint_insert(cs, 0, 1ULL << 63, wp_flags, 0, NULL); + cpu_watchpoint_insert(cs, 1ULL << 63, 1ULL << 63, wp_flags, 0, NUL= L); } else if (env->cregs[10] > env->cregs[11]) { /* The address range loops, create two watchpoints. */ cpu_watchpoint_insert(cs, env->cregs[10], -env->cregs[10], - wp_flags, NULL); - cpu_watchpoint_insert(cs, 0, env->cregs[11] + 1, wp_flags, NULL); - + wp_flags, 0, NULL); + cpu_watchpoint_insert(cs, 0, env->cregs[11] + 1, wp_flags, 0, NULL= ); } else { /* Default case, create a single watchpoint. */ cpu_watchpoint_insert(cs, env->cregs[10], env->cregs[11] - env->cregs[10] + 1, - wp_flags, NULL); + wp_flags, 0, NULL); } } =20 diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index 4cf147bbfb..20ddc527f8 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -105,7 +105,7 @@ static void set_dbreak(CPUXtensaState *env, unsigned i,= uint32_t dbreaka, mask =3D 0xffffffff << (32 - clo32(mask)); } if (cpu_watchpoint_insert(cs, dbreaka & mask, ~mask + 1, - flags, &env->cpu_watchpoint[i])) { + flags, i, &env->cpu_watchpoint[i])) { env->cpu_watchpoint[i] =3D NULL; qemu_log_mask(LOG_GUEST_ERROR, "Failed to set data breakpoint at 0x%08x/%d\n", --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717214; cv=none; d=zohomail.com; s=zohoarc; b=G5HZ9ChvUGYORF0gQ6U5G9YeE49bn1GuADFLC3BJ7sRCpqhnxEbav6qCvTW3WPkZtuRz/Jw9GEtToZMyu5O7ZGt05uxJv1BlowZWAVLOF1SkmIrTrmg/ibr7cclbvgbx0d5XldHbe5Z/48KeekJTSR86gYLqkSJikjtbm+1SUpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717214; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0XZuRi9HvvwiPYc6CNchjCF+2MDqKyBGJGQf+HVpXHI=; b=Yabsf93gbqIer4NpO2EGPH8/+294fSAle4/v8RIO+COMQ6FfbQ9qkSGuyJC+cQPfMKyjITyOmZc4Quj/4AVEFvIC4YVX9+y6nL8cnWWAY0oVllx4DZPUqvN9yVkukegRiZOF8n4O4bS1JTs8LcXZpj2xlys8Z2lcq82akc4nTQk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717214339133.38305821257313; Fri, 10 Jul 2026 14:00:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEt-0001LZ-5Q; Fri, 10 Jul 2026 16:54:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEp-0001GZ-NF for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:23 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEf-0000fC-Rt for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:23 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-8485fad302bso1373445b3a.3 for ; Fri, 10 Jul 2026 13:54:13 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716852; x=1784321652; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0XZuRi9HvvwiPYc6CNchjCF+2MDqKyBGJGQf+HVpXHI=; b=ooJxeiRvgTUCTjLrszFVuXSVeIeVpSheAKESnZ42/DC+6GTr1FY32dPscKWo2X7HsE RfOBJ9FG+dSd1YgZfaKCmx33xMd9HZruZ9dZcaDrm8b7zfM26QR8wuZtIBot1ZOvNMqK kGeqj/NoAQiQCpXs7PdqZHa5jJ34fJpQz0cCtjypemadSN1/SjgtnKPDXYf4CpXdrc/T lAywV6UHYG/fCcnKvAwFNx1KFfSq3sa/4GQcK7x6v8u19emgRYgffCjJHc9DhHafv/8z ZXKFhlkjt4VFBnVps5EqAxwzy/FKobPC/rTCTJe7Id7KW8udm5Xk65JhisqxmuXYZFf2 yMCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716852; x=1784321652; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=0XZuRi9HvvwiPYc6CNchjCF+2MDqKyBGJGQf+HVpXHI=; b=J3vaIChcQKqvMGV/Nhf5Uv33qNLt+UDJq5bUSHRTly1UlbijT+fUM/dyLEavUZaLoZ NTVoRLEbQM5DVH+Se8IBs6ivjRGU420A0o0urj9xk8nYom1QXbxCg410oSxqiApE+tqb kB+dECHUBx2KBmDEJbkJ6AYsM9Ogv6zskpmrEW3cYfAPk/SfmF+tw/lEiNmCyPJpwI4a mT6hkG1KissYzjK9ISmDUsiWdBcgJEYg6kWifjOQ1x+j30CGiw/b3NR3EYKt+nCSJ29e xaGYiDeACKRqggbG8YfLgAKg3v8aw68eRZz8idzxILNcRsKiojLy2xD1w7lG1FTJGRws YrLg== X-Gm-Message-State: AOJu0Yx0AWGj4wOi6lUiOkVIQ3Ea6XjeaUlxc27KSk5kSoICvi90OXBQ CIotk8pE0hlxDMmZ6Yh9P0gTsX28Z1y5+N8ZXryCdawLkYA+JFeU8dPTP1oxJeYU5Lrn4dYl3UE OraC8 X-Gm-Gg: AfdE7cm68/mUEHEfDYlpdAPjffqKmFwz+4HA1VNZkFhcvVBYE5V5wuZfgPmSVdAn067 ZDIGcd1dzx35ykBJiBhj4OKERkOer/8yW6Bt+jaIu6t39FrSp+n9D6yq+VaZ/jludVXqBDA84eQ szaSQWYAUKG0qPCBqWIi7osgv4grLpkkthL6QGE3XSUEV4oLJHalVz3d4MUxdpscCZHuCB5DTum 9KqlYq+LZv7Esm0QVcMv7NgXRk0sCEscB4iAeOJm/h4rfvFVk+QQugjwQLoxekkzBuQlVuXwKpA 2yZgdxMTFckg4OFx8nmVWy36XsyG8KaStclZxIagn8bfA9gmE95WvMarBs5D/8QMRsMELdYlcDj 8bdYKoNzmrSZ5xQIg0nTuEvU4l43QIwLWYj6R7PkCaLIthoLNo0jFUY16LVjrF21oBgs99heeY9 7DiPeVTJmUjkKkjGNpDw== X-Received: by 2002:a05:6a00:b47:b0:848:5c00:fa91 with SMTP id d2e1a72fcca58-8488970ab10mr585319b3a.38.1783716852390; Fri, 10 Jul 2026 13:54:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 08/51] accel/tcg: Pass CPUBreakpoint to debug_check_breakpoint Date: Fri, 10 Jul 2026 13:53:18 -0700 Message-ID: <20260710205401.836304-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717215850158500 Content-Type: text/plain; charset="utf-8" Add the argument and ignore it so far in all targets. Signed-off-by: Richard Henderson --- include/accel/tcg/cpu-ops.h | 2 +- target/arm/internals.h | 2 +- target/ppc/internal.h | 2 +- target/riscv/debug.h | 2 +- target/xtensa/cpu.h | 2 +- accel/tcg/cpu-exec.c | 2 +- target/arm/tcg/debug.c | 2 +- target/i386/tcg/tcg-cpu.c | 2 +- target/ppc/tcg-excp_helper.c | 2 +- target/riscv/debug.c | 2 +- target/xtensa/dbg_helper.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 568d82cdd3..3988bef520 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -264,7 +264,7 @@ struct TCGCPUOps { * @debug_check_breakpoint: return true if the architectural * breakpoint whose PC has matched should really fire. */ - bool (*debug_check_breakpoint)(CPUState *cpu); + bool (*debug_check_breakpoint)(CPUState *cpu, CPUBreakpoint *bp); =20 /** * @io_recompile_replay_branch: Callback for cpu_io_recompile. diff --git a/target/arm/internals.h b/target/arm/internals.h index 4026f67579..49ec97bd1c 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -689,7 +689,7 @@ void hw_breakpoint_update(ARMCPU *cpu, int n); void hw_breakpoint_update_all(ARMCPU *cpu); =20 /* Callback function for checking if a breakpoint should trigger. */ -bool arm_debug_check_breakpoint(CPUState *cs); +bool arm_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); =20 /* Callback function for checking if a watchpoint should trigger. */ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); diff --git a/target/ppc/internal.h b/target/ppc/internal.h index a3bb12afd9..ec057afa92 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -304,7 +304,7 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr= physaddr, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr= ); void ppc_cpu_debug_excp_handler(CPUState *cs); -bool ppc_cpu_debug_check_breakpoint(CPUState *cs); +bool ppc_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); =20 G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason); diff --git a/target/riscv/debug.h b/target/riscv/debug.h index a25d099b37..8eb9eccd4c 100644 --- a/target/riscv/debug.h +++ b/target/riscv/debug.h @@ -144,7 +144,7 @@ void tdata_csr_write(CPURISCVState *env, int tdata_inde= x, target_ulong val); target_ulong tinfo_csr_read(CPURISCVState *env); =20 void riscv_cpu_debug_excp_handler(CPUState *cs); -bool riscv_cpu_debug_check_breakpoint(CPUState *cs); +bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); =20 void riscv_trigger_realize(CPURISCVState *env); diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index ab42b4be00..590371c4dc 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -591,7 +591,7 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwa= ddr physaddr, vaddr addr, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t reta= ddr); hwaddr xtensa_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); -bool xtensa_debug_check_breakpoint(CPUState *cs); +bool xtensa_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); #endif void xtensa_cpu_dump_state(CPUState *cpu, FILE *f, int flags); void xtensa_count_regs(const XtensaConfig *config, diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 257211235d..6547cc70c9 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -328,7 +328,7 @@ static bool check_for_breakpoints_slow(CPUState *cpu, v= addr pc, #else const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; assert(tcg_ops->debug_check_breakpoint); - match_bp =3D tcg_ops->debug_check_breakpoint(cpu); + match_bp =3D tcg_ops->debug_check_breakpoint(cpu, bp); #endif } =20 diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 50b90ad675..306106b7e8 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -351,7 +351,7 @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_w= p) return true; } =20 -bool arm_debug_check_breakpoint(CPUState *cs) +bool arm_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) { ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index 6f5dc06b3b..86832cfdf2 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -132,7 +132,7 @@ static int x86_cpu_mmu_index(CPUState *cs, bool ifetch) } =20 #ifndef CONFIG_USER_ONLY -static bool x86_debug_check_breakpoint(CPUState *cs) +static bool x86_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) { X86CPU *cpu =3D X86_CPU(cs); CPUX86State *env =3D &cpu->env; diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index b04f07a637..eb78a6a104 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -331,7 +331,7 @@ void ppc_cpu_debug_excp_handler(CPUState *cs) #endif } =20 -bool ppc_cpu_debug_check_breakpoint(CPUState *cs) +bool ppc_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) { #if defined(TARGET_PPC64) CPUPPCState *env =3D cpu_env(cs); diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 1b88cd136c..5c378dd2e8 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -941,7 +941,7 @@ void riscv_cpu_debug_excp_handler(CPUState *cs) } } =20 -bool riscv_cpu_debug_check_breakpoint(CPUState *cs) +bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *ignore) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index 20ddc527f8..557a7852c8 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -64,7 +64,7 @@ void HELPER(wsr_ibreaka)(CPUXtensaState *env, uint32_t i,= uint32_t v) env->sregs[IBREAKA + i] =3D v; } =20 -bool xtensa_debug_check_breakpoint(CPUState *cs) +bool xtensa_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) { CPUXtensaState *env =3D cpu_env(cs); unsigned int i; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717045; cv=none; d=zohomail.com; s=zohoarc; b=Z/X+PZzjT4yyYaJJZ99HzVUTbg1+WNiGosisI9gMeyNc2Tm0wI1l21K3UV5hA2c66Ic2sZsPqsg0Zy8RiVdXCF/xlutHofr0ggkLa/yuf6NNO27iQrVF3qKPXp/QtFl5c2VQdhN9AlD8Jy74ODGdhJDJ6MRjo5ktFRCkOtHSfIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717045; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=w7mbi44ms/ED7IuWTQq/DSHUQAsdDGZrhybOFw4BdE8=; b=BZ7y6nwUwjN6AT1Dy0SBXKBQhpYmTtz3eVdDVy3xgbUCPnlOffCqVDtjyumez9pkuhKZaprpX099HByoCzY5fi8HmlXHNgHq4HWJR8f9uT+kwMf3deOdo7t6G8WOHwaizNy4tMA696smfvIvTO68D6ZJMhZxYLvQJug2OFTlXZg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717045006449.1526602446987; Fri, 10 Jul 2026 13:57:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEv-0001Ql-DO; Fri, 10 Jul 2026 16:54:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEq-0001Hx-Pz for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:24 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEh-0000fs-JG for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:24 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-848479c9bd5so1110606b3a.3 for ; Fri, 10 Jul 2026 13:54:15 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716854; x=1784321654; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=w7mbi44ms/ED7IuWTQq/DSHUQAsdDGZrhybOFw4BdE8=; b=Ku7BUNiKjm3IT0HvBzZtYO66oSesFDeHdf6uXzsv+AHHoj458mpIjq0NjlEVwz3kuK 1NFDByL8GYnlXkU6CAdDL+VvrGlV8n0OlG7iHpXWRQEnH/NBcooM2QDSk7lU2cwI2D5j aIzzddcEb5/Qr1wQ2R8j2cQR/Nb+O8DQqx+tFslBQhInlbUnTkF6BQeHCVLbYeMGxWyC 8g1s/as//YLxMAY6U5blGMds76wPB7TTJs+N+/1zoHgBvxYUhUEiUjFAkqCDjhfbB2T1 XIxERueJyP6EOfoZxB0T622pwXDzAfBsi5TiqQyshpGG7/wTs2/rc+F15G8Z7jdG6jtk 96Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716854; x=1784321654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=w7mbi44ms/ED7IuWTQq/DSHUQAsdDGZrhybOFw4BdE8=; b=EiUHji2fpBFUWEEkqlisz4eI2GoPGhTdH4NXoR8Y41f6utX0cg18iBwnpfFuTc8NnN H8CDo56KdbiTbury9Ounhw3wRGGXfmjYmCGbewNBT/8U9zLkWTvCWfhEaCNX4IXHYWLO lv5Mmyf1lkqIV4gCN1AxnGHnpvhUxYzxHZuUXHEX4wtYo7RJPdFcWZ2pAuEjbEKqLb25 9FEjETphBQBxfAV1mQsfkIpn8vypVad2dwAb58e6zywcUGLLdMFOSnlKb1ss3PgY39KJ JU0f15tiErxhgUZ6Bjx0mBgBPtf6DE7d1TaUZxaR0OxtPMXzDxV/mOecJfOxppy2Lpit h6Uw== X-Gm-Message-State: AOJu0YwwFzaqcwEwouB7Q/2uekU04r2g1r7utwzZaax1L+BMB6Z0iFNC h86P0BN2o/l8ITYa8pVFURTboVzVCTRxg1y6qH8Wh196vPzVcZJu+QtFzH+3EkgZ8/1xdtihjMW sTyVe X-Gm-Gg: AfdE7cn1E1nLCe6CP1XgHh7usqdTFlkStElplobXTA5ZdJqs2/D/pi+XkjW3Q/l8O7J mEoEwEEFv7EIVleIFyCXVMh6sVH1IyYcQ7XUDEGAmNeTkZEPySPv2rp7R1jUN+x3TzGgHEWBly1 5twWSa5W0YTpvxViz44Zk0+iVZpSuaVwW2BoJkgLlpy+M2YQ2J29W2KQjVLPhH/RjMcVbIb3PVp 4V696HDtGqr7imFds4fNTtOqo/SrUsHArZPSULsf2wKOgdqHGCgzzKAintk28mJJGnsVeoUiGxa baKIpQ73zy6kN6xSOvDYZFe4IomjOH15TUypb3k3NsFZMA+EStLypfAhhN//9qvLbD9ezved+rD HIZErGraIwWX5td3wR415BXg5wlQEz8/LFL7iGyq1V05FPe+56+Boi/VW0Rn6CmafBhzI+QkR07 WrH06vkfDQ54SielVwtw== X-Received: by 2002:a05:6a00:4207:b0:848:68cb:5c74 with SMTP id d2e1a72fcca58-848898343a8mr470769b3a.60.1783716853081; Fri, 10 Jul 2026 13:54:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 09/51] target/arm: Split is_wp out of bp_wp_matches Date: Fri, 10 Jul 2026 13:53:19 -0700 Message-ID: <20260710205401.836304-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717046514158500 Content-Type: text/plain; charset="utf-8" This function is only called twice, once for each of breakpoint and watchpoint. Hoist the separate bp/wp code into the respective callers. Signed-off-by: Richard Henderson --- target/arm/tcg/debug.c | 49 +++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 306106b7e8..519a06fbc7 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -252,41 +252,16 @@ static bool linked_bp_matches(ARMCPU *cpu, int lbn) return contextidr =3D=3D (uint32_t)env->cp15.dbgbvr[lbn]; } =20 -static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp) +static bool bp_wp_matches(ARMCPU *cpu, uint64_t cr, int access_el) { CPUARMState *env =3D &cpu->env; - uint64_t cr; int pac, hmc, ssc, wt, lbn; /* * Note that for watchpoints the check is against the CPU security * state, not the S/NS attribute on the offending data access. */ bool is_secure =3D arm_is_secure(env); - int access_el =3D arm_current_el(env); =20 - if (is_wp) { - CPUWatchpoint *wp =3D env->cpu_watchpoint[n]; - - if (!wp || !(wp->flags & BP_WATCHPOINT_HIT)) { - return false; - } - cr =3D env->cp15.dbgwcr[n]; - if (wp->hitattrs.user) { - /* - * The LDRT/STRT/LDT/STT "unprivileged access" instructions sh= ould - * match watchpoints as if they were accesses done at EL0, eve= n if - * the CPU is at EL1 or higher. - */ - access_el =3D 0; - } - } else { - uint64_t pc =3D is_a64(env) ? env->pc : env->regs[15]; - - if (!env->cpu_breakpoint[n] || env->cpu_breakpoint[n]->pc !=3D pc)= { - return false; - } - cr =3D env->cp15.dbgbcr[n]; - } /* * The WATCHPOINT_HIT flag guarantees us that the watchpoint is * enabled and that the address and access type match; for breakpoints @@ -390,14 +365,16 @@ bool arm_debug_check_breakpoint(CPUState *cs, CPUBrea= kpoint *bp) */ =20 for (n =3D 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { - if (bp_wp_matches(cpu, n, false)) { + if (env->cpu_breakpoint[n] && + env->cpu_breakpoint[n]->pc !=3D pc && + bp_wp_matches(cpu, env->cp15.dbgbcr[n], arm_current_el(env))) { return true; } } return false; } =20 -bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) +bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *ignore) { /* * Called by core code when a CPU watchpoint fires; need to check if t= his @@ -417,7 +394,21 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatch= point *wp) } =20 for (n =3D 0; n < ARRAY_SIZE(env->cpu_watchpoint); n++) { - if (bp_wp_matches(cpu, n, true)) { + CPUWatchpoint *wp =3D env->cpu_watchpoint[n]; + int access_el; + + if (!wp || !(wp->flags & BP_WATCHPOINT_HIT)) { + continue; + } + + /* + * The LDRT/STRT/LDT/STT "unprivileged access" instructions should + * match watchpoints as if they were accesses done at EL0, even if + * the CPU is at EL1 or higher. + */ + access_el =3D (wp->hitattrs.user ? 0 : arm_current_el(env)); + + if (bp_wp_matches(cpu, env->cp15.dbgwcr[n], access_el)) { return true; } } --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717108; cv=none; d=zohomail.com; s=zohoarc; b=GhnHwFOgqz11h9tPcZQ7b9CzS7bXnQ1Ez/FFtA1eafr+2pWwm2J6VJFKO25ThnGEkA+F6Qp4uc05gXchq+APh2OI413HKzvknVjlksqE5OQQCdyQrtK53DVMQvscRwu5OjBCmk5m4zfE1j3KXyo7PJ4I2Wcbz9lmLy+D3+lMnXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717108; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T8Nke7VBw79ok0DwBulA/6kCjtrNSHe+I6s+oojEmf0=; b=WUzvOr61gdaoehvJcrCQl7LPJk8Myn3xND6OqxQFCYZVkQBSrBQewqtaavA14k/j2JoIa6eFIR9uBtqZ028EYF7BA5hj0VHdYIcyESCPxygU71yltU/YZtLMgHGDrbTL3+itll/wh5iX+aEcxi9x5Dnjh3iTByowdV0Z6u0KgYg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178371710829565.81353036705468; Fri, 10 Jul 2026 13:58:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEt-0001Mw-Sy; Fri, 10 Jul 2026 16:54:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEr-0001Ib-81 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:25 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEi-0000gJ-15 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:24 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-8485bd28dd0so1438939b3a.2 for ; Fri, 10 Jul 2026 13:54:15 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716854; x=1784321654; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=T8Nke7VBw79ok0DwBulA/6kCjtrNSHe+I6s+oojEmf0=; b=YhZI+EwUXeEge72K6bVviMRqf/zvXBLGobGhmUtkA8QX17tMGe2WDp1Sgx6oJHtYBg nx4FOOCfz70l1wihWL8NGwoZeGjpPGxtid+ht7OoxLcp++13+BEp/npNOxGffoQf1cGK gMWj3tBWCcM631ts1c9NrCaiTkwnrogFBHzCNH0/16+lY7W7gLNE06MhIjSAfBgG8EAE YMcZvHQPMx9Yt8+GAEVsBvQ9IuRUtLvmh/kwrXeCuqoKs74aZOROJNIi05b1rQOafzaF 8qKOPbC6QwOycW5OcXUqIPDtu15flBD2fPx9FRlyv0S11iD2etAR4mCxhXGRGsTvMQHZ Zn5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716854; x=1784321654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=T8Nke7VBw79ok0DwBulA/6kCjtrNSHe+I6s+oojEmf0=; b=G86NWpBK1ez2INJdEsmjvVayVpfYy5q19U6E3v8AYAmMAc7GrPzEKlotrKEhLuH/XQ DAtZpwYs4w0JpWxjC5JL7+BYZb1ZzcQ9WYlMLoWp8RjX0dhR2VfK0w1qvrsS+muoPQDN rEkTOTRyLROoHZt2YHUzrMWXVopndZuKhAxZpUX/1xUOMRpeEus5SirB54/SCghCeOtW MyTNuDjC6Zr0WtIHyspwmmHsGPMOL3+I/0kuEMQWS2BQm/l4v/6ED4oh9kTIpxQlR8pr AG3Akte2HLNwtBABKr6VY7eKEh9HxpcAu9UkLI2KfclVdfPc7e4vUcRP2T79LSL/DITv aihA== X-Gm-Message-State: AOJu0YzeVzxSSt3EqxoY1QxpTz5npTdUrj0tWtfXF8wDIBo8gHQdcYYH gX3r3jjhXUR82bEkhvFTYAQO2HeWp2li/r1vz1aMqoBlZGt2zHRdIyRuKlU3QkIWjpU2mCNCWil 6LZ7v X-Gm-Gg: AfdE7cnz3pdlJilmiGaTTHraEoO2xtr6wMamWSWftK+OgdS0rBlXPNSYrTmCrWmhI7j mP4KJz3ckcNG/7TO8HoOr+OkQZtrKG2Im/4txLiJQWwynzi+h5Je0Ek15kQY4CPtWqlJJGrGlPn 0HOY4vnHHe+B9zKi0yBZ6hlwxYdWZMhpzbRqXYpoibBExX2v/aaqX4mVxDQg0wZCnZsNRsI3TJJ xwQw04f2WaPefJe4bT/1WZ2k1J79+c2KSiMjERjreIkknGrOSKY9m2IQFBCp8EwfrM8Ahfit2rP fK5lmZt/ZS9S+K9bfOZkD60Hnsp+1udH70ZKnHsZd49v7YelsioCxEkgo4OrQZ0C+E3IsFADSAk jLhz2JAK2H7Dmgzip9acC4WcZQWYACviFByfETTVtw/6lqOgStZhtQAPNGxqth2opdSh0/bq/Nr xYB+69csJKGl/3WPjlBw== X-Received: by 2002:a05:6a00:2304:b0:848:4256:d6ad with SMTP id d2e1a72fcca58-848897701f2mr540984b3a.60.1783716854506; Fri, 10 Jul 2026 13:54:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 10/51] target/arm: Use bp argument in arm_debug_check_breakpoint Date: Fri, 10 Jul 2026 13:53:20 -0700 Message-ID: <20260710205401.836304-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717108912158500 Content-Type: text/plain; charset="utf-8" Use the matched breakpoint instead of looping over all. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/tcg/debug.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 519a06fbc7..2389830b2a 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -331,7 +331,6 @@ bool arm_debug_check_breakpoint(CPUState *cs, CPUBreakp= oint *bp) ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; vaddr pc; - int n; =20 /* * If breakpoints are disabled globally or we can't take debug @@ -363,15 +362,7 @@ bool arm_debug_check_breakpoint(CPUState *cs, CPUBreak= point *bp) * TODO: We would need to look up the page for PC and verify that * it is present and executable. */ - - for (n =3D 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { - if (env->cpu_breakpoint[n] && - env->cpu_breakpoint[n]->pc !=3D pc && - bp_wp_matches(cpu, env->cp15.dbgbcr[n], arm_current_el(env))) { - return true; - } - } - return false; + return bp_wp_matches(cpu, env->cp15.dbgbcr[bp->id], arm_current_el(env= )); } =20 bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *ignore) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717334; cv=none; d=zohomail.com; s=zohoarc; b=Jrv4vo408B1+J0B7PNaAdnnr9eUB13SnEFgZIkiYR99WWHSqLZq62cbMs5UJ3e5mQlNR785WC0BAUQgHITS1bBCB6QMKibF2Y4/yHarKlwTQyzVBHDYfDZdNtDcR0m/UC6Dg2fMBMeCw1+Mfxr84GpYSdQ7onibTdyfa/hV5Njk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717334; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=w/QoPchMBLEoPNwVaZS+xZRRFREK+x04Oz5t5RgPWdc=; b=keuiIDpS0RKPHF6zEfOx9Pj2v+1+TrkTtHczoy7xLCrF7ddF+i8maY7O0NCsAXkoK7qKkPiwVb+R4I9Uv2J37/IxsDY6U0oy9DyANKhKKtlB+JpIhro7APZiOMTSKZkUjbI2pis6XqmiwabHOMgJVuSpWpx6d7D/fhU5uN5mEhU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717334736847.1608239192265; Fri, 10 Jul 2026 14:02:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEw-0001S7-Bq; Fri, 10 Jul 2026 16:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEs-0001Kq-M9 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:26 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEj-0000hP-K7 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:26 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-848882fdb18so343338b3a.0 for ; Fri, 10 Jul 2026 13:54:16 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716856; x=1784321656; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=w/QoPchMBLEoPNwVaZS+xZRRFREK+x04Oz5t5RgPWdc=; b=rgkDTkn0Y+9/6Nn+FPyMWXO4uSIZPxT4gEsY4xpSzturGI55L4CUa5rW/P4HLO/54y C30G332YoPuMUXgft2UzrdF4T2vjun4wCAKW2PSH7dQsn9B5djkXnG0KJIb2F4+kKDML jTYq8Xu5eOVgAkGmy4lsyYa8YvQ+ABd8vpUxOb3w5o/yYHlZNFlaJka9Kt9+ZcQrZP+e OsohNbojeUYR0wiRMCVj7Gtdjvq9VRW8uo7rBUr1FXAzi3yaSN7wOrBtkm6kee4imMJr +sbr3ctHbk3k1wjBl215kqvUfyJUK26ep34q7Nkbyg+NZIlD9c9MvgZGk83/0JmpZH17 kWFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716856; x=1784321656; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=w/QoPchMBLEoPNwVaZS+xZRRFREK+x04Oz5t5RgPWdc=; b=WjTQwTEkavIum98NYfsGVNmEDbM363JYLhoRQbqC09ezyu3EF974GQmfjfLZCw+FGh rLCo7/oh3pw0V2p1ASY1H0m2yjmEvPG5srRcxJqtqb6mcWG0U6HIuosA7vEp4lLUqZgy Bq22JWrF984It2DEYhtmfeTBpUDIPrPtzUtcqFL7ifYyIC+h5CzlQawxAaFA9XO5KNNb vKk2J3KmYaW+u+ig91AB7vIfqeqvCbjkVdoipLLeH+dpYIyyf5ZG0vchP5sWsFjqG2nq MbNmdZjPKTqwZKtFPjdVPleisFQCh3C7xUbo9DtpuQ8WFfNoHqekngYxdpFwByOrEmZG GLLQ== X-Gm-Message-State: AOJu0YyplIiZ+7UoYujMXITH6Aa+GWJHWJl5ltXro/HDVSlNJuYfu15b R/N5/LiT1NzSKm/VQPKXl4RxxSa8FdFVgmqi6E5wC8cPreOCYYnXAQ+2h55sBMzhexaRa+FqkAL 4us3G X-Gm-Gg: AfdE7cktlcWZwqpsty44fZM4UAmvyqMjh79+La5cC5l+YcFtoYSy88CbsUjEcbsA5IT 4W8JA6HC7FStJzfrIENsIM38Qtx8wtE24BUf84Jb2IV9X0bziqbtMw84Kyu4OeBWYRBfl1dWdLR P7VmXSfnmMRNV4gGD0AKNmCqK6FQMes/layvDD7giaU+MomIvpszNCPJpCUUDdBJFtjH0qcF+z5 Dn+BuP8cybE2heEA1+LZ4u43pOmgLxsPKEqf8C5c8Hy2Sx8tom7ZuxY9tuZdvFYspWXdGjvgler VZtmCPQyCIhW6P7ZNqq5TOf9kipvkBb3OS77hbovPRf2yxEPHfSzFDEgDEHPbNdSP3IAJHkHmMO g6CSAZ22MtvFe1bsYnZk1q3lqE24kNgQsNmQPkjVbSdulqSD2c2jsc/TUR8P6WI1+HtNHl5DYep ntr6WgM6nbYlzhuivAFQ== X-Received: by 2002:a05:6a00:1a8c:b0:848:75a1:a0fe with SMTP id d2e1a72fcca58-8488964a85fmr496369b3a.18.1783716855939; Fri, 10 Jul 2026 13:54:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 11/51] target/arm: Use wp argument in arm_debug_check_watchpoint Date: Fri, 10 Jul 2026 13:53:21 -0700 Message-ID: <20260710205401.836304-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717336445158500 Content-Type: text/plain; charset="utf-8" Use the matched watchpoint instead of looping over all. Signed-off-by: Richard Henderson --- target/arm/tcg/debug.c | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 2389830b2a..daad2ac440 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -365,7 +365,7 @@ bool arm_debug_check_breakpoint(CPUState *cs, CPUBreakp= oint *bp) return bp_wp_matches(cpu, env->cp15.dbgbcr[bp->id], arm_current_el(env= )); } =20 -bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *ignore) +bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) { /* * Called by core code when a CPU watchpoint fires; need to check if t= his @@ -373,37 +373,14 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatc= hpoint *ignore) */ ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; - int n; - /* - * If watchpoints are disabled globally or we can't take debug - * exceptions here then watchpoint firings are ignored. + * The LDRT/STRT/LDT/STT "unprivileged access" instructions should + * match watchpoints as if they were accesses done at EL0, even if + * the CPU is at EL1 or higher. */ - if (extract32(env->cp15.mdscr_el1, 15, 1) =3D=3D 0 - || !arm_generate_debug_exceptions(env)) { - return false; - } + int access_el =3D wp->hitattrs.user ? 0 : arm_current_el(env); =20 - for (n =3D 0; n < ARRAY_SIZE(env->cpu_watchpoint); n++) { - CPUWatchpoint *wp =3D env->cpu_watchpoint[n]; - int access_el; - - if (!wp || !(wp->flags & BP_WATCHPOINT_HIT)) { - continue; - } - - /* - * The LDRT/STRT/LDT/STT "unprivileged access" instructions should - * match watchpoints as if they were accesses done at EL0, even if - * the CPU is at EL1 or higher. - */ - access_el =3D (wp->hitattrs.user ? 0 : arm_current_el(env)); - - if (bp_wp_matches(cpu, env->cp15.dbgwcr[n], access_el)) { - return true; - } - } - return false; + return bp_wp_matches(cpu, env->cp15.dbgwcr[wp->id], access_el); } =20 /* --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717331; cv=none; d=zohomail.com; s=zohoarc; b=gT0iV8A92rvhzWOEehrhwwLE8fECdZo2bm6RCgf1vjufhG0Iia1szZ0Y31cK9qmOiaZ2iz2LZj5OA4cQxEPYAnLNXxKJ6CaMwxt55wAZdgp4G+bppwbnoq54EoRsAgcwGlrFuV2CCSkN7ckEo1NSryFStqxfIPO+JIyZsYLAU4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717331; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k40Ct/scLRA6POY4s+1/g3ylMfrjfxUVUANTHep1r88=; b=Zrvr304KxrlZTZ6i2XmhrTaFeAoJn4uogoC9eMTwoyO3VKg04/mz98PIPRQaZNWcJMcVuPPBFwNGvQB2sCSgmtC4/AKRoIPATC+as0XKDg3PaJpbhm3DxIGMrzbEQywsFAuc3gzgJrGPd8WwN6zega8RhzHYJ+xOF3x9yd01SGY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717331638652.3612398273056; Fri, 10 Jul 2026 14:02:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEw-0001S6-A0; Fri, 10 Jul 2026 16:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEt-0001NV-VZ for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:28 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEk-0000hh-5H for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:27 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-84862b0d5aeso1441142b3a.2 for ; Fri, 10 Jul 2026 13:54:17 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716857; x=1784321657; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=k40Ct/scLRA6POY4s+1/g3ylMfrjfxUVUANTHep1r88=; b=FBeOsRyLde+iffSRs1nbHx263W5LfQKpNFzTdO+EoG6D5zDH0rLgK6WHdUpaXmG9xN ZB4yy3qwYA+Lt+1iPQLXdKx+jJT8LMP7mob3imLKSmx4+v8t0AQuwBIebHuiwI3tNtZL pqwtz+P5Voeb/bMhy1uIv8Ijfk5/FAWJXJ6tHYcqIwB1Yd0jltfehRgztjV0W8TYKs4n SbZZnBH8WeEraOkuAWU+YUZzwHM8GHnCbSbx0x/YL03reyCq1nzrVjvB6v0s202EV8o4 ZFQb5Tu6A4YsjUHtRQADicZeEueaSqjAOAn9tLjXVc/mGVXYKUBa79HkqD0zy6VhSaWg 1y9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716857; x=1784321657; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=k40Ct/scLRA6POY4s+1/g3ylMfrjfxUVUANTHep1r88=; b=IzwTsmzcaC9BUAWmI7pe5QYhUmgqjvJvYKBQ9EgQj6bpSr4SNPy+n8zHHWmJy5YUnf 1rGBfIButEwY+yEBAwwxP8Xlenqf+Wc7TY7OiIdjHzyAUOjsjD8zK/ZRwjCu1H/Ot8fz SUxYnsbyZMlvZmg5Z8i0ESjfVvsqgwE6EZmV/Th+x1dqH6VZMadJ7ce+B1RFPfDi9v4G zw3XrrQ3UfxIkDmnZjZLVaHQ6Ze2bBhcKjwvae92bp2qsLygci3uUM5RtgChVwt6PD+P hTWClIXsGOI9gG3oDcu/qXrqw2yhYeaUk8nsz/EnIuR2vfQYhDVlYso6GGneLJ59EZut Arxg== X-Gm-Message-State: AOJu0YyBxtEv7ECkZnFQhfIEV4E2UCWs4xqAhSIK33jWnxP0au/x4VuD 0hlGuTjsPV9fKHSMNQ3gWLvgKh2cIxo6APBUFitCCzxILHINmradLd6xu9Q1I3CZT6W1Fe68X5j dTu3I X-Gm-Gg: AfdE7ckHYUo88AMBPVYK0Tx8K34R2zMS/mxfjfDK/G/fGutzfpoU8mEHY47+polYozG fn2n7ToeaMG5xgdML9p5umN3f/ZawNE3RQy53CIDPi3/icWuNl5oNAnzouTrxcaxrzJY6NdEmPS AQQ9F+HN6h6tZXLSFWFx3LhNcEQvvg05a7cLPYWmAn50TaqfrlapYz7gllGYmo3pBZsndaYOJsm I2zEFZ/Y6BwZsWaIAkyZQEtUPTZk3zQWe4AMu4nlMnn74fTo70JB8P93Qjib+gztkk3tkYAhRkU K3UrsKUW108OvqT4x7U6I8fAAMvLIsiIYwIsv9pTFx8ns6a5NHWu2XzF+NRpNPXZKkXmRaHmDtZ tEyYg7YdtxQ4Qqc4GpGNJWOicf+93t9GQpMPmowKipFINPDei/vTM+tP3v7jFxXTaTYRzZlsCi3 lGnOce7UmjqL22emheXg== X-Received: by 2002:a05:6a00:c84:b0:847:7ece:3426 with SMTP id d2e1a72fcca58-8488979782emr487915b3a.58.1783716856628; Fri, 10 Jul 2026 13:54:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 12/51] target/riscv: Use bp argument in riscv_cpu_debug_check_breakpoint Date: Fri, 10 Jul 2026 13:53:22 -0700 Message-ID: <20260710205401.836304-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717332391158500 Content-Type: text/plain; charset="utf-8" Use the ID of the breakpoint instead of a loop over all. Signed-off-by: Richard Henderson --- target/riscv/debug.c | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 5c378dd2e8..511a69c28d 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -941,48 +941,16 @@ void riscv_cpu_debug_excp_handler(CPUState *cs) } } =20 -bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *ignore) +bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; - CPUBreakpoint *bp; - target_ulong ctrl; - target_ulong pc; - int trigger_type; - int i; + int i =3D bp->id; + trigger_type_t trigger_type =3D get_trigger_type(env, i); =20 - QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { - for (i =3D 0; i < env->num_triggers; i++) { - trigger_type =3D get_trigger_type(env, i); - - if (!trigger_common_match(env, trigger_type, i)) { - continue; - } - - switch (trigger_type) { - case TRIGGER_TYPE_AD_MATCH: - ctrl =3D env->tdata1[i]; - pc =3D env->tdata2[i]; - - if ((ctrl & TYPE2_EXEC) && (bp->pc =3D=3D pc)) { - env->badaddr =3D pc; - return true; - } - break; - case TRIGGER_TYPE_AD_MATCH6: - ctrl =3D env->tdata1[i]; - pc =3D env->tdata2[i]; - - if ((ctrl & TYPE6_EXEC) && (bp->pc =3D=3D pc)) { - env->badaddr =3D pc; - return true; - } - break; - default: - /* other trigger types are not supported or irrelevant */ - break; - } - } + if (trigger_common_match(env, trigger_type, i)) { + env->badaddr =3D env->tdata2[i]; + return true; } =20 return false; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717384; cv=none; d=zohomail.com; s=zohoarc; b=XLum6lBISWHoJ3pVNDhej7z+zZ3YoAFS8u/lhhfhRyB5Zm+144qTgkOJNTfw/+FuoECNKFxZGcZm7YO0NxXyDCK2F05z7e1NwGcfohMHwiqBuXVSXk7V8mJdal6yc/toHjEMCctSrDwLxxgKUPVm7fDx636YjnFgqA1LWnJL2NI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717384; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Lg/N8LFKGp5ELLy+c1KbExFW/0dtEAJ/1CeA/sfoCRs=; b=X/k4gTKVZDKa+/+5zCrqbdBty8u2oo4PF8ZQtMogQ6CyNvL4dE/af48jIYCSAu2bFCyLcbQc++5NNtoCkyjSyK1NP5mFgAuQxA++VWWpjMaIRaeSq01YtScuq1U7AaHmSZC+qFruhpAP5Re07KIWQ6FAHxjgLyK/8CF+Xir8ZVc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717384577503.5700816723431; Fri, 10 Jul 2026 14:03:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEy-0001VO-Ky; Fri, 10 Jul 2026 16:54:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEw-0001S8-BC for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:30 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEl-0000ie-LK for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:29 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-8485bd28dd0so1438978b3a.2 for ; Fri, 10 Jul 2026 13:54:18 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716858; x=1784321658; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Lg/N8LFKGp5ELLy+c1KbExFW/0dtEAJ/1CeA/sfoCRs=; b=IMdwQ1YxoiOhZMl/5y+9gvJDOKccB7Wd0py9k/P73h/wm3ftkdQj8QCfAYQymqWxbU IXfhOrgPoOfN4YlcdJJtpxccJH1OfC/FZRIXc34pLrs3mro/bimiSR37l0W3DVLGVEe2 kYMwLK2FjmnwzM+KVLvKyqUr6wnt2MWewQuh416lhcNaFQ3T1nNGDxbcDCUN6ea6W8r9 eay/qDXekCqYL980PglZxwdCt2DNsRE2oGwUGC4DLxkqbEqMk4JbxRgEjoUjHHyrkuQC zKgjft8CdT4cybiRWpQCr2CVkljn16XBfpNumKWOELI672+SbkQ7sGdzjn5Oer1N8hH0 0rPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716858; x=1784321658; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Lg/N8LFKGp5ELLy+c1KbExFW/0dtEAJ/1CeA/sfoCRs=; b=PtIeTc0lKc5BHIrdmB3vzpu6Bz4OI5QDTBhX9h5LZ0iPXKYmkPCiyCUTEgCFMcJm4V 36nV6oER+QFc+B986YSiOfEW2HCHOhS8Gr0svpD5kO9IkEPNNVJRBuN8AW3vKuJ4TAkH 6bFsoDnKPFaJrX7SR0f/1MqI88bXi2DMvpkHeyDwc19za2cmWP89hPicg8kW8p9WOhUN YNcObs+hRYExgSmd1HiFVJjPKpnKuccthDYaljXGesKIoM6HXdFVMpf0ZS6DsvaP6cyw jD47XCoHHAlujpUfVsqjCrwacqy4p4FMLWhGWSfi8iO7CItWii1tsJtT82ioz+8LCc9U hWXQ== X-Gm-Message-State: AOJu0YybnOMue7roblo/FjhUPvUaLZQmyiyMZyJiGFfd1mTrLUhKuWt8 mLgXEsWiQJwkuERqOp+6HTXVqp5q9zUt4j2Z62+nwrVea/7Gcns+O4Yj1BqzDexZvdTOaBHodgs 1Sz7o X-Gm-Gg: AfdE7cnyx0I4n42Ipw0kL52Rmilrsz+PGy9GdFpJcYmNN+CvWQCfEtY3B08oXE1YJkQ RS8NuMG3wFFM+zGU/pFGfQj91RsPU1KoYpsTCoIoDtgS34C6hOt0R4mTmIeUdpb8/XbzmV4VkCo slmUM3lMKVMJ5uXOCrYP1eCd7CmqXhqwwIkkRqulLPRjywctbtidFcc1/yeUwqi7/G7D4uJadHl OybS2aNPydeyFMyfU9Re7K8jBjF6oMbAvj1JkdjnSjgEgWNwPBJLEcwC5Yrwk3aeYd++C+2746r 83Mujqet45Lr9ID78NIGoa9lfGOYzdPdF/gHerx51aQeZdN0y2sue829kVKct1wX8gRisd8UGfJ gxh09OJoA4UA9NrJ8hJXVVdESRYjvH41v9l4nGHniEZiVFftvb7izKEK5CUb+DcDoQDEjRC1tuJ nS3K80ZmxlkEEU65aZZg== X-Received: by 2002:a05:6a00:124f:b0:848:5ed6:9d27 with SMTP id d2e1a72fcca58-84889722166mr504636b3a.36.1783716857887; Fri, 10 Jul 2026 13:54:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 13/51] target/riscv: Use bp argument in riscv_cpu_debug_check_watchpoint Date: Fri, 10 Jul 2026 13:53:23 -0700 Message-ID: <20260710205401.836304-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717384773158500 Content-Type: text/plain; charset="utf-8" Use the ID of the watchpoint instead of a loop over all. This fixes a bug in which addr was compared against wp->vaddr, so that we never recognized watchpoints that didn't trigger at the start of the region. Signed-off-by: Richard Henderson --- target/riscv/debug.c | 55 +++----------------------------------------- 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 511a69c28d..56ae1e6107 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -960,59 +960,10 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, C= PUWatchpoint *wp) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; - target_ulong ctrl; - target_ulong addr; - int trigger_type; - BreakpointFlags flags; - int i; + int i =3D wp->id; + trigger_type_t trigger_type =3D get_trigger_type(env, i); =20 - for (i =3D 0; i < env->num_triggers; i++) { - trigger_type =3D get_trigger_type(env, i); - - if (!trigger_common_match(env, trigger_type, i)) { - continue; - } - - switch (trigger_type) { - case TRIGGER_TYPE_AD_MATCH: - ctrl =3D env->tdata1[i]; - addr =3D env->tdata2[i]; - flags =3D 0; - - if (ctrl & TYPE2_LOAD) { - flags |=3D BP_MEM_READ; - } - if (ctrl & TYPE2_STORE) { - flags |=3D BP_MEM_WRITE; - } - - if ((wp->flags & flags) && (wp->vaddr =3D=3D addr)) { - return true; - } - break; - case TRIGGER_TYPE_AD_MATCH6: - ctrl =3D env->tdata1[i]; - addr =3D env->tdata2[i]; - flags =3D 0; - - if (ctrl & TYPE6_LOAD) { - flags |=3D BP_MEM_READ; - } - if (ctrl & TYPE6_STORE) { - flags |=3D BP_MEM_WRITE; - } - - if ((wp->flags & flags) && (wp->vaddr =3D=3D addr)) { - return true; - } - break; - default: - /* other trigger types are not supported */ - break; - } - } - - return false; + return trigger_common_match(env, trigger_type, i); } =20 void riscv_trigger_realize(CPURISCVState *env) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717281; cv=none; d=zohomail.com; s=zohoarc; b=kER4Ak1G2BjxqcgMv38gHbhpe4Qi3gB79yRlIdYIYlEXqL0O+rNFJTnYirFX3c9lPwpfp5Ij+qS0ijmAWGJEMjFZUHSbtUQVmmsNzSZXzGQWaoRv6pQ7m6V8JD5NmNh/FHRzBagxybUNXeTsPkRwHQ8hrlPnEG3F726yCEzgga8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717281; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sqD0i4B4xHusdPHG8dIAD4vZ8p3PsgamfaStAkj5bxU=; b=JoppcEOytiWiwzt8dsdz14+M6FokTbiw7nLxiiqpD3/co9HKepzblzzsCnLdZaR5OKj7Ma0S7W1PwB1mqWXv7Qcv3hT4UsuWo39L0l8DW3zBIBGz4NASKE563w0m0+u1MH1FcJ4heI+SVXw9TymnFtBsigUZfkl4oFLqE/9shDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717281858422.55871378016434; Fri, 10 Jul 2026 14:01:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIEz-0001W6-OW; Fri, 10 Jul 2026 16:54:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEx-0001TD-6B for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:31 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEm-0000j9-8j for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:30 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-8423f236418so1050585b3a.1 for ; Fri, 10 Jul 2026 13:54:19 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716859; x=1784321659; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sqD0i4B4xHusdPHG8dIAD4vZ8p3PsgamfaStAkj5bxU=; b=W7p4KMSRHRVwda8Ne3q5fOWJOCW5UxyVlhNNHIYiovpsTH/tyEW9GCnXYA24bVRrSL ESpCQm6E38xmSDXcj64tXhc60AjNiQHlBV+zuGg8KaCLSO/rRvgsEJvPSJm1yh1m80ri f/AIwxidO0XrsZF6BwQtdD6Sp69xdAPWV8cV9uLtHzCGCZcVlIAt/6hFNihjFEhub7gD gf5blITHz1SV4a874n5+xoUtTvpMyXNEX9RF6CUICnjp2x87iEIVx5xJYRHiw+eD4wvJ d2TSDq2/LdCVpsUqTA73qtzCKTWSX5Db404+ApQunWTTsaOjsb7VzeXJhBMprwRVcERX TeGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716859; x=1784321659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sqD0i4B4xHusdPHG8dIAD4vZ8p3PsgamfaStAkj5bxU=; b=O/pPtymHohdkDCMK7XgAhqWf+/OnZqoK0sy/1OmN8mAEtHi00AJyrD3VAsQvF7deOx oJMzyJn/cXKOJfVYYIJKnEgIjy+T55c+mhnqIfyh5TYRkaih9QxcloLWM9Oljdq/fKmn G50s2pYb6GuIH6Nsh9RYDNQcVZO1AQwi5yi66wg9mSTD50JQQqlWYsImunYwqB4sjHH8 XnfyJEr+ZWiLnRSbnPWMNM7SqgsvPEhbyr4yI4I2KXIAXbpsEFvWgXEfyfZa75TUeOGw BdFGlSTMgESvhaXsZ00yzItD85VANs0y5FwNN2R8mQtZAPknxsboMZTLHnzZRfEdAJfq dOrg== X-Gm-Message-State: AOJu0YxV0Tx4Pt/qYavrI2fMQsmE0f7eZd47Qfqk0ZtAA6fxx7Lnv9m2 5lHJmfrmtahmYXygxL8ztW4iYGpKfN64baB4hyz6qrjjmSDitZEzVL+VMarSqbVMBPOixwQed69 uLcqo X-Gm-Gg: AfdE7cmvAIFadSPCw1qVFZwx0Q3Hr3RBQEl2GgjxX6u+yy7wr2IPDiNeaP+sRY2f7Du 5IaDgeekT/E1+15955axjxaXm2hVWhaC+MXCKrJ2ruPVU7EJoPa7OAGF3gLGOk+n/cJnupzX4pE xfabmp1zaYh0t+SnRfw6/CLSI5uNoEo4/1cwtrHR1C5+9KfEtc3mV3oyIBRPfvi7HKay9FCTbrv xTlQ3dRzIXsThbYPhBg8YgCDoM7PuvRNFeEVg7wKMImIOOH+7435llhyZn8tpfBbmhV4KkpFnIu 0bqfyBALgBmPXX73aqSCcv6+2X1bX4Q7Tw3Fub2vsybrx782xe+3d+czo7qg4BWe5YLGR2yhvDR fFjwRGCLwamun1GIT5VgfZJEeEeVa97fooVTSEwSrWQNrqpiFNoa37a2VqkikoRUmY1hvZ3MdKH vocFrRoK+114Z3ule23a2y7V9YmfmE X-Received: by 2002:a05:6a00:3494:b0:848:8445:6956 with SMTP id d2e1a72fcca58-848895feb43mr459561b3a.18.1783716858692; Fri, 10 Jul 2026 13:54:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 14/51] target/xtensa: Use bp argument in xtensa_debug_check_breakpoint Date: Fri, 10 Jul 2026 13:53:24 -0700 Message-ID: <20260710205401.836304-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717284146158500 Content-Type: text/plain; charset="utf-8" Use the ID of the breakpoint instead of a loop over all. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/xtensa/dbg_helper.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index 557a7852c8..b08bd03435 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -67,18 +67,11 @@ void HELPER(wsr_ibreaka)(CPUXtensaState *env, uint32_t = i, uint32_t v) bool xtensa_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) { CPUXtensaState *env =3D cpu_env(cs); - unsigned int i; =20 if (xtensa_get_cintlevel(env) >=3D env->config->debug_level) { return false; } - for (i =3D 0; i < env->config->nibreak; ++i) { - if (env->sregs[IBREAKENABLE] & (1 << i) && - env->sregs[IBREAKA + i] =3D=3D env->pc) { - return true; - } - } - return false; + return (env->sregs[IBREAKENABLE] >> bp->id) & 1; } =20 static void set_dbreak(CPUXtensaState *env, unsigned i, uint32_t dbreaka, --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783716944; cv=none; d=zohomail.com; s=zohoarc; b=J1r035TkuGNNJYSJ0KquXytFSePpNdsn4bVgFaGDQ51GZQ9FknQtrkWFi9u1zhNSrlzs6jkra4JBjWB+dtnFIaMzcTsUELE/4FmT6frJlwvDOqYSBDSTZ9hcttnNQdU/BdRy4e2gGIVcmlOK6R733ViZ90L3u6DJEFKHIXhVMMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783716944; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AH60zWDle7diIfRrGmEWIKGfqDNGJU7oKLZ50WZchqw=; b=oGwUyxKGjJcZL2pTIAcIMSj0yXp908xwfsUYRum2bP+4OdFB/lx/qkGMEQiMfs/cpFOPubdvqC3Il+6CP+WPTTkX5yIgy0MUN7buKvKOlqoOyuElD0A4pFn0SFw8+nLMAFDhOrrYzQ6RKkV7ddZoQg+B5se1ctP62Y9IWF3MGng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783716943931356.71411207443293; Fri, 10 Jul 2026 13:55:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIF0-0001YB-KD; Fri, 10 Jul 2026 16:54:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIEy-0001V9-Dw for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:32 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEm-0000jl-Tt for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:32 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-8487214ad2bso1789718b3a.1 for ; Fri, 10 Jul 2026 13:54:20 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716859; x=1784321659; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AH60zWDle7diIfRrGmEWIKGfqDNGJU7oKLZ50WZchqw=; b=TDJuJF4lMoea6rieQL6LVztyxKK4cqYT252U7XZVhFKXoy3T2uImnMfmI6Wrczm6jE tAlmR/zxYmJQwPSTlKeSQV0fMUer0ptk0rpj4c4Lf1O8oVlv7Rryfft+zU7KCcGPtOF4 +XCV2v7eNZJzbQAB5L/wqJTxFOEBzaiTO7d0tx72OoHhtS2jhoAOfOBwy0+J4WEzQ/xG TnqgRKWbRvebkNopbsX+ZXOzjqKvyT4YOXDtWZF2irkRtPhZCmPaZlKC7gyhfJtR9feY +m078IHKz48PIJun/o5F8X3j8inzYU581hoJJN2UadIC03UPUYMvfDWuFjpkwPbK1vYS Q8iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716859; x=1784321659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=AH60zWDle7diIfRrGmEWIKGfqDNGJU7oKLZ50WZchqw=; b=VecK18chNbANLpPzqSgxr4Ft7zFDX3VT/CbB9ZVxJTipV+Ky3y5vewa9Alv4AWLz64 SyHVLkbNOFheCuaNda4WcRyonihEiNSgZCLU9nzH1qXaJxke+SCHm1Arpe+mnbYjTkRh 6AeWHqJcVxEKrZWg1O+vCFiIPKTn+a00lQfnPqJO69ChB4LGQqTxal2pmY/fcrds7Mkk soZByVlUx23Y+6ae6yedvlGaJXQ9l4hchT9rhsdIDYajie6bz4yUe+dIKDWFxo9yVxdx 7oxamQmNOwbvDz4NKJCVgatqU8ygN98CCCrK+FSi9q6r9MRRY1KP15vSuD+m2U2OwUdU vSsg== X-Gm-Message-State: AOJu0Yw1fKohnlh5BkJ7aCwZqEEB++1a4zWKxtfgxsqgc8WsCCBXvFmD vz45Egjj4Rtqp4PaJpQuLQw/ZFukhryhGvD8KGsc0rS+ETX+qQtZAzN4haEHqFo8pVaXw7ibLKE wZ1uL X-Gm-Gg: AfdE7cmbF3oLAWTAhpXeKLtbzRbB28Nhzd2TG/7GdUvClW5fZA9bNx8v6uoC5Ia/ct4 3MZr2Zbi/gnwlM+F22hXNeZzw0QKAO2dVgW8XTanlNl5+PcBVBeHAArgB1ub1KVjo0D0hirCY0a 4oVd7W4bymIyr6EK6uly9NgPqb5B/DMFer6paHvgTS+6bLIwpTUP7DGddjeouGGzTJzAeKpNWYv oGTARJv8gEhSTODmGCVGqojMtOW7MnY6c4s0LFs1TOFYEM0BMGtY/ByecSvumgUPD+GZmoVTN81 2pbFzZ8OSUFHCQZbtdcoF6EaWR6/i/Xz7lh+ASNybYiQvijO/hZtszvpyxAo/q1S1lstYV6xoeP SEhQw93meCg9ypzIL0rCe1CZTz4dLj2DmzzGnLvERzdnziIxRdRKDorbumNJhG6qzJLrZo0BLB2 rAc+qwe5N0dOwfoCwZtw== X-Received: by 2002:a05:6a00:c88:b0:848:2f77:e2dd with SMTP id d2e1a72fcca58-848897a7553mr512136b3a.70.1783716859449; Fri, 10 Jul 2026 13:54:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 15/51] cpu: Use interval-tree for CPUBreakpoint Date: Fri, 10 Jul 2026 13:53:25 -0700 Message-ID: <20260710205401.836304-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783716946100158500 Content-Type: text/plain; charset="utf-8" Use a balanced binary tree rather than a simple list for breakpoints. Using an interval tree makes it easy to probe for all breakpoints on a virtual page. Signed-off-by: Richard Henderson --- include/exec/breakpoint.h | 4 +-- include/hw/core/cpu.h | 3 +- accel/tcg/cpu-exec.c | 58 +++++++++++++++++++++---------------- accel/whpx/whpx-common.c | 9 +++--- cpu-common.c | 46 +++++++++++++++-------------- hw/core/cpu-common.c | 1 - linux-user/main.c | 14 ++++++--- target/i386/whpx/whpx-all.c | 15 +++++----- 8 files changed, 84 insertions(+), 66 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index 6da8a007df..bb7cbc626d 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -8,6 +8,7 @@ #ifndef EXEC_BREAKPOINT_H #define EXEC_BREAKPOINT_H =20 +#include "qemu/interval-tree.h" #include "qemu/queue.h" #include "exec/vaddr.h" #include "exec/memattrs.h" @@ -29,10 +30,9 @@ typedef uint32_t BreakpointFlags; #define BP_WATCHPOINT_HIT (BP_MEM_ACCESS << BP_HIT_SHIFT) =20 struct CPUBreakpoint { - vaddr pc; + IntervalTreeNode itree; /* start =3D=3D last =3D=3D pc */ BreakpointFlags flags; unsigned id; - QTAILQ_ENTRY(CPUBreakpoint) entry; }; =20 struct CPUWatchpoint { diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 5c01908f83..b8a1419860 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -30,6 +30,7 @@ #include "qapi/qapi-types-machine.h" #include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" +#include "qemu/interval-tree.h" #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/lockcnt.h" @@ -523,7 +524,7 @@ struct CPUState { QTAILQ_ENTRY(CPUState) node; =20 /* ice debug support */ - QTAILQ_HEAD(, CPUBreakpoint) breakpoints; + IntervalTreeRoot breakpoints; =20 QTAILQ_HEAD(, CPUWatchpoint) watchpoints; CPUWatchpoint *watchpoint_hit; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 6547cc70c9..2762cf6705 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -296,8 +296,8 @@ static void log_cpu_exec(vaddr pc, CPUState *cpu, static bool check_for_breakpoints_slow(CPUState *cpu, vaddr pc, uint32_t *cflags) { + IntervalTreeNode *n; CPUBreakpoint *bp; - bool match_page =3D false; =20 /* * Singlestep overrides breakpoints. @@ -312,33 +312,34 @@ static bool check_for_breakpoints_slow(CPUState *cpu,= vaddr pc, return false; } =20 - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - /* - * If we have an exact pc match, trigger the breakpoint. - * Otherwise, note matches within the page. - */ - if (pc =3D=3D bp->pc) { - bool match_bp =3D false; - - if (bp->flags & BP_GDB) { - match_bp =3D true; - } else if (bp->flags & BP_CPU) { + n =3D interval_tree_iter_first(&cpu->breakpoints, pc, pc); + if (n) { #ifdef CONFIG_USER_ONLY - g_assert_not_reached(); + bp =3D container_of(n, CPUBreakpoint, itree); + assert(bp->flags & BP_GDB); + goto found; #else - const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; - assert(tcg_ops->debug_check_breakpoint); - match_bp =3D tcg_ops->debug_check_breakpoint(cpu, bp); -#endif + /* Prefer GDB breakpoint over architectural breakpoint. */ + do { + bp =3D container_of(n, CPUBreakpoint, itree); + if (bp->flags & BP_GDB) { + goto found; } + n =3D interval_tree_iter_next(n, pc, pc); + } while (n); =20 - if (match_bp) { - cpu->exception_index =3D EXCP_DEBUG; - return true; + const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; + assert(tcg_ops->debug_check_breakpoint); + + for (n =3D interval_tree_iter_first(&cpu->breakpoints, pc, pc); n; + n =3D interval_tree_iter_next(n, pc, pc)) { + bp =3D container_of(n, CPUBreakpoint, itree); + if ((bp->flags & BP_CPU) && + tcg_ops->debug_check_breakpoint(cpu, bp)) { + goto found; } - } else if (((pc ^ bp->pc) & TARGET_PAGE_MASK) =3D=3D 0) { - match_page =3D true; } +#endif } =20 /* @@ -353,17 +354,24 @@ static bool check_for_breakpoints_slow(CPUState *cpu,= vaddr pc, * invalidated, nor would any TB need to be invalidated as * breakpoints are removed. */ - if (match_page) { + n =3D interval_tree_iter_first(&cpu->breakpoints, + pc & TARGET_PAGE_MASK, + pc | ~TARGET_PAGE_MASK); + if (n) { *cflags =3D (*cflags & ~CF_COUNT_MASK) | CF_NO_GOTO_TB | CF_BP_PAG= E | 1; } return false; + + found: + cpu->exception_index =3D EXCP_DEBUG; + return true; } =20 static inline bool check_for_breakpoints(CPUState *cpu, vaddr pc, uint32_t *cflags) { - return unlikely(!QTAILQ_EMPTY(&cpu->breakpoints)) && - check_for_breakpoints_slow(cpu, pc, cflags); + return unlikely(!interval_tree_is_empty(&cpu->breakpoints)) && + check_for_breakpoints_slow(cpu, pc, cflags); } =20 /** diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 247e12db81..74113b1ec1 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -112,16 +112,17 @@ int whpx_first_vcpu_starting(CPUState *cpu) =20 g_assert(bql_locked()); =20 - if (!QTAILQ_EMPTY(&cpu->breakpoints) || + if (!interval_tree_is_empty(&cpu->breakpoints) || (whpx->breakpoints.breakpoints && whpx->breakpoints.breakpoints->used)) { - CPUBreakpoint *bp; + IntervalTreeNode *n; int i =3D 0; bool update_pending =3D false; =20 - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { + for (n =3D interval_tree_iter_first(&cpu->breakpoints, 0, -1); n; + n =3D interval_tree_iter_next(n, 0, -1)) { if (i >=3D whpx->breakpoints.original_address_count || - bp->pc !=3D whpx->breakpoints.original_addresses[i]) { + n->start !=3D whpx->breakpoints.original_addresses[i]) { update_pending =3D true; } =20 diff --git a/cpu-common.c b/cpu-common.c index 9476bb612a..0287022de4 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -392,13 +392,13 @@ void process_queued_cpu_work(CPUState *cpu) /* Return true if PC matches an installed breakpoint. */ bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask) { - CPUBreakpoint *bp; + IntervalTreeNode *n; =20 - if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - if (bp->pc =3D=3D pc && (bp->flags & mask)) { - return true; - } + for (n =3D interval_tree_iter_first(&cpu->breakpoints, pc, pc); n; + n =3D interval_tree_iter_next(n, pc, pc)) { + CPUBreakpoint *bp =3D container_of(n, CPUBreakpoint, itree); + if (bp->flags & mask) { + return true; } } return false; @@ -414,18 +414,14 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, Br= eakpointFlags flags, pc =3D cpu->cc->gdb_adjust_breakpoint(cpu, pc); } =20 - bp =3D g_malloc(sizeof(*bp)); + bp =3D g_new0(CPUBreakpoint, 1); =20 - bp->pc =3D pc; + bp->itree.start =3D pc; + bp->itree.last =3D pc; bp->flags =3D flags; bp->id =3D id; =20 - /* keep all GDB-injected breakpoints in front */ - if (flags & BP_GDB) { - QTAILQ_INSERT_HEAD(&cpu->breakpoints, bp, entry); - } else { - QTAILQ_INSERT_TAIL(&cpu->breakpoints, bp, entry); - } + interval_tree_insert(&bp->itree, &cpu->breakpoints); =20 if (breakpoint) { *breakpoint =3D bp; @@ -438,36 +434,42 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, Br= eakpointFlags flags, /* Remove a specific breakpoint. */ int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags) { - CPUBreakpoint *bp; + IntervalTreeNode *n; =20 if (cpu->cc->gdb_adjust_breakpoint) { pc =3D cpu->cc->gdb_adjust_breakpoint(cpu, pc); } =20 - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - if (bp->pc =3D=3D pc && bp->flags =3D=3D flags) { + for (n =3D interval_tree_iter_first(&cpu->breakpoints, pc, pc); n; + n =3D interval_tree_iter_next(n, pc, pc)) { + CPUBreakpoint *bp =3D container_of(n, CPUBreakpoint, itree); + if (bp->flags =3D=3D flags) { cpu_breakpoint_remove_by_ref(cpu, bp); return 0; } } + return -ENOENT; } =20 /* Remove a specific breakpoint by reference. */ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp) { - QTAILQ_REMOVE(&cpu->breakpoints, bp, entry); - - trace_breakpoint_remove(cpu->cpu_index, bp->pc, bp->flags); + interval_tree_remove(&bp->itree, &cpu->breakpoints); + trace_breakpoint_remove(cpu->cpu_index, bp->itree.start, bp->flags); g_free(bp); } =20 /* Remove all matching breakpoints. */ void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask) { - CPUBreakpoint *bp, *next; + IntervalTreeNode *n; =20 - QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) { + n =3D interval_tree_iter_first(&cpu->breakpoints, 0, -1); + while (n) { + CPUBreakpoint *bp =3D container_of(n, CPUBreakpoint, itree); + + n =3D interval_tree_iter_next(n, 0, -1); if (bp->flags & mask) { cpu_breakpoint_remove_by_ref(cpu, bp); } diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index e314f916f8..5c2d7ed42c 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -322,7 +322,6 @@ static void cpu_common_initfn(Object *obj) qemu_mutex_init(&cpu->work_mutex); qemu_lockcnt_init(&cpu->in_ioctl_lock); QSIMPLEQ_INIT(&cpu->work_list); - QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); =20 cpu_exec_initfn(cpu); diff --git a/linux-user/main.c b/linux-user/main.c index 83b9c88ac4..4372d0b5a6 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -239,7 +239,6 @@ CPUArchState *cpu_copy(CPUArchState *env) CPUState *cpu =3D env_cpu(env); CPUState *new_cpu =3D cpu_create(cpu_type); CPUArchState *new_env =3D cpu_env(new_cpu); - CPUBreakpoint *bp; =20 /* Reset non arch specific state */ cpu_reset(new_cpu); @@ -258,9 +257,16 @@ CPUArchState *cpu_copy(CPUArchState *env) /* Clone all break/watchpoints. Note: Once we support ptrace with hw-debug register access, make su= re BP_CPU break/watchpoints are handled correctly on clone. */ - QTAILQ_INIT(&new_cpu->breakpoints); - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - cpu_breakpoint_insert(new_cpu, bp->pc, bp->flags, 0, NULL); + if (!interval_tree_is_empty(&cpu->breakpoints)) { + IntervalTreeNode *n; + + memset(&new_cpu->breakpoints, 0, sizeof(new_cpu->breakpoints)); + for (n =3D interval_tree_iter_first(&cpu->breakpoints, 0, -1); n; + n =3D interval_tree_iter_next(n, 0, -1)) { + CPUBreakpoint *bp =3D container_of(n, CPUBreakpoint, itree); + cpu_breakpoint_insert(new_cpu, bp->itree.start, + bp->flags, bp->id, NULL); + } } =20 return new_env; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 634d542821..243413d94c 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1688,8 +1688,8 @@ void whpx_translate_cpu_breakpoints( CPUState *cpu, int cpu_breakpoint_count) { - CPUBreakpoint *bp; int cpu_bp_index =3D 0; + IntervalTreeNode *n; =20 breakpoints->original_addresses =3D g_renew(vaddr, breakpoints->original_addresses, cpu_breakpoint_cou= nt); @@ -1721,14 +1721,15 @@ void whpx_translate_cpu_breakpoints( } =20 /* 2. Map all CPU breakpoints to WHPX breakpoints */ - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - int i; + for (n =3D interval_tree_iter_first(&cpu->breakpoints, 0, -1); n; + n =3D interval_tree_iter_next(n, 0, -1)) { + vaddr pc =3D n->start; bool found =3D false; =20 /* This will be used to detect changed CPU breakpoints later. */ - breakpoints->original_addresses[cpu_bp_index++] =3D bp->pc; + breakpoints->original_addresses[cpu_bp_index++] =3D pc; =20 - for (i =3D 0; i < new_breakpoints->used; i++) { + for (int i =3D 0; i < new_breakpoints->used; i++) { /* * WARNING: This loop has O(N^2) complexity, where N is the * number of breakpoints. It should not be a bottleneck in @@ -1738,7 +1739,7 @@ void whpx_translate_cpu_breakpoints( * high-level breakpoint objects in a tree or hash map. */ =20 - if (new_breakpoints->data[i].address =3D=3D bp->pc) { + if (new_breakpoints->data[i].address =3D=3D pc) { /* There was already a breakpoint at this address. */ if (new_breakpoints->data[i].state =3D=3D WHPX_BP_CLEAR_PE= NDING) { new_breakpoints->data[i].state =3D WHPX_BP_SET; @@ -1753,7 +1754,7 @@ void whpx_translate_cpu_breakpoints( =20 if (!found && new_breakpoints->used < new_breakpoints->allocated) { /* No WHPX breakpoint at this address. Create one. */ - new_breakpoints->data[new_breakpoints->used].address =3D bp->p= c; + new_breakpoints->data[new_breakpoints->used].address =3D pc; new_breakpoints->data[new_breakpoints->used].state =3D WHPX_BP_SET_PENDING; new_breakpoints->used++; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783716941; cv=none; d=zohomail.com; s=zohoarc; b=KFQRyOO9DFgTU+HCPT/REhtXHenhTov0dd3tQ7x2Zj9VdJkmZlWdUVNBLpfVCDBcuNdCPALq4stwJ+ogbpEU07W5nNtLU1TYUlk0ruWPxGhlqLpApSt4A7Rutw24jpWP36dzeUG0OOsTtzBHQ0jmnhHBByaEvRQ1SSUpPINADC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783716941; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9FVe4IDYzuWlBAdVKn89Oel+X5gqBqY4ENpHT0MrX5Q=; b=VbUQTLGc2iSf4VsGcubcQblxK8hzIFHUtjGD7YNKlovnUGTv6e4S648+ACPDmo8AUf0f7bgxRAvCYjQgXcdw5v6u1+SN0bldXW609G+vv5Lg5e/+p63rAXty+6GSrfm74uOntO0KyZvsoSZRMEABOvoEfRAGht61u59HAq/pvcg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783716941100314.939545086832; Fri, 10 Jul 2026 13:55:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIFB-0001jF-N3; Fri, 10 Jul 2026 16:54:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIF4-0001ei-AD for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:40 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEn-0000kA-RW for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:37 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-845c92bc464so1259627b3a.2 for ; Fri, 10 Jul 2026 13:54:21 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716860; x=1784321660; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9FVe4IDYzuWlBAdVKn89Oel+X5gqBqY4ENpHT0MrX5Q=; b=rszTJ0XCFgp4EQ2zXVI82oN5tZNn9S4HW3Xonoqt1nMeIjecdfk2c+b7b3nvgUB7oS TCGeN6FBnq5tZPF3M5zVNgbifvo3hKP/ETJUvT2ih5bHYViFeBSpQqDcBuT6mCcubVQx igVSS9EL7R2hYw4E3vEZICD69QZfLRS4c3vUElI3JVsRtCBSLk4ASbUFbYoa53jKrQSA J5ToyHuv/tN07Ah8i+2MAyjhKERNFdMKHpKZmJIpjH0RtMgulS1tVGSJ0hgum3ODiM34 BcuAjIS/gxRbc8tu6UnO8ItNFtkGB1UdetvIt+sughG3CNJUPFLrr1mfPA7c70CYJqME WtMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716860; x=1784321660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=9FVe4IDYzuWlBAdVKn89Oel+X5gqBqY4ENpHT0MrX5Q=; b=VPsZTihSIwGSZwpDs0CiQtuMLU682sE/RB9jekY1R/GkvwS1TyqcG6DnDxsz8PdAyN KwmSAb9wCn5t+j1Y4+SBaXUU+DMrVvyWb7EDOqSCK3ohfN4HaG3kLMRKCQB4wc5X5/3v aY0s5RIvBLrZG1kHc7m6M9Q6Np2ZC6tGFoir6Y2nqXIwPQ/jRvgc1eic84dh1LMgRqAz uUl/+Chmpj+j+S20l4VN1iD2LvzQ8SOklkWjo/YtobZHqtlLjlAiXPGyT1Gf9pHCBCuu Hsr9NLQJqtad89ct8EhhP/6/TxqmLSb38XgnfajVaPeX4hqzc0ZkZecNmtb64k9cIpP2 QCxQ== X-Gm-Message-State: AOJu0YyEdT71BMN0cNvCCdoSufJE2xfL96o9krja8gf1l6QzwnxUBKfr J7pBA9DIlSGZU/6lk6Q8Gtu4AOfNxR9iDeQZcyNNtx2p3LeyKXsVbq+psgdVlodk87ZvYCnpFO1 lishs X-Gm-Gg: AfdE7cnMdqZqfqzJo/TdotMxLoneJnTduvHFJJTImblOkZWWlA+AkOntMl97HgTY/Vj zCmV02V677flkI+csuxd7Dqj8j0OPJy8xuNFJWqph3z5HXyilM45/uDy/8/hhlO9zMsQUFAPDnA 2apgAeYNmsoHjkSofCmFpMIp9cr9VQFq2cOlOW4rlERnAooLfhUxqhMl0xaFSv3m4RZAT8EfExX xyak3qc17Tljx20fXbdkiltDckHkO/6lL4jvG0tsr5iwUEidaQhyVobfaXqy6WlKl3osnHNb3iy WxQi8OTtg02O1qwzP6fDEQNeIk3Wzzf4AJFqCtzeo7U9mGfZCaxGVc4DvwwxLObxqoC+qxUVko6 o6jUbmLu5nKPH/vkLgcWcu2Zqq/BLb7lMFlGBa6VMR+PwEaYZ/FBWc+xDCP8Yfhy6lm1a9IEPZu QXD+vKvPRRIRiNYj3SUwaYhgKR9yXi X-Received: by 2002:a05:6a00:3388:b0:845:d274:c021 with SMTP id d2e1a72fcca58-8488970be58mr554168b3a.58.1783716860358; Fri, 10 Jul 2026 13:54:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 16/51] target/arm: Make check_watchpoint_in_range static Date: Fri, 10 Jul 2026 13:53:26 -0700 Message-ID: <20260710205401.836304-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783716941924158500 Content-Type: text/plain; charset="utf-8" This function is not used outside hyp_gdbstub.c. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/internals.h | 1 - target/arm/hyp_gdbstub.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 49ec97bd1c..95f32ad308 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1975,7 +1975,6 @@ bool find_hw_breakpoint(CPUState *cpu, vaddr pc); int insert_hw_breakpoint(vaddr pc); int delete_hw_breakpoint(vaddr pc); =20 -bool check_watchpoint_in_range(int i, vaddr addr); CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr); int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType = type); int delete_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType = type); diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c index dda6946dda..c91efa7495 100644 --- a/target/arm/hyp_gdbstub.c +++ b/target/arm/hyp_gdbstub.c @@ -182,7 +182,7 @@ int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len,= GdbBreakpointType type) return 0; } =20 -bool check_watchpoint_in_range(int i, vaddr addr) +static bool check_watchpoint_in_range(int i, vaddr addr) { HWWatchpoint *wp =3D get_hw_wp(i); uint64_t addr_top, addr_bottom =3D wp->wvr; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717400; cv=none; d=zohomail.com; s=zohoarc; b=DyMka7tNSwpWywsCS4FQF2FIlqrwMAIAhJMui/coB5gPe8RX8nxQhdHRrYt3DrbIpxHnrzcKmu2i3us8LAxI5XIgtFFdHjMA7T9D1HiLv2HkZ6Vc/v6dGpBWUmuZ+6ZduOTx4duQs4cV88poF1Ja+1a6Zxd6IvliqBeY+7Ritd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717400; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9b7zTETWU90o56GcX57svy4revXN3qZdBYXrx4oYXfA=; b=ZDmS1iO0dAH8VgmbZE3nU7xopvZlbU8V4u4S3WbqHRvVbMJbBTilSSwAxXGZ2s23kzSn8ziA6s1dpOIsEghYweGcKkPCrsn/rWCQQKyvIyjh33Cq3eoBDIHj/HcjIoCahbqVa0f0w4mNU2sIQ3kCUvhwVTIr3qViZjSrJ9yLqwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717400570344.8897520073548; Fri, 10 Jul 2026 14:03:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIF7-0001el-Ig; Fri, 10 Jul 2026 16:54:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIF2-0001bg-MK for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:36 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEo-0000kn-Ku for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:36 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-84864b41100so1173801b3a.3 for ; Fri, 10 Jul 2026 13:54:22 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716861; x=1784321661; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9b7zTETWU90o56GcX57svy4revXN3qZdBYXrx4oYXfA=; b=YNqTHRTdrERMIIJfD8UxOqF0hYvmFQ64eCYxJy05/PSJB6sPhbguUY7SVCdrGMXFyB zz8WTZnxn9GNNGnpLnG0QyNY6LbFc3oi3sccENFYyu4hISfztHWTtWBtZEli31mJa3g+ aM2zwmrNq1PGu2whbavryzv2H2gyt8i3YOSb0XsaU4Zm8JrA3HVFf056o05JWH3a7VO9 eNX92ugdo2042ifgCbL2Ud83NqgN/UHZ1jXgDIsyaBWSkVHBpO6NABTC8HdqYTsrhO5i 49J7VDydY/mKGI9nzauFY/oVmJv82mI0Hz2+MwZpLlF2y4+Nn/PxgA/M5y87hyk99vgc YAhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716861; x=1784321661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=9b7zTETWU90o56GcX57svy4revXN3qZdBYXrx4oYXfA=; b=A1nRkPrZfgbaFeqZ6fGFwqZRiU1A2Ba10meAQioVK2k+Rf5pwYOQGdFnUFl5oHFv29 y/YPOVK+AiEaAPiZ1vZ0Rxr2peX7O6u4wdG9wogkATdHLk4WiJNhNFG3LUiGzKo63UKi E7YIJjbeVC5XYi2kN3wqIU2r8GafLujCyQHoZ5k0m4HayLCaCN+1ybwWx3kxCETSGm19 Z/C68bzCmqwA3EE4ahNnuTRgH4C6XIdytic4mbX6z5rH9ieZ9Jc+STDXzHzk5cQtXtt2 7YCGJLRu0Owxm46KZL6rpo2yknUxpCH890o21R7bdikZbBOd7CIeePenPPfjdPDrlaM6 q7MA== X-Gm-Message-State: AOJu0Ywh0P+EWf0oawbQ/xmAFwT4SJbWxApKiYQFUuKP/SGlHFmu41Fk 3o+iQGP2p3jzvsRstRBeDyT4wdSuDa9ltDpuRwwrT8GpwHW0YPihnVYL0vQOoJSDwodb5IKbH/B wjmxP X-Gm-Gg: AfdE7ckWae0wk2tH7shMVYZMGfZoSGdkfODsXopRD0FUOAJ+LO8ydU/M7Zowyzgfcj9 NTRiNZR0T+ot4gHj7A1fvH/tIUZIDi3GuogfrLl4r4+4aPGWeLkUCvQ2+eL/JuOjWI6CCrqo0/N a9Y32h3c7xRMqZ1IVpM9ntyjyv6N2WexDdm1jPj1SICjXxMvsGF6pm4ZBZuXKtZyH+cllAVfYtO K8O5ChpPz+yIfjmcYAasY4a5rBJoidHepnaoB2OWxzGvjlOjAzAqGPuT3yS5e79dN64Wv9+s4mD S3L6f/b0eawM6FEQci1djxkEKOK4D/TLmw8QUDp+bxCQ6rAZyxonPMY6QUuFeJi5AHnwc9Hp11m +viHx553VPJPPZ4dDIrBNSszM5BI0kfhJXpTIHUknHHyKD7yH0Onb4/uF3Kz3mjjk8quKD3EHUE TfqK6HMV8nqOdC+ZWQeQ== X-Received: by 2002:a05:6a00:b47:b0:837:e9cc:d474 with SMTP id d2e1a72fcca58-8488974f808mr577808b3a.2.1783716861043; Fri, 10 Jul 2026 13:54:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 17/51] gdbstub: Report actual watchpoint trigger address Date: Fri, 10 Jul 2026 13:53:27 -0700 Message-ID: <20260710205401.836304-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717400928158500 Content-Type: text/plain; charset="utf-8" While gdb doesn't care either way, it seems more correct to report the address of the watchpoint hit, rather than the beginning of the watchpoint region. Adjust all virtualization hosts which construct a dummy CPUWatchpoint structure. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- gdbstub/system.c | 4 ++-- target/arm/hvf/hvf.c | 1 + target/arm/kvm.c | 1 + target/i386/kvm/kvm.c | 4 ++-- target/ppc/kvm.c | 4 ++-- target/s390x/kvm/kvm.c | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gdbstub/system.c b/gdbstub/system.c index 724fd24c00..b36e957b95 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -166,10 +166,10 @@ static void gdb_vm_state_change(void *opaque, bool ru= nning, RunState state) } trace_gdbstub_hit_watchpoint(type, gdb_get_cpu_index(cpu), - cpu->watchpoint_hit->vaddr); + cpu->watchpoint_hit->hitaddr); g_string_printf(buf, "T%02xthread:%s;%swatch:%" VADDR_PRIx ";", GDB_SIGNAL_TRAP, tid->str, type, - cpu->watchpoint_hit->vaddr); + cpu->watchpoint_hit->hitaddr); cpu->watchpoint_hit =3D NULL; goto send_packet; } else { diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index da3ec521fc..70edb2f219 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2375,6 +2375,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) if (!wp) { error_report("EXCP_DEBUG but unknown hw watchpoint"); } + wp->hitaddr =3D excp->virtual_address; cpu->watchpoint_hit =3D wp; break; } diff --git a/target/arm/kvm.c b/target/arm/kvm.c index d40a6a9859..ebe4ecbb77 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -1519,6 +1519,7 @@ static bool kvm_arm_handle_debug(ARMCPU *cpu, { CPUWatchpoint *wp =3D find_hw_watchpoint(cs, debug_exit->far); if (wp) { + wp->hitaddr =3D debug_exit->far; cs->watchpoint_hit =3D wp; return true; } diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 8161831de2..51ff5cd767 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -6264,13 +6264,13 @@ static int kvm_handle_debug(X86CPU *cpu, case 0x1: ret =3D EXCP_DEBUG; cs->watchpoint_hit =3D &hw_watchpoint; - hw_watchpoint.vaddr =3D hw_breakpoint[n].addr; + hw_watchpoint.hitaddr =3D hw_breakpoint[n].addr; hw_watchpoint.flags =3D BP_MEM_WRITE; break; case 0x3: ret =3D EXCP_DEBUG; cs->watchpoint_hit =3D &hw_watchpoint; - hw_watchpoint.vaddr =3D hw_breakpoint[n].addr; + hw_watchpoint.hitaddr =3D hw_breakpoint[n].addr; hw_watchpoint.flags =3D BP_MEM_ACCESS; break; } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 1a093e1f83..2a98ed89c8 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1589,11 +1589,11 @@ static int kvm_handle_hw_breakpoint(CPUState *cs, KVMPPC_DEBUG_WATCH_WRITE)) { BreakpointFlags flag =3D 0; =20 - n =3D find_hw_watchpoint(arch_info->address, &flag); + n =3D find_hw_watchpoint(arch_info->address, &flag); if (n >=3D 0) { handle =3D DEBUG_RETURN_GDB; cs->watchpoint_hit =3D &hw_watchpoint; - hw_watchpoint.vaddr =3D hw_debug_points[n].addr; + hw_watchpoint.hitaddr =3D arch_info->address; hw_watchpoint.flags =3D flag; } } diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 6f7f75f601..89e90a84ec 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -1864,7 +1864,7 @@ static int kvm_arch_handle_debug_exit(S390CPU *cpu) case KVM_HW_WP_WRITE: if (find_hw_breakpoint(arch_info->addr, -1, arch_info->type)) { cs->watchpoint_hit =3D &hw_watchpoint; - hw_watchpoint.vaddr =3D arch_info->addr; + hw_watchpoint.hitaddr =3D arch_info->addr; hw_watchpoint.flags =3D BP_MEM_WRITE; ret =3D EXCP_DEBUG; } --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717025; cv=none; d=zohomail.com; s=zohoarc; b=E7qjbZRhDsISew1MjeH5w6dxFWt9SWhj9JJ88m+9xh+vFI2vyQx5np+AW1rfaYpd17evkYVMDiPdtOUnI/Wk7bRln0c534tZJ+pcwqjcIHbFHRjS3Pev5/nQfmimi5f/oh4ZrDhRPtXLcCl6HH2dNdYKgYY79Eh74kvv1bzMjc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717025; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I8oM6zA995h2YqemG4RaUvMUdlMqbrs5DxUx8iaXoJQ=; b=TUQr7iG5rX6Prtd/oZ8ack2U9Lb16/Npounlnfk2zQAQYbQgD8BitN9swyPNToPkbw91NLE78XFske8v0pbeKBrXhNutuXy+DnTTBJzd9TlMgyEDB1DKNbnd7HPO5Zq+1Ai80/2OTb0pRZ5jPUxR3ZOajycx1e3gdVwxy/PZvJM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717025040689.839314637738; Fri, 10 Jul 2026 13:57:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIFH-0001oh-44; Fri, 10 Jul 2026 16:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIF4-0001eW-84 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:38 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEp-0000lH-ER for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:37 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-84864b41100so1173809b3a.3 for ; Fri, 10 Jul 2026 13:54:22 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716862; x=1784321662; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=I8oM6zA995h2YqemG4RaUvMUdlMqbrs5DxUx8iaXoJQ=; b=FwPNQHe6kT/SxBQXjmesrPIw0u5v7SMoYJWma2G+DSjFJlkfVvoegVjisLd1uVIs8s RPdL+FPzQEd2nX/dCC3YLPd2EWIn7Df+S5W1pUBBvDv0sVCtfCyTk7Vlga/ZzCAcsXUL 7AvizZI+8T3sEh6IB29UdG/43xNdTyjxBJLpNefpqGwSP26AIii2uI+O5EgNcvOmlJRl 1Nqd4Z88srvpWs0IA1vaJ6Gpa4Ksgqs5wQ1ryEyLw4XPKkBk0x/JhL/0uAI4+QFUYV4m O+WfLZU0hvpHzmXuAuvnoQUJZG1NHvzViIULNUqB2nRBVyp2Hrk04aTl3U/VG66sWt49 AKUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716862; x=1784321662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=I8oM6zA995h2YqemG4RaUvMUdlMqbrs5DxUx8iaXoJQ=; b=b2YEjUvAoaqtxFoEwhohJfVsSqzRLyxZwj5UQNvk2rBzeJcswezOVpHiiwICdaz9fG YKPmM7AwIthXZjG1/zkCssIiJRhmEEHfQYrRYhuk/s6uchPpJnmHPXZ+eyKKQT+aUemn d0MRmBrdr6xhTD1+J1d2LfMGMj/o4utq0eZUvHAb4Xrz2CbSaeu+CpKB+jxeXfC4+fal pxXbWtqZQ07zudpbG1guZ2By0fwBjheUcRcowF9w1fHU1Yv488C2LnxXDeLxpt1kX17t CYpWt0zkGTeTj7kzfiyKeJ8ccs5d0Xj+M2RFKx+0ci1A3SN3MDRui/r+6UdW1I7QuxLg lE8w== X-Gm-Message-State: AOJu0Yxgn9yZ/Hl0jrfEhXhu8mix697MX7syny3QB5Pg5jTZWwtG5fna kimqBN5rck599C8YKiuivUb8cjGaPPwJwEhRAQEhIev6adQYvJoTmxpk9LcinAzlxEYCJYPCWcf g8fWI X-Gm-Gg: AfdE7clYrVS+FsVcKzmSNMOcZnhg9f/ZkjkJ2gKes/uirImclNP4SWjQwjZsxd27spZ mnYWrx/t1d4SuKEGu/KwlXOwJwOrKqKNkHkB8Zu1inOxaeBpJyp5gJZLie1PaTpEzu3PG3q7rN5 X3jl6FRQvwz6gkXONRNiWBAG0wKVrEfm240jyC97EoVn2wj0IV5J8XqG6KrVic0mLBdn7HPVrA8 ETFsrTX0uahvKAkvnvOePhEDQyNQ9ki/SbUkHiEc5PgQdYd+mMxHfeZvb1c9cy3S5w+4cGAiCfb xHX1VJ/F30amok1zleCreOfI6rY6FPWKSyKvOKBYhAHUPFKCAL7WjDExY7WqGKyCJGq7zJJgWPQ pqrg+PyNNyoiTg5HiCphyCTB70dnizD1lxQCnty5+zjVMh30Ujm8lp/0YFW5zW1NoLZ6C18FAIk CIH+SwzMHnKrrQCXJqJw== X-Received: by 2002:a05:6a00:ab88:b0:848:411f:3969 with SMTP id d2e1a72fcca58-8488979fc3cmr487713b3a.20.1783716861885; Fri, 10 Jul 2026 13:54:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 18/51] cpu: Use interval-tree for CPUWatchpoint Date: Fri, 10 Jul 2026 13:53:28 -0700 Message-ID: <20260710205401.836304-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717026483158500 Content-Type: text/plain; charset="utf-8" Use a balanced binary tree rather than a simple list for watchpoints. Using an interval tree makes it easy to probe for any overlapping address. Signed-off-by: Richard Henderson --- include/exec/breakpoint.h | 7 +- include/hw/core/cpu.h | 3 +- accel/tcg/cpu-exec.c | 8 +- accel/tcg/watchpoint.c | 155 +++++++++++++++++++++----------------- hw/core/cpu-common.c | 1 - system/watchpoint.c | 43 ++++++----- target/arm/hyp_gdbstub.c | 3 +- 7 files changed, 119 insertions(+), 101 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index bb7cbc626d..e0826a1a2d 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -9,7 +9,6 @@ #define EXEC_BREAKPOINT_H =20 #include "qemu/interval-tree.h" -#include "qemu/queue.h" #include "exec/vaddr.h" #include "exec/memattrs.h" =20 @@ -36,13 +35,11 @@ struct CPUBreakpoint { }; =20 struct CPUWatchpoint { - vaddr vaddr; - vaddr len; + IntervalTreeNode itree; vaddr hitaddr; MemTxAttrs hitattrs; - int flags; /* BP_* */ + BreakpointFlags flags; unsigned id; - QTAILQ_ENTRY(CPUWatchpoint) entry; }; =20 int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index b8a1419860..7e19ea418d 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -525,8 +525,7 @@ struct CPUState { =20 /* ice debug support */ IntervalTreeRoot breakpoints; - - QTAILQ_HEAD(, CPUWatchpoint) watchpoints; + IntervalTreeRoot watchpoints; CPUWatchpoint *watchpoint_hit; =20 void *opaque; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 2762cf6705..ab299387e3 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -682,10 +682,12 @@ static inline bool cpu_handle_halt(CPUState *cpu) static inline void cpu_handle_debug_exception(CPUState *cpu) { const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; - CPUWatchpoint *wp; + IntervalTreeNode *n; =20 - if (!cpu->watchpoint_hit) { - QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { + for (n =3D interval_tree_iter_first(&cpu->watchpoints, 0, -1); n; + n =3D interval_tree_iter_next(n, 0, -1)) { + CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + if (wp !=3D cpu->watchpoint_hit) { wp->flags &=3D ~BP_WATCHPOINT_HIT; } } diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index 5ea66e9763..a7ce5fa9dd 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -30,38 +30,18 @@ #include "hw/core/cpu.h" #include "internal-common.h" =20 -/* - * Return true if this watchpoint address matches the specified - * access (ie the address range covered by the watchpoint overlaps - * partially or completely with the address range covered by the - * access). - */ -static inline bool watchpoint_address_matches(CPUWatchpoint *wp, - vaddr addr, vaddr len) -{ - /* - * We know the lengths are non-zero, but a little caution is - * required to avoid errors in the case where the range ends - * exactly at the top of the address space and so addr + len - * wraps round to zero. - */ - vaddr wpend =3D wp->vaddr + wp->len - 1; - vaddr addrend =3D addr + len - 1; - - return !(addr > wpend || wp->vaddr > addrend); -} - /* Return flags for watchpoints that match addr + prot. */ BreakpointFlags cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len) { - CPUWatchpoint *wp; + vaddr last =3D addr + len - 1; BreakpointFlags ret =3D 0; + IntervalTreeNode *n; =20 - QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { - if (watchpoint_address_matches(wp, addr, len)) { - ret |=3D wp->flags; - } + for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, last); n; + n =3D interval_tree_iter_next(n, addr, last)) { + CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + ret |=3D wp->flags; } return ret; } @@ -70,7 +50,10 @@ BreakpointFlags cpu_watchpoint_address_matches(CPUState = *cpu, void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, MemTxAttrs attrs, BreakpointFlags flags, uintptr= _t ra) { - CPUWatchpoint *wp; + vaddr last =3D addr + len - 1; + IntervalTreeNode *n; + CPUWatchpoint *found_wp =3D NULL; + bool have_cpu_wp =3D false; =20 assert(tcg_enabled()); if (cpu->watchpoint_hit) { @@ -88,56 +71,90 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, va= ddr len, if (cpu->cc->tcg_ops->adjust_watchpoint_address) { /* this is currently used only by ARM BE32 */ addr =3D cpu->cc->tcg_ops->adjust_watchpoint_address(cpu, addr, le= n); + last =3D addr + len - 1; } =20 assert((flags & ~BP_MEM_ACCESS) =3D=3D 0); - QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { - BreakpointFlags hit_flags =3D wp->flags & flags; =20 - if (hit_flags && watchpoint_address_matches(wp, addr, len)) { - if (replay_running_debug()) { - /* - * replay_breakpoint reads icount. - * Force recompile to succeed, because icount may - * be read only at the end of the block. - */ - if (!cpu->neg.can_do_io) { - /* Force execution of one insn next time. */ - cpu->cflags_next_tb =3D 1 | CF_NOIRQ | curr_cflags(cpu= ); - cpu_loop_exit_restore(cpu, ra); - } - /* - * Don't process the watchpoints when we are - * in a reverse debugging operation. - */ - replay_breakpoint(); - return; - } + for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, last); n; + n =3D interval_tree_iter_next(n, addr, last)) { + CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); =20 - wp->flags |=3D hit_flags << BP_HIT_SHIFT; - wp->hitaddr =3D MAX(addr, wp->vaddr); - wp->hitattrs =3D attrs; - - if (wp->flags & BP_CPU - && cpu->cc->tcg_ops->debug_check_watchpoint - && !cpu->cc->tcg_ops->debug_check_watchpoint(cpu, wp)) { + if (wp->flags & flags) { + /* + * Prefer GDB over CPU watchpoint, so we can take the first + * GDB watchpoint that we see. + */ + if (wp->flags & BP_GDB) { wp->flags &=3D ~BP_WATCHPOINT_HIT; - continue; - } - cpu->watchpoint_hit =3D wp; + wp->flags |=3D flags << BP_HIT_SHIFT; + wp->hitaddr =3D MAX(addr, wp->itree.start); + wp->hitattrs =3D attrs; =20 - /* This call also restores vCPU state */ - tb_check_watchpoint(cpu, ra); - if (wp->flags & BP_STOP_BEFORE_ACCESS) { - cpu->exception_index =3D EXCP_DEBUG; - cpu_loop_exit(cpu); - } else { - /* Force execution of one insn next time. */ - cpu->cflags_next_tb =3D 1 | CF_NOIRQ | curr_cflags(cpu); - cpu_loop_exit_noexc(cpu); + found_wp =3D wp; + goto found; } - } else { - wp->flags &=3D ~BP_WATCHPOINT_HIT; + have_cpu_wp =3D true; } } + + if (have_cpu_wp) { + const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; + + for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, last)= ; n; + n =3D interval_tree_iter_next(n, addr, last)) { + CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + + if ((wp->flags & BP_CPU) && (wp->flags & flags)) { + wp->flags &=3D ~BP_WATCHPOINT_HIT; + wp->flags |=3D flags << BP_HIT_SHIFT; + wp->hitaddr =3D MAX(addr, wp->itree.start); + wp->hitattrs =3D attrs; + + if (tcg_ops->debug_check_watchpoint + && !tcg_ops->debug_check_watchpoint(cpu, wp)) { + wp->flags &=3D ~BP_WATCHPOINT_HIT; + continue; + } + + found_wp =3D wp; + goto found; + } + } + } + return; + + found: + if (replay_running_debug()) { + /* + * replay_breakpoint reads icount. + * Force recompile to succeed, because icount may + * be read only at the end of the block. + */ + if (!cpu->neg.can_do_io) { + /* Force execution of one insn next time. */ + cpu->cflags_next_tb =3D 1 | CF_NOIRQ | curr_cflags(cpu); + cpu_loop_exit_restore(cpu, ra); + } + /* + * Don't process the watchpoints when we are + * in a reverse debugging operation. + */ + replay_breakpoint(); + return; + } + + cpu->watchpoint_hit =3D found_wp; + + /* This call also restores vCPU state */ + tb_check_watchpoint(cpu, ra); + if (found_wp->flags & BP_STOP_BEFORE_ACCESS) { + cpu->exception_index =3D EXCP_DEBUG; + cpu_loop_exit(cpu); + } else { + /* Force execution of one insn next time. */ + cpu->cflags_next_tb =3D 1 | CF_NOIRQ | curr_cflags(cpu); + cpu_loop_exit_noexc(cpu); + } + qemu_build_not_reached(); } diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 5c2d7ed42c..868c7c4d46 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -322,7 +322,6 @@ static void cpu_common_initfn(Object *obj) qemu_mutex_init(&cpu->work_mutex); qemu_lockcnt_init(&cpu->in_ioctl_lock); QSIMPLEQ_INIT(&cpu->work_list); - QTAILQ_INIT(&cpu->watchpoints); =20 cpu_exec_initfn(cpu); =20 diff --git a/system/watchpoint.c b/system/watchpoint.c index a618bb5acd..ed505da403 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -30,26 +30,23 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, va= ddr len, CPUWatchpoint **watchpoint) { CPUWatchpoint *wp; + vaddr last =3D addr + len - 1; vaddr in_page; =20 /* forbid ranges which are empty or run off the end of the address spa= ce */ - if (len =3D=3D 0 || (addr + len - 1) < addr) { + if (len =3D=3D 0 || last < addr) { error_report("tried to set invalid watchpoint at %" VADDR_PRIx ", len=3D%" VADDR_PRIu, addr, len); return -EINVAL; } - wp =3D g_malloc(sizeof(*wp)); =20 - wp->vaddr =3D addr; - wp->len =3D len; + wp =3D g_new0(CPUWatchpoint, 1); + + wp->itree.start =3D addr; + wp->itree.last =3D last; wp->flags =3D flags; =20 - /* keep all GDB-injected watchpoints in front */ - if (flags & BP_GDB) { - QTAILQ_INSERT_HEAD(&cpu->watchpoints, wp, entry); - } else { - QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry); - } + interval_tree_insert(&wp->itree, &cpu->watchpoints); =20 in_page =3D -(addr | TARGET_PAGE_MASK); if (len <=3D in_page) { @@ -68,11 +65,16 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, va= ddr len, int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags) { - CPUWatchpoint *wp; + vaddr last =3D addr + len - 1; + IntervalTreeNode *n; =20 - QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { - if (addr =3D=3D wp->vaddr && len =3D=3D wp->len - && flags =3D=3D (wp->flags & ~BP_WATCHPOINT_HIT)) { + for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, addr); n; + n =3D interval_tree_iter_next(n, addr, addr)) { + CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + + if (addr =3D=3D wp->itree.start && + last =3D=3D wp->itree.last && + flags =3D=3D (wp->flags & ~BP_WATCHPOINT_HIT)) { cpu_watchpoint_remove_by_ref(cpu, wp); return 0; } @@ -83,19 +85,20 @@ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, va= ddr len, /* Remove a specific watchpoint by reference. */ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint) { - QTAILQ_REMOVE(&cpu->watchpoints, watchpoint, entry); - - tlb_flush_page(cpu, watchpoint->vaddr); - + interval_tree_remove(&watchpoint->itree, &cpu->watchpoints); + tlb_flush_page(cpu, watchpoint->itree.start); g_free(watchpoint); } =20 /* Remove all matching watchpoints. */ void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags mask) { - CPUWatchpoint *wp, *next; + IntervalTreeNode *n =3D interval_tree_iter_first(&cpu->watchpoints, 0,= -1); =20 - QTAILQ_FOREACH_SAFE(wp, &cpu->watchpoints, entry, next) { + while (n) { + CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + + n =3D interval_tree_iter_next(n, 0, -1); if (wp->flags & mask) { cpu_watchpoint_remove_by_ref(cpu, wp); } diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c index c91efa7495..8dd1fbd440 100644 --- a/target/arm/hyp_gdbstub.c +++ b/target/arm/hyp_gdbstub.c @@ -130,7 +130,8 @@ int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len,= GdbBreakpointType type) HWWatchpoint wp =3D { .wcr =3D R_DBGWCR_E_MASK, /* E=3D1, enable */ .wvr =3D addr & (~0x7ULL), - .details =3D { .vaddr =3D addr, .len =3D len } + .details.itree.start =3D addr, + .details.itree.last =3D addr + len - 1, }; =20 if (cur_hw_wps >=3D max_hw_wps) { --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717054; cv=none; d=zohomail.com; s=zohoarc; b=Ich+iXqTK7M1XBd5nq29a2IvOoJOfS5uve0xdyexpNhIvNb2s3c5APIv3HBY99/alFAmSvlCaRbjwMmWHMm3BtyiSnxQNoQ+FI+zLJiOZBKIlilEwjGLoffJSX7ctgcidOh/f3JYT2D+S4pYNIb4yMA67c2dMWWUcR5KMMcVeaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717054; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/tBqTVMfzy4JRXI0rLMBlVN1Jp4ho8+t/VS/+DbUbgg=; b=eUhI0hL9rOJ8Fiki+h7yGOf+0yRrpON4nJ2x60t34D5tPi+XwKowJc6qrkLav3T9LTraJzREgKWsWCU9dwwFzpqq/yrtfpf0BGirLX6I0xfgF2B0v2PeTOcfTMzbE9Ce0HDtq5NhreRgfM/hGKJPgOYbLEYD8F4DCLnCly7afyQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717054991588.929137713876; Fri, 10 Jul 2026 13:57:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIFJ-0001rx-1E; Fri, 10 Jul 2026 16:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIF7-0001fs-Tm for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:42 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEq-0000mK-RP for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:39 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-848479c9bd5so1110688b3a.3 for ; Fri, 10 Jul 2026 13:54:24 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716863; x=1784321663; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/tBqTVMfzy4JRXI0rLMBlVN1Jp4ho8+t/VS/+DbUbgg=; b=PS3vL+W+BeerTsYsZu+r995dj6qMcTJm7bUxSD3QDiX6QQ/4nP9sv4EYayedaYtl9i EtH1YAXVFKWNeEsIAUw/zbp3OdgGrdkBZtg++IGs6N/e5WHoWUd3fYTMGnsSweqYCyHS n7pxy8f7BHzS03NY2yJozZ0GOowvWLI10/0okF+2VQHBIXgMNZWNI5+18x7KG9nK8Kd9 1135iYXaADsB47Ahf7eq4EYCqUtHVCjp46cVolg6+69c9lH7HEzZhM0o/nhXkunRpBZF 65ehx35nFrq5Wyw9vrNHHHzONshkY6nprwMIrA/PobZ0ZLFu+Vy1ZO3HNgXZOLe2/qmO 5g0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716863; x=1784321663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/tBqTVMfzy4JRXI0rLMBlVN1Jp4ho8+t/VS/+DbUbgg=; b=COoKhSWngP7S1tFokndzrWdhMhXm+MTLa5e6Gtd9zu8BXjM43pUmFaa2ah1OsCVrdL Ge9umyqa6p1RFLfSFY3cshfw2rUaxL33TT2FhNczHvlTZcNMTEnKRefAjtZty7uBFrSV ZCoMCLYiK4Zs3oZmCifkCyVy9mQOfLIyB7p8dphwiC0wGQ0Q0LHkwDtDBHsxF02IxaLv EZSMGkpS83u4Qkxm5fXR7xDaZvYq4JklRILzcrfQhfJrSggeRJvgcLswmB/t3JiIABjk U76TE+gu7+jE3zlh8AyN/nDNjwK6vmjhGjiP1o44sNx028c52CpZlhTkhbrFGoMDV5Y5 UuTg== X-Gm-Message-State: AOJu0YyjLFLWAax4kFmqeSH8TB19/ab88lewLoTCsss5vQlbCPyK6wHg Dz1lfaTTwwFZ5wKnFDgXlZDWZO/yRBJ3qhVvLSxOIpM5H8jNidIvIZjT+x5xptGlb2LDfGJLxe6 kWQ/O X-Gm-Gg: AfdE7cnzD7VXozohPGrP9+zHiijT/jYXlKg3LKxumbuXGxBBx5/cORfbdmF0hlxOnjR j5Bsd+YRxKo+b/rQZx140jb+7BEnR5hl9ZCt6xTwTZG/GrO88M7R333w5k4SEOMkl6fW+eY/bJ5 ifYZlkHDieupPgtJOnRJVYdPOG0AC3cnUotvL9EPzPaDDMrnHTOR1UsYd3YtRs+AUD0NitwLVvJ zrIMG+BpJuglNbXC89oM0mcDpLdmXZTUUchy5UbgcvjTxVdr+CdHMhW4XOu/Bj6OmrqxKvfRMXv V2gN/hIxGAvG3bQZM5xf1EBOCLwQhNtz0B3getlrBCGdvOF9/gHmAe16Pqa+t6kqoHqw1l2hYxp DBuIzLLteCtEnACsGzUGU2+/b1ICt3kjcMk8g+D3X3BdiXSxOSPZJvjA4LPYBBj+zKlz5NAG7yE 0BbKP5urypgp6x3szwSw== X-Received: by 2002:a05:6a00:f8b:b0:845:dedd:89c6 with SMTP id d2e1a72fcca58-848896f266cmr521883b3a.18.1783716863331; Fri, 10 Jul 2026 13:54:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 19/51] exec/breakpoint: Return the new bp from cpu_breakpoint_insert Date: Fri, 10 Jul 2026 13:53:29 -0700 Message-ID: <20260710205401.836304-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717056561158500 Content-Type: text/plain; charset="utf-8" The cpu_breakpoint_insert function cannot fail, so the error return value isn't actually used. Instead of returning the new breakpoint by reference, return it directly. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/breakpoint.h | 4 ++-- accel/tcg/tcg-accel-ops.c | 7 ++----- cpu-common.c | 11 +++-------- gdbstub/user.c | 8 ++------ linux-user/main.c | 2 +- target/arm/tcg/debug.c | 2 +- target/i386/tcg/system/bpt_helper.c | 3 +-- target/ppc/cpu.c | 2 +- target/riscv/debug.c | 5 ++--- target/xtensa/dbg_helper.c | 6 +++--- 10 files changed, 18 insertions(+), 32 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index e0826a1a2d..95aa4f5933 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -42,8 +42,8 @@ struct CPUWatchpoint { unsigned id; }; =20 -int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, - unsigned id, CPUBreakpoint **breakpoint); +CPUBreakpoint *cpu_breakpoint_insert(CPUState *cpu, vaddr pc, + BreakpointFlags flags, unsigned id); int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, BreakpointFlags flags); void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint= ); void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index afac859b8d..644c5b04a2 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -137,12 +137,9 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs,= GdbBreakpointType type, case GDB_BREAKPOINT_SW: case GDB_BREAKPOINT_HW: CPU_FOREACH(cpu) { - err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, 0, NULL); - if (err) { - break; - } + cpu_breakpoint_insert(cpu, addr, BP_GDB, 0); } - return err; + return 0; case GDB_WATCHPOINT_WRITE: case GDB_WATCHPOINT_READ: case GDB_WATCHPOINT_ACCESS: diff --git a/cpu-common.c b/cpu-common.c index 0287022de4..fcc9bc77a3 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -405,8 +405,8 @@ bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, Break= pointFlags mask) } =20 /* Add a breakpoint. */ -int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, BreakpointFlags flags, - unsigned id, CPUBreakpoint **breakpoint) +CPUBreakpoint *cpu_breakpoint_insert(CPUState *cpu, vaddr pc, + BreakpointFlags flags, unsigned id) { CPUBreakpoint *bp; =20 @@ -422,13 +422,8 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, Bre= akpointFlags flags, bp->id =3D id; =20 interval_tree_insert(&bp->itree, &cpu->breakpoints); - - if (breakpoint) { - *breakpoint =3D bp; - } - trace_breakpoint_insert(cpu->cpu_index, pc, flags); - return 0; + return bp; } =20 /* Remove a specific breakpoint. */ diff --git a/gdbstub/user.c b/gdbstub/user.c index ed0e88d169..f58fcf92a5 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -795,18 +795,14 @@ int gdb_breakpoint_insert(CPUState *cs, GdbBreakpoint= Type type, vaddr addr, vaddr len) { CPUState *cpu; - int err =3D 0; =20 switch (type) { case GDB_BREAKPOINT_SW: case GDB_BREAKPOINT_HW: CPU_FOREACH(cpu) { - err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, 0, NULL); - if (err) { - break; - } + cpu_breakpoint_insert(cpu, addr, BP_GDB, 0); } - return err; + return 0; default: /* user-mode doesn't support watchpoints */ return -ENOSYS; diff --git a/linux-user/main.c b/linux-user/main.c index 4372d0b5a6..54d39627f6 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -265,7 +265,7 @@ CPUArchState *cpu_copy(CPUArchState *env) n =3D interval_tree_iter_next(n, 0, -1)) { CPUBreakpoint *bp =3D container_of(n, CPUBreakpoint, itree); cpu_breakpoint_insert(new_cpu, bp->itree.start, - bp->flags, bp->id, NULL); + bp->flags, bp->id); } } =20 diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index daad2ac440..2c73ca1080 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -685,7 +685,7 @@ void hw_breakpoint_update(ARMCPU *cpu, int n) return; } =20 - cpu_breakpoint_insert(CPU(cpu), addr, flags, n, &env->cpu_breakpoint[n= ]); + env->cpu_breakpoint[n] =3D cpu_breakpoint_insert(CPU(cpu), addr, flags= , n); } =20 void hw_breakpoint_update_all(ARMCPU *cpu) diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index 662ffbacfc..23f2d05126 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -62,8 +62,7 @@ static int hw_breakpoint_insert(CPUX86State *env, int ind= ex) switch (hw_breakpoint_type(dr7, index)) { case DR7_TYPE_BP_INST: if (hw_breakpoint_enabled(dr7, index)) { - err =3D cpu_breakpoint_insert(cs, drN, BP_CPU, index, - &env->cpu_breakpoint[index]); + env->cpu_breakpoint[index] =3D cpu_breakpoint_insert(cs, drN, = BP_CPU, index); } break; =20 diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 581fa6a575..a25c8ae2f1 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -121,7 +121,7 @@ void ppc_update_ciabr(CPUPPCState *env) } =20 if (priv) { - cpu_breakpoint_insert(cs, ciea, BP_CPU, 0, &env->ciabr_breakpoint); + env->ciabr_breakpoint =3D cpu_breakpoint_insert(cs, ciea, BP_CPU, = 0); } } =20 diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 56ae1e6107..d6bba24c81 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -488,7 +488,7 @@ static void type2_breakpoint_insert(CPURISCVState *env,= target_ulong index) } =20 if (ctrl & TYPE2_EXEC) { - cpu_breakpoint_insert(cs, addr, flags, 0, &env->cpu_breakpoint[ind= ex]); + env->cpu_breakpoint[index] =3D cpu_breakpoint_insert(cs, addr, fla= gs, 0); } =20 if (ctrl & TYPE2_LOAD) { @@ -613,8 +613,7 @@ static void type6_breakpoint_insert(CPURISCVState *env,= target_ulong index) } =20 if (ctrl & TYPE6_EXEC) { - cpu_breakpoint_insert(cs, addr, flags, index, - &env->cpu_breakpoint[index]); + env->cpu_breakpoint[index] =3D cpu_breakpoint_insert(cs, addr, fla= gs, index); } =20 if (ctrl & TYPE6_LOAD) { diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index b08bd03435..9df0c519b3 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -42,8 +42,8 @@ void HELPER(wsr_ibreakenable)(CPUXtensaState *env, uint32= _t v) for (i =3D 0; i < env->config->nibreak; ++i) { if (change & (1 << i)) { if (v & (1 << i)) { - cpu_breakpoint_insert(cs, env->sregs[IBREAKA + i], - BP_CPU, i, &env->cpu_breakpoint[i]); + env->cpu_breakpoint[i] =3D + cpu_breakpoint_insert(cs, env->sregs[IBREAKA + i], BP_= CPU, i); } else { cpu_breakpoint_remove_by_ref(cs, env->cpu_breakpoint[i]); env->cpu_breakpoint[i] =3D NULL; @@ -59,7 +59,7 @@ void HELPER(wsr_ibreaka)(CPUXtensaState *env, uint32_t i,= uint32_t v) CPUState *cs =3D env_cpu(env); =20 cpu_breakpoint_remove_by_ref(cs, env->cpu_breakpoint[i]); - cpu_breakpoint_insert(cs, v, BP_CPU, i, &env->cpu_breakpoint[i]); + env->cpu_breakpoint[i] =3D cpu_breakpoint_insert(cs, v, BP_CPU, i); } env->sregs[IBREAKA + i] =3D v; } --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717217; cv=none; d=zohomail.com; s=zohoarc; b=O1rYWwcbs4y+7JFzJOWYHgUQiGxJ18Tb3WkHOu8aXY5pfU+ZJDNJFJT2/gUq5MNhaOut+ZjZEqB+id9ayE+EWp1xL62itPcEY3XKOliFGUZut+f9wflGW21e160C7FH5MOxnN97z4hfJcXFE5ta6bC5FXYHaVMNpdmoV31WGClM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717217; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Uywufw6tvUASB9x55Dq0IZwzU/8JaTqzxiT122QYyUo=; b=XuNv1NlhUOyGvOHwEuIf36IPYyiA1JDFcgXS02m2rja1f6F3oNRy0AwsOKmftCmT1AlECgxz2cz+3UtoJaC2Z5tMgmFK6i6Y0gOxWRYZ/aMhzDSKBC69K3uCeIvjMLEPdzQWAh1rmpmrJasGa3lGqZq5RkAtMi8GQwD4OsTVGKo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717217061985.0973798898933; Fri, 10 Jul 2026 14:00:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIFD-0001lh-Pz; Fri, 10 Jul 2026 16:54:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIF7-0001fl-PD for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:42 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEr-0000mz-Ue for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:40 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-848479c9bd5so1110700b3a.3 for ; Fri, 10 Jul 2026 13:54:25 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716864; x=1784321664; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Uywufw6tvUASB9x55Dq0IZwzU/8JaTqzxiT122QYyUo=; b=NQDprAMqGYaDL+LBWGu4tNeMJQYJ27lxgRID9jRHinzm27aYeHwMaCZHb8EbE+WdRY CY05TzFmxrOklF2aBHdtkEJCtNpCcDQbrHD5a/vVmglIacOtVlZ8wuNV1nfTs1QB839R i3B/1GEBvYOUQtZ0HO3BmjFKToLHgMT5XQIzJ3ZB6yqU06TtuDf4xfsKJwSXiqapfMIA lSRJM1iKFDgqVpES7AEX/6bfQpYbVYAyaayy3DSETnWzB6H4FCbwkAuqOI5S0BvS/xs4 XOe5mpgDPgwaMND0/y+vbx9IShWYSAEaVtvz72sVf7r6JYWOHHWL06m9EYOFPnB1n8rf e8OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716864; x=1784321664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Uywufw6tvUASB9x55Dq0IZwzU/8JaTqzxiT122QYyUo=; b=W2REFSghq/zOvAMX9Ot7QVDbP4HiBkCPfp5IwAVAGw61sTLmwDmhZlpr/TBJk3vQ3a CeELj4VqayewX3KQ+weLa+flnLo6tAYmyHpKpCZdL6L10V6TcWCxYSusBVEIz7GcMMhJ Ly//1qREvEfpG22mimaKp+o9gEDzWgHHZ2hihnjtT479kO7eNX2KGgZRpii1+/2BcqIs 54D3yIFEiNNEruNMIdJ3XiBZpWlHIfRL2NzSxQyzxqmKib+y6YHr2q/KSSTiG2vd7XX9 JgdEhQqj8iBfrWFXeA1/qUR+KrubfAP466f9q7MgwQJGQ6ABczHNVS5p0IvIVVFrr884 hkQQ== X-Gm-Message-State: AOJu0Yza3N7gaB4tMwkxeWkcJgopPBbx43kjC/AXE7uYgVDWvWNxf5Yf 1iYnHMCV+ybsUC6S3Xi4lZSEFnxksQKw8SQO1gDr/mcv5KEYPPOAotm/UC81JgPne5zT6J29b4u IUFJL X-Gm-Gg: AfdE7cmT7NGmkT+6arz87KZQ+dlAlEQXS47HEqVekyEFLYHt4GXIVJfso4Y1bye+Bpo fHDTY6aaF9vK6t7z57Pum7j2firla34OHBFY74kUeKtChAGoSS5f0PqS8otZEei42jUz6FC9fcb MHzPQuLMRjZxqE8/Oisx/wVL/ZiXZk3q2EyAbr1UPuPlsqd+8+rU0YzdCJ1ELipU/CdGCHMAg5o TzQT/Os1fRSeIhuMEwfpniCPYiubesBifAoGIabRfxNHRmuZivkynmfpIKzZrtQTTIWfScBWfVJ /Vb107Z78kJPuo9Ytag6ZN3ox9YSX72lBbm5SiAycRbZOhj3nDUKPv6ivjDuwli1hoY54szDeqO zT4cshb2zFy5UQ+iwfw2EFX7d833BKbL9XXqUX1+qXi7Uw+xobwQ/jUYylVFTn+6BToaVD7ql6E NeCYiKyX0QEyhAxGcM8Q== X-Received: by 2002:a05:6a00:22c9:b0:848:5951:ff78 with SMTP id d2e1a72fcca58-848897d2bc7mr497196b3a.36.1783716864532; Fri, 10 Jul 2026 13:54:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 20/51] system: Remove cpu_watchpoint_insert error return path Date: Fri, 10 Jul 2026 13:53:30 -0700 Message-ID: <20260710205401.836304-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717217572158500 Content-Type: text/plain; charset="utf-8" Move the validation of the address range to tcg_insert_breakpoint, which has to deal with gdbstub inputs. Leave assertions behind in cpu_watchpoint_insert, but no error return path. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/tcg-accel-ops.c | 3 +++ system/watchpoint.c | 9 ++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 644c5b04a2..4dee5ea57f 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -143,6 +143,9 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs, = GdbBreakpointType type, case GDB_WATCHPOINT_WRITE: case GDB_WATCHPOINT_READ: case GDB_WATCHPOINT_ACCESS: + if (len =3D=3D 0 || addr + (len - 1) < addr) { + return -EINVAL; + } CPU_FOREACH(cpu) { err =3D cpu_watchpoint_insert(cpu, addr, len, xlat_gdb_type(cpu, type), 0, NULL); diff --git a/system/watchpoint.c b/system/watchpoint.c index ed505da403..01cf0f61a8 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/error-report.h" #include "exec/cputlb.h" #include "exec/target_page.h" #include "exec/breakpoint.h" @@ -33,12 +32,8 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vad= dr len, vaddr last =3D addr + len - 1; vaddr in_page; =20 - /* forbid ranges which are empty or run off the end of the address spa= ce */ - if (len =3D=3D 0 || last < addr) { - error_report("tried to set invalid watchpoint at %" - VADDR_PRIx ", len=3D%" VADDR_PRIu, addr, len); - return -EINVAL; - } + assert(len !=3D 0); + assert(last >=3D addr); =20 wp =3D g_new0(CPUWatchpoint, 1); =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783716974; cv=none; d=zohomail.com; s=zohoarc; b=b9B2RFmlul2QdKYXM9CArDOMO7H6BKz3f6g4eGDrYqObC0M9vPeTk03KfiBHiKWj8nDur2vPicIl5pKW3O10fpb3bODS3mgLphtOoZ85i5tJv6+yBWv14jj+zdaJNtaTiHGf55eBFprfZxpzn1SK+Wo6uTYHc+46uf0GujRuX0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783716974; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=42co0mDh6L6bESb0gXu2fwgy0JNlrBbKeAp5pQJcyYg=; b=gLb64MR8kpc8I0fKkAmJG/MYSJfQ2Fg2cUequ9Ghoe1hGfs2+cI6TXOY8/wSTOKWG/A1bokWjnHloKRxLVBIwPgjw4ZMhPQJU7PmnXukIRTrVcaaFE5/7SKpDOQiRJ1AG8kuRlQRkx3BGs3hd8L3GLietTSsmdnuaGuENR14c+0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178371697449522.19154796500891; Fri, 10 Jul 2026 13:56:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIG9-0002rr-Qg; Fri, 10 Jul 2026 16:55:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFB-0001iI-92 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:45 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEt-0000o3-Hw for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:42 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-8487de17abaso64973b3a.0 for ; Fri, 10 Jul 2026 13:54:27 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716866; x=1784321666; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=42co0mDh6L6bESb0gXu2fwgy0JNlrBbKeAp5pQJcyYg=; b=QYcjrWVsmGNOaZyexlRGPM63edToLwwkGJr689pJYbXCgtBzUecg/JjxbZcPCn21hQ ZUX9tRd2iF3qbn/iVj3TO5Gxc6OgLIJlQV83VWfPSrM8VJ0iHmhBuHWHKhILIxbHGUVL RdUCgeI475FUCQIorEjVtOMgbsU5IAKQzfZV2FB4O8TdaNnJhsf9fewn3krBY00BbNIg KUEZ0YP9V+IBwW0aGVeGzWHWwxeUQq93YciTQh+vi7Y+mY4mcRJ6F5baqj7gCzu4yi5b LdibzRUM4FoALBmmeyCafqOVN/pv7DX8U4jmLH7SYGvHU+cp3vbIynm/VRJn7IbgFa9F jNtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716866; x=1784321666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=42co0mDh6L6bESb0gXu2fwgy0JNlrBbKeAp5pQJcyYg=; b=sPyEa4bgO0UMME4CkjY9uuj6ZRa27ZmVR/jp4FgWw5L6qGGFdmJcC72aTFBYu6KTEE OrZvcBOIHxt+ytZJSdnd0CSlSX9Vh+c5lfec9nyDjnwQnhfSb+bOK6Miw4Dfqkf3Np5Q W0e0wBhizxwPBoQQiOcGtuE3xw3A66dGN3N+SbvOjea/E3Wy2Gq9aatBf6fEqisX6NHG 0X0EnxuwFqenzPEptCgZ/Z/AihhmgqzHpY9+cYxDGgmY760JTMXohcKW1wVHwgq0ham4 x5edNB2opDd808Or7izituSoJBMv3SlMdi/O3FRHi9wnEAxXCdJ6gAzsD862UHabi8j/ M+uQ== X-Gm-Message-State: AOJu0Yys+TTKzHaZPhVjxDe4ZWDoyf0jo0ZUPnCYWRtbaWvpuyIaFBPk IJMkAo8CHE4F20vrrgnkK+ZikT42Sp1o++jHAKz/Dwn1ilPsVXvuu8eYi5IxglEqOIjpCGe1LaC Q8Bo5 X-Gm-Gg: AfdE7cmhcZlNY2jjkmUgkucQYbpPCS+ybQZFovw+B6HhY23mP9m07yOKvG0tHoOnx+f 1IMMlWVk3ZeZ46FEdctneqbcngOziFUBrKBsVS1Nz2O1N86GCt76crEwPGHEccNg53ocxHJ05VW Rd1RZ9pXMdBwHI/U91wHGXCkdlqT3MzsVqeDNmnorTWfFMwd3DsHDWXRibOiGVJi8i1cbokEDLy 77l6WzZ0yBXpTBmT+rUrKC2SnrEQgENN/KW1jeGyU5uMX00fphypNonTtHPOHS6jElvmZsdLx+k 9bt+PMYYk1h5XRLzBDNcpp5ChrgVzVYoqdc1Ca4nNE3Osuyi5BT2KOwRBLqustT+OimWK0r2i7I PSQ1h46XA6zOdnrDMgHKoBEebhqs+LD66QyWzv11ASFoG46s2ie+YTz4A7Jf/eoEv+VMryNIVbI tdbq/NOTeSCmcBA81I6w== X-Received: by 2002:a05:6a00:4109:b0:848:5010:ad63 with SMTP id d2e1a72fcca58-848898317eemr446126b3a.62.1783716865950; Fri, 10 Jul 2026 13:54:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 21/51] exec/breakpoint: Return the new wp from cpu_watchpoint_insert Date: Fri, 10 Jul 2026 13:53:31 -0700 Message-ID: <20260710205401.836304-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783716976494158500 Content-Type: text/plain; charset="utf-8" The cpu_watchpoint_insert function cannot fail, so the error return value isn't actually used. Instead of returning the new watchpoint by reference, return it directly. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/breakpoint.h | 5 ++--- accel/tcg/tcg-accel-ops.c | 9 ++------- accel/tcg/user-exec-stub.c | 7 +++---- system/watchpoint.c | 11 +++-------- target/arm/tcg/debug.c | 4 ++-- target/i386/tcg/system/bpt_helper.c | 20 ++++++++------------ target/ppc/cpu.c | 4 ++-- target/riscv/debug.c | 28 +++++++++------------------- target/s390x/tcg/debug.c | 10 +++++----- target/xtensa/dbg_helper.c | 10 +++------- 10 files changed, 39 insertions(+), 69 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index 95aa4f5933..60fda8dbb7 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -49,9 +49,8 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreak= point *breakpoint); void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); =20 -int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - BreakpointFlags flags, unsigned id, - CPUWatchpoint **watchpoint); +CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, + BreakpointFlags flags, unsigned id); int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags); void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint= ); diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 4dee5ea57f..79289bf7b2 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -131,7 +131,6 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs, = GdbBreakpointType type, vaddr addr, vaddr len) { CPUState *cpu; - int err =3D 0; =20 switch (type) { case GDB_BREAKPOINT_SW: @@ -147,13 +146,9 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs,= GdbBreakpointType type, return -EINVAL; } CPU_FOREACH(cpu) { - err =3D cpu_watchpoint_insert(cpu, addr, len, - xlat_gdb_type(cpu, type), 0, NULL); - if (err) { - break; - } + cpu_watchpoint_insert(cpu, addr, len, xlat_gdb_type(cpu, type)= , 0); } - return err; + return 0; default: return -ENOSYS; } diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c index 42e4861868..bf8b7113b8 100644 --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -21,11 +21,10 @@ void cpu_exec_reset_hold(CPUState *cpu) { } =20 -int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - BreakpointFlags flags, unsigned id, - CPUWatchpoint **watchpoint) +CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, + BreakpointFlags flags, unsigned id) { - return -ENOSYS; + g_assert_not_reached(); } =20 int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, diff --git a/system/watchpoint.c b/system/watchpoint.c index 01cf0f61a8..183b194403 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -24,9 +24,8 @@ #include "hw/core/cpu.h" =20 /* Add a watchpoint. */ -int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, - BreakpointFlags flags, unsigned id, - CPUWatchpoint **watchpoint) +CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, + BreakpointFlags flags, unsigned id) { CPUWatchpoint *wp; vaddr last =3D addr + len - 1; @@ -49,11 +48,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vad= dr len, } else { tlb_flush(cpu); } - - if (watchpoint) { - *watchpoint =3D wp; - } - return 0; + return wp; } =20 /* Remove a specific watchpoint. */ diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 2c73ca1080..e75fd39fb6 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -581,8 +581,8 @@ void hw_watchpoint_update(ARMCPU *cpu, int n) wvr +=3D basstart; } =20 - cpu_watchpoint_insert(CPU(cpu), wvr, len, flags, n, - &env->cpu_watchpoint[n]); + env->cpu_watchpoint[n] =3D cpu_watchpoint_insert(CPU(cpu), wvr, len, + flags, n); } =20 void hw_watchpoint_update_all(ARMCPU *cpu) diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index 23f2d05126..c0c63e3e89 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -57,7 +57,6 @@ static int hw_breakpoint_insert(CPUX86State *env, int ind= ex) CPUState *cs =3D env_cpu(env); target_ulong dr7 =3D env->dr[7]; target_ulong drN =3D env->dr[index]; - int err =3D 0; =20 switch (hw_breakpoint_type(dr7, index)) { case DR7_TYPE_BP_INST: @@ -73,25 +72,22 @@ static int hw_breakpoint_insert(CPUX86State *env, int i= ndex) =20 case DR7_TYPE_DATA_WR: if (hw_breakpoint_enabled(dr7, index)) { - err =3D cpu_watchpoint_insert(cs, drN, - hw_breakpoint_len(dr7, index), - BP_CPU | BP_MEM_WRITE, index, - &env->cpu_watchpoint[index]); + env->cpu_watchpoint[index] =3D + cpu_watchpoint_insert(cs, drN, + hw_breakpoint_len(dr7, index), + BP_CPU | BP_MEM_WRITE, index); } break; =20 case DR7_TYPE_DATA_RW: if (hw_breakpoint_enabled(dr7, index)) { - err =3D cpu_watchpoint_insert(cs, drN, - hw_breakpoint_len(dr7, index), - BP_CPU | BP_MEM_ACCESS, index, - &env->cpu_watchpoint[index]); + env->cpu_watchpoint[index] =3D + cpu_watchpoint_insert(cs, drN, + hw_breakpoint_len(dr7, index), + BP_CPU | BP_MEM_ACCESS, index); } break; } - if (err) { - env->cpu_breakpoint[index] =3D NULL; - } return 0; } =20 diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index a25c8ae2f1..fbd199c08d 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -171,8 +171,8 @@ void ppc_update_daw(CPUPPCState *env, int rid) flags |=3D BP_MEM_WRITE; } =20 - cpu_watchpoint_insert(cs, deaw, len, flags, rid, - &env->dawr_watchpoint[rid]); + env->dawr_watchpoint[rid] =3D + cpu_watchpoint_insert(cs, deaw, len, flags, rid); } =20 void ppc_store_dawr0(CPUPPCState *env, target_ulong val) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index d6bba24c81..6777f1a905 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -481,7 +481,6 @@ static void type2_breakpoint_insert(CPURISCVState *env,= target_ulong index) bool enabled =3D type2_breakpoint_enabled(ctrl); CPUState *cs =3D env_cpu(env); BreakpointFlags flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; - uint32_t size, def_size; =20 if (!enabled) { return; @@ -499,16 +498,12 @@ static void type2_breakpoint_insert(CPURISCVState *en= v, target_ulong index) } =20 if (flags & BP_MEM_ACCESS) { - size =3D type2_breakpoint_size(env, ctrl); - if (size !=3D 0) { - cpu_watchpoint_insert(cs, addr, size, flags, index, - &env->cpu_watchpoint[index]); - } else { - def_size =3D riscv_cpu_mxl(env) =3D=3D MXL_RV64 ? 8 : 4; - - cpu_watchpoint_insert(cs, addr, def_size, flags, index, - &env->cpu_watchpoint[index]); + uint32_t size =3D type2_breakpoint_size(env, ctrl); + if (size =3D=3D 0) { + size =3D riscv_cpu_mxl(env) =3D=3D MXL_RV64 ? 8 : 4; } + env->cpu_watchpoint[index] =3D + cpu_watchpoint_insert(cs, addr, size, flags, index); } } =20 @@ -606,7 +601,6 @@ static void type6_breakpoint_insert(CPURISCVState *env,= target_ulong index) bool enabled =3D type6_breakpoint_enabled(ctrl); CPUState *cs =3D env_cpu(env); BreakpointFlags flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; - uint32_t size; =20 if (!enabled) { return; @@ -625,14 +619,10 @@ static void type6_breakpoint_insert(CPURISCVState *en= v, target_ulong index) } =20 if (flags & BP_MEM_ACCESS) { - size =3D extract32(ctrl, 16, 4); - if (size !=3D 0) { - cpu_watchpoint_insert(cs, addr, size, flags, index, - &env->cpu_watchpoint[index]); - } else { - cpu_watchpoint_insert(cs, addr, 8, flags, index, - &env->cpu_watchpoint[index]); - } + uint32_t size =3D extract32(ctrl, 16, 4) ? : 8; + + env->cpu_watchpoint[index] =3D + cpu_watchpoint_insert(cs, addr, size, flags, index); } } =20 diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index 25968d9a3c..bd30b85ada 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -34,18 +34,18 @@ void s390_cpu_recompute_watchpoints(CPUState *cs) if (env->cregs[10] =3D=3D 0 && env->cregs[11] =3D=3D -1LL) { /* We can't create a watchoint spanning the whole memory range, so split it in two parts. */ - cpu_watchpoint_insert(cs, 0, 1ULL << 63, wp_flags, 0, NULL); - cpu_watchpoint_insert(cs, 1ULL << 63, 1ULL << 63, wp_flags, 0, NUL= L); + cpu_watchpoint_insert(cs, 0, 1ULL << 63, wp_flags, 0); + cpu_watchpoint_insert(cs, 1ULL << 63, 1ULL << 63, wp_flags, 0); } else if (env->cregs[10] > env->cregs[11]) { /* The address range loops, create two watchpoints. */ cpu_watchpoint_insert(cs, env->cregs[10], -env->cregs[10], - wp_flags, 0, NULL); - cpu_watchpoint_insert(cs, 0, env->cregs[11] + 1, wp_flags, 0, NULL= ); + wp_flags, 0); + cpu_watchpoint_insert(cs, 0, env->cregs[11] + 1, wp_flags, 0); } else { /* Default case, create a single watchpoint. */ cpu_watchpoint_insert(cs, env->cregs[10], env->cregs[11] - env->cregs[10] + 1, - wp_flags, 0, NULL); + wp_flags, 0); } } =20 diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c index 9df0c519b3..ae3791ac23 100644 --- a/target/xtensa/dbg_helper.c +++ b/target/xtensa/dbg_helper.c @@ -97,13 +97,9 @@ static void set_dbreak(CPUXtensaState *env, unsigned i, = uint32_t dbreaka, /* cut mask after the first zero bit */ mask =3D 0xffffffff << (32 - clo32(mask)); } - if (cpu_watchpoint_insert(cs, dbreaka & mask, ~mask + 1, - flags, i, &env->cpu_watchpoint[i])) { - env->cpu_watchpoint[i] =3D NULL; - qemu_log_mask(LOG_GUEST_ERROR, - "Failed to set data breakpoint at 0x%08x/%d\n", - dbreaka & mask, ~mask + 1); - } + + env->cpu_watchpoint[i] =3D + cpu_watchpoint_insert(cs, dbreaka & mask, ~mask + 1, flags, i); } =20 void HELPER(wsr_dbreaka)(CPUXtensaState *env, uint32_t i, uint32_t v) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717284; cv=none; d=zohomail.com; s=zohoarc; b=cWDr3hoDMu+k1PKxpqfubp3oujysittHqSveyHAzJn7MM2vZWA7/Xy1JzMf11NlvvIYFtV04UA9pKWMWt06G4yM/CoLTr5UZkBeO2Cq8rxK5YRFhqUqDOAurXBqVMvbs23wyOTx4Lc/BEzIel3bIpKmKYV1TSIRrrHcHpKA861I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717284; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FgdeNV+kSDtwWzzSUG7k6o21nzzJqi9iKyuHEyE17qI=; b=MI79pIZLl9+H+fTTOtHWnxrz0nzdcMCs2rCKKUesvTaBDig/5OYuVpOJKZHLWGvW1vh0rA1zsWCR4Pyl86H6z8FhWO9oCqoL19wo0yG4rPwi616p7woJ2HBN3j+ohwamNlb1K3FgdM7ljxRpDLYmfRD5hCrgreEqfawZHi25a2U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717284332939.3262953761409; Fri, 10 Jul 2026 14:01:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIGj-0004FM-23; Fri, 10 Jul 2026 16:56:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFL-0001wx-8L for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:55 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF4-0000oa-Bi for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:54 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-8484a0b998fso2000788b3a.2 for ; Fri, 10 Jul 2026 13:54:27 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716867; x=1784321667; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FgdeNV+kSDtwWzzSUG7k6o21nzzJqi9iKyuHEyE17qI=; b=wsQ5gUMkRhKZrcAVRFyM8sA0bqo/bh0We/ypT2qhV7AJsu2bjgkqek/92kC6ZWOtCz uaDgOxdeRXVUKnhLwFRNFYNO8JQr9FLJs53bouWZR9d8WSE9jUbMURkmpCVvei5whd3l lAdO4YFqOyyvrhGKYTW/5spAZyFp+sDepkH+LU36JsqCJeZn9QLgiERzNbdXA4JmUAA0 fFJJdPtqj5LeUctC03bKC5m8BG9aZxTfdylycKMmUk8BX5wac8JmtZBdTDHsUR6DRUD+ fhNh620W3BEAqZBriqjoenzDszHDMCFhyo/7gNMI6CpwcGHEIm78JSSTliv0YuLfl2N6 uRBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716867; x=1784321667; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=FgdeNV+kSDtwWzzSUG7k6o21nzzJqi9iKyuHEyE17qI=; b=Rn9TXPN8mIqjLLIkELWZaTWuNcsJS8HHQ1JjlvjRW6zrVZ82r1Wb/4IZ0FqC73Os23 F1ka6QxMwGaLhTOwaD0TnmXYHD0xcJSZ2escgXTor1OT/rAudVWXmPnKlnR+KECr62wP 6I2BEgK9hSIX8RAjSMKTk1KCQLJj9gLRsjw6alvLQoovEBRGu8VdUvlftBWRWGYcZ1mt yAlOrZh4z8Sltso0/XcmAcIgFpi4UlyeLOg6zJuEuMCrhFZ5PSjrJXfdV1Ecfo2Tnkky NQdQNMkg++ZSKwkghY8Xvf7oAru1DxCJCxNX0RJ3KixluBMI7+V6JnlM7iT7Fg8HFvol 7H5g== X-Gm-Message-State: AOJu0Yy0zAZ7KWVRkGj4abUit1nXkUAT4l8zNi9d7ByhJ+IDolKPPS72 OPHMRea+WN8ycRfizeg48jEKw9PHZnnaBdg0QTLCYdT9nZDghNSdciykfrgBkbXNc+fbY6AhUGI G01Bx X-Gm-Gg: AfdE7clJGjwnpQ4K5c1C6nHaxyuxGHfTOIdzF8azamUmQGrbbAEkEhMS9ghDtEaApY+ o3e7CRv6CO7K3b8tGQkLdMpAVHBGakTfcyZsBoUr9jgN2N0k95C1gV/6LTLhMENUVj7MiWIuojh OaTkpTfXXK5ycMR6oIzi07VENrkS0uOmkTaBzPwa7jeiQja++7gMPLcLRXoUZjgY6AOdh4Tk8W1 0LpkH4PsCJ/J3LJKq3veG4dfIL4/m8O15VH/eqYqtpR3DiLnmyZx2wzy1HAU+Bk/QDy62lJWtVF iCqnl9pUixk4FDbSBB9k8QJXhv9wta+b1HjDw2g0IXqH+N++iAl0KySZMs8oEJ7g8xum5UAYLKp loHlz31XeeAxDGlb05p/qWZUVPXTwoQ9NKqi4WnKiqou7fNF9PYTd6fVMeyp9PM7VxtK3JTX8YL yfYlZZJSaVPeRA9PAaKw== X-Received: by 2002:a05:6a00:98c:b0:845:e432:e93 with SMTP id d2e1a72fcca58-8488970af5bmr490069b3a.48.1783716866766; Fri, 10 Jul 2026 13:54:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 22/51] system: Validate flags in cpu_watchpoint_insert Date: Fri, 10 Jul 2026 13:53:32 -0700 Message-ID: <20260710205401.836304-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717286101158500 Content-Type: text/plain; charset="utf-8" Flags must watch reads, writes, or both. Flags must specify GDB or CPU but not both. Flags must not contain extraneous bits. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- system/watchpoint.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/watchpoint.c b/system/watchpoint.c index 183b194403..fbaebba7cf 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -33,6 +33,9 @@ CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr= addr, vaddr len, =20 assert(len !=3D 0); assert(last >=3D addr); + assert(flags & BP_MEM_ACCESS); + assert(ctpop32(flags & BP_ANY) =3D=3D 1); + assert(!(flags & ~(BP_ANY | BP_MEM_ACCESS | BP_STOP_BEFORE_ACCESS))); =20 wp =3D g_new0(CPUWatchpoint, 1); =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717352; cv=none; d=zohomail.com; s=zohoarc; b=h2DuMyiCLn9kAMonaaCtaSqdBn7IfsKpwyWOm5KgGZIlH4PsTXEZELE3/l0nByhDlrQVhWVXKqr+Ate0D82qyoaKIg81oXmeYuXlc1eHzk+2QPUC8YFcj3WDpV/SMFhUIVWFhx9uLARGaw6sjMBaV5tm/RQVLysAC2Y16joCqY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717352; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YQ0VkN+fXYkTd5pIzgNSNc34KFa66jXvc0dQc3T9c/U=; b=ZvInS1GykB19i0t/8A2CcN2GHXGwXfgzWBZqgSonwauzyIq7gwOKLBhriZIUyycaczRJ9zzSeo08ZPsbG/uiJLbcyQwNVLivHP72eJBXyhEJ1Q5p9UA20QVlGxWbajBUucexMz6csJLI/+zR2rfxjITqGNyfN1cWUbW7y7s//2Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717352888331.0923066548311; Fri, 10 Jul 2026 14:02:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIFY-0002KJ-Tg; Fri, 10 Jul 2026 16:55:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFB-0001iK-8B for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:45 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEv-0000pD-0K for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:43 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-848882fdb18so343456b3a.0 for ; Fri, 10 Jul 2026 13:54:28 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716868; x=1784321668; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=YQ0VkN+fXYkTd5pIzgNSNc34KFa66jXvc0dQc3T9c/U=; b=KgqfIWcbqIF700zUYkkmZ/bLYp3zfRy7TLSMgfSHIWNF07E8sN9CANMyoEIcL45MPh dFLbqiFj0wXk1jrfRw7ixN6rFz60YVY2TkOFOVa2o8oanbfdEvMTPUV+2ZmWDG3+YoHL 0b/iNXCkRcDUMB1rzIZqphJBw8ZUFX1+i5BjGVj3Gau3hqXY5uF53bip/L0bv4+ttWlS PhCi5Az9j3XbeV014lbfljeoQdyhIwx+DmjeieR1gdECsKtLRyFPr4lNVqX1d+rZVnyI D6EOHlG6XJvJ5uoVqm5lzDuzgkFCK0IJH5cylDpa+I9P1zYFFfH4lOghUBKpUiOPqdFp wePQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716868; x=1784321668; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=YQ0VkN+fXYkTd5pIzgNSNc34KFa66jXvc0dQc3T9c/U=; b=Ko/e2RI+nW3uUatF9MLi/y6Hrg2LGtuvWFAjstvcX35c0XNHVtlkSIq/VCeh4SGq6q pc634c9bKJ4fQh8fqYEK565dVKiY3QNTMxNAI/9dVDO5hMiPA754dbPZbIbLzoIDfEMx BQ36MDzW+tYc75hfvoUiHc4c0XRzSDG3aJIN1l4kEQbZUIwmtx7dKhqT/TZhaTunnwYi xgXwEuuOhIMkkSgv8DsPIdNVJRX9V6uH8EYFEt19lvDeRZfPiwyOb51uurloTn0ro/wK D9U5niX2CfwnJ9F9QPYqERyHo/VYeRah6GFHX8KLtb83j46sH789GZmt7HkgfHS8aX6B HXrw== X-Gm-Message-State: AOJu0YwZDQo9oG7vYm71nzTrlsb6LoAxhMHMdj6ifl2pmpmwewFOLRIr uht3c1EnISDPfAgDYUJtbOhezzc2WLrBaKrdeblMgC0jEKfyAlxo73yyB9Axb66bz2faKTN5Ksv jhQXB X-Gm-Gg: AfdE7cmv2hNg0wrIWiEPdF9cs/xZWzFi2ywN0gwwVvGxb2EUIwzfD284rgTARXI+LEy VZvppPCXkBaQVJODtCoOHt4Nuj3KVaKyKJIDuT3ovZ+z2Q14hxENZqdm7oU8tN+1lZ/kW6xbvKb xhsCgX2FJfdZHNUZRghWd4RtsIYWSTHU2DoKBtBGpfmIJQNi8GyOkhiOVHUvdA/nEXB9OJh3c46 E72JP/fJm4KQKEZ8TXlIFIdHompk9f/mjkYyixF9L9KWdor91kvpPEzlskiU0GsbU7cdP0w/dSE 7dVNEHjjvqMxpdbocJ8623mTc30VYnuWXKhVNj57pP+5KIEmqMWSTpIxiaBthghyeFzcqdUMXMC FhUw+1LLoH0EEbPK+gF00W2SdcHGTiJg25mFUULEr7IrukrlcwG/sn4wV6jT0z71ncrk62RQFjx E7+OgblLwuphzgZiHbeQ== X-Received: by 2002:a05:6a00:6c9a:b0:848:2f84:f42d with SMTP id d2e1a72fcca58-84889792beemr481182b3a.70.1783716867603; Fri, 10 Jul 2026 13:54:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 23/51] cpu-common: Validate flags in cpu_breakpoint_insert Date: Fri, 10 Jul 2026 13:53:33 -0700 Message-ID: <20260710205401.836304-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717354534158500 Content-Type: text/plain; charset="utf-8" Flags must specify GDB or CPU but not both. Flags must not contain extraneous bits. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- cpu-common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpu-common.c b/cpu-common.c index fcc9bc77a3..80a4a191f4 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -410,6 +410,9 @@ CPUBreakpoint *cpu_breakpoint_insert(CPUState *cpu, vad= dr pc, { CPUBreakpoint *bp; =20 + assert(!(flags & ~BP_ANY)); + assert(ctpop32(flags) =3D=3D 1); + if (cpu->cc->gdb_adjust_breakpoint) { pc =3D cpu->cc->gdb_adjust_breakpoint(cpu, pc); } --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717379; cv=none; d=zohomail.com; s=zohoarc; b=R2iyI84bpn7lAcjA+/wxuQYV+FuomnaqEyaKUA9G9fKzBskC1GB3I9aKzW3w9yk7nLtXTGJ/jzCHJ3lCFVM+bvIcfz6NZf+IBgMLilLnxC1/PUjHDDGpoG53dh/kpDVddU2qqL9gIYRwywcmUB9FLFj9s/f4Ln34hxNN20mOeyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717379; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oTQ42LKlvaXUmLWp84DyN7oebX42kH2GrCSdO42BkNs=; b=GEeAv4h6KZeQhw22bJE/Gpj6f95HyQXtU++7NjBO8vD4o5F6NhqcfhyBtnVPO+bwjtxzOOAmn0cYEH0nh+QtrxR/yADs7YaSrwzaaIikVok493/08sfwtontzoXavoc4uQxrfbJi2gANTncKMxTYGOyid4KtUJtIeEKQSsROkGg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717379864281.42364648665114; Fri, 10 Jul 2026 14:02:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIGY-0003mf-AM; Fri, 10 Jul 2026 16:56:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFC-0001kD-6x for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:46 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEw-0000rR-Jg for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:45 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-8454160043aso1457389b3a.3 for ; Fri, 10 Jul 2026 13:54:29 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716869; x=1784321669; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=oTQ42LKlvaXUmLWp84DyN7oebX42kH2GrCSdO42BkNs=; b=nPlyKx4uzAOKw2uirf/xZ9exHJsp3oN3YTEYePgVhZPpFLWok0T6nbuE5nkc2Y/m7Q 6D+T+7cEnfIIJbwJAPvd90UDRCj54XlGvC4QSspveQM9k7d3cx0jVjijGx1Tg6hXTjSd 2a0p+IrIvUa15CCbzxYxCXfDRJH60ktXGutwZuYpnnhGu8M8aWHLenBfSNX+XK1oIeDH uvY9sTff79AD5jJ2RCGBywSTeZ+P2ISPd5cWMISZFZnt8FM+p3FYMKau7LY8HFwI0tWh 0Xttku3klGSHY2+/ErBEHQ4gv+HtLsiv7zD2HtK8yxZaKQvPVBic7E/Ba8Fv+DEzGcHf tuDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716869; x=1784321669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=oTQ42LKlvaXUmLWp84DyN7oebX42kH2GrCSdO42BkNs=; b=NcNN6FViDhpfLWF2nV8FlHHuvlXiy+TG3Ts8EYjoFwpILQYh5uWTal1sDtAi01QFI6 qyTSrz4pyvKPYOeEDXAAqYWtoyxMiS2KRoIHH0c8wLO3AGgUi5uGw2uYBLcX1p7GJcDk A1nQr5yU7SU83BVgjh5E0XWBcFn0TsHL1LjfR0dC3xAJDx/xDMf4WuETZJWmDBjF+god gSqhJfn9LRdr77kUc8pGucMg4gnUQOly6xFcZhv61FH2R0aiOMvbeieSjhdCaxjtpZ15 qMjkvRee1jdhIg3X/oMPL9/o1CALp5thTIewttPeoe53BSuRUXbaHCz+RR276RBy0tIC AVYg== X-Gm-Message-State: AOJu0YzIhp52hLLmUtMIrodzQFSz+NX9rlz+2YbtbduSkcgppUHPBUhI IGDOa9g8+3taYr20ZojFwC1gHrL5Usm+dCbHRJMPeLCI2uHXBf3C26ZjRRuxlptPug6m3AXY3GA gITN8 X-Gm-Gg: AfdE7cnXGadpIkQvXuoWwJaPCDDfe+1AbMfZ64UIAe2Hm1rxVh/CLHCYe7yX2YNMrSK 31BjGUdEDiZOSfJ8EklIVknd+tL1XHRpIHRQ8V4cMvtJO26JSN8FufkT9S7CYXlMzp6j8xK9U1j xsgH7q36Xa8rzZYwSXpAmr8rk7O1N5fV8uMhf8UL1UEUmr2PGkkiX0GI/bK9nHhw4WaY6TduZNr VxAaRkbXGzOoE6tAjfcLQllRjEGhuSTQz0ZAply1S4ZRS+/9w8QulPRnIqynLoVYNCMIAqxNYmj 42+mGV2w9GofR7rcqal4rGSZFR8Y0amOfLapEPw9AEqMJJ5Z3O9clfAfnK1dKrp5ZIZLIsqEXJ7 WLEvcqI0N2iMmXD7mjtcQhloxRuvE0Gb0WFZ0Q6INNxD/iqGKG5dRHdPaYLp0JIAi/bqkKC1xys s3lxgkCnbh0XoD55wSUw== X-Received: by 2002:a05:6a00:f89:b0:848:3e74:85eb with SMTP id d2e1a72fcca58-84889611e4fmr542804b3a.1.1783716868959; Fri, 10 Jul 2026 13:54:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 24/51] exec/breakpoint: Add CPUWatchpoint.hitlast Date: Fri, 10 Jul 2026 13:53:34 -0700 Message-ID: <20260710205401.836304-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717380803158500 Content-Type: text/plain; charset="utf-8" Allow the debug_check_watchpoint callback to see the entire range that triggered the query. Signed-off-by: Richard Henderson --- include/exec/breakpoint.h | 1 + accel/tcg/watchpoint.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index 60fda8dbb7..fe6dd02bdf 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -37,6 +37,7 @@ struct CPUBreakpoint { struct CPUWatchpoint { IntervalTreeNode itree; vaddr hitaddr; + vaddr hitlast; MemTxAttrs hitattrs; BreakpointFlags flags; unsigned id; diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index a7ce5fa9dd..edd1d5708b 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -89,6 +89,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vadd= r len, wp->flags &=3D ~BP_WATCHPOINT_HIT; wp->flags |=3D flags << BP_HIT_SHIFT; wp->hitaddr =3D MAX(addr, wp->itree.start); + wp->hitlast =3D MIN(last, wp->itree.last); wp->hitattrs =3D attrs; =20 found_wp =3D wp; @@ -109,6 +110,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, va= ddr len, wp->flags &=3D ~BP_WATCHPOINT_HIT; wp->flags |=3D flags << BP_HIT_SHIFT; wp->hitaddr =3D MAX(addr, wp->itree.start); + wp->hitlast =3D MIN(last, wp->itree.last); wp->hitattrs =3D attrs; =20 if (tcg_ops->debug_check_watchpoint --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717403; cv=none; d=zohomail.com; s=zohoarc; b=npzIxTDGgolg+rWgSpzoXIo3o3aa+FjaBPD+ouvS2A6yKLgUDgkqn4l6HGIALIHL7/qVOgAWABlEd+EVbnSj6bNaAgQmXXMT95C272RrsN32GvOppS4hLDP2TE8Ff7iDJHt3F5h2EzoDGU6tlYta0pgUNFPLwWuq1DC6vREHBL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717403; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UDGpOdZ6GdN/8EqvNC20wChll1UX5UfZiUxtmOMrgDk=; b=QDmSPDmi7GTI1J5oox4nSZjf+jcP4N+qUNmc6u+MijoTdue9ieFYh19/Qh0Ve2HxeyI5BJVcrmk8eV3wRmDiY9vM9cSyW9ge1m3hU26axZkKrAbr4gKONqnXaQEOJEGqLaWT5NfQDMR+7a0v4gb9umiV5RQUtLAC+fUIRIS1g9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178371740381896.15901248740681; Fri, 10 Jul 2026 14:03:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIGZ-0003rS-9A; Fri, 10 Jul 2026 16:56:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFE-0001mj-PV for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:48 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEx-0000t6-JB for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:48 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-8487b7b4066so999501b3a.1 for ; Fri, 10 Jul 2026 13:54:31 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716870; x=1784321670; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=UDGpOdZ6GdN/8EqvNC20wChll1UX5UfZiUxtmOMrgDk=; b=MvlW9wWMAqWYzW0ZgPcovvfmjuNHqYV6Z2iyW1SHeDpqpCuyWWsU+/hdSSE4WKchTx Wyn+U4Zgvn9IM8p8UVqvwvPshpVc4XKsuOnihs+C5DzNMT6NOZdKcP0GbwAyu0ucP1ei vqzauRGrdytZjhx9kzcLAFSJb+SW/Jvk3n0n6qM3da9Syy8pDJ409CdjDY4HpawJqcAq TFRrZn5AMgVy+ybcHseYXYQLUxvccamSRa56EM3tH9XVBF5ioer4aHM/TN9Tb0wps7Dk N0aqAMkydBIRNvKm+evtmA1S6ZLu/V8biggNHYxqS8e1ymE4vLJYEKou7vh1SLUAWaxi tp5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716870; x=1784321670; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=UDGpOdZ6GdN/8EqvNC20wChll1UX5UfZiUxtmOMrgDk=; b=TOkzQ2tSYxUR6ciVXYG3gNZYOiB8mQZVwPaaf7Y99BssB9N4GpS1ai2izf3apP88Sq 0awGpyobrX95vPjRwUG2L3JdfjOuac8mZm74xXfzaggrCfE9zvO7A1pfGqljWvzjIMLu Qfm8JTSq2b5RrU1mMGkJrNQu/aY7erel7mjmo5OltbUX1TfSgi7LmfFKbIkBrhdsvJtL OebbVg20uBm45/XcwRpAEYT4rMj/lUAdHWtGfV8cA0vp8DYXZRDCpk0zYO6W939SxcTD S1wVndXFoRbklFM9BZ6Fl5x5fazCHD/OM2BWfrXmqkOFWbkzxH4NpWQKspVOY0HC0HLi YNIg== X-Gm-Message-State: AOJu0YwqhdYjD7kkDXxBhytYc+hudciqdNapkv4Gludbyd1fA64Bgwb1 w3Aaofo71UmZXQpzDETa9zE1KDLE7645F5a5b/QkixK/ZvYVUNWbohAj9ckzrlI+HRrNWHl9v7j twGRI X-Gm-Gg: AfdE7clPW+A62imv2M68HuYdyTt0NfUzkpUdL6Q8vbmQcO/czeoIph0WB8nxOwwk2bM BWqL1FegIvC9DccweLTVPfaNoQlaeuWvvmpcpVL5vkH8csZy0GMqYSU3zLcW+JHxPq5T//Qup3X lEv0VGNt307Sxq2IXGLHBf8MG0uR2ig7fB2CLZ2hoF5xhE6oqR84hSzv/KI3L1BmsiQKIXfGU/a fsc9efPg9vwInO8Tdzo4QVJ/OTHh4C4+ZXlZmaE1cUVfY9sP4PpDkQ8khfJ9l+Nc628myE7+9QV 0Bp1PPoEDGORL7kSEgmM3XeAsd0cyJT8K7nWiGnGkuwiPwwj04cak2G0h3GbniWMMjMAvk4uucX X4iZwuBMupxQFwZktfmth3/ApzOY311xDoJqPz7OYzGvgTnNobX1Vy0Cv+ywFK+m1Zj17B/3SYR N+LpW9aG7w6XiVpBruSA== X-Received: by 2002:a05:6a00:408f:b0:848:51b3:f3af with SMTP id d2e1a72fcca58-848896dd4dcmr476718b3a.36.1783716869975; Fri, 10 Jul 2026 13:54:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 25/51] exec/breakpoint: Merge CPUBreakpoint and CPUWatchpoint Date: Fri, 10 Jul 2026 13:53:35 -0700 Message-ID: <20260710205401.836304-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717405084158500 Content-Type: text/plain; charset="utf-8" Drop the CPUBreakpoint structure and rename CPUWatchpoint to CPUBreakpoint. Mechanical change to adjust all uses. Signed-off-by: Richard Henderson --- include/accel/tcg/cpu-ops.h | 2 +- include/exec/breakpoint.h | 10 ++-------- include/hw/core/cpu.h | 2 +- include/qemu/typedefs.h | 1 - target/arm/cpu.h | 2 +- target/arm/internals.h | 8 ++++---- target/i386/cpu.h | 2 +- target/ppc/cpu.h | 2 +- target/ppc/internal.h | 2 +- target/riscv/cpu.h | 2 +- target/riscv/debug.h | 2 +- target/xtensa/cpu.h | 2 +- accel/tcg/cpu-exec.c | 2 +- accel/tcg/user-exec-stub.c | 4 ++-- accel/tcg/watchpoint.c | 8 ++++---- system/watchpoint.c | 12 ++++++------ target/arm/hvf/hvf.c | 2 +- target/arm/hyp_gdbstub.c | 2 +- target/arm/kvm.c | 2 +- target/arm/tcg/debug.c | 4 ++-- target/i386/kvm/kvm.c | 2 +- target/ppc/kvm.c | 2 +- target/ppc/tcg-excp_helper.c | 2 +- target/riscv/debug.c | 4 ++-- target/s390x/kvm/kvm.c | 2 +- target/s390x/tcg/debug.c | 2 +- 26 files changed, 40 insertions(+), 47 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 3988bef520..2dde42cf29 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -258,7 +258,7 @@ struct TCGCPUOps { * @debug_check_watchpoint: return true if the architectural * watchpoint whose address has matched should really fire. */ - bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp); + bool (*debug_check_watchpoint)(CPUState *cpu, CPUBreakpoint *wp); =20 /** * @debug_check_breakpoint: return true if the architectural diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index fe6dd02bdf..e9b77081e7 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -29,12 +29,6 @@ typedef uint32_t BreakpointFlags; #define BP_WATCHPOINT_HIT (BP_MEM_ACCESS << BP_HIT_SHIFT) =20 struct CPUBreakpoint { - IntervalTreeNode itree; /* start =3D=3D last =3D=3D pc */ - BreakpointFlags flags; - unsigned id; -}; - -struct CPUWatchpoint { IntervalTreeNode itree; vaddr hitaddr; vaddr hitlast; @@ -50,11 +44,11 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBre= akpoint *breakpoint); void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); =20 -CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, +CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags, unsigned id); int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags); -void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint= ); +void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *watchpoint= ); void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointFlags mask); =20 #endif diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 7e19ea418d..3986e43f84 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -526,7 +526,7 @@ struct CPUState { /* ice debug support */ IntervalTreeRoot breakpoints; IntervalTreeRoot watchpoints; - CPUWatchpoint *watchpoint_hit; + CPUBreakpoint *watchpoint_hit; =20 void *opaque; =20 diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 919fe8ebff..4c69bf7760 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -43,7 +43,6 @@ typedef struct CPUBreakpoint CPUBreakpoint; typedef struct CPUPluginState CPUPluginState; typedef struct CPUState CPUState; typedef struct CPUTLBEntryFull CPUTLBEntryFull; -typedef struct CPUWatchpoint CPUWatchpoint; typedef struct DeviceState DeviceState; typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot; typedef struct DisasContextBase DisasContextBase; diff --git a/target/arm/cpu.h b/target/arm/cpu.h index f0b4599d7a..8f2e707d2f 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -755,7 +755,7 @@ typedef struct CPUArchState { } za_state; =20 CPUBreakpoint *cpu_breakpoint[16]; - CPUWatchpoint *cpu_watchpoint[16]; + CPUBreakpoint *cpu_watchpoint[16]; =20 /* Optional fault info across tlb lookup. */ ARMMMUFaultInfo *tlb_fi; diff --git a/target/arm/internals.h b/target/arm/internals.h index 95f32ad308..9d022245a2 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -692,7 +692,7 @@ void hw_breakpoint_update_all(ARMCPU *cpu); bool arm_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); =20 /* Callback function for checking if a watchpoint should trigger. */ -bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); +bool arm_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp); =20 /* Adjust addresses (in BE32 mode) before testing against watchpoint * addresses. @@ -1953,13 +1953,13 @@ typedef struct { /* * The watchpoint registers can cover more area than the requested * watchpoint so we need to store the additional information - * somewhere. We also need to supply a CPUWatchpoint to the GDB stub + * somewhere. We also need to supply a CPUBreakpoint to the GDB stub * when the watchpoint is hit. */ typedef struct { uint64_t wcr; uint64_t wvr; - CPUWatchpoint details; + CPUBreakpoint details; } HWWatchpoint; =20 /* Maximum and current break/watch point counts */ @@ -1975,7 +1975,7 @@ bool find_hw_breakpoint(CPUState *cpu, vaddr pc); int insert_hw_breakpoint(vaddr pc); int delete_hw_breakpoint(vaddr pc); =20 -CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr); +CPUBreakpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr); int insert_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType = type); int delete_gdbstub_hw_watchpoint(vaddr addr, vaddr len, GdbBreakpointType = type); =20 diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 9dbfa7c9b9..efff7b97f7 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2186,7 +2186,7 @@ typedef struct CPUArchState { target_ulong dr[8]; /* debug registers; note dr4 and dr5 are unused */ union { CPUBreakpoint *cpu_breakpoint[4]; - CPUWatchpoint *cpu_watchpoint[4]; + CPUBreakpoint *cpu_watchpoint[4]; }; /* break/watchpoints for dr[0..3] */ int old_exception; /* exception in flight */ =20 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index bda8ad16ad..44018be684 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1321,7 +1321,7 @@ struct CPUArchState { #if defined(TARGET_PPC64) ppc_slb_t slb[MAX_SLB_ENTRIES]; /* PowerPC 64 SLB area */ CPUBreakpoint *ciabr_breakpoint; - CPUWatchpoint *dawr_watchpoint[2]; + CPUBreakpoint *dawr_watchpoint[2]; #endif target_ulong sr[32]; /* segment registers */ uint32_t nb_BATs; /* number of BATs */ diff --git a/target/ppc/internal.h b/target/ppc/internal.h index ec057afa92..80f4195378 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -305,7 +305,7 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr= physaddr, MemTxResult response, uintptr_t retaddr= ); void ppc_cpu_debug_excp_handler(CPUState *cs); bool ppc_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); -bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); +bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp); =20 G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason); void powerpc_excp(PowerPCCPU *cpu, int excp); diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 9cd38d10a3..a48bf61576 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -492,7 +492,7 @@ struct CPUArchState { uint64_t *tdata2; uint64_t *tdata3; CPUBreakpoint **cpu_breakpoint; - CPUWatchpoint **cpu_watchpoint; + CPUBreakpoint **cpu_watchpoint; QEMUTimer **itrigger_timer; int64_t last_icount; bool itrigger_enabled; diff --git a/target/riscv/debug.h b/target/riscv/debug.h index 8eb9eccd4c..f5234ff763 100644 --- a/target/riscv/debug.h +++ b/target/riscv/debug.h @@ -145,7 +145,7 @@ target_ulong tinfo_csr_read(CPURISCVState *env); =20 void riscv_cpu_debug_excp_handler(CPUState *cs); bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); -bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp); +bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp); =20 void riscv_trigger_realize(CPURISCVState *env); void riscv_trigger_unrealize(CPURISCVState *env); diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 590371c4dc..c256ab3cc8 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -545,7 +545,7 @@ struct CPUArchState { unsigned static_vectors; =20 /* Watchpoints for DBREAK registers */ - CPUWatchpoint *cpu_watchpoint[MAX_NDBREAK]; + CPUBreakpoint *cpu_watchpoint[MAX_NDBREAK]; /* Breakpoints for IBREAK registers */ CPUBreakpoint *cpu_breakpoint[MAX_NIBREAK]; }; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index ab299387e3..86ce902c34 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -686,7 +686,7 @@ static inline void cpu_handle_debug_exception(CPUState = *cpu) =20 for (n =3D interval_tree_iter_first(&cpu->watchpoints, 0, -1); n; n =3D interval_tree_iter_next(n, 0, -1)) { - CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); if (wp !=3D cpu->watchpoint_hit) { wp->flags &=3D ~BP_WATCHPOINT_HIT; } diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c index bf8b7113b8..c45e31e2fa 100644 --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -21,7 +21,7 @@ void cpu_exec_reset_hold(CPUState *cpu) { } =20 -CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, +CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags, unsigned id) { g_assert_not_reached(); @@ -33,7 +33,7 @@ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, return -ENOSYS; } =20 -void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *wp) +void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *wp) { } =20 diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index edd1d5708b..bf4c46c393 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -40,7 +40,7 @@ BreakpointFlags cpu_watchpoint_address_matches(CPUState *= cpu, =20 for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, last); n; n =3D interval_tree_iter_next(n, addr, last)) { - CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); ret |=3D wp->flags; } return ret; @@ -52,7 +52,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vadd= r len, { vaddr last =3D addr + len - 1; IntervalTreeNode *n; - CPUWatchpoint *found_wp =3D NULL; + CPUBreakpoint *found_wp =3D NULL; bool have_cpu_wp =3D false; =20 assert(tcg_enabled()); @@ -78,7 +78,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vadd= r len, =20 for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, last); n; n =3D interval_tree_iter_next(n, addr, last)) { - CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); =20 if (wp->flags & flags) { /* @@ -104,7 +104,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, va= ddr len, =20 for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, last)= ; n; n =3D interval_tree_iter_next(n, addr, last)) { - CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); =20 if ((wp->flags & BP_CPU) && (wp->flags & flags)) { wp->flags &=3D ~BP_WATCHPOINT_HIT; diff --git a/system/watchpoint.c b/system/watchpoint.c index fbaebba7cf..35cb3bdaec 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -24,10 +24,10 @@ #include "hw/core/cpu.h" =20 /* Add a watchpoint. */ -CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, +CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags, unsigned id) { - CPUWatchpoint *wp; + CPUBreakpoint *wp; vaddr last =3D addr + len - 1; vaddr in_page; =20 @@ -37,7 +37,7 @@ CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr= addr, vaddr len, assert(ctpop32(flags & BP_ANY) =3D=3D 1); assert(!(flags & ~(BP_ANY | BP_MEM_ACCESS | BP_STOP_BEFORE_ACCESS))); =20 - wp =3D g_new0(CPUWatchpoint, 1); + wp =3D g_new0(CPUBreakpoint, 1); =20 wp->itree.start =3D addr; wp->itree.last =3D last; @@ -63,7 +63,7 @@ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vadd= r len, =20 for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, addr); n; n =3D interval_tree_iter_next(n, addr, addr)) { - CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); =20 if (addr =3D=3D wp->itree.start && last =3D=3D wp->itree.last && @@ -76,7 +76,7 @@ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vadd= r len, } =20 /* Remove a specific watchpoint by reference. */ -void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint) +void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *watchpoint) { interval_tree_remove(&watchpoint->itree, &cpu->watchpoints); tlb_flush_page(cpu, watchpoint->itree.start); @@ -89,7 +89,7 @@ void cpu_watchpoint_remove_all(CPUState *cpu, BreakpointF= lags mask) IntervalTreeNode *n =3D interval_tree_iter_first(&cpu->watchpoints, 0,= -1); =20 while (n) { - CPUWatchpoint *wp =3D container_of(n, CPUWatchpoint, itree); + CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); =20 n =3D interval_tree_iter_next(n, 0, -1); if (wp->flags & mask) { diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 70edb2f219..32e5f43ee3 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2370,7 +2370,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) =20 cpu_synchronize_state(cpu); =20 - CPUWatchpoint *wp =3D + CPUBreakpoint *wp =3D find_hw_watchpoint(cpu, excp->virtual_address); if (!wp) { error_report("EXCP_DEBUG but unknown hw watchpoint"); diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c index 8dd1fbd440..7f053c5b0e 100644 --- a/target/arm/hyp_gdbstub.c +++ b/target/arm/hyp_gdbstub.c @@ -240,7 +240,7 @@ bool find_hw_breakpoint(CPUState *cpu, vaddr pc) return false; } =20 -CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr) +CPUBreakpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr) { int i; =20 diff --git a/target/arm/kvm.c b/target/arm/kvm.c index ebe4ecbb77..c2f921095a 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -1517,7 +1517,7 @@ static bool kvm_arm_handle_debug(ARMCPU *cpu, break; case EC_WATCHPOINT: { - CPUWatchpoint *wp =3D find_hw_watchpoint(cs, debug_exit->far); + CPUBreakpoint *wp =3D find_hw_watchpoint(cs, debug_exit->far); if (wp) { wp->hitaddr =3D debug_exit->far; cs->watchpoint_hit =3D wp; diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index e75fd39fb6..293907fdaf 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -365,7 +365,7 @@ bool arm_debug_check_breakpoint(CPUState *cs, CPUBreakp= oint *bp) return bp_wp_matches(cpu, env->cp15.dbgbcr[bp->id], arm_current_el(env= )); } =20 -bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) +bool arm_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp) { /* * Called by core code when a CPU watchpoint fires; need to check if t= his @@ -422,7 +422,7 @@ void arm_debug_excp_handler(CPUState *cs) */ ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; - CPUWatchpoint *wp_hit =3D cs->watchpoint_hit; + CPUBreakpoint *wp_hit =3D cs->watchpoint_hit; =20 if (wp_hit) { if (wp_hit->flags & BP_CPU) { diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 51ff5cd767..2e1ecb1c83 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -6239,7 +6239,7 @@ void kvm_arch_remove_all_gdbstub_hw_breakpoints(void) nb_hw_breakpoint =3D 0; } =20 -static CPUWatchpoint hw_watchpoint; +static CPUBreakpoint hw_watchpoint; =20 static int kvm_handle_debug(X86CPU *cpu, struct kvm_debug_exit_arch *arch_info) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 2a98ed89c8..f161ba6415 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -459,7 +459,7 @@ static struct HWBreakpoint { GdbBreakpointType type; } hw_debug_points[MAX_HW_BKPTS]; =20 -static CPUWatchpoint hw_watchpoint; +static CPUBreakpoint hw_watchpoint; =20 /* Default there is no breakpoint and watchpoint supported */ static int max_hw_breakpoint; diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index eb78a6a104..12785dc161 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -358,7 +358,7 @@ bool ppc_cpu_debug_check_breakpoint(CPUState *cs, CPUBr= eakpoint *bp) return false; } =20 -bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) +bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp) { #if defined(TARGET_PPC64) CPUPPCState *env =3D cpu_env(cs); diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 6777f1a905..958c534f4f 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -945,7 +945,7 @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPU= Breakpoint *bp) return false; } =20 -bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) +bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; @@ -970,7 +970,7 @@ void riscv_trigger_realize(CPURISCVState *env) env->tdata2 =3D g_new0(uint64_t, env->num_triggers); env->tdata3 =3D g_new0(uint64_t, env->num_triggers); env->cpu_breakpoint =3D g_new0(CPUBreakpoint *, env->num_triggers); - env->cpu_watchpoint =3D g_new0(CPUWatchpoint *, env->num_triggers); + env->cpu_watchpoint =3D g_new0(CPUBreakpoint *, env->num_triggers); env->itrigger_timer =3D g_new0(QEMUTimer *, env->num_triggers); =20 for (i =3D 0; i < env->num_triggers; i++) { diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 89e90a84ec..b75dab5f3c 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -130,7 +130,7 @@ */ #define KVM_SLOT_MAX_BYTES (4UL * TiB) =20 -static CPUWatchpoint hw_watchpoint; +static CPUBreakpoint hw_watchpoint; /* * We don't use a list because this structure is also used to transmit the * hardware breakpoints to the kernel. diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index bd30b85ada..9e724bb262 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -52,7 +52,7 @@ void s390_cpu_recompute_watchpoints(CPUState *cs) void s390x_cpu_debug_excp_handler(CPUState *cs) { CPUS390XState *env =3D cpu_env(cs); - CPUWatchpoint *wp_hit =3D cs->watchpoint_hit; + CPUBreakpoint *wp_hit =3D cs->watchpoint_hit; =20 if (wp_hit && wp_hit->flags & BP_CPU) { /* --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717027; cv=none; d=zohomail.com; s=zohoarc; b=bsnkpztgcFgrwKn4lfn75fiL+whk+ClBt+dJw/hiX460P74SYNJkts7OYQeyRTWsvCzvoyKr1EgLijKHl8yfBONgkbZhG+tcUUjAGF95ZUYEvOcUsyPwWqF3SG77sv1OVQvzszWjhUsfsz4mRVyGTMWO7UGQBjDtPjNMY7Mmpn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717027; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bmhsTGQCtR7WnIwNmB8y86zKxj40+R+s322AEH4j5lE=; b=gN8eZKmj9EPhvpfbeknIqwsVJnK6tsaGkbUtLI+zBU8/gTIeiorqcr8UzUJ6mE90q+bha5MpPXR+HHP0pz3TTCTVG0D/xULL0c3Y+1e+T4mqC0yadZgmlo37RJSnv10+CYZIHOghXbOoHYiyQvVXHUAT6544+8R88lXfLSr0KIo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717027852946.60140988412; Fri, 10 Jul 2026 13:57:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIGa-0003tV-Aa; Fri, 10 Jul 2026 16:56:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFP-00021n-Ix for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:59 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF8-0000uH-Mw for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:59 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-848595b338cso1566738b3a.0 for ; Fri, 10 Jul 2026 13:54:32 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716871; x=1784321671; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bmhsTGQCtR7WnIwNmB8y86zKxj40+R+s322AEH4j5lE=; b=s9GqOZt80qWp86U0LOzFtEhyQ84vj6FkQpBX9taEksF6rKW9YmcCk7RbSwmm9lRpnb v3PkGnfPUCjIQTMPurETxmenj72MhjjHFgwU2Pl75TjoibAGl0LxYlZCo+yEm/fj4s9q o8TQ3UFVSXV8a3SRpNZmi3RxKs1Ekesks3YFVLx5sJqocdscgxbFbShUDPIxxbJunJcf +pGoyZNJMPnVUQ7jVAigqpD5vN6MuP7zpO3jKb/USi10byBXkWgVzoRVEWzWmCW2HMV+ x33ibdQ/puoK5FB87dTpklg1mq7Yp3y+5l84JGzMf9RlmNfmVgFDVxhInoCth1pXw5tf X0AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716871; x=1784321671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=bmhsTGQCtR7WnIwNmB8y86zKxj40+R+s322AEH4j5lE=; b=kPSM1YomYsLW/ehZwjm8Qy8pDmLUNyB4U2pdwq028mqn3Gd22w5/2MdQFa1Qbj0/wJ 5aVChQCns0nZz63bVJaNz7WklCYLZ2NFwe5yYx23ztKUMQFeqRAIJi1O6tbH6w7zj/7g DJvGAYFdIlg1PT/efzZFHIRrdm5wN6ka076yvsP4bgOfqWplt0Eh0H6ZdJtoclSya2m4 JHymiClYr7SavL5hbvpKyLr9h/Pvc0Vxt10YAF1Up88vVCEc/+3MRalgMBuRE0SY0fQS TU+WegGsqUVEkDyHICTq+JG2n4NZTtWZfEuZecqbx/QgNbaT1NmLxxWJSpH76u31CHFG T1JA== X-Gm-Message-State: AOJu0YwA2Yl2RxO0Gd3kM2X7zHV8BTqtknPlyFxBwtR2KJ+93FxQMz5X eEGaUzttvJusZSM5/DxO0rB6N2KLvePAjqSe7b4kaucLxrTbpr1GSoanTr70GNXpkwD4SyUjl7M UOpvS X-Gm-Gg: AfdE7ckJEhcuhCIzgDERBLisnxXP10rSZgmqK+10MYqbDqGU7M6Ohyofh48iI9mn6Xh oo3K9XdVYs7d6MZg2qjGVvSwkbSgRQnt9g0VqbyyP0cj5pHwlderDedHAwmIocyOeX4PDceiOQs 70w0/hmVlT99ol+SxiuCpz7HBiRZcmC4lA8PN9jTyHzm+aRzYtoqb4hBzdPTMwvDZltLxgzCVQ4 Xj7Yx9dFhRRCQpr9+qu5feDXtVZh+TkZeOP4B9xVLTkwKw9F5/iIyywpjvLpm6cIGgsygMMtoA9 +bsyWuyhih7n9JaSd8X+ugXZtwr14E/zE99K2SmT7Pkf1iRjuFuI6P9ig9naMemQ6twjX2uXB0H +HE/n4RPH9iuzbYc6WL5zEQZC1guhb0bT/1dBbcEYoxdQQUSs4amiFnAmiRqc4dMBUZq31HxiG2 KiAJU0NwdJO+DCs9yIOA== X-Received: by 2002:a05:6a00:2d1f:b0:848:590a:4c90 with SMTP id d2e1a72fcca58-84889797bdamr465210b3a.59.1783716871178; Fri, 10 Jul 2026 13:54:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 26/51] accel/tcg: Pass watchpoint hit to debug_excp_handler Date: Fri, 10 Jul 2026 13:53:36 -0700 Message-ID: <20260710205401.836304-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717028484158500 Content-Type: text/plain; charset="utf-8" Allow the breakpoint/watchpoint causing the exception to be passed to the target hook. Unused so far. Signed-off-by: Richard Henderson --- include/accel/tcg/cpu-ops.h | 2 +- target/arm/internals.h | 2 +- target/i386/tcg/helper-tcg.h | 2 +- target/ppc/internal.h | 2 +- target/riscv/debug.h | 2 +- target/s390x/tcg/tcg_s390x.h | 2 +- target/xtensa/cpu.h | 2 +- accel/tcg/cpu-exec.c | 2 +- target/arm/tcg/debug.c | 2 +- target/i386/tcg/system/bpt_helper.c | 2 +- target/ppc/tcg-excp_helper.c | 2 +- target/riscv/debug.c | 2 +- target/s390x/tcg/debug.c | 2 +- target/xtensa/helper.c | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 2dde42cf29..734bcd537b 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -99,7 +99,7 @@ struct TCGCPUOps { /** @cpu_exec_exit: Callback for cpu_exec cleanup */ void (*cpu_exec_exit)(CPUState *cpu); /** @debug_excp_handler: Callback for handling debug exceptions */ - void (*debug_excp_handler)(CPUState *cpu); + void (*debug_excp_handler)(CPUState *cpu, CPUBreakpoint *hit); =20 /** @mmu_index: Callback for choosing softmmu mmu index */ int (*mmu_index)(CPUState *cpu, bool ifetch); diff --git a/target/arm/internals.h b/target/arm/internals.h index 9d022245a2..9deb7a6e22 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -700,7 +700,7 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUBreakp= oint *wp); vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len); =20 /* Callback function for when a watchpoint or breakpoint triggers. */ -void arm_debug_excp_handler(CPUState *cs); +void arm_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit); =20 #if defined(CONFIG_USER_ONLY) || !defined(CONFIG_TCG) static inline bool arm_is_psci_call(ARMCPU *cpu, int excp_type) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index f4b2ff740d..01f4a8bcd0 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -42,7 +42,7 @@ bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); #endif =20 -void breakpoint_handler(CPUState *cs); +void breakpoint_handler(CPUState *cs, CPUBreakpoint *hit); =20 /* n must be a constant to be efficient */ static inline target_long lshift(target_long x, int n) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 80f4195378..5d7346a03d 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -303,7 +303,7 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr= physaddr, MMUAccessType access_type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr= ); -void ppc_cpu_debug_excp_handler(CPUState *cs); +void ppc_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit); bool ppc_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp); =20 diff --git a/target/riscv/debug.h b/target/riscv/debug.h index f5234ff763..540835f2d0 100644 --- a/target/riscv/debug.h +++ b/target/riscv/debug.h @@ -143,7 +143,7 @@ void tdata_csr_write(CPURISCVState *env, int tdata_inde= x, target_ulong val); =20 target_ulong tinfo_csr_read(CPURISCVState *env); =20 -void riscv_cpu_debug_excp_handler(CPUState *cs); +void riscv_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit); bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp); =20 diff --git a/target/s390x/tcg/tcg_s390x.h b/target/s390x/tcg/tcg_s390x.h index 975f60085a..61db0c0b53 100644 --- a/target/s390x/tcg/tcg_s390x.h +++ b/target/s390x/tcg/tcg_s390x.h @@ -26,7 +26,7 @@ G_NORETURN void tcg_s390_vector_exception(CPUS390XState *= env, uint32_t vxc, =20 #ifndef CONFIG_USER_ONLY void s390_cpu_recompute_watchpoints(CPUState *cs); -void s390x_cpu_debug_excp_handler(CPUState *cs); +void s390x_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit); #endif =20 #endif /* TCG_S390X_H */ diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index c256ab3cc8..663ee23dc4 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -621,7 +621,7 @@ void xtensa_translate_init(void); void xtensa_translate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, vaddr pc, void *host_pc); void **xtensa_get_regfile_by_name(const char *name, int entries, int bits); -void xtensa_breakpoint_handler(CPUState *cs); +void xtensa_breakpoint_handler(CPUState *cs, CPUBreakpoint *hit); void xtensa_register_core(XtensaConfigList *node); void xtensa_sim_open_console(Chardev *chr); void check_interrupts(CPUXtensaState *s); diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 86ce902c34..3205f365e5 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -693,7 +693,7 @@ static inline void cpu_handle_debug_exception(CPUState = *cpu) } =20 if (tcg_ops->debug_excp_handler) { - tcg_ops->debug_excp_handler(cpu); + tcg_ops->debug_excp_handler(cpu, cpu->watchpoint_hit); } } =20 diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 293907fdaf..fe8513a5de 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -414,7 +414,7 @@ static uint32_t arm_debug_exception_fsr(CPUARMState *en= v) } } =20 -void arm_debug_excp_handler(CPUState *cs) +void arm_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) { /* * Called by core code when a watchpoint or breakpoint fires; diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index c0c63e3e89..8ba5dfcfc1 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -202,7 +202,7 @@ bool check_hw_breakpoints(CPUX86State *env, bool force_= dr6_update) return hit_enabled; } =20 -void breakpoint_handler(CPUState *cs) +void breakpoint_handler(CPUState *cs, CPUBreakpoint *hit) { X86CPU *cpu =3D X86_CPU(cs); CPUX86State *env =3D &cpu->env; diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 12785dc161..51358c901f 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -309,7 +309,7 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr= physaddr, cpu_loop_exit_restore(cs, retaddr); } =20 -void ppc_cpu_debug_excp_handler(CPUState *cs) +void ppc_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) { #if defined(TARGET_PPC64) CPUPPCState *env =3D cpu_env(cs); diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 958c534f4f..a8429778f6 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -914,7 +914,7 @@ target_ulong tinfo_csr_read(CPURISCVState *env) BIT(TRIGGER_TYPE_AD_MATCH6); } =20 -void riscv_cpu_debug_excp_handler(CPUState *cs) +void riscv_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index 9e724bb262..58d9cc6e79 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -49,7 +49,7 @@ void s390_cpu_recompute_watchpoints(CPUState *cs) } } =20 -void s390x_cpu_debug_excp_handler(CPUState *cs) +void s390x_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) { CPUS390XState *env =3D cpu_env(cs); CPUBreakpoint *wp_hit =3D cs->watchpoint_hit; diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 0db5502287..02627ada7c 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -219,7 +219,7 @@ static uint32_t check_hw_breakpoints(CPUXtensaState *en= v) return 0; } =20 -void xtensa_breakpoint_handler(CPUState *cs) +void xtensa_breakpoint_handler(CPUState *cs, CPUBreakpoint *hit) { CPUXtensaState *env =3D cpu_env(cs); =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717186; cv=none; d=zohomail.com; s=zohoarc; b=ikjR6m67Bu0qGVJBcL3E7Ss48Gmb1CJo79pTZ1nTiCw595x+AFusdkaRvhob280NxiIgWScexuOGwdPCjXSS/kmwU/2MbfqH8H4HK77dsrdYtXVq24NaUKUlATxSKea+yKYK5qBWYFlg6lKrOnk6ZSOa0Bo+6Y0RQLHRvFb1kjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717186; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fJfbDIS/fYFApYI9j0z0r2WuLwyv5LpJL3k4ywDcnyc=; b=S6ItAfBzSYn4VrISX5HNwQOQYNZ03ZpaCeLyznxxy4OGmfgyi7jORSsf/+o4P131lxQOgvFgqOAI1V6a6Y1X137o6fLFS5yU0usvAPGMu9P2ytwPQiqpVBLE4jt4eN34vxNKcx/7uZ05AO+zxAu3RLdAdBAipXMxoZxE21HiSOY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178371718643185.62474484720792; Fri, 10 Jul 2026 13:59:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIFW-00029v-32; Fri, 10 Jul 2026 16:55:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFH-0001pY-E9 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:51 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIEz-0000v2-Uq for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:50 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-848882fdb18so343535b3a.0 for ; Fri, 10 Jul 2026 13:54:33 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716873; x=1784321673; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fJfbDIS/fYFApYI9j0z0r2WuLwyv5LpJL3k4ywDcnyc=; b=xfQLdlOoDzBQSUC6XOf0uckCFr4iPsauhgbkpADz8Z3/mvQ17JNM1ZB90VjSNtwhBI g/FtlchyIpHf87ObdOJsdXxcBGzIi87gN5tj2ds5eI0jkDcqqUqHi6JJKeFShJalaLpU rz/Itxbx5tlW4ScT3SjjP//4J3MEXSwOKiDMlvCUmedgVXUnunu4SaYKzx5SmZ8MUJrd 8ZSkJlikMVYCkhm5B76CAVo05bSwjx3WmPOO7J1fTTrIP/PBiEIAXL+iATYoB0ztYdka QguZ13tEUV/6Gzi7hvaw9ilGizOdE9lqzjFvwkR2X1eI102SWiwEO99CW3Icuo4eoTTW nWOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716873; x=1784321673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=fJfbDIS/fYFApYI9j0z0r2WuLwyv5LpJL3k4ywDcnyc=; b=gBg3SUNWtKqgDtRtWIRPPK/RbSA0T8yr9nuRTYzbo+a88ADzNRjTQ7RuDqWYWACclG FkItB77seDR9tRfKOppznrOgqUYA9MsDgSE/SZ+vyB5JC1TIoWj8yxG3qtRnsiPeAMwR y95Fy2YHK1bW5Xtd9zwXEDk2UzivuJ1SOGUtk/fi9XBhl8+yOJtzx9Kf2DUk8V7wru/q y6IQ9gFQcJnUe1Kxa3BUL6LsDOoICPH/SLJdjojviBCCtOaK6rnnhOA5H7fJPMpbKB5b QSFyo/QDJn6RIwI1PEoYaf5FlNl465Q3L4NkUwpwu6b+XCmP9MaThTDpI5Y8SA82mkeR aK+A== X-Gm-Message-State: AOJu0YxhH7c1PNP9flinhmbvLymkrXdbOtyuEWNuV4IHMrLHWa4o1fy2 j6rS1qhf1AsjYHgaFavFTTJGDYfrCZI+LDtV99nCqG/TH+zo/A7OdPEfgoJMyEFEfq+Yzl/BFZO +gNcf X-Gm-Gg: AfdE7ckY7MCwn1df4BNkzgBHsfBl6QKBlqK/RMTgWMykxoB3Cxy0vLfCMM4DiW8GOTw Q/k+0pvx6ExfwTMuu26jiXl+kBHf0pIiIFRZrH1Oo7/Z7vmukcLY1mxcpNEP/HP5MbSFC2w0uLy NznDjEZaj9X7Hm6WUBDhQH+jTcO2uCYyT2dUX8hKK3xcu5CvpCQ1rlq6vasP4eEgfLOLfK9eXvD daBXszd1qxoETUVG7cd8WhPOiqK8UV7mJBN/gdYZLQrVlIcCPNSldQ8WerQ1/M3EUWSAMxlHLiG A2MYmvUZfePzRDxtCtE0hs4KXDprSWNZNlJPTW66uB81B+wNZiKaIBNl4w0LiXRXCfuEpCalOGA hbkaXEUjaoMNn+7jvpxoO/i3cpkxt+kIlO4fVFLpUJtmJdg9Pg0aDM7JtUtYiK7xI7v3C+ls96X on9a0A3+TST4JNN4HyPLvv1r58Qcbt X-Received: by 2002:a05:6a00:18a0:b0:848:6720:6fec with SMTP id d2e1a72fcca58-8488965c1fbmr568684b3a.28.1783716872552; Fri, 10 Jul 2026 13:54:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 27/51] accel/tcg: Pass breakpoint hit to debug_excp_handler Date: Fri, 10 Jul 2026 13:53:37 -0700 Message-ID: <20260710205401.836304-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717187285158500 Content-Type: text/plain; charset="utf-8" Record the CPUBreakpoint in check_for_breakpoints_slow, into a new CPUState field, so that the as-yet unconverted target debug_excp_handler functions won't see it. Only call debug_excp_handler for BP_CPU, and clear the CPUState fields after the call. This will allow these actions to be dropped from the target hook. Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 1 + accel/tcg/cpu-exec.c | 32 +++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 3986e43f84..1a42940d92 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -526,6 +526,7 @@ struct CPUState { /* ice debug support */ IntervalTreeRoot breakpoints; IntervalTreeRoot watchpoints; + CPUBreakpoint *breakpoint_hit; CPUBreakpoint *watchpoint_hit; =20 void *opaque; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 3205f365e5..a4eb1f1c31 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -363,6 +363,10 @@ static bool check_for_breakpoints_slow(CPUState *cpu, = vaddr pc, return false; =20 found: + bp->hitaddr =3D pc; + bp->hitlast =3D pc; + bp->hitattrs =3D MEMTXATTRS_UNSPECIFIED; + cpu->breakpoint_hit =3D bp; cpu->exception_index =3D EXCP_DEBUG; return true; } @@ -681,19 +685,29 @@ static inline bool cpu_handle_halt(CPUState *cpu) =20 static inline void cpu_handle_debug_exception(CPUState *cpu) { - const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; - IntervalTreeNode *n; + CPUBreakpoint *hit =3D cpu->watchpoint_hit; =20 - for (n =3D interval_tree_iter_first(&cpu->watchpoints, 0, -1); n; - n =3D interval_tree_iter_next(n, 0, -1)) { - CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); - if (wp !=3D cpu->watchpoint_hit) { - wp->flags &=3D ~BP_WATCHPOINT_HIT; + if (hit) { + IntervalTreeNode *n; + + for (n =3D interval_tree_iter_first(&cpu->watchpoints, 0, -1); n; + n =3D interval_tree_iter_next(n, 0, -1)) { + CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); + if (wp !=3D hit) { + wp->flags &=3D ~BP_WATCHPOINT_HIT; + } + } + } else { + hit =3D cpu->breakpoint_hit; + if (!hit) { + return; } } =20 - if (tcg_ops->debug_excp_handler) { - tcg_ops->debug_excp_handler(cpu, cpu->watchpoint_hit); + if (hit->flags & BP_CPU) { + cpu->cc->tcg_ops->debug_excp_handler(cpu, hit); + cpu->watchpoint_hit =3D NULL; + cpu->breakpoint_hit =3D NULL; } } =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717081; cv=none; d=zohomail.com; s=zohoarc; b=DPgSH5avMwltZ6xj/mTZ3DkBswpkphdClfNVHK+rduC6SpfLwvhwVKW7IxuJmiYFsr5+7WPpi4qa/hOZ6P6U1VpmUHcmWDCSBb9EJ0+ZZLU14hoZKjRVRlTtliWkn0jM5Zj00/PZLIOcdXCKL3bXo40NTmxA4izi5PMAJqio9Ao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717081; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mes9xDUQ0Ck2g/+WTnUtzsbUXNthtYb/ogAdhSHGYlY=; b=McNW/HPgUzox/q8opbYT7Ou+t5p4eQ0W8ZJn/NtvK9GhXiV0vjkegafn584A6sMEUFWUYXb/N36rJW9+uwfmtioFLb0BsfrrmvrvKCiWxyj0LySiFNNtS7bQcgFqWgynMmIsfn5GRNT+71igo4Qusjt5i7IfF8dMCP6GkrTw80w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717081551986.3495280023853; Fri, 10 Jul 2026 13:58:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHI-0005U7-Bs; Fri, 10 Jul 2026 16:56:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFS-00028k-F4 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:04 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIFA-0000va-PZ for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:02 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-848595b338cso1566754b3a.0 for ; Fri, 10 Jul 2026 13:54:34 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716873; x=1784321673; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mes9xDUQ0Ck2g/+WTnUtzsbUXNthtYb/ogAdhSHGYlY=; b=D7uamCcbKptZF5/gWoDeMxTHveTlQYCOwvaB2wV+R0XYsjRioLNBj81mv0lXsCb8tu mBOiHoqXeIgr9G2jT2ZVt7mgnYA/D50C3MaMFAaoNyUgHD9tmSM+Rc/ERtg13Q+59JWf FZn1ha/2+jQmZyGDHfaTBCppjXz6HauXW6qZP+ponMw0frIah4ivLw+V/MIJ3DBqlcJB yOIcS9tML/QbjOPllTzY/UADUM7wmptO3acUD5IkFUuD6mgGtnUEoYILMC5J6Sm4Whao 6trghKSLWVUPGsL17IHmK86nJ4DWTSwKekva5pJeal6z0IJwe4nMisD3yA5cmiOoCHqt 9XWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716873; x=1784321673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=mes9xDUQ0Ck2g/+WTnUtzsbUXNthtYb/ogAdhSHGYlY=; b=j87nW+5k59okqQv499MhfjD7X4t4NlYWBgQJdZI8wqWaTy10qgWprJdC8TkUomYYbc hp7XMuKJMBmGGjBrNk+2hR5SCgALQNd7evVFCCaSNRyZEiISwqXt1eMnCBVs5nUvPpA+ GXQbSgmhNan7x2keCRBbowNiyYHV1MQ20iVJERD65/Vp49A5afVblJKAMZ7lh9brdGXf R02+3P1IFgI8Sc2wtoQP5d+Zd22icdVN41JX9PhF+bpisVujkpLn2bLdcpfauuzB845p ZZntY8fdQPy80sN7S4qMfHtoB3wX95zaQ79ENaWUSbsQA4j1LGl3gcTWaoPQTsZtTH/3 SEZQ== X-Gm-Message-State: AOJu0YxD7aPhaPQ6r+OMsMhx0Pgx8A+5Hj92iTW71I/2X2xIWd4JQxgK 1yeD5nJze72nqH2pJhC3xLVbw+EfeJ6JuOofiOhZSe6pTIIvVvDT7aB9K3k1KDuN/C5O1NtSID5 Luq4u X-Gm-Gg: AfdE7cm8iZ54/kp43eeXrjzNjoBZgoH7IeQaPALDs7hTM2/K8Ij5yyJQByQ4ZxK7IKd RtQ+pIw1t4UEheqMRTxtc0mcWIQy467ZHCiMPyepIz7kteWUXAJoahQrHoQU63/mFPIg8HbgSLt mtmWuvMzT4/tUQKZomqJl+QMgTUChZ7zCqfKl6s3ZYf8Vt6ldj4I3skrLtbWiS8y5vn8IU9eEgP xQdu412aKfnM73ujGsw0QSTK7Z0/DOFtBcbuNzGwe3pmhBLEC7i/Tw0TVFfE7sFtyUrhWIvwuXs /Vc9FU2vfraaszO46dBvQKLHlMRqZawB0vYrLnowYIcyRMiqEkXYokyeqZPGbDzq54Y0EtXiWsj ulBDg2o/tkAIxjG7HMPOkqv8hP8iM30G0uzbEgVGn082hCGute9wwr/KpM1AYXIfx9n2Y2C6bq6 JdHNJIuyBFy9Mv1feJn5BjjNS5WyFC X-Received: by 2002:a05:6a00:14d1:b0:848:2f6e:e532 with SMTP id d2e1a72fcca58-848897cdcadmr473243b3a.70.1783716873368; Fri, 10 Jul 2026 13:54:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 28/51] target/arm: Use CPUBreakpoint arg in arm_debug_excp_handler Date: Fri, 10 Jul 2026 13:53:38 -0700 Message-ID: <20260710205401.836304-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717082639158501 Content-Type: text/plain; charset="utf-8" We no longer need to search for a matched breakpoint, test for BP_CPU, or clear watchpoint_hit. Signed-off-by: Richard Henderson --- target/arm/tcg/debug.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index fe8513a5de..d705f7aef2 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -422,42 +422,27 @@ void arm_debug_excp_handler(CPUState *cs, CPUBreakpoi= nt *hit) */ ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; - CPUBreakpoint *wp_hit =3D cs->watchpoint_hit; + uint32_t excp, syndrome; =20 - if (wp_hit) { - if (wp_hit->flags & BP_CPU) { - bool wnr =3D (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) !=3D 0; + if (hit->flags & BP_MEM_ACCESS) { + bool wnr =3D hit->flags & BP_WATCHPOINT_HIT_WRITE; + syndrome =3D syn_watchpoint(0, 0, wnr); + excp =3D EXCP_DATA_ABORT; =20 - cs->watchpoint_hit =3D NULL; - - env->exception.fsr =3D arm_debug_exception_fsr(env); - env->exception.vaddress =3D wp_hit->hitaddr; - raise_exception_debug(env, EXCP_DATA_ABORT, - syn_watchpoint(0, 0, wnr)); - } + env->exception.vaddress =3D hit->hitaddr; } else { - uint64_t pc =3D is_a64(env) ? env->pc : env->regs[15]; + syndrome =3D syn_breakpoint(0); + excp =3D EXCP_PREFETCH_ABORT; =20 - /* - * (1) GDB breakpoints should be handled first. - * (2) Do not raise a CPU exception if no CPU breakpoint has fired, - * since singlestep is also done by generating a debug internal - * exception. - */ - if (cpu_breakpoint_test(cs, pc, BP_GDB) - || !cpu_breakpoint_test(cs, pc, BP_CPU)) { - return; - } - - env->exception.fsr =3D arm_debug_exception_fsr(env); /* * FAR is UNKNOWN: clear vaddress to avoid potentially exposing * values to the guest that it shouldn't be able to see at its * exception/security level. */ env->exception.vaddress =3D 0; - raise_exception_debug(env, EXCP_PREFETCH_ABORT, syn_breakpoint(0)); } + env->exception.fsr =3D arm_debug_exception_fsr(env); + raise_exception_debug(env, excp, syndrome); } =20 /* --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717447; cv=none; d=zohomail.com; s=zohoarc; b=K4KGm//cEPFFeUTMyMmu3RbgxapN5G9HsTRyn9gdpaieYAyNowdXXR/9kyV828sAYLIGTWZHvf9jwc/8CT1zcDoXnoquG/Ezl08g+wTqRG9YtiOsInvFFKWOP9IQK5qR9ZDjnF+x62H0IDxl0U9a9sj04fJjYNvNjLmAGnETOVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717447; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aii0dYUlzhh0daweMydBIrcsyG896sPYULsiw+pFWxo=; b=dX4m5mGlHlN+CUTgM2Elig3nBYKHOtiPtJblla0wF6xDwzWxaKVBhDWONv7Wuefb6/6SJCxYA4nYaiRekUSjnlbJPQVL4WT0yj9/peg3k0aIczsTBGzFKN1buFni4qh3DTSevA56E9IAqaNw4+7GezgL4lmuHRo4haWkOVkcN3s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178371744731572.23356716478895; Fri, 10 Jul 2026 14:04:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHO-0005w3-Hu; Fri, 10 Jul 2026 16:57:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFU-0002Az-9Y for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:05 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIFC-0000wK-AI for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:03 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-8487b7b3fc7so798115b3a.0 for ; Fri, 10 Jul 2026 13:54:35 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716875; x=1784321675; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aii0dYUlzhh0daweMydBIrcsyG896sPYULsiw+pFWxo=; b=rLiEaUxP01vMQwKnrM8/kl5XPl7DzHJu8bE/aSe21MdFxjmLpZg/NwJXmdi8C2sz/T F1i1rbtO+fSVrJP5UXv10sjEG99VgEi2tLfsfV/ZIYkfpImN+3RsN61/DrbzXGqtI0Fv nHYVxitiZP3Sj/v0Qyua/+umztATp+eorr0Yb38/PVci+V2C0bU1L62IOVIGD7qvO6oX qRtLJVJmP/6QUM/8ok04JGbh/kaiu8rKZ5EyRbw0e1wnQV4SCag5znPrIDzKgqjutFv/ qCB/zKS7UphUp2PZv/oE0j7E6GKMeisLDKzzKylp9nuMQ9l4sPIQMFLm4Wl7pkIF04Qj gAuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716875; x=1784321675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=aii0dYUlzhh0daweMydBIrcsyG896sPYULsiw+pFWxo=; b=JJePjaXJDoh4cQBh2ZtK2d+a36neKz5Dqs1uvqFyYaodLI7hYatSlElXKRoU/MbQUg MdKjqpZXa58yjuxhnNXQ6vcAHQhEtcfge23X9NzAUA2o/OROI77eXAb5nSZMGIQdo096 5DAHHmIagQ4JoLZC6Dn2Z3CP8D5UKfPmN3MpskBF17aMSimgnOY+xWcAjzG7JYjwdV7S 5HfMOCVV1IhxxDg55tSzaA1HWNN2vks6JXQKD9qYnZPCWZmnf7jZUwv5A3kuXLzSFeu4 H50+fjfdu8FH7eFsJrExpPpi1Dgk8xHhiMpH0rBKpYinrTsL+Xxntd2MOWJ8+lXsaU3h lpig== X-Gm-Message-State: AOJu0YyVeoPrcXrfRLNyGAwsjAOKDD7WM/ROZoXIFjM+25A+JSGXRQ0s MuGkTrT8bbherHCHFhBU8UcAiMs2cZO1zWNOncBTS0Iz1V9cT8wNu8oocdKTIdyrrXmtRXthYes qpknB X-Gm-Gg: AfdE7cm5r+Ct6WfBAPPqHHn8xG/9E95tVVlGxNg/vu4/Bz9XsaHKfZV3cg/Vcbf3cbV EK8Okaal5RN04BZ0pWublRObOl0yHAytLUEPnwDTj5L2pR74OyFbUN+Ix7UNjRoWmL+Znp10w8a 2RPx1TKzJ04cPJbVYXfazIuWq4HgEgL+MPK5JPTveKCuRFGQMCJCFGSU5WzxDjylSzHq04uTe6E MShZbbW7IeXUCcJTr398WvBIvlbw0uZtub1EP/hwtWJWIBqJga4q6iGTRY38xlj+M07B9HArrDI WrZQ8UcoW62Se/l0WK3Ehaq1JmBKLGtTUb1II54uZMOZlhPwf6loW/+LFMS9EOBR6m8wJQCTbvG rGJ5QhxKYEhSILn71bqij5taC9OWlhQ8Bnz3Mt2hDlG7qlVLo+7bQCXQ/hiRsqWMnBeMOGBVhEM BV7Q4MlWjwF1oGb0izcipNUWn3tUth X-Received: by 2002:a05:6a00:450f:b0:848:2f71:b65b with SMTP id d2e1a72fcca58-848897d5cc1mr491288b3a.70.1783716874801; Fri, 10 Jul 2026 13:54:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 29/51] target/i386: Pass wp_hit to check_hw_breakpoints Date: Fri, 10 Jul 2026 13:53:39 -0700 Message-ID: <20260710205401.836304-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717449250158500 Content-Type: text/plain; charset="utf-8" Since force_dr6_update is set exclusively for breakpoints, replace force_dr6_update with wp_hit =3D=3D NULL. Use the value of wp_hit to notice which watchpoint is hit. Signed-off-by: Richard Henderson --- target/i386/tcg/helper-tcg.h | 2 +- target/i386/tcg/bpt_helper.c | 2 +- target/i386/tcg/system/bpt_helper.c | 32 ++++++++++++----------------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index 01f4a8bcd0..2227712e2e 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -114,7 +114,7 @@ int exception_has_error_code(int intno); void do_smm_enter(X86CPU *cpu); =20 /* system/bpt_helper.c */ -bool check_hw_breakpoints(CPUX86State *env, bool force_dr6_update); +bool check_hw_breakpoints(CPUX86State *env, CPUBreakpoint *wp_hit); =20 /* * Do the tasks usually performed by gen_eob(). Callers of this function diff --git a/target/i386/tcg/bpt_helper.c b/target/i386/tcg/bpt_helper.c index bc34ac27fe..bcb9869c86 100644 --- a/target/i386/tcg/bpt_helper.c +++ b/target/i386/tcg/bpt_helper.c @@ -25,7 +25,7 @@ G_NORETURN void helper_single_step(CPUX86State *env) { #ifndef CONFIG_USER_ONLY - check_hw_breakpoints(env, true); + check_hw_breakpoints(env, NULL); env->dr[6] |=3D DR6_BS; #endif raise_exception(env, EXCP01_DB); diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index 8ba5dfcfc1..5dab77b2c4 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -160,34 +160,27 @@ void cpu_x86_update_dr7(CPUX86State *env, uint32_t ne= w_dr7) env->hflags =3D (env->hflags & ~HF_IOBPT_MASK) | iobpt; } =20 -bool check_hw_breakpoints(CPUX86State *env, bool force_dr6_update) +bool check_hw_breakpoints(CPUX86State *env, CPUBreakpoint *wp_hit) { - target_ulong dr6; - int reg; + target_ulong dr6 =3D env->dr[6] & ~0xf; + bool force_dr6_update =3D wp_hit =3D=3D NULL; bool hit_enabled =3D false; =20 - dr6 =3D env->dr[6] & ~0xf; - for (reg =3D 0; reg < DR7_MAX_BP; reg++) { - bool bp_match =3D false; - bool wp_match =3D false; + for (int reg =3D 0; reg < DR7_MAX_BP; reg++) { + bool match =3D false; =20 switch (hw_breakpoint_type(env->dr[7], reg)) { case DR7_TYPE_BP_INST: - if (env->dr[reg] =3D=3D env->eip) { - bp_match =3D true; - } + match =3D env->dr[reg] =3D=3D env->eip; break; case DR7_TYPE_DATA_WR: case DR7_TYPE_DATA_RW: - if (env->cpu_watchpoint[reg] && - env->cpu_watchpoint[reg]->flags & BP_WATCHPOINT_HIT) { - wp_match =3D true; - } + match =3D wp_hit =3D=3D env->cpu_watchpoint[reg]; break; case DR7_TYPE_IO_RW: break; } - if (bp_match || wp_match) { + if (match) { dr6 |=3D 1 << reg; if (hw_breakpoint_enabled(env->dr[7], reg)) { hit_enabled =3D true; @@ -207,10 +200,11 @@ void breakpoint_handler(CPUState *cs, CPUBreakpoint *= hit) X86CPU *cpu =3D X86_CPU(cs); CPUX86State *env =3D &cpu->env; =20 - if (cs->watchpoint_hit) { - if (cs->watchpoint_hit->flags & BP_CPU) { + hit =3D cs->watchpoint_hit; + if (hit) { + if (hit->flags & BP_CPU) { cs->watchpoint_hit =3D NULL; - if (check_hw_breakpoints(env, false)) { + if (check_hw_breakpoints(env, hit)) { /* * FIXME: #DB should be delayed by one instruction if * INHIBIT_IRQ is set (STI cannot trigger a watchpoint). @@ -224,7 +218,7 @@ void breakpoint_handler(CPUState *cs, CPUBreakpoint *hi= t) } } else { if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) { - check_hw_breakpoints(env, true); + check_hw_breakpoints(env, NULL); raise_exception(env, EXCP01_DB); } } --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717187; cv=none; d=zohomail.com; s=zohoarc; b=LJyIzPY9dLG+EWBoAst7T82rTIkcYF+6mewDFxyeZtlaPxYtF5qkYhtwkePN9r7JNMIhLbisxPKT8Sn99UVTJNThBQpjr18zxHzGOj0qRHcgf9q+1y7WQ06BhERJZPgHKncJgUQ8bymp2Eb9Z0aJNwrFBgeoChfGDbZ8z99YNBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717187; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+m7+GFqYgO2mGhurSu+ZocnMlHw4aq+wKZ/1FbPF0Jg=; b=flAv81hdQGElEFV9oc26tSOL00FybIzLOe0jI+lW1UemIAoufKJwXYw0T7nHh7L/qfsjCaaV2QUUi+zhwyQyea/291KpajCqJLaDGvOB/vNQiIeeZh95LxcDBQuDUHnQgn335qLfX4s0V1lTH/cpFvs2m5pUiEvRLbtoGNKZ5sA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178371718683118.409442507985432; Fri, 10 Jul 2026 13:59:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIGI-0003Aa-LZ; Fri, 10 Jul 2026 16:55:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFJ-0001t2-Vn for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:54 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF3-0000x0-3d for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:53 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-84867f07d63so1546709b3a.2 for ; Fri, 10 Jul 2026 13:54:36 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716876; x=1784321676; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+m7+GFqYgO2mGhurSu+ZocnMlHw4aq+wKZ/1FbPF0Jg=; b=k9BuvJNqRVPNMnAukEYi/4dD3JhPqrWIQdrhoSfsNGgiGRJFBE563nFX6mvAKpgfIr gabu9btlTZaebRqVV4M2Antc4gHDFJbBAx6F/m3RXA09pUqyrpjW98SodJ6+3Qeuh+27 jn7KyCM1Yms5DJgtcD2EWzyOPKPJcrg7Vwmkd0ECvPbOOWg8T6IPj32Glvy+MWxRPqlO xFIX2tW9WCzQjVKE93BmmGjTsSrpT6WEKeNy8GoTUSRkXs5E6Rt/+gjqjSXP+BRdbFSB JXXAYbXVFahqKdYhC8Co0fW8BigXJhK699f84AxlHuZdmLRzm792Bb9W6UJIpXdBE9hY 8g4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716876; x=1784321676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=+m7+GFqYgO2mGhurSu+ZocnMlHw4aq+wKZ/1FbPF0Jg=; b=YYKmF+hPRNQUwuyzNpqXdKfd4aYyeF8be2I/EkkZs0M7RbmcxwqNZN2Bb/IR/CGA4Z PBAyrA/FfMT+YkfJrsIlRbagalr3baSMxFf9J7eejy4rshUCUzio62pDk+7hVQg/k2Zt cyz6lXEcY8kmRHkJFZKhA2YdwWVq/kENx4FqRDGkKF21X1HtCPBU5oHIkjGGQa3CXuS1 VC5wWp0YyGHEwd+kN2G28LwNNsta4PF4v74OpuQv84hDb1I4k3a0JjAixYFswtSYsA02 fvwanmaMCbYYE8/T65EKYHAFNHww6VuVAJSOrzezm4UBEsNVPbe2S4/Ms3MxYpp2x6wM 770A== X-Gm-Message-State: AOJu0Yx3KRDjRUIitEvx26emgt3Pfs+mtNEPO2Jhw55f7I3QUJvjn5Nk 117nc1T7KGp7NYTZG9sTsZFdu3guoyidvrXk8giSMUaienmppaRwpTBozz+n9uv3oCvMFmyX7b+ O/H2P X-Gm-Gg: AfdE7cmP6RU3qL9QmQM3lqlzCyBsfoVRYT4g2g3ubrEii7kawQimnZn83ZSmzhavPdq 3o6fgKqixDz1b9IixFGXb019HtOvKn98xJbtFFkckHhbQQgVlTGfcXLAOdvcXw/mzvJKI4rnQRu gp2YNgpHFQDCYbYdNQXBy1s9INzy2GcXhvwn1fMQfUdGQX+ReMm/tJ6+/1ei9P35VNwcUl8W5iI qyt5y6bWfdexaSmUZAdt3vFxx71lbTNJZEcWyrtmAzuQqsEDbpJsZh/0rdg9KmklXLpnQ/0vrMN FtRKb2Z3ddmOUgOGHYqE0di0/jUdvkeMa/19dF/vkBTsJiRqLecbDepZC9zmN0oQk6cFWPGtKao GXjhp6EzJ+pZrdJc5/6IMhbL8cO1GLI+MbPCCOkS0AmePwOSdWKl4j0nsZ3Wn4McyJhTD3nYFjz NRavmxv7tBgiD+x5z+cA== X-Received: by 2002:a05:6a00:3d11:b0:848:55a6:fce with SMTP id d2e1a72fcca58-848897276d2mr531163b3a.62.1783716875574; Fri, 10 Jul 2026 13:54:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 30/51] target/i386: Use CPUBreakpoint arg in breakpoint_handler Date: Fri, 10 Jul 2026 13:53:40 -0700 Message-ID: <20260710205401.836304-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717189236158500 Content-Type: text/plain; charset="utf-8" We no longer need to test for BP_CPU, or clear watchpoint_hit. Signed-off-by: Richard Henderson --- target/i386/tcg/system/bpt_helper.c | 32 ++++++++++++----------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index 5dab77b2c4..86562fc946 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -200,28 +200,22 @@ void breakpoint_handler(CPUState *cs, CPUBreakpoint *= hit) X86CPU *cpu =3D X86_CPU(cs); CPUX86State *env =3D &cpu->env; =20 - hit =3D cs->watchpoint_hit; - if (hit) { - if (hit->flags & BP_CPU) { - cs->watchpoint_hit =3D NULL; - if (check_hw_breakpoints(env, hit)) { - /* - * FIXME: #DB should be delayed by one instruction if - * INHIBIT_IRQ is set (STI cannot trigger a watchpoint). - * The delayed #DB should also fuse with one generated - * by ICEBP (aka INT1). - */ - raise_exception(env, EXCP01_DB); - } else { - cpu_loop_exit_noexc(cs); - } + if (hit->flags & BP_MEM_ACCESS) { + /* watchpoint */ + if (!check_hw_breakpoints(env, hit)) { + cpu_loop_exit_noexc(cs); } + /* + * FIXME: #DB should be delayed by one instruction if + * INHIBIT_IRQ is set (STI cannot trigger a watchpoint). + * The delayed #DB should also fuse with one generated + * by ICEBP (aka INT1). + */ } else { - if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) { - check_hw_breakpoints(env, NULL); - raise_exception(env, EXCP01_DB); - } + /* breakpoint */ + check_hw_breakpoints(env, NULL); } + raise_exception(env, EXCP01_DB); } =20 target_ulong helper_get_dr(CPUX86State *env, int reg) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717252; cv=none; d=zohomail.com; s=zohoarc; b=HNrlqX4D86IOVWNh4H29QEytdMl+eeWZ/zwpkh0W0YxxMfAlb/Yhc6sMC+53DjvkOPK6gBdUx/9hcjfUHUF/R5Lvft5HuWU7JyFWdlracrLyrH9ZTmR2Z50KUr/pZ80QerdAuYpDBc1PE/StZJUYl8u5ToFH7C2iJ89pQd/GEMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717252; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HlU1WJhs/EKnxRmtpuuBgS8HV9oUIdhQMc6Ge3RayaI=; b=mbirm6oYGcUxTtvrxXAQQl0AIyKKb9cFKKG0hOFjOi0dazXz/Xn7XMsC+38ZIZMDAaeKgIcLCcpDJeYytH6ShEc31XXcyCULm+7tlbDd1HAcNXNU7d2iAdt5NT9TdSyIX2ISZe0w5cSo/k/PE1S73lHowYnI/vqchKLpEu+jEpU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717252666136.82393563316782; Fri, 10 Jul 2026 14:00:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIGS-0003Ve-Kd; Fri, 10 Jul 2026 16:56:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFL-0001zd-Qf for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:57 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF4-0000xT-Bj for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:55 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-8484f229529so1094242b3a.2 for ; Fri, 10 Jul 2026 13:54:37 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716877; x=1784321677; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HlU1WJhs/EKnxRmtpuuBgS8HV9oUIdhQMc6Ge3RayaI=; b=HtJpNWkwLoR95fmac8+GtHEMOhehaX/IUQfm65dwLdb4paOnXG3HDGDnu6bOQ85r13 IJcnumPGGi9PKXTtB2gk/lh8GdRjakdp/ui5KdLtyo1HaEJ2/4d9yP5Kt1ZZFe0B91zl aCxxVSyBDR+77xB0XBWEFfHZmHj+Y6V5TcNhk/qXxZaIJ5IkjQnXjYhPZXwgdH71Up5z xJUAJp9WjtSuOmxXePCEzBXmE6EV+BqwLN3nV8aawPxqIn0yKWqUXeDLmN7hdw4r6rbS DohGBnLHk0tQk9DHHv9JT6a3xRParWg/stt6e8diQXrZpF5s+x1D+xYCcnJ1vq13pwLr JWZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716877; x=1784321677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=HlU1WJhs/EKnxRmtpuuBgS8HV9oUIdhQMc6Ge3RayaI=; b=fXS8Rx2c481FSUN4h0M1surPn/fWsfB+bcV+fGd7rednd/Nrw4J1NuFOv2gybCsLse i0wfyTFhQ2ny5tb0+SdotEbAQ6WwLvAKhD66G4iaCYqNz1ohXZl3vcpCcRGWtKrVs0+Q EYQrCgSQ+FG73HdCHaXiv26gBCaOeCklVELCYTTrthCatoXAfQ75hHENZhcb+D33SWMf eDbZZezHfjyl9AMfCmBS0frGt0TfwLSChMxN39QSURb8rTv35OI1e/+ZNAbuRZWsj+kn IN7nw8MjSXtcPxdUTb0fasICsxqbFjgZvSrB+rpqKRuZnmn0Udpwa7pcSDkr1rJOhSTa X2bA== X-Gm-Message-State: AOJu0Yx/lROJZIR7p8ZyxNbECMYMomMnNLPEqPV25MDfmS+BfLvvzV5s bfJOvy1mOcxM6vyR4JEGH3cNJGBwf6Kpx5NV980Oj5R+fLMeXFxuLRSxtEtjnCg+jlzAH/sju/V S+qth X-Gm-Gg: AfdE7clT6MX+qrsxFcZDjkCaBzRvh53YvyQyNW+h7BXPIcHG4a6Dd68mOmALPioa/4O 4BfUhwaMtbX30x5RUwWutiXDqg/cI12TsgHJx3ra+oEZdW3n9xfbrd1yDWb3rrCAb78TtMQhOt5 qGV+E22/IER1JoUu0MqNmuTLffAHQcrX14nKaLGoDstxylLrRmqhnJo5mpFhd82XvF869DM0nrc Gxv/noLUSThkXQrfuLhMAQYT77QC59TBgLtS0XNodQG//iYqmWtBckcltbQPhG0KIvCVDqIBWJ0 oMwBJJvQ6GX32MNoq1zZQym1ITZfns3yARuSmRLv9d3knHMot4ptb2ZudA822EnJrebaiPUasmv g4YaPm3HJOIQ7Py5/joOUo/lVDy9oNPp7GuyTnaC/+prNJonOFSSMMaJSLtAk0v53nHGKhuJ4gV 5piTK2gkPif/NClqJ/nIwckfSYYLi8 X-Received: by 2002:a05:6a00:1881:b0:846:f517:ba5a with SMTP id d2e1a72fcca58-84889716692mr549556b3a.28.1783716876615; Fri, 10 Jul 2026 13:54:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 31/51] target/ppc: Use CPUBreakpoint arg in breakpoint_handler Date: Fri, 10 Jul 2026 13:53:41 -0700 Message-ID: <20260710205401.836304-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717253883158500 Content-Type: text/plain; charset="utf-8" We don't need to check PPC_ISA207S, because that's already done starting with register_book3s_207_dbg_sprs(). We no longer need to check BP_CPU or clear watchpoint_hit. Signed-off-by: Richard Henderson --- target/ppc/tcg-excp_helper.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 51358c901f..56ca66e7b5 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -314,19 +314,14 @@ void ppc_cpu_debug_excp_handler(CPUState *cs, CPUBrea= kpoint *hit) #if defined(TARGET_PPC64) CPUPPCState *env =3D cpu_env(cs); =20 - if (env->insns_flags2 & PPC2_ISA207S) { - if (cs->watchpoint_hit) { - if (cs->watchpoint_hit->flags & BP_CPU) { - env->spr[SPR_DAR] =3D cs->watchpoint_hit->hitaddr; - env->spr[SPR_DSISR] =3D PPC_BIT(41); - cs->watchpoint_hit =3D NULL; - raise_exception(env, POWERPC_EXCP_DSI); - } - cs->watchpoint_hit =3D NULL; - } else if (cpu_breakpoint_test(cs, env->nip, BP_CPU)) { - raise_exception_err(env, POWERPC_EXCP_TRACE, - PPC_BIT(33) | PPC_BIT(43)); - } + if (hit->flags & BP_MEM_ACCESS) { + /* watchpoint */ + env->spr[SPR_DAR] =3D hit->hitaddr; + env->spr[SPR_DSISR] =3D PPC_BIT(41); + raise_exception(env, POWERPC_EXCP_DSI); + } else { + /* breakpoint */ + raise_exception_err(env, POWERPC_EXCP_TRACE, PPC_BIT(33) | PPC_BIT= (43)); } #endif } --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717293; cv=none; d=zohomail.com; s=zohoarc; b=L7JXqmFcCUHX3ANoZl6+cqzlu/5QHpb2jxh73EqhWXxGShnVHuysMQ3nX3NrHZIPZOIvv02fe1JHc6moBSoh5hCEDfsSKJGPumpkgiJG1/SGJK4bVqR7GBB41UHrvzLINIqujWs9YH5bQuTWmslfj8b89qA2TM14EviY14QO2O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717293; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GnP83ngqbzOCaEyHZuWHVT2DEUxtaEIT/kVQUZ1VwBM=; b=NA4xZVdDw5S7Vq6tnxQndjySQ/wAk87J/d7ElzfRBKc9rvFEvVScBBLdE0dn1OpmLkxPnWbBPolB20kqAM/ww00lygTTlr1wu3zNvhw0cyvdG1csBjCm7cHMDRchgmV4l7ah+girfYH9IS/s08VNpwbqJhUETyPWy296fTSuKts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717293077486.7381073913284; Fri, 10 Jul 2026 14:01:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIGj-0004FL-1m; Fri, 10 Jul 2026 16:56:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFM-00020n-88 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:59 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF6-0000y3-Pr for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:55 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-8484a0b998fso2000987b3a.2 for ; Fri, 10 Jul 2026 13:54:38 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716877; x=1784321677; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GnP83ngqbzOCaEyHZuWHVT2DEUxtaEIT/kVQUZ1VwBM=; b=bNibhBOuXmppnR68sD7trHHPZhV4j5AQA7Kzb1A4Kdqa36+ioA052goYRxRpYKa4z0 nTDqPU18wNEc555riEoiORe/2eXBPi+48ptIwdmTA78WzDTMy7QGlRCiiAwFiHCkZ1+V E9t1WbRZF5Q1uZfdTKrhGuwaKWCfGUMp+YUxFODC+gYXFX3Dxp4URnfVOLfT7YsQNJK9 HPPk7sVaFOIW9SGHe9iHJWL4ov6vl4DTVfKzAsUjhA4nzoNKAOOt2OjJ8+Wm3FxdXz99 nqG3rd6KV9pBDHUYDAAQf1NAWc/AlXp8ZELb+bX5sP2XJn0facaxZYIFlPq9wi92oCnf hcDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716877; x=1784321677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=GnP83ngqbzOCaEyHZuWHVT2DEUxtaEIT/kVQUZ1VwBM=; b=DnyA5XtKUtelMOJYKrOQvqb62rrdYqwfEDS2RaQs+XcEAW8LVvbr8/130CwRSwiGxQ vQ/PJPgHo4JQGJXb7ww6DbSNyOqth+iZdE3S6TGd9izinaR+3XlKrr/ym1aqOG9QeSUt drZcuvyEVlq2dTqZNEImCBtr6EFDLruWo0BFCtrz0+FtBQGbLhJgDqjuZ9C1gxEP9nxi 4MQZGiMe2yko7nD99I0xpjyUgj4j1zUbCcl8l8Z30LsoYt0IIF1rM80MB1Q/aGAdr2MD 4YfJ1fg0dKBQAYiPiCgfMlvT6LkN0Kzwunzrq4HRByQdWS/yijyW/HjhOnLdIMUaoKG+ GDzg== X-Gm-Message-State: AOJu0YxW9VhLtsfCqonroEnMqNySl36t3YKjd7Agc/Z5Gxblio3hjhvQ PjgnzLA9ZMYh3i69XQ0buPwMeoSF7/o5T3oDtt2KUm7T8K0TBD+mwlMhTnS+q9RqjUVi/8kjorp V9D/W X-Gm-Gg: AfdE7cmuX9ysuiv26Ezz9lOek4MASY5rHrryy9GMLE0wNTj7998B3Tcn/1I0Qz5vSCC BBWFa2kOOOGDAs+XiobUhhsqQIfW0b+hxE7zRnDCVNJFU5rePrni9JG3GJ1SSKfJ0rYaoX6MzcW MrPQoDcSrkomuJ6+Ze92MUGtfMgml9R+zJr6f4tzLW4ODOrdQpxU3lX1qNFSiOLzwsAcj9YhJLx O1UUwh9yunY+7D2kO6Qc8JqL1HwEJsjEP7M6PDKJWDCdc0CaU+lreJrClvCN4sx8o7xl9AzYQ4V 7xeggf9oiMV5Z4eZCmVOtXMem+2UkyObJOWeYHTgxIq5h1RvAjsr875jnlVxZdlFcwOXT2cuhVH 04apYmVlt0ibyLqVxV+ulLxVRrqEdFmWjBbic14kygBzUptOusgvuS5hasbv4pRYwmsHSmUfPLs DgzROPIbSI2Ni8M7OKPw== X-Received: by 2002:a05:6a00:b50:b0:848:80ec:5d2 with SMTP id d2e1a72fcca58-84889738aa8mr513964b3a.51.1783716877471; Fri, 10 Jul 2026 13:54:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 32/51] target/ppc: Simplify ppc_cpu_debug_check_breakpoint Date: Fri, 10 Jul 2026 13:53:42 -0700 Message-ID: <20260710205401.836304-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717294162158500 Content-Type: text/plain; charset="utf-8" We don't need to check PPC_ISA207S, because that's already done starting with register_book3s_207_dbg_sprs(). Replace target_ulong with uint64_t, as we're under TARGET_PPC64. Signed-off-by: Richard Henderson --- target/ppc/tcg-excp_helper.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 56ca66e7b5..99ffe4a820 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -330,23 +330,19 @@ bool ppc_cpu_debug_check_breakpoint(CPUState *cs, CPU= Breakpoint *bp) { #if defined(TARGET_PPC64) CPUPPCState *env =3D cpu_env(cs); + uint64_t priv =3D env->spr[SPR_CIABR] & PPC_BITMASK(62, 63); =20 - if (env->insns_flags2 & PPC2_ISA207S) { - target_ulong priv; - - priv =3D env->spr[SPR_CIABR] & PPC_BITMASK(62, 63); - switch (priv) { - case 0x1: /* problem */ - return env->msr & ((target_ulong)1 << MSR_PR); - case 0x2: /* supervisor */ - return (!(env->msr & ((target_ulong)1 << MSR_PR)) && - !(env->msr & ((target_ulong)1 << MSR_HV))); - case 0x3: /* hypervisor */ - return (!(env->msr & ((target_ulong)1 << MSR_PR)) && - (env->msr & ((target_ulong)1 << MSR_HV))); - default: - g_assert_not_reached(); - } + switch (priv) { + case 0x1: /* problem */ + return env->msr & (1ull << MSR_PR); + case 0x2: /* supervisor */ + return (!(env->msr & (1ull << MSR_PR)) && + !(env->msr & (1ull << MSR_HV))); + case 0x3: /* hypervisor */ + return (!(env->msr & (1ull << MSR_PR)) && + (env->msr & (1ull << MSR_HV))); + default: + g_assert_not_reached(); } #endif =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717446; cv=none; d=zohomail.com; s=zohoarc; b=goSjaPeeMzQVpAfR+hwaJFWKr+Dn0yFkpgdMZJeUFst+hDfbL66lqYtj2V0iihXceoDZ0kTvUEtYhcB9zogMjyNGZa0ir7Q9un+xaMPJBBVggX4IAayDBW6EIFwInyd3/R4RvuhdTlc+fb1Rw/1S5BLrT2kPdv8B+QloSl7PuJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717446; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Gu1/Z4NGRci2zl7OUGsQFq715jKZAcS9WoRfcTkKu9k=; b=oBBQk/qaTQW2DQd7fJar3nHRDt8244wB5ZmKFMOOLRKMGY+s3/KHQTvxKrgCBpqwiC+joxJmHxg2etgq9pOmUlKe6eIKTxN9jIzTa/xd4cuFpKJP2Njscz0oIbL4DM9TmkzoBMGBOw9MwvOjCN/wU7uvC+vI7SmArjMKpcS8Sac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717446750572.6079830963073; Fri, 10 Jul 2026 14:04:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHE-0004ti-7P; Fri, 10 Jul 2026 16:56:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFM-000214-Vi for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:59 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF7-0000yR-D9 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:56 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-84536ecfc5bso1562214b3a.2 for ; Fri, 10 Jul 2026 13:54:39 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716878; x=1784321678; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Gu1/Z4NGRci2zl7OUGsQFq715jKZAcS9WoRfcTkKu9k=; b=UflPqKgUWWqvS5/ScDzpkjsvQ/vUNSh1u2K2BIn/lkpW1RVl28bL1aOew19yzLdS3p 9d/oFdtfWRNJYQWVfYCSOy3Qki6DK+W8rqEMjq0Fity4DLJFGXe5ZVD1f9+AA9YRpBQD Zj99E49j30a0eYM4Md8zvUY3tZiSvngcBBzG5jHNzU6DwZI4W8im/uRv+Fe7QN0eYmRI yziA/YNzCKpJymvGN4lU9+pODIxUDaVH6215FECpip59vCUhObtRXJ6D4DVu7PQucDlZ aW/Uc+VqnDiC3qtxSKWMnL1QMlN1muzo5KX9OSrB8KidMqf/H+1OiyQdg/AFrmIcZT/O uKFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716878; x=1784321678; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Gu1/Z4NGRci2zl7OUGsQFq715jKZAcS9WoRfcTkKu9k=; b=APryKrs39aoWaSzgWpl10shlGFLQBDRB2+qvoWpz2MPAOuNLOtrCHE9CZOeobPURBF K4J6sFTJervSVzEK3srccUP7NO3HnGdpoOjSfJMptfzf7rUhzRYEXcPP1blMKxLY9dIo u7iPVb6CE59znvSKDlYtZJFT5RHWiCGkPFD2gevOAExtigT2vT/4j5xEild+e/8sxLeU MBfZXCLOTtmhnMZx+NyInJ9pDfZ89bkBtPPGNxK9R4ASMTaqOokb3FE0astJda5dWiwQ tuAqkwSJhTk9yGDa20er9eeFem1DcYHDsQzagnux0rFJzHgmhsSipL495P7S215QWorP c70w== X-Gm-Message-State: AOJu0YyM3/h2XFBj55c7uxHG2ZBogF6BBZc2KCI8NH9N7nlyApL66k5k MuWlUap9pxegKNLJR3aBqKUybP1uMtW2G8irTMGr8u4S0IUj91yA4fCPuCM1+ipqjC7O7hHIPX5 T5AQj X-Gm-Gg: AfdE7cmW8Oomgyz8zHlmCXec6Y32OfS+61cJ7Fv9pShwpoC0vcKgS3B2evBKhQYPML5 u4WTO1abaTXT9E4QEKcds+3jYTGPCWiQEwShCHFB7Zmo9tIQTUiqNqB8NX+HiG+/wPHnMt0vh/S 7R7SFx3mY8w7KfVrNQSChrDPSJ2+ZSezIgGoodJlvqEIYXWSzYNaj29aRjMltvKgUrpp2OGuyJ7 E20IhDcLRyoDfQ13AH1EzojfZN5/JTrCjAfLpAlmler6vQkuIZuqLSX8tM62/vKTjcZNVPjXdYc ifuf6+cvCjbee9v8EQ/7CJYggRbSDYxzzluLjjfFpbyu/jvmciPc6KB2FzbW7dXwSf9SL+5wjq8 KLX8DGHfGUovHy5SxmpBU3NYqhX8X2FehxFJTj5Er8HysjyL7x7OArScn0Girv0sQVqABeXHvkn wnico2rkYHikUtElECjg== X-Received: by 2002:a05:6a00:178e:b0:847:77e9:acbb with SMTP id d2e1a72fcca58-84889611685mr564261b3a.13.1783716878244; Fri, 10 Jul 2026 13:54:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 33/51] target/ppc: Simplify ppc_cpu_debug_check_watchpoint Date: Fri, 10 Jul 2026 13:53:43 -0700 Message-ID: <20260710205401.836304-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717447240158500 Content-Type: text/plain; charset="utf-8" We don't need to check either ISA bit, because that's already done starting with SPR registration. Replace target_ulong with uint64_t, as we're under TARGET_PPC64. Signed-off-by: Richard Henderson --- target/ppc/tcg-excp_helper.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 99ffe4a820..4065440949 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -353,35 +353,23 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPU= Breakpoint *wp) { #if defined(TARGET_PPC64) CPUPPCState *env =3D cpu_env(cs); - bool wt, wti, hv, sv, pr; - uint32_t dawrx; + uint32_t dawrx =3D env->spr[wp->id ? SPR_DAWRX1 : SPR_DAWRX0]; + bool wt =3D extract32(dawrx, PPC_BIT_NR(59), 1); + bool wti =3D extract32(dawrx, PPC_BIT_NR(60), 1); + bool hv =3D extract32(dawrx, PPC_BIT_NR(61), 1); + bool sv =3D extract32(dawrx, PPC_BIT_NR(62), 1); + bool pr =3D extract32(dawrx, PPC_BIT_NR(62), 1); =20 - if ((env->insns_flags2 & PPC2_ISA207S) && - (wp =3D=3D env->dawr_watchpoint[0])) { - dawrx =3D env->spr[SPR_DAWRX0]; - } else if ((env->insns_flags2 & PPC2_ISA310) && - (wp =3D=3D env->dawr_watchpoint[1])) { - dawrx =3D env->spr[SPR_DAWRX1]; - } else { + if ((env->msr & (1ull << MSR_PR)) && !pr) { return false; - } - - wt =3D extract32(dawrx, PPC_BIT_NR(59), 1); - wti =3D extract32(dawrx, PPC_BIT_NR(60), 1); - hv =3D extract32(dawrx, PPC_BIT_NR(61), 1); - sv =3D extract32(dawrx, PPC_BIT_NR(62), 1); - pr =3D extract32(dawrx, PPC_BIT_NR(62), 1); - - if ((env->msr & ((target_ulong)1 << MSR_PR)) && !pr) { - return false; - } else if ((env->msr & ((target_ulong)1 << MSR_HV)) && !hv) { + } else if ((env->msr & (1ull << MSR_HV)) && !hv) { return false; } else if (!sv) { return false; } =20 if (!wti) { - if (env->msr & ((target_ulong)1 << MSR_DR)) { + if (env->msr & (1ull << MSR_DR)) { return wt; } else { return !wt; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717075; cv=none; d=zohomail.com; s=zohoarc; b=edK9a70yIO07tx9nZExVvWKlErtKeABTb2XZ9Hc27aruUwR/HlyiNG7hHQpq/aCos0yITPjwXgs/umU1AVwPtiSXQPowys3hDEql7NhU2u35wGP97rGLeHsGJNLvyeYjnNXTsoiR29xjbil3lmFBFi3g1z7/JP9tIOGQNoAK2RA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717075; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AwlXkf93TRyaeETrOdNkI4UVA8dItVhEvL4JieLFr/A=; b=fHv2DLJF+qN2rBkzbsK+AyIuxYl1mjqP0rwdIk8a8ZGE6Rcp96dH0mD7aRx3TqdFo9D6YVvUeTQEM4CpGqJe/oy+GtEZ/3hIkaLtjAMB48YmaO5OYZNO6xInPwMs7my+eUaW/elMp8DEvP9C3xmFIrBnBo/rPEd3oQ6EIssqOak= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717075396883.9087539814175; Fri, 10 Jul 2026 13:57:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHB-0004fO-DG; Fri, 10 Jul 2026 16:56:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFO-00021d-4r for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:59 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF7-0000zC-EM for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:57 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-8486ac3f347so1789386b3a.1 for ; Fri, 10 Jul 2026 13:54:40 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716880; x=1784321680; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AwlXkf93TRyaeETrOdNkI4UVA8dItVhEvL4JieLFr/A=; b=VDrOfR6D2i+eIk7vp+Dbwsxuh4eL3fbtmo9ATwalut4sf0eLBphzlPZORuFwBhBao8 xAli11KIfiCkklQPUOBs41aGzh4SJAeVgBoGRNHjlJOAqCnpXyQDc6/FNv1ZZLOBJ1Xd yiPwQ83aKzF53STl9wq5Br2q64UB5R6DRjNX1nJ/I3HvCMOCZAH+UXKkjTp4WgZmqrKD j+Fy1iolNKgXtaNQ2sK0g1tX4i7Xd8ks+5C6OWGJ4wSXBhfx3EcQokKYZ6p4oIjqfNdg AfuVwPelNDDS+7OdFcmieqqGKcVOexdoMr2juS6nZCP4eTiJLLEODoiE19HlZgyaCN3b 186Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716880; x=1784321680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=AwlXkf93TRyaeETrOdNkI4UVA8dItVhEvL4JieLFr/A=; b=BotlppWm3xo6Hy77bnTNuVNhIpA7p3T3sgn2lmqRTAoEGQro7/zFX26od/MFk69bHL gitWi6f9Uafe/JgI9mFeDArkzf2E4ouX0eROaoYJnWUBafa3b/BjfE14phTcLufm4Ryz vgqpjf4K3+kKURuYhbAquj9kUM0/1OQRANyhii11dq2lctfHBkBjllSEec1fKM3Jg3Mk IJfH1I8nYg7FsHvLYHp527KW+JmxMdVwXer3Vd9PLIZovvlNLXsm70taxXwD8P/q94q1 Z0OBOpS4DiRP21RR9O/HkGc17hoLmAC7oTfE+Oh5iNTph2IXzvQ25yppK+CIeJqbFWkR fxMw== X-Gm-Message-State: AOJu0YxlXgSA+XQshzqU+KpBXzAUHdoPu8/C2SzoNxgGSeLHtsJk7Srr XJZANKe7v0Nu6xb3gvU6qeNSm+htK6d89gv/6H55g8hZObej2QrryMdja9a7t4o5WPrnbWqnPct gYc9w X-Gm-Gg: AfdE7cn/LoQbPAs3O5PYCXeyPN12mvOPI4jqJ1O01mP13kPU1q/aG9ASrtEk8qqNhm7 NE69mahYNAsCnWI0+z9ifXDZ1RDKWz7fg3eWv8LB8wwLWv/qipxpwkK1cDHk4aCnw7IPgF01ozd LVlE0dFCHcSomaYRToNHz/XzPyXrHtmvTm8gb9CBofQUIvfr82dhoJBb4Ms4mYHrgXjmthQuS7R K5FLLKMgCiRuOc0gZZmZU0ls2NcZAGzZDob4vlDrPq3dIvJgbGELN0j6AY8OBi6H9Kt2Q8Pymhv K2tEbhKKM3vC2JX1drX0fHZ889VPPC11sW/njl2KR+P3QQVRW7RILcOy11nrz6zGOEbGPq9lPI5 E5Z4eiklfAxD37eKS0dNqbV+Uyg/KODC6wejFPC1cBFMIxg6Wau3ztnEZF3+PWB6io1czRvZQ9I BqScuSfYLbpU2nV0gHaw== X-Received: by 2002:a05:6a00:1990:b0:847:8c6d:2f14 with SMTP id d2e1a72fcca58-8487075aa21mr4562202b3a.31.1783716878973; Fri, 10 Jul 2026 13:54:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 34/51] target/s390x: Use CPUBreakpoint arg in breakpoint_handler Date: Fri, 10 Jul 2026 13:53:44 -0700 Message-ID: <20260710205401.836304-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717076650158500 Content-Type: text/plain; charset="utf-8" We no longer need to test for BP_CPU, or clear watchpoint_hit. Signed-off-by: Richard Henderson --- target/s390x/tcg/debug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index 58d9cc6e79..ef0d953e01 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -52,9 +52,9 @@ void s390_cpu_recompute_watchpoints(CPUState *cs) void s390x_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) { CPUS390XState *env =3D cpu_env(cs); - CPUBreakpoint *wp_hit =3D cs->watchpoint_hit; =20 - if (wp_hit && wp_hit->flags & BP_CPU) { + if (hit->flags & BP_MEM_ACCESS) { + /* watchpoint */ /* * FIXME: When the storage-alteration-space control bit is set, * the exception should only be triggered if the memory access @@ -62,7 +62,6 @@ void s390x_cpu_debug_excp_handler(CPUState *cs, CPUBreakp= oint *hit) * bit set. We have no way to detect that with the current * watchpoint code. */ - cs->watchpoint_hit =3D NULL; =20 env->per_address =3D env->psw.addr; env->per_perc_atmid |=3D PER_CODE_EVENT_STORE | get_per_atmid(env); --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717183; cv=none; d=zohomail.com; s=zohoarc; b=VM9gqYTrValPDiP4GpwaInrtarQ8c6aBZEUvCsIt0Ei+dGVFBxHp8GuK+RGHTvsjYAy+4au++irXTncp08uNDr9CkunIfWoeKNsqkeXn6pn4QQHzBCn3/9ViE1dtOD/1tJ80f4c6Qai23F/mEdjoABAStbG4pxI5Ton0FuFTDMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717183; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zEoEbldckN16OhTsR6Zaa+zbm5X/cyDm4W7LiW18RHY=; b=RLBD6MQ+BnqbWw9bbn8I6k7dUHQiuhI36Z+OYxuHJojxFATMODumyEStWs4vytBNPexIUXGv5+qtWXKTx/3OQ0aRB0WZ10XasmDq1TJApRUDGz9+Xns56csnqR44RWMveNoy1MRtChkGlNn6pncCynBT54kroHHuDtVDAuslApI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717182908220.77291787361492; Fri, 10 Jul 2026 13:59:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHF-00057L-Lf; Fri, 10 Jul 2026 16:56:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFP-00021l-2h for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:59 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIF8-0000zY-BU for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:54:58 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-845c92bc464so1259845b3a.2 for ; Fri, 10 Jul 2026 13:54:41 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716881; x=1784321681; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zEoEbldckN16OhTsR6Zaa+zbm5X/cyDm4W7LiW18RHY=; b=VYTlhnARxmlw5k8I3xYPU9OMaokf2nMP227KKz4mvQtjTPuaZmxTavwzU/lvsW4Kb1 9LK0EHeCA9Y92HNseFLkfvsazTlZ2UdzGwH9hzVtG8LByl0AphQ6G1FvzQnGnHXSMX2r Lx8ZTkObBNiLhtOYZ5XcbtfxKAEzi8Em+5XQjR+5dJTrvCoR/8YQbmgpnBHphb9JYwlE 8iiqOWTyKQCulMjVFOy6o+45sB3lyLrS8P1M5zV4w7UL6e9w+hB87XOp0OnB7bUIziKm bu5wzCC+oQ/CMoiNlFarSsLLaQXjvjpCHUaDa9zepd16vxVVHLq/n1xPsriOdLDy1L8Q q7Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716881; x=1784321681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zEoEbldckN16OhTsR6Zaa+zbm5X/cyDm4W7LiW18RHY=; b=JxupJS/h48k0C7a7VY+lEvUZyvKsT0lNZ8lh86ION6pO9Bo3toem+RuAqXSHtoMqpQ MxCumvDWGtx5qT78IwJ4pmIWFuH9lbVvbxIX7rnxrggThLn1O5eGcChpzJMezMB2iKyb 40eUy2lm+04EyNlMb0PpSyy6YjgbU41ScLsB4X/kY/nlTtZse06g6TMNjYT8zAGhzOFA Cug4tNDI2SFYVLFN+DME367tu+pFFNbgKeGCx4B51pr1n1qz3pcFuAUkgis0r57OYG0y iLAsElliKeSctKS0dy6kfS//wMTJBfw5yGiwfm7qMEXwPmsm2guXYwUw6tveqCLHue/l 9hVg== X-Gm-Message-State: AOJu0YxUnUSHzfp6VIksUVjoo+iSDKXluYkynjy4VD9MnA3yho793v9c AHH0bmBj2y+E5cVGiA/nWC303Vp5tKFOGqz8435ekg3mq7gEEATfdnOyu98hadDNI33Ym3FIaV7 KyhM3 X-Gm-Gg: AfdE7cmT4LqFggow1v7iw0yYWVy/rnjIMVQ1iVM0ZuIjhr7ZuudqaBfKlPoqbLgh3v0 1meo9F6QoCTDuO7imuUPpU/2/gjB2NwOV9z1jbbcwEgs9OvHxnNyP4VYka0bq+TzEABc5x/s48w rKmczdOA6ekIoUodpJRITp1308m+gllFC/PgcYGC3wf9oXcI1fjVVzbDHyFvmwkGTCWh7wcy5Ro no18xJARbGh39o8rY9r8e1z97Set9xzrOiELlw5V/AoH/XeBIb1UyuGZfGecIvOEuQF/UQKeGNL G45sfJu+EddfMffrjEaFwPo/AMRd0AqRIpEdY7zh2WKq9qVkRbPGr9cnEleL54QDkdhPkAjbYpY DzW/qAUMphOt9nb6k69e3Q9I8O9ofS7o+wFq2AMo276UgxTodwrULxfWRf19SiPwomupDSnDcnU qYJUu7CDrDhWvX3N9dow== X-Received: by 2002:a05:6a00:3691:b0:848:5935:2e11 with SMTP id d2e1a72fcca58-848896b9a7cmr617803b3a.48.1783716880557; Fri, 10 Jul 2026 13:54:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 35/51] target/riscv: Simplify riscv_cpu_debug_excp_handler Date: Fri, 10 Jul 2026 13:53:45 -0700 Message-ID: <20260710205401.836304-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717185208158500 Content-Type: text/plain; charset="utf-8" We no longer need to test for BP_CPU. Signed-off-by: Richard Henderson --- target/riscv/debug.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index a8429778f6..994a77fd31 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -919,15 +919,7 @@ void riscv_cpu_debug_excp_handler(CPUState *cs, CPUBre= akpoint *hit) RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; =20 - if (cs->watchpoint_hit) { - if (cs->watchpoint_hit->flags & BP_CPU) { - do_trigger_action(env, DBG_ACTION_BP); - } - } else { - if (cpu_breakpoint_test(cs, env->pc, BP_CPU)) { - do_trigger_action(env, DBG_ACTION_BP); - } - } + do_trigger_action(env, DBG_ACTION_BP); } =20 bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717457; cv=none; d=zohomail.com; s=zohoarc; b=ML7sniw0afVtHj0/yCD7WRbF0DobLIIJZOcmH+pHHbLxuBZ4fQzh770ZOqtP1WC2+/NAFDw2pUJy0Q6LspstErveN4G4CFsJupZPuKMpoYmEYuBnz6bq2OQue3TyDMA+7xxaF5g19/6IoFZukPe7bNeuefpQRf/8anNz0qxxTp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717457; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Lp+19HN1hDJRD/nyQTZDKaLa3PwvYZGSdAI5w9aXD2A=; b=jP8gPLVap6qBxQWkcijAv41EE8vaK7kAxCNEacDIosjtuiZ6F9c1to+aBc/9pnem1t/IuMwJirHyNyAsq7Rjep5BKmYxKaj+tKxTJW2ssb18FdEw3DqO/SbCgIwa7iOSswYqNCqtWzf7hehMoHwCrBHwYbUCURPJD8jVXhj8S0w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717457490568.1285630791165; Fri, 10 Jul 2026 14:04:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHH-0005Ju-Co; Fri, 10 Jul 2026 16:56:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFa-0002Nd-Jb for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:12 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIFK-00010X-L3 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:10 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-8485b358552so1514299b3a.2 for ; Fri, 10 Jul 2026 13:54:42 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716881; x=1784321681; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Lp+19HN1hDJRD/nyQTZDKaLa3PwvYZGSdAI5w9aXD2A=; b=NRm5vutXosn0qEulf6s2AP8yiv/XvKe89Rh0B2V3gMDw+vAV+qEpzwZqB8udydLASm KRITViG9NOfHn6IdT1eUbWd6BVzrupMPzQIgLqeT5VhSjCdsHOKxke/5F1AM55d9mecv HfjyOrU5Io242Kf2uxaTkJm1/jiOIfgnSQ1HR1Lig/dzTkEM7053Royqa51opk0AmSDA OevP2h+hDK3W4Jn2F5KiGhBeVrjaiCo/alaVALMMCyaA2JeSYOBloGNSNqYjAlzTXpkW 4LU7wg+uWtpFECG/IpSrfDH/KdZz/2EV8m/IDGRLRkGwsu3eRwcB5/RfCYmAVwuYHcdP I9kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716881; x=1784321681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Lp+19HN1hDJRD/nyQTZDKaLa3PwvYZGSdAI5w9aXD2A=; b=llXtZbM7r1dL1QZrywlqDVHKqf/EtaUNJmqd8eehQeekLuULa22HrYKjFDjGL2Guet +3/HN9/5StLZmP37n1WOEoF4tPMBqWJeqmpvd7c9/1P1NuZsK6LEt4lPSmo+UtUuW/fV S0ZgmzZo1Bu27Ds66Or3IA7UhBcnkmuY0dseoLlpGgTaJUxnS6r9gdtgJ4TPJ8ruVhVv SXl4ySW2IjMygC5MLhl6XN1+uyAyRecG2IQsw0PHzx2n0BHBJQRn4SWeWCz922KLP/o/ FFlfVJBcbhzsO/Qy0qkK9/gsLZ4ZB/BhWK2fjCZooOpnBO2Mwlo8UGS3nkOKGuzusHJZ pP3Q== X-Gm-Message-State: AOJu0YykmyG+cz6zKg6fgKiWnrMjxcLiTcXvQB2gsZf/I+7xr3yPD8+O 3ABBaYVMb/vJIovthiN52J4/3VulXaMBavzBOXwPwFUTeQssZP0Ys9GL/0wLsctBj9tiJ9I8WrM pKYw2 X-Gm-Gg: AfdE7ck3PbpLClN2/U47sz74tNzq3orIW2ZN7hXnXQmpLMe1jkW5ZMzhghiCKVSIxtQ qZuGCSi+eBi0bIuE8Hna1bo+T1MtlCLvzzwU5flLjCjbd0dMtGJNjTpiwyxTeLKiNhL5IL90uO8 G0hD2olK9TFPZVHWMtPDlRHjqeqJN8pXNzeP8I/sskxHsqcwiNuzWWR6d2biCMJSRVomXZT2mQy Vg3zowBynRSrUc6SIfUueeNk2bbNu29l/kYIIB90T78vjgEBk3IMd2N94XzNLu61q/rCWCEEvkV cFs19gHZu5cPD5nn5wF6BbjYKnXmztgNwrbT1+nEnPkeNhwmYmZSGFxQlu+lLaBHv+EvL2UgVEU 8xFGWmXkWyh6V1fYS8/cVEy4s97e+yePKxaZ96r1O2MZWBdPO/iLqmYcS7Mm/im3W5th1nVVXMc rQHGfgiy6jHTlzISvZAQ== X-Received: by 2002:a05:6a00:1256:b0:847:904c:8452 with SMTP id d2e1a72fcca58-8488986fb9emr455784b3a.38.1783716881331; Fri, 10 Jul 2026 13:54:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 36/51] target/riscv: Set badaddr in riscv_cpu_debug_excp_handler Date: Fri, 10 Jul 2026 13:53:46 -0700 Message-ID: <20260710205401.836304-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717459300158500 Content-Type: text/plain; charset="utf-8" Setting badaddr in riscv_cpu_debug_check_breakpoint was a minor buglet as that function should only be testing if the breakpoint should trigger. Signed-off-by: Richard Henderson --- target/riscv/cpu_helper.c | 4 ---- target/riscv/debug.c | 8 ++------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index c318dcd633..f9556c04a5 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -2373,10 +2373,6 @@ void riscv_cpu_do_interrupt(CPUState *cs) break; case RISCV_EXCP_BREAKPOINT: tval =3D env->badaddr; - if (cs->watchpoint_hit) { - tval =3D cs->watchpoint_hit->hitaddr; - cs->watchpoint_hit =3D NULL; - } break; case RISCV_EXCP_SW_CHECK: tval =3D env->sw_check_code; diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 994a77fd31..f4689519d8 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -919,6 +919,7 @@ void riscv_cpu_debug_excp_handler(CPUState *cs, CPUBrea= kpoint *hit) RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; =20 + env->badaddr =3D hit->hitaddr; do_trigger_action(env, DBG_ACTION_BP); } =20 @@ -929,12 +930,7 @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CP= UBreakpoint *bp) int i =3D bp->id; trigger_type_t trigger_type =3D get_trigger_type(env, i); =20 - if (trigger_common_match(env, trigger_type, i)) { - env->badaddr =3D env->tdata2[i]; - return true; - } - - return false; + return trigger_common_match(env, trigger_type, i); } =20 bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717282985417.7773777080265; Fri, 10 Jul 2026 14:01:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHJ-0005Zh-3c; Fri, 10 Jul 2026 16:56:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFS-00028j-Dl for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:04 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIFA-000110-LW for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:01 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-8454160043aso1457569b3a.3 for ; Fri, 10 Jul 2026 13:54:43 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716882; x=1784321682; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zOV8aDWsylX+EDtzAiDKgexQev8L9FW7a3sm5qjjMIQ=; b=vowvtVoUdq0rdIQS1+zi4RFPW9DzyNJAdGXuoDwTiUWOS7sGyvbKKO6msBNY2bbqAm fCrp2FRRcu45WECOpYMwpDZvisWSrfjantcgHopE3TI1o3gGjKssdhGWjXAOe/MlwbI5 sQe3wmOHTIFVUhcCw72aeOaK2q3vbCNuk5Oha51R6uHfCEPXgGuoDYa9PcS2/ofB4KTK o7EKSqJX6FaENH+iPdZf10Haen9KpaMZucDzmOzob8WSYtfGGzj/c5jbuU35RwniWiB4 YowlbV9/0G6iJIYq2OVb1TDLXPQJJkVevvUYLOLFJswOf1T7DMjMcV+yLXjStx+aUpq+ mj0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716882; x=1784321682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zOV8aDWsylX+EDtzAiDKgexQev8L9FW7a3sm5qjjMIQ=; b=avE//YzrZR11/KhTXxuaaeYSV5pQwAwoDskhA5AC9C78hU6Nuhwg2ny07DS9fX8zTW PablsSRMKuTb137zMgEkZ2ZuxQDMRGJ0gfVw1aRPcVSJHVOs6NY+X3vMyl1UqfDJHWGf 1WWny1i3oCEGwSQ7h8e22oMqvoCFsXvVxDXsGcYq/9W7wIIBLZI/Yp0wUrNuEk8J/v/7 mT0IncPa72gmqwKlw+LhpOLJDnwAyNamDmSfGQ4/+JEjmSq+W1eC1KvBQNPh35ytsAPs Vx6HLl4tDYkU+6S334HhHrj/EMrN607sxpwwnkPsjvaHZ3xPIvvpwvtlXU1GBeJKeUCs AkEQ== X-Gm-Message-State: AOJu0Yz4pPnQcL2KfO1ihBzLl6SH9FVMgl7BF7fuK5aCvsbEHmjc5K3r 5fnKm8O+NrglOK6//rN/k5hpwd60sxKnvfd2du5rt1yWGLUqaoJ+XhPU/0x12E5YMeqQbX87jRH oED/U X-Gm-Gg: AfdE7ckzM0zPOAdWzc6lzMCueVJ44rvPBx87dyCXiptf7kTq+uF9OCiJvY8p1/vASD6 oth5ii2V+WTohLofNTZXlyza0MthFVRYoLdUUv4CA74Abl4vXrcrhd8u1eerPZrzT+CDPc8kxgU 735cRmKbtv4hRwkC8zOg+xj36mO9TVGmvu1SYuB+BAkWanMb1SwkSxm98TUJ5pG6yIkzAGDrfjm ptJ38bdcm/b/P3QWyNKYiVXWMPwXzV5T46JmpjFHnciZXC7zY/pwHrs+puvGVaFF9GutquXRiUp 2BbLPnjFjBqSf4TbEc2zR3OXxC4JeTeQTSURJ/6li9RGP0879EPECLXqpL+Cg4YU06XR3qJulrv COvj1glrlkLQ4T7y/6J+Q7DCIKkX2y9AY85qZtlFGfrACqCKZaGxuC+jTsgnwZR1tqXSImlPfJp 8UzHPkpJcUVbu+2T2dUg== X-Received: by 2002:a05:6a00:4298:b0:848:5d9b:6885 with SMTP id d2e1a72fcca58-848897b70a6mr521424b3a.77.1783716882145; Fri, 10 Jul 2026 13:54:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 37/51] target/riscv: Merge riscv_cpu_debug_check_{break, watch}point Date: Fri, 10 Jul 2026 13:53:47 -0700 Message-ID: <20260710205401.836304-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1783717284152158500 Content-Type: text/plain; charset="utf-8" These functions are identical. Rename to riscv_cpu_debug_check_bp_wp and install in both target hooks. Signed-off-by: Richard Henderson --- target/riscv/debug.h | 3 +-- target/riscv/debug.c | 12 +----------- target/riscv/tcg/tcg-cpu.c | 4 ++-- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/target/riscv/debug.h b/target/riscv/debug.h index 540835f2d0..fbe6898718 100644 --- a/target/riscv/debug.h +++ b/target/riscv/debug.h @@ -144,8 +144,7 @@ void tdata_csr_write(CPURISCVState *env, int tdata_inde= x, target_ulong val); target_ulong tinfo_csr_read(CPURISCVState *env); =20 void riscv_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit); -bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); -bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp); +bool riscv_cpu_debug_check_bp_wp(CPUState *cs, CPUBreakpoint *bp); =20 void riscv_trigger_realize(CPURISCVState *env); void riscv_trigger_unrealize(CPURISCVState *env); diff --git a/target/riscv/debug.c b/target/riscv/debug.c index f4689519d8..803418f390 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -923,7 +923,7 @@ void riscv_cpu_debug_excp_handler(CPUState *cs, CPUBrea= kpoint *hit) do_trigger_action(env, DBG_ACTION_BP); } =20 -bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp) +bool riscv_cpu_debug_check_bp_wp(CPUState *cs, CPUBreakpoint *bp) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; @@ -933,16 +933,6 @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs, CP= UBreakpoint *bp) return trigger_common_match(env, trigger_type, i); } =20 -bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp) -{ - RISCVCPU *cpu =3D RISCV_CPU(cs); - CPURISCVState *env =3D &cpu->env; - int i =3D wp->id; - trigger_type_t trigger_type =3D get_trigger_type(env, i); - - return trigger_common_match(env, trigger_type, i); -} - void riscv_trigger_realize(CPURISCVState *env) { int i; diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index b73e3e9dd4..3701aa6c94 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -292,8 +292,8 @@ const TCGCPUOps riscv_tcg_ops =3D { .do_transaction_failed =3D riscv_cpu_do_transaction_failed, .do_unaligned_access =3D riscv_cpu_do_unaligned_access, .debug_excp_handler =3D riscv_cpu_debug_excp_handler, - .debug_check_breakpoint =3D riscv_cpu_debug_check_breakpoint, - .debug_check_watchpoint =3D riscv_cpu_debug_check_watchpoint, + .debug_check_breakpoint =3D riscv_cpu_debug_check_bp_wp, + .debug_check_watchpoint =3D riscv_cpu_debug_check_bp_wp, #endif /* !CONFIG_USER_ONLY */ }; =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717295; cv=none; d=zohomail.com; s=zohoarc; b=Z9vwjYwTNBMAGu8h4nCD1Gdc0jOu+gnBgzqSk++i/UEzRhhHVJLQXnqlg2YLwb8wRU66wgxImAXWWwxFGvuMu5aEtktHVUar6hQ93b6W4XssV8HvPJc41om5VbDPaN4+wE4VN2zHJiaUh2J5QnuthsUwxgyBhaAAIA1damEz8lE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717295; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Oi77c4t6mTRvDij0KOLon4zdhMhjLviMYDkRz5tIy7Q=; b=QE77CVs72SywJr3T/ZVu72BIUE1/lbhWzjjvFWx7fgI1NPGBSIUe4XtzHGAbbaHoTQmCvHqfAJsw7xessYwAZfw1wUH5Ga3eDRH/z9XZXv5Pqy15mHifdw4vFq5D3rD2y1QCeM91xe3eFr01FC3VMyZtlH1tmFw4/GYo1b9zPRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717295692498.1444763442737; Fri, 10 Jul 2026 14:01:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHI-0005T4-8W; Fri, 10 Jul 2026 16:56:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFR-00026S-FL for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:03 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIFA-00011T-JN for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:00 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-84861fc51f5so1243893b3a.1 for ; Fri, 10 Jul 2026 13:54:44 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716883; x=1784321683; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Oi77c4t6mTRvDij0KOLon4zdhMhjLviMYDkRz5tIy7Q=; b=xMG8b3H/EZ+V7aRc+e50ajp7Hx3dnazQx79ChhbiMrrL4KMw0H/3jRAMLHPJYxRtBy 3VwlFkyRpmrHIZMlCWJP85wlzn+kuI8iCAhm36Zxjsa7FrDgfvp0H4fKpz14EbD3/NQU n9lMeiXHsCX4m9RY/n68MDV7yOriYd/4hfY+kXGQzC9Gdby7xZW3M2PUphsU6hDzARWU dsdmfWDQnE9FGI6gQdhvoqNzSYPIpm9rehj+776KsJqguDk16Zw1uDtA6xQs1qr9hwER XECmx2xZSuYN7z/8zWVukspJsLcih9rYmp62Xd+JhdLVY8aoJtBkZ7tKbr2HvKpCOO7I 9ekQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716883; x=1784321683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Oi77c4t6mTRvDij0KOLon4zdhMhjLviMYDkRz5tIy7Q=; b=D7puYDwVfkfzJkKHdFH5Rbv+4KWLFIRe7hsR6Rbsb2ibTxj74UkfZ2yXNTpqBKNSPq 7fjfGIl/aVNcQYaZyLORsMPkv8DgFBHV5zzaLQkaE2fHE3C8FbzeT2SjqITyJfip0brv jzIUMIZ0BMJz2Sx5fB1HoMvc380o4yJXOXQoHwK9MzfgWDDgCcPEKd/0uqMvMIKuh2dt gRgW8OqLSZNZgqNegad7AVJEkcrRxxcuBv9ZNq+MYsWDA51qqyODXCyV8kXEAf6JaAYO efAqG6eJkimkBrLxpkODcTMq95zoZSuCpGA6TAwLQPCT9a57PUOg6w6qRUoppnH0jJyw 6J0Q== X-Gm-Message-State: AOJu0YzYHt1tMLCbYrJ0jg6PVuV+sGnB6+nuxNc9WIcxHnRoJgi4oKE3 5zHqDjUo/B3FMynkpLj0UWIgfqVz2rrL8c+5iLznZBfBgchF6dc1tUf73Tmsl+DvLRSU9nXF+BY oruDA X-Gm-Gg: AfdE7ckyVX2HQcRXOHp8OeS4caBmtE1cEUAbXw5l02mQRbfhgsz3KHDqpvad1jCR1mB zM48SOWo2g5A7CY0s+LtPvzbjX6Xlk9Ny59ftx3LHIsLwE+vGl0vBfZ7xmNrvu8y09s+hhiBGsL WMmV4XE90n8m+n2PP5IDiHEzlG0g6NJiaW55dupH6tFENl2YJ9rcvt07il1Js1Kt37Ya7vKXB+H REH8Cq1kzK9b/FDORCtEZfXfLVXOt72SPGcOV+pZn5ukWvBo2SFV40jfoT7r3ZvhKaZrmd1BVeD whyt1Uw/N1R9N7mrPJXFH9I/eZswjKYhBRvvFxuihKjKfS8Ek3isqFQZ3IK5wd0/pHTWyo72FcK X4nRwwU4HW/C4ey0GKNyi+TBiH2x6S9W8SutpRSmH+gaMRxQNG0oW8ItlMcA6WpzzO6cTr2QpLY 1cJoHEW/MM+q2b4y8JhA== X-Received: by 2002:a05:6a00:94f5:b0:82f:2b0:2809 with SMTP id d2e1a72fcca58-84889637281mr545510b3a.1.1783716882973; Fri, 10 Jul 2026 13:54:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 38/51] target/xtensa: Restrict xtensa_breakpoint_handler to system mode Date: Fri, 10 Jul 2026 13:53:48 -0700 Message-ID: <20260710205401.836304-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717296136158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/xtensa/cpu.h | 2 +- target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 663ee23dc4..119a0b8187 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -592,6 +592,7 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwa= ddr physaddr, vaddr addr, MemTxResult response, uintptr_t reta= ddr); hwaddr xtensa_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); bool xtensa_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); +void xtensa_breakpoint_handler(CPUState *cs, CPUBreakpoint *hit); #endif void xtensa_cpu_dump_state(CPUState *cpu, FILE *f, int flags); void xtensa_count_regs(const XtensaConfig *config, @@ -621,7 +622,6 @@ void xtensa_translate_init(void); void xtensa_translate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, vaddr pc, void *host_pc); void **xtensa_get_regfile_by_name(const char *name, int entries, int bits); -void xtensa_breakpoint_handler(CPUState *cs, CPUBreakpoint *hit); void xtensa_register_core(XtensaConfigList *node); void xtensa_sim_open_console(Chardev *chr); void check_interrupts(CPUXtensaState *s); diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 2015a4e3d0..eb6758b694 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -316,7 +316,6 @@ static const TCGCPUOps xtensa_tcg_ops =3D { =20 .initialize =3D xtensa_translate_init, .translate_code =3D xtensa_translate_code, - .debug_excp_handler =3D xtensa_breakpoint_handler, .get_tb_cpu_state =3D xtensa_get_tb_cpu_state, .restore_state_to_opc =3D xtensa_restore_state_to_opc, .mmu_index =3D xtensa_cpu_mmu_index, @@ -331,6 +330,7 @@ static const TCGCPUOps xtensa_tcg_ops =3D { .do_transaction_failed =3D xtensa_cpu_do_transaction_failed, .do_unaligned_access =3D xtensa_cpu_do_unaligned_access, .debug_check_breakpoint =3D xtensa_debug_check_breakpoint, + .debug_excp_handler =3D xtensa_breakpoint_handler, #endif /* !CONFIG_USER_ONLY */ }; =20 diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 02627ada7c..aa012068de 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -206,6 +206,7 @@ void xtensa_register_core(XtensaConfigList *node) g_free((gpointer)type.name); } =20 +#ifndef CONFIG_USER_ONLY static uint32_t check_hw_breakpoints(CPUXtensaState *env) { unsigned i; @@ -249,7 +250,6 @@ void xtensa_breakpoint_handler(CPUState *cs, CPUBreakpo= int *hit) } } =20 -#ifndef CONFIG_USER_ONLY void xtensa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717405; cv=none; d=zohomail.com; s=zohoarc; b=es8yzON6vk3JuWU/4thLWlFGZvGt1buToj/IR8e4CIV5bgDQZC7u1c/+t70d/FibfiduKMViol+WOR5Qb6S/MR8JxK+lVrFLG+smOA5K20IGM44BnJ5485wQpw3jR3cvH8sOSFh+JECqI/b5Atjb1NINQMUfvHaLeLCqk9qwoBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717405; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cta3/Q1WePeftyAZ1tIJUWYuQmdzSHeLF7F4WBnHI1o=; b=jWlxF9nWgkTapf7VtKcNVISz+M3ZJdgaNEAdA//1XHnpT9B9IIlgXV3h16KYKs7Rrc76ahgSaguIyhyeNlYvyBwGavKUu+g85W5ZhvVO/zY2FtaDE6wSCUcs1BJ6QyghOHGWJzGLjPFCZnOmyIGX0YLDrBjWoSfmkOCrq2OKPT4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717405663731.1885673870662; Fri, 10 Jul 2026 14:03:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIHR-00063Q-2a; Fri, 10 Jul 2026 16:57:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIFb-0002Ng-7Q for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:13 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIFL-00011r-Gc for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:55:10 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-848595b338cso1566883b3a.0 for ; Fri, 10 Jul 2026 13:54:44 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d76106sm10780574b3a.40.2026.07.10.13.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783716884; x=1784321684; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=cta3/Q1WePeftyAZ1tIJUWYuQmdzSHeLF7F4WBnHI1o=; b=kL3e8RQT2PuGtHex3zHc0QwC112sBgvFQ9xtOa/jDPYMHyLmSsh6INZ0NiSZ9dyQjX XtzMHykIdG9+bsmyku3hPWPs/3EiGgBHVOgXCcGd+h1T0Lr6I0K4Mt4yn25+w3isr5+H d3DCFF0HDUuaM082pxZn5T1zyG/LbRiAjcLGAxDeTiRCYqsLT9YBGiHlP5nvD8v+82vl 8C4e/ZwcMDshyukvCvsbjHPSs+cMFuqYfvACsr26BESF4K5N7epRAXnAAgExex0Gs88e VipWlhX+sPKy2PY303JGatHZO/tYP4CgzNVjhJadj2c6jSwG4OMDiEL7EOWo8lby2kEj glxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783716884; x=1784321684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=cta3/Q1WePeftyAZ1tIJUWYuQmdzSHeLF7F4WBnHI1o=; b=sS2p0e22Q2onnpPg5zsN1534yT5A2gMkZbHFXF7GLqGfTc+CHVaucYlP2JK2MN12nZ EM3MqQGUZZEtSAvi9Tkv10RWtqdZqNsdjqHcpHSWKKbr8rWyMWxZeeYQMDuq8/6Ip47w p5+vNsshfLOPBfdxMIPP7S5F1MW3eSijvrHsfOutKivCD0UbKWGnWkDOaHB0sA0n5QJX GVg5vDMaLVq4NsQ9AVkrvyaQhGZnCwvQS18jqdwgh9ze0JSsRXuCcj0N1DwAOILas5Cp ypw5Usf7ag1lZzMA3yyNQsaj32CJmrB23xyvIc8lLn65RkWnQfe46aaxSQpEKnRNBC4r F6Mw== X-Gm-Message-State: AOJu0YyUQP1RGb2hLGFxhlQp1oXuWpQl2SRFb4uXl6Df9aiP16R9S3eL hm5mDBaaBMcHprP47op3H9jBe4nho+jUl7M/NzerrqV9IFIf+gjviArVOv8yaMUeP8LjSeE273j LhOqT X-Gm-Gg: AfdE7clcLueTtsLfeQ5A7dbBl1cVbILACLKX/Ot69koaCuhrcfb3YXvhoL7OhAk/Ryn BAcsNnIzF2QEoQxpYccshaFUiW78pmF5qkcBesw+5vWve6d6iadBHOGak0p5VYchWYnCKzA6rIW zVLV3do5DlbIuCs/XE6TpjnCatY34RSur0j0o92e3h3/rmYpCa1VZ5OkHITlRzx28jFZx3baFFN yEoP6grkETG6Fke2GqZ1pt2tPmcCoyPhZgEwxeAwXghHqzNev9QwZbydCEDO08SqCj+uJi+KNV4 il8yN+uEWObrM/D0MZcP7fOEeo35DmOxSn/JYIxh2o+WaOcGK7TrZB/cpyf7FjH9mgUM4DlxfNI Qm+s7JAbJ8TXn2xtHtkNRdR85/Jsm9Zk1Ch+lWzS52FOczICpEgTtLW1W1Hco921PV423wFYL6R pi8GBdXsKDp82CPmWmbg== X-Received: by 2002:a05:6a00:bd91:b0:848:731a:fa55 with SMTP id d2e1a72fcca58-8488974b0fdmr494515b3a.48.1783716883761; Fri, 10 Jul 2026 13:54:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 39/51] target/xtensa: Rename xtensa_breakpoint_handler Date: Fri, 10 Jul 2026 13:53:49 -0700 Message-ID: <20260710205401.836304-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717406908158500 Content-Type: text/plain; charset="utf-8" Rename to xtensa_cpu_debug_excp_handler, since it also handles watchpoints, and that's the name of the tcg_ops cpu hook. Signed-off-by: Richard Henderson --- target/xtensa/cpu.h | 2 +- target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 119a0b8187..928d300772 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -592,7 +592,7 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwa= ddr physaddr, vaddr addr, MemTxResult response, uintptr_t reta= ddr); hwaddr xtensa_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); bool xtensa_debug_check_breakpoint(CPUState *cs, CPUBreakpoint *bp); -void xtensa_breakpoint_handler(CPUState *cs, CPUBreakpoint *hit); +void xtensa_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit); #endif void xtensa_cpu_dump_state(CPUState *cpu, FILE *f, int flags); void xtensa_count_regs(const XtensaConfig *config, diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index eb6758b694..82b7493ff4 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -330,7 +330,7 @@ static const TCGCPUOps xtensa_tcg_ops =3D { .do_transaction_failed =3D xtensa_cpu_do_transaction_failed, .do_unaligned_access =3D xtensa_cpu_do_unaligned_access, .debug_check_breakpoint =3D xtensa_debug_check_breakpoint, - .debug_excp_handler =3D xtensa_breakpoint_handler, + .debug_excp_handler =3D xtensa_cpu_debug_excp_handler, #endif /* !CONFIG_USER_ONLY */ }; =20 diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index aa012068de..7643e97b2c 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -220,7 +220,7 @@ static uint32_t check_hw_breakpoints(CPUXtensaState *en= v) return 0; } =20 -void xtensa_breakpoint_handler(CPUState *cs, CPUBreakpoint *hit) +void xtensa_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) { CPUXtensaState *env =3D cpu_env(cs); =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717447; cv=none; d=zohomail.com; s=zohoarc; b=aYBg10CFPkGwkcQcC2i5rZRnOK+p1z9R3Bzy9XUDwOjT7bOH7HqeAEBGA8dpsPnMXpUMeP5U8KYo2Xubk7VAYa1QkoR4r/pPjcxaAtufgbFjpVbJI04XYL1EV6Zyaq3HxahbpNFRRdfg28GN1opvohtrJtl5fWFXqFpQUz/XUd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717447; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9Z8VyrlNOS3AtUzlV7fFAEANc3KY/TwCjUicBVUQopA=; b=UZHS9/OXthc7EcFaYwPAzTofaC0kxQ0g39ovI1xLHueAkTh6yELHV5kNf9IGQIrVU47o8IlECDgJRw4bSjUrUGSWI1ZM4AISEAh2hMoeqDY0/6+DfNN8l55UyLntez/MAmYxG38Ah2e3CCwPkYc5ap/+feGXMIB0KEJeSO6TAdA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717447610906.564178251839; Fri, 10 Jul 2026 14:04:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIIE-0000Nj-3P; Fri, 10 Jul 2026 16:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIA-00009H-OF for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:50 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiII6-0001r4-Ld for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:50 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-3847e8b0f3aso1241939a91.3 for ; Fri, 10 Jul 2026 13:57:46 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717065; x=1784321865; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9Z8VyrlNOS3AtUzlV7fFAEANc3KY/TwCjUicBVUQopA=; b=NCElr68YS9piSHtJUMjfvpqYzpoHGLcEBEJLrndO+kjGtoPbbclWiPUxqUwYl04lFw pptH5MGygnufRYYyuZOrPYQuWNA+uDuOVQrjWRWbcatrOUg0gQj1iljOvWDAcV+yiOJQ g8pxlbQXCtAfimrWOJXCJX7SMMfGPc2BSJMqRjpe/s8vsaldXMF8+6BkF5amg4ipeITu gAmR1GHTX7Cn3EQpmaqMCZ0WG1jXMdT7gRwyAPs+5jGpv3nu89V9eSjEEiT43IyHYU4V aMM/1ZRbqPIDlFalf28tNDhtgTf0k8gb1/Bu7TLHxdEA+EIZrLNncKF/iiD6yJXjVr1P 4V/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717065; x=1784321865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=9Z8VyrlNOS3AtUzlV7fFAEANc3KY/TwCjUicBVUQopA=; b=bketuPXb5KHYtX/cQl7wMkhzInNl/NghQdIq7O3jw+zyZyuKdxTjwZ5LPga33BQ2e5 X6XmEt2AkCTL/2WXoxDrycrd2crKlzxJr8FOzO4Be9R5Ubpla4Gju77fC+czFnJl9nm0 qm/4D4AW86V+Kw7wjE7qdUB/+EvjmGWsEKXEIGCTod+AvK99M68zxjKApeAwJsQy88Fz AUa8QFjNb1MuaVWG6DgM/TmRrp3M91niqQA1bs/UbiKhk6Rr+xdUGzyiRYlr+xEQASAf 62hxFuvdjQ1Vhv48jz7OImIFUQK2ZP3SemTi5EhX/NFles4ZPXVSeTQwqbi7brEPN4Gg wIEg== X-Gm-Message-State: AOJu0YxRjwmNuyHu0nYqkeJL+n6RqkqLMzO9w04fyNxxs6Q3AON1J1eH Nf1bjGhgaVwWSlNs4EIRIdVrpXvHuGZ+1A38HeybinWGJlLPcIhc6eC3EeqCsMvDlC+3BTCIgFA obUUI X-Gm-Gg: AfdE7cnLHvBsM5RDaj8BOSIMWk4OwDWSfcGXijxYMXmK81oeVFHT3d1cIKNEiOE3MXE n3xgok8+D/DON24zp/Gx39GOZngE8ZSjbQ8VzYxwyD0F7FeWtI0QYvP910TsR9FA1SJVqaB34QK uhYh/f6gfjsg/fLbxhkLVmo+AbnXu7SeKhbzSceTFnNpnw/jECd+xanDl5vapr8uD+G/qDtjlwk joyFX66M0rLqQTmDwZuslEUE+BX1pZe8401ADvUr70Hi9j9qH8cGR+iGM5+c5PqJ2v2SKSOkKrE gzHBlywRZX0W8vEZq29OOew3IVZAD1djUBl9ZajiLZd3MKsXb2cA6wwaFlCH6G4xFwi3vgj5j+5 bxP1FPWJssG5c7XGTUoQgOsHjPtUtnToIorojLRsaqZuI/b6XvDzqMDPffgrbn2XjejsPs0Ap1r WvLZelMNKuvjtTBpuyWg== X-Received: by 2002:a17:90b:2750:b0:387:df8f:1405 with SMTP id 98e67ed59e1d1-38dc77badd3mr469550a91.38.1783717065021; Fri, 10 Jul 2026 13:57:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 40/51] target/xtensa: Simplify xtensa_cpu_debug_excp_handler Date: Fri, 10 Jul 2026 13:53:50 -0700 Message-ID: <20260710205401.836304-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717449232158501 Content-Type: text/plain; charset="utf-8" No longer need to check BP_CPU. Use hit->id instead of a search over ndbreak. Unify the raising of the exception. Signed-off-by: Richard Henderson --- target/xtensa/helper.c | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 7643e97b2c..f66d0bff04 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -207,47 +207,26 @@ void xtensa_register_core(XtensaConfigList *node) } =20 #ifndef CONFIG_USER_ONLY -static uint32_t check_hw_breakpoints(CPUXtensaState *env) -{ - unsigned i; - - for (i =3D 0; i < env->config->ndbreak; ++i) { - if (env->cpu_watchpoint[i] && - env->cpu_watchpoint[i]->flags & BP_WATCHPOINT_HIT) { - return DEBUGCAUSE_DB | (i << DEBUGCAUSE_DBNUM_SHIFT); - } - } - return 0; -} - void xtensa_cpu_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) { CPUXtensaState *env =3D cpu_env(cs); + uint32_t cause; =20 - if (cs->watchpoint_hit) { - if (cs->watchpoint_hit->flags & BP_CPU) { - uint32_t cause; - - cs->watchpoint_hit =3D NULL; - cause =3D check_hw_breakpoints(env); - if (cause) { - debug_exception_env(env, cause); - } - cpu_loop_exit_noexc(cs); - } + if (hit->flags & BP_MEM_ACCESS) { + /* watchpoint */ + cause =3D DEBUGCAUSE_DB | (hit->id << DEBUGCAUSE_DBNUM_SHIFT); } else { - if (cpu_breakpoint_test(cs, env->pc, BP_GDB) - || !cpu_breakpoint_test(cs, env->pc, BP_CPU)) { - return; - } + /* breakpoint */ if (env->sregs[ICOUNT] =3D=3D 0xffffffff && xtensa_get_cintlevel(env) < env->sregs[ICOUNTLEVEL]) { - debug_exception_env(env, DEBUGCAUSE_IC); + cause =3D DEBUGCAUSE_IC; } else { - debug_exception_env(env, DEBUGCAUSE_IB); + cause =3D DEBUGCAUSE_IB; } - cpu_loop_exit_noexc(cs); } + + debug_exception_env(env, cause); + cpu_loop_exit_noexc(cs); } =20 void xtensa_cpu_do_unaligned_access(CPUState *cs, --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717333; cv=none; d=zohomail.com; s=zohoarc; b=g3G2F+dAydBuw0sgLnGe9eF3CNOm0G76xdI62w6MGAr8Pmm79+G/FOEvNf0S4j1VNL2jCutNu4UptEBMBuwepm2FCchqFLnZ96InhbPnT0zYCATmZuypjlqRpdJZAGIA6/bS+QJZ45IKm1VkbsAPtyKzj4mc3oPHkuh7zjcl5d0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717333; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YsP83YiTkmrY79bbOPi3SHoXW0ymWPjIg1hBoCFHly8=; b=OuYS+EqMpZj1RFGUxA7ojnMp4f+4F4DYjJHaEi26ksjzXpy2kcSAjM4xpPF8a5FRgOknrZm/BNRAZcrk3HXYQnr7Rb3EyRzHct6ZkHeWdh11NJdPtqyQPr9tvtFGaydzz4N3vUjRH2Z7f6hegQMv0+RiPyc2rsfE033m6BwG+/Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717333723599.5496289797346; Fri, 10 Jul 2026 14:02:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIIG-0000Xe-Ti; Fri, 10 Jul 2026 16:57:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIE-0000PL-Ij for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:54 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiII7-0001rZ-Gi for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:54 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2c7c61b5292so23391045ad.0 for ; Fri, 10 Jul 2026 13:57:46 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717066; x=1784321866; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=YsP83YiTkmrY79bbOPi3SHoXW0ymWPjIg1hBoCFHly8=; b=RdvFuxcTnbZ3OJWmJ+PaH7OfNa+Bfvu2HkBTv6hwbjHj3Mq28kQ78MUsORNEjl9a8C 2EqAeS9hehk/06H3lOR++sledon+jSPK7LVamiIHDXsjIEG7CDHvdIZzzTk9psXlR8Qd RnfvRmCyF7ApAL3LudSI+5J8Fb7UDa1jfR2ATMSabkXe6rr56LGtu5hXzPRnd6K8EG2v 2zUlfKidINd1G0rY32gqNR1P37aYgKlMO51Thuoh0ImzPHG889uyEVBLtW1Y7QwUKWDI 5h2VX4rPX1rF7kBUbdBT0nqZb+bVnhS+FAK0vJgnYJX7DVVAusuE4Ob4NCmaZusEgUrl 710A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717066; x=1784321866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=YsP83YiTkmrY79bbOPi3SHoXW0ymWPjIg1hBoCFHly8=; b=k1kR5yuBdeOBiZ92m6a8AR4YjSXJD0JfNmBR6+kEZWQ2rNz0kXtVXASIEslXdM+N0w iiS/OyWZUAhZb73kxbt4/C9R2hZaqQAb3HR1hWrnkHgjNFICbUpPGvKw5cFsXau2a++O 6/oY6yWXNOz81m/Id+81+YOeQ0R9xXbnAY56qCKd7BgTer68IVCLXjyMtZSza94xfXHd 8GUDfxHG2VqzbN9YQUuksERgBJqeqeFtMztKJPAFj4Gv+gN+LG7xomco/YpZ0QrXzaCl qjFUG3mfLxriPpEIHd4UEjVRNrkKvNQVO24FL9i5KPXDQU8dqVCiX+RrLv6bYuyr11Pr 3Ifg== X-Gm-Message-State: AOJu0YzJvu259p3amexKKvakpKp3N+e21uLqFRbqXc2Nce5ZAWGDeXrG Pyu9mxeW0Wt2xlGoPf12X/79N6Oldd4KkKOnsf7yv5ZGkL3DgRZAH47Qia/vhN3tBgnhSTUFgo9 p09cM X-Gm-Gg: AfdE7cnX8P36sHCRc6sVrmtoX+12FDpTsSg24wY/QZMDaz7pS8e7LVbLPvJeVbp1/bF A5Ws3sBbm8ZFYqAW1mAfzqkI61sDnyKXb9IUwkxYKtWaYy+A9vS8MRzc3GTR7pAlm0+VF9nu4oR mijz8uqet3h4b+mSKONApRDstlmX84fkCh9/FRq4LyMEk4kDxKALtpB99DKILkz9l/ME3nyYK9c 2iYnIG/IksOFf4W1ZW6WzLlzM5D9hKcJCiSJW1nbO5jusCIZiR6cR2i8HbM6iGfO02jWG+pDuAS dhkZtbL9T6uJbGWC368YjyJco/2pO9BrLc0Hdb37kJtsxNSGhhxJeSa+JBrbR9kd7FTYCLChAYD 8eJVs97lz2lzm33xR738jXLiBgvoBvW4ZMMhDdbZhjmWWE2AVUz4hx8GZbVP+GT5scic1S+4Pkx QYjEHtUBJ4yrYTSlKwgg== X-Received: by 2002:a17:90b:33c8:b0:387:e0db:3fb1 with SMTP id 98e67ed59e1d1-38dc77993c3mr526112a91.42.1783717065807; Fri, 10 Jul 2026 13:57:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 41/51] accel/tcg: Clear BP_WATCHPOINT_HIT after use Date: Fri, 10 Jul 2026 13:53:51 -0700 Message-ID: <20260710205401.836304-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717334463158500 Content-Type: text/plain; charset="utf-8" Now that all targets have been converted to use the debug_excp_handler, and no longer clear watchpoint_hit themselves, we can clear BP_WATCHPOINT_HIT after the single usage. This avoids a loop over all watchpoints. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 23 ++++------------------- gdbstub/system.c | 2 ++ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index a4eb1f1c31..68d434fff4 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -685,27 +685,12 @@ static inline bool cpu_handle_halt(CPUState *cpu) =20 static inline void cpu_handle_debug_exception(CPUState *cpu) { - CPUBreakpoint *hit =3D cpu->watchpoint_hit; + CPUBreakpoint *hit =3D cpu->watchpoint_hit ? : cpu->breakpoint_hit; =20 - if (hit) { - IntervalTreeNode *n; - - for (n =3D interval_tree_iter_first(&cpu->watchpoints, 0, -1); n; - n =3D interval_tree_iter_next(n, 0, -1)) { - CPUBreakpoint *wp =3D container_of(n, CPUBreakpoint, itree); - if (wp !=3D hit) { - wp->flags &=3D ~BP_WATCHPOINT_HIT; - } - } - } else { - hit =3D cpu->breakpoint_hit; - if (!hit) { - return; - } - } - - if (hit->flags & BP_CPU) { + if (hit && hit->flags & BP_CPU) { cpu->cc->tcg_ops->debug_excp_handler(cpu, hit); + + hit->flags &=3D ~BP_WATCHPOINT_HIT; cpu->watchpoint_hit =3D NULL; cpu->breakpoint_hit =3D NULL; } diff --git a/gdbstub/system.c b/gdbstub/system.c index b36e957b95..c78fb330c4 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -170,6 +170,8 @@ static void gdb_vm_state_change(void *opaque, bool runn= ing, RunState state) g_string_printf(buf, "T%02xthread:%s;%swatch:%" VADDR_PRIx ";", GDB_SIGNAL_TRAP, tid->str, type, cpu->watchpoint_hit->hitaddr); + + cpu->watchpoint_hit->flags &=3D ~BP_WATCHPOINT_HIT; cpu->watchpoint_hit =3D NULL; goto send_packet; } else { --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717411; cv=none; d=zohomail.com; s=zohoarc; b=To2H/FhUthCvuKK2T1VlIDgrpmJg56dvJyc/UX2gStA9ICzxvOG9CiedAkpZqPIMG4WWV/Xu5/zkKmP7xwTWV5eO0TAIeUVM7NVHzbr+CWVoL1am40Ivnc3228BSrEpVpthLUmVCUi38e6x8Ozc4hHyczlQa+YSMwuW8C+QJLpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717411; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WjLEtohWc+o9MkE1PG7oePLniabIWGoiT7bdPR5cyO4=; b=h2VhfvA3W0iJ6k7sh/WSH2gNnOEsziecmOCU6O79V/tcI3siXCJ2dMBOTbvhLeDitTbIFVXjYJUG8UhmLQ6CWukdtj5KP5kGCRk/m3D1T9mMQ3IKf4lLpefdrRbZcxQyI6/q5ULJulNkjJ3xP4lgNbk9iazZ4UmhMI7VmeIsPEQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17837174114981012.0574851716508; Fri, 10 Jul 2026 14:03:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIII-0000es-Jh; Fri, 10 Jul 2026 16:57:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIF-0000Sy-Fg for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:55 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiII7-0001sD-VF for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:54 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-38426d04bb4so1080848a91.1 for ; Fri, 10 Jul 2026 13:57:47 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717066; x=1784321866; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=WjLEtohWc+o9MkE1PG7oePLniabIWGoiT7bdPR5cyO4=; b=R1FhU5TuOzouHoUPCsTkOGJIq5qTLqCUghcA84TMQUJYpQ/R00PP7xlLpjIL3EO79d +CiDHwh5fq2fgvnSNECOk4QUhyO5oGFet35aQb0GjIDgVmV8kCiI8IAp6vrnqLs7KpaK 7yU8dZbLE9biM31a8Z93tddzXQ4cRPZphzJ2Cf+yEGqjDHUUKkMtxp/C7kVNyrP0g5nC AXWh26aoLY/qlervp3OC2lNgDjCD1vQyeVGCJSwkALI7g7isR4RZZzVgvSagKkYBjCXY So47DvGe+swiWbRNgquQkTZSIxQ6GTJ2CIBjmG6MSNgGVFXPkotKbG6Ukt3nWD/KHW6w AGGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717066; x=1784321866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=WjLEtohWc+o9MkE1PG7oePLniabIWGoiT7bdPR5cyO4=; b=UD3/tnWlpQdtO0LvTTcQFkKeOT5E7OAIk3opKNmOvkqh+n1jQnH3AUdg+eIg7Q5AIh T9e3A/486v+XuVQD+zX1xn/45TIuLV6gtIvHYuU805AdZa1Uyj9Q519H//8iXZzeQSUt iTqc8+3OJP/gHwoFstvop1XJpobghY+WdyhwJi5J0EPcEZ9An1+JaF7tmzxJgoR8pGXe 2BsEfSTVJyBTzrp7qM0SPJMuMCXIVTGWw+UGgiAQ5vYHW82zShctkpjPZvWGtj1Z4YM8 NG1BLgGNxps7MwrmBE35TsyYuhc57G9KaV3yjGGmFH41rCk62BZjPxHSsSeJ66aGc8S3 9bng== X-Gm-Message-State: AOJu0YxeC9DlW1EQVXrLchYlU5K6IADC4Mf2d8uitKMd54GjXAFJXhK4 daUOajjlRHW8JW/5uyI8LxDUIxj+QHV/hqOfdzaOliZwcwBBKgeIZi5Pw9aUBEPV9oUlyz4nks9 Qp6Us X-Gm-Gg: AfdE7ckzWmhO1D+dYekSSWD3bXrNHgoGGP0IbekKNL+VtvcyNiOWsJ3zRGNnmiCQjus h1brb0mWLIor5KojxR/pUMdxeNLbuXg+1vsoG8S8OHy1F97ueiZnP+EsZBTnKJfpdCFZP+RPkWf YKIpPN1fK5xIW6T3GSxzWFR4Cgwu4ZlaUeSMN9TpwRO7JHi533zKpAsscYmflIjidAm3yPy1C0H o2qemQSLq0SpCKAPHszeUmDgCOR0TWYqf0t5ChcMUPXU0L3CXkOTT0kJ6PazkWexbLxiUWNDs67 jcNIy4ZlSBIg+Ww510Vi3tjWmL75T3m6Bniyz7k3gMldh3J3Po6a5oIvw/kjy8um+fzugcWYeqH 7PEPEXKv0AaLCM1/nqAA6iEd06VKCBttTRqnINJ86bbhVImKTkd8dYBojwxzjlp56WT2QPGtP5e grgJV/rGTEuTnt8exqGQ== X-Received: by 2002:a17:90b:2248:b0:37f:fd70:6790 with SMTP id 98e67ed59e1d1-38dc81c1b09mr281371a91.9.1783717066451; Fri, 10 Jul 2026 13:57:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 42/51] accel/tcg: Merge CPUState.{break,watch}point_hit Date: Fri, 10 Jul 2026 13:53:52 -0700 Message-ID: <20260710205401.836304-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717413055158500 Content-Type: text/plain; charset="utf-8" Merge and name bp_wp_hit. Now that all targets have been converted to use debug_excp_handler hit argument, we only need one pointer to an outstanding debug event. Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 3 +-- accel/tcg/cpu-exec.c | 7 +++--- accel/tcg/watchpoint.c | 4 ++-- gdbstub/system.c | 50 ++++++++++++++++++++++-------------------- target/arm/hvf/hvf.c | 5 ++--- target/arm/kvm.c | 2 +- target/i386/kvm/kvm.c | 4 ++-- target/ppc/kvm.c | 2 +- target/s390x/kvm/kvm.c | 2 +- 9 files changed, 39 insertions(+), 40 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 1a42940d92..5401d7c14b 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -526,8 +526,7 @@ struct CPUState { /* ice debug support */ IntervalTreeRoot breakpoints; IntervalTreeRoot watchpoints; - CPUBreakpoint *breakpoint_hit; - CPUBreakpoint *watchpoint_hit; + CPUBreakpoint *bp_wp_hit; =20 void *opaque; =20 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 68d434fff4..d0cf89e5bf 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -366,7 +366,7 @@ static bool check_for_breakpoints_slow(CPUState *cpu, v= addr pc, bp->hitaddr =3D pc; bp->hitlast =3D pc; bp->hitattrs =3D MEMTXATTRS_UNSPECIFIED; - cpu->breakpoint_hit =3D bp; + cpu->bp_wp_hit =3D bp; cpu->exception_index =3D EXCP_DEBUG; return true; } @@ -685,14 +685,13 @@ static inline bool cpu_handle_halt(CPUState *cpu) =20 static inline void cpu_handle_debug_exception(CPUState *cpu) { - CPUBreakpoint *hit =3D cpu->watchpoint_hit ? : cpu->breakpoint_hit; + CPUBreakpoint *hit =3D cpu->bp_wp_hit; =20 if (hit && hit->flags & BP_CPU) { cpu->cc->tcg_ops->debug_excp_handler(cpu, hit); =20 hit->flags &=3D ~BP_WATCHPOINT_HIT; - cpu->watchpoint_hit =3D NULL; - cpu->breakpoint_hit =3D NULL; + cpu->bp_wp_hit =3D NULL; } } =20 diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index bf4c46c393..f96ffc018d 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -56,7 +56,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vadd= r len, bool have_cpu_wp =3D false; =20 assert(tcg_enabled()); - if (cpu->watchpoint_hit) { + if (cpu->bp_wp_hit) { /* * We re-entered the check after replacing the TB. * Now raise the debug interrupt so that it will @@ -146,7 +146,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, va= ddr len, return; } =20 - cpu->watchpoint_hit =3D found_wp; + cpu->bp_wp_hit =3D found_wp; =20 /* This call also restores vCPU state */ tb_check_watchpoint(cpu, ra); diff --git a/gdbstub/system.c b/gdbstub/system.c index c78fb330c4..3f31b75173 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -150,34 +150,36 @@ static void gdb_vm_state_change(void *opaque, bool ru= nning, RunState state) =20 switch (state) { case RUN_STATE_DEBUG: - if (cpu->watchpoint_hit) { - const char *type; + { + CPUBreakpoint *hit =3D cpu->bp_wp_hit; =20 - switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) { - case BP_MEM_READ: - type =3D "r"; - break; - case BP_MEM_ACCESS: - type =3D "a"; - break; - default: - type =3D ""; - break; + if (hit) { + unsigned watch =3D hit->flags & BP_MEM_ACCESS; + + hit->flags &=3D ~BP_WATCHPOINT_HIT; + cpu->bp_wp_hit =3D NULL; + + if (watch) { + static const char hit_type[4][2] =3D { + [BP_MEM_READ] =3D "r", + [BP_MEM_WRITE] =3D "", + [BP_MEM_ACCESS] =3D "a", + }; + const char *type =3D hit_type[watch]; + + trace_gdbstub_hit_watchpoint(type, gdb_get_cpu_index(c= pu), + hit->hitaddr); + g_string_printf(buf, "T%02xthread:%s;%swatch:%" + VADDR_PRIx ";", + GDB_SIGNAL_TRAP, tid->str, type, + hit->hitaddr); + goto send_packet; + } + /* else breakpoint */ } - trace_gdbstub_hit_watchpoint(type, - gdb_get_cpu_index(cpu), - cpu->watchpoint_hit->hitaddr); - g_string_printf(buf, "T%02xthread:%s;%swatch:%" VADDR_PRIx ";", - GDB_SIGNAL_TRAP, tid->str, type, - cpu->watchpoint_hit->hitaddr); - - cpu->watchpoint_hit->flags &=3D ~BP_WATCHPOINT_HIT; - cpu->watchpoint_hit =3D NULL; - goto send_packet; - } else { trace_gdbstub_hit_break(); + ret =3D GDB_SIGNAL_TRAP; } - ret =3D GDB_SIGNAL_TRAP; break; case RUN_STATE_PAUSED: trace_gdbstub_hit_paused(); diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 32e5f43ee3..0fd72c5bde 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2370,13 +2370,12 @@ static int hvf_handle_exception(CPUState *cpu, hv_v= cpu_exit_exception_t *excp) =20 cpu_synchronize_state(cpu); =20 - CPUBreakpoint *wp =3D - find_hw_watchpoint(cpu, excp->virtual_address); + CPUBreakpoint *wp =3D find_hw_watchpoint(cpu, excp->virtual_addres= s); if (!wp) { error_report("EXCP_DEBUG but unknown hw watchpoint"); } wp->hitaddr =3D excp->virtual_address; - cpu->watchpoint_hit =3D wp; + cpu->bp_wp_hit =3D wp; break; } case EC_DATAABORT: { diff --git a/target/arm/kvm.c b/target/arm/kvm.c index c2f921095a..f66332299c 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -1520,7 +1520,7 @@ static bool kvm_arm_handle_debug(ARMCPU *cpu, CPUBreakpoint *wp =3D find_hw_watchpoint(cs, debug_exit->far); if (wp) { wp->hitaddr =3D debug_exit->far; - cs->watchpoint_hit =3D wp; + cs->bp_wp_hit =3D wp; return true; } break; diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 2e1ecb1c83..c4f0dc1e02 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -6263,13 +6263,13 @@ static int kvm_handle_debug(X86CPU *cpu, break; case 0x1: ret =3D EXCP_DEBUG; - cs->watchpoint_hit =3D &hw_watchpoint; + cs->bp_wp_hit =3D &hw_watchpoint; hw_watchpoint.hitaddr =3D hw_breakpoint[n].addr; hw_watchpoint.flags =3D BP_MEM_WRITE; break; case 0x3: ret =3D EXCP_DEBUG; - cs->watchpoint_hit =3D &hw_watchpoint; + cs->bp_wp_hit =3D &hw_watchpoint; hw_watchpoint.hitaddr =3D hw_breakpoint[n].addr; hw_watchpoint.flags =3D BP_MEM_ACCESS; break; diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index f161ba6415..f11f8457d0 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1592,7 +1592,7 @@ static int kvm_handle_hw_breakpoint(CPUState *cs, n =3D find_hw_watchpoint(arch_info->address, &flag); if (n >=3D 0) { handle =3D DEBUG_RETURN_GDB; - cs->watchpoint_hit =3D &hw_watchpoint; + cs->bp_wp_hit =3D &hw_watchpoint; hw_watchpoint.hitaddr =3D arch_info->address; hw_watchpoint.flags =3D flag; } diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index b75dab5f3c..5c3cde97b8 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -1863,7 +1863,7 @@ static int kvm_arch_handle_debug_exit(S390CPU *cpu) switch (arch_info->type) { case KVM_HW_WP_WRITE: if (find_hw_breakpoint(arch_info->addr, -1, arch_info->type)) { - cs->watchpoint_hit =3D &hw_watchpoint; + cs->bp_wp_hit =3D &hw_watchpoint; hw_watchpoint.hitaddr =3D arch_info->addr; hw_watchpoint.flags =3D BP_MEM_WRITE; ret =3D EXCP_DEBUG; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717347; cv=none; d=zohomail.com; s=zohoarc; b=Kot3tlNcDy/kbAQd3sM1zIhwNnhC4caaSBGiKFbMCqLxgrr/rWlBeXAvMK7J+zIUhEBEnnevTIwpvRVY8PpfXUD4g50l+Pp+WAMkTK5hxcITONTJMUenE+yUsES37f1f0rxLAG1KnoP92GNEki4zrnA/jvcqMI5Lhvyf3HaYhMo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717347; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FJD0bozxsAaU8VxtEpxfjjLduhuIEtavECVR9Kha1MU=; b=FTmBvsAMf6MPbV7mbglGcMNLENGRhbJY0M60+F8vqEhn9fsruvZeC5MQ9vrdXio28/utnSLn2DEWq49qtlb2uI5DcvMaMpmmIEpGkmaCRAb4XJMATiafNEZ79Ovg2vChtuKW1WRvqNTUn/2qRQLdVL3v0jpTYeDzJ3y1ZWf90J0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717347242432.72255130640315; Fri, 10 Jul 2026 14:02:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIK2-0001sD-LW; Fri, 10 Jul 2026 16:59:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIH-0000el-V4 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:58 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiII9-0001se-8L for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:57 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-38d489b6b71so1141579a91.0 for ; Fri, 10 Jul 2026 13:57:48 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717067; x=1784321867; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FJD0bozxsAaU8VxtEpxfjjLduhuIEtavECVR9Kha1MU=; b=rRJfzR5dQgokgJH1nmNtVoZQ47y3BR3+qvWWHZvyGq45Dfmc+Yy3ohGUB8WQe+Z/vA tHr3/3f7KgFC8GDrNUvHhZu0doHfO4HhvjIQ2rvMUU23BdPrKBSJldnkH10/oPb1bRcs DxJcVDWseIEy8qiYpnZoiKhFzsu5ToG6gRxbISNWonEHG13X+ONc8fCELOzsoWzyzdnd lRto5c039h5/dO3sGDd5u40vgwURganF/+dv+kvciByxyuEAC7VpZzYw6iSoQlyV8imY CALmR673xGX/Dt2SBPU6Y++K+q0i8burVLbmf/rMQ6XsbIFYnS4r9RVWOX525ap7kmNq wjAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717067; x=1784321867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=FJD0bozxsAaU8VxtEpxfjjLduhuIEtavECVR9Kha1MU=; b=aQjDsduUa6T50pDNDNQQLgWOT+mkKA/J1M57/ktPA47EAOEl5TxjYayQ6mK3g1/qcR Mw0Q/IHp/JsOXcQndna9WLTVKQlUJIejzBT3NHwJ554Qzqx1cxLLw91+3VexQNFq87c0 GNy6oA+ze/9c21nDh0h2Q9CIl51CmNxxpKGlHbd1C3ivFz11czGRcLD2Cdj9gk/a0KBA AsnJzrTl83xlOsOPL7R68+US5t52Q2xKyAFzvjGSnNSIF9G3fxE6fqOJQs3PqgN74y1l 8p9OzjWHu5L3w134KxgltKO35lw/JMGUhwL2X0svg81NkayNW6CHMVY/2giSXBEU5rgZ dVgA== X-Gm-Message-State: AOJu0Yy3/7oLNd1FNVVN5Jn/Z7qI6iSyxsa6Rqc9LpRqLN5W1JqZF164 9Fig0uagXiZxPd4BHnUewvjK69kPPnFbdfhmYgWH7P26w+UR92hiDgzzX5ilT7ZOgD55Km0DOvD V11Ty X-Gm-Gg: AfdE7cnQYuq2ShiQZrE+lko+y7ZCLVeUwc+Zet6DT66TDehCcNEi2xKxX4Dakp65+jS dZtFJeY3secZweQqlhvS+r/KsrJs1KuZLzh6q3CspVASe3rZbu4tHvOTFiiEqRJn+DREG2v3Rur Sz4WrL9ECOWqDKyaTD39isTvks7Nm99GgAnnylexB4oysBT1zmZvLhTZs2p8h2nAPPy7TQXS1MX Jl31AQd1hexMUI1eDYDnKui9E1LXu09XcwxkKLlkLsQxmRN340znvS4m1sYvxlKMFxNS/C6dLY3 qR3BQFNevKYSXXKFUGKVCDvfqRv3qIu/riSWePMdDkBVipkuwNOyPor9Wo1v2RuPLbmjh93xSAD 8mqXLBVzOrGiUnOXHRkE0f50ZS+eXWpeAxQgn4lfnseOf11+vacYz0i9vsctgPv/4YDcwjRJ9ae SKxkOuapPLjGUBExquTQ== X-Received: by 2002:a17:90b:510f:b0:37e:a09:2640 with SMTP id 98e67ed59e1d1-38dc761aba3mr531684a91.7.1783717067270; Fri, 10 Jul 2026 13:57:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 43/51] target/arm: Simplify v6 watchpoints Date: Fri, 10 Jul 2026 13:53:53 -0700 Message-ID: <20260710205401.836304-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717348648158500 Content-Type: text/plain; charset="utf-8" Rather than use arm_adjust_watchpoint_address, delay the interpretation of BAS until the check_watchpoint hook so that we use the current value of SCTLR.B. Signed-off-by: Richard Henderson --- target/arm/internals.h | 5 -- target/arm/cpu.c | 1 - target/arm/debug_helper.c | 12 +++ target/arm/tcg/cpu-v7m.c | 1 - target/arm/tcg/debug.c | 159 ++++++++++++++++++++++++-------------- 5 files changed, 114 insertions(+), 64 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 9deb7a6e22..4446adb896 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -694,11 +694,6 @@ bool arm_debug_check_breakpoint(CPUState *cs, CPUBreak= point *bp); /* Callback function for checking if a watchpoint should trigger. */ bool arm_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp); =20 -/* Adjust addresses (in BE32 mode) before testing against watchpoint - * addresses. - */ -vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len); - /* Callback function for when a watchpoint or breakpoint triggers. */ void arm_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit); =20 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 787e4dc7ab..e06fbb903a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2609,7 +2609,6 @@ static const TCGCPUOps arm_tcg_ops =3D { .do_interrupt =3D arm_cpu_do_interrupt, .do_transaction_failed =3D arm_cpu_do_transaction_failed, .do_unaligned_access =3D arm_cpu_do_unaligned_access, - .adjust_watchpoint_address =3D arm_adjust_watchpoint_address, .debug_check_watchpoint =3D arm_debug_check_watchpoint, .debug_check_breakpoint =3D arm_debug_check_breakpoint, #endif /* !CONFIG_USER_ONLY */ diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 2c3a56c7d5..086043cf5e 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -362,6 +362,18 @@ static void dbgwcr_write(CPUARMState *env, const ARMCP= RegInfo *ri, ARMCPU *cpu =3D env_archcpu(env); int i =3D ri->crm; =20 + /* + * Bits [7:4] of BAS are RAZ/WI if an 8-bit field is not supported. + * This is always true of v6 debug. + * As an IMPLEMENTATION DEFINED choice, we always implement the 8-bit + * field with ARMv7 cpus. + * This is never true of v8 debug. + * The Linux kernel will probe for 4 or 8-bit by writing all 1's. + */ + if (!arm_feature(env, ARM_FEATURE_V7)) { + value &=3D ~FIELD_DP64(0, DBGWCR, BAS, 0xf0); + } + raw_write(env, ri, value); if (tcg_enabled()) { hw_watchpoint_update(cpu, i); diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index dc249ce1f1..b7e5623c59 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -262,7 +262,6 @@ static const TCGCPUOps arm_v7m_tcg_ops =3D { .do_interrupt =3D arm_v7m_cpu_do_interrupt, .do_transaction_failed =3D arm_cpu_do_transaction_failed, .do_unaligned_access =3D arm_cpu_do_unaligned_access, - .adjust_watchpoint_address =3D arm_adjust_watchpoint_address, .debug_check_watchpoint =3D arm_debug_check_watchpoint, .debug_check_breakpoint =3D arm_debug_check_breakpoint, #endif /* !CONFIG_USER_ONLY */ diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index d705f7aef2..1dec39c0bf 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -365,6 +365,31 @@ bool arm_debug_check_breakpoint(CPUState *cs, CPUBreak= point *bp) return bp_wp_matches(cpu, env->cp15.dbgbcr[bp->id], arm_current_el(env= )); } =20 +static bool arm_debug_check_watchpoint_v6(CPUARMState *env, CPUBreakpoint = *wp) +{ + uint32_t wcr =3D env->cp15.dbgwcr[wp->id]; + uint32_t bas =3D FIELD_EX64(wcr, DBGWCR, BAS) & 0xf; + + /* Create a mask of the bytes touched by the access. */ + uint32_t hitlen =3D wp->hitlast - wp->hitaddr + 1; + uint32_t hitmask =3D MAKE_64BIT_MASK(wp->hitaddr & 3, hitlen); + + /* With BE-32, the interpretation of BAS is inverted. */ + if (arm_sctlr_b(env)) { + bas =3D revbit8(bas) >> 4; + } + + hitmask &=3D bas; + if (!hitmask) { + return false; + } + + /* Update hit to the first byte matched. */ + wp->hitaddr =3D wp->itree.start + ctz32(hitmask); + wp->hitlast =3D wp->hitaddr; + return true; +} + bool arm_debug_check_watchpoint(CPUState *cs, CPUBreakpoint *wp) { /* @@ -380,7 +405,13 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUBreak= point *wp) */ int access_el =3D wp->hitattrs.user ? 0 : arm_current_el(env); =20 - return bp_wp_matches(cpu, env->cp15.dbgwcr[wp->id], access_el); + /* + * For ARM v6, we need to validate the address match. + * After that, everyone needs to validate linked watchpoints. + */ + return ((arm_feature(env, ARM_FEATURE_V7) || + arm_debug_check_watchpoint_v6(env, wp)) && + bp_wp_matches(cpu, env->cp15.dbgwcr[wp->id], access_el)); } =20 /* @@ -481,46 +512,44 @@ void HELPER(exception_swstep)(CPUARMState *env, uint3= 2_t syndrome) raise_exception_debug(env, EXCP_UDEF, syndrome); } =20 -void hw_watchpoint_update(ARMCPU *cpu, int n) +static void hw_watchpoint_update_v6(ARMCPU *cpu, int n, BreakpointFlags fl= ags) +{ + /* + * With v6: + * - MASK does not exist, + * - BAS is 4 bits, + * - non-consecutive BAS bits are not yet deprecated, + * - BE-32 is supported, affecting interpretation of BAS. + * Install a 4 byte aligned watchpoint now and defer checking + * of the BAS bits until breakpoint hit. + */ + CPUARMState *env =3D &cpu->env; + uint32_t wvr =3D env->cp15.dbgwvr[n] & ~3; + uint32_t wcr =3D env->cp15.dbgwcr[n]; + uint32_t bas =3D FIELD_EX64(wcr, DBGWCR, BAS) & 0xf; + + if (bas =3D=3D 0) { + /* This must act as if the watchpoint is disabled */ + return; + } + + env->cpu_watchpoint[n] =3D cpu_watchpoint_insert(CPU(cpu), wvr, 4, + flags, n); +} + +static void hw_watchpoint_update_v7(ARMCPU *cpu, int n, BreakpointFlags fl= ags) { CPUARMState *env =3D &cpu->env; vaddr len =3D 0; vaddr wvr =3D env->cp15.dbgwvr[n]; uint64_t wcr =3D env->cp15.dbgwcr[n]; - int mask; - BreakpointFlags flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; - - if (env->cpu_watchpoint[n]) { - cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[n]); - env->cpu_watchpoint[n] =3D NULL; - } - - if (!FIELD_EX64(wcr, DBGWCR, E)) { - /* E bit clear : watchpoint disabled */ - return; - } - - switch (FIELD_EX64(wcr, DBGWCR, LSC)) { - case 0: - /* LSC 00 is reserved and must behave as if the wp is disabled */ - return; - case 1: - flags |=3D BP_MEM_READ; - break; - case 2: - flags |=3D BP_MEM_WRITE; - break; - case 3: - flags |=3D BP_MEM_ACCESS; - break; - } + int mask =3D FIELD_EX64(wcr, DBGWCR, MASK); =20 /* * Attempts to use both MASK and BAS fields simultaneously are * CONSTRAINED UNPREDICTABLE; we opt to ignore BAS in this case, * thus generating a watchpoint for every byte in the masked region. */ - mask =3D FIELD_EX64(wcr, DBGWCR, MASK); if (mask =3D=3D 1 || mask =3D=3D 2) { /* * Reserved values of MASK; we must act as if the mask value was @@ -570,6 +599,49 @@ void hw_watchpoint_update(ARMCPU *cpu, int n) flags, n); } =20 +void hw_watchpoint_update(ARMCPU *cpu, int n) +{ + CPUARMState *env =3D &cpu->env; + uint64_t wcr =3D env->cp15.dbgwcr[n]; + int flags =3D BP_CPU | BP_STOP_BEFORE_ACCESS; + + if (env->cpu_watchpoint[n]) { + cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[n]); + env->cpu_watchpoint[n] =3D NULL; + } + + if (!FIELD_EX64(wcr, DBGWCR, E)) { + /* E bit clear : watchpoint disabled */ + return; + } + + switch (FIELD_EX64(wcr, DBGWCR, LSC)) { + case 0: + /* LSC 00 is reserved and must behave as if the wp is disabled */ + return; + case 1: + flags |=3D BP_MEM_READ; + break; + case 2: + flags |=3D BP_MEM_WRITE; + break; + case 3: + flags |=3D BP_MEM_ACCESS; + break; + } + + /* + * ARM v6 debug. The AArch32 DBGDIDR register is deprecated + * under certain v8 conditions, and ID_DFR0 doesn't exist pre-v7. + * Cut the proverbial knot by checking cpu features. + */ + if (arm_feature(env, ARM_FEATURE_V7)) { + hw_watchpoint_update_v7(cpu, n, flags); + } else { + hw_watchpoint_update_v6(cpu, n, flags); + } +} + void hw_watchpoint_update_all(ARMCPU *cpu) { int i; @@ -689,30 +761,3 @@ void hw_breakpoint_update_all(ARMCPU *cpu) hw_breakpoint_update(cpu, i); } } - -#if !defined(CONFIG_USER_ONLY) - -vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len) -{ - ARMCPU *cpu =3D ARM_CPU(cs); - CPUARMState *env =3D &cpu->env; - - /* - * In BE32 system mode, target memory is stored byteswapped (on a - * little-endian host system), and by the time we reach here (via an - * opcode helper) the addresses of subword accesses have been adjusted - * to account for that, which means that watchpoints will not match. - * Undo the adjustment here. - */ - if (arm_sctlr_b(env)) { - if (len =3D=3D 1) { - addr ^=3D 3; - } else if (len =3D=3D 2) { - addr ^=3D 2; - } - } - - return addr; -} - -#endif /* !CONFIG_USER_ONLY */ --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717351; cv=none; d=zohomail.com; s=zohoarc; b=Tr9AVf3ETzq20WWY8s5aVls2r5KYZVbIfRQhGBvv4eUVNZwpg7E9fUOZsXyauxgwAyq9WlhitkeWmCz6MsuyJhfZEVNEhy6PTv5Vk25dcwUDayNWwLkRhHSTkrqgFR4eqCfTrVgE21fUaypbC2FGeNQuRNnAtvE1YrYmpr7PjHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717351; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6DlcOURZ8Vq6FHB8e3m8GHkjsu8dVLmyFcRV/xT55GA=; b=nFbw1Q8ORkDpB9nScvT088p6c2pkiHkv+YBQy8sRRGWoe2hDAkRyzETsIfRSrjR28R4fUOUax0iqwdEiJpvBr7H6PxsgNFMqbpVgKhzDLEMvFr8DZXAR1c97EtDapMgUyiYR4vxcfnxCuyWy8kvGeFLnY298/A5XUY9jCO9EhNc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717351339272.66592570833825; Fri, 10 Jul 2026 14:02:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIIL-0000mO-1g; Fri, 10 Jul 2026 16:58:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIJ-0000hZ-9B for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:59 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiII9-0001tM-Tz for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:57:58 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-38125cebfdaso1934137a91.1 for ; Fri, 10 Jul 2026 13:57:49 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717068; x=1784321868; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6DlcOURZ8Vq6FHB8e3m8GHkjsu8dVLmyFcRV/xT55GA=; b=IlcDt8GypjmeRkoGkm1036T85xesu/lwtKMyumcYjc6DTn1rTP2kX/Yp85+bsV6r0I XtTavvrzgGvNP6c2AquwR5wGk8TQCY+XbgLkTqjedRr9yLg4Thv0LXuehQ6ppasgGKfl u8v3cJQ/mMtmw8cEnBNTp8vR9Pot0Zh8Nm42rlqT7QXvDwBhY7hjbheZGRz8dV9DuXB2 L8fU5clY6Yc+u3tdDYQlarQXW/SKSMH7Z7J0O2wSlbPOaQ9BKywslHL8RK62FmyfzUHV IEJdPkplSuDLxNiIsDrjb10OBp5IRuWvzWnV17H/fWINCM1mF4WDuS7xaNKAcGEqogJH DXWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717068; x=1784321868; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=6DlcOURZ8Vq6FHB8e3m8GHkjsu8dVLmyFcRV/xT55GA=; b=diqwQqEusrl0DdEZre3FxxOGmPhIS2nTGJuexCJmGrCoveTxaB73wLupPdqwqfaUkt kmBWpB6MXEAveBZiHHk/XX5WAwG140JWZDAQz/PkQcov2ktL0h6detBsWyLOgEwePEtC PctXxW6DISWTfwtQA0F7HIxoFtU7eOM0PEh+1ed/NWPLLIwsS+aSETlkebzF0veRDz22 6YQIQC3wqRagfobuzAMKsq1GtRivZAuw8bdbbY6NYxStNMNiLkVFs/EpEavegxXx4/To KLesZUTsYzJl8SWiil7tLU361WZZztP25pMokowrCE3JDJGOGx+haDiCsUYxPj5hrke6 nfHw== X-Gm-Message-State: AOJu0YxmYqJgU9xy0bHI3ply+W+JhEkQJ0pDZr8EoO7Z6Cls513chy1h H+yoELHu6StmI6FcTtqcuayRStvgzcGHv94eBUxwt/XM4Zs9zh5jXigJF/29WOZMSfwXcMskji7 9iwOn X-Gm-Gg: AfdE7clYsDdR3Hppbud8Pg1MvH3CF47rgEp34ShFPmrVMbEIQ3lrHs1tUc61qv+7nnd 7BP8P5EquiNQailjCo5ou2iqdMPCvKNjaxWMtL8lT+2xFcPMX7RNv/eh4QyoZfKc+SnFWis53lx 2PPaQUqKjvYDz467kwpdgfcZqsUsDp9VwYJYWpcz3Q+tVgXr3b8IxXi1EL1VdAd839EalntUx8j 8a30vi5tDaUN6e2WwH7evNVp/9Sem6IQ46itf5M/9QVNiM2d9QPa8vRfjLwvRxEHzX4C/MKf6sY c4Xf2/gl8ycZQ3mstqsY8H24cQLcTEx1IP2I/CtlnsH12+1kwgI+Y59PeqkBtAVuLIzv8Uqhii4 aScidWo2/HN6aE47k31omqJjHDv3h82/rl0PI6mf6KfeDznG3GuA3KxfDKWg9qaQgqUNBnPLifF 90dISems88G9XRecWr1g== X-Received: by 2002:a17:90b:3b89:b0:387:e0db:3fad with SMTP id 98e67ed59e1d1-38dc7778aedmr450010a91.38.1783717068048; Fri, 10 Jul 2026 13:57:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 44/51] accel/tcg: Remove TCGCPUOps.adjust_watchpoint_address Date: Fri, 10 Jul 2026 13:53:54 -0700 Message-ID: <20260710205401.836304-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717352597158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- include/accel/tcg/cpu-ops.h | 5 ----- include/hw/core/cpu.h | 2 -- accel/tcg/watchpoint.c | 6 ------ 3 files changed, 13 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 734bcd537b..a232288152 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -249,11 +249,6 @@ struct TCGCPUOps { MMUAccessType access_type, int mmu_idx, uintptr_t retaddr); =20 - /** - * @adjust_watchpoint_address: hack for cpu_check_watchpoint (used by = ARM) - */ - vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len); - /** * @debug_check_watchpoint: return true if the architectural * watchpoint whose address has matched should really fire. diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 5401d7c14b..c4c86b8595 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -139,8 +139,6 @@ struct SysemuCPUOps; * to GDB. The returned value is expected to be a simple constant string: * the caller will not g_free() it. * @disas_set_info: Setup architecture specific components of disassembly = info - * @adjust_watchpoint_address: Perform a target-specific adjustment to an - * address before attempting to match it against watchpoints. * @deprecation_note: If this CPUClass is deprecated, this field provides * related information. * @max_as: Maximum valid index used to refer to the address spaces suppor= ted by diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index f96ffc018d..b8a49b7567 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -68,12 +68,6 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vad= dr len, return; } =20 - if (cpu->cc->tcg_ops->adjust_watchpoint_address) { - /* this is currently used only by ARM BE32 */ - addr =3D cpu->cc->tcg_ops->adjust_watchpoint_address(cpu, addr, le= n); - last =3D addr + len - 1; - } - assert((flags & ~BP_MEM_ACCESS) =3D=3D 0); =20 for (n =3D interval_tree_iter_first(&cpu->watchpoints, addr, last); n; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717302; cv=none; d=zohomail.com; s=zohoarc; b=l/OeFgfx50+zaVpwDTI9U2lqunWdB+YitxypTeLPayxLIg2FwemXCe4A6+RP1nGU1MA5xn+2C+OcQAzQmamgX8rLttY1VMfrAvZ+UHDpM5cz3YtWQnhR24Vv7HdCgeNGnsi93RUoxMZR5r8IEPfoGFYCYxn/U1l8whY9GjaXZjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717302; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dhJDN2Uvwx4DiZ1THGmdkn4VOYJT0oPXA9HE61gRL3Y=; b=manDyJDRx6nJY2vof0hYVZ/n8OY/yw+VzcCZ9xeA/reyZziMXPA6LBPJvbTPldKSFX5cA9mOyJv1tl3mjQOt4eV+i65A4caooNmz550fsIFoeqOA1eqOVmADAC9jyBWOw/6OL/e3gjN3zAebq3jwzyyoptFT9Sev92kaqwE3Ykc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717302653313.6524596082518; Fri, 10 Jul 2026 14:01:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIK0-0001YC-Kr; Fri, 10 Jul 2026 16:59:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIK-0000m3-JS for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:00 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIIB-0001uf-0F for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:00 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-381507c9380so1024630a91.0 for ; Fri, 10 Jul 2026 13:57:50 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717069; x=1784321869; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dhJDN2Uvwx4DiZ1THGmdkn4VOYJT0oPXA9HE61gRL3Y=; b=h/QdwWBgz0GVG6hqf/NW0x1h07nI+8ldm/WOz15+TzZrBhDk0bgPJjqQVO88KWgJFV gYwUfjb3vNrCdu2igWekmAjPwNlNsyjQjK9r1/nMqZnR0deyEPNPzOlr0AnthhED5ohF pmh8KQNUGqFDlbrvwrJfMeTqgz6IIUN6pf8i2TngOTaskDpmc71xIt5RDILGWgwLlW2W dSf4OrUB4EAIgRbyRVAs0L4MsTOUbfsL9PwEEniUrSelJirfgNKTCXS4riLRTYZ1v3Ry FgPiKCfXpfHU02+B9mNRKBZrpjJ0GkxttlpiKCuMPrYbQa7HeNSR9oz7PMS02ub3iWG+ lyzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717069; x=1784321869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=dhJDN2Uvwx4DiZ1THGmdkn4VOYJT0oPXA9HE61gRL3Y=; b=EQXa3RaY0FVlvasxtvATnNLMVUgBrLwlv9/WppKMfxL0lwJxv0JSvglfNYG0XUH6dt J9yZPioxcd8o8jZ/qsgO4T+PdkTUqyQN4K9U9VSRjk5hNqWTxWGVZzNl9kaX3WnlCVB0 fTk8uBEIqrUz/fxg9VFRN3DiaJSsgLBmHMTWk44KrNtDP4YrYD29AF9SYxYA6DrIdks8 /own59QjsKC94PCvVIRwbdY7vptb9m0hfJFkGxFU3xVyWKUdnk23TxTS8O+znZs4oghv 7XVYmBkYeb/q92O1pr+pTgqhI/lkb5/Wcpo6jLXSW/bADTUSntGOLp41nssfLLwX2au0 UE4A== X-Gm-Message-State: AOJu0Yxw7rBy28UWfVC6RSh7jQc51ld4TfLkNjne7HPntOspL2Z+745i 2SU/MymMAsMmdksXatCZSbVwy/96kQFPrGuA/vIGxgUrYtRL9Vq++sTfP+juXf2MKSZZ4aO5t7x qmwV8 X-Gm-Gg: AfdE7cmXiGEdfaKN4Yz7ltL6N4kNMWpXMH3iTV30Rq9oG5dms0qYR1arAA5stHoLCFU 0oyOdQNc6F7i/tr5bR/Oq8uHmYvX7Bq263OIhvy87/0dergRJqkNkX1229JCtbnXB/4RtebU04B O57Z5F1iu2FQ+KqHyU++Ro0E+CCw947hDv5gE9b9GB6sroDV7wvvNctYZ6mVxvxASJTsAiHBF6X CkEsHZP1yT7KnGt0WLHhJwTkzV7rjiVmTh3Tp/047dN5xEHIKpHPGXKXJK+I3PeuROLlokueRZn qnpVjx6sMEl3SMoNKhMn9eJrRVbMOEet0vskmZFDV8GzBtRu0+YzsGHP0Wl4VBmvRZhuNk92YxS AgnCw0LJtdCyugE0mt6lzPgyLE/ISQnH8J8Zb1M69uXWwxAaP+Orlv92Z7jRqh3vJvW+0b2foCk 316wT5iWfCeyFnccw6Bg== X-Received: by 2002:a17:90a:e7cb:b0:37e:2505:cde9 with SMTP id 98e67ed59e1d1-38dc75e6c75mr513578a91.13.1783717069354; Fri, 10 Jul 2026 13:57:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 45/51] accel/tcg: Move ALL_MMUIDX_BITS to hw/core/cpu.h Date: Fri, 10 Jul 2026 13:53:55 -0700 Message-ID: <20260710205401.836304-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717304188158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 1 + accel/tcg/cputlb.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index c4c86b8595..3d48bc81f2 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -197,6 +197,7 @@ struct CPUClass { * Current maximum is target/arm/. */ #define NB_MMU_MODES 22 +#define ALL_MMUIDX_BITS ((1 << NB_MMU_MODES) - 1) typedef uint32_t MMUIdxMap; =20 /* Use a fully associative victim tlb of 8 entries. */ diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index e2911e3aac..695476eef1 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -91,8 +91,6 @@ */ QEMU_BUILD_BUG_ON(sizeof(vaddr) > sizeof(run_on_cpu_data)); =20 -#define ALL_MMUIDX_BITS ((1 << NB_MMU_MODES) - 1) - static inline size_t tlb_n_entries(CPUTLBDescFast *fast) { return (fast->mask >> CPU_TLB_ENTRY_BITS) + 1; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717390; cv=none; d=zohomail.com; s=zohoarc; b=dVBupcDyQnJApxuwlkc+IILsewfOcfeHptvHGxa7wgOLtvzebOB6aCBSyw8RAYCYDsyo7/5j/Ol9XihxRCfWs0ynCNqt8Jm7rrgsAyQKP+dKPFv1gpXO0VPhF/az4bespfOqBbA0GWbX7W/nMwr6eGANbWgzTpYNpPyzQClwmD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717390; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wQlUvhVxYxUBBJ0TpgUPbHv3TSyy1Fi4wFktbhNSBoc=; b=JaGOl+nhcqxkUqvepNp3Rz7CR5egAyDC3nApCVkNyj0OB1VixTZO00gWnKpopXFyB3wfIbdBtoqxFsxdqtsBqv6diY2LOts3Q1JA582y2DHKci7Z5n22r/NfJoFMTKPqwT1jouiwPGbFCaIWD+Er4vdRkD+a496Q7ROnSvtqqAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717390386778.6097783540644; Fri, 10 Jul 2026 14:03:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIK7-0002Cj-Jp; Fri, 10 Jul 2026 16:59:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIM-0000rW-8s for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:02 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIIC-0001vR-2p for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:01 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-3811f512167so1817161a91.3 for ; Fri, 10 Jul 2026 13:57:51 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717070; x=1784321870; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wQlUvhVxYxUBBJ0TpgUPbHv3TSyy1Fi4wFktbhNSBoc=; b=sFiLLpEAbUq+7VZQrTOSdsRMd2vtmu5Y2sLEJYPiXxfXTpoEyyK1COEHZCb1FUnK9o swjl/bZ80RlFcCcin1Q2aTJTgftdUGOY5lg0KrYwv+ypInSF6xjVy7pGEnc/ULudU/4F dDrgbbsyZnY3mibrAXap8927f7IJ4Ui8eXxVY6VUJ5n2LzVDJqMwTY5rw37ugms+qRGI pB8I6XcwnzJWl/nkO+JYtlw3YNm482RXfg0l3rU3FsffsoDd5lq46ELBRq6QOAnH0oPP gkhEjyy8U3K2D4WDd2+TTBN1ZCNDA3l9o0VrOPXBpsfQ9k0sOAplRzL4i2CdaUAHLRN5 fAIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717070; x=1784321870; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=wQlUvhVxYxUBBJ0TpgUPbHv3TSyy1Fi4wFktbhNSBoc=; b=Kn0wHphUFElXvHYLnMM4wBhzMvrNngAYNeI59EWgEriBKi/UbmIr0903vXz0mPyUQt zlDNG3yKG6RSnyABoF/+gSp/PtjyeYV6GiR2OHBrlObuk4APWpoMfk+p8CQLqIudAYxV xtk4/O97LWHmeuBNjPboHpB/oJ5Yqr7kV4J330cjbTSDGjXeyisQfSxLgnqTa0cFDew5 jWG3R90Gw1w7068Ja9kbtWBlYN2ZxIyB4lWVoJmL/v2500Ua+dI2Txg9D1cQtmv5fVf6 tARMjZHfNc8OegesA9Ome0xKbqGQZjpayQ1Cu/7CYp1EiU63Jut7I0VO/N9ij7UHqAaE zS+g== X-Gm-Message-State: AOJu0Yxoqh/KKZ8QsvneTYSGRZrf1vujo9PdLXKaPdb3yuWKvOlBuUK1 rbFvxZNSsOD97bsZ47LRjqF41hqmQ31Bkdt71qDuvn2pSe0/4wrp08Ri5KqMgv8MSHLhwPVskMO QfLiC X-Gm-Gg: AfdE7ckwulgUGVaYk31C1q52tRpGz5teB4IAJq59dIKogreUP5L6adXVTuUaPSlIeJ4 Mobpygg9nEj7CVWjCRasGbG+IueOJPh7M3cwY2NRQlPpasy7APhjFZhhDWjHqvd9ip9IAXOBFVo 2NuSWs5rHkYSZhn3KN/uIHwBNpTDhCFRV3y3pnxZJ4jt7p1Zx0FTPW/ahDsZHin+yR1P19I4/1+ ihNf7KxyA+kQGfhSNlF32c7icDr9mEBccQhNaa/XfSW1qg9iDDDKc5jBdIWKOJwG/H1J/oH1unz 6/5djWUCHf9Z35jCj6XhRNki2EEq/qG5Thl3+E3bG56dEgba0i1BSCXuLeQtXUtDYUsecm+11Wi iLr6N0qQaS58yKefKy5gPUUKTsV0XpTsDpPqds7VDOeiKzU0nGIEBGigCByLkVJvyPATTe4cQbP QDzFSfEslTce3fjyp17A== X-Received: by 2002:a17:90b:58ce:b0:381:152b:d596 with SMTP id 98e67ed59e1d1-38dc74cff62mr495341a91.11.1783717070129; Fri, 10 Jul 2026 13:57:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 46/51] accel/tcg: Drop stale assert for vaddr Date: Fri, 10 Jul 2026 13:53:56 -0700 Message-ID: <20260710205401.836304-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717391112158500 Content-Type: text/plain; charset="utf-8" We no longer support 32-bit hosts. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/cputlb.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 695476eef1..c8ba727859 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -86,11 +86,6 @@ } \ } while (0) =20 -/* run_on_cpu_data.target_ptr should always be big enough for a - * vaddr even on 32 bit builds - */ -QEMU_BUILD_BUG_ON(sizeof(vaddr) > sizeof(run_on_cpu_data)); - static inline size_t tlb_n_entries(CPUTLBDescFast *fast) { return (fast->mask >> CPU_TLB_ENTRY_BITS) + 1; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717354; cv=none; d=zohomail.com; s=zohoarc; b=Kt3vku1A7j+fXxVTOOUjzcwtVF8uIA1yizVael2heuBzlSGqkwC9aGJ/9N48A93ew/UCVlXI32VraOMR3zG501DRH9QyCP1cg3N7E66CD+EPgyNFJxKN9q9s97029rkSAVqoFKZJkenXmQyZFfO7CAYPIdImqBisctTB4zL6zD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717354; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JmjdcWDm3mF1YdNNpgp9aZdazz5VacQFjad94vdrfZs=; b=j9DKcAzp0xyQO1Z3GVEzdQVoQdn8x/sYhmn7YmDA6LkvT11A33NAbKotala/5Wj4z2GoDgnCUMZp5Lp5fcpiyFm4pPGEy48xILFPQsIl7q5HsQ35TQ1/02vEhmpMznKf0lyA7JPeuPzNcribn7qfREzYx07NFEAQGqi5dgkdIwM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717354183956.4347644814426; Fri, 10 Jul 2026 14:02:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIK6-000285-5B; Fri, 10 Jul 2026 16:59:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIN-0000w6-CC for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:05 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIIC-0001wA-Os for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:03 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-38125cebfdaso1934160a91.1 for ; Fri, 10 Jul 2026 13:57:51 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717071; x=1784321871; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JmjdcWDm3mF1YdNNpgp9aZdazz5VacQFjad94vdrfZs=; b=w7myDxbY0j/pKAPQCAtHPY+3cs14SMqB5k9lZ37eup9GINqoPB7+0cQV4pkqhlrgsF /qUs7oeD1y/tVWh6/mQGhgbBryAtd3F0E/4d5KaxdwR/sd5wGCVV8L78xtZNBDWdeS3x 0g5mpfwezF6WQRpmd/Yxq/jzvJN/jUffeDJTe7ql1sSLGijuTAjsBC51Bv/FZjLfaU91 ZScEZawT9tqhjYFK+6zNBHK3ugoYDZOeO86q7qeSAtLB+1zenigw8rzWkb82Wd+eMRMt B3t8h5WhdYVSvbsMF2dSli22oBuy2lSM7YOKNCRQue9yv/QydjgPd8Qig6D35pJxEC1N kmAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717071; x=1784321871; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=JmjdcWDm3mF1YdNNpgp9aZdazz5VacQFjad94vdrfZs=; b=O61/2VHUZ74Qcv0HHU1QmHzMlU2MXHV5167lXdE4tYa0rSLX26Jo+v45KInqezUTSa LZQXgUiYk/CbB+E1nIOchwNFg8RJaC8fo18+kBXLdvd4RSsOdsHS6P59y3McodQ/AdRv Jf4Ejo86LDkYaHX9EVar06+k9Fsx1jrwfyh4D0VnxiUQ85e6vO7vGhIy9jCZPGj6JBs+ /6FHfqDqCeRQcUxujT0+pCNKfZFwXYMfpYEr0c7GkwzMpfIg9PsH3Db4wOd9mDbW8j79 NZh4cN2DRjh6d2RifwNCf3vf9QIHWDmdwhcu/1nmntn1IbkovKMZ5xRCDktVFMEi9y0S xfyQ== X-Gm-Message-State: AOJu0YySu6AXokZRFAOOikS1s2qPKpkOeUkCuxpWmcMcDj18Ao1PoFT3 /BXVm6xQ2RSYJC6wSFhLrKeUBS4ujVSqAjYqLIo2d1dNm1S70/eEj7AGNi4esPwHd/PyvoV1cic 0Gaxq X-Gm-Gg: AfdE7ck5sg/0AE4yKyEIrBTwO/OQn+CMCv7o+9IA9LgJ4qnaE4WVEn4pYt9ZMF2Un/+ zEFbWVjLmYBTTTw4+F6W4uZxFxYYfO1tZzMD52Hj0ucJ93QjD6Ge8dkuEpYpkv3+5cBU6On0Anb U5P7vwBYWNvg1fbbkwgzDFp1YjqLywJwLJaMU+NF+2JSadxczEeWzhUR86HFkZjkNV+/zO0heDq AuRIa2oupGCaVNFibwgkwa3P/q4nrFZGVPB7nLa+2bKXjc+4b7o9R8hD7H0d4hFthv7hr0eWFg9 xCJDAC0NoXZZFlgRanlGt+TNBzBg52qlXxycHFPqkCKsxEPcwQly0sAot1l5qQrJHBDHcQDVnG5 HX091dWc+u4FasES1Y0p1lDsp0oTqtmGLIiLLj4r5mrdV/P5gA4KARtxN8wXkI7C5fspUTYkPSn 4GCc5TZ/0Fr8GUg7D2WA== X-Received: by 2002:a17:90a:da87:b0:37f:caeb:69df with SMTP id 98e67ed59e1d1-38dc77381f2mr529130a91.22.1783717070836; Fri, 10 Jul 2026 13:57:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 47/51] accel/tcg: Use addr/last in tlb_flush_range_locked Date: Fri, 10 Jul 2026 13:53:57 -0700 Message-ID: <20260710205401.836304-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717354705158500 Content-Type: text/plain; charset="utf-8" Change from addr/len to addr/last in the implementation. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 71 +++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c8ba727859..2c0f7bed52 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -655,7 +655,7 @@ void tlb_flush_page_all_cpus_synced(CPUState *src, vadd= r addr) } =20 static void tlb_flush_range_locked(CPUState *cpu, int midx, - vaddr addr, vaddr len, + vaddr addr, vaddr last, unsigned bits) { CPUTLBDesc *d =3D &cpu->neg.tlb.d[midx]; @@ -669,13 +669,13 @@ static void tlb_flush_range_locked(CPUState *cpu, int= midx, * TODO: Perhaps allow bits to be a few bits less than the size. * For now, just flush the entire TLB. * - * If @len is larger than the tlb size, then it will take longer to + * If [addr:last] is larger than the tlb size, then it will take longe= r to * test all of the entries in the TLB than it will to flush it all. */ - if (mask < f->mask || len > f->mask) { + if (mask < f->mask || ((addr ^ last) & ~f->mask) !=3D 0) { tlb_debug("forcing full flush midx %d (" - "%016" VADDR_PRIx "/%016" VADDR_PRIx "+%016" VADDR_PRIx = ")\n", - midx, addr, mask, len); + "%016" VADDR_PRIx "/%016" VADDR_PRIx "-%016" VADDR_PRIx = ")\n", + midx, addr, mask, last); tlb_flush_one_mmuidx_locked(cpu, midx, get_clock_realtime()); return; } @@ -685,7 +685,7 @@ static void tlb_flush_range_locked(CPUState *cpu, int m= idx, * Because large_page_mask contains all 1's from the msb, * we only need to test the end of the range. */ - if (((addr + len - 1) & d->large_page_mask) =3D=3D d->large_page_addr)= { + if ((last & d->large_page_mask) =3D=3D d->large_page_addr) { tlb_debug("forcing full flush midx %d (" "%016" VADDR_PRIx "/%016" VADDR_PRIx ")\n", midx, d->large_page_addr, d->large_page_mask); @@ -693,20 +693,23 @@ static void tlb_flush_range_locked(CPUState *cpu, int= midx, return; } =20 - for (vaddr i =3D 0; i < len; i +=3D TARGET_PAGE_SIZE) { - vaddr page =3D addr + i; + for (vaddr page =3D addr; ; page +=3D TARGET_PAGE_SIZE) { CPUTLBEntry *entry =3D tlb_entry(cpu, midx, page); =20 if (tlb_flush_entry_mask_locked(entry, page, mask)) { tlb_n_used_entries_dec(cpu, midx); } tlb_flush_vtlb_page_mask_locked(cpu, midx, page, mask); + + if (page =3D=3D last) { + break; + } } } =20 typedef struct { vaddr addr; - vaddr len; + vaddr last; MMUIdxMap idxmap; unsigned bits; } TLBFlushRangeData; @@ -718,13 +721,13 @@ static void tlb_flush_range_by_mmuidx_async_0(CPUStat= e *cpu, =20 assert_cpu_is_self(cpu); =20 - tlb_debug("range: %016" VADDR_PRIx "/%u+%016" VADDR_PRIx " mmu_map:0x%= x\n", - d.addr, d.bits, d.len, d.idxmap); + tlb_debug("range: %016" VADDR_PRIx "/%u-%016" VADDR_PRIx " mmu_map:0x%= x\n", + d.addr, d.bits, d.last, d.idxmap); =20 qemu_spin_lock(&cpu->neg.tlb.c.lock); for (mmu_idx =3D 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { if ((d.idxmap >> mmu_idx) & 1) { - tlb_flush_range_locked(cpu, mmu_idx, d.addr, d.len, d.bits); + tlb_flush_range_locked(cpu, mmu_idx, d.addr, d.last, d.bits); } } qemu_spin_unlock(&cpu->neg.tlb.c.lock); @@ -733,7 +736,7 @@ static void tlb_flush_range_by_mmuidx_async_0(CPUState = *cpu, * If the length is larger than the jump cache size, then it will take * longer to clear each entry individually than it will to clear it al= l. */ - if (d.len >=3D (TARGET_PAGE_SIZE * TB_JMP_CACHE_SIZE)) { + if (((d.last - d.addr) >> TARGET_PAGE_SIZE) + 1 >=3D TB_JMP_CACHE_SIZE= ) { tcg_flush_jmp_cache(cpu); return; } @@ -742,10 +745,11 @@ static void tlb_flush_range_by_mmuidx_async_0(CPUStat= e *cpu, * Discard jump cache entries for any tb which might potentially * overlap the flushed pages, which includes the previous. */ - d.addr -=3D TARGET_PAGE_SIZE; - for (vaddr i =3D 0, n =3D d.len / TARGET_PAGE_SIZE + 1; i < n; i++) { - tb_jmp_cache_clear_page(cpu, d.addr); - d.addr +=3D TARGET_PAGE_SIZE; + tb_jmp_cache_clear_page(cpu, d.addr - TARGET_PAGE_SIZE); + for (vaddr page =3D d.addr; ; page +=3D TARGET_PAGE_SIZE) { + if (page =3D=3D d.last) { + break; + } } } =20 @@ -761,7 +765,12 @@ void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr ad= dr, vaddr len, MMUIdxMap idxmap, unsigned bits) { - TLBFlushRangeData d; + TLBFlushRangeData d =3D { + .addr =3D addr & TARGET_PAGE_MASK, + .last =3D (addr + len - 1) & TARGET_PAGE_MASK, + .idxmap =3D idxmap, + .bits =3D bits, + }; =20 assert_cpu_is_self(cpu); =20 @@ -770,21 +779,16 @@ void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr a= ddr, tlb_flush_by_mmuidx(cpu, idxmap); return; } + /* * If all bits are significant, and len is small, * this devolves to tlb_flush_page. */ - if (len <=3D TARGET_PAGE_SIZE && bits >=3D target_long_bits()) { + if (d.addr =3D=3D d.last && bits >=3D target_long_bits()) { tlb_flush_page_by_mmuidx(cpu, addr, idxmap); return; } =20 - /* This should already be page aligned */ - d.addr =3D addr & TARGET_PAGE_MASK; - d.len =3D len; - d.idxmap =3D idxmap; - d.bits =3D bits; - tlb_flush_range_by_mmuidx_async_0(cpu, d); } =20 @@ -800,7 +804,13 @@ void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUStat= e *src_cpu, MMUIdxMap idxmap, unsigned bits) { - TLBFlushRangeData d, *p; + TLBFlushRangeData d =3D { + .addr =3D addr & TARGET_PAGE_MASK, + .last =3D (addr + len - 1) & TARGET_PAGE_MASK, + .idxmap =3D idxmap, + .bits =3D bits, + }; + TLBFlushRangeData *p; CPUState *dst_cpu; =20 /* If no page bits are significant, this devolves to tlb_flush. */ @@ -808,21 +818,16 @@ void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUSta= te *src_cpu, tlb_flush_by_mmuidx_all_cpus_synced(src_cpu, idxmap); return; } + /* * If all bits are significant, and len is small, * this devolves to tlb_flush_page. */ - if (len <=3D TARGET_PAGE_SIZE && bits >=3D target_long_bits()) { + if (d.addr =3D=3D d.last && bits >=3D target_long_bits()) { tlb_flush_page_by_mmuidx_all_cpus_synced(src_cpu, addr, idxmap); return; } =20 - /* This should already be page aligned */ - d.addr =3D addr & TARGET_PAGE_MASK; - d.len =3D len; - d.idxmap =3D idxmap; - d.bits =3D bits; - /* Allocate a separate data block for each destination cpu. */ CPU_FOREACH(dst_cpu) { if (dst_cpu !=3D src_cpu) { --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717393; cv=none; d=zohomail.com; s=zohoarc; b=U2XaOkKL7VD6LCTiiHq0DqotMLWjH9Ica3PP/eae96MY4Qzc/frGNB22WNQN6kt0sUduaR+ISo1FVd5Dj4rCs9LRu9RPo67ER1MM3K7Vk4/6B71j4/kLtJWpCMuGzdZ9hqkZWki7YmI+AtrCgoVDeQMDVMQxU7QyP93q5n1HyhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717393; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XDiSL4skeBdw/QfZ4bPcuanFzLKyweW4gBYzMWPnN78=; b=XDkeh5P8p36ZXhdthwD18z8aE6ZBaVi0nim4vk0Bmiq2FumErjK+46RZpAs4zPwu/+sPmq8RDLKGjkkIGsbz7Esnda7nYaNztn846eNZ2LEZcN9HUolflGXU0SwUdZLzeFvdvrUIJIr/Hogg7shE7KfpWVUpBwyYnp07Ud9PMgI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717393773136.85054618492973; Fri, 10 Jul 2026 14:03:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIKG-00035d-3t; Fri, 10 Jul 2026 17:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIQ-0000yE-4X for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:13 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIID-0001xB-Iv for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:05 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-383cb94f742so1237580a91.3 for ; Fri, 10 Jul 2026 13:57:52 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717072; x=1784321872; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XDiSL4skeBdw/QfZ4bPcuanFzLKyweW4gBYzMWPnN78=; b=SWigjjwV+adHRAHruT2Xzf4LIZ/QXekhl5kA0EvV/cGTTxJjhPwtaDkfEp35/n9uzq hQ+uKQ1Xjyxsykur9kI8zTq6EiDLtTfLKBzKd/mGCp8RdCe/ptxohScWZJDCqHhtTYPS 0rfng+ByxQhUS9VgGypuw7XFDrF1nF362CFcaDX7D0jn9naGvnP9EySQ4ZqpJSS39TV2 UQe/ldUZPvp5ZkAA7lDMeiU0+OFrfXQXDE8+EWYDFVahuhEoqxkkcPMF9O7e01RYS/mH BA/U2hJHub7wxTYbqX5GVahcN3+9gdVS7Do/wba1da75/Gq/urmZzIKrjcVFDw2kPOvP W/aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717072; x=1784321872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=XDiSL4skeBdw/QfZ4bPcuanFzLKyweW4gBYzMWPnN78=; b=oMGpo7JCiHV4JbITCGKo4Mqla/1X0SyNU+qdLEmN8PO+qMUvfhvvQzhHVSoJFK7vty UUFdj5ZF04aXCVGEenoteMTUYx4G+Dghk7Pzv/xMzlFVRUjdT/tGIrEIaTiS3bBjLvCP 3ZZAajizYzuCAZ74wXUCxQEaDzGLI/n7VvpH3sh5CZH6Ui25T0a2iM7v72ViKQb9Tb5v dJMU56cMcMK6JV8NuwBLWhBDPgYefFKv2Y9J6IZbG2dLcKmSs2J/k9JEoobu7+lEd8A/ O8Wn8TXnSdhujea49uFNacXfM9wqT2ex/tbpdyhwSOxVt2u4x0u66hEVDZ6PmW2lby2O dcvw== X-Gm-Message-State: AOJu0YzqKJKb6nIiS3u1PIJHFWQJdDAIqhgr1EJhYMXLdYsTzoNWelMK G0XKpZi/UOvAERggcyv2R8ZzK/E18O6+SNXN5nFV9uPRieh1CBROt7QcQvx+F5l4Qp5qjPY4rHG O9haY X-Gm-Gg: AfdE7cn0sMUZeMkYgfb1Zg+8+BGACwS7TN8HjHUU/RT1RwNVh3TNIqYYsVnmmvTo+Iu QNKKhZCWaoajR5eLIvDjT/uHk2DNpqc90mi7ZcsdtpqJr0ZaeUgUVYhFn+UAHLpB58OpOGaUhYq 6TZtdMlzU+8fmztkDK7OxGUfzexuNWHYyRwdgoYV/L0H+XUhYfBaegbDz/WzwIHwxi/noYbAcp3 DtUqITz2LfR9LGiXazPjI5y4lQKHeqVGC0EpTnDgarkqxdXxZMrd+Cs7ihX8AaAno3gTAC1i9HO m8iNliAKIFUaOjsTY7RjxbNK0JY9dL8MRvq/MuzX+HudVUOgw4BNYz2yA6yfxmcnPZd7UfYWoJN f2aQo9yybFIa8A1p3UZZE70F2tqyB4c0NWr8BbVQKJX4GpaG3AMtN/WuSmDkBhbDZ5mj6JdfyQ2 CoLpidJZvmOkRz46YKAw== X-Received: by 2002:a17:90b:3806:b0:37f:e326:6559 with SMTP id 98e67ed59e1d1-38dc7b37972mr513114a91.22.1783717071586; Fri, 10 Jul 2026 13:57:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com, qemu-stable@nongnu.org Subject: [PATCH v3 48/51] target/arm: Be more defensive for invalid tlbi_aa64_get_range Date: Fri, 10 Jul 2026 13:53:58 -0700 Message-ID: <20260710205401.836304-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717394895158500 Content-Type: text/plain; charset="utf-8" It's possible to program TCR_ELx with an invalid granule size, which could match passing an invalid granule size to TLBI RVA, which would then fall through to assert in arm_granule_bits. Cc: qemu-stable@nongnu.org Fixes: 3c003f7029e ("target/arm: Use ARMGranuleSize in ARMVAParameters") Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/tcg/tlb-insns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/tcg/tlb-insns.c b/target/arm/tcg/tlb-insns.c index 1a0a332583..b24eb57788 100644 --- a/target/arm/tcg/tlb-insns.c +++ b/target/arm/tcg/tlb-insns.c @@ -854,7 +854,7 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env, = ARMMMUIdx mmuidx, gran =3D tlbi_range_tg_to_gran_size(page_size_granule); =20 /* The granule encoded in value must match the granule in use. */ - if (gran !=3D param.gran) { + if (gran !=3D param.gran || gran =3D=3D GranInvalid) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid tlbi page size granule %d\= n", page_size_granule); return ret; --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717279; cv=none; d=zohomail.com; s=zohoarc; b=Jt2o6EFEpl/ZOiG85zEgT8UDPTfTmfWOSGGKHteqqwyXZPVRwTtxkRDpCJgtB6EbQ6opR9NT6nm4aZDXh96iIptx5jJB6fNHAzfToXluyvL7ukEfA0rkoLvwuSLv78K4H0nHRyuAZvQRGcvDbUrlJKXYOvgKmHFX72jbZRbzH18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717279; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KpnTdJpquXSGqeXOM/ODDLLKulghlNdrEhAgoBJAG/g=; b=OJNIvwVAMEKepMRKdbcAUcgybnuq++CygFNw6gd/oUL3NE+aDl2uxXfcUv2Op+b8szXH4g1jRuY18Lj/3/3CB5+aXYQVfA8uBkziDbIZR5iCLKAP1XFwoORQLMZ+Uuu9VaO4aTcJlvGxMNWAjMfvPYZXSHuCtxWlnfm9j/xVePA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717279607812.6732090372174; Fri, 10 Jul 2026 14:01:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIKB-0002Zd-Ki; Fri, 10 Jul 2026 16:59:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIS-0000yZ-1b for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:13 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIIE-0001yK-4t for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:07 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-38d489b6b71so1141625a91.0 for ; Fri, 10 Jul 2026 13:57:53 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717072; x=1784321872; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=KpnTdJpquXSGqeXOM/ODDLLKulghlNdrEhAgoBJAG/g=; b=O4odXN0/2FJ2BI+krkEQzvAGSglPW4QlsfSykLmYMmLjnt0CoZ7ScRcI/kgFhQInIQ 04OY0JmsXsoUY8+Wz5ze5ZTiEgFy7veAmgwkMp3aL5CD+1iVzmBuzZhjoML+e/4zKg4q 9ajILiGTEFtCnX0yK89dBsKxowbQFLKaDKxDlVYnNHrerAb3OMc+/pk66dFNJrWKwXk0 bkW/ImIQkHDvNa/17rbtAKddFcZIg/5QAUMRa9abldb5x6RzrjxabduL7l0VwaPIxzTp de+UJ6yofvcr/xNZAEeCJLrScp5mMGJveccugz3SEp9GItqgoQ7uvTV1b6Tf05lLLsVF Xnzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717072; x=1784321872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=KpnTdJpquXSGqeXOM/ODDLLKulghlNdrEhAgoBJAG/g=; b=lUaD4ypDV89tNq80f2+haSasQe2TKsdMYkccOs2UIt8H3qzA8a80jSjMTC5ICzwCOA 9IdNNnmNld9uSVYygSdMKsx2qgkWpB+5z+Mbf2Y46X5KIM/237jbo6uEnON9ZKRHSuZ3 abfkRmr2ymLkYYkzkaM7jROfVrhMe6CN3NlhSJ6ogNCze5O11GiDCFC9IC61dqGWJ55L PjeFi6LHgXP1W8j80CTSlILO2hzdAoGrWluc+KFfXT7NHz9j7vD9LqKwL371hcfFU3gn 2wTk2SyyZ/ezBw1pNxYuYDAPjqJGi4OJOuSe0Cv9BVJ4tEcseGixh53ogiiEXwHIClRN n2Rw== X-Gm-Message-State: AOJu0YxvCS0oM1UqXecHLjN5+HrRKjEbPMr7y4yGbdTjHsBD/mChC5KJ YceVgTZQ8AbWv58G9ag4hyLkuGV7ceAaz6BBcwkNVB29yDF+ZiYiEmdOFFc4o0bDJfMJgqxLW6n BvBs4 X-Gm-Gg: AfdE7cl9cpSzhSGC/r+yRBlf85JkVaTj+VyTXYiHluH4vVVhqcyimV1M/hInN24gYvq 5R4acHN2rWt/LfTfavSkWhtdv8HrF9SaxWJcsdCYRMVwjEg5RDO3CfqIXJbJyDf0zKOvoEJmdgM 9ype7DJ9h9ymTHGicEG9f3LFAVkXl6fASnC2puyexZUJ+31bhnAicxNOrSPtfgwtU0ScdJHyl3q cSjCebGpTLo5hhR7qUxswmPQ5sPNOibwqH/2sEupRmqn0zGsXxACTPJcDKIHG3ADQZw0bhDL5Sm X7Mg2gj6MpJXmqYF7mI9fgORZ7GIOd2FjQWR+4sPaPJpIixC22UQl8dhs2kBy/2LgYd8SCsFLBW 7gPjD2KvIpQvepa2DWRWnT8Ngpsw5WgSVxluuSOHVCnluf6xvVu/LaqSDinA1mhR6vPahh7lR8g TeKc1L3PKMzhFqyOvXi/QxlufPn0h+ X-Received: by 2002:a17:90b:164b:b0:37f:ceed:e1d8 with SMTP id 98e67ed59e1d1-38dc7730cbdmr483202a91.12.1783717072370; Fri, 10 Jul 2026 13:57:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 49/51] accel/tcg: Change tlb_flush_range_* to use addr/last Date: Fri, 10 Jul 2026 13:53:59 -0700 Message-ID: <20260710205401.836304-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717280280158500 Content-Type: text/plain; charset="utf-8" Plugs a hole in the API by which one cannot flush the entire address space with one range. There are only a few users, so it's easy to update them all at once. Signed-off-by: Richard Henderson --- include/exec/cputlb.h | 12 ++++++------ accel/tcg/cputlb.c | 27 ++++++++++++++++----------- target/arm/tcg/tlb-insns.c | 21 +++++++++++---------- target/hppa/mem_helper.c | 3 +-- target/loongarch/tcg/tlb_helper.c | 5 +++-- target/ppc/mmu_helper.c | 4 ++-- 6 files changed, 39 insertions(+), 33 deletions(-) diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h index f7f7020382..30e1d1f93e 100644 --- a/include/exec/cputlb.h +++ b/include/exec/cputlb.h @@ -209,21 +209,21 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CP= UState *cpu, vaddr addr, * tlb_flush_range_by_mmuidx * @cpu: CPU whose TLB should be flushed * @addr: virtual address of the start of the range to be flushed - * @len: length of range to be flushed + * @last: virtual address of the end of the range to be flushed, inclusive * @idxmap: bitmap of mmu indexes to flush * @bits: number of significant bits in address * - * For each mmuidx in @idxmap, flush all pages within [@addr,@addr+@len), + * For each mmuidx in @idxmap, flush all pages within [@addr,@last] * comparing only the low @bits worth of each virtual page. */ void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr addr, - vaddr len, MMUIdxMap idxmap, + vaddr last, MMUIdxMap idxmap, unsigned bits); =20 /* Similarly, with broadcast and syncing. */ void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *cpu, vaddr addr, - vaddr len, + vaddr last, MMUIdxMap idxmap, unsigned bits); #else @@ -268,13 +268,13 @@ tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUStat= e *cpu, vaddr addr, { } static inline void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr addr, - vaddr len, MMUIdxMap idxmap, + vaddr last, MMUIdxMap idxmap, unsigned bits) { } static inline void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *cpu, vaddr addr, - vaddr len, + vaddr last, MMUIdxMap idx= map, unsigned bits) { diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 2c0f7bed52..0a49b87bcb 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -761,13 +761,12 @@ static void tlb_flush_range_by_mmuidx_async_1(CPUStat= e *cpu, g_free(d); } =20 -void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr addr, - vaddr len, MMUIdxMap idxmap, - unsigned bits) +void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr addr, vaddr last, + MMUIdxMap idxmap, unsigned bits) { TLBFlushRangeData d =3D { .addr =3D addr & TARGET_PAGE_MASK, - .last =3D (addr + len - 1) & TARGET_PAGE_MASK, + .last =3D last & TARGET_PAGE_MASK, .idxmap =3D idxmap, .bits =3D bits, }; @@ -795,18 +794,20 @@ void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr a= ddr, void tlb_flush_page_bits_by_mmuidx(CPUState *cpu, vaddr addr, MMUIdxMap idxmap, unsigned bits) { - tlb_flush_range_by_mmuidx(cpu, addr, TARGET_PAGE_SIZE, idxmap, bits); + /* + * The implementation above only cares about the page of @last, + * so we don't need to find the end of the page for @addr. + */ + tlb_flush_range_by_mmuidx(cpu, addr, addr, idxmap, bits); } =20 void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *src_cpu, - vaddr addr, - vaddr len, - MMUIdxMap idxmap, - unsigned bits) + vaddr addr, vaddr last, + MMUIdxMap idxmap, unsigned = bits) { TLBFlushRangeData d =3D { .addr =3D addr & TARGET_PAGE_MASK, - .last =3D (addr + len - 1) & TARGET_PAGE_MASK, + .last =3D last & TARGET_PAGE_MASK, .idxmap =3D idxmap, .bits =3D bits, }; @@ -847,7 +848,11 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPU= State *src_cpu, MMUIdxMap idxmap, unsigned bits) { - tlb_flush_range_by_mmuidx_all_cpus_synced(src_cpu, addr, TARGET_PAGE_S= IZE, + /* + * The implementation above only cares about the page of @last, + * so we don't need to find the end of the page for @addr. + */ + tlb_flush_range_by_mmuidx_all_cpus_synced(src_cpu, addr, addr, idxmap, bits); } =20 diff --git a/target/arm/tcg/tlb-insns.c b/target/arm/tcg/tlb-insns.c index b24eb57788..cf1698941c 100644 --- a/target/arm/tcg/tlb-insns.c +++ b/target/arm/tcg/tlb-insns.c @@ -819,7 +819,7 @@ static const ARMCPRegInfo tlbi_el3_cp_reginfo[] =3D { =20 typedef struct { uint64_t base; - uint64_t length; + uint64_t last; } TLBIRange; =20 static ARMGranuleSize tlbi_range_tg_to_gran_size(int tg) @@ -847,8 +847,8 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env, = ARMMMUIdx mmuidx, /* Extract one bit to represent the va selector in use. */ uint64_t select =3D sextract64(value, 36, 1); ARMVAParameters param =3D aa64_va_parameters(env, select, mmuidx, true= , false); - TLBIRange ret =3D { }; ARMGranuleSize gran; + uint64_t base, length; =20 page_size_granule =3D extract64(value, 46, 2); gran =3D tlbi_range_tg_to_gran_size(page_size_granule); @@ -857,7 +857,8 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env, = ARMMMUIdx mmuidx, if (gran !=3D param.gran || gran =3D=3D GranInvalid) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid tlbi page size granule %d\= n", page_size_granule); - return ret; + /* The behaviour of the insn is undefined. */ + return (TLBIRange) { 0, 0 }; } =20 page_shift =3D arm_granule_bits(gran); @@ -865,12 +866,12 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env= , ARMMMUIdx mmuidx, scale =3D extract64(value, 44, 2); exponent =3D (5 * scale) + 1; =20 - ret.length =3D (num + 1) << (exponent + page_shift); + length =3D (num + 1) << (exponent + page_shift); =20 if (param.select) { - ret.base =3D sextract64(value, 0, 37); + base =3D sextract64(value, 0, 37); } else { - ret.base =3D extract64(value, 0, 37); + base =3D extract64(value, 0, 37); } if (param.ds) { /* @@ -880,9 +881,9 @@ static TLBIRange tlbi_aa64_get_range(CPUARMState *env, = ARMMMUIdx mmuidx, */ page_shift =3D 16; } - ret.base <<=3D page_shift; + base <<=3D page_shift; =20 - return ret; + return (TLBIRange){ .base =3D base, .last =3D base + length - 1 }; } =20 static void do_rvae_write(CPUARMState *env, uint64_t value, @@ -898,12 +899,12 @@ static void do_rvae_write(CPUARMState *env, uint64_t = value, if (synced) { tlb_flush_range_by_mmuidx_all_cpus_synced(env_cpu(env), range.base, - range.length, + range.last, idxmap, bits); } else { tlb_flush_range_by_mmuidx(env_cpu(env), range.base, - range.length, idxmap, bits); + range.last, idxmap, bits); } } =20 diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 01e6149c81..394e975533 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -106,8 +106,7 @@ static void hppa_flush_tlb_ent(CPUHPPAState *env, HPPAT= LBEntry *ent, trace_hppa_tlb_flush_ent(env, ent, ent->itree.start, ent->itree.last, ent->pa); =20 - tlb_flush_range_by_mmuidx(cs, ent->itree.start, - ent->itree.last - ent->itree.start + 1, + tlb_flush_range_by_mmuidx(cs, ent->itree.start, ent->itree.last, HPPA_MMU_FLUSH_MASK, TARGET_LONG_BITS); =20 /* Never clear BTLBs, unless forced to do so. */ diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_h= elper.c index a4b90beca6..3a708ebf3a 100644 --- a/target/loongarch/tcg/tlb_helper.c +++ b/target/loongarch/tcg/tlb_helper.c @@ -130,13 +130,14 @@ static void invalidate_tlb_entry(CPULoongArchState *e= nv, int index) =20 tlb_v =3D pte_present(env, tlb->tlb_entry0); if (tlb_v) { - tlb_flush_range_by_mmuidx(env_cpu(env), addr, pagesize, + tlb_flush_range_by_mmuidx(env_cpu(env), addr, addr + pagesize - 1, idxmap, TARGET_LONG_BITS); } =20 tlb_v =3D pte_present(env, tlb->tlb_entry1); if (tlb_v) { - tlb_flush_range_by_mmuidx(env_cpu(env), addr + pagesize, pagesize, + tlb_flush_range_by_mmuidx(env_cpu(env), addr + pagesize, + addr + 2 * pagesize - 1, idxmap, TARGET_LONG_BITS); } } diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index ac60705402..c881191749 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -734,8 +734,8 @@ static void ppcemb_tlb_flush(CPUState *cs, ppcemb_tlb_t= *tlb) mmu_idx <<=3D 2; } =20 - tlb_flush_range_by_mmuidx(cs, tlb->EPN, tlb->size, mmu_idx, - TARGET_LONG_BITS); + tlb_flush_range_by_mmuidx(cs, tlb->EPN, tlb->EPN + tlb->size - 1, + mmu_idx, TARGET_LONG_BITS); } =20 void helper_4xx_tlbwe_hi(CPUPPCState *env, target_ulong entry, --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717301; cv=none; d=zohomail.com; s=zohoarc; b=ifI0/5yLB2A8SV0AvaxxkAX6Nkfr7+Ee/Z/gE+NUvyMcfmD/Xk8A04uVBrEetby+zF+VNo5HxUVOdHPxPvpvNhyIqaGr0JVH5PVXbJQhmz2yi5dK43FF580dwnZZh8YPX8MiJYR44qRUTZOYfX9JM2mTDm+s8DJaVtNExhEv8Y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717301; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/dRLgHIpg9jU4QQ3fj8FRVxP7oOcs4Ea/cFITkJMzy0=; b=ecUhVsdNDS9EonEPt6PdBsJ7SJoSFFFGh70a2uqRbZpvf8ymXDqtSg4F2F90DXnjKL2YIBRZirXlZuYnSQCg62L1b2s+z1z2nUFOk8aEn4p+eYcRoshFRODjrNkk9EsKRMZWXQkN0hP+R4aRyljSuVaeCMJfwlijENqN/QmAin8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717301170630.6524039095773; Fri, 10 Jul 2026 14:01:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIKF-00033O-NS; Fri, 10 Jul 2026 17:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIS-0000yf-Jv for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:15 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIIE-0001yv-M6 for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:08 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-381507c9380so1024648a91.0 for ; Fri, 10 Jul 2026 13:57:54 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717073; x=1784321873; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/dRLgHIpg9jU4QQ3fj8FRVxP7oOcs4Ea/cFITkJMzy0=; b=B0qj2qEo4JAtD+kE8gOMN8CsmaE97w5kIcqhutMXNvdupHEkQfOyv9ksqCv3vPXFLT My8XRSXB5yagF0ywJqp/6Ag3rS0bn8HbNQqjABeBw5lOmvsb7hiW6usMhaXiTxaaQBuu F5UuqBnsjbvk46ercB1pXUZ5SOFzgcFRb52mtm/S7s+JV4VZ1Iovqal31hBcdgMn2edY sOoV/8MY/Wx5CBVjXbCQdbM8aug1+4/APRrBnQX6mc6t5jHCJ6FNOwbDdMsPQ0DWYpnt 8g4fKIV/cGSDedV11ZlRlXfoKwJLofMloAaCVF6HPbMETt3IJnB0BELBZ9bYrlTFnTZ1 0QxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717073; x=1784321873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/dRLgHIpg9jU4QQ3fj8FRVxP7oOcs4Ea/cFITkJMzy0=; b=T/olNkdnAiM5CAJdatK6mQDpmw4+aOqI2rEqM12Lmqqyvird+r6IQI/t/A4Fn0R3X9 Y+HjPALYPZ5nglcbu14QGtQAWl8USOXU1zIbLRXFbz5MqWsXF1NK3XHw9JZ6jt8iMS8G lTOOtrdX8XRxt3wN0BnM//tVABrmk1BEjAesBc4y9FrNQvXzqNebNTTC7gRVgqluVuZY 6Mkyz+HxNTloJcp2IaeCZActqe+Le2B7fyH9E4tHJBZdaQkWYKIfhS9CzGqcKABFIg1H qrJabEL2PvT26MgAPrj7IO2xR4e3TZQitT1MVutb8lPslweaCnF90ImTeNLNCyPsBfD8 r/OQ== X-Gm-Message-State: AOJu0Ywn6+kKahza2DSeRHKi83au0xf0SScAwu3nmaWKIu4TkVJC2AEI lfflKT1YS7eMp7FshdtOiSOnH7HkSWnncnf8nZnQFFglGEwJ7agImHDbbxd8a5Mw3PokbMCnqW9 wck+n X-Gm-Gg: AfdE7ckd/IUK3WUiJ3Xv+ht/SaYjyOfw9GFvFvKrbZaBbceJsu0QunO0KnutJ4SwTE0 q7WfGXdgYfRgjCPSUOLPWZBc4S8TElRjPT3+0UwDuFt1QxaAUnph6E46GGp3nxrh6gX1RCPHTih EW0FLnXq9qnaU5w3uAvLtr5PxU+cf1Dt4rLxomqnM87jC8djJFsJPu60IOUCPRdsP5BFnNbFeNP i8qy1dQR8pbgbDnY55UsEkRnQ02cjomJ2p97wBGY19PZodmb9zn7LbUWLTbXDfpskdJIfT1FEfk ZESaIJsIEoSd0r8fKhgQhWUbPQHfEIsHrXTbhi6BM9E/wFd/KNC+Y1+8I2bHn/WSfncx8LxdR6R tWjciaMRC8G5a/UO2nHx3wORD+EFs0Qg0VYfhkqK4gtgtagPH/Hxd0ICJ2AtfOSyJ5kl/j1nhdj nEr6EtYQPARlNngXhZ7GM3hTMh2963 X-Received: by 2002:a17:90b:2f0d:b0:37f:9ce1:7360 with SMTP id 98e67ed59e1d1-38dc77aba5cmr457732a91.33.1783717073029; Fri, 10 Jul 2026 13:57:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 50/51] system: Use tlb_flush_range_by_mmuidx in cpu_watchpoint_insert Date: Fri, 10 Jul 2026 13:54:00 -0700 Message-ID: <20260710205401.836304-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717302319158500 Content-Type: text/plain; charset="utf-8" Update to newer tlb_flush api and flush exactly what is required, not single-page vs everything. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- system/watchpoint.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/system/watchpoint.c b/system/watchpoint.c index 35cb3bdaec..fe7e0ac59f 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -29,7 +29,6 @@ CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr= addr, vaddr len, { CPUBreakpoint *wp; vaddr last =3D addr + len - 1; - vaddr in_page; =20 assert(len !=3D 0); assert(last >=3D addr); @@ -45,12 +44,8 @@ CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vadd= r addr, vaddr len, =20 interval_tree_insert(&wp->itree, &cpu->watchpoints); =20 - in_page =3D -(addr | TARGET_PAGE_MASK); - if (len <=3D in_page) { - tlb_flush_page(cpu, addr); - } else { - tlb_flush(cpu); - } + tlb_flush_range_by_mmuidx(cpu, addr, last, ALL_MMUIDX_BITS, + target_long_bits()); return wp; } =20 --=20 2.43.0 From nobody Sun Jul 12 00:42:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1783717282; cv=none; d=zohomail.com; s=zohoarc; b=FDNeZS+XgKC5mwO5A28D0lngAMHtqtKI5UqVVmJ0dPyUSD+kWJFU4E0Y4Zm9BsJIg3xEiSzD996kVH4cU+oZiiZ2Oyxl1b+/ADZ38c4jHb+CLp+zHtomPsSbPdY9rb+UD0v9nCc0BTH6XNHRvX5LDM4i2N3fZ+HhfFm4RTNL2nM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783717282; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SJXo9dmPwlA/s00enjuVhcLjfiAYT7fqyYmVJu+OMt4=; b=WTdm8FSDVqfwAlP4IVVD8ijFqEmDQ7UHt96X9KNZT1hilGp1PSDVftEGldGnBsFxjnFnsg1O4LIOO7qdBF2s5ItbYWevw6tpTMIRsRTvRTIXPIOgoAC2dIj0g0TNJNziXVjNiMbVfnk4UGyf0ORGlHyKimUFKAh3FnkUHAwTYmk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1783717282646775.4088677707321; Fri, 10 Jul 2026 14:01:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wiIKa-0004Ur-4m; Fri, 10 Jul 2026 17:00:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wiIIX-0000zJ-Ev for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:20 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wiIIF-0001zm-JP for qemu-devel@nongnu.org; Fri, 10 Jul 2026 16:58:10 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-380cda7f00cso1358436a91.0 for ; Fri, 10 Jul 2026 13:57:54 -0700 (PDT) Received: from stoup.. ([71.212.146.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38a58792cdasm3256221a91.16.2026.07.10.13.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 13:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1783717074; x=1784321874; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SJXo9dmPwlA/s00enjuVhcLjfiAYT7fqyYmVJu+OMt4=; b=K5rpq/B7qOozw+3LyARG7aVdg+i++z8drWKqrOnusvtfXBksMvnX4qRuCP+3M3ziHQ GpyCYF5ph08IF0YkwSCkdf/d6XYVE9nzyCZ+sS5hsPLkA79lGIZY/B7kPDgLG/MKmtxR sMCy6XBr/mtc2giDA8VdmpyQ5ie7L9SplNP5nF0ruqBu/jEQjKTxcLNtrNtQK5icf7KH Y88/dKMSbVuXkQzjvynJZOLaQQMmoQashCxAWMx2R3ozCF/riOk+zhc/+NTrLQBqRQk5 OPom8YWCg3McWSLo56uu0tjLikPd+ilNijuBvNC5ISrxab681OaExrw2u6C0sCWn1AnF O+6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783717074; x=1784321874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=SJXo9dmPwlA/s00enjuVhcLjfiAYT7fqyYmVJu+OMt4=; b=dpi/iO/YHbOFN9GErCOaTTGL9B5iobsn1GfzJGwFx/gRMrK6L3dnzSL6fSfSf4uksw ICOcJRTVjbALQflCtibFQKnE0qCHdNuHnOkSKuN0uYgYKBWobPDhwfj/ws2RJLGclpgu J//z/yvW1S2BYsZqWYKp5hBLWruCXb3q/Lh8TYBw5E96FXEaqmrdu3hKRFXDdKvcJOuh 2LM0uQcOo+MFC794msElo+G0kgzNDw6tHq7nQXWPO6h4XT7YUwBjvCE7+uTh0QirTXSb xzx5DfGlv9cr+OyBn6xftNs0MTaG7RzdvrTlMju0ydYXewagdSrXclzYcdYh3GRzsHNA lQyQ== X-Gm-Message-State: AOJu0YwvmgYos9A0mUcWvENg0ydWjTtZrrp8tPiFxx+AN0wPHL0Uxfcm ScA1bqoAKv0SxHRdvv3xfA3PeEa2Q12NFa4b1qMQgzTWuw2wPjiu16+2VRwcUQiukN1aqlJf9Uo 6EiVr X-Gm-Gg: AfdE7clb4ECOk2cGtGl4hQ4DD1+XU1hLLS0GAk7LDFiNM1+y/7kC1M5qHQM0qBY6I8T wss4uaVrIo4q+Tin1GjGS34ME1aQ1WQQSlHA3ES58o7jm5K3IhhdV7wbOMnajVMiGJ9BVR3831F uYbd25MMA0LWXXzCIOZ0aeZt94Fqnej9TxlEiNaLJN9yVm2zc2xL3BP3rDj25OvEoea5feD+QCS pmkyt71eYhzuNdnnHtpWb/URsTv6UFAF6SsXurKle7gROV4dYlShVcFrZvUUaBUYTAiNpft9lWJ hLZJ7aUJnkeAY44XF5hnJXfI8DmNZZkbQpvvUe6+S5pMTGjrY5/T2F9ezxYBPTPEA+FUhoI7KGn IL1tklzSan0F6+2VWJr0XmnKmxElQTKToLYTH2g1G6+p4zkrPzyDtgFEzHj/+Zkue8TSsHqYghl CQQVPE1Ag8DXcuhDIqPw== X-Received: by 2002:a17:90b:2d08:b0:37f:9cdf:f03e with SMTP id 98e67ed59e1d1-38dc7b967b8mr427558a91.33.1783717073751; Fri, 10 Jul 2026 13:57:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com Subject: [PATCH v3 51/51] accel/tcg: Change cpu_watchpoint_insert to use addr/last Date: Fri, 10 Jul 2026 13:54:01 -0700 Message-ID: <20260710205401.836304-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710205401.836304-1-richard.henderson@linaro.org> References: <20260710205401.836304-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1783717284337158500 Content-Type: text/plain; charset="utf-8" Plugs a hole in the API by which one cannot watch the entire address space with one range. Eliminates a workaround in s390x where we used 2 watchpoints for exactly that. Signed-off-by: Richard Henderson --- include/exec/breakpoint.h | 2 +- accel/tcg/tcg-accel-ops.c | 7 +++++-- accel/tcg/user-exec-stub.c | 2 +- system/watchpoint.c | 4 +--- target/arm/tcg/debug.c | 10 +++++----- target/i386/tcg/system/bpt_helper.c | 4 ++-- target/ppc/cpu.c | 2 +- target/riscv/debug.c | 4 ++-- target/s390x/tcg/debug.c | 16 ++++------------ 9 files changed, 22 insertions(+), 29 deletions(-) diff --git a/include/exec/breakpoint.h b/include/exec/breakpoint.h index e9b77081e7..79a1453a45 100644 --- a/include/exec/breakpoint.h +++ b/include/exec/breakpoint.h @@ -44,7 +44,7 @@ void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreak= point *breakpoint); void cpu_breakpoint_remove_all(CPUState *cpu, BreakpointFlags mask); bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, BreakpointFlags mask); =20 -CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, +CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr first, vaddr las= t, BreakpointFlags flags, unsigned id); int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, BreakpointFlags flags); diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 79289bf7b2..fd14459f7d 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -131,6 +131,7 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs, = GdbBreakpointType type, vaddr addr, vaddr len) { CPUState *cpu; + vaddr last; =20 switch (type) { case GDB_BREAKPOINT_SW: @@ -142,11 +143,13 @@ static int tcg_insert_gdbstub_breakpoint(CPUState *cs= , GdbBreakpointType type, case GDB_WATCHPOINT_WRITE: case GDB_WATCHPOINT_READ: case GDB_WATCHPOINT_ACCESS: - if (len =3D=3D 0 || addr + (len - 1) < addr) { + last =3D addr + (len - 1); + if (len =3D=3D 0 || last < addr) { return -EINVAL; } CPU_FOREACH(cpu) { - cpu_watchpoint_insert(cpu, addr, len, xlat_gdb_type(cpu, type)= , 0); + cpu_watchpoint_insert(cpu, addr, last, + xlat_gdb_type(cpu, type), 0); } return 0; default: diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c index c45e31e2fa..a989aeaa60 100644 --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -21,7 +21,7 @@ void cpu_exec_reset_hold(CPUState *cpu) { } =20 -CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, +CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr last, BreakpointFlags flags, unsigned id) { g_assert_not_reached(); diff --git a/system/watchpoint.c b/system/watchpoint.c index fe7e0ac59f..cb9f41269c 100644 --- a/system/watchpoint.c +++ b/system/watchpoint.c @@ -24,13 +24,11 @@ #include "hw/core/cpu.h" =20 /* Add a watchpoint. */ -CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, +CPUBreakpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr last, BreakpointFlags flags, unsigned id) { CPUBreakpoint *wp; - vaddr last =3D addr + len - 1; =20 - assert(len !=3D 0); assert(last >=3D addr); assert(flags & BP_MEM_ACCESS); assert(ctpop32(flags & BP_ANY) =3D=3D 1); diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 1dec39c0bf..b3e7df7876 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -524,7 +524,7 @@ static void hw_watchpoint_update_v6(ARMCPU *cpu, int n,= BreakpointFlags flags) * of the BAS bits until breakpoint hit. */ CPUARMState *env =3D &cpu->env; - uint32_t wvr =3D env->cp15.dbgwvr[n] & ~3; + uint32_t wvr =3D env->cp15.dbgwvr[n]; uint32_t wcr =3D env->cp15.dbgwcr[n]; uint32_t bas =3D FIELD_EX64(wcr, DBGWCR, BAS) & 0xf; =20 @@ -533,8 +533,8 @@ static void hw_watchpoint_update_v6(ARMCPU *cpu, int n,= BreakpointFlags flags) return; } =20 - env->cpu_watchpoint[n] =3D cpu_watchpoint_insert(CPU(cpu), wvr, 4, - flags, n); + env->cpu_watchpoint[n] =3D + cpu_watchpoint_insert(CPU(cpu), wvr & ~3, wvr | 3, flags, n); } =20 static void hw_watchpoint_update_v7(ARMCPU *cpu, int n, BreakpointFlags fl= ags) @@ -595,8 +595,8 @@ static void hw_watchpoint_update_v7(ARMCPU *cpu, int n,= BreakpointFlags flags) wvr +=3D basstart; } =20 - env->cpu_watchpoint[n] =3D cpu_watchpoint_insert(CPU(cpu), wvr, len, - flags, n); + env->cpu_watchpoint[n] =3D + cpu_watchpoint_insert(CPU(cpu), wvr, wvr + len - 1, flags, n); } =20 void hw_watchpoint_update(ARMCPU *cpu, int n) diff --git a/target/i386/tcg/system/bpt_helper.c b/target/i386/tcg/system/b= pt_helper.c index 86562fc946..3307b2f52e 100644 --- a/target/i386/tcg/system/bpt_helper.c +++ b/target/i386/tcg/system/bpt_helper.c @@ -74,7 +74,7 @@ static int hw_breakpoint_insert(CPUX86State *env, int ind= ex) if (hw_breakpoint_enabled(dr7, index)) { env->cpu_watchpoint[index] =3D cpu_watchpoint_insert(cs, drN, - hw_breakpoint_len(dr7, index), + drN + hw_breakpoint_len(dr7, index) = - 1, BP_CPU | BP_MEM_WRITE, index); } break; @@ -83,7 +83,7 @@ static int hw_breakpoint_insert(CPUX86State *env, int ind= ex) if (hw_breakpoint_enabled(dr7, index)) { env->cpu_watchpoint[index] =3D cpu_watchpoint_insert(cs, drN, - hw_breakpoint_len(dr7, index), + drN + hw_breakpoint_len(dr7, index) = - 1, BP_CPU | BP_MEM_ACCESS, index); } break; diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index fbd199c08d..f153d2fece 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -172,7 +172,7 @@ void ppc_update_daw(CPUPPCState *env, int rid) } =20 env->dawr_watchpoint[rid] =3D - cpu_watchpoint_insert(cs, deaw, len, flags, rid); + cpu_watchpoint_insert(cs, deaw, deaw + len - 1, flags, rid); } =20 void ppc_store_dawr0(CPUPPCState *env, target_ulong val) diff --git a/target/riscv/debug.c b/target/riscv/debug.c index 803418f390..0995ad157c 100644 --- a/target/riscv/debug.c +++ b/target/riscv/debug.c @@ -503,7 +503,7 @@ static void type2_breakpoint_insert(CPURISCVState *env,= target_ulong index) size =3D riscv_cpu_mxl(env) =3D=3D MXL_RV64 ? 8 : 4; } env->cpu_watchpoint[index] =3D - cpu_watchpoint_insert(cs, addr, size, flags, index); + cpu_watchpoint_insert(cs, addr, addr + size - 1, flags, index); } } =20 @@ -622,7 +622,7 @@ static void type6_breakpoint_insert(CPURISCVState *env,= target_ulong index) uint32_t size =3D extract32(ctrl, 16, 4) ? : 8; =20 env->cpu_watchpoint[index] =3D - cpu_watchpoint_insert(cs, addr, size, flags, index); + cpu_watchpoint_insert(cs, addr, addr + size - 1, flags, index); } } =20 diff --git a/target/s390x/tcg/debug.c b/target/s390x/tcg/debug.c index ef0d953e01..22f75fd3a5 100644 --- a/target/s390x/tcg/debug.c +++ b/target/s390x/tcg/debug.c @@ -31,21 +31,13 @@ void s390_cpu_recompute_watchpoints(CPUState *cs) return; } =20 - if (env->cregs[10] =3D=3D 0 && env->cregs[11] =3D=3D -1LL) { - /* We can't create a watchoint spanning the whole memory range, so - split it in two parts. */ - cpu_watchpoint_insert(cs, 0, 1ULL << 63, wp_flags, 0); - cpu_watchpoint_insert(cs, 1ULL << 63, 1ULL << 63, wp_flags, 0); - } else if (env->cregs[10] > env->cregs[11]) { + if (env->cregs[10] > env->cregs[11]) { /* The address range loops, create two watchpoints. */ - cpu_watchpoint_insert(cs, env->cregs[10], -env->cregs[10], - wp_flags, 0); - cpu_watchpoint_insert(cs, 0, env->cregs[11] + 1, wp_flags, 0); + cpu_watchpoint_insert(cs, env->cregs[10], -1, wp_flags, 0); + cpu_watchpoint_insert(cs, 0, env->cregs[11], wp_flags, 0); } else { /* Default case, create a single watchpoint. */ - cpu_watchpoint_insert(cs, env->cregs[10], - env->cregs[11] - env->cregs[10] + 1, - wp_flags, 0); + cpu_watchpoint_insert(cs, env->cregs[10], env->cregs[11], wp_flags= , 0); } } =20 --=20 2.43.0