@@ -8,7 +8,11 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
{
switch(d_config->c_info.type) {
case LIBXL_DOMAIN_TYPE_HVM:
- config->arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI);
+ config->arch.emulation_flags = XEN_X86_EMU_ALL;
+ config->arch.emulation_flags &= ~XEN_X86_EMU_VPCI;
+ /* Virtual UART is selected at Xen build time */
+ config->arch.emulation_flags &= ~XEN_X86_EMU_VUART;
+
if (!libxl_defbool_val(d_config->b_info.u.hvm.pirq))
config->arch.emulation_flags &= ~XEN_X86_EMU_USE_PIRQ;
break;
@@ -47,6 +47,7 @@ type x86_arch_emulation_flags =
| X86_EMU_PIT
| X86_EMU_USE_PIRQ
| X86_EMU_VPCI
+ | X86_EMU_VUART
type x86_arch_misc_flags =
| X86_MSR_RELAXED
@@ -41,6 +41,7 @@ type x86_arch_emulation_flags =
| X86_EMU_PIT
| X86_EMU_USE_PIRQ
| X86_EMU_VPCI
+ | X86_EMU_VUART
type x86_arch_misc_flags =
| X86_MSR_RELAXED
@@ -159,9 +159,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
#if defined (__i386) || defined(__x86_64__)
if ( config.flags & XEN_DOMCTL_CDF_hvm )
- config.arch.emulation_flags = XEN_X86_EMU_ALL &
- ~(XEN_X86_EMU_VPCI |
- XEN_X86_EMU_USE_PIRQ);
+ config.arch.emulation_flags = XEN_X86_EMU_HVM_ALLOWABLE;
#elif defined (__arm__) || defined(__aarch64__)
config.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
#else
@@ -752,10 +752,10 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)
if ( is_hardware_domain(d) &&
emflags != (X86_EMU_VPCI | X86_EMU_LAPIC | X86_EMU_IOAPIC) )
return false;
+
+ emflags &= ~X86_EMU_VUART;
if ( !is_hardware_domain(d) &&
- /* HVM PIRQ feature is user-selectable. */
- (emflags & ~X86_EMU_USE_PIRQ) !=
- (X86_EMU_ALL & ~(X86_EMU_VPCI | X86_EMU_USE_PIRQ)) &&
+ xen_emflags_allowable(emflags) != XEN_X86_EMU_HVM_ALLOWABLE &&
emflags != X86_EMU_LAPIC )
return false;
}
@@ -806,6 +806,8 @@ int arch_domain_create(struct domain *d,
emflags = config->arch.emulation_flags;
+ if ( IS_ENABLED(CONFIG_HAS_VUART_NS8250) && is_hvm_domain(d) )
+ emflags |= XEN_X86_EMU_VUART;
if ( is_hardware_domain(d) && is_pv_domain(d) )
emflags |= XEN_X86_EMU_PIT;
@@ -484,7 +484,8 @@ struct arch_domain
#define X86_EMU_VPCI 0
#endif
-#define X86_EMU_PIT XEN_X86_EMU_PIT
+#define X86_EMU_PIT XEN_X86_EMU_PIT
+#define X86_EMU_VUART XEN_X86_EMU_VUART
/* This must match XEN_X86_EMU_ALL in xen.h */
#define X86_EMU_ALL (X86_EMU_LAPIC | X86_EMU_HPET | \
@@ -492,7 +493,7 @@ struct arch_domain
X86_EMU_IOAPIC | X86_EMU_PIC | \
X86_EMU_VGA | X86_EMU_IOMMU | \
X86_EMU_PIT | X86_EMU_USE_PIRQ | \
- X86_EMU_VPCI)
+ X86_EMU_VPCI | X86_EMU_VUART)
#define has_vlapic(d) (!!((d)->arch.emulation_flags & X86_EMU_LAPIC))
#define has_vhpet(d) (!!((d)->arch.emulation_flags & X86_EMU_HPET))
@@ -507,7 +508,7 @@ struct arch_domain
#define has_vpci(d) (!!((d)->arch.emulation_flags & X86_EMU_VPCI))
/* NB: same symbol as in Arm port */
-#define domain_has_vuart(d) false
+#define domain_has_vuart(d) (!!((d)->arch.emulation_flags & X86_EMU_VUART))
#define gdt_ldt_pt_idx(v) \
((v)->vcpu_id >> (PAGETABLE_ORDER - GDT_LDT_VCPU_SHIFT))
@@ -283,13 +283,25 @@ struct xen_arch_domainconfig {
#define XEN_X86_EMU_USE_PIRQ (1U<<_XEN_X86_EMU_USE_PIRQ)
#define _XEN_X86_EMU_VPCI 10
#define XEN_X86_EMU_VPCI (1U<<_XEN_X86_EMU_VPCI)
+#define _XEN_X86_EMU_VUART 11
+#define XEN_X86_EMU_VUART (1U<<_XEN_X86_EMU_VUART)
#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 | XEN_X86_EMU_USE_PIRQ |\
- XEN_X86_EMU_VPCI)
+ XEN_X86_EMU_VPCI | XEN_X86_EMU_VUART)
+
+/* HVM PIRQ feature is user-selectable (libxl). */
+#define XEN_X86_EMU_HVM_SELECTABLE (XEN_X86_EMU_VPCI | \
+ XEN_X86_EMU_USE_PIRQ | \
+ XEN_X86_EMU_VUART)
+
+#define xen_emflags_allowable(x) ((x) & ~XEN_X86_EMU_HVM_SELECTABLE)
+
+#define XEN_X86_EMU_HVM_ALLOWABLE xen_emflags_allowable(XEN_X86_EMU_ALL)
+
uint32_t emulation_flags;
/*