linux_dsm_epyc7002/drivers/gpu/drm
Oleksandr Andrushchenko c575b7eeb8 drm/xen-front: Add support for Xen PV display frontend
Add support for Xen para-virtualized frontend display driver.
Accompanying backend [1] is implemented as a user-space application
and its helper library [2], capable of running as a Weston client
or DRM master.
Configuration of both backend and frontend is done via
Xen guest domain configuration options [3].

Driver limitations:
 1. Only primary plane without additional properties is supported.
 2. Only one video mode supported which resolution is configured
    via XenStore.
 3. All CRTCs operate at fixed frequency of 60Hz.

1. Implement Xen bus state machine for the frontend driver according to
the state diagram and recovery flow from display para-virtualized
protocol: xen/interface/io/displif.h.

2. Read configuration values from Xen store according
to xen/interface/io/displif.h protocol:
  - read connector(s) configuration
  - read buffer allocation mode (backend/frontend)

3. Handle Xen event channels:
  - create for all configured connectors and publish
    corresponding ring references and event channels in Xen store,
    so backend can connect
  - implement event channels interrupt handlers
  - create and destroy event channels with respect to Xen bus state

4. Implement shared buffer handling according to the
para-virtualized display device protocol at xen/interface/io/displif.h:
  - handle page directories according to displif protocol:
    - allocate and share page directories
    - grant references to the required set of pages for the
      page directory
  - allocate xen balllooned pages via Xen balloon driver
    with alloc_xenballooned_pages/free_xenballooned_pages
  - grant references to the required set of pages for the
    shared buffer itself
  - implement pages map/unmap for the buffers allocated by the
    backend (gnttab_map_refs/gnttab_unmap_refs)

5. Implement kernel modesetiing/connector handling using
DRM simple KMS helper pipeline:

- implement KMS part of the driver with the help of DRM
  simple pipepline helper which is possible due to the fact
  that the para-virtualized driver only supports a single
  (primary) plane:
  - initialize connectors according to XenStore configuration
  - handle frame done events from the backend
  - create and destroy frame buffers and propagate those
    to the backend
  - propagate set/reset mode configuration to the backend on display
    enable/disable callbacks
  - send page flip request to the backend and implement logic for
    reporting backend IO errors on prepare fb callback

- implement virtual connector handling:
  - support only pixel formats suitable for single plane modes
  - make sure the connector is always connected
  - support a single video mode as per para-virtualized driver
    configuration

6. Implement GEM handling depending on driver mode of operation:
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.

6.1. Buffers allocated by the frontend driver.

The below modes of operation are configured at compile-time via
frontend driver's kernel configuration.

6.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.

6.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.

6.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.

Note, while using this scenario the following should be considered:
  a) If guest domain dies then pages/grants received from the backend
     cannot be claimed back
  b) Misbehaving guest may send too many requests to the
     backend exhausting its grant references and memory
     (consider this from security POV).

Note! Configuration options 1.1 (contiguous display buffers) and 2
(backend allocated buffers) are not supported at the same time.

7. Handle communication with the backend:
 - send requests and wait for the responses according
   to the displif protocol
 - serialize access to the communication channel
 - time-out used for backend communication is set to 3000 ms
 - manage display buffers shared with the backend

