Add hvm config option to allow nesting
Signed-off-by: Qing He <qing.he@xxxxxxxxx>
---
examples/xmexample.hvm | 12 ++++++++++++
python/xen/xend/XendConfig.py | 4 ++++
python/xen/xend/XendDomainInfo.py | 5 ++++-
python/xen/xm/create.py | 7 ++++++-
python/xen/xm/xenapi_create.py | 1 +
5 files changed, 27 insertions(+), 2 deletions(-)
diff -r 3a7b55a0be9c -r 682f3d39f719 tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm Thu Apr 22 22:30:10 2010 +0800
+++ b/tools/examples/xmexample.hvm Thu Apr 22 22:39:56 2010 +0800
@@ -371,3 +371,15 @@
#
#vscsi = [ '/dev/sdx, 0:0:0:0' ]
+
+# Enable nested virtualization
+#
+# Turn on this option allow the guest to present virtualization
+# hardware. So that guest can use VMX or SVM to run another guest.
+# Turning off the option not only masks availability reporting, but
+# also disables all related controls, including related instructions,
+# cpuid, msr, etc. for security concerns.
+#
+# This feature is experimental, and the default is off.
+#
+#nesting=0
diff -r 3a7b55a0be9c -r 682f3d39f719 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Thu Apr 22 22:30:10 2010 +0800
+++ b/tools/python/xen/xend/XendConfig.py Thu Apr 22 22:39:56 2010 +0800
@@ -176,6 +176,7 @@
'vhpt': int,
'guest_os_type': str,
'hap': int,
+ 'nesting': int,
'xen_extended_power_mgmt': int,
'pci_msitranslate': int,
'pci_power_mgmt': int,
@@ -2219,6 +2220,9 @@
def is_hap(self):
return self['platform'].get('hap', 0)
+ def is_nesting(self):
+ return self['platform'].get('nesting', 0)
+
def is_pv_and_has_pci(self):
for dev_type, dev_info in self.all_devices_sxpr():
if dev_type != 'pci':
diff -r 3a7b55a0be9c -r 682f3d39f719 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Thu Apr 22 22:30:10 2010 +0800
+++ b/tools/python/xen/xend/XendDomainInfo.py Thu Apr 22 22:39:56 2010 +0800
@@ -2511,9 +2511,11 @@
self.restart_in_progress = False
hap = 0
+ nesting = 0
hvm = self.info.is_hvm()
if hvm:
hap = self.info.is_hap()
+ nesting = self.info.is_nesting()
info = xc.xeninfo()
if 'hvm' not in info['xen_caps']:
raise VmError("HVM guest support is unavailable: is VT/AMD-V "
@@ -2540,7 +2542,8 @@
oos = self.info['platform'].get('oos', 1)
oos_off = 1 - int(oos)
- flags = (int(hvm) << 0) | (int(hap) << 1) | (int(s3_integrity) << 2) |
(int(oos_off) << 3)
+ flags = (int(hvm) << 0) | (int(hap) << 1) | (int(s3_integrity) << 2) \
+ | (int(oos_off) << 3) | (int(nesting) << 4)
try:
self.domid = xc.domain_create(
diff -r 3a7b55a0be9c -r 682f3d39f719 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Thu Apr 22 22:30:10 2010 +0800
+++ b/tools/python/xen/xm/create.py Thu Apr 22 22:39:56 2010 +0800
@@ -643,6 +643,11 @@
use="""Should out-of-sync shadow page tabled be enabled?
(0=OOS is disabled; 1=OOS is enabled.""")
+gopts.var('nesting', val='Nesting',
+ fn=set_int, default=0,
+ use="""Nesting availability (0=nesting is forbidden;
+ 1=nesting is allowed.""")
+
gopts.var('cpuid', val="IN[,SIN]:eax=EAX,ebx=EBX,ecx=ECX,edx=EDX",
fn=append_value, default=[],
use="""Cpuid description.""")
@@ -1065,7 +1070,7 @@
'device_model', 'display',
'fda', 'fdb',
'gfx_passthru', 'guest_os_type',
- 'hap', 'hpet',
+ 'hap', 'hpet', 'nesting',
'isa',
'keymap',
'localtime',
diff -r 3a7b55a0be9c -r 682f3d39f719 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py Thu Apr 22 22:30:10 2010 +0800
+++ b/tools/python/xen/xm/xenapi_create.py Thu Apr 22 22:39:56 2010 +0800
@@ -1105,6 +1105,7 @@
'guest_os_type',
'hap',
'oos',
+ 'nesting',
'pci_msitranslate',
'pci_power_mgmt',
'xen_platform_pci',
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|