From: Haibo Xu <haibo.xu@linaro.org>
To: drjones@redhat.com, richard.henderson@linaro.org
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, philmd@redhat.com,
qemu-devel@nongnu.org, Haibo Xu <haibo.xu@linaro.org>
Subject: [PATCH v3 06/12] target/arm/kvm: spe: Add device init and set_irq operations
Date: Tue, 15 Sep 2020 03:11:42 +0000 [thread overview]
Message-ID: <cdd78c54073f1bcedef391b3d08b4a520690756f.1600135462.git.haibo.xu@linaro.org> (raw)
In-Reply-To: <cover.1600135462.git.haibo.xu@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Haibo Xu <haibo.xu@linaro.org>
---
target/arm/kvm64.c | 33 +++++++++++++++++++++++++++++++++
target/arm/kvm_arm.h | 5 +++++
2 files changed, 38 insertions(+)
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 8ffd31ffdf..5a2032fc9e 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -450,6 +450,39 @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
}
}
+void kvm_arm_spe_init(CPUState *cs)
+{
+ struct kvm_device_attr attr = {
+ .group = KVM_ARM_VCPU_SPE_V1_CTRL,
+ .attr = KVM_ARM_VCPU_SPE_V1_INIT,
+ };
+
+ if (!ARM_CPU(cs)->has_spe) {
+ return;
+ }
+ if (!kvm_arm_set_device_attr(cs, &attr, "SPE")) {
+ error_report("failed to init SPE");
+ abort();
+ }
+}
+
+void kvm_arm_spe_set_irq(CPUState *cs, int irq)
+{
+ struct kvm_device_attr attr = {
+ .group = KVM_ARM_VCPU_SPE_V1_CTRL,
+ .addr = (intptr_t)&irq,
+ .attr = KVM_ARM_VCPU_SPE_V1_IRQ,
+ };
+
+ if (!ARM_CPU(cs)->has_spe) {
+ return;
+ }
+ if (!kvm_arm_set_device_attr(cs, &attr, "SPE")) {
+ error_report("failed to set irq for SPE");
+ abort();
+ }
+}
+
static int read_sys_reg32(int fd, uint32_t *pret, uint64_t id)
{
uint64_t ret;
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index f79655674e..bb155322eb 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -348,6 +348,8 @@ int kvm_arm_vgic_probe(void);
void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
void kvm_arm_pmu_init(CPUState *cs);
+void kvm_arm_spe_set_irq(CPUState *cs, int irq);
+void kvm_arm_spe_init(CPUState *cs);
int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level);
#else
@@ -397,6 +399,9 @@ static inline int kvm_arm_vgic_probe(void)
static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) {}
static inline void kvm_arm_pmu_init(CPUState *cs) {}
+static inline void kvm_arm_spe_set_irq(CPUState *cs, int irq) {}
+static inline void kvm_arm_spe_init(CPUState *cs) {}
+
static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) {}
static inline void kvm_arm_get_virtual_time(CPUState *cs) {}
--
2.17.1
next prev parent reply other threads:[~2020-09-15 3:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 3:11 [PATCH v3 00/12] target/arm: Add vSPE support to KVM guest Haibo Xu
2020-09-15 3:11 ` [PATCH v3 01/12] update Linux headers with new vSPE macros Haibo Xu
2020-09-15 3:11 ` [PATCH v3 02/12] target/arm/kvm: spe: Add helper to detect SPE when using KVM Haibo Xu
2020-09-15 3:11 ` [PATCH v3 03/12] target/arm/cpu: spe: Add an option to turn on/off vSPE support Haibo Xu
2020-09-15 6:10 ` Andrew Jones
2020-09-15 7:33 ` Haibo Xu
2020-09-15 3:11 ` [PATCH v3 04/12] target/arm: spe: Only enable SPE from 5.2 compat machines Haibo Xu
2020-09-15 3:11 ` [PATCH v3 05/12] target/arm/kvm: spe: Unify device attr operation helper Haibo Xu
2020-09-15 3:11 ` Haibo Xu [this message]
2020-09-15 3:11 ` [PATCH v3 07/12] hw/arm/virt: Move post cpu realize check into its own function Haibo Xu
2020-09-15 6:22 ` Andrew Jones
2020-09-15 7:03 ` Haibo Xu
2020-09-15 7:31 ` Andrew Jones
2020-09-15 7:34 ` Haibo Xu
2020-09-15 3:11 ` [PATCH v3 08/12] hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init Haibo Xu
2020-09-15 3:11 ` [PATCH v3 09/12] hw/arm/virt: spe: Add vSPE device and corresponding interrupt support Haibo Xu
2020-09-15 3:11 ` [PATCH v3 10/12] target/arm/cpu: spe: Enable spe to work with host cpu Haibo Xu
2020-09-15 6:30 ` Andrew Jones
2020-09-15 3:11 ` [PATCH v3 11/12] target/arm/kvm: spe: Enable userspace irqchip support Haibo Xu
2020-09-15 3:11 ` [PATCH v3 12/12] target/arm: spe: Add corresponding test Haibo Xu
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=cdd78c54073f1bcedef391b3d08b4a520690756f.1600135462.git.haibo.xu@linaro.org \
--to=haibo.xu@linaro.org \
--cc=drjones@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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;
as well as URLs for NNTP newsgroup(s).