static xenforeignmemory_handle *fh;
static xengnttab_handle *gh;
+static xc_physinfo_t physinfo;
+
static void test_gnttab(uint32_t domid, unsigned int nr_frames,
unsigned long gfn)
{
printf("Test %s\n", t->name);
+#if defined(__x86_64__) || defined(__i386__)
+ if ( t->create.flags & XEN_DOMCTL_CDF_hvm )
+ {
+ if ( !(physinfo.capabilities & XEN_SYSCTL_PHYSCAP_hvm) )
+ {
+ printf(" Skip: HVM not available\n");
+ continue;
+ }
+
+ /*
+ * On x86, use HAP guests if possible, but skip if neither HAP nor
+ * SHADOW is available.
+ */
+ if ( physinfo.capabilities & XEN_SYSCTL_PHYSCAP_hap )
+ t->create.flags |= XEN_DOMCTL_CDF_hap;
+ else if ( !(physinfo.capabilities & XEN_SYSCTL_PHYSCAP_shadow) )
+ {
+ printf(" Skip: Neither HAP or SHADOW available\n");
+ continue;
+ }
+ }
+ else
+ {
+ if ( !(physinfo.capabilities & XEN_SYSCTL_PHYSCAP_pv) )
+ {
+ printf(" Skip: PV not available\n");
+ continue;
+ }
+ }
+#endif
+
rc = xc_domain_create(xch, &domid, &t->create);
if ( rc )
{
int main(int argc, char **argv)
{
+ int rc;
+
printf("XENMEM_acquire_resource tests\n");
xch = xc_interface_open(NULL, NULL, 0);
if ( !gh )
err(1, "xengnttab_open");
+ rc = xc_physinfo(xch, &physinfo);
+ if ( rc )
+ err(1, "Failed to obtain physinfo");
+
test_domain_configurations();
return !!nr_failures;