From nobody Fri Apr 26 14:36:18 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1669205879; cv=none; d=zohomail.com; s=zohoarc; b=AVzbZ649qnETQMI4vGtmqt6kKZahZOs+BNpVpq6GVgPrFMpQ1OdCfE62THwT9ivr+JBZfYqb7BVCuh8LVxc8LiL/2Q2Dyjgy/taQSVfyoKgVqYOgGcvML41N0lOffJ4B7FEw1QLXqEBwgM6clJBsEU3SFnuFtQW92awuRUxbqg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669205879; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Aut9ZXf9F14OuFZUq+1kZwYBZufehGQHszc7xp6jek0=; b=Bu2ArS99rL85XFDIGIgVIoE1csnC00YxZb0LBpRP1piJ4IiNKumc1/bj/0gIuChIW9TUaxxrB8uui/iGtvRsGd1jTxNnhG8hAFkN1Br+xatPlMFRpsrSb62rIQSDzQA3LRDDdxsaXF05EG2TZtPF9v9ivHPzx0EZ9RunqXX49eA= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669205879832128.1447221806609; Wed, 23 Nov 2022 04:17:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxogu-0005CA-V7; Wed, 23 Nov 2022 07:17:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxogt-0005C2-KQ for qemu-devel@nongnu.org; Wed, 23 Nov 2022 07:17:23 -0500 Received: from mr85p00im-zteg06021901.me.com ([17.58.23.194]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxogr-0008K1-Mm for qemu-devel@nongnu.org; Wed, 23 Nov 2022 07:17:23 -0500 Received: from localhost.localdomain (mr38p00im-dlb-asmtp-mailmevip.me.com [17.57.152.18]) by mr85p00im-zteg06021901.me.com (Postfix) with ESMTPSA id 9D4B3740615; Wed, 23 Nov 2022 12:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ynddal.dk; s=sig1; t=1669205838; bh=Aut9ZXf9F14OuFZUq+1kZwYBZufehGQHszc7xp6jek0=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=R2koUfr9v/zuaU4nuBelNsx9BDzGQY1Cuca6KBd1H3UupGPPMQ6k0iEljApCRhNui lFJzykK0hRaHRo2XX0d7cD4YLFFnq5ZyGp+vbHSZFJPwF56vtT+2J4PG51K2ZLmQ2/ BBjZy1PMVENBYUziZn95qmjenAiH73elGVPbZWp8rQ5sQeBR6mA5bPX76JEFC/xu5m 3djqRfHMYhUnErzpxHichiSk7zTJ7Vh6aaTZU4XAeZ+vX+IwG7BsTtUAhg5FFrW/A+ AqlkCBxz/gZAAWEXCY1OnxhAqUHSbrvfnn3G4RggJe/rR5GQ+7Nf/NsMMPvtiSj+yQ SAz4eyr+Ghqwg== From: Mads Ynddal To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Yanan Wang , Richard Henderson , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH] gdbstub: move update guest debug to accel ops Date: Wed, 23 Nov 2022 13:17:12 +0100 Message-Id: <20221123121712.72817-1-mads@ynddal.dk> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: qzeEWYv33anWYhSjHxToGt3-6N3b3HwE X-Proofpoint-GUID: qzeEWYv33anWYhSjHxToGt3-6N3b3HwE X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.425,18.0.816,17.11.62.513.0000000_definitions?= =?UTF-8?Q?=3D2022-01-18=5F01:2022-01-14=5F01,2022-01-18=5F01,2021-12-02?= =?UTF-8?Q?=5F01_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 spamscore=0 clxscore=1030 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2211230091 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=lists.gnu.org; Received-SPF: pass client-ip=17.58.23.194; envelope-from=mads@ynddal.dk; helo=mr85p00im-zteg06021901.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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 @ynddal.dk) X-ZM-MESSAGEID: 1669205881690100003 Content-Type: text/plain; charset="utf-8" From: Mads Ynddal Continuing the refactor of a48e7d9e52 (gdbstub: move guest debug support check to ops) by removing hardcoded kvm_enabled() from generic cpu.c code, and replace it with a property of AccelOpsClass. Signed-off-by: Mads Ynddal --- accel/kvm/kvm-accel-ops.c | 1 + cpu.c | 10 +++++++--- include/sysemu/accel-ops.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c index fbf4fe3497..6ebf9a644f 100644 --- a/accel/kvm/kvm-accel-ops.c +++ b/accel/kvm/kvm-accel-ops.c @@ -99,6 +99,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, voi= d *data) ops->synchronize_pre_loadvm =3D kvm_cpu_synchronize_pre_loadvm; =20 #ifdef KVM_CAP_SET_GUEST_DEBUG + ops->update_guest_debug =3D kvm_update_guest_debug; ops->supports_guest_debug =3D kvm_supports_guest_debug; ops->insert_breakpoint =3D kvm_insert_breakpoint; ops->remove_breakpoint =3D kvm_remove_breakpoint; diff --git a/cpu.c b/cpu.c index 2a09b05205..ef433a79e3 100644 --- a/cpu.c +++ b/cpu.c @@ -31,8 +31,8 @@ #include "hw/core/sysemu-cpu-ops.h" #include "exec/address-spaces.h" #endif +#include "sysemu/cpus.h" #include "sysemu/tcg.h" -#include "sysemu/kvm.h" #include "sysemu/replay.h" #include "exec/cpu-common.h" #include "exec/exec-all.h" @@ -378,10 +378,14 @@ void cpu_breakpoint_remove_all(CPUState *cpu, int mas= k) void cpu_single_step(CPUState *cpu, int enabled) { if (cpu->singlestep_enabled !=3D enabled) { + const AccelOpsClass *ops =3D cpus_get_accel(); + cpu->singlestep_enabled =3D enabled; - if (kvm_enabled()) { - kvm_update_guest_debug(cpu, 0); + + if (ops->update_guest_debug) { + ops->update_guest_debug(cpu, 0); } + trace_breakpoint_singlestep(cpu->cpu_index, enabled); } } diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h index 8cc7996def..0a47a2f00c 100644 --- a/include/sysemu/accel-ops.h +++ b/include/sysemu/accel-ops.h @@ -48,6 +48,7 @@ struct AccelOpsClass { =20 /* gdbstub hooks */ bool (*supports_guest_debug)(void); + int (*update_guest_debug)(CPUState *cpu, unsigned long flags); int (*insert_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr = len); int (*remove_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr = len); void (*remove_all_breakpoints)(CPUState *cpu); --=20 2.38.1