Skip to content

Commit f8ca7b7

Browse files
committed
Merge tag 'drm-misc-next-fixes-2021-11-10' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
Removed the TTM Huge Page functionnality to address a crash, a timeout fix for udl, CONFIG_FB dependency improvements, a fix for a circular locking depency in imx, a NULL pointer dereference fix for virtio, and a naming collision fix for drm/locking. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20211110082114.vfpkpnecwdfg27lk@gilmour
2 parents 917a6f0 + bcae3af commit f8ca7b7

14 files changed

Lines changed: 23 additions & 193 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6154,8 +6154,7 @@ T: git git://anongit.freedesktop.org/drm/drm
61546154
F: Documentation/devicetree/bindings/display/
61556155
F: Documentation/devicetree/bindings/gpu/
61566156
F: Documentation/gpu/
6157-
F: drivers/gpu/drm/
6158-
F: drivers/gpu/vga/
6157+
F: drivers/gpu/
61596158
F: include/drm/
61606159
F: include/linux/vga*
61616160
F: include/uapi/drm/

drivers/gpu/drm/Kconfig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ config DRM_DEBUG_MODESET_LOCK
117117

118118
config DRM_FBDEV_EMULATION
119119
bool "Enable legacy fbdev support for your modesetting driver"
120-
depends on DRM
121-
depends on FB=y || FB=DRM
122-
select DRM_KMS_HELPER
120+
depends on DRM_KMS_HELPER
121+
depends on FB=y || FB=DRM_KMS_HELPER
123122
select FB_CFB_FILLRECT
124123
select FB_CFB_COPYAREA
125124
select FB_CFB_IMAGEBLIT

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ static vm_fault_t amdgpu_gem_fault(struct vm_fault *vmf)
6060
goto unlock;
6161
}
6262

63-
ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
64-
TTM_BO_VM_NUM_PREFAULT, 1);
65-
drm_dev_exit(idx);
63+
ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
64+
TTM_BO_VM_NUM_PREFAULT);
65+
66+
drm_dev_exit(idx);
6667
} else {
6768
ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot);
6869
}

drivers/gpu/drm/drm_modeset_lock.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
static DEFINE_WW_CLASS(crtc_ww_class);
8080

8181
#if IS_ENABLED(CONFIG_DRM_DEBUG_MODESET_LOCK)
82-
static noinline depot_stack_handle_t __stack_depot_save(void)
82+
static noinline depot_stack_handle_t __drm_stack_depot_save(void)
8383
{
8484
unsigned long entries[8];
8585
unsigned int n;
@@ -89,7 +89,7 @@ static noinline depot_stack_handle_t __stack_depot_save(void)
8989
return stack_depot_save(entries, n, GFP_NOWAIT | __GFP_NOWARN);
9090
}
9191

92-
static void __stack_depot_print(depot_stack_handle_t stack_depot)
92+
static void __drm_stack_depot_print(depot_stack_handle_t stack_depot)
9393
{
9494
struct drm_printer p = drm_debug_printer("drm_modeset_lock");
9595
unsigned long *entries;
@@ -108,11 +108,11 @@ static void __stack_depot_print(depot_stack_handle_t stack_depot)
108108
kfree(buf);
109109
}
110110
#else /* CONFIG_DRM_DEBUG_MODESET_LOCK */
111-
static depot_stack_handle_t __stack_depot_save(void)
111+
static depot_stack_handle_t __drm_stack_depot_save(void)
112112
{
113113
return 0;
114114
}
115-
static void __stack_depot_print(depot_stack_handle_t stack_depot)
115+
static void __drm_stack_depot_print(depot_stack_handle_t stack_depot)
116116
{
117117
}
118118
#endif /* CONFIG_DRM_DEBUG_MODESET_LOCK */
@@ -266,7 +266,7 @@ EXPORT_SYMBOL(drm_modeset_acquire_fini);
266266
void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx)
267267
{
268268
if (WARN_ON(ctx->contended))
269-
__stack_depot_print(ctx->stack_depot);
269+
__drm_stack_depot_print(ctx->stack_depot);
270270

271271
while (!list_empty(&ctx->locked)) {
272272
struct drm_modeset_lock *lock;
@@ -286,7 +286,7 @@ static inline int modeset_lock(struct drm_modeset_lock *lock,
286286
int ret;
287287

288288
if (WARN_ON(ctx->contended))
289-
__stack_depot_print(ctx->stack_depot);
289+
__drm_stack_depot_print(ctx->stack_depot);
290290

291291
if (ctx->trylock_only) {
292292
lockdep_assert_held(&ctx->ww_ctx);
@@ -317,7 +317,7 @@ static inline int modeset_lock(struct drm_modeset_lock *lock,
317317
ret = 0;
318318
} else if (ret == -EDEADLK) {
319319
ctx->contended = lock;
320-
ctx->stack_depot = __stack_depot_save();
320+
ctx->stack_depot = __drm_stack_depot_save();
321321
}
322322

323323
return ret;

drivers/gpu/drm/imx/imx-drm-core.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
8181
struct drm_plane_state *old_plane_state, *new_plane_state;
8282
bool plane_disabling = false;
8383
int i;
84-
bool fence_cookie = dma_fence_begin_signalling();
8584

8685
drm_atomic_helper_commit_modeset_disables(dev, state);
8786

@@ -112,7 +111,6 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
112111
}
113112

114113
drm_atomic_helper_commit_hw_done(state);
115-
dma_fence_end_signalling(fence_cookie);
116114
}
117115

118116
static const struct drm_mode_config_helper_funcs imx_drm_mode_config_helpers = {

drivers/gpu/drm/nouveau/nouveau_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf)
5656

5757
nouveau_bo_del_io_reserve_lru(bo);
5858
prot = vm_get_page_prot(vma->vm_flags);
59-
ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT, 1);
59+
ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT);
6060
nouveau_bo_add_io_reserve_lru(bo);
6161
if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
6262
return ret;

