libxl_domain_config *d_config,
xc_domain_configuration_t *xc_config)
{
- /* No specific configuration right now */
+ if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM)
+ xc_config->emulation_flags = XEN_X86_EMU_ALL;
+ else
+ xc_config->emulation_flags = 0;
return 0;
}
int i, paging_initialised = 0;
int rc = -ENOMEM;
+ if ( config == NULL && !is_idle_domain(d) )
+ return -EINVAL;
+
d->arch.s3_integrity = !!(domcr_flags & DOMCRF_s3_integrity);
INIT_LIST_HEAD(&d->arch.pdev_list);
d->domain_id);
}
+ if ( is_idle_domain(d) )
+ {
+ d->arch.emulation_flags = 0;
+ }
+ else
+ {
+ if ( (config->emulation_flags & ~XEN_X86_EMU_ALL) != 0 )
+ {
+ printk(XENLOG_G_ERR "d%d: Invalid emulation bitmap: %#x\n",
+ d->domain_id, config->emulation_flags);
+ return -EINVAL;
+ }
+ if ( is_hvm_domain(d) ? (config->emulation_flags != XEN_X86_EMU_ALL)
+ : (config->emulation_flags != 0) )
+ {
+ printk(XENLOG_G_ERR "d%d: Xen does not allow %s domain creation "
+ "with the current selection of emulators: %#x\n",
+ d->domain_id, is_hvm_domain(d) ? "HVM" : "PV",
+ config->emulation_flags);
+ return -EOPNOTSUPP;
+ }
+ d->arch.emulation_flags = config->emulation_flags;
+ }
+
if ( has_hvm_container_domain(d) )
{
d->arch.hvm_domain.hap_enabled =
.parity = 'n',
.stop_bits = 1
};
+ struct xen_arch_domainconfig config = { .emulation_flags = 0 };
/* Critical region without IDT or TSS. Any fault is deadly! */
* x86 doesn't support arch-configuration. So it's fine to pass
* NULL.
*/
- dom0 = domain_create(0, domcr_flags, 0, NULL);
+ dom0 = domain_create(0, domcr_flags, 0, &config);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
panic("Error creating domain 0");
sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
}
- /* There is no need of arch-specific configuration for an idle domain */
idle_domain = domain_create(DOMID_IDLE, 0, 0, NULL);
BUG_ON(IS_ERR(idle_domain));
idle_domain->vcpu = idle_vcpu;
/* Mem_access emulation control */
bool_t mem_access_emulate_enabled;
bool_t mem_access_emulate_each_rep;
+
+ /* Emulated devices enabled bitmap. */
+ uint32_t emulation_flags;
} __cacheline_aligned;
+#define has_vlapic(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_LAPIC))
+#define has_vhpet(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_HPET))
+#define has_vpm(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_PM))
+#define has_vrtc(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_RTC))
+#define has_vioapic(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_IOAPIC))
+#define has_vpic(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_PIC))
+#define has_vvga(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_VGA))
+#define has_viommu(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_IOMMU))
+#define has_vpit(d) (!!((d)->arch.emulation_flags & XEN_X86_EMU_PIT))
+
#define has_arch_pdevs(d) (!list_empty(&(d)->arch.pdev_list))
#define gdt_ldt_pt_idx(v) \
* XEN_DOMCTL_INTERFACE_VERSION.
*/
struct xen_arch_domainconfig {
- char dummy;
+#define _XEN_X86_EMU_LAPIC 0
+#define XEN_X86_EMU_LAPIC (1U<<_XEN_X86_EMU_LAPIC)
+#define _XEN_X86_EMU_HPET 1
+#define XEN_X86_EMU_HPET (1U<<_XEN_X86_EMU_HPET)
+#define _XEN_X86_EMU_PM 2
+#define XEN_X86_EMU_PM (1U<<_XEN_X86_EMU_PM)
+#define _XEN_X86_EMU_RTC 3
+#define XEN_X86_EMU_RTC (1U<<_XEN_X86_EMU_RTC)
+#define _XEN_X86_EMU_IOAPIC 4
+#define XEN_X86_EMU_IOAPIC (1U<<_XEN_X86_EMU_IOAPIC)
+#define _XEN_X86_EMU_PIC 5
+#define XEN_X86_EMU_PIC (1U<<_XEN_X86_EMU_PIC)
+#define _XEN_X86_EMU_VGA 6
+#define XEN_X86_EMU_VGA (1U<<_XEN_X86_EMU_VGA)
+#define _XEN_X86_EMU_IOMMU 7
+#define XEN_X86_EMU_IOMMU (1U<<_XEN_X86_EMU_IOMMU)
+#define _XEN_X86_EMU_PIT 8
+#define XEN_X86_EMU_PIT (1U<<_XEN_X86_EMU_PIT)
+
+#define XEN_X86_EMU_ALL (XEN_X86_EMU_LAPIC | XEN_X86_EMU_HPET | \
+ XEN_X86_EMU_PM | XEN_X86_EMU_RTC | \
+ XEN_X86_EMU_IOAPIC | XEN_X86_EMU_PIC | \
+ XEN_X86_EMU_VGA | XEN_X86_EMU_IOMMU | \
+ XEN_X86_EMU_PIT)
+ uint32_t emulation_flags;
};
#endif