From patchwork Thu Jan 21 16:51:28 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: 8083201 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F2C059F6FA for ; Thu, 21 Jan 2016 16:54:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14340204A9 for ; Thu, 21 Jan 2016 16:54:58 +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 229BF204A0 for ; Thu, 21 Jan 2016 16:54:57 +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 1aMITA-0003hm-St; Thu, 21 Jan 2016 16:52:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMIT9-0003hG-1Q for xen-devel@lists.xenproject.org; Thu, 21 Jan 2016 16:52:23 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 29/0D-31069-6CC01A65; Thu, 21 Jan 2016 16:52:22 +0000 X-Env-Sender: prvs=8211775ec=roger.pau@citrix.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1453395138!16777457!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 5739 invoked from network); 21 Jan 2016 16:52:21 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 21 Jan 2016 16:52:21 -0000 X-IronPort-AV: E=Sophos;i="5.22,326,1449532800"; d="scan'208";a="333115570" From: Roger Pau Monne To: Date: Thu, 21 Jan 2016 17:51:28 +0100 Message-ID: <1453395092-88090-3-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: Wei Liu , Ian Jackson , Ian Campbell , Roger Pau Monne Subject: [Xen-devel] [PATCH v4 2/6] libxl: introduce LIBXL_VGA_INTERFACE_TYPE_UNKNOWN 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 And use it as the default value for the VGA kind. This allows libxl to set it to the default value later on when the domain type is known. For HVM guests the default value is LIBXL_VGA_INTERFACE_TYPE_CIRRUS while for HVMlite the default value is LIBXL_VGA_INTERFACE_TYPE_NONE. Signed-off-by: Roger Pau Monné Acked-by: Ian Campbell --- Cc: Ian Jackson Cc: Ian Campbell Cc: Wei Liu --- Changes since v3: - s/UNDEF/UNKNOWN/. - Add a LIBXL_HAVE_VGA_INTERFACE_TYPE_UNKNOWN. --- tools/libxl/libxl.h | 10 ++++++++++ tools/libxl/libxl_create.c | 8 ++++++-- tools/libxl/libxl_dm.c | 6 ++++++ tools/libxl/libxl_types.idl | 3 ++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 156c0d5..ab76d85 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -876,6 +876,16 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); */ #define LIBXL_HAVE_DEVICE_MODEL_VERSION_NONE 1 +/* + * LIBXL_HAVE_VGA_INTERFACE_TYPE_UNKNOWN + * + * In the case that LIBXL_HAVE_VGA_INTERFACE_TYPE_UNKNOWN is set the + * libxl_vga_interface_type enumeration type contains a + * LIBXL_VGA_INTERFACE_TYPE_UNKNOWN identifier. This is used to signal + * that a libxl_vga_interface_type type has not been initialized yet. + */ +#define LIBXL_HAVE_VGA_INTERFACE_TYPE_UNKNOWN 1 + typedef char **libxl_string_list; void libxl_string_list_dispose(libxl_string_list *sl); int libxl_string_list_length(const libxl_string_list *sl); diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index e491d83..b669359 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -206,8 +206,12 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, if (b_info->u.hvm.mmio_hole_memkb == LIBXL_MEMKB_DEFAULT) b_info->u.hvm.mmio_hole_memkb = 0; - if (!b_info->u.hvm.vga.kind) - b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_CIRRUS; + if (b_info->u.hvm.vga.kind == LIBXL_VGA_INTERFACE_TYPE_UNKNOWN) { + if (b_info->device_model_version == LIBXL_DEVICE_MODEL_VERSION_NONE) + b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_NONE; + else + b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_CIRRUS; + } if (!b_info->u.hvm.hdtype) b_info->u.hvm.hdtype = LIBXL_HDTYPE_IDE; diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index a088d71..9aa0cc8 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -531,6 +531,9 @@ static int libxl__build_device_model_args_old(libxl__gc *gc, break; case LIBXL_VGA_INTERFACE_TYPE_QXL: break; + default: + LOG(ERROR, "Invalid emulated video card specified"); + return ERROR_INVAL; } if (b_info->u.hvm.boot) { @@ -970,6 +973,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, GCSPRINTF("qxl-vga,vram_size_mb=%"PRIu64",ram_size_mb=%"PRIu64, (b_info->video_memkb/2/1024), (b_info->video_memkb/2/1024) ) ); break; + default: + LOG(ERROR, "Invalid emulated video card specified"); + return ERROR_INVAL; } if (b_info->u.hvm.boot) { diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 9ad7eba..e9e0da0 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -204,11 +204,12 @@ libxl_shutdown_reason = Enumeration("shutdown_reason", [ ], init_val = "LIBXL_SHUTDOWN_REASON_UNKNOWN") libxl_vga_interface_type = Enumeration("vga_interface_type", [ + (0, "UNKNOWN"), (1, "CIRRUS"), (2, "STD"), (3, "NONE"), (4, "QXL"), - ], init_val = "LIBXL_VGA_INTERFACE_TYPE_CIRRUS") + ], init_val = "LIBXL_VGA_INTERFACE_TYPE_UNKNOWN") libxl_vendor_device = Enumeration("vendor_device", [ (0, "NONE"),