Skip to content

Commit b1da33b

Browse files
schlacClaudio Imbrenda
authored andcommitted
KVM: s390: selftests: Add ucontrol gis routing test
Add a selftests for the interrupt routing configuration when using ucontrol VMs. Calling the test may trigger a null pointer dereferences on kernels not containing the fixes in this patch series. Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com> Tested-by: Hariharan Mari <hari55@linux.ibm.com> Reviewed-by: Hariharan Mari <hari55@linux.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Link: https://lore.kernel.org/r/20241216092140.329196-5-schlameuss@linux.ibm.com Message-ID: <20241216092140.329196-5-schlameuss@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
1 parent 5021fd7 commit b1da33b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tools/testing/selftests/kvm/s390x/ucontrol_test.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,4 +783,23 @@ TEST_F(uc_kvm, uc_flic_attrs)
783783
close(cd.fd);
784784
}
785785

786+
TEST_F(uc_kvm, uc_set_gsi_routing)
787+
{
788+
struct kvm_irq_routing *routing = kvm_gsi_routing_create();
789+
struct kvm_irq_routing_entry ue = {
790+
.type = KVM_IRQ_ROUTING_S390_ADAPTER,
791+
.gsi = 1,
792+
.u.adapter = (struct kvm_irq_routing_s390_adapter) {
793+
.ind_addr = 0,
794+
},
795+
};
796+
int rc;
797+
798+
routing->entries[0] = ue;
799+
routing->nr = 1;
800+
rc = ioctl(self->vm_fd, KVM_SET_GSI_ROUTING, routing);
801+
ASSERT_EQ(-1, rc) TH_LOG("err %s (%i)", strerror(errno), errno);
802+
ASSERT_EQ(EINVAL, errno) TH_LOG("err %s (%i)", strerror(errno), errno);
803+
}
804+
786805
TEST_HARNESS_MAIN

0 commit comments

Comments
 (0)