@@ -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;
@@ -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) {}
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(+)