From patchwork Tue Aug 22 09:49:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Roger Pau Monne X-Patchwork-Id: 9914645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1FE6C600C5 for ; Tue, 22 Aug 2017 09:51:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30F3D2885E for ; Tue, 22 Aug 2017 09:51:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25D5928863; Tue, 22 Aug 2017 09:51:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BD1C32885E for ; Tue, 22 Aug 2017 09:51:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dk5p8-0006Mx-93; Tue, 22 Aug 2017 09:50:14 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dk5p7-0006KV-88 for xen-devel@lists.xenproject.org; Tue, 22 Aug 2017 09:50:13 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 4A/75-04533-45EFB995; Tue, 22 Aug 2017 09:50:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRWlGSWpSXmKPExsXitHRDpG7Iv9m RBldm8Vh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBltG0+wFRyTqTjfMY2pgfGzaBcjB4eEgL/E s+8uXYycHGwCOhIX5+5kAwmLCKhI3N5r0MXIxcEssIZR4vycP+wgNcICdhIdL36A2SwCqhKz5 l8Gs3kFrCT6Pn8DsyUE9CTeTnzBCGJzAsUP730CZgsJWEps/PiTFaJeUOLkzCcsIDazgKZE6/ bf7BC2vETz1tnMEPWKEv3zHrBNYOSbhaRlFpKWWUhaFjAyr2LUKE4tKkst0jU20EsqykzPKMl NzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECAy1egYGxh2MnSf8DjFKcjApifJO/j47UogvKT+l MiOxOCO+qDQntfgQowwHh5IEL9tfoJxgUWp6akVaZg4w6GHSEhw8SiK8j/8ApXmLCxJzizPTI VKnGBWlxHl/gCQEQBIZpXlwbbBIu8QoKyXMy8jAwCDEU5BalJtZgir/ilGcg1FJmPcFyBSezL wSuOmvgBYzAS02bJ0GsrgkESEl1cC4TJBNnFX5snjmb7eXD8KrJKaI+nRnHvXcrnLZ1PXp1y+ bF/okzrkyef2b+XJn/8Uz2ocdyGNdtV3H+5RSbpPP7llHfwd5O2hcjJJo81r50ssxW7jQtlmh suJZ2Va+yhupYjN0rNJ6UqdplE/hv6Ya3DT78V3rRX+Lcx2kZEv6X9vMk/Z76aHEUpyRaKjFX FScCAApdmvVrwIAAA== X-Env-Sender: prvs=400f1e73e=roger.pau@citrix.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1503395402!111036246!7 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: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64504 invoked from network); 22 Aug 2017 09:50:11 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Aug 2017 09:50:11 -0000 X-IronPort-AV: E=Sophos;i="5.41,411,1498521600"; d="scan'208";a="436366319" From: Roger Pau Monne To: Date: Tue, 22 Aug 2017 10:49:18 +0100 Message-ID: <20170822094920.70151-18-roger.pau@citrix.com> X-Mailer: git-send-email 2.11.0 (Apple Git-81) In-Reply-To: <20170822094920.70151-1-roger.pau@citrix.com> References: <20170822094920.70151-1-roger.pau@citrix.com> MIME-Version: 1.0 Cc: Wei Liu , boris.ostrovsky@oracle.com, Roger Pau Monne , Ian Jackson Subject: [Xen-devel] [PATCH 17/19] libxl: add PVH support to x86 functions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This also includes the x86 ACPI related functions. Remove support for device model "none" Signed-off-by: Roger Pau Monné --- Cc: Ian Jackson Cc: Wei Liu --- tools/libxl/libxl_x86.c | 33 +++++++++++++++++---------------- tools/libxl/libxl_x86_acpi.c | 3 +-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 442854c5c2..d321b8349c 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -7,20 +7,22 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, libxl_domain_config *d_config, xc_domain_configuration_t *xc_config) { - - if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM) { - if (d_config->b_info.device_model_version != - LIBXL_DEVICE_MODEL_VERSION_NONE) { - xc_config->emulation_flags = XEN_X86_EMU_ALL; - } else if (libxl_defbool_val(d_config->b_info.apic)) { - /* - * HVM guests without device model may want - * to have LAPIC emulation. - */ + switch(d_config->c_info.type) { + case LIBXL_DOMAIN_TYPE_HVM: + xc_config->emulation_flags = XEN_X86_EMU_ALL; + break; + case LIBXL_DOMAIN_TYPE_PVH: + if (libxl_defbool_val(d_config->b_info.apic)) + /* PVH guests may want to have LAPIC emulation. */ xc_config->emulation_flags = XEN_X86_EMU_LAPIC; - } - } else { + else + xc_config->emulation_flags = 0; + break; + case LIBXL_DOMAIN_TYPE_PV: xc_config->emulation_flags = 0; + break; + default: + abort(); } return 0; @@ -266,7 +268,7 @@ static int libxl__e820_alloc(libxl__gc *gc, uint32_t domid, struct e820entry map[E820MAX]; libxl_domain_build_info *b_info; - if (d_config == NULL || d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM) + if (d_config == NULL || d_config->c_info.type != LIBXL_DOMAIN_TYPE_PV) return ERROR_INVAL; b_info = &d_config->b_info; @@ -338,7 +340,7 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, if (rtc_timeoffset) xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset); - if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) { + if (d_config->b_info.type != LIBXL_DOMAIN_TYPE_PV) { unsigned long shadow = DIV_ROUNDUP(d_config->b_info.shadow_memkb, 1024); xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, @@ -381,8 +383,7 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, { int rc = 0; - if ((info->type == LIBXL_DOMAIN_TYPE_HVM) && - (info->device_model_version == LIBXL_DEVICE_MODEL_VERSION_NONE)) { + if (info->type == LIBXL_DOMAIN_TYPE_PVH) { rc = libxl__dom_load_acpi(gc, info, dom); if (rc != 0) LOGE(ERROR, "libxl_dom_load_acpi failed"); diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c index cd8f4f4779..523386053f 100644 --- a/tools/libxl/libxl_x86_acpi.c +++ b/tools/libxl/libxl_x86_acpi.c @@ -171,8 +171,7 @@ int libxl__dom_load_acpi(libxl__gc *gc, void *acpi_pages; unsigned long page_mask; - if ((b_info->type != LIBXL_DOMAIN_TYPE_HVM) || - (b_info->device_model_version != LIBXL_DEVICE_MODEL_VERSION_NONE)) + if (b_info->type != LIBXL_DOMAIN_TYPE_PVH) goto out; libxl_ctxt.page_size = XC_DOM_PAGE_SIZE(dom);