From patchwork Fri Jan 15 14:59:43 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: 8042291 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 04E2BBEEE5 for ; Fri, 15 Jan 2016 15:02:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 680B420453 for ; Fri, 15 Jan 2016 15:02:12 +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 9D9F420434 for ; Fri, 15 Jan 2016 15:02:10 +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 1aK5r6-0000rW-KM; Fri, 15 Jan 2016 15:00:00 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aK5r4-0000pW-R1 for xen-devel@lists.xenproject.org; Fri, 15 Jan 2016 14:59:58 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 20/57-03066-E6909965; Fri, 15 Jan 2016 14:59:58 +0000 X-Env-Sender: prvs=8150a737c=roger.pau@citrix.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1452869990!16144022!4 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 18464 invoked from network); 15 Jan 2016 14:59:57 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 15 Jan 2016 14:59:57 -0000 X-IronPort-AV: E=Sophos;i="5.22,299,1449532800"; d="scan'208";a="325418790" From: Roger Pau Monne To: Date: Fri, 15 Jan 2016 15:59:43 +0100 Message-ID: <1452869983-75956-5-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 1.9.5 (Apple Git-50.3) In-Reply-To: <1452869983-75956-1-git-send-email-roger.pau@citrix.com> References: <1452869983-75956-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Wei Liu , Ian Campbell , Andrew Cooper , Ian Jackson , Jan Beulich , Roger Pau Monne Subject: [Xen-devel] [PATCH v2 4/4] x86/PV: enable the 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 The HVMlite series removed the initialization of the emulated PIT for PV guests, this patch re-enables it. Signed-off-by: Roger Pau Monné Acked-by: Jan Beulich --- Cc: Ian Jackson Cc: Ian Campbell Cc: Wei Liu Cc: Jan Beulich Cc: Andrew Cooper --- NB: Since it's not clear why an emulated PIT is needed, it won't be enabled by default for HVMlite guests until we can figure out if/why it's needed. --- Changes since v1: - New in this version. --- tools/libxl/libxl_x86.c | 8 +++++++- xen/arch/x86/domain.c | 5 +++-- xen/arch/x86/setup.c | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 46cfafb..7f47cc5 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -13,8 +13,14 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, LIBXL_DEVICE_MODEL_VERSION_NONE) { /* HVM domains with a device model. */ xc_config->emulation_flags = XEN_X86_EMU_ALL; + } else if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV) { + /* PV domains. */ + xc_config->emulation_flags = XEN_X86_EMU_PIT; } else { - /* PV or HVM domains without a device model. */ + assert(d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM); + assert(d_config->b_info.device_model_version == + LIBXL_DEVICE_MODEL_VERSION_NONE); + /* HVMlite domains. */ xc_config->emulation_flags = 0; } diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 159d960..8ee5d76 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -542,8 +542,9 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, d->domain_id, config->emulation_flags); return -EINVAL; } - if ( config->emulation_flags != 0 && - (!is_hvm_domain(d) || config->emulation_flags != XEN_X86_EMU_ALL) ) + if ( (is_hvm_domain(d) && config->emulation_flags != XEN_X86_EMU_ALL && + config->emulation_flags != 0) || + (!is_hvm_domain(d) && 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/setup.c b/xen/arch/x86/setup.c index 76c7b0f..08bd3fb 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -582,7 +582,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) .parity = 'n', .stop_bits = 1 }; - struct xen_arch_domainconfig config = { .emulation_flags = 0 }; + struct xen_arch_domainconfig config = { + .emulation_flags = XEN_X86_EMU_PIT, + }; /* Critical region without IDT or TSS. Any fault is deadly! */