Skip to contentSkip to conversation

drm/gem: Fix builds with CONFIG_MMU=n

PATCH In review Boris Brezillon 2 participants 3 messages Dec 9, 2025 – Dec 10, 2025

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

PATCH 1/1 drm/gem: Fix builds with CONFIG_MMU=n

drm_gem_get_unmapped_area() relies on mm_get_unmapped_area() which is only available if CONFIG_MMU=y.

Fixes 99bda20d6d4c ("drm/gem: Introduce drm_gem_get_unmapped_area() fop")
Cc Loïc Molinari <[email protected]>
---
 drivers/gpu/drm/drm_gem.c | 2 ++
 include/drm/drm_gem.h     | 5 +++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/drm_gem.c +2 -0
index 6021c4087a08..ca1956608261 100644
@@ -1267,6 +1267,7 @@ drm_gem_object_lookup_at_offset(struct file *filp, unsigned long start,
 	return obj;
 }
 
+#ifdef CONFIG_MMU
 /**
  * drm_gem_get_unmapped_area - get memory mapping region routine for GEM objects
  * @filp: DRM file pointer
@@ -1309,6 +1310,7 @@ unsigned long drm_gem_get_unmapped_area(struct file *filp, unsigned long uaddr,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(drm_gem_get_unmapped_area);
+#endif
 
 /**
  * drm_gem_mmap - memory map routine for GEM objects
include/drm/drm_gem.h +5 -0
index cca815dc87f3..f4da8ed0d630 100644
@@ -537,9 +537,14 @@ void drm_gem_vm_close(struct vm_area_struct *vma);
 int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
 		     struct vm_area_struct *vma);
 int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+
+#ifdef CONFIG_MMU
 unsigned long drm_gem_get_unmapped_area(struct file *filp, unsigned long uaddr,
 					unsigned long len, unsigned long pgoff,
 					unsigned long flags);
+#else
+#define drm_gem_get_unmapped_area NULL
+#endif
 
 /**
  * drm_gem_object_get - acquire a GEM buffer object reference
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Boris,

I missed that one, thanks for the fix.

Quoted 6 lines · Boris Brezillon

drm_gem_get_unmapped_area() relies on mm_get_unmapped_area() which is only available if CONFIG_MMU=y.

Fixes 99bda20d6d4c ("drm/gem: Introduce drm_gem_get_unmapped_area() fop")
Cc Loïc Molinari <[email protected]>

Regards,
Loïc

Quoted 44 lines
---
  drivers/gpu/drm/drm_gem.c | 2 ++
  include/drm/drm_gem.h     | 5 +++++
  2 files changed, 7 insertions(+)
drivers/gpu/drm/drm_gem.c +2 -0
index 6021c4087a08..ca1956608261 100644
@@ -1267,6 +1267,7 @@ drm_gem_object_lookup_at_offset(struct file *filp, unsigned long start,
  	return obj;
  }
 
+#ifdef CONFIG_MMU
  /**
   * drm_gem_get_unmapped_area - get memory mapping region routine for GEM objects
   * @filp: DRM file pointer
@@ -1309,6 +1310,7 @@ unsigned long drm_gem_get_unmapped_area(struct file *filp, unsigned long uaddr,
  	return ret;
  }
  EXPORT_SYMBOL_GPL(drm_gem_get_unmapped_area);
+#endif
 
  /**
   * drm_gem_mmap - memory map routine for GEM objects
include/drm/drm_gem.h +5 -0
index cca815dc87f3..f4da8ed0d630 100644
@@ -537,9 +537,14 @@ void drm_gem_vm_close(struct vm_area_struct *vma);
  int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
  		     struct vm_area_struct *vma);
  int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+
+#ifdef CONFIG_MMU
  unsigned long drm_gem_get_unmapped_area(struct file *filp, unsigned long uaddr,
  					unsigned long len, unsigned long pgoff,
  					unsigned long flags);
+#else
+#define drm_gem_get_unmapped_area NULL
+#endif
 
  /**
   * drm_gem_object_get - acquire a GEM buffer object reference
#2 lore raw
Quoted 5 lines · On Wed, 10 Dec 2025 14:35:51 +0100 Loïc Molinari <[email protected]>…

Hi Boris,

I missed that one, thanks for the fix.

On 09/12/2025 18:11, Boris Brezillon wrote:

Quoted 8 lines
Quoted 6 lines

drm_gem_get_unmapped_area() relies on mm_get_unmapped_area() which is only available if CONFIG_MMU=y.

Fixes 99bda20d6d4c ("drm/gem: Introduce drm_gem_get_unmapped_area() fop")
Cc Loïc Molinari <[email protected]>

Thanks, queued to drm-misc-next immediately so we don't get new kbot reports.

Quoted 49 lines

Regards,
Loïc

Quoted 44 lines
---
  drivers/gpu/drm/drm_gem.c | 2 ++
  include/drm/drm_gem.h     | 5 +++++
  2 files changed, 7 insertions(+)
drivers/gpu/drm/drm_gem.c +2 -0
index 6021c4087a08..ca1956608261 100644
@@ -1267,6 +1267,7 @@ drm_gem_object_lookup_at_offset(struct file *filp, unsigned long start,
  	return obj;
  }
 
+#ifdef CONFIG_MMU
  /**
   * drm_gem_get_unmapped_area - get memory mapping region routine for GEM objects
   * @filp: DRM file pointer
@@ -1309,6 +1310,7 @@ unsigned long drm_gem_get_unmapped_area(struct file *filp, unsigned long uaddr,
  	return ret;
  }
  EXPORT_SYMBOL_GPL(drm_gem_get_unmapped_area);
+#endif
 
  /**
   * drm_gem_mmap - memory map routine for GEM objects
include/drm/drm_gem.h +5 -0
index cca815dc87f3..f4da8ed0d630 100644
@@ -537,9 +537,14 @@ void drm_gem_vm_close(struct vm_area_struct *vma);
  int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
  		     struct vm_area_struct *vma);
  int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
+
+#ifdef CONFIG_MMU
  unsigned long drm_gem_get_unmapped_area(struct file *filp, unsigned long uaddr,
  					unsigned long len, unsigned long pgoff,
  					unsigned long flags);
+#else
+#define drm_gem_get_unmapped_area NULL
+#endif
 
  /**
   * drm_gem_object_get - acquire a GEM buffer object reference