PyObject *kwds)
{
uint32_t dom = 0, ssidref = 0, flags = 0, target = 0;
- int ret, i, hvm = 0;
+ int ret, i;
PyObject *pyhandle = NULL;
xen_domain_handle_t handle = {
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef };
- static char *kwd_list[] = { "domid", "ssidref", "handle", "hvm", "target", NULL };
+ static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", "target", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOii", kwd_list,
- &dom, &ssidref, &pyhandle, &hvm, &target))
+ &dom, &ssidref, &pyhandle, &flags, &target))
return NULL;
-
if ( pyhandle != NULL )
{
if ( !PyList_Check(pyhandle) ||
}
}
- if ( hvm )
- flags |= XEN_DOMCTL_CDF_hvm_guest;
-
if ( (ret = xc_domain_create(self->xc_handle, ssidref,
handle, flags, &dom)) < 0 )
return pyxc_error_to_exception();
'soundhw','stdvga', 'usb', 'usbdevice', 'vnc',
'vncconsole', 'vncdisplay', 'vnclisten', 'timer_mode',
'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt',
- 'guest_os_type' ]
+ 'guest_os_type', 'hap']
# Xen API console 'other_config' keys.
XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
def image_type(self):
stored_type = self['platform'].get('image_type')
return stored_type or (self.is_hvm() and 'hvm' or 'linux')
+
+ def is_hap(self):
+ return self['platform']['hap']
@raise: VmError on error
"""
+ hvm_bit_offset = 0
+
+ hap_bit_offset = 1
+
log.debug('XendDomainInfo.constructDomain')
self.shutdownStartTime = None
hvm = self.info.is_hvm()
+
+ hap = self.info.is_hap()
+
if hvm:
info = xc.xeninfo()
if 'hvm' not in info['xen_caps']:
domid = 0,
ssidref = ssidref,
handle = uuid.fromString(self.info['uuid']),
- hvm = int(hvm),
+ flags = int((hvm << hvm_bit_offset) | (hap << hap_bit_offset)),
target = self.info.target())
except Exception, e:
# may get here if due to ACM the operation is not permitted
fn=set_int, default=0,
use="Set domain target.")
+gopts.var('hap', val='HAP',
+ fn=set_int, default=1,
+ use="""Hap status (0=hap is disabled;
+ 1=hap is enabled.""")
+
def err(msg):
"""Print an error to stderr and exit.
"""
'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci',
- 'guest_os_type']
+ 'guest_os_type', 'hap']
for a in args:
if a in vals.__dict__ and vals.__dict__[a] is not None:
def extract_platform(self, image, document):
- platform_keys = ['acpi', 'apic', 'pae', 'vhpt', 'timer_mode']
+ platform_keys = ['acpi', 'apic', 'pae', 'vhpt', 'timer_mode', 'hap']
def extract_platform_key(key):
platform = document.createElement("platform")
integer_param("pervcpu_vhpt", opt_pervcpu_vhpt);
#endif
-int arch_domain_create(struct domain *d)
+int arch_domain_create(struct domain *d, unsigned int domcr_flags)
{
int i;
struct page_info *page = NULL;
return XEN_MARK(op);
}
-int arch_domain_create(struct domain *d)
+int arch_domain_create(struct domain *d, unsigned int domcr_flags)
{
if (d->domain_id == IDLE_DOMAIN_ID) {
d->shared_info = (void *)alloc_xenheap_page();
hvm_vcpu_destroy(v);
}
-int arch_domain_create(struct domain *d)
+int arch_domain_create(struct domain *d, unsigned int domcr_flags)
{
#ifdef __x86_64__
struct page_info *pg;
int vcpuid, pdpt_order, paging_initialised = 0;
int rc = -ENOMEM;
+ d->arch.hvm_domain.hap_enabled =
+ is_hvm_domain(d) &&
+ hvm_funcs.hap_supported &&
+ (domcr_flags & DOMCRF_hap);
+
d->arch.relmem = RELMEM_not_started;
INIT_LIST_HEAD(&d->arch.relmem_list);
{
if ( !test_and_set_bool(d->arch.hvm_domain.amd_npt_4gb_warning) )
dprintk(XENLOG_WARNING, "Dom%d failed to populate memory beyond"
- " 4GB: remove 'hap' Xen boot parameter.\n",
+ " 4GB: specify 'nohap' Xen boot parameter, or 'hap=0' "
+ "domain config option.\n",
d->domain_id);
return -EINVAL;
}
#include <asm/guest_access.h>
#include <xsm/xsm.h>
-#define hap_enabled(d) (hvm_funcs.hap_supported && is_hvm_domain(d))
+#define hap_enabled(d) (is_hvm_domain(d) && (d)->arch.hvm_domain.hap_enabled)
/* Printouts */
#define PAGING_PRINTK(_f, _a...) \
init_status |= INIT_gnttab;
}
- if ( arch_domain_create(d) != 0 )
+ if ( arch_domain_create(d, domcr_flags) != 0 )
goto fail;
init_status |= INIT_arch;
ret = -EINVAL;
if ( supervisor_mode_kernel ||
- (op->u.createdomain.flags & ~XEN_DOMCTL_CDF_hvm_guest) )
+ (op->u.createdomain.flags &
+ ~(XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap)) )
break;
dom = op->domain;
domcr_flags = 0;
if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hvm_guest )
domcr_flags |= DOMCRF_hvm;
+ if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hap )
+ domcr_flags |= DOMCRF_hap;
ret = -ENOMEM;
d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref);
#if CONFIG_PAGING_LEVELS == 3
bool_t amd_npt_4gb_warning;
#endif
-
+ bool_t hap_enabled;
bool_t qemu_mapcache_invalidate;
};
/* Is this an HVM guest (as opposed to a PV guest)? */
#define _XEN_DOMCTL_CDF_hvm_guest 0
#define XEN_DOMCTL_CDF_hvm_guest (1U<<_XEN_DOMCTL_CDF_hvm_guest)
+ /* Use hardware-assisted paging if available? */
+#define _XEN_DOMCTL_CDF_hap 1
+#define XEN_DOMCTL_CDF_hap (1U<<_XEN_DOMCTL_CDF_hap)
uint32_t flags;
};
typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
int vcpu_initialise(struct vcpu *v);
void vcpu_destroy(struct vcpu *v);
-int arch_domain_create(struct domain *d);
+int arch_domain_create(struct domain *d, unsigned int domcr_flags);
void arch_domain_destroy(struct domain *d);
/* DOMCRF_hvm: Create an HVM domain, as opposed to a PV domain. */
#define _DOMCRF_hvm 0
#define DOMCRF_hvm (1U<<_DOMCRF_hvm)
+#define _DOMCRF_hap 1
+#define DOMCRF_hap (1U<<_DOMCRF_hap)
int construct_dom0(
struct domain *d,