@@ -831,6 +831,8 @@ static int __init construct_domU(struct domain *d,
rc = domain_vpl011_init(d, NULL);
if ( rc < 0 )
return rc;
+
+ d->arch.emulation_flags |= ARM_EMU_VUART;
}
rc = prepare_dtb_domU(d, &kinfo);
@@ -769,14 +769,19 @@ int arch_domain_create(struct domain *d,
if ( !vgic_reserve_virq(d, GUEST_EVTCHN_PPI) )
BUG();
}
+ else
+ {
+ /*
+ * Virtual UART is only used by linux early printk and decompress code.
+ * Only use it for the hardware domain because the linux kernel may not
+ * support multi-platform.
+ */
+ rc = domain_vuart_init(d);
+ if ( rc )
+ goto fail;
- /*
- * Virtual UART is only used by linux early printk and decompress code.
- * Only use it for the hardware domain because the linux kernel may not
- * support multi-platform.
- */
- if ( is_hardware_domain(d) && (rc = domain_vuart_init(d)) )
- goto fail;
+ d->arch.emulation_flags |= ARM_EMU_VUART;
+ }
if ( (rc = domain_vpci_init(d)) != 0 )
goto fail;
@@ -42,9 +42,11 @@ static int handle_vuart_init(struct domain *d,
return -EOPNOTSUPP;
rc = domain_vpl011_init(d, &info);
-
if ( !rc )
+ {
vuart_op->evtchn = info.evtchn;
+ d->arch.emulation_flags |= ARM_EMU_VUART;
+ }
return rc;
}
@@ -119,8 +119,17 @@ struct arch_domain
void *tee;
#endif
+ /* Emulated devices enabled bitmap. */
+ uint32_t emulation_flags;
+
} __cacheline_aligned;
+enum {
+ ARM_EMU_VUART = BIT(0, U),
+};
+
+#define domain_has_vuart(d) (!!((d)->arch.emulation_flags & ARM_EMU_VUART))
+
struct arch_vcpu
{
struct {
@@ -31,8 +31,6 @@
#include "vuart.h"
-#define domain_has_vuart(d) ((d)->arch.vuart.info != NULL)
-
static int vuart_mmio_read(struct vcpu *v, mmio_info_t *info,
register_t *r, void *priv);
static int vuart_mmio_write(struct vcpu *v, mmio_info_t *info,