Skip to contentSkip to conversation

libxl: Introduce a new guest config file parameter

PATCH New Wei Wang 1 participant 1 message Sep 26, 2012

lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH v6 1/1 libxl: Introduce a new guest config file parameter

From 3b17aad3f1275cab439f69a4d037097f1cbcd6f6 Mon Sep 17 00:00:00 2001
From: Wei Wang <[email protected]>
Date: Wed, 26 Sep 2012 11:48:23 +0200
Subject: [PATCH 6/6] libxl: Introduce a new guest config file parameter

Use guest_iommu = {1,0} to enable or disable guest iommu emulation. Default value is 0. Regression tests have been done to make sure it does not break non-iommuv2 systems.

---
 docs/man/xl.cfg.pod.5       |    5 +++++
 tools/libxl/libxl_create.c  |    5 ++++-
 tools/libxl/libxl_types.idl |    1 +
 tools/libxl/xl_cmdimpl.c    |    1 +
 4 files changed, 11 insertions(+), 1 deletions(-)
docs/man/xl.cfg.pod.5 +5 -0
index 013270d..2bef429 100644
@@ -270,6 +270,11 @@ UUID will be generated.
 
 Assign an XSM security label to this domain.
 
+=item B<guest_iommu=BOOLEAN>
+
+Enable a virtual iommu device for hvm guest. It should be enabled to 
+passthrough AMD HD7900 series GPGPU.
+
 =item B<nomigrate=BOOLEAN>
 
 Disable migration of this domain.  This enables certain other features
tools/libxl/libxl_create.c +4 -1
index ef17f05..5854a13 100644
@@ -250,6 +250,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         libxl_defbool_setdefault(&b_info->u.hvm.nested_hvm,         false);
         libxl_defbool_setdefault(&b_info->u.hvm.usb,                false);
         libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci,   true);
+        libxl_defbool_setdefault(&b_info->u.hvm.guest_iommu,        false);
 
         if (!b_info->u.hvm.boot) {
             b_info->u.hvm.boot = strdup("cda");
@@ -340,13 +341,15 @@ int libxl__domain_build(libxl__gc *gc,
         vments[4] = "start_time";
         vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
 
-        localents = libxl__calloc(gc, 7, sizeof(char *));
+        localents = libxl__calloc(gc, 9, sizeof(char *));
         localents[0] = "platform/acpi";
         localents[1] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
         localents[2] = "platform/acpi_s3";
         localents[3] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0";
         localents[4] = "platform/acpi_s4";
         localents[5] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1" : "0";
+        localents[6] = "guest_iommu";
+        localents[7] = libxl_defbool_val(info->u.hvm.guest_iommu) ? "1" : "0";
 
         break;
     case LIBXL_DOMAIN_TYPE_PV:
tools/libxl/libxl_types.idl +1 -0
index 6d5c578..afd50a1 100644
@@ -319,6 +319,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("usbdevice",        string),
                                        ("soundhw",          string),
                                        ("xen_platform_pci", libxl_defbool),
+                                       ("guest_iommu",      libxl_defbool),
                                        ])),
                  ("pv", Struct(None, [("kernel", string),
                                       ("slack_memkb", MemKB),
tools/libxl/xl_cmdimpl.c +1 -0
index 1627cac..b7e10b6 100644
@@ -864,6 +864,7 @@ static void parse_config_data(const char *config_source,
         }
 
         xlu_cfg_get_defbool(config, "nestedhvm", &b_info->u.hvm.nested_hvm, 0);
+        xlu_cfg_get_defbool(config, "guest_iommu", &b_info->u.hvm.guest_iommu, 0);
         break;
     case LIBXL_DOMAIN_TYPE_PV:
     {
Signature · 1 line
1.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel