Received: by 10.223.185.116 with SMTP id b49csp415459wrg; Wed, 21 Feb 2018 00:08:11 -0800 (PST) X-Google-Smtp-Source: AH8x226q/1skuQ1t6g1pTxluAAg6aVBAciG4Zy+wFOi6FwcrjBrRnlnZB+Z/NnOzHorDrmDOnJM0 X-Received: by 10.99.167.75 with SMTP id w11mr2082247pgo.246.1519200491592; Wed, 21 Feb 2018 00:08:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519200491; cv=none; d=google.com; s=arc-20160816; b=lZWkIk9ZSJe4txz0WCvS5HT6nHPJP7v6SULDM4mJz2Fm5cduTNiZSsiGpadyg6EaYw qSNuNKn+2NXVjw+MBSvN0fjGIOzifZwHSsiK1UpJELAJQPsObuoXQOCQ1XIcyioO6quy nb/vQJAMFO0vId2jk87PVloSHZhbOkoEbX4K9i2F7QRf0gxtXb6MaOoMI/PgR/MZAPSI S/CKiht30VPXakCO5mSGLxvSWDePu1eDL3qKRk6a4g4zNlvJAlOdJnZ4N7Q5jgVjkern TL9B5LQ2oRjF8fwk0qiCTMKJlX+CuP/3BeyQtHxn9ACQ+czXy2pI6/yM11rACMf6BQdT vw6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=X33N+J6fegymLIHZ6y8WZqQrMSQvkLmrk2sJovv5g+M=; b=YUYSj7cOAdby5UcC9Qv664DloBLyqAKx4RTGJNCLcwV7m49eBYYpgE30thY+yklpE5 mIQ/WggFmBLr/7jIy8EF3LPjEHxT0nmpvO38hH3HG/snyrroKlTGrjhIA2aIJTsfn/P8 9psAwrgsamawbqmeo9MF2gQ/XABgfuLMQujiniDPAx3ZfsF9BHCOsezBxShecje51x/O WaBfuEVHeE+mcEaBNEiwgdnouObelYw4IRT0lbKF89HHw54VJNcFlRTCsaHs5KMG7uVV MQmPxJJCeEmRx37a6Jd5XDvHHgz8vKiuOcUmVy4wBg2LeCN+P4q1LU491zTS+d7HkL+h gZ+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P719sQ3d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si2037888pgr.693.2018.02.21.00.07.57; Wed, 21 Feb 2018 00:08:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P719sQ3d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751816AbeBUID4 (ORCPT + 99 others); Wed, 21 Feb 2018 03:03:56 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:45750 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751717AbeBUIDx (ORCPT ); Wed, 21 Feb 2018 03:03:53 -0500 Received: by mail-lf0-f68.google.com with SMTP id x196so1057298lfd.12 for ; Wed, 21 Feb 2018 00:03:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X33N+J6fegymLIHZ6y8WZqQrMSQvkLmrk2sJovv5g+M=; b=P719sQ3dyp0I5In3yDVLc+qLs8jGCM/92iiI1e2Py1xzJ7akvwX3HQsgizOY6qLFsU +x7RliRHT9kc4pQYGeCfFRnM58YwPFMjq8UIk6EVyWsoQVLgbaSsztutSAKSWGZDdj0n TT9X7JJH+N9AWO2Dg8BKc28pIj19Kvo4qTBZW+88hoGZYoHa9Z/Hb7j7+eRxt8GpqUYa igWa+0wj6oxcwKFHYb/FywmWhwFJOhNfnTbmWmf/iMjR+5U4xrNNq4onjrPV7wwO00+M 1iSSqIFt84rmb5Jd42Porz9gzo2sghpcGD+y8qse6sK1eP+cS0sWBY6vTDMW1M/1ov99 ObDA== 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:mime-version :content-transfer-encoding; bh=X33N+J6fegymLIHZ6y8WZqQrMSQvkLmrk2sJovv5g+M=; b=GeRZlEOZw30e4XtjK2GiWGKwQqbd9pAaK6rw0Xe4qNnW8IAC3CZrfPGOqUi61XkyG9 i05I9hCo8oPsmWkBmlw6/MtoQ472mxRPieeX7mtKZUlomHTCgieG1cVALwqTmrJ2Cbt8 4TH2t5s4IpmzOPiLbwFtj0WHA7gC0XiNtsdYgl+m/HohbPSuwuP3x80jUfR88yXWEVnm bGRPMvLsYhQf82tg+64K7Kn2OxMZUIzepq6rKuM2wJKsmbNxcq55ndmozIqv0gwUmYOe 6qx5rcrAm9kiKxK1WAhq/c/4sWl/cecTQdVCU+BMhCpP806Yro7ArnOhRxHWgXZLybPZ OcrA== X-Gm-Message-State: APf1xPBUmj+nk+8Bqbm+f1UuQh7gRJoE+laKTsMA8iNKDb1eDXBT3VB3 rQIRWslHdi2hldt7PbdXpiA= X-Received: by 10.46.29.23 with SMTP id d23mr1599888ljd.7.1519200231209; Wed, 21 Feb 2018 00:03:51 -0800 (PST) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-53.209.223.85.sovam.net.ua. [85.223.209.53]) by smtp.gmail.com with ESMTPSA id g38sm687394lji.24.2018.02.21.00.03.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 00:03:50 -0800 (PST) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, airlied@linux.ie, daniel.vetter@intel.com, seanpaul@chromium.org, gustavo@padovan.org, jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Cc: andr2000@gmail.com, Oleksandr Andrushchenko Subject: [PATCH 0/9] drm/xen-front: Add support for Xen PV display frontend Date: Wed, 21 Feb 2018 10:03:33 +0200 Message-Id: <1519200222-20623-1-git-send-email-andr2000@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oleksandr Andrushchenko Hello! This patch series adds support for Xen [1] para-virtualized frontend display driver. It implements the protocol from include/xen/interface/io/displif.h [2]. Accompanying backend [3] is implemented as a user-space application and its helper library [4], capable of running as a Weston client or DRM master. Configuration of both backend and frontend is done via Xen guest domain configuration options [5]. ******************************************************************************* * Driver limitations ******************************************************************************* 1. Configuration options 1.1 (contiguous display buffers) and 2 (backend allocated buffers) below are not supported at the same time. 2. Only primary plane without additional properties is supported. 3. Only one video mode supported which resolution is configured via XenStore. 4. All CRTCs operate at fixed frequency of 60Hz. ******************************************************************************* * Driver modes of operation in terms of display buffers used ******************************************************************************* Depending on the requirements for the para-virtualized environment, namely requirements dictated by the accompanying DRM/(v)GPU drivers running in both host and guest environments, number of operating modes of para-virtualized display driver are supported: - display buffers can be allocated by either frontend driver or backend - display buffers can be allocated to be contiguous in memory or not Note! Frontend driver itself has no dependency on contiguous memory for its operation. ******************************************************************************* * 1. Buffers allocated by the frontend driver. ******************************************************************************* The below modes of operation are configured at compile-time via frontend driver's kernel configuration. 1.1. Front driver configured to use GEM CMA helpers This use-case is useful when used with accompanying DRM/vGPU driver in guest domain which was designed to only work with contiguous buffers, e.g. DRM driver based on GEM CMA helpers: such drivers can only import contiguous PRIME buffers, thus requiring frontend driver to provide such. In order to implement this mode of operation para-virtualized frontend driver can be configured to use GEM CMA helpers. 1.2. Front driver doesn't use GEM CMA If accompanying drivers can cope with non-contiguous memory then, to lower pressure on CMA subsystem of the kernel, driver can allocate buffers from system memory. Note! If used with accompanying DRM/(v)GPU drivers this mode of operation may require IOMMU support on the platform, so accompanying DRM/vGPU hardware can still reach display buffer memory while importing PRIME buffers from the frontend driver. ******************************************************************************* * 2. Buffers allocated by the backend ******************************************************************************* This mode of operation is run-time configured via guest domain configuration through XenStore entries. For systems which do not provide IOMMU support, but having specific requirements for display buffers it is possible to allocate such buffers at backend side and share those with the frontend. For example, if host domain is 1:1 mapped and has DRM/GPU hardware expecting physically contiguous memory, this allows implementing zero-copying use-cases. I would like to thank at least, but not at last the following people/communities who helped this driver to happen ;) 1. My team at EPAM for continuous support 2. Xen community for answering tons of questions on different modes of operation of the driver with respect to virtualized environment. 3. Rob Clark for "GEM allocation for para-virtualized DRM driver" [6] 4. Maarten Lankhorst for "Atomic driver and old remove FB behavior" [7] 5. Ville Syrjälä for "Questions on page flips and atomic modeset" [8] Thank you, Oleksandr Andrushchenko P.S. There are two dependencies for this driver limiting some of the use-cases which are on review now: 1. "drm/simple_kms_helper: Add {enable|disable}_vblank callback support" [9] 2. "drm/simple_kms_helper: Fix NULL pointer dereference with no active CRTC" [10] [1] https://wiki.xen.org/wiki/Paravirtualization_(PV)#PV_IO_Drivers [2] https://elixir.bootlin.com/linux/v4.16-rc2/source/include/xen/interface/io/displif.h [3] https://github.com/xen-troops/displ_be [4] https://github.com/xen-troops/libxenbe [5] https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/man/xl.cfg.pod.5.in;h=a699367779e2ae1212ff8f638eff0206ec1a1cc9;hb=refs/heads/master#l1257 [6] https://lists.freedesktop.org/archives/dri-devel/2017-March/136038.html [7] https://www.spinics.net/lists/dri-devel/msg164102.html [8] https://www.spinics.net/lists/dri-devel/msg164463.html [9] https://patchwork.freedesktop.org/series/38073/ [10] https://patchwork.freedesktop.org/series/38139/ Oleksandr Andrushchenko (9): drm/xen-front: Introduce Xen para-virtualized frontend driver drm/xen-front: Implement Xen bus state handling drm/xen-front: Read driver configuration from Xen store drm/xen-front: Implement Xen event channel handling drm/xen-front: Implement handling of shared display buffers drm/xen-front: Introduce DRM/KMS virtual display driver drm/xen-front: Implement KMS/connector handling drm/xen-front: Implement GEM operations drm/xen-front: Implement communication with backend drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/xen/Kconfig | 30 ++ drivers/gpu/drm/xen/Makefile | 17 + drivers/gpu/drm/xen/xen_drm_front.c | 712 ++++++++++++++++++++++++++++ drivers/gpu/drm/xen/xen_drm_front.h | 154 ++++++ drivers/gpu/drm/xen/xen_drm_front_cfg.c | 84 ++++ drivers/gpu/drm/xen/xen_drm_front_cfg.h | 45 ++ drivers/gpu/drm/xen/xen_drm_front_conn.c | 125 +++++ drivers/gpu/drm/xen/xen_drm_front_conn.h | 35 ++ drivers/gpu/drm/xen/xen_drm_front_drv.c | 294 ++++++++++++ drivers/gpu/drm/xen/xen_drm_front_drv.h | 73 +++ drivers/gpu/drm/xen/xen_drm_front_evtchnl.c | 399 ++++++++++++++++ drivers/gpu/drm/xen/xen_drm_front_evtchnl.h | 89 ++++ drivers/gpu/drm/xen/xen_drm_front_gem.c | 360 ++++++++++++++ drivers/gpu/drm/xen/xen_drm_front_gem.h | 46 ++ drivers/gpu/drm/xen/xen_drm_front_gem_cma.c | 93 ++++ drivers/gpu/drm/xen/xen_drm_front_kms.c | 299 ++++++++++++ drivers/gpu/drm/xen/xen_drm_front_kms.h | 30 ++ drivers/gpu/drm/xen/xen_drm_front_shbuf.c | 430 +++++++++++++++++ drivers/gpu/drm/xen/xen_drm_front_shbuf.h | 80 ++++ 21 files changed, 3398 insertions(+) create mode 100644 drivers/gpu/drm/xen/Kconfig create mode 100644 drivers/gpu/drm/xen/Makefile create mode 100644 drivers/gpu/drm/xen/xen_drm_front.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front.h create mode 100644 drivers/gpu/drm/xen/xen_drm_front_cfg.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_cfg.h create mode 100644 drivers/gpu/drm/xen/xen_drm_front_conn.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_conn.h create mode 100644 drivers/gpu/drm/xen/xen_drm_front_drv.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_drv.h create mode 100644 drivers/gpu/drm/xen/xen_drm_front_evtchnl.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_evtchnl.h create mode 100644 drivers/gpu/drm/xen/xen_drm_front_gem.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_gem.h create mode 100644 drivers/gpu/drm/xen/xen_drm_front_gem_cma.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_kms.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_kms.h create mode 100644 drivers/gpu/drm/xen/xen_drm_front_shbuf.c create mode 100644 drivers/gpu/drm/xen/xen_drm_front_shbuf.h -- 2.7.4