On 08.05.2020 18:41, Jim Fehlig wrote: > On 4/30/20 6:07 AM, Artur Puzio wrote: >> gfx_passthru xl.cfg option enables GPU specific quirks required for >> working >> Intel GPU passthru. Qemu (used for device model by xen) will refuse >> to start >> a VM when an IGD is passed, but this option was not set in Xen. > > Do we really need to expose this setting to the user? I'm not really > sure what to think about it after reading the xl.cfg(5) man page. It > starts with > > gfx_passthru=BOOLEAN|"STRING" > > The setting can be a boolean or a string - nice. And it really seems > specific to Intel graphics cards. The man page claims that a value of > 1 "Enables graphics device PCI passthrough and autodetects the type of > device which is being used.". It also says "Note that some graphics > cards (AMD/ATI cards, for example) do not necessarily require the > gfx_passthru option". > > Can't libxl just enable this itself if there's a PCI passthrough > device and it's detected as type igd? > > Regards, > Jim Hi, sorry for slowish response. Setting gfx_passthru to 1 as in this patch enables the autodetection routines (it's equivalent to gfx_passthru=1 from xl.cfg). Currently libxl handles only IGD. If there is no IGD specified at creation and gfx_passthru is 1, autodetection routines will report an error preventing domain creation. Relevant libxl code: libxl_dm.c:1746 if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) { enum libxl_gfx_passthru_kind gfx_passthru_kind = libxl__detect_gfx_passthru_kind(gc, guest_config); switch (gfx_passthru_kind) { case LIBXL_GFX_PASSTHRU_KIND_IGD: machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg); break; case LIBXL_GFX_PASSTHRU_KIND_DEFAULT: LOGD(ERROR, guest_domid, "unable to detect required gfx_passthru_kind"); return ERROR_FAIL; default: LOGD(ERROR, guest_domid, "invalid value for gfx_passthru_kind"); return ERROR_INVAL; } } libxl contains a function for checking if IGD is present. After some testing I will send another version of this patch that will enable gfx_passthru if there is a IGD attached. Artur > >> >> Signed-off-by: Artur Puzio <contact@xxxxxxxxxxxx> >> --- >> docs/formatdomain.html.in | 7 +++++++ >> docs/schemas/domaincommon.rng | 5 +++++ >> src/conf/domain_conf.c | 4 ++++ >> src/conf/domain_conf.h | 1 + >> src/libxl/libxl_conf.c | 13 +++++++++++++ >> 5 files changed, 30 insertions(+) >> >> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in >> index 91d6f6c0d3..5307844a23 100644 >> --- a/docs/formatdomain.html.in >> +++ b/docs/formatdomain.html.in >> @@ -2064,6 +2064,7 @@ >> <xen> >> <e820_host state='on'/> >> <passthrough state='on' mode='share_pt'/> >> + <gfx_passthru state='on'/> >> </xen> >> <pvspinlock state='on'/> >> <gic version='2'/> >> @@ -2270,6 +2271,12 @@ >> <td>on, off; mode - optional string sync_pt or share_pt</td> >> <td><span class="since">6.3.0</span></td> >> </tr> >> + <tr> >> + <td>gfx_passthru</td> >> + <td>Enable Intel GPU specific quirks. Required and allowed >> only when passing an IGD.</td> >> + <td>on, off</td> >> + <td><span class="since">6.3.0</span></td> >> + </tr> >> </table> >> </dd> >> <dt><code>pmu</code></dt> >> diff --git a/docs/schemas/domaincommon.rng >> b/docs/schemas/domaincommon.rng >> index 9d60b090f3..7d8ea879a1 100644 >> --- a/docs/schemas/domaincommon.rng >> +++ b/docs/schemas/domaincommon.rng >> @@ -6409,6 +6409,11 @@ >> </optional> >> </element> >> </optional> >> + <optional> >> + <element name="gfx_passthru"> >> + <ref name="featurestate"/> >> + </element> >> + </optional> >> </interleave> >> </element> >> </define> >> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c >> index 8a87586936..75f72ff64c 100644 >> --- a/src/conf/domain_conf.c >> +++ b/src/conf/domain_conf.c >> @@ -214,6 +214,7 @@ VIR_ENUM_IMPL(virDomainXen, >> VIR_DOMAIN_XEN_LAST, >> "e820_host", >> "passthrough", >> + "gfx_passthru" >> ); >> VIR_ENUM_IMPL(virDomainXenPassthroughMode, >> @@ -19649,6 +19650,7 @@ virDomainFeaturesDefParse(virDomainDefPtr def, >> switch ((virDomainXen) feature) { >> case VIR_DOMAIN_XEN_E820_HOST: >> + case VIR_DOMAIN_XEN_GFX_PASSTHRU: >> break; >> case VIR_DOMAIN_XEN_PASSTHROUGH: >> @@ -23579,6 +23581,7 @@ >> virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, >> } >> switch ((virDomainXen) i) { >> case VIR_DOMAIN_XEN_E820_HOST: >> + case VIR_DOMAIN_XEN_GFX_PASSTHRU: >> break; >> case VIR_DOMAIN_XEN_PASSTHROUGH: >> @@ -29235,6 +29238,7 @@ virDomainDefFormatFeatures(virBufferPtr buf, >> switch ((virDomainXen) j) { >> case VIR_DOMAIN_XEN_E820_HOST: >> + case VIR_DOMAIN_XEN_GFX_PASSTHRU: >> virBufferAddLit(&childBuf, "/>\n"); >> break; >> case VIR_DOMAIN_XEN_PASSTHROUGH: >> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h >> index 4afd8f04bc..f28f0741ac 100644 >> --- a/src/conf/domain_conf.h >> +++ b/src/conf/domain_conf.h >> @@ -1867,6 +1867,7 @@ typedef enum { >> typedef enum { >> VIR_DOMAIN_XEN_E820_HOST = 0, >> VIR_DOMAIN_XEN_PASSTHROUGH, >> + VIR_DOMAIN_XEN_GFX_PASSTHRU, >> VIR_DOMAIN_XEN_LAST >> } virDomainXen; >> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c >> index 458dfc2399..a5605f6200 100644 >> --- a/src/libxl/libxl_conf.c >> +++ b/src/libxl/libxl_conf.c >> @@ -679,6 +679,19 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, >> return -1; >> } >> #endif >> + if (def->features[VIR_DOMAIN_FEATURE_XEN] == >> VIR_TRISTATE_SWITCH_ON) { >> + switch ((virTristateSwitch) >> def->xen_features[VIR_DOMAIN_XEN_GFX_PASSTHRU]) { >> + case VIR_TRISTATE_SWITCH_ON: >> + libxl_defbool_set(&b_info->u.hvm.gfx_passthru, >> true); >> + break; >> + case VIR_TRISTATE_SWITCH_OFF: >> + libxl_defbool_set(&b_info->u.hvm.gfx_passthru, >> false); >> + break; >> + case VIR_TRISTATE_SWITCH_ABSENT: >> + case VIR_TRISTATE_SWITCH_LAST: >> + break; >> + } >> + } >> } else if (pvh) { >> b_info->cmdline = g_strdup(def->os.cmdline); >> b_info->kernel = g_strdup(def->os.kernel); >>
Attachment:
signature.asc
Description: OpenPGP digital signature