37
37
static struct kvm_reg_list * reg_list ;
38
38
static __u64 * blessed_reg , blessed_n ;
39
39
40
- struct reg_sublist {
41
- const char * name ;
42
- long capability ;
43
- int feature ;
44
- bool finalize ;
45
- __u64 * regs ;
46
- __u64 regs_n ;
47
- __u64 * rejects_set ;
48
- __u64 rejects_set_n ;
49
- };
50
-
51
40
struct feature_id_reg {
52
41
__u64 reg ;
53
42
__u64 id_reg ;
@@ -76,12 +65,7 @@ static struct feature_id_reg feat_id_regs[] = {
76
65
}
77
66
};
78
67
79
- struct vcpu_config {
80
- char * name ;
81
- struct reg_sublist sublists [];
82
- };
83
-
84
- static struct vcpu_config * vcpu_configs [];
68
+ static struct vcpu_reg_list * vcpu_configs [];
85
69
static int vcpu_configs_n ;
86
70
87
71
#define for_each_sublist (c , s ) \
@@ -103,9 +87,9 @@ static int vcpu_configs_n;
103
87
for_each_reg_filtered(i) \
104
88
if (!find_reg(blessed_reg, blessed_n, reg_list->reg[i]))
105
89
106
- static const char * config_name (struct vcpu_config * c )
90
+ static const char * config_name (struct vcpu_reg_list * c )
107
91
{
108
- struct reg_sublist * s ;
92
+ struct vcpu_reg_sublist * s ;
109
93
int len = 0 ;
110
94
111
95
if (c -> name )
@@ -390,18 +374,18 @@ static void core_reg_fixup(void)
390
374
reg_list = tmp ;
391
375
}
392
376
393
- static void prepare_vcpu_init (struct vcpu_config * c , struct kvm_vcpu_init * init )
377
+ static void prepare_vcpu_init (struct vcpu_reg_list * c , struct kvm_vcpu_init * init )
394
378
{
395
- struct reg_sublist * s ;
379
+ struct vcpu_reg_sublist * s ;
396
380
397
381
for_each_sublist (c , s )
398
382
if (s -> capability )
399
383
init -> features [s -> feature / 32 ] |= 1 << (s -> feature % 32 );
400
384
}
401
385
402
- static void finalize_vcpu (struct kvm_vcpu * vcpu , struct vcpu_config * c )
386
+ static void finalize_vcpu (struct kvm_vcpu * vcpu , struct vcpu_reg_list * c )
403
387
{
404
- struct reg_sublist * s ;
388
+ struct vcpu_reg_sublist * s ;
405
389
int feature ;
406
390
407
391
for_each_sublist (c , s ) {
@@ -412,9 +396,9 @@ static void finalize_vcpu(struct kvm_vcpu *vcpu, struct vcpu_config *c)
412
396
}
413
397
}
414
398
415
- static void check_supported (struct vcpu_config * c )
399
+ static void check_supported (struct vcpu_reg_list * c )
416
400
{
417
- struct reg_sublist * s ;
401
+ struct vcpu_reg_sublist * s ;
418
402
419
403
for_each_sublist (c , s ) {
420
404
if (!s -> capability )
@@ -430,14 +414,14 @@ static bool print_list;
430
414
static bool print_filtered ;
431
415
static bool fixup_core_regs ;
432
416
433
- static void run_test (struct vcpu_config * c )
417
+ static void run_test (struct vcpu_reg_list * c )
434
418
{
435
419
struct kvm_vcpu_init init = { .target = -1 , };
436
420
int new_regs = 0 , missing_regs = 0 , i , n ;
437
421
int failed_get = 0 , failed_set = 0 , failed_reject = 0 ;
438
422
struct kvm_vcpu * vcpu ;
439
423
struct kvm_vm * vm ;
440
- struct reg_sublist * s ;
424
+ struct vcpu_reg_sublist * s ;
441
425
442
426
check_supported (c );
443
427
@@ -574,7 +558,7 @@ static void run_test(struct vcpu_config *c)
574
558
575
559
static void help (void )
576
560
{
577
- struct vcpu_config * c ;
561
+ struct vcpu_reg_list * c ;
578
562
int i ;
579
563
580
564
printf (
@@ -598,9 +582,9 @@ static void help(void)
598
582
);
599
583
}
600
584
601
- static struct vcpu_config * parse_config (const char * config )
585
+ static struct vcpu_reg_list * parse_config (const char * config )
602
586
{
603
- struct vcpu_config * c ;
587
+ struct vcpu_reg_list * c ;
604
588
int i ;
605
589
606
590
if (config [8 ] != '=' )
@@ -620,7 +604,7 @@ static struct vcpu_config *parse_config(const char *config)
620
604
621
605
int main (int ac , char * * av )
622
606
{
623
- struct vcpu_config * c , * sel = NULL ;
607
+ struct vcpu_reg_list * c , * sel = NULL ;
624
608
int i , ret = 0 ;
625
609
pid_t pid ;
626
610
@@ -1104,45 +1088,45 @@ static __u64 pauth_generic_regs[] = {
1104
1088
.regs_n = ARRAY_SIZE(pauth_generic_regs), \
1105
1089
}
1106
1090
1107
- static struct vcpu_config vregs_config = {
1091
+ static struct vcpu_reg_list vregs_config = {
1108
1092
.sublists = {
1109
1093
BASE_SUBLIST ,
1110
1094
VREGS_SUBLIST ,
1111
1095
{0 },
1112
1096
},
1113
1097
};
1114
- static struct vcpu_config vregs_pmu_config = {
1098
+ static struct vcpu_reg_list vregs_pmu_config = {
1115
1099
.sublists = {
1116
1100
BASE_SUBLIST ,
1117
1101
VREGS_SUBLIST ,
1118
1102
PMU_SUBLIST ,
1119
1103
{0 },
1120
1104
},
1121
1105
};
1122
- static struct vcpu_config sve_config = {
1106
+ static struct vcpu_reg_list sve_config = {
1123
1107
.sublists = {
1124
1108
BASE_SUBLIST ,
1125
1109
SVE_SUBLIST ,
1126
1110
{0 },
1127
1111
},
1128
1112
};
1129
- static struct vcpu_config sve_pmu_config = {
1113
+ static struct vcpu_reg_list sve_pmu_config = {
1130
1114
.sublists = {
1131
1115
BASE_SUBLIST ,
1132
1116
SVE_SUBLIST ,
1133
1117
PMU_SUBLIST ,
1134
1118
{0 },
1135
1119
},
1136
1120
};
1137
- static struct vcpu_config pauth_config = {
1121
+ static struct vcpu_reg_list pauth_config = {
1138
1122
.sublists = {
1139
1123
BASE_SUBLIST ,
1140
1124
VREGS_SUBLIST ,
1141
1125
PAUTH_SUBLIST ,
1142
1126
{0 },
1143
1127
},
1144
1128
};
1145
- static struct vcpu_config pauth_pmu_config = {
1129
+ static struct vcpu_reg_list pauth_pmu_config = {
1146
1130
.sublists = {
1147
1131
BASE_SUBLIST ,
1148
1132
VREGS_SUBLIST ,
@@ -1152,7 +1136,7 @@ static struct vcpu_config pauth_pmu_config = {
1152
1136
},
1153
1137
};
1154
1138
1155
- static struct vcpu_config * vcpu_configs [] = {
1139
+ static struct vcpu_reg_list * vcpu_configs [] = {
1156
1140
& vregs_config ,
1157
1141
& vregs_pmu_config ,
1158
1142
& sve_config ,
0 commit comments