drivers/gpu/drm/radeon/radeon_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static vm_fault_t radeon_gem_fault(struct vm_fault *vmf)
6161
goto unlock_resv;
6262

6363
ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
64-
TTM_BO_VM_NUM_PREFAULT, 1);
64+
TTM_BO_VM_NUM_PREFAULT);
6565
if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
6666
goto unlock_mclk;
6767

drivers/gpu/drm/ttm/ttm_bo_vm.c

Lines changed: 2 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -173,97 +173,13 @@ vm_fault_t ttm_bo_vm_reserve(struct ttm_buffer_object *bo,
173173
}
174174
EXPORT_SYMBOL(ttm_bo_vm_reserve);
175175

176-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
177-
/**
178-
* ttm_bo_vm_insert_huge - Insert a pfn for PUD or PMD faults
179-
* @vmf: Fault data
180-
* @bo: The buffer object
181-
* @page_offset: Page offset from bo start
182-
* @fault_page_size: The size of the fault in pages.
183-
* @pgprot: The page protections.
184-
* Does additional checking whether it's possible to insert a PUD or PMD
185-
* pfn and performs the insertion.
186-
*
187-
* Return: VM_FAULT_NOPAGE on successful insertion, VM_FAULT_FALLBACK if
188-
* a huge fault was not possible, or on insertion error.
189-
*/
190-
static vm_fault_t ttm_bo_vm_insert_huge(struct vm_fault *vmf,
191-
struct ttm_buffer_object *bo,
192-
pgoff_t page_offset,
193-
pgoff_t fault_page_size,
194-
pgprot_t pgprot)
195-
{
196-
pgoff_t i;
197-
vm_fault_t ret;
198-
unsigned long pfn;
199-
pfn_t pfnt;
200-
struct ttm_tt *ttm = bo->ttm;
201-
bool write = vmf->flags & FAULT_FLAG_WRITE;
202-
203-
/* Fault should not cross bo boundary. */
204-
page_offset &= ~(fault_page_size - 1);
205-
if (page_offset + fault_page_size > bo->resource->num_pages)
206-
goto out_fallback;
207-
208-
if (bo->resource->bus.is_iomem)
209-
pfn = ttm_bo_io_mem_pfn(bo, page_offset);
210-
else
211-
pfn = page_to_pfn(ttm->pages[page_offset]);
212-
213-
/* pfn must be fault_page_size aligned. */
214-
if ((pfn & (fault_page_size - 1)) != 0)
215-
goto out_fallback;
216-
217-
/* Check that memory is contiguous. */
218-
if (!bo->resource->bus.is_iomem) {
219-
for (i = 1; i < fault_page_size; ++i) {
220-
if (page_to_pfn(ttm->pages[page_offset + i]) != pfn + i)
221-
goto out_fallback;
222-
}
223-
} else if (bo->bdev->funcs->io_mem_pfn) {
224-
for (i = 1; i < fault_page_size; ++i) {
225-
if (ttm_bo_io_mem_pfn(bo, page_offset + i) != pfn + i)
226-
goto out_fallback;
227-
}
228-
}
229-
230-
pfnt = __pfn_to_pfn_t(pfn, PFN_DEV);
231-
if (fault_page_size == (HPAGE_PMD_SIZE >> PAGE_SHIFT))
232-
ret = vmf_insert_pfn_pmd_prot(vmf, pfnt, pgprot, write);
233-
#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
234-
else if (fault_page_size == (HPAGE_PUD_SIZE >> PAGE_SHIFT))
235-
ret = vmf_insert_pfn_pud_prot(vmf, pfnt, pgprot, write);
236-
#endif
237-
else
238-
WARN_ON_ONCE(ret = VM_FAULT_FALLBACK);
239-
240-
if (ret != VM_FAULT_NOPAGE)
241-
goto out_fallback;
242-
243-
return VM_FAULT_NOPAGE;
244-
out_fallback:
245-
count_vm_event(THP_FAULT_FALLBACK);
246-
return VM_FAULT_FALLBACK;
247-
}
248-
#else
249-
static vm_fault_t ttm_bo_vm_insert_huge(struct vm_fault *vmf,
250-
struct ttm_buffer_object *bo,
251-
pgoff_t page_offset,
252-
pgoff_t fault_page_size,
253-
pgprot_t pgprot)
254-
{
255-
return VM_FAULT_FALLBACK;
256-
}
257-
#endif
258-
259176
/**
260177
* ttm_bo_vm_fault_reserved - TTM fault helper
261178
* @vmf: The struct vm_fault given as argument to the fault callback
262179
* @prot: The page protection to be used for this memory area.
263180
* @num_prefault: Maximum number of prefault pages. The caller may want to
264181
* specify this based on madvice settings and the size of the GPU object
265182
* backed by the memory.
266-
* @fault_page_size: The size of the fault in pages.
267183
*
268184
* This function inserts one or more page table entries pointing to the
269185
* memory backing the buffer object, and then returns a return code
@@ -277,8 +193,7 @@ static vm_fault_t ttm_bo_vm_insert_huge(struct vm_fault *vmf,
277193
*/
278194
vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
279195
pgprot_t prot,
280-
pgoff_t num_prefault,
281-
pgoff_t fault_page_size)
196+
pgoff_t num_prefault)
282197
{
283198
struct vm_area_struct *vma = vmf->vma;
284199
struct ttm_buffer_object *bo = vma->vm_private_data;
@@ -329,11 +244,6 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
329244
prot = pgprot_decrypted(prot);
330245
}
331246

