From patchwork Fri Jan 15 17:45:51 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: 8043681 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 3A98DBEEE5 for ; Fri, 15 Jan 2016 17:48:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C38E20253 for ; Fri, 15 Jan 2016 17:48:47 +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 652332025A for ; Fri, 15 Jan 2016 17:48:46 +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 1aK8Rj-0001uD-GM; Fri, 15 Jan 2016 17:45:59 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aK8Ri-0001u3-3q for xen-devel@lists.xenproject.org; Fri, 15 Jan 2016 17:45:58 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id 0A/4F-09708-55039965; Fri, 15 Jan 2016 17:45:57 +0000 X-Env-Sender: prvs=8150a737c=roger.pau@citrix.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1452879955!10339625!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7536 invoked from network); 15 Jan 2016 17:45:56 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-8.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 15 Jan 2016 17:45:56 -0000 X-IronPort-AV: E=Sophos;i="5.22,300,1449532800"; d="scan'208";a="331704474" From: Roger Pau Monne To: Date: Fri, 15 Jan 2016 18:45:51 +0100 Message-ID: <1452879951-76391-1-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 1.9.5 (Apple Git-50.3) In-Reply-To: <5699358D02000078000C7800@prv-mh.provo.novell.com> References: <5699358D02000078000C7800@prv-mh.provo.novell.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 v3 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 v2: - Change 'if ( (a && b) || (!a && c) )' into 'if ( a ? b : c )'. 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..ae85e45 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) : + (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! */