xref: /kvm-unit-tests/s390x/cpumodel.c (revision 0917dc65eabbacb592456c0d1bb05e5828c23661)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Test the known dependencies for facilities
4  *
5  * Copyright 2019 IBM Corp.
6  *
7  * Authors:
8  *    Christian Borntraeger <borntraeger@de.ibm.com>
9  */
10 
11 #include <asm/facility.h>
12 #include <vm.h>
13 
14 static struct {
15 	int facility;
16 	int implied;
17 	bool expected_tcg_fail;
18 } dep[] = {
19 	/* from SA22-7832-11 4-98 facility indications */
20 	{   4,   3 },
21 	{   5,   3 },
22 	{   5,   4 },
23 	{  19,  18 },
24 	{  37,  42, true },  /* TCG does not have DFP and won't get it soon */
25 	{  43,  42 },
26 	{  73,  49 },
27 	{ 134, 129 },
28 	{ 135, 129 },
29 	{ 139,  25 },
30 	{ 139,  28 },
31 	{ 146,  76 },
32 	/* indirectly documented in description */
33 	{  78,   8 },  /* EDAT */
34 	/* new dependencies from gen15 */
35 	{  61,  45 },
36 	{ 148, 129 },
37 	{ 148, 135 },
38 	{ 152, 129 },
39 	{ 152, 134 },
40 	{ 155,  76 },
41 	{ 155,  77 },
42 };
43 
44 int main(void)
45 {
46 	int i;
47 
48 	report_prefix_push("cpumodel");
49 
50 	report_prefix_push("dependency");
51 	for (i = 0; i < ARRAY_SIZE(dep); i++) {
52 		if (test_facility(dep[i].facility)) {
53 			report_xfail(dep[i].expected_tcg_fail && vm_is_tcg(),
54 				     test_facility(dep[i].implied),
55 				     "%d implies %d",
56 				     dep[i].facility, dep[i].implied);
57 		} else {
58 			report_skip("facility %d not present", dep[i].facility);
59 		}
60 	}
61 	report_prefix_pop();
62 
63 	report_prefix_pop();
64 	return report_summary();
65 }
66