xref: /freebsd/sys/xen/features.c (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1 #include <sys/cdefs.h>
2 #include <sys/param.h>
3 #include <sys/systm.h>
4 
5 #include <xen/xen-os.h>
6 #include <xen/hypervisor.h>
7 #include <xen/features.h>
8 
9 uint8_t xen_features[XENFEAT_NR_SUBMAPS * 32] /* __read_mostly */;
10 
11 void
12 setup_xen_features(void)
13 {
14         xen_feature_info_t fi;
15         int i, j;
16 
17         for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) {
18                 fi.submap_idx = i;
19                 if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
20                         break;
21                 for (j = 0; j < 32; j++)
22                         xen_features[i*32 + j] = !!(fi.submap & 1<<j);
23         }
24 }
25