332-
/* We don't prefault on huge faults. Yet. */
333-
if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && fault_page_size != 1)
334-
return ttm_bo_vm_insert_huge(vmf, bo, page_offset,
335-
fault_page_size, prot);
336-
337247
/*
338248
* Speculatively prefault a number of pages. Only error on
339249
* first page.
@@ -429,7 +339,7 @@ vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
429339

430340
prot = vma->vm_page_prot;
431341
if (drm_dev_enter(ddev, &idx)) {
432-
ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT, 1);
342+
ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT);
433343
drm_dev_exit(idx);
434344
} else {
435345
ret = ttm_bo_vm_dummy_page(vmf, prot);

drivers/gpu/drm/udl/udl_connector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static int udl_get_edid_block(void *data, u8 *buf, unsigned int block,
3030
int bval = (i + block * EDID_LENGTH) << 8;
3131
ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
3232
0x02, (0x80 | (0x02 << 5)), bval,
33-
0xA1, read_buff, 2, HZ);
33+
0xA1, read_buff, 2, 1000);
3434
if (ret < 1) {
3535
DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
3636
kfree(read_buff);

drivers/gpu/drm/virtio/virtgpu_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ static __poll_t virtio_gpu_poll(struct file *filp,
163163
struct drm_file *drm_file = filp->private_data;
164164
struct virtio_gpu_fpriv *vfpriv = drm_file->driver_priv;
165165
struct drm_device *dev = drm_file->minor->dev;
166+
struct virtio_gpu_device *vgdev = dev->dev_private;
166167
struct drm_pending_event *e = NULL;
167168
__poll_t mask = 0;
168169

169-
if (!vfpriv->ring_idx_mask)
170+
if (!vgdev->has_virgl_3d || !vfpriv || !vfpriv->ring_idx_mask)
170171
return drm_poll(filp, wait);
171172

172173
poll_wait(filp, &drm_file->event_wait, wait);

0 commit comments

Comments
 (0)