From patchwork Thu Jan 21 16:51:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 8083171 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 03AABBEEE5 for ; Thu, 21 Jan 2016 16:54:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30553204FF for ; Thu, 21 Jan 2016 16:54:21 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AE2720502 for ; Thu, 21 Jan 2016 16:54:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMISh-0003XU-Iy; Thu, 21 Jan 2016 16:51:55 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMISg-0003XA-0G for xen-devel@lists.xenproject.org; Thu, 21 Jan 2016 16:51:54 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 5E/CE-03225-9AC01A65; Thu, 21 Jan 2016 16:51:53 +0000 X-Env-Sender: prvs=8211775ec=roger.pau@citrix.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1453395110!17350081!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 51267 invoked from network); 21 Jan 2016 16:51:52 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-12.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 21 Jan 2016 16:51:52 -0000 X-IronPort-AV: E=Sophos;i="5.22,326,1449532800"; d="scan'208";a="326845262" From: Roger Pau Monne To: Date: Thu, 21 Jan 2016 17:51:30 +0100 Message-ID: <1453395092-88090-5-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 1.9.5 (Apple Git-50.3) In-Reply-To: <1453395092-88090-1-git-send-email-roger.pau@citrix.com> References: <1453395092-88090-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Andrew Cooper , Jan Beulich , Roger Pau Monne Subject: [Xen-devel] [PATCH v4 4/6] x86/PV: allow PV guests to have an emulated PIT X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Cc: Jan Beulich Cc: Andrew Cooper --- Changes since v3: - Allow PV guests to specify whether a PIT is needed or not. - Fix pv_pit_handler so it can deal with the fact that the PIT might not be present. Changes since v2: - Force the emulated PIT to always be enabled for the hardware domain. - Change indentation of the valid set of emulation bitmaps check. --- 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 e70c125..b005fe0 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) ) + (is_hvm_domain(d) ? (config->emulation_flags != XEN_X86_EMU_ALL) : + (config->emulation_flags != 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 b517cd6..577b43c 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 */;