From patchwork Mon May 27 02:19:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Du X-Patchwork-Id: 13674531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96354C25B7A for ; Mon, 27 May 2024 02:25:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBQ1x-0000qh-Cf; Sun, 26 May 2024 22:24:09 -0400 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 1sBQ1u-0000pT-UF; Sun, 26 May 2024 22:24:06 -0400 Received: from zg8tmja5ljk3lje4ms43mwaa.icoremail.net ([209.97.181.73]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBQ1s-0003mF-Rx; Sun, 26 May 2024 22:24:06 -0400 Received: from localhost.localdomain (unknown [10.12.130.31]) by app1 (Coremail) with SMTP id TAJkCgAXrOM07lNmsQANAA--.24375S4; Mon, 27 May 2024 10:21:41 +0800 (CST) From: Chao Du To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com, alistair23@gmail.com, bin.meng@windriver.com, liweiwei@iscas.ac.cn, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com, palmer@dabbelt.com, anup@brainfault.org, duchao713@qq.com Subject: [PATCH v1 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V Date: Mon, 27 May 2024 02:19:12 +0000 Message-Id: <20240527021916.12953-1-duchao@eswincomputing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r0_Gr1UYxBIdaVFxhVjvjDU0xZFpf 9x07j04E_UUUUU= X-CM-SenderInfo: xgxfxt3r6h245lqf0zpsxwx03jof0z/ Received-SPF: pass client-ip=209.97.181.73; envelope-from=duchao@eswincomputing.com; helo=zg8tmja5ljk3lje4ms43mwaa.icoremail.net X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL=1.31, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This series implements QEMU KVM Guest Debug on RISC-V, with which we could debug RISC-V KVM guest from the host side, using software breakpoints. This series is based on riscv-to-apply.next branch (v9.0.0) and is also available at: https://github.com/Du-Chao/qemu-alistair23/tree/riscv-to-apply.next.0524 The corresponding KVM side patches have been merged already: https://lore.kernel.org/kvm/20240402062628.5425-1-duchao@eswincomputing.com/ A TODO list which will be added later: 1. HW breakpoints support 2. A 'corner case' in which the debug exception is not inserted by the debugger, need to be re-injected to the guest. Changes from RFC->v1: - Rebased on riscv-to-apply.next - use configs/ definition to conditionalize debug support RFC link: https://lore.kernel.org/qemu-riscv/20231221094923.7349-1-duchao@eswincomputing.com/ Chao Du (4): target/riscv/kvm: add software breakpoints support target/riscv/kvm: implement kvm_arch_update_guest_debug() target/riscv/kvm: handle the exit with debug reason target/riscv/kvm: define TARGET_KVM_HAVE_GUEST_DEBUG accel/kvm/kvm-all.c | 8 +-- configs/targets/riscv64-softmmu.mak | 1 + include/sysemu/kvm.h | 6 +- target/arm/kvm.c | 6 +- target/i386/kvm/kvm.c | 6 +- target/mips/kvm.c | 6 +- target/ppc/kvm.c | 6 +- target/riscv/kvm/kvm-cpu.c | 101 ++++++++++++++++++++++++++++ target/s390x/kvm/kvm.c | 6 +- 9 files changed, 130 insertions(+), 16 deletions(-) --- 2.17.1