Skip to contentSkip to conversation

drm: allow to use mmuless SoC

PATCH New Benjamin Gaignard 1 participant 1 message Jan 6, 2017

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: allow to use mmuless SoC

Some SoC without MMU have display driver where a drm/kms driver could be implemented.

Before doing such kind of thing drm/kms must allow to use mmuless devices. This patch propose to remove MMU configuration flag and add a cma helper function to help implementing mmuless display driver

version 4:
- add documentation about drm_gem_cma_get_unmapped_area()
- stub it MMU case

version 5:
- Make all driver that select DRM_TTM depends on MMU (issue reported by kbuild test robot)

[danvet: Use recommended struct member references in kernel-doc.]
---
 Documentation/gpu/drm-mm.rst            | 11 +++++
 drivers/gpu/drm/Kconfig                 |  8 ++--
 drivers/gpu/drm/ast/Kconfig             |  2 +-
 drivers/gpu/drm/bochs/Kconfig           |  2 +-
 drivers/gpu/drm/cirrus/Kconfig          |  2 +-
 drivers/gpu/drm/drm_gem_cma_helper.c    | 71 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/gma500/Kconfig          |  2 +-
 drivers/gpu/drm/hisilicon/hibmc/Kconfig |  2 +-
 drivers/gpu/drm/mgag200/Kconfig         |  2 +-
 drivers/gpu/drm/nouveau/Kconfig         |  2 +-
 drivers/gpu/drm/qxl/Kconfig             |  2 +-
 drivers/gpu/drm/virtio/Kconfig          |  2 +-
 drivers/gpu/drm/vmwgfx/Kconfig          |  2 +-
 include/drm/drm_gem_cma_helper.h        | 17 ++++++++
 14 files changed, 113 insertions(+), 14 deletions(-)
Documentation/gpu/drm-mm.rst +11 -0
index d3c6d77..1ea94fc 100644
@@ -310,6 +310,17 @@ created.
 Drivers that want to map the GEM object upfront instead of handling page
 faults can implement their own mmap file operation handler.
 
+For platforms without MMU the GEM core provides a helper method
+:c:func:`drm_gem_cma_get_unmapped_area`. The mmap() routines will call
+this to get a proposed address for the mapping.
+
+To use :c:func:`drm_gem_cma_get_unmapped_area`, drivers must fill the
+struct :c:type:`struct file_operations <file_operations>` get_unmapped_area
+field with a pointer on :c:func:`drm_gem_cma_get_unmapped_area`.
+
+More detailed information about get_unmapped_area can be found in
+Documentation/nommu-mmap.txt
+
 Memory Coherency
 ----------------
 
drivers/gpu/drm/Kconfig +4 -4
index d56b85c..6f3f9e6 100644
@@ -6,7 +6,7 @@
 #
 menuconfig DRM
 	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
-	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU && HAS_DMA
+	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
 	select HDMI
 	select FB_CMDLINE
 	select I2C
@@ -113,7 +113,7 @@ config DRM_LOAD_EDID_FIRMWARE
 
 config DRM_TTM
 	tristate
-	depends on DRM
+	depends on DRM && MMU
 	help
 	  GPU memory management subsystem for devices with multiple
 	  GPU memory types. Will be enabled automatically if a device driver
@@ -146,7 +146,7 @@ source "drivers/gpu/drm/arm/Kconfig"
 
 config DRM_RADEON
 	tristate "ATI Radeon"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select FW_LOADER
         select DRM_KMS_HELPER
         select DRM_TTM
@@ -166,7 +166,7 @@ source "drivers/gpu/drm/radeon/Kconfig"
 
 config DRM_AMDGPU
 	tristate "AMD GPU"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select FW_LOADER
         select DRM_KMS_HELPER
         select DRM_TTM
