@@ -65,6 +65,7 @@ typedef enum {
65
65
KVM_SET_IRQ_LINE_HIGH ,
66
66
KVM_SET_LEVEL_INFO_HIGH ,
67
67
KVM_INJECT_IRQFD ,
68
+ KVM_WRITE_ISPENDR ,
68
69
} kvm_inject_cmd ;
69
70
70
71
struct kvm_inject_args {
@@ -105,6 +106,7 @@ static struct kvm_inject_desc inject_edge_fns[] = {
105
106
/* sgi ppi spi */
106
107
{ KVM_INJECT_EDGE_IRQ_LINE , false, false, true },
107
108
{ KVM_INJECT_IRQFD , false, false, true },
109
+ { KVM_WRITE_ISPENDR , true, false, true },
108
110
{ 0 , },
109
111
};
110
112
@@ -113,6 +115,7 @@ static struct kvm_inject_desc inject_level_fns[] = {
113
115
{ KVM_SET_IRQ_LINE_HIGH , false, true, true },
114
116
{ KVM_SET_LEVEL_INFO_HIGH , false, true, true },
115
117
{ KVM_INJECT_IRQFD , false, false, true },
118
+ { KVM_WRITE_ISPENDR , false, true, true },
116
119
{ 0 , },
117
120
};
118
121
@@ -495,6 +498,20 @@ static void kvm_set_gsi_routing_irqchip_check(struct kvm_vm *vm,
495
498
}
496
499
}
497
500
501
+ static void kvm_irq_write_ispendr_check (int gic_fd , uint32_t intid ,
502
+ uint32_t vcpu , bool expect_failure )
503
+ {
504
+ /*
505
+ * Ignore this when expecting failure as invalid intids will lead to
506
+ * either trying to inject SGIs when we configured the test to be
507
+ * level_sensitive (or the reverse), or inject large intids which
508
+ * will lead to writing above the ISPENDR register space (and we
509
+ * don't want to do that either).
510
+ */
511
+ if (!expect_failure )
512
+ kvm_irq_write_ispendr (gic_fd , intid , vcpu );
513
+ }
514
+
498
515
static void kvm_routing_and_irqfd_check (struct kvm_vm * vm ,
499
516
uint32_t intid , uint32_t num , uint32_t kvm_max_routes ,
500
517
bool expect_failure )
@@ -597,6 +614,11 @@ static void run_guest_cmd(struct kvm_vm *vm, int gic_fd,
597
614
test_args -> kvm_max_routes ,
598
615
expect_failure );
599
616
break ;
617
+ case KVM_WRITE_ISPENDR :
618
+ for (i = intid ; i < intid + num ; i ++ )
619
+ kvm_irq_write_ispendr_check (gic_fd , i ,
620
+ VCPU_ID , expect_failure );
621
+ break ;
600
622
default :
601
623
break ;
602
624
}
0 commit comments