From nobody Tue Feb 10 01:35:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552381280277165.2994278546836; Tue, 12 Mar 2019 02:01:20 -0700 (PDT) Received: from localhost ([127.0.0.1]:47639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3dHj-00068f-1A for importer@patchew.org; Tue, 12 Mar 2019 05:01:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3dCC-0001aS-KR for qemu-devel@nongnu.org; Tue, 12 Mar 2019 04:55:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3dCB-0001XY-JP for qemu-devel@nongnu.org; Tue, 12 Mar 2019 04:55:36 -0400 Received: from ozlabs.org ([203.11.71.1]:42887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3dCA-0001Rz-Tr; Tue, 12 Mar 2019 04:55:35 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44JTML38Hdz9sP6; Tue, 12 Mar 2019 19:55:25 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1552380926; bh=qR/R0MY3QIAq48FDvnmhNjl92og3dwnqH+1oxvI5Pjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CF1n1UqrbOQkXwlBvhv3MgcFtpRqvkBAh69Bki2wDEoVZTkMIuPyHwjAkdgG+u7lx K+3bioVsJJnNrtUpUmA88YuP8iKSLkk8Ej7S9MD3QkIR3KVpR6iMuJWSlhbBBxYDXY qf8YW00sK4LI453fn9nXHm9+S4FDCZF21HcN6M8g= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 12 Mar 2019 19:54:14 +1100 Message-Id: <20190312085502.8203-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312085502.8203-1-david@gibson.dropbear.id.au> References: <20190312085502.8203-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 14/62] target/ppc: Move handling of hardware breakpoints to a separate function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, Fabiano Rosas , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas This is in preparation for a refactoring of the kvm_handle_debug function in the next patch. Signed-off-by: Fabiano Rosas Message-Id: <20190228225759.21328-4-farosas@linux.ibm.com> Signed-off-by: David Gibson --- target/ppc/kvm.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 1da28039a8..a54fb9f0a8 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1597,35 +1597,44 @@ void kvm_arch_update_guest_debug(CPUState *cs, stru= ct kvm_guest_debug *dbg) } } =20 +static int kvm_handle_hw_breakpoint(CPUState *cs, + struct kvm_debug_exit_arch *arch_info) +{ + int handle =3D 0; + int n; + int flag =3D 0; + + if (nb_hw_breakpoint + nb_hw_watchpoint > 0) { + if (arch_info->status & KVMPPC_DEBUG_BREAKPOINT) { + n =3D find_hw_breakpoint(arch_info->address, GDB_BREAKPOINT_HW= ); + if (n >=3D 0) { + handle =3D 1; + } + } else if (arch_info->status & (KVMPPC_DEBUG_WATCH_READ | + KVMPPC_DEBUG_WATCH_WRITE)) { + n =3D find_hw_watchpoint(arch_info->address, &flag); + if (n >=3D 0) { + handle =3D 1; + cs->watchpoint_hit =3D &hw_watchpoint; + hw_watchpoint.vaddr =3D hw_debug_points[n].addr; + hw_watchpoint.flags =3D flag; + } + } + } + return handle; +} + static int kvm_handle_debug(PowerPCCPU *cpu, struct kvm_run *run) { CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; struct kvm_debug_exit_arch *arch_info =3D &run->debug.arch; int handle =3D 0; - int n; - int flag =3D 0; =20 if (cs->singlestep_enabled) { handle =3D 1; } else if (arch_info->status) { - if (nb_hw_breakpoint + nb_hw_watchpoint > 0) { - if (arch_info->status & KVMPPC_DEBUG_BREAKPOINT) { - n =3D find_hw_breakpoint(arch_info->address, GDB_BREAKPOIN= T_HW); - if (n >=3D 0) { - handle =3D 1; - } - } else if (arch_info->status & (KVMPPC_DEBUG_WATCH_READ | - KVMPPC_DEBUG_WATCH_WRITE)) { - n =3D find_hw_watchpoint(arch_info->address, &flag); - if (n >=3D 0) { - handle =3D 1; - cs->watchpoint_hit =3D &hw_watchpoint; - hw_watchpoint.vaddr =3D hw_debug_points[n].addr; - hw_watchpoint.flags =3D flag; - } - } - } + handle =3D kvm_handle_hw_breakpoint(cs, arch_info); } else if (kvm_find_sw_breakpoint(cs, arch_info->address)) { handle =3D 1; } else { --=20 2.20.1