From nobody Mon Feb 9 11:51:38 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552386488416552.5722217211112; Tue, 12 Mar 2019 03:28:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:49125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3edh-00065k-0R for importer@patchew.org; Tue, 12 Mar 2019 06:28:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3dU8-00005V-J7 for qemu-devel@nongnu.org; Tue, 12 Mar 2019 05:14:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3dGY-0005RV-5T for qemu-devel@nongnu.org; Tue, 12 Mar 2019 05:00:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42358) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3dGX-0005Qi-U3; Tue, 12 Mar 2019 05:00:06 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CA60C04BE0C; Tue, 12 Mar 2019 08:54:06 +0000 (UTC) Received: from umbus.redhat.com (vpn2-54-33.bne.redhat.com [10.64.54.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A5FE6013E; Tue, 12 Mar 2019 08:54:03 +0000 (UTC) From: David Gibson To: peter.maydell@linaro.org Date: Tue, 12 Mar 2019 19:52:28 +1100 Message-Id: <20190312085316.8054-15-dgibson@redhat.com> In-Reply-To: <20190312085316.8054-1-dgibson@redhat.com> References: <20190312085316.8054-1-dgibson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 12 Mar 2019 08:54:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 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, clg@kaod.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, groug@kaod.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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