[1] https://github.com/xen-troops/displ_be
[2] https://github.com/xen-troops/libxenbe
[3] 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

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180403112317.28751-2-andr2000@gmail.com
2018-04-03 14:41:48 +03:00
..
amd Merge tag 'drm-amdkfd-next-2018-03-27' of git://people.freedesktop.org/~gabbayo/linux into drm-next 2018-03-28 14:49:19 +10:00
arc drm/arcpgu: remove drm_encoder_slave 2018-01-30 18:05:25 +01:00
arm drm: mali-dp: Add YUV->RGB conversion support for video layers 2018-03-14 11:41:01 +00:00
armada drm: Don't pass clip to drm_atomic_helper_check_plane_state() 2018-03-05 20:48:25 +02:00
ast Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
atmel-hlcdc drm/atmel-hlcdc: Use the alpha format field in drm_format_info 2018-01-29 12:08:37 +01:00
bochs drm/ttm: add bo as parameter to the ttm_tt_create callback 2018-03-14 14:38:27 -05:00
bridge drm/bridge: dw-hdmi: Remove unused hdmi_enable_overflow_interrupts() 2018-03-15 09:45:11 +01:00
cirrus Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
etnaviv drm/etnaviv: bump HW job limit to 4 2018-03-22 11:08:48 +01:00
exynos Merge airlied/drm-next into drm-misc-next 2018-03-30 12:35:45 -04:00
fsl-dcu drm/fsl-dcu: Use drm_mode_config_helper_suspend/resume() 2017-12-05 13:46:41 +01:00
gma500 pci-v4.16-changes 2018-02-06 09:59:40 -08:00
hisilicon drm/ttm: add bo as parameter to the ttm_tt_create callback 2018-03-14 14:38:27 -05:00
i2c drm/i2c: tda998x: Remove duplicate NULL check 2018-01-18 16:24:38 +02:00
i810
i915 Merge airlied/drm-next into drm-misc-next 2018-03-30 12:35:45 -04:00
imx Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
lib
mediatek drm: Don't pass clip to drm_atomic_helper_check_plane_state() 2018-03-05 20:48:25 +02:00
meson Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
mga
mgag200 drm/ttm: add bo as parameter to the ttm_tt_create callback 2018-03-14 14:38:27 -05:00
msm Merge tag 'drm-msm-next-2018-03-20' of git://people.freedesktop.org/~robclark/linux into drm-next 2018-03-21 14:06:00 +10:00
mxsfb drm/simple-kms-helper: Plumb plane state to the enable hook 2018-03-28 19:19:32 +03:00
nouveau Merge airlied/drm-next into drm-misc-next 2018-03-30 12:35:45 -04:00
omapdrm drm/omap: Use normalized zpos for plane placement 2018-03-28 09:45:45 +03:00
panel drm/panel: rm68200: Add backlight dependency 2018-03-14 11:51:24 +01:00
pl111 drm/simple-kms-helper: Plumb plane state to the enable hook 2018-03-28 19:19:32 +03:00
qxl Merge airlied/drm-next into drm-misc-next 2018-03-21 09:40:55 -04:00
r128 r128: don't open-code memdup_user() 2017-12-27 19:00:09 -05:00
radeon Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
rcar-du drm: rcar-du: Let core take care of normalizing the zpos 2018-03-28 09:45:45 +03:00
rockchip drm/rockchip: fixup comment for gem_free_object_unlocked 2018-03-28 17:07:36 +02:00
savage
scheduler treewide/trivial: Remove ';;$' typo noise 2018-02-22 10:59:33 +01:00
selftests Merge tag 'drm-misc-next-2017-11-30' of git://anongit.freedesktop.org/drm/drm-misc into drm-next 2017-12-04 05:42:49 +10:00
shmobile
sis
sti drm/sti: Stop consulting plane->fb 2018-03-29 19:14:21 +03:00
stm drm/stm: check pitch and size calculations even if !CONFIG_MMU 2018-02-23 09:37:12 +01:00
sun4i Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
tdfx
tegra Merge airlied/drm-next into drm-misc-next 2018-03-30 12:35:45 -04:00
tilcdc drm/tilcdc: tilcdc_panel: Rename device from "panel" to "tilcdc-panel" 2018-02-28 11:48:25 +02:00
tinydrm drm/tinydrm: Make fb_dirty into a lower level hook 2018-03-28 19:19:32 +03:00
ttm drm/ttm: Export the ttm_k[un]map_atomic_prot API. 2018-03-22 11:10:06 +01:00
tve200 drm/simple-kms-helper: Plumb plane state to the enable hook 2018-03-28 19:19:32 +03:00
udl Merge airlied/drm-next into drm-misc-next 2018-03-30 12:35:45 -04:00
vc4 drm/vc4_validate: Remove VLA usage 2018-03-16 15:51:52 -07:00
vgem treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
via Merge tag 'drm-misc-next-2017-11-30' of git://anongit.freedesktop.org/drm/drm-misc into drm-next 2017-12-04 05:42:49 +10:00
virtio Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
vmwgfx Merge airlied/drm-next into drm-misc-next 2018-03-30 12:35:45 -04:00
xen drm/xen-front: Add support for Xen PV display frontend 2018-04-03 14:41:48 +03:00
zte drm/zte: Stop consulting plane->crtc 2018-03-29 19:14:21 +03:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic_helper.c drm: Use plane->state->fb over plane->fb 2018-03-29 19:14:21 +03:00
drm_atomic.c drm: Verify gamma/degamma LUT size 2018-03-16 15:44:01 +02:00
drm_auth.c drm: Check for lessee in DROP_MASTER ioctl 2018-01-31 09:27:51 +01:00
drm_blend.c drm/docs: Align layout of optional plane blending properties 2018-02-20 12:10:46 +01:00
drm_bridge.c
drm_bufs.c drm: dma_bufs: Fixed checkpatch issues 2018-03-19 09:31:20 -04:00
drm_cache.c
drm_color_mgmt.c drm/atomic: Include color encoding/range in plane state dump 2018-03-02 14:41:21 +02:00
drm_connector.c drm/docs: Document "scaling mode" property better 2018-02-20 12:10:46 +01:00
drm_context.c
drm_crtc_helper_internal.h
drm_crtc_helper.c
drm_crtc_internal.h drm/atomic: Include color encoding/range in plane state dump 2018-03-02 14:41:21 +02:00
drm_crtc.c drm: Use plane->state->fb over plane->fb 2018-03-29 19:14:21 +03:00
drm_debugfs_crc.c drm/crc: Add support for polling on the data fd. 2018-02-05 13:22:44 +01:00
drm_debugfs.c
drm_dma.c
drm_dp_aux_dev.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm/dp: Add HBR3 support in existing DRM DP helpers 2018-01-26 13:36:53 +02:00
drm_dp_mst_topology.c drm/dp/mst: Fix off-by-one typo when dump payload table 2018-03-28 09:12:16 +03:00
drm_drv.c drm: Use srcu to protect drm_device.unplugged 2018-03-29 13:19:20 +03:00
drm_dumb_buffers.c
drm_edid_load.c
drm_edid.c Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
drm_encoder_slave.c
drm_encoder.c drm: Warn if plane/crtc/encoder/connector index exceeds our 32bit bitmasks 2018-01-29 18:46:53 +02:00
drm_fb_cma_helper.c drm/cma-helper: Add drm_fb_cma_fbdev_init/fini() 2017-12-08 14:27:47 +01:00
drm_fb_helper.c drm: Remove now pointelss blob->data casts 2018-03-16 15:44:01 +02:00
drm_file.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
drm_flip_work.c
drm_fourcc.c drm/fourcc: Add a alpha field to drm_format_info 2018-01-29 12:07:47 +01:00
drm_framebuffer.c drm: Reshuffle getfb error returns 2018-03-30 17:54:27 +01:00
drm_gem_cma_helper.c
drm_gem_framebuffer_helper.c drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional 2017-12-08 14:26:00 +01:00
drm_gem.c drm/gem: Document that handle_create must be the last step 2018-03-26 17:42:06 +02:00
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h Merge airlied/drm-next into drm-misc-next 2017-11-21 14:17:56 +01:00
drm_ioc32.c
drm_ioctl.c drm: Print the pid when debug logging an ioctl error. 2018-02-10 22:23:10 +00:00
drm_irq.c
drm_kms_helper_common.c
drm_lease.c gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry 2018-03-26 10:38:06 +02:00
drm_legacy.h
drm_lock.c
drm_memory.c drm: fix drm_get_max_iomem type mismatch 2018-02-22 11:18:58 -05:00
drm_mipi_dsi.c drm/dsi: Fix improper use of mipi_dsi_device_transfer() return value 2018-01-16 17:10:14 -05:00
drm_mm.c Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
drm_mode_config.c Linux 4.15-rc4 2017-12-19 21:37:24 +10:00
drm_mode_object.c
drm_modes.c drm: Fix uabi regression by allowing garbage mode->type from userspace 2018-03-23 13:51:12 +02:00
drm_modeset_helper.c drm/modeset-helper: Add simple modeset suspend/resume helpers 2017-11-30 18:18:08 +01:00
drm_modeset_lock.c drm/atomic: Call ww_acquire_done after drm_modeset_lock_all 2018-03-05 10:35:32 +01:00
drm_of.c drm: of: simplify component probe code 2018-03-06 14:05:00 +05:30
drm_panel_orientation_quirks.c drm: Include the header with the prototype for drm_get_panel_orientation_quirk() 2018-02-26 17:39:59 +02:00
drm_panel.c
drm_pci.c
drm_plane_helper.c drm: Don't pass clip to drm_atomic_helper_check_plane_state() 2018-03-05 20:48:25 +02:00
drm_plane.c drm: Use plane->state->fb over plane->fb 2018-03-29 19:14:21 +03:00
drm_prime.c drm: add parameter explanation for some gem dmabuf_ops 2018-03-28 15:10:28 -05:00
drm_print.c drm: Reduce object size of DRM_DEV_<LEVEL> uses 2018-03-19 15:15:42 +01:00
drm_probe_helper.c Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
drm_property.c Revert "drm: Use a flexible array member for blob property data" 2018-03-16 15:44:01 +02:00
drm_rect.c
drm_scatter.c
drm_scdc_helper.c drm/scdc-helper: Convert errors into debug messages 2018-03-26 21:37:24 +03:00
drm_simple_kms_helper.c drm/simple-kms-helper: Plumb plane state to the enable hook 2018-03-28 19:19:32 +03:00
drm_syncobj.c drm: Use idr_init_base(1) when using id==0 for invalid 2018-02-19 12:21:24 +00:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank.c Merge tag 'drm-intel-next-2018-03-08' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2018-03-14 14:53:01 +10:00
drm_vm.c
drm_vma_manager.c
Kconfig drm/xen-front: Add support for Xen PV display frontend 2018-04-03 14:41:48 +03:00
Makefile drm/xen-front: Add support for Xen PV display frontend 2018-04-03 14:41:48 +03:00