From patchwork Tue Oct 8 14:10:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Grytsov X-Patchwork-Id: 11179665 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2E7F13BD for ; Tue, 8 Oct 2019 14:11:53 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E6162064A for ; Tue, 8 Oct 2019 14:11:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vIJ6vks5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E6162064A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqCF-0006us-Ac; Tue, 08 Oct 2019 14:10:39 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqCE-0006u7-5A for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 14:10:38 +0000 X-Inumbo-ID: 63c3a5e2-e9d5-11e9-8c93-bc764e2007e4 Received: from mail-lf1-x141.google.com (unknown [2a00:1450:4864:20::141]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 63c3a5e2-e9d5-11e9-8c93-bc764e2007e4; Tue, 08 Oct 2019 14:10:32 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id r22so12096319lfm.1 for ; Tue, 08 Oct 2019 07:10:32 -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=/oCwxQMbBLr1BZU6moM5qReytO7wpH++DT8doawdOYE=; b=vIJ6vks5nvIY8D3G1FnQrmi/346IeexJrxXMxl0wOHZD8hdBthgcMA0aLOjRGFdlCe w1GSIWeAyw1VZO1TILbkJG3erK40phJJlc5SkZ/7Ciwb+Y+u+JYPQhjqSOOzNvL/2c0m mFHqQNQ0NLvVE/FqeJE+7MRi0pl19OqenRMy1dwEz1f2nu6MXomnvxPpyFQ+uTEuoFJ+ NHCGmIhpnsW+CAnV8ETysDPfrK9gf9z8SrTtgSsqy6hpw4/uVDW03SykjoZjUZZVZD/O 9y69vmM6kQ0gnnAwbthOG1WhJ5jreOn8TUkOJcEFwQtS4E4wtEYmjMLPxtuten/+YoJi fV/g== 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=/oCwxQMbBLr1BZU6moM5qReytO7wpH++DT8doawdOYE=; b=A2z/rgJByupuxm/wHS0z3hKRFrKu72aj61s7IODcK2b3erNKowJPVXH0PXsBCoPEbV TQLJNy0HIEqUEJEnuYtNH968xv7PGHN6R1gwO8ozkPEHChSMLGSSXycAPo0mzZ35jq51 kYOktyeqrb55kb8CwY/sAOySeh1LqEbPTW0LFeCQG9uqWYPVN5t/+BUpEviR4U8HK9om wV2P0C0Tg3tlSQxYL3vmONcY86A3CnicEPJcPVJy+V72y7DlqJHd8UeVngHJF7rYnpSk 2VFhCN9j8uBrDwoFyg3lXlCW0k63hEqYpykLE8IdPn+4EzmIys/+cjr4YjlP5yRF7TcI 6riw== X-Gm-Message-State: APjAAAXnyzXIUyyGpLwvqmyli1hkGxIoAaXlDM63zfF7Crbk+siYjAxu oAA2UOwK57ZQhmqbvuu9RBHZN1SKxDo= X-Google-Smtp-Source: APXvYqxMMR03tW+nTLLSIsDb5zNnMUjdDOZVwqnLbSFnTFi4OI7jCGn+e74rTvuVPqWEsevvDzKkzQ== X-Received: by 2002:ac2:4a8f:: with SMTP id l15mr20799804lfp.21.1570543831393; Tue, 08 Oct 2019 07:10:31 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id z20sm4937764ljk.63.2019.10.08.07.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 07:10:30 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Tue, 8 Oct 2019 17:10:23 +0300 Message-Id: <20191008141024.10885-2-al1img@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008141024.10885-1-al1img@gmail.com> References: <20191008141024.10885-1-al1img@gmail.com> Subject: [Xen-devel] [PATCH v1 1/2] libxl: introduce new backend type VINPUT X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr Grytsov , ian.jackson@eu.citrix.com, wl@xen.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Oleksandr Grytsov There are two kind of VKBD devices: with QEMU backend and user space backend. In current implementation they can't be distinguished as both use VKBD backend type. As result, user space KBD backend is started and stopped as QEMU backend. This commit adds new device kind VINPUT to be used as backend type for user space KBD backend. Signed-off-by: Oleksandr Grytsov Acked-by: Ian Jackson --- tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/libxl_vkb.c | 29 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl index cb85c3b37f..3593e21dbb 100644 --- a/tools/libxl/libxl_types_internal.idl +++ b/tools/libxl/libxl_types_internal.idl @@ -31,6 +31,7 @@ libxl__device_kind = Enumeration("device_kind", [ (13, "VUART"), (14, "PVCALLS"), (15, "VSND"), + (16, "VINPUT"), ]) libxl__console_backend = Enumeration("console_backend", [ diff --git a/tools/libxl/libxl_vkb.c b/tools/libxl/libxl_vkb.c index 26376a7eef..4c44a813c1 100644 --- a/tools/libxl/libxl_vkb.c +++ b/tools/libxl/libxl_vkb.c @@ -38,9 +38,6 @@ static int libxl__set_xenstore_vkb(libxl__gc *gc, uint32_t domid, flexarray_t *back, flexarray_t *front, flexarray_t *ro_front) { - flexarray_append_pair(back, "backend-type", - (char *)libxl_vkb_backend_to_string(vkb->backend_type)); - if (vkb->unique_id) { flexarray_append_pair(back, XENKBD_FIELD_UNIQUE_ID, vkb->unique_id); } @@ -93,7 +90,8 @@ static int libxl__vkb_from_xenstore(libxl__gc *gc, const char *libxl_path, libxl_devid devid, libxl_device_vkb *vkb) { - const char *be_path, *be_type, *fe_path, *tmp; + const char *be_path, *fe_path, *tmp; + libxl__device dev; int rc; vkb->devid = devid; @@ -111,13 +109,11 @@ static int libxl__vkb_from_xenstore(libxl__gc *gc, const char *libxl_path, rc = libxl__backendpath_parse_domid(gc, be_path, &vkb->backend_domid); if (rc) goto out; - rc = libxl__xs_read_mandatory(gc, XBT_NULL, - GCSPRINTF("%s/backend-type", be_path), - &be_type); + rc = libxl__parse_backend_path(gc, be_path, &dev); if (rc) goto out; - rc = libxl_vkb_backend_from_string(be_type, &vkb->backend_type); - if (rc) goto out; + vkb->backend_type = dev.backend_kind == LIBXL__DEVICE_KIND_VINPUT ? + LIBXL_VKB_BACKEND_LINUX : LIBXL_VKB_BACKEND_QEMU; vkb->unique_id = xs_read(CTX->xsh, XBT_NULL, GCSPRINTF("%s/"XENKBD_FIELD_UNIQUE_ID, be_path), NULL); @@ -218,6 +214,20 @@ out: return rc; } +static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid, + libxl_device_vkb *type, libxl__device *device) +{ + device->backend_devid = type->devid; + device->backend_domid = type->backend_domid; + device->backend_kind = type->backend_type == LIBXL_VKB_BACKEND_LINUX ? + LIBXL__DEVICE_KIND_VINPUT : LIBXL__DEVICE_KIND_VKBD; + device->devid = type->devid; + device->domid = domid; + device->kind = LIBXL__DEVICE_KIND_VKBD; + + return 0; +} + int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb, const libxl_asyncop_how *ao_how) { @@ -318,7 +328,6 @@ out: return rc; } -static LIBXL_DEFINE_DEVICE_FROM_TYPE(vkb) static LIBXL_DEFINE_UPDATE_DEVID(vkb) #define libxl__add_vkbs NULL From patchwork Tue Oct 8 14:10:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Grytsov X-Patchwork-Id: 11179667 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5863515AB for ; Tue, 8 Oct 2019 14:12:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 347772064A for ; Tue, 8 Oct 2019 14:12:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CIXl+xvN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 347772064A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqCK-0006wL-PH; Tue, 08 Oct 2019 14:10:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqCJ-0006vz-4o for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 14:10:43 +0000 X-Inumbo-ID: 644177d8-e9d5-11e9-96dc-bc764e2007e4 Received: from mail-lj1-x242.google.com (unknown [2a00:1450:4864:20::242]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 644177d8-e9d5-11e9-96dc-bc764e2007e4; Tue, 08 Oct 2019 14:10:33 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id m7so17723651lji.2 for ; Tue, 08 Oct 2019 07:10:33 -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=8cB5iex11iqVqDmJdNxCcGJEmCz5fLgF2Tp7Bx104WI=; b=CIXl+xvNvz41+yj3i1UYt7xrv3F7Yy2UtVAD29K2Ob6DxVuKOwl7TTQ6hXhWISLbJK 7AwskGMLjcxyUrvNwTB8ytAe1FUCXqlMXOdjRExpmSil9Q7buBgahfUb3olJkhmRThYW PPgtyFJaFyFuN5CUJzebz6F95Ch98el+u3S6t4gz1BLFdQwNabb2Qo8DFaN1D6zIkfW8 AcjNF+RCz8uSlO8nezzFDYXjwrpuh8/xJObpT8B9ga6QhU4lsAdAa72r5PxZNMTzEHUu 6nTPTCXQz3xHlzU/+CKd2wmECHssvKlaSpnRpfUbH4d7tE9wSbGzgMQ04JBMp8sJGPDi NsGA== 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=8cB5iex11iqVqDmJdNxCcGJEmCz5fLgF2Tp7Bx104WI=; b=e9u1fTH+HVjujmKR7kQXxkNALfNiCpzpkqs7q2SWrL+DOkYLwNTkS7d5n5RlknVoxz J90d9gFLwi0pBlNqztq/Q21taPY78+bEy/kmJpt3zVhBYTwkptKGjBIdwAEBRlTOW6qo lt98r1A3YLLM7pJGMRoNf3WMsKif5ixSPF2XEs5wXPqyHcMfSuT9Ixa6DXMlA1ZbEZ6M Q8pTkFUQDq5wUzFyyydWhD+tjxeWfdte617dqvIat4ls47xtR02GdIcsgtk4HqwNvfTX Cs5z+JLtrcXoBJPvFfOhGSrOFSBlsZs2qpSXo8ppsAASXDGNd0QJ4iJE0qKsbT5C4TQc 1DKQ== X-Gm-Message-State: APjAAAWdOR2p8XsPSaZ3Xhzt64dFvBDHr9P2JbaX9bUDJcaJpXNZwE6j iOaoHDXetJe9gpvXLQ5r9iRjgl61NHo= X-Google-Smtp-Source: APXvYqx3olnVYwO9LIS+6/+MUJykG7EFYX6ORNtmVabgCPKFVPIxQ+RICrmYikRh3SHQdHwb491k8g== X-Received: by 2002:a2e:504f:: with SMTP id v15mr22919371ljd.67.1570543832359; Tue, 08 Oct 2019 07:10:32 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id z20sm4937764ljk.63.2019.10.08.07.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 07:10:31 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Tue, 8 Oct 2019 17:10:24 +0300 Message-Id: <20191008141024.10885-3-al1img@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008141024.10885-1-al1img@gmail.com> References: <20191008141024.10885-1-al1img@gmail.com> Subject: [Xen-devel] [PATCH v1 2/2] libxl: add removing XS backend path for PV devices on domain destroy X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr Grytsov , ian.jackson@eu.citrix.com, wl@xen.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Oleksandr Grytsov Currently backend path is remove for specific devices: VBD, VIF, QDISK. This commit adds removing backend path for: VDISPL, VSND, VINPUT. Signed-off-by: Oleksandr Grytsov --- tools/libxl/libxl_device.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 1402b61a81..8ce70661e5 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -1477,7 +1477,7 @@ typedef struct libxl__ddomain_device { */ typedef struct libxl__ddomain_guest { uint32_t domid; - int num_vifs, num_vbds, num_qdisks; + int num_qdisks; LIBXL_SLIST_HEAD(, struct libxl__ddomain_device) devices; LIBXL_SLIST_ENTRY(struct libxl__ddomain_guest) next; } libxl__ddomain_guest; @@ -1530,8 +1530,7 @@ static void check_and_maybe_remove_guest(libxl__gc *gc, { assert(ddomain); - if (dguest != NULL && - dguest->num_vifs + dguest->num_vbds + dguest->num_qdisks == 0) { + if (dguest != NULL && LIBXL_SLIST_FIRST(&dguest->devices) == NULL) { LIBXL_SLIST_REMOVE(&ddomain->guests, dguest, libxl__ddomain_guest, next); LOGD(DEBUG, dguest->domid, "Removed domain from the list of active guests"); @@ -1573,9 +1572,6 @@ static int add_device(libxl__egc *egc, libxl__ao *ao, switch(dev->backend_kind) { case LIBXL__DEVICE_KIND_VBD: case LIBXL__DEVICE_KIND_VIF: - if (dev->backend_kind == LIBXL__DEVICE_KIND_VBD) dguest->num_vbds++; - if (dev->backend_kind == LIBXL__DEVICE_KIND_VIF) dguest->num_vifs++; - GCNEW(aodev); libxl__prepare_ao_device(ao, aodev); /* @@ -1619,11 +1615,11 @@ static int remove_device(libxl__egc *egc, libxl__ao *ao, int rc = 0; switch(ddev->dev->backend_kind) { + case LIBXL__DEVICE_KIND_VDISPL: + case LIBXL__DEVICE_KIND_VSND: + case LIBXL__DEVICE_KIND_VINPUT: case LIBXL__DEVICE_KIND_VBD: case LIBXL__DEVICE_KIND_VIF: - if (dev->backend_kind == LIBXL__DEVICE_KIND_VBD) dguest->num_vbds--; - if (dev->backend_kind == LIBXL__DEVICE_KIND_VIF) dguest->num_vifs--; - GCNEW(aodev); libxl__prepare_ao_device(ao, aodev); /*