Received: by 10.213.65.68 with SMTP id h4csp128107imn; Tue, 27 Mar 2018 23:49:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9yqEWMXN11zAmYo7snl1GrEm7jhkJzjPe8Elx9he4tZHlpH9sYK7PNmIZoolFymUxWetc X-Received: by 10.98.156.16 with SMTP id f16mr1984870pfe.180.1522219788603; Tue, 27 Mar 2018 23:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522219788; cv=none; d=google.com; s=arc-20160816; b=w3RcKxYFXhcgkPh7bq4pCJhifSb1OajYzQCVlufAo1pVgrroYAEO7rqTiumdAdtzqO rXN7nmdyNZRcgD8rZ4/Xn9qEeRBQc9KrC8vTp+qUTAMC4wMxT7MO4HI3WXK4Q2OgDBfw KCv1Jdkgcby6lgio7tenvjpEN5xMJvIDMQ72clZ5aVFiM7CSEA0nEEufUVr9HTIe0NG0 NZEeV1Dzqt7Lx01tlbOWfKSJYOlk9PLkTnI6BSNmrnoq+fx4JJ+diaGcDe3p+mHV/0J7 xj9L2SexjLs0Ia9OlvLrZTy2B04ZuPlOKG57vfZ2tTMNkOh+sB3nWnvnC1VgEdTAgjXn IvKg== 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=9TAUlqBDd4M2sdgZwKG7tElRcwKqz5j9WyIQPy75c44=; b=oDppOOycQw+qIKNGp+nIAkkkAlcHrQhjvuoRgqjpKPXZ5H3QqYMDhcmKFs1JCw/fVN EtYw7oG+XDqHon3mNDAAyLW2nLoDhXHVbV3NLIRlTDBffDvBYlMGauKYYshEO+S4zNzJ Y3/zIDPWwDXC7Ldy7Rp9EDiFMNJ3qMwBlFV3T6QCCaY4Cr1dXgjA8XybXL6LDGTLt9No MfKU9VNV4HwOkfGokBV7g1FRhtDi/UzyT+Hp+8/QMNBV00gaC+LNLdSymxTVRG9OpXuB QG90ec6Kz+hjgomyjAbHtIhS3+K6x3bnakxQ8lb+rvTRuKowwOR3geP6BbukNjL3Je9x Nx2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MgX2j00X; 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 q12-v6si3192447pll.419.2018.03.27.23.49.34; Tue, 27 Mar 2018 23:49:48 -0700 (PDT) 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=MgX2j00X; 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 S1752906AbeC1Grz (ORCPT + 99 others); Wed, 28 Mar 2018 02:47:55 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:46695 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752199AbeC1Grv (ORCPT ); Wed, 28 Mar 2018 02:47:51 -0400 Received: by mail-lf0-f68.google.com with SMTP id j68-v6so1835907lfg.13 for ; Tue, 27 Mar 2018 23:47:50 -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:mime-version :content-transfer-encoding; bh=9TAUlqBDd4M2sdgZwKG7tElRcwKqz5j9WyIQPy75c44=; b=MgX2j00Xij6lew00D/Qv5TOEZRQbty9XKN89zSdaXggIytuqVzhLEjq8hdCybkQj2o Zc5fevPy9ZHFxRhmAjjR2qE6yujUPzA37kz7J2Fy0mP5UzxOyaQP6m4GhqbnaDADsNAT UIHxkHYYaLPSD/u1IK+5z6ERltEUBay17fblIn6SlnUmHzpXfmOQxy6XrXO6iepCdhzI rFNJDXnvnrr2YQx4QRjSDBt2MMeQt7bFpswHLAV26jsMLUEbJnG5j/KcgMg5sy5PioO4 JTQhttxAbiELtSTuO7Cistf7xPrwZ91XNmrd4HvsAsW3wcLAdYwYTrB81Wy3T2reOvra FBnA== 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=9TAUlqBDd4M2sdgZwKG7tElRcwKqz5j9WyIQPy75c44=; b=gR0ZYNeQLlQCr73XC4w2PYRWgK+zFFBscXpIAH6ss/gxPLy/hZeRZ3vtfLtnLuNQqB KysvdogOcSz5YlResrx7Ghz8q/+A/9zeJ7lw2bQEQtKOHFllkSVEPKgvFYEiXG9H2xIW h2CXC4e66La2Qe8a85SR63hAnBpDtC1iib14BtwyVb/t5rlCfdi0R3Y1YtYaLDkg2rp3 nJxMF+LW9e645RFo8bC2RdSD9M4DADasb0eBG9OW3G9ateCmTQ/tG2To5/UJiwvGIlQ6 VKQm4gVRSxg4gKwNjjgY9kQ8omhguRc+gFzjQTJD5UksAiskT6R8GRV6MKoKyllPFkTR i1eA== X-Gm-Message-State: AElRT7FE4op2bp2S+1cxt36jFb8uGY0n32vHtpNOW2j2+kivcaBQ41nB Y+dIxpPWsFBJfkP8hpXqFDE= X-Received: by 2002:a19:960e:: with SMTP id y14-v6mr1510267lfd.43.1522219669686; Tue, 27 Mar 2018 23:47:49 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-55.209.223.85.sovam.net.ua. [85.223.209.55]) by smtp.gmail.com with ESMTPSA id x70-v6sm546081lfd.82.2018.03.27.23.47.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Mar 2018 23:47:48 -0700 (PDT) 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 v4 0/2] drm/xen-front: Add support for Xen PV display frontend Date: Wed, 28 Mar 2018 09:47:39 +0300 Message-Id: <1522219661-26827-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! Notes. 1. Boris, I put your R-b tag as I almost didn't change Xen part of the driver (see below). Please let me know if this is not acceptable, so I remove the tag. 2. With this patch series I am also adding a patch from Noralf Trønnes [12] to enable critical sections for unplugabble devices as agreed in [13]. This can be applied without any respect to Xen PV DRM frontend driver. 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] Changes since v3: ******************************************************************************* - no changes to Xen related code (shared buffer handling, event channels etc.), but minor changes to xenbus_driver state machine due to re-worked unplug implementation: additional state checks added - re-worked dumb creation code to fix race condition (drm_gem_handle_create) - use drm_dev_{enter|exit} to protect code which must not run when unplugged - re-work unplug code to fully support "zombie" DRM devices on backend disconnect - implement a dedicated page flip time-out worker, remove logic from connector detect callback - move mode_valid from drm_connector_helper_funcs to drm_simple_display_pipe_funcs - use drm_gem_object_put_unlocked instead of obsolete drm_gem_object_unreference_unlocked - minor cleanups Changes since v2: ******************************************************************************* - no changes to Xen related code (shared buffer handling, event channels etc.) - rework DRM driver release with hotplug (Daniel) - squash xen_drm_front and xen_drm_front_drv as they depend on each other too heavily now - remove platform driver and instantiate DRM device from xenbus driver directly - have serializing mutex per connector, not a single one, so we don't introduce a bottle neck for multiple connectors - minor comments addressed (Daniel) Changes since v1: ******************************************************************************* - use SPDX license identifier, set license to GPLv2 OR MIT - changed midlayers to direct function calls, removed: - front_ops - gem_ops - renamed xenbus_driver callbacks to align with exisitng PV drivers - re-worked backend error handling with connector hotplug uevents - removed vblank handling so user-space doesn't have an impression we really support that - directly use front's mode_set in display enable/disable - removed BUG_ON, error handling implemented - moved driver documentation into Documentation/gpu - other comments from Xen community addressed (Boris and Juergen) - squashed Xen and DRM patches for better interrconnection visibility - for your convenience driver is available at [11] Thank you, Oleksandr Andrushchenko [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/ [11] https://github.com/andr2000/linux/commits/drm_tip_pv_drm_v2 [12] https://patchwork.freedesktop.org/patch/175779/ [13] https://www.spinics.net/lists/dri-devel/msg170453.html Noralf Trønnes (1): drm: Use srcu to protect drm_device.unplugged Oleksandr Andrushchenko (1): drm/xen-front: Add support for Xen PV display frontend Documentation/gpu/drivers.rst | 1 + Documentation/gpu/xen-front.rst | 43 ++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_drv.c | 54 +- drivers/gpu/drm/xen/Kconfig | 30 + drivers/gpu/drm/xen/Makefile | 16 + drivers/gpu/drm/xen/xen_drm_front.c | 880 ++++++++++++++++++++++++++++ drivers/gpu/drm/xen/xen_drm_front.h | 189 ++++++ drivers/gpu/drm/xen/xen_drm_front_cfg.c | 77 +++ drivers/gpu/drm/xen/xen_drm_front_cfg.h | 37 ++ drivers/gpu/drm/xen/xen_drm_front_conn.c | 115 ++++ drivers/gpu/drm/xen/xen_drm_front_conn.h | 27 + drivers/gpu/drm/xen/xen_drm_front_evtchnl.c | 382 ++++++++++++ drivers/gpu/drm/xen/xen_drm_front_evtchnl.h | 81 +++ drivers/gpu/drm/xen/xen_drm_front_gem.c | 309 ++++++++++ drivers/gpu/drm/xen/xen_drm_front_gem.h | 41 ++ drivers/gpu/drm/xen/xen_drm_front_gem_cma.c | 78 +++ drivers/gpu/drm/xen/xen_drm_front_kms.c | 371 ++++++++++++ drivers/gpu/drm/xen/xen_drm_front_kms.h | 27 + drivers/gpu/drm/xen/xen_drm_front_shbuf.c | 432 ++++++++++++++ drivers/gpu/drm/xen/xen_drm_front_shbuf.h | 72 +++ include/drm/drm_device.h | 9 +- include/drm/drm_drv.h | 15 +- 24 files changed, 3279 insertions(+), 10 deletions(-) create mode 100644 Documentation/gpu/xen-front.rst 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_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