[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/12] target/arm/kvm: spe: Add device init and set_irq operat
From: |
Haibo Xu |
Subject: |
[PATCH v2 06/12] target/arm/kvm: spe: Add device init and set_irq operations |
Date: |
Tue, 8 Sep 2020 08:13:24 +0000 |
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
- [PATCH v2 04/12] target/arm: spe: Only enable SPE from 5.2 compat machines., (continued)
- [PATCH v2 04/12] target/arm: spe: Only enable SPE from 5.2 compat machines., Haibo Xu, 2020/09/08
- [PATCH v2 05/12] target/arm/kvm: spe: Unify device attr operation helper, Haibo Xu, 2020/09/08
- [PATCH v2 03/12] target/arm/cpu: spe: Add an option to turn on/off vSPE support, Haibo Xu, 2020/09/08
- [PATCH v2 07/12] hw/arm/virt: Move post cpu realize check into its own function, Haibo Xu, 2020/09/08
- [PATCH v2 06/12] target/arm/kvm: spe: Add device init and set_irq operations,
Haibo Xu <=
- [PATCH v2 09/12] hw/arm/virt: spe: Add SPE fdt binding for virt machine, Haibo Xu, 2020/09/08
[PATCH v2 08/12] hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init, Haibo Xu, 2020/09/08
[PATCH v2 10/12] target/arm/cpu: spe: Enable spe to work with host cpu, Haibo Xu, 2020/09/08