Wei Wang
2012-Jan-20 15:57 UTC
[PATCH 7 of 7 V4] libxl: Introduce a new guest config file parameter
# HG changeset patch # User Wei Wang <wei.wang2@amd.com> # Date 1327074009 -3600 # Node ID e71836563bfabed56c0140ad0bcaab517d82c894 # Parent a768bb39d0bc64360055e7fce0e890be71920e63 libxl: Introduce a new guest config file parameter Use guest_iommu = {1,0} to enable or disable guest iommu emulation. Default value is 0. Signed-off-by: Wei Wang <wei.wang2@amd.com> diff -r a768bb39d0bc -r e71836563bfa docs/man/xl.cfg.pod.5 --- a/docs/man/xl.cfg.pod.5 Fri Jan 20 14:40:32 2012 +0100 +++ b/docs/man/xl.cfg.pod.5 Fri Jan 20 16:40:09 2012 +0100 @@ -820,6 +820,10 @@ certainly belong in a more appropriate s Enable graphics device PCI passthrough. XXX which device is passed through ? +=item B<guest_iommu=BOOLEAN> + +Enable virtual iommu device for hvm guest. It should be enabled to passthrough AMD GPGPU. + =item B<nomigrate=BOOLEAN> Disable migration of this domain. This enables certain other features diff -r a768bb39d0bc -r e71836563bfa tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Fri Jan 20 14:40:32 2012 +0100 +++ b/tools/libxl/libxl_create.c Fri Jan 20 16:40:09 2012 +0100 @@ -93,6 +93,7 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->u.hvm.timer_mode = 1; b_info->u.hvm.nested_hvm = 0; b_info->u.hvm.no_incr_generationid = 0; + b_info->u.hvm.guest_iommu = 0; break; case LIBXL_DOMAIN_TYPE_PV: b_info->u.pv.slack_memkb = 8 * 1024; @@ -183,13 +184,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] = (info->u.hvm.acpi) ? "1" : "0"; localents[2] = "platform/acpi_s3"; localents[3] = (info->u.hvm.acpi_s3) ? "1" : "0"; localents[4] = "platform/acpi_s4"; localents[5] = (info->u.hvm.acpi_s4) ? "1" : "0"; + localents[6] = "guest_iommu"; + localents[7] = (info->u.hvm.guest_iommu) ? "1" : "0"; break; case LIBXL_DOMAIN_TYPE_PV: diff -r a768bb39d0bc -r e71836563bfa tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Fri Jan 20 14:40:32 2012 +0100 +++ b/tools/libxl/libxl_types.idl Fri Jan 20 16:40:09 2012 +0100 @@ -185,6 +185,7 @@ libxl_domain_build_info = Struct("domain ("timer_mode", integer), ("nested_hvm", bool), ("no_incr_generationid", bool), + ("guest_iommu", bool), ])), ("pv", Struct(None, [("kernel", libxl_file_reference), ("slack_memkb", uint32), diff -r a768bb39d0bc -r e71836563bfa tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri Jan 20 14:40:32 2012 +0100 +++ b/tools/libxl/xl_cmdimpl.c Fri Jan 20 16:40:09 2012 +0100 @@ -768,6 +768,8 @@ static void parse_config_data(const char b_info->u.hvm.timer_mode = l; if (!xlu_cfg_get_long (config, "nestedhvm", &l, 0)) b_info->u.hvm.nested_hvm = l; + if (!xlu_cfg_get_long (config, "guest_iommu", &l, 0)) + b_info->u.hvm.guest_iommu = l; break; case LIBXL_DOMAIN_TYPE_PV: { _______________________________________________ osrc-patches mailing list osrc-patches@elbe.amd.com https://elbe.amd.com/mailman/listinfo/osrc-patches