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