From patchwork Thu Oct 5 09:07:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Grytsov X-Patchwork-Id: 9986621 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 E6612602B8 for ; Thu, 5 Oct 2017 09:09:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD060287CB for ; Thu, 5 Oct 2017 09:09:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2243287E5; Thu, 5 Oct 2017 09:09:38 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 610EE287CB for ; Thu, 5 Oct 2017 09:09:38 +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 1e027p-00023C-Na; Thu, 05 Oct 2017 09:07:25 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e027o-000226-D8 for xen-devel@lists.xenproject.org; Thu, 05 Oct 2017 09:07:24 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id DC/B5-03422-B46F5D95; Thu, 05 Oct 2017 09:07:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNIsWRWlGSWpSXmKPExsVyMfS6o67Xt6u RBluvc1l83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBknbn5iLtisWHH99nOWBsaJUl2MXBxCAjMY JTZP+88C4rAIvGSR+HJrGjOIIyHQzyoxc2svUxcjJ5CTJXH7+lo2CDtNYsuZJewQdrnEhmkTw WqEBOQlDrZcZocYO5VJYtH+K2AJNgEtifu3V4A1iwgoSdxbNRksziyQIrF3XRsjiC0sYCxxp2 8nWJxFQFXiy56JYPW8Ag4S82/sY4VYJidx81wnM4jNKeAocfTrYTaIxQ4Scw58YpvAKLiAkWE Vo0ZxalFZapGuobleUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrFecn7uJkZg0DEAwQ7G2xsD DjFKcjApifIef3c1UogvKT+lMiOxOCO+qDQntfgQowYHh8DPp39bGKVY8vLzUpUkeLk+ANUJF qWmp1akZeYA4wKmVIKDR0mE9/dHoDRvcUFibnFmOkTqFKM9x4U7l/4wcRzbdBlIHthzC0h23L z7h0kIbKqUOC8vyFQBkLaM0jy4obA4vsQoKyXMywh0shBPQWpRbmYJqvwrRnEORiVh3hsgU3g y80rgdr8COosJ6Kw5TVdAzipJREhJNTCyztu5S9v0WP10XZlNZ+/2fNb70Z9ccr3vl7WAU3Bx pMIXq1X/QzVjLtScddq6L+b0Yz/e/wJzd/x4lrpmk13KFomgySV/fsjs3DptkpTmZL3XMUlTG i/Gfn1t5W3s8NZyfiN3YdT01qjt013Xi+c1qXptcNt89EH2hPXM1jaKl4/aSD91ZZiixFKckW ioxVxUnAgAt/eWE94CAAA= X-Env-Sender: al1img@gmail.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1507194441!119703884!1 X-Originating-IP: [209.85.215.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52468 invoked from network); 5 Oct 2017 09:07:22 -0000 Received: from mail-lf0-f65.google.com (HELO mail-lf0-f65.google.com) (209.85.215.65) by server-16.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 5 Oct 2017 09:07:22 -0000 Received: by mail-lf0-f65.google.com with SMTP id l196so5537818lfl.3 for ; Thu, 05 Oct 2017 02:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LYzv9ehb91lhTGFu1jtBrNSly+UxVcaTUkwcJqMAqIo=; b=Gj1HRtCKiG+XOw/3mP3D7AgOo5nxhKCEqmjVtxgx1tZJMMhlofaYjzbs7Pn4N19qP3 +EtQ1irVK3NXcIiUOzJKPTFV3pggJlnmkUJMLVUBXPjhOUQ2sp4s17RBSWbd1prZ9Thc Qc3TBTiFrMUFnNA0/Qmg5raEf0IVAZIRZ/QU/hIeVFeR7Dsyqq4/FC9hyzOgswtaQYt1 MS6xuM3HUvrQvvLojX4gldiBopk1J/hjEBSsrLXmggoxGHv0nYdSgYz+jdWtKIUY2wrA oPchU5jYD3UVQALszausUGd1WcKMDpsIce/yGuaqIfrAaqIxMDo4TAd+qqPfVO5xQS2O hEwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LYzv9ehb91lhTGFu1jtBrNSly+UxVcaTUkwcJqMAqIo=; b=qWucAEC/mENio7Zj2/WB5LZHT04yXzhZVp/PMZVlHuQUMoD3OBdjoDwxfdloxWxrhY UamsNp0R7oQ4twxVrRuGmck5lfc393aIQshvkw4mv/uwllGB2SmlqYBlC2KD70iGyzBJ P4X79g8BtFZWNheKs+gDo5GPkoi8fP+rc7xJc130I2234SC/yPHA5vEBWpj5NQuJ7m4v nGGxgvClk5SLmJH52Cq2/ajN8lFnNWo7IND4Tjpjmr5zWTdIzIUlusNjIK633p1YiKkB JHxIRyPN0cZwhT2Ui0AzBZ67/C6+CzqtTFmjXue4i/WwzX5DF7bvK++4gDHBSmsA9Nty rY+A== X-Gm-Message-State: AHPjjUgHvRPLelJwpp4rkN6kgG8ONWteZkFbS0gX/befrLf/RlkVGiAm ro714d3nGUf5mRSu2NcpJvRKvA== X-Google-Smtp-Source: AOwi7QCNbzV9TP56TaUJYLjNfNgN6CMy2gqyoTuWfFCQdoE8rvRix/4czaDw3JHAxygQm20igmcfdw== X-Received: by 10.46.95.93 with SMTP id t90mr12362967ljb.2.1507194441241; Thu, 05 Oct 2017 02:07:21 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-52.209.223.85.sovam.net.ua. [85.223.209.52]) by smtp.gmail.com with ESMTPSA id l11sm2861584lfi.3.2017.10.05.02.07.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Oct 2017 02:07:20 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Thu, 5 Oct 2017 12:07:08 +0300 Message-Id: <1507194431-17588-4-git-send-email-al1img@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507194431-17588-1-git-send-email-al1img@gmail.com> References: <1507194431-17588-1-git-send-email-al1img@gmail.com> Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, Oleksandr Grytsov Subject: [Xen-devel] [PATCH 3/6] libxl: add backend type to vkb 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Grytsov New field backend_type is added to vkb device in order to have QEMU and user space backend simultaneously. Each vkb backend shall read appropriate XS entry and service only own frontends. Signed-off-by: Oleksandr Grytsov --- tools/libxl/libxl_create.c | 4 ++++ tools/libxl/libxl_dm.c | 2 ++ tools/libxl/libxl_types.idl | 7 +++++++ tools/libxl/libxl_vkb.c | 10 +++++++++- tools/xl/xl_parse.c | 4 ++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index f813114..7268f7f 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1349,6 +1349,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, } libxl_device_vkb_init(&vkb); + vkb.backend_type = LIBXL_VKB_BACKEND_QEMU; libxl__device_add(gc, domid, &libxl__vkb_devtype, &vkb); libxl_device_vkb_dispose(&vkb); @@ -1376,6 +1377,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, for (i = 0; i < d_config->num_vfbs; i++) { libxl__device_add(gc, domid, &libxl__vfb_devtype, &d_config->vfbs[i]); + } + + for (i = 0; i < d_config->num_vkbs; i++) { libxl__device_add(gc, domid, &libxl__vkb_devtype, &d_config->vkbs[i]); } diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 98f89a9..d8b0ee7 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1728,6 +1728,8 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc, vkb->backend_domid = 0; vkb->devid = 0; + vkb->backend_type = LIBXL_VKB_BACKEND_QEMU; + return 0; } diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index cd0c06f..65cd81a 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -240,6 +240,12 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (2, "COLO"), ]) +libxl_vkb_backend = Enumeration("vkb_backend", [ + (0, "UNKNOWN"), + (1, "QEMU"), + (2, "LINUX") + ]) + # # Complex libxl types # @@ -603,6 +609,7 @@ libxl_device_vkb = Struct("device_vkb", [ ("backend_domid", libxl_domid), ("backend_domname", string), ("devid", libxl_devid), + ("backend_type", libxl_vkb_backend) ]) libxl_device_disk = Struct("device_disk", [ diff --git a/tools/libxl/libxl_vkb.c b/tools/libxl/libxl_vkb.c index ea6fca8..07b5428 100644 --- a/tools/libxl/libxl_vkb.c +++ b/tools/libxl/libxl_vkb.c @@ -34,6 +34,13 @@ static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid, return 0; } +static int libxl__device_vkb_dm_needed(libxl_device_vkb *vkb, uint32_t domid) +{ + if (vkb->backend_type == LIBXL_VKB_BACKEND_QEMU) + return 1; + return 0; +} + int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb, const libxl_asyncop_how *ao_how) { @@ -60,7 +67,8 @@ static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkbd") LIBXL_DEFINE_DEVICE_REMOVE(vkb) DEFINE_DEVICE_TYPE_STRUCT_X(vkb, vkb, vkbd - .skip_attach = 1 + .skip_attach = 1, + .dm_needed = (device_dm_needed_fn_t)libxl__device_vkb_dm_needed ); /* diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index d4c2efb..7cfd7fd 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1941,6 +1941,8 @@ skip_nic: vkb = ARRAY_EXTEND_INIT(d_config->vkbs, d_config->num_vkbs, libxl_device_vkb_init); + vkb->backend_type = LIBXL_VKBD_BACKEND_QEMU; + p = strtok(buf2, ","); if (!p) goto skip_vfb; @@ -2272,6 +2274,8 @@ skip_usbdev: vkb = ARRAY_EXTEND_INIT(d_config->vkbs, d_config->num_vkbs, libxl_device_vkb_init); + vkb->backend_type = LIBXL_VKBD_BACKEND_QEMU; + parse_top_level_vnc_options(config, &vfb->vnc); parse_top_level_sdl_options(config, &vfb->sdl); xlu_cfg_replace_string (config, "keymap", &vfb->keymap, 0);