From: Oliver Upton <oupton@google.com>
To: kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, Marc Zyngier <maz@kernel.org>,
James Morse <james.morse@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
linux-arm-kernel@lists.infradead.org,
Peter Shier <pshier@google.com>,
Ricardo Koller <ricarkol@google.com>,
Reiji Watanabe <reijiw@google.com>, Will Deacon <will@kernel.org>,
Julien Thierry <julien.thierry.kdev@gmail.com>,
Oliver Upton <oupton@google.com>
Subject: [RFC PATCH kvmtool 2/5] Allow architectures to hook KVM_EXIT_SYSTEM_EVENT
Date: Fri, 11 Mar 2022 17:57:14 +0000 [thread overview]
Message-ID: <20220311175717.616958-3-oupton@google.com> (raw)
In-Reply-To: <20220311175717.616958-1-oupton@google.com>
Certain system events require architecture-specific handling. Allow
architectures to intervene for exits unhandled by the default exit
handler.
Signed-off-by: Oliver Upton <oupton@google.com>
---
include/kvm/kvm-cpu.h | 1 +
kvm-cpu.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/kvm/kvm-cpu.h b/include/kvm/kvm-cpu.h
index 0f16f8d..75e42d8 100644
--- a/include/kvm/kvm-cpu.h
+++ b/include/kvm/kvm-cpu.h
@@ -20,6 +20,7 @@ void kvm_cpu__run(struct kvm_cpu *vcpu);
int kvm_cpu__start(struct kvm_cpu *cpu);
bool kvm_cpu__handle_exit(struct kvm_cpu *vcpu);
int kvm_cpu__get_endianness(struct kvm_cpu *vcpu);
+bool kvm_cpu__arch_handle_system_event(struct kvm_cpu *vcpu);
int kvm_cpu__get_debug_fd(void);
void kvm_cpu__set_debug_fd(int fd);
diff --git a/kvm-cpu.c b/kvm-cpu.c
index 7dec088..d615c37 100644
--- a/kvm-cpu.c
+++ b/kvm-cpu.c
@@ -23,6 +23,11 @@ int __attribute__((weak)) kvm_cpu__get_endianness(struct kvm_cpu *vcpu)
return VIRTIO_ENDIAN_HOST;
}
+bool __attribute__((weak)) kvm_cpu__arch_handle_system_event(struct kvm_cpu *vcpu)
+{
+ return false;
+}
+
void kvm_cpu__enable_singlestep(struct kvm_cpu *vcpu)
{
struct kvm_guest_debug debug = {
@@ -224,6 +229,9 @@ int kvm_cpu__start(struct kvm_cpu *cpu)
*/
switch (cpu->kvm_run->system_event.type) {
default:
+ if (kvm_cpu__arch_handle_system_event(cpu))
+ break;
+
pr_warning("unknown system event type %d",
cpu->kvm_run->system_event.type);
/* fall through for now */
--
2.35.1.723.g4982287a31-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-03-11 17:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220311174001.605719-1-oupton@google.com>
2022-03-11 17:57 ` [RFC PATCH kvmtool 0/5] ARM: Implement PSCI SYSTEM_SUSPEND Oliver Upton
2022-03-11 17:57 ` [RFC PATCH kvmtool 1/5] TESTONLY: Sync KVM headers with pending changes Oliver Upton
2022-03-11 17:57 ` Oliver Upton [this message]
2022-03-11 17:57 ` [RFC PATCH kvmtool 3/5] ARM: Stash vcpu_init in the vCPU structure Oliver Upton
2022-03-11 17:57 ` [RFC PATCH kvmtool 4/5] ARM: Add a helper to re-init a vCPU Oliver Upton
2022-03-11 17:57 ` [RFC PATCH kvmtool 5/5] ARM: Implement PSCI SYSTEM_SUSPEND Oliver Upton
2022-05-06 13:01 ` [RFC PATCH kvmtool 0/5] " Will Deacon
2022-05-06 19:18 ` Oliver Upton
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=20220311175717.616958-3-oupton@google.com \
--to=oupton@google.com \
--cc=alexandru.elisei@arm.com \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=pshier@google.com \
--cc=reijiw@google.com \
--cc=ricarkol@google.com \
--cc=suzuki.poulose@arm.com \
--cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox