Subject: linux-next: manual merge of the drm tree with the drm-fixes tree

From: Mark Brown <[email-masked]>
Date: Fri, 23 Jan 2026 17:45:36 +0000

Hi all,

Today's linux-next merge of the drm tree got a conflict in:

  include/drm/drm_pagemap.h

between commits:

  754c232384386 ("drm/pagemap, drm/xe: Ensure that the devmem allocation is idle before use")
  bdcdf968be314 ("drm, drm/xe: Fix xe userptr in the absence of CONFIG_DEVICE_PRIVATE")

from the drm-fixes tree and commits:

  a599b98607dec ("drm/pagemap, drm/xe: Add refcounting to struct drm_pagemap")
  75af93b3f5d0a ("drm/pagemap, drm/xe: Support destination migration over interconnect")
  77f14f2f2d73f ("drm/pagemap: Add a drm_pagemap cache and shrinker")

from the drm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc include/drm/drm_pagemap.h
index eb29e5309f0ab,46e9c58f09e01..0000000000000
--- a/include/drm/drm_pagemap.h
+++ b/include/drm/drm_pagemap.h
@@@ -209,19 -243,56 +243,69 @@@ struct drm_pagemap_devmem_ops 
  			   struct dma_fence *pre_migrate_fence);
  };
  
 +#if IS_ENABLED(CONFIG_ZONE_DEVICE)
 +
 +struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page);
 +
 +#else
 +
 +static inline struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page)
 +{
 +	return NULL;
 +}
 +
 +#endif /* IS_ENABLED(CONFIG_ZONE_DEVICE) */
 +
+ int drm_pagemap_init(struct drm_pagemap *dpagemap,
+ 		     struct dev_pagemap *pagemap,
+ 		     struct drm_device *drm,
+ 		     const struct drm_pagemap_ops *ops);
+ 
+ struct drm_pagemap *drm_pagemap_create(struct drm_device *drm,
+ 				       struct dev_pagemap *pagemap,
+ 				       const struct drm_pagemap_ops *ops);
+ 
+ #if IS_ENABLED(CONFIG_DRM_GPUSVM)
+ 
+ void drm_pagemap_put(struct drm_pagemap *dpagemap);
+ 
+ #else
+ 
+ static inline void drm_pagemap_put(struct drm_pagemap *dpagemap)
+ {
+ }
+ 
+ #endif /* IS_ENABLED(CONFIG_DRM_GPUSVM) */
+ 
+ /**
+  * drm_pagemap_get() - Obtain a reference on a struct drm_pagemap
+  * @dpagemap: Pointer to the struct drm_pagemap, or NULL.
+  *
+  * Return: Pointer to the struct drm_pagemap, or NULL.
+  */
+ static inline struct drm_pagemap *
+ drm_pagemap_get(struct drm_pagemap *dpagemap)
+ {
+ 	if (likely(dpagemap))
+ 		kref_get(&dpagemap->ref);
+ 
+ 	return dpagemap;
+ }
+ 
+ /**
+  * drm_pagemap_get_unless_zero() - Obtain a reference on a struct drm_pagemap
+  * unless the current reference count is zero.
+  * @dpagemap: Pointer to the drm_pagemap or NULL.
+  *
+  * Return: A pointer to @dpagemap if the reference count was successfully
+  * incremented. NULL if @dpagemap was NULL, or its refcount was 0.
+  */
+ static inline struct drm_pagemap * __must_check
+ drm_pagemap_get_unless_zero(struct drm_pagemap *dpagemap)
+ {
+ 	return (dpagemap && kref_get_unless_zero(&dpagemap->ref)) ? dpagemap : NULL;
+ }
+ 
  /**
   * struct drm_pagemap_devmem - Structure representing a GPU SVM device memory allocation
   *
@@@ -246,8 -317,23 +330,25 @@@ struct drm_pagemap_devmem 
  	struct dma_fence *pre_migrate_fence;
  };
  
+ /**
+  * struct drm_pagemap_migrate_details - Details to govern migration.
+  * @timeslice_ms: The time requested for the migrated pagemap pages to
+  * be present in @mm before being allowed to be migrated back.
+  * @can_migrate_same_pagemap: Whether the copy function as indicated by
+  * the @source_peer_migrates flag, can migrate device pages within a
+  * single drm_pagemap.
+  * @source_peer_migrates: Whether on p2p migration, The source drm_pagemap
+  * should use the copy_to_ram() callback rather than the destination
+  * drm_pagemap should use the copy_to_devmem() callback.
+  */
+ struct drm_pagemap_migrate_details {
+ 	unsigned long timeslice_ms;
+ 	u32 can_migrate_same_pagemap : 1;
+ 	u32 source_peer_migrates : 1;
+ };
+ 
 +#if IS_ENABLED(CONFIG_ZONE_DEVICE)
 +
  int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,
  				  struct mm_struct *mm,
  				  unsigned long start, unsigned long end,
@@@ -269,6 -356,7 +369,10 @@@ int drm_pagemap_populate_mm(struct drm_
  			    struct mm_struct *mm,
  			    unsigned long timeslice_ms);
  
 +#endif /* IS_ENABLED(CONFIG_ZONE_DEVICE) */
 +
+ void drm_pagemap_destroy(struct drm_pagemap *dpagemap, bool is_atomic_or_reclaim);
+ 
+ int drm_pagemap_reinit(struct drm_pagemap *dpagemap);
++
  #endif