From bce296364e6ec320a33fc8770b20f552d6163af6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roger=20Pau=20Monn=C3=A9?= Date: Fri, 22 Jan 2016 16:18:29 +0100 Subject: [PATCH] x86/PV: allow PV guests to have an emulated PIT MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- xen/arch/x86/domain.c | 5 ++++- xen/arch/x86/hvm/i8254.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 */; -- 2.39.5