From: Roger Pau Monné Date: Fri, 22 Jan 2016 15:18:29 +0000 (+0100) Subject: x86/PV: allow PV guests to have an emulated PIT X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bce296364e6ec320a33fc8770b20f552d6163af6;p=people%2Fliuw%2Flibxenctrl-split%2Fxen.git x86/PV: allow PV guests to have an emulated PIT This fixes the fallout from the HVMlite series, that removed the emulated PIT from PV(H) guests. Also, this patch forces the hardware domain to always have an emulated PIT, regardless of whether the toolstack specified one or not. Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index e70c12532a..352c194f4f 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -542,8 +542,11 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, d->domain_id, config->emulation_flags); return -EINVAL; } + if ( is_hardware_domain(d) ) + config->emulation_flags |= XEN_X86_EMU_PIT; if ( config->emulation_flags != 0 && - (!is_hvm_domain(d) || config->emulation_flags != XEN_X86_EMU_ALL) ) + (config->emulation_flags != + (is_hvm_domain(d) ? XEN_X86_EMU_ALL : 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", diff --git a/xen/arch/x86/hvm/i8254.c b/xen/arch/x86/hvm/i8254.c index b517cd636b..577b43cff0 100644 --- a/xen/arch/x86/hvm/i8254.c +++ b/xen/arch/x86/hvm/i8254.c @@ -568,6 +568,9 @@ int pv_pit_handler(int port, int data, int write) .data = data }; + if ( !has_vpit(current->domain) ) + return ~0; + if ( is_hardware_domain(current->domain) && hwdom_pit_access(&ioreq) ) { /* nothing to do */;