All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Du <duchao@eswincomputing.com>
To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	anup@brainfault.org, atishp@atishpatra.org, pbonzini@redhat.com,
	shuah@kernel.org, dbarboza@ventanamicro.com,
	paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu, haibo1.xu@intel.com, duchao713@qq.com
Subject: [PATCH v4 2/3] RISC-V: KVM: Handle breakpoint exits for VCPU
Date: Tue,  2 Apr 2024 06:26:27 +0000	[thread overview]
Message-ID: <20240402062628.5425-3-duchao@eswincomputing.com> (raw)
In-Reply-To: <20240402062628.5425-1-duchao@eswincomputing.com>

Exit to userspace for breakpoint traps. Set the exit_reason as
KVM_EXIT_DEBUG before exit.

Signed-off-by: Chao Du <duchao@eswincomputing.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
---
 arch/riscv/kvm/vcpu_exit.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c
index 2415722c01b8..5761f95abb60 100644
--- a/arch/riscv/kvm/vcpu_exit.c
+++ b/arch/riscv/kvm/vcpu_exit.c
@@ -204,6 +204,10 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
 		if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV)
 			ret = kvm_riscv_vcpu_sbi_ecall(vcpu, run);
 		break;
+	case EXC_BREAKPOINT:
+		run->exit_reason = KVM_EXIT_DEBUG;
+		ret = 0;
+		break;
 	default:
 		break;
 	}
--
2.17.1


  parent reply	other threads:[~2024-04-02  6:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  6:26 [PATCH v4 0/3] RISC-V: KVM: Guest Debug Support - Software Breakpoint Part Chao Du
2024-04-02  6:26 ` [PATCH v4 1/3] RISC-V: KVM: Implement kvm_arch_vcpu_ioctl_set_guest_debug() Chao Du
2024-04-02  6:26 ` Chao Du [this message]
2024-04-02  6:26 ` [PATCH v4 3/3] RISC-V: KVM: selftests: Add ebreak test support Chao Du
2024-04-02 15:36   ` Andrew Jones
2024-04-08 11:51 ` [PATCH v4 0/3] RISC-V: KVM: Guest Debug Support - Software Breakpoint Part Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240402062628.5425-3-duchao@eswincomputing.com \
    --to=duchao@eswincomputing.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atishp@atishpatra.org \
    --cc=dbarboza@ventanamicro.com \
    --cc=duchao713@qq.com \
    --cc=haibo1.xu@intel.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=pbonzini@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.