提交 04197350 编写于 作者: J Jim Fehlig

Add support for HAP feature to xen drivers

xen-unstable c/s 16931 introduced a per-domain setting for hvm
guests to enable/disable hardware assisted paging.  If disabled,
software techniques such as shadow page tables are used.  If enabled,
and the feature exists in underlying hardware, hardware support for
paging is used.

This provides implementation for mapping HAP setting to/from
domxml/native formats in xen drivers.
上级 48a5dccd
...@@ -2210,6 +2210,8 @@ xenDaemonParseSxpr(virConnectPtr conn, ...@@ -2210,6 +2210,8 @@ xenDaemonParseSxpr(virConnectPtr conn,
def->features |= (1 << VIR_DOMAIN_FEATURE_APIC); def->features |= (1 << VIR_DOMAIN_FEATURE_APIC);
if (sexpr_int(root, "domain/image/hvm/pae")) if (sexpr_int(root, "domain/image/hvm/pae"))
def->features |= (1 << VIR_DOMAIN_FEATURE_PAE); def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
if (sexpr_int(root, "domain/image/hvm/hap"))
def->features |= (1 << VIR_DOMAIN_FEATURE_HAP);
/* Old XenD only allows localtime here for HVM */ /* Old XenD only allows localtime here for HVM */
if (sexpr_int(root, "domain/image/hvm/localtime")) if (sexpr_int(root, "domain/image/hvm/localtime"))
...@@ -5923,6 +5925,8 @@ xenDaemonFormatSxpr(virConnectPtr conn, ...@@ -5923,6 +5925,8 @@ xenDaemonFormatSxpr(virConnectPtr conn,
virBufferAddLit(&buf, "(apic 1)"); virBufferAddLit(&buf, "(apic 1)");
if (def->features & (1 << VIR_DOMAIN_FEATURE_PAE)) if (def->features & (1 << VIR_DOMAIN_FEATURE_PAE))
virBufferAddLit(&buf, "(pae 1)"); virBufferAddLit(&buf, "(pae 1)");
if (def->features & (1 << VIR_DOMAIN_FEATURE_HAP))
virBufferAddLit(&buf, "(hap 1)");
virBufferAddLit(&buf, "(usb 1)"); virBufferAddLit(&buf, "(usb 1)");
......
...@@ -830,6 +830,10 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) { ...@@ -830,6 +830,10 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto cleanup; goto cleanup;
else if (val) else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_APIC); def->features |= (1 << VIR_DOMAIN_FEATURE_APIC);
if (xenXMConfigGetBool(conf, "hap", &val, 0) < 0)
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_HAP);
} }
if (xenXMConfigGetBool(conf, "localtime", &vmlocaltime, 0) < 0) if (xenXMConfigGetBool(conf, "localtime", &vmlocaltime, 0) < 0)
goto cleanup; goto cleanup;
...@@ -2409,6 +2413,10 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, ...@@ -2409,6 +2413,10 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
(1 << VIR_DOMAIN_FEATURE_APIC)) ? 1 : 0) < 0) (1 << VIR_DOMAIN_FEATURE_APIC)) ? 1 : 0) < 0)
goto no_memory; goto no_memory;
if (xenXMConfigSetInt(conf, "hap",
(def->features &
(1 << VIR_DOMAIN_FEATURE_HAP)) ? 1 : 0) < 0)
goto no_memory;
if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) { if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) {
if (def->clock.data.timezone) { if (def->clock.data.timezone) {
......
...@@ -1358,6 +1358,8 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED) ...@@ -1358,6 +1358,8 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_APIC); defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_APIC);
else if (STREQ(result->contents[i].key, "pae")) else if (STREQ(result->contents[i].key, "pae"))
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_PAE); defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_PAE);
else if (STREQ(result->contents[i].key, "hap"))
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_HAP);
} }
} }
xen_string_string_map_free(result); xen_string_string_map_free(result);
......
...@@ -529,6 +529,8 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def, ...@@ -529,6 +529,8 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
allocStringMap(&strings, (char *)"apic", (char *)"true"); allocStringMap(&strings, (char *)"apic", (char *)"true");
if (def->features & (1 << VIR_DOMAIN_FEATURE_PAE)) if (def->features & (1 << VIR_DOMAIN_FEATURE_PAE))
allocStringMap(&strings, (char *)"pae", (char *)"true"); allocStringMap(&strings, (char *)"pae", (char *)"true");
if (def->features & (1 << VIR_DOMAIN_FEATURE_HAP))
allocStringMap(&strings, (char *)"hap", (char *)"true");
} }
if (strings != NULL) if (strings != NULL)
(*record)->platform = strings; (*record)->platform = strings;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册