mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86: Allow LAPIC-only emulation_flags for HVM guests
PVHv2 guests may request LAPIC emulation (and nothing else) Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
73b72736e6
commit
85c17cbb25
1 file changed
+18
-12
+18
-12
@@ -545,25 +545,31 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
|
||||
}
|
||||
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;
|
||||
}
|
||||
uint32_t emflags;
|
||||
|
||||
if ( is_hardware_domain(d) )
|
||||
config->emulation_flags |= XEN_X86_EMU_PIT;
|
||||
if ( config->emulation_flags != 0 &&
|
||||
(config->emulation_flags !=
|
||||
(is_hvm_domain(d) ? XEN_X86_EMU_ALL : XEN_X86_EMU_PIT)) )
|
||||
|
||||
emflags = config->emulation_flags;
|
||||
if ( emflags & ~XEN_X86_EMU_ALL )
|
||||
{
|
||||
printk(XENLOG_G_ERR "d%d: Invalid emulation bitmap: %#x\n",
|
||||
d->domain_id, emflags);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* PVHv2 guests can request emulated APIC. */
|
||||
if ( emflags &&
|
||||
(is_hvm_domain(d) ? ((emflags != XEN_X86_EMU_ALL) &&
|
||||
(emflags != XEN_X86_EMU_LAPIC)) :
|
||||
(emflags != XEN_X86_EMU_PIT)) )
|
||||
{
|
||||
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);
|
||||
d->domain_id, is_hvm_domain(d) ? "HVM" : "PV", emflags);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
d->arch.emulation_flags = config->emulation_flags;
|
||||
d->arch.emulation_flags = emflags;
|
||||
}
|
||||
|
||||
if ( has_hvm_container_domain(d) )
|
||||
|
||||