- libxl: Add support for 'passthrough' and 'e820_host' settings b7d6648d-conf-add-e820-host.patch, 5749395b-libxl-e820-host.patch, f3ef7daf-xenconfig-e820-host.patch, 34077c1b-tests-check-e820-host.patch, fadbaa23-conf-add-passthrough.patch, 9529e007-libxl-passthrough.patch, 9cb8bc6f-xenconfig-refactor-features.patch, b523e225-xenconfig-passthrough.patch, bed32525-tests-check-passthrough.patch bsc#1167217 OBS-URL: https://build.opensuse.org/request/show/796123 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=823
113 lines
4.8 KiB
Diff
113 lines
4.8 KiB
Diff
commit b523e22521afe733165869c9e1ae18e88536acd6
|
|
Author: Jim Fehlig <jfehlig@suse.com>
|
|
Date: Thu Apr 16 08:31:48 2020 -0600
|
|
|
|
xenconfig: Add support for 'passthrough' hypervisor feature
|
|
|
|
Add support for xl.cfg(5) 'passthrough' option in the domXML-to-xenconfig
|
|
configuration converter.
|
|
|
|
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
|
Index: libvirt-6.2.0/src/libvirt_private.syms
|
|
===================================================================
|
|
--- libvirt-6.2.0.orig/src/libvirt_private.syms
|
|
+++ libvirt-6.2.0/src/libvirt_private.syms
|
|
@@ -650,6 +650,8 @@ virDomainWatchdogActionTypeToString;
|
|
virDomainWatchdogDefFree;
|
|
virDomainWatchdogModelTypeFromString;
|
|
virDomainWatchdogModelTypeToString;
|
|
+virDomainXenPassthroughModeTypeFromString;
|
|
+virDomainXenPassthroughModeTypeToString;
|
|
virDomainXMLOptionGetNamespace;
|
|
virDomainXMLOptionGetSaveCookie;
|
|
virDomainXMLOptionNew;
|
|
Index: libvirt-6.2.0/src/libxl/xen_common.c
|
|
===================================================================
|
|
--- libvirt-6.2.0.orig/src/libxl/xen_common.c
|
|
+++ libvirt-6.2.0/src/libxl/xen_common.c
|
|
@@ -530,14 +530,14 @@ xenParseCPU(virConfPtr conf,
|
|
static int
|
|
xenParseHypervisorFeatures(virConfPtr conf, virDomainDefPtr def)
|
|
{
|
|
- g_autofree char *tsc_mode = NULL;
|
|
+ g_autofree char *strval = NULL;
|
|
virDomainTimerDefPtr timer;
|
|
int val = 0;
|
|
|
|
- if (xenConfigGetString(conf, "tsc_mode", &tsc_mode, NULL) < 0)
|
|
+ if (xenConfigGetString(conf, "tsc_mode", &strval, NULL) < 0)
|
|
return -1;
|
|
|
|
- if (tsc_mode) {
|
|
+ if (strval) {
|
|
if (VIR_EXPAND_N(def->clock.timers, def->clock.ntimers, 1) < 0 ||
|
|
VIR_ALLOC(timer) < 0)
|
|
return -1;
|
|
@@ -547,16 +547,40 @@ xenParseHypervisorFeatures(virConfPtr co
|
|
timer->tickpolicy = -1;
|
|
timer->mode = VIR_DOMAIN_TIMER_MODE_AUTO;
|
|
timer->track = -1;
|
|
- if (STREQ_NULLABLE(tsc_mode, "always_emulate"))
|
|
+ if (STREQ_NULLABLE(strval, "always_emulate"))
|
|
timer->mode = VIR_DOMAIN_TIMER_MODE_EMULATE;
|
|
- else if (STREQ_NULLABLE(tsc_mode, "native"))
|
|
+ else if (STREQ_NULLABLE(strval, "native"))
|
|
timer->mode = VIR_DOMAIN_TIMER_MODE_NATIVE;
|
|
- else if (STREQ_NULLABLE(tsc_mode, "native_paravirt"))
|
|
+ else if (STREQ_NULLABLE(strval, "native_paravirt"))
|
|
timer->mode = VIR_DOMAIN_TIMER_MODE_PARAVIRT;
|
|
|
|
def->clock.timers[def->clock.ntimers - 1] = timer;
|
|
}
|
|
|
|
+ if (xenConfigGetString(conf, "passthrough", &strval, NULL) < 0)
|
|
+ return -1;
|
|
+
|
|
+ if (strval) {
|
|
+ if (STREQ(strval, "disabled")) {
|
|
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_OFF;
|
|
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_OFF;
|
|
+ } else if (STREQ(strval, "enabled")) {
|
|
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
|
|
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_ON;
|
|
+ } else if (STREQ(strval, "sync_pt")) {
|
|
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
|
|
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_ON;
|
|
+ def->xen_passthrough_mode = VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT;
|
|
+ } else if (STREQ(strval, "share_pt")) {
|
|
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
|
|
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_ON;
|
|
+ def->xen_passthrough_mode = VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT;
|
|
+ } else {
|
|
+ virReportError(VIR_ERR_CONF_SYNTAX,
|
|
+ _("Invalid passthrough mode %s"), strval);
|
|
+ }
|
|
+ }
|
|
+
|
|
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
|
if (xenConfigGetBool(conf, "pae", &val, 1) < 0)
|
|
return -1;
|
|
@@ -2163,6 +2187,20 @@ xenFormatHypervisorFeatures(virConfPtr c
|
|
}
|
|
}
|
|
|
|
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
|
|
+ if (def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] == VIR_TRISTATE_SWITCH_ON) {
|
|
+ if (def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT ||
|
|
+ def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT) {
|
|
+ if (xenConfigSetString(conf, "passthrough",
|
|
+ virDomainXenPassthroughModeTypeToString(def->xen_passthrough_mode)) < 0)
|
|
+ return -1;
|
|
+ } else {
|
|
+ if (xenConfigSetString(conf, "passthrough", "enabled") < 0)
|
|
+ return -1;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
for (i = 0; i < def->clock.ntimers; i++) {
|
|
switch ((virDomainTimerNameType)def->clock.timers[i]->name) {
|
|
case VIR_DOMAIN_TIMER_NAME_TSC:
|