[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/7] target/arm/kvm: spe: Add device init and set_irq operations
From: |
Haibo Xu |
Subject: |
[PATCH 5/7] target/arm/kvm: spe: Add device init and set_irq operations |
Date: |
Fri, 7 Aug 2020 08:10:35 +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 75a417d65c..be045ccc5f 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_dev_set_attr(cs, &attr)) {
+ 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_dev_set_attr(cs, &attr)) {
+ 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 2/7] target/arm/kvm: spe: Add helper to detect SPE when using KVM, Haibo Xu, 2020/08/07
[PATCH 5/7] target/arm/kvm: spe: Add device init and set_irq operations,
Haibo Xu <=
[PATCH 6/7] hw/arm/virt: spe: Add SPE fdt binding for virt machine, Haibo Xu, 2020/08/07
Re: [PATCH 6/7] hw/arm/virt: spe: Add SPE fdt binding for virt machine, Auger Eric, 2020/08/29
[PATCH 3/7] target/arm/cpu: spe: Add an option to turn on/off vSPE support, Haibo Xu, 2020/08/07