drivers/gpu/drm/ast/Kconfig +1 -1
index 15f6ce7..9647e1f 100644
@@ -1,6 +1,6 @@
 config DRM_AST
 	tristate "AST server chips"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select DRM_TTM
 	select DRM_KMS_HELPER
 	select DRM_TTM
drivers/gpu/drm/bochs/Kconfig +1 -1
index f739763..bd27180 100644
@@ -1,6 +1,6 @@
 config DRM_BOCHS
 	tristate "DRM Support for bochs dispi vga interface (qemu stdvga)"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	help
drivers/gpu/drm/cirrus/Kconfig +1 -1
index 04b3c16..ca38098 100644
@@ -1,6 +1,6 @@
 config DRM_CIRRUS_QEMU
 	tristate "Cirrus driver for QEMU emulated device"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	help
drivers/gpu/drm/drm_gem_cma_helper.c +71 -0

77 lines not on this page · raw message

drivers/gpu/drm/gma500/Kconfig +1 -1
index 8906d67..df11582 100644
@@ -1,6 +1,6 @@
 config DRM_GMA500
 	tristate "Intel GMA5/600 KMS Framebuffer"
-	depends on DRM && PCI && X86
+	depends on DRM && PCI && X86 && MMU
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	# GMA500 depends on ACPI_VIDEO when ACPI is enabled, just like i915
drivers/gpu/drm/hisilicon/hibmc/Kconfig +1 -1
index 380622a..c7129dc 100644
@@ -1,6 +1,6 @@
 config DRM_HISI_HIBMC
 	tristate "DRM Support for Hisilicon Hibmc"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select DRM_KMS_HELPER
 	select DRM_TTM
 
drivers/gpu/drm/mgag200/Kconfig +1 -1
index 520e5e6..db58578 100644
@@ -1,6 +1,6 @@
 config DRM_MGAG200
 	tristate "Kernel modesetting driver for MGA G200 server engines"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	help
drivers/gpu/drm/nouveau/Kconfig +1 -1
index 0f2f0af..c02a134 100644
@@ -1,6 +1,6 @@
 config DRM_NOUVEAU
 	tristate "Nouveau (NVIDIA) cards"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
         select FW_LOADER
 	select DRM_KMS_HELPER
 	select DRM_TTM
drivers/gpu/drm/qxl/Kconfig +1 -1
index da45b11..378da59 100644
@@ -1,6 +1,6 @@
 config DRM_QXL
 	tristate "QXL virtual GPU"
-	depends on DRM && PCI
+	depends on DRM && PCI && MMU
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	select CRC32
drivers/gpu/drm/virtio/Kconfig +1 -1
index 81d1807..0c384d9 100644
@@ -1,6 +1,6 @@
 config DRM_VIRTIO_GPU
 	tristate "Virtio GPU driver"
-	depends on DRM && VIRTIO
+	depends on DRM && VIRTIO && MMU
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	help
drivers/gpu/drm/vmwgfx/Kconfig +1 -1
index fb7b82a..8c308da 100644
@@ -1,6 +1,6 @@
 config DRM_VMWGFX
 	tristate "DRM driver for VMware Virtual GPU"
-	depends on DRM && PCI && X86
+	depends on DRM && PCI && X86 && MMU
 	select FB_DEFERRED_IO
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
include/drm/drm_gem_cma_helper.h +17 -0
index acd6af8..2abcd51 100644
@@ -53,6 +53,23 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
 
 extern const struct vm_operations_struct drm_gem_cma_vm_ops;
 
+#ifndef CONFIG_MMU
+unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
+					    unsigned long addr,
+					    unsigned long len,
+					    unsigned long pgoff,
+					    unsigned long flags);
+#else
+static inline unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
+							  unsigned long addr,
+							  unsigned long len,
+							  unsigned long pgoff,
+							  unsigned long flags)
+{
+	return -EINVAL;
+}
+#endif
+
 #ifdef CONFIG_DEBUG_FS
 void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
 #endif
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel