Index: xen-4.0.1-testing/tools/python/xen/lowlevel/xc/xc.c
===================================================================
--- xen-4.0.1-testing.orig/tools/python/xen/lowlevel/xc/xc.c
+++ xen-4.0.1-testing/tools/python/xen/lowlevel/xc/xc.c
@@ -944,16 +944,16 @@ static PyObject *pyxc_hvm_build(XcObject
 #endif
     int i;
     char *image;
-    int memsize, target=-1, vcpus = 1, acpi = 0, apic = 1;
+    int memsize, target=-1, vcpus = 1, acpi = 0, apic = 1, extid = 0;
     PyObject *vcpu_avail_handle = NULL;
     uint8_t vcpu_avail[(HVM_MAX_VCPUS + 7)/8];
 
     static char *kwd_list[] = { "domid",
-                                "memsize", "image", "target", "vcpus", 
-                                "vcpu_avail", "acpi", "apic", NULL };
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|iiOii", kwd_list,
+                                "memsize", "image", "target", "vcpus",
+                                "vcpu_avail", "extid", "acpi", "apic", NULL };
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|iiOiii", kwd_list,
                                       &dom, &memsize, &image, &target, &vcpus,
-                                      &vcpu_avail_handle, &acpi, &apic) )
+                                      &vcpu_avail_handle, &extid, &acpi, &apic) )
         return NULL;
 
     memset(vcpu_avail, 0, sizeof(vcpu_avail));
@@ -1005,6 +1005,7 @@ static PyObject *pyxc_hvm_build(XcObject
     va_hvm->checksum -= sum;
     munmap(va_map, XC_PAGE_SIZE);
 #endif
+    xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_EXTEND_HYPERVISOR, extid);
 
     return Py_BuildValue("{}");
 }
Index: xen-4.0.1-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-4.0.1-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-4.0.1-testing/tools/python/xen/xend/XendConfig.py
@@ -157,6 +157,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'nographic': int,
     'nomigrate': int,
     'pae' : int,
+    'extid': int,
     'rtc_timeoffset': int,
     'parallel': str,
     'serial': str,
Index: xen-4.0.1-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-4.0.1-testing.orig/tools/python/xen/xend/image.py
+++ xen-4.0.1-testing/tools/python/xen/xend/image.py
@@ -842,6 +842,7 @@ class HVMImageHandler(ImageHandler):
 
         self.apic = int(vmConfig['platform'].get('apic', 0))
         self.acpi = int(vmConfig['platform'].get('acpi', 0))
+        self.extid = int(vmConfig['platform'].get('extid', 0))
         self.guest_os_type = vmConfig['platform'].get('guest_os_type')
         self.memory_sharing = int(vmConfig['memory_sharing'])
         try:
@@ -973,6 +974,7 @@ class HVMImageHandler(ImageHandler):
         log.debug("target         = %d", mem_mb)
         log.debug("vcpus          = %d", self.vm.getVCpuCount())
         log.debug("vcpu_avail     = %li", self.vm.getVCpuAvail())
+        log.debug("extid          = %d", self.extid)
         log.debug("acpi           = %d", self.acpi)
         log.debug("apic           = %d", self.apic)
 
@@ -982,6 +984,7 @@ class HVMImageHandler(ImageHandler):
                           target         = mem_mb,
                           vcpus          = self.vm.getVCpuCount(),
                           vcpu_avail     = self.vm.getVCpuAvail(),
+                          extid          = self.extid,
                           acpi           = self.acpi,
                           apic           = self.apic)
         rc['notes'] = { 'SUSPEND_CANCEL': 1 }
Index: xen-4.0.1-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-4.0.1-testing.orig/tools/python/xen/xm/create.py
+++ xen-4.0.1-testing/tools/python/xen/xm/create.py
@@ -242,6 +242,10 @@ gopts.var('viridian', val='VIRIDIAN',
           use="""Expose Viridian interface to x86 HVM guest?
           (Default is 0).""")
 
+gopts.var('extid', val='EXTID',
+          fn=set_int, default=0,
+          use="Specify extention ID for a HVM domain.")
+
 gopts.var('acpi', val='ACPI',
           fn=set_int, default=1,
           use="Disable or enable ACPI of HVM domain.")
@@ -1091,7 +1095,7 @@ def configure_hvm(config_image, vals):
              'timer_mode',
              'usb', 'usbdevice',
              'vcpus', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten',
-             'vncunused', 'viridian', 'vpt_align',
+             'vncunused', 'viridian', 'extid', 'vpt_align',
              'xauthority', 'xen_extended_power_mgmt', 'xen_platform_pci',
              'memory_sharing' ]
 
