Skip to content

Commit 60d98e1

Browse files
committed
Merge tag 'drm-misc-fixes-2025-08-28' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
Several nouveau fixes to remove unused code, fix an error path and be less restrictive with the formats it accepts. A fix for amdgpu to pin vmapped dma-buf, and a revert for tegra for a regression in the dma-buf / GEM code. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <mripard@redhat.com> Link: https://lore.kernel.org/r/20250828-hypersonic-colorful-squirrel-64f04b@houat
2 parents 59b0002 + 16fdb3c commit 60d98e1

File tree

7 files changed

+88
-60
lines changed

7 files changed

+88
-60
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,36 @@ static int amdgpu_dma_buf_begin_cpu_access(struct dma_buf *dma_buf,
285285
return ret;
286286
}
287287

288+
static int amdgpu_dma_buf_vmap(struct dma_buf *dma_buf, struct iosys_map *map)
289+
{
290+
struct drm_gem_object *obj = dma_buf->priv;
291+
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
292+
int ret;
293+
294+
/*
295+
* Pin to keep buffer in place while it's vmap'ed. The actual
296+
* domain is not that important as long as it's mapable. Using
297+
* GTT and VRAM should be compatible with most use cases.
298+
*/
299+
ret = amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT | AMDGPU_GEM_DOMAIN_VRAM);
300+
if (ret)
301+
return ret;
302+
ret = drm_gem_dmabuf_vmap(dma_buf, map);
303+
if (ret)
304+
amdgpu_bo_unpin(bo);
305+
306+
return ret;
307+
}
308+
309+
static void amdgpu_dma_buf_vunmap(struct dma_buf *dma_buf, struct iosys_map *map)
310+
{
311+
struct drm_gem_object *obj = dma_buf->priv;
312+
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
313+
314+
drm_gem_dmabuf_vunmap(dma_buf, map);
315+
amdgpu_bo_unpin(bo);
316+
}
317+
288318
const struct dma_buf_ops amdgpu_dmabuf_ops = {
289319
.attach = amdgpu_dma_buf_attach,
290320
.pin = amdgpu_dma_buf_pin,
@@ -294,8 +324,8 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = {
294324
.release = drm_gem_dmabuf_release,
295325
.begin_cpu_access = amdgpu_dma_buf_begin_cpu_access,
296326
.mmap = drm_gem_dmabuf_mmap,
297-
.vmap = drm_gem_dmabuf_vmap,
298-
.vunmap = drm_gem_dmabuf_vunmap,
327+
.vmap = amdgpu_dma_buf_vmap,
328+
.vunmap = amdgpu_dma_buf_vunmap,
299329
};
300330

301331
/**

drivers/gpu/drm/drm_gpuvm.c

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* mapping's backing &drm_gem_object buffers.
4141
*
4242
* &drm_gem_object buffers maintain a list of &drm_gpuva objects representing
43-
* all existent GPU VA mappings using this &drm_gem_object as backing buffer.
43+
* all existing GPU VA mappings using this &drm_gem_object as backing buffer.
4444
*
4545
* GPU VAs can be flagged as sparse, such that drivers may use GPU VAs to also
4646
* keep track of sparse PTEs in order to support Vulkan 'Sparse Resources'.
@@ -72,7 +72,7 @@
7272
* but it can also be a 'dummy' object, which can be allocated with
7373
* drm_gpuvm_resv_object_alloc().
7474
*
75-
* In order to connect a struct drm_gpuva its backing &drm_gem_object each
75+
* In order to connect a struct drm_gpuva to its backing &drm_gem_object each
7676
* &drm_gem_object maintains a list of &drm_gpuvm_bo structures, and each
7777
* &drm_gpuvm_bo contains a list of &drm_gpuva structures.
7878
*
@@ -81,7 +81,7 @@
8181
* This is ensured by the API through drm_gpuvm_bo_obtain() and
8282
* drm_gpuvm_bo_obtain_prealloc() which first look into the corresponding
8383
* &drm_gem_object list of &drm_gpuvm_bos for an existing instance of this
84-
* particular combination. If not existent a new instance is created and linked
84+
* particular combination. If not present, a new instance is created and linked
8585
* to the &drm_gem_object.
8686
*
8787
* &drm_gpuvm_bo structures, since unique for a given &drm_gpuvm, are also used
@@ -108,7 +108,7 @@
108108
* sequence of operations to satisfy a given map or unmap request.
109109
*
110110
* Therefore the DRM GPU VA manager provides an algorithm implementing splitting
111-
* and merging of existent GPU VA mappings with the ones that are requested to
111+
* and merging of existing GPU VA mappings with the ones that are requested to
112112
* be mapped or unmapped. This feature is required by the Vulkan API to
113113
* implement Vulkan 'Sparse Memory Bindings' - drivers UAPIs often refer to this
114114
* as VM BIND.
@@ -119,7 +119,7 @@
119119
* execute in order to integrate the new mapping cleanly into the current state
120120
* of the GPU VA space.
121121
*
122-
* Depending on how the new GPU VA mapping intersects with the existent mappings
122+
* Depending on how the new GPU VA mapping intersects with the existing mappings
123123
* of the GPU VA space the &drm_gpuvm_ops callbacks contain an arbitrary amount
124124
* of unmap operations, a maximum of two remap operations and a single map
125125
* operation. The caller might receive no callback at all if no operation is
@@ -139,16 +139,16 @@
139139
* one unmap operation and one or two map operations, such that drivers can
140140
* derive the page table update delta accordingly.
141141
*
142-
* Note that there can't be more than two existent mappings to split up, one at
142+
* Note that there can't be more than two existing mappings to split up, one at
143143
* the beginning and one at the end of the new mapping, hence there is a
144144
* maximum of two remap operations.
145145
*
146146
* Analogous to drm_gpuvm_sm_map() drm_gpuvm_sm_unmap() uses &drm_gpuvm_ops to
147147
* call back into the driver in order to unmap a range of GPU VA space. The
148-
* logic behind this function is way simpler though: For all existent mappings
148+
* logic behind this function is way simpler though: For all existing mappings
149149
* enclosed by the given range unmap operations are created. For mappings which
150-
* are only partically located within the given range, remap operations are
151-
* created such that those mappings are split up and re-mapped partically.
150+
* are only partially located within the given range, remap operations are
151+
* created such that those mappings are split up and re-mapped partially.
152152
*
153153
* As an alternative to drm_gpuvm_sm_map() and drm_gpuvm_sm_unmap(),
154154
* drm_gpuvm_sm_map_ops_create() and drm_gpuvm_sm_unmap_ops_create() can be used
@@ -168,7 +168,7 @@
168168
* provided helper functions drm_gpuva_map(), drm_gpuva_remap() and
169169
* drm_gpuva_unmap() instead.
170170
*
171-
* The following diagram depicts the basic relationships of existent GPU VA
171+
* The following diagram depicts the basic relationships of existing GPU VA
172172
* mappings, a newly requested mapping and the resulting mappings as implemented
173173
* by drm_gpuvm_sm_map() - it doesn't cover any arbitrary combinations of these.
174174
*
@@ -218,7 +218,7 @@
218218
*
219219
*
220220
* 4) Existent mapping is a left aligned subset of the requested one, hence
221-
* replace the existent one.
221+
* replace the existing one.
222222
*
223223
* ::
224224
*
@@ -236,9 +236,9 @@
236236
* and/or non-contiguous BO offset.
237237
*
238238
*
239-
* 5) Requested mapping's range is a left aligned subset of the existent one,
239+
* 5) Requested mapping's range is a left aligned subset of the existing one,
240240
* but backed by a different BO. Hence, map the requested mapping and split
241-
* the existent one adjusting its BO offset.
241+
* the existing one adjusting its BO offset.
242242
*
243243
* ::
244244
*
@@ -271,9 +271,9 @@
271271
* new: |-----|-----| (a.bo_offset=n, a'.bo_offset=n+1)
272272
*
273273
*
274-
* 7) Requested mapping's range is a right aligned subset of the existent one,
274+
* 7) Requested mapping's range is a right aligned subset of the existing one,
275275
* but backed by a different BO. Hence, map the requested mapping and split
276-
* the existent one, without adjusting the BO offset.
276+
* the existing one, without adjusting the BO offset.
277277
*
278278
* ::
279279
*
@@ -304,7 +304,7 @@
304304
*
305305
* 9) Existent mapping is overlapped at the end by the requested mapping backed
306306
* by a different BO. Hence, map the requested mapping and split up the
307-
* existent one, without adjusting the BO offset.
307+
* existing one, without adjusting the BO offset.
308308
*
309309
* ::
310310
*
@@ -334,9 +334,9 @@
334334
* new: |-----|-----------| (a'.bo_offset=n, a.bo_offset=n+1)
335335
*
336336
*
337-
* 11) Requested mapping's range is a centered subset of the existent one
337+
* 11) Requested mapping's range is a centered subset of the existing one
338338
* having a different backing BO. Hence, map the requested mapping and split
339-
* up the existent one in two mappings, adjusting the BO offset of the right
339+
* up the existing one in two mappings, adjusting the BO offset of the right
340340
* one accordingly.
341341
*
342342
* ::
@@ -351,7 +351,7 @@
351351
* new: |-----|-----|-----| (a.bo_offset=n,b.bo_offset=m,a'.bo_offset=n+2)
352352
*
353353
*
354-
* 12) Requested mapping is a contiguous subset of the existent one. Split it
354+
* 12) Requested mapping is a contiguous subset of the existing one. Split it
355355
* up, but indicate that the backing PTEs could be kept.
356356
*
357357
* ::
@@ -367,7 +367,7 @@
367367
*
368368
*
369369
* 13) Existent mapping is a right aligned subset of the requested one, hence
370-
* replace the existent one.
370+
* replace the existing one.
371371
*
372372
* ::
373373
*
@@ -386,7 +386,7 @@
386386
*
387387
*
388388
* 14) Existent mapping is a centered subset of the requested one, hence
389-
* replace the existent one.
389+
* replace the existing one.
390390
*
391391
* ::
392392
*
@@ -406,7 +406,7 @@
406406
*
407407
* 15) Existent mappings is overlapped at the beginning by the requested mapping
408408
* backed by a different BO. Hence, map the requested mapping and split up
409-
* the existent one, adjusting its BO offset accordingly.
409+
* the existing one, adjusting its BO offset accordingly.
410410
*
411411
* ::
412412
*
@@ -469,8 +469,8 @@
469469
* make use of them.
470470
*
471471
* The below code is strictly limited to illustrate the generic usage pattern.
472-
* To maintain simplicitly, it doesn't make use of any abstractions for common
473-
* code, different (asyncronous) stages with fence signalling critical paths,
472+
* To maintain simplicity, it doesn't make use of any abstractions for common
473+
* code, different (asynchronous) stages with fence signalling critical paths,
474474
* any other helpers or error handling in terms of freeing memory and dropping
475475
* previously taken locks.
476476
*
@@ -479,7 +479,7 @@
479479
* // Allocates a new &drm_gpuva.
480480
* struct drm_gpuva * driver_gpuva_alloc(void);
481481
*
482-
* // Typically drivers would embedd the &drm_gpuvm and &drm_gpuva
482+
* // Typically drivers would embed the &drm_gpuvm and &drm_gpuva
483483
* // structure in individual driver structures and lock the dma-resv with
484484
* // drm_exec or similar helpers.
485485
* int driver_mapping_create(struct drm_gpuvm *gpuvm,
@@ -582,7 +582,7 @@
582582
* .sm_step_unmap = driver_gpuva_unmap,
583583
* };
584584
*
585-
* // Typically drivers would embedd the &drm_gpuvm and &drm_gpuva
585+
* // Typically drivers would embed the &drm_gpuvm and &drm_gpuva
586586
* // structure in individual driver structures and lock the dma-resv with
587587
* // drm_exec or similar helpers.
588588
* int driver_mapping_create(struct drm_gpuvm *gpuvm,
@@ -680,7 +680,7 @@
680680
*
681681
* This helper is here to provide lockless list iteration. Lockless as in, the
682682
* iterator releases the lock immediately after picking the first element from
683-
* the list, so list insertion deletion can happen concurrently.
683+
* the list, so list insertion and deletion can happen concurrently.
684684
*
685685
* Elements popped from the original list are kept in a local list, so removal
686686
* and is_empty checks can still happen while we're iterating the list.
@@ -1160,7 +1160,7 @@ drm_gpuvm_prepare_objects_locked(struct drm_gpuvm *gpuvm,
11601160
}
11611161

11621162
/**
1163-
* drm_gpuvm_prepare_objects() - prepare all assoiciated BOs
1163+
* drm_gpuvm_prepare_objects() - prepare all associated BOs
11641164
* @gpuvm: the &drm_gpuvm
11651165
* @exec: the &drm_exec locking context
11661166
* @num_fences: the amount of &dma_fences to reserve
@@ -1230,13 +1230,13 @@ drm_gpuvm_prepare_range(struct drm_gpuvm *gpuvm, struct drm_exec *exec,
12301230
EXPORT_SYMBOL_GPL(drm_gpuvm_prepare_range);
12311231

12321232
/**
1233-
* drm_gpuvm_exec_lock() - lock all dma-resv of all assoiciated BOs
1233+
* drm_gpuvm_exec_lock() - lock all dma-resv of all associated BOs
12341234
* @vm_exec: the &drm_gpuvm_exec wrapper
12351235
*
12361236
* Acquires all dma-resv locks of all &drm_gem_objects the given
12371237
* &drm_gpuvm contains mappings of.
12381238
*
1239-
* Addionally, when calling this function with struct drm_gpuvm_exec::extra
1239+
* Additionally, when calling this function with struct drm_gpuvm_exec::extra
12401240
* being set the driver receives the given @fn callback to lock additional
12411241
* dma-resv in the context of the &drm_gpuvm_exec instance. Typically, drivers
12421242
* would call drm_exec_prepare_obj() from within this callback.
@@ -1293,7 +1293,7 @@ fn_lock_array(struct drm_gpuvm_exec *vm_exec)
12931293
}
12941294

12951295
/**
1296-
* drm_gpuvm_exec_lock_array() - lock all dma-resv of all assoiciated BOs
1296+
* drm_gpuvm_exec_lock_array() - lock all dma-resv of all associated BOs
12971297
* @vm_exec: the &drm_gpuvm_exec wrapper
12981298
* @objs: additional &drm_gem_objects to lock
12991299
* @num_objs: the number of additional &drm_gem_objects to lock
@@ -1588,7 +1588,7 @@ drm_gpuvm_bo_find(struct drm_gpuvm *gpuvm,
15881588
EXPORT_SYMBOL_GPL(drm_gpuvm_bo_find);
15891589

15901590
/**
1591-
* drm_gpuvm_bo_obtain() - obtains and instance of the &drm_gpuvm_bo for the
1591+
* drm_gpuvm_bo_obtain() - obtains an instance of the &drm_gpuvm_bo for the
15921592
* given &drm_gpuvm and &drm_gem_object
15931593
* @gpuvm: The &drm_gpuvm the @obj is mapped in.
15941594
* @obj: The &drm_gem_object being mapped in the @gpuvm.
@@ -1624,7 +1624,7 @@ drm_gpuvm_bo_obtain(struct drm_gpuvm *gpuvm,
16241624
EXPORT_SYMBOL_GPL(drm_gpuvm_bo_obtain);
16251625

16261626
/**
1627-
* drm_gpuvm_bo_obtain_prealloc() - obtains and instance of the &drm_gpuvm_bo
1627+
* drm_gpuvm_bo_obtain_prealloc() - obtains an instance of the &drm_gpuvm_bo
16281628
* for the given &drm_gpuvm and &drm_gem_object
16291629
* @__vm_bo: A pre-allocated struct drm_gpuvm_bo.
16301630
*
@@ -1688,7 +1688,7 @@ EXPORT_SYMBOL_GPL(drm_gpuvm_bo_extobj_add);
16881688
* @vm_bo: the &drm_gpuvm_bo to add or remove
16891689
* @evict: indicates whether the object is evicted
16901690
*
1691-
* Adds a &drm_gpuvm_bo to or removes it from the &drm_gpuvms evicted list.
1691+
* Adds a &drm_gpuvm_bo to or removes it from the &drm_gpuvm's evicted list.
16921692
*/
16931693
void
16941694
drm_gpuvm_bo_evict(struct drm_gpuvm_bo *vm_bo, bool evict)
@@ -1790,7 +1790,7 @@ __drm_gpuva_remove(struct drm_gpuva *va)
17901790
* drm_gpuva_remove() - remove a &drm_gpuva
17911791
* @va: the &drm_gpuva to remove
17921792
*
1793-
* This removes the given &va from the underlaying tree.
1793+
* This removes the given &va from the underlying tree.
17941794
*
17951795
* It is safe to use this function using the safe versions of iterating the GPU
17961796
* VA space, such as drm_gpuvm_for_each_va_safe() and
@@ -2358,7 +2358,7 @@ EXPORT_SYMBOL_GPL(drm_gpuvm_sm_map);
23582358
*
23592359
* This function iterates the given range of the GPU VA space. It utilizes the
23602360
* &drm_gpuvm_ops to call back into the driver providing the operations to
2361-
* unmap and, if required, split existent mappings.
2361+
* unmap and, if required, split existing mappings.
23622362
*
23632363
* Drivers may use these callbacks to update the GPU VA space right away within
23642364
* the callback. In case the driver decides to copy and store the operations for
@@ -2475,7 +2475,7 @@ static const struct drm_gpuvm_ops lock_ops = {
24752475
* required without the earlier DRIVER_OP_MAP. This is safe because we've
24762476
* already locked the GEM object in the earlier DRIVER_OP_MAP step.
24772477
*
2478-
* Returns: 0 on success or a negative error codec
2478+
* Returns: 0 on success or a negative error code
24792479
*/
24802480
int
24812481
drm_gpuvm_sm_map_exec_lock(struct drm_gpuvm *gpuvm,
@@ -2619,12 +2619,12 @@ static const struct drm_gpuvm_ops gpuvm_list_ops = {
26192619
* @req_offset: the offset within the &drm_gem_object
26202620
*
26212621
* This function creates a list of operations to perform splitting and merging
2622-
* of existent mapping(s) with the newly requested one.
2622+
* of existing mapping(s) with the newly requested one.
26232623
*
26242624
* The list can be iterated with &drm_gpuva_for_each_op and must be processed
26252625
* in the given order. It can contain map, unmap and remap operations, but it
26262626
* also can be empty if no operation is required, e.g. if the requested mapping
2627-
* already exists is the exact same way.
2627+
* already exists in the exact same way.
26282628
*
26292629
* There can be an arbitrary amount of unmap operations, a maximum of two remap
26302630
* operations and a single map operation. The latter one represents the original

drivers/gpu/drm/nouveau/dispnv50/wndw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,10 @@ static bool nv50_plane_format_mod_supported(struct drm_plane *plane,
795795
struct nouveau_drm *drm = nouveau_drm(plane->dev);
796796
uint8_t i;
797797

798+
/* All chipsets can display all formats in linear layout */
799+
if (modifier == DRM_FORMAT_MOD_LINEAR)
800+
return true;
801+
798802
if (drm->client.device.info.chipset < 0xc0) {
799803
const struct drm_format_info *info = drm_format_info(format);
800804
const uint8_t kind = (modifier >> 12) & 0xff;

0 commit comments

Comments
 (0)