Skip to content

Commit 2819cf0

Browse files
committed
Merge tag 'drm-misc-next-2021-08-12' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for v5.15: UAPI Changes: Cross-subsystem Changes: - Add lockdep_assert(once) helpers. Core Changes: - Add lockdep assert to drm_is_current_master_locked. - Fix typos in dma-buf documentation. - Mark drm irq midlayer as legacy only. - Fix GPF in udmabuf_create. - Rename member to correct value in drm_edid.h Driver Changes: - Build fix to make nouveau build with NOUVEAU_BACKLIGHT. - Add MI101AIT-ICP1, LTTD800480070-L6WWH-RT panels. - Assorted fixes to bridge/it66121, anx7625. - Add custom crtc_state to simple helpers, and use it to convert pll handling in mgag200 to atomic. - Convert drivers to use offset-adjusted framebuffer bo mappings. - Assorted small fixes and fix for a use-after-free in vmwgfx. - Convert remaining callers of non-legacy drivers to use linux irqs directly. - Small cleanup in ingenic. - Small fixes to virtio and ti-sn65dsi86. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents a22c074 + c778244 commit 2819cf0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1975
-1338
lines changed

drivers/dma-buf/udmabuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ static long udmabuf_create(struct miscdevice *device,
227227
if (!hpage) {
228228
hpage = find_get_page_flags(mapping, pgoff,
229229
FGP_ACCESSED);
230-
if (IS_ERR(hpage)) {
231-
ret = PTR_ERR(hpage);
230+
if (!hpage) {
231+
ret = -EINVAL;
232232
goto err;
233233
}
234234
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,6 @@ static const struct drm_driver amdgpu_kms_driver = {
17861786
.open = amdgpu_driver_open_kms,
17871787
.postclose = amdgpu_driver_postclose_kms,
17881788
.lastclose = amdgpu_driver_lastclose_kms,
1789-
.irq_handler = amdgpu_irq_handler,
17901789
.ioctls = amdgpu_ioctls_kms,
17911790
.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
17921791
.dumb_create = amdgpu_mode_dumb_create,

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include <linux/pci.h>
4747

4848
#include <drm/drm_crtc_helper.h>
49-
#include <drm/drm_irq.h>
5049
#include <drm/drm_vblank.h>
5150
#include <drm/amdgpu_drm.h>
5251
#include <drm/drm_drv.h>
@@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
184183
* Returns:
185184
* result of handling the IRQ, as defined by &irqreturn_t
186185
*/
187-
irqreturn_t amdgpu_irq_handler(int irq, void *arg)
186+
static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
188187
{
189188
struct drm_device *dev = (struct drm_device *) arg;
190189
struct amdgpu_device *adev = drm_to_adev(dev);
@@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
307306
int amdgpu_irq_init(struct amdgpu_device *adev)
308307
{
309308
int r = 0;
309+
unsigned int irq;
310310

311311
spin_lock_init(&adev->irq.lock);
312312

@@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
349349
INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
350350
INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
351351

352-
adev->irq.installed = true;
353-
/* Use vector 0 for MSI-X */
354-
r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
352+
/* Use vector 0 for MSI-X. */
353+
r = pci_irq_vector(adev->pdev, 0);
354+
if (r < 0)
355+
return r;
356+
irq = r;
357+
358+
/* PCI devices require shared interrupts. */
359+
r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
360+
adev_to_drm(adev));
355361
if (r) {
356-
adev->irq.installed = false;
357362
if (!amdgpu_device_has_dc_support(adev))
358363
flush_work(&adev->hotplug_work);
359364
return r;
360365
}
366+
adev->irq.installed = true;
367+
adev->irq.irq = irq;
361368
adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
362369

363370
DRM_DEBUG("amdgpu: irq initialized.\n");
@@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
368375
void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
369376
{
370377
if (adev->irq.installed) {
371-
drm_irq_uninstall(&adev->ddev);
378+
free_irq(adev->irq.irq, adev_to_drm(adev));
372379
adev->irq.installed = false;
373380
if (adev->irq.msi_enabled)
374381
pci_free_irq_vectors(adev->pdev);

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
8080

8181
struct amdgpu_irq {
8282
bool installed;
83+
unsigned int irq;
8384
spinlock_t lock;
8485
/* interrupt sources */
8586
struct amdgpu_irq_client client[AMDGPU_IRQ_CLIENTID_MAX];
@@ -100,7 +101,6 @@ struct amdgpu_irq {
100101
};
101102

102103
void amdgpu_irq_disable_all(struct amdgpu_device *adev);
103-
irqreturn_t amdgpu_irq_handler(int irq, void *arg);
104104

105105
int amdgpu_irq_init(struct amdgpu_device *adev);
106106
void amdgpu_irq_fini_sw(struct amdgpu_device *adev);

drivers/gpu/drm/arm/hdlcd_drv.c

Lines changed: 96 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <drm/drm_fb_helper.h>
3030
#include <drm/drm_gem_cma_helper.h>
3131
#include <drm/drm_gem_framebuffer_helper.h>
32-
#include <drm/drm_irq.h>
3332
#include <drm/drm_modeset_helper.h>
3433
#include <drm/drm_of.h>
3534
#include <drm/drm_probe_helper.h>
@@ -38,6 +37,94 @@
3837
#include "hdlcd_drv.h"
3938
#include "hdlcd_regs.h"
4039

40+
static irqreturn_t hdlcd_irq(int irq, void *arg)
41+
{
42+
struct drm_device *drm = arg;
43+
struct hdlcd_drm_private *hdlcd = drm->dev_private;
44+
unsigned long irq_status;
45+
46+
irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
47+
48+
#ifdef CONFIG_DEBUG_FS
49+
if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
50+
atomic_inc(&hdlcd->buffer_underrun_count);
51+
52+
if (irq_status & HDLCD_INTERRUPT_DMA_END)
53+
atomic_inc(&hdlcd->dma_end_count);
54+
55+
if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
56+
atomic_inc(&hdlcd->bus_error_count);
57+
58+
if (irq_status & HDLCD_INTERRUPT_VSYNC)
59+
atomic_inc(&hdlcd->vsync_count);
60+
61+
#endif
62+
if (irq_status & HDLCD_INTERRUPT_VSYNC)
63+
drm_crtc_handle_vblank(&hdlcd->crtc);
64+
65+
/* acknowledge interrupt(s) */
66+
hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
67+
68+
return IRQ_HANDLED;
69+
}
70+
71+
static void hdlcd_irq_preinstall(struct drm_device *drm)
72+
{
73+
struct hdlcd_drm_private *hdlcd = drm->dev_private;
74+
/* Ensure interrupts are disabled */
75+
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
76+
hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
77+
}
78+
79+
static void hdlcd_irq_postinstall(struct drm_device *drm)
80+
{
81+
#ifdef CONFIG_DEBUG_FS
82+
struct hdlcd_drm_private *hdlcd = drm->dev_private;
83+
unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
84+
85+
/* enable debug interrupts */
86+
irq_mask |= HDLCD_DEBUG_INT_MASK;
87+
88+
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
89+
#endif
90+
}
91+
92+
static int hdlcd_irq_install(struct drm_device *drm, int irq)
93+
{
94+
int ret;
95+
96+
if (irq == IRQ_NOTCONNECTED)
97+
return -ENOTCONN;
98+
99+
hdlcd_irq_preinstall(drm);
100+
101+
ret = request_irq(irq, hdlcd_irq, 0, drm->driver->name, drm);
102+
if (ret)
103+
return ret;
104+
105+
hdlcd_irq_postinstall(drm);
106+
107+
return 0;
108+
}
109+
110+
static void hdlcd_irq_uninstall(struct drm_device *drm)
111+
{
112+
struct hdlcd_drm_private *hdlcd = drm->dev_private;
113+
/* disable all the interrupts that we might have enabled */
114+
unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
115+
116+
#ifdef CONFIG_DEBUG_FS
117+
/* disable debug interrupts */
118+
irq_mask &= ~HDLCD_DEBUG_INT_MASK;
119+
#endif
120+
121+
/* disable vsync interrupts */
122+
irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
123+
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
124+
125+
free_irq(hdlcd->irq, drm);
126+
}
127+
41128
static int hdlcd_load(struct drm_device *drm, unsigned long flags)
42129
{
43130
struct hdlcd_drm_private *hdlcd = drm->dev_private;
@@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
90177
goto setup_fail;
91178
}
92179

93-
ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
180+
ret = platform_get_irq(pdev, 0);
181+
if (ret < 0)
182+
goto irq_fail;
183+
hdlcd->irq = ret;
184+
185+
ret = hdlcd_irq_install(drm, hdlcd->irq);
94186
if (ret < 0) {
95187
DRM_ERROR("failed to install IRQ handler\n");
96188
goto irq_fail;
@@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
122214
drm->mode_config.funcs = &hdlcd_mode_config_funcs;
123215
}
124216

125-
static irqreturn_t hdlcd_irq(int irq, void *arg)
126-
{
127-
struct drm_device *drm = arg;
128-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
129-
unsigned long irq_status;
130-
131-
irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
132-
133-
#ifdef CONFIG_DEBUG_FS
134-
if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
135-
atomic_inc(&hdlcd->buffer_underrun_count);
136-
137-
if (irq_status & HDLCD_INTERRUPT_DMA_END)
138-
atomic_inc(&hdlcd->dma_end_count);
139-
140-
if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
141-
atomic_inc(&hdlcd->bus_error_count);
142-
143-
if (irq_status & HDLCD_INTERRUPT_VSYNC)
144-
atomic_inc(&hdlcd->vsync_count);
145-
146-
#endif
147-
if (irq_status & HDLCD_INTERRUPT_VSYNC)
148-
drm_crtc_handle_vblank(&hdlcd->crtc);
149-
150-
/* acknowledge interrupt(s) */
151-
hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
152-
153-
return IRQ_HANDLED;
154-
}
155-
156-
static void hdlcd_irq_preinstall(struct drm_device *drm)
157-
{
158-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
159-
/* Ensure interrupts are disabled */
160-
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
161-
hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
162-
}
163-
164-
static int hdlcd_irq_postinstall(struct drm_device *drm)
165-
{
166-
#ifdef CONFIG_DEBUG_FS
167-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
168-
unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
169-
170-
/* enable debug interrupts */
171-
irq_mask |= HDLCD_DEBUG_INT_MASK;
172-
173-
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
174-
#endif
175-
return 0;
176-
}
177-
178-
static void hdlcd_irq_uninstall(struct drm_device *drm)
179-
{
180-
struct hdlcd_drm_private *hdlcd = drm->dev_private;
181-
/* disable all the interrupts that we might have enabled */
182-
unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
183-
184-
#ifdef CONFIG_DEBUG_FS
185-
/* disable debug interrupts */
186-
irq_mask &= ~HDLCD_DEBUG_INT_MASK;
187-
#endif
188-
189-
/* disable vsync interrupts */
190-
irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
191-
192-
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
193-
}
194-
195217
#ifdef CONFIG_DEBUG_FS
196218
static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
197219
{
@@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
236258

237259
static const struct drm_driver hdlcd_driver = {
238260
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
239-
.irq_handler = hdlcd_irq,
240-
.irq_preinstall = hdlcd_irq_preinstall,
241-
.irq_postinstall = hdlcd_irq_postinstall,
242-
.irq_uninstall = hdlcd_irq_uninstall,
243261
DRM_GEM_CMA_DRIVER_OPS,
244262
#ifdef CONFIG_DEBUG_FS
245263
.debugfs_init = hdlcd_debugfs_init,
@@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
316334
err_unload:
317335
of_node_put(hdlcd->crtc.port);
318336
hdlcd->crtc.port = NULL;
319-
drm_irq_uninstall(drm);
337+
hdlcd_irq_uninstall(drm);
320338
of_reserved_mem_device_release(drm->dev);
321339
err_free:
322340
drm_mode_config_cleanup(drm);
@@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
338356
hdlcd->crtc.port = NULL;
339357
pm_runtime_get_sync(dev);
340358
drm_atomic_helper_shutdown(drm);
341-
drm_irq_uninstall(drm);
359+
hdlcd_irq_uninstall(drm);
342360
pm_runtime_put(dev);
343361
if (pm_runtime_enabled(dev))
344362
pm_runtime_disable(dev);

drivers/gpu/drm/arm/hdlcd_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct hdlcd_drm_private {
1111
struct clk *clk;
1212
struct drm_crtc crtc;
1313
struct drm_plane *plane;
14+
unsigned int irq;
1415
#ifdef CONFIG_DEBUG_FS
1516
atomic_t buffer_underrun_count;
1617
atomic_t bus_error_count;

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane,
808808
ast_cursor_plane->hwc[ast_cursor_plane->next_hwc_index].map;
809809
u64 dst_off =
810810
ast_cursor_plane->hwc[ast_cursor_plane->next_hwc_index].off;
811-
struct dma_buf_map src_map = shadow_plane_state->map[0];
811+
struct dma_buf_map src_map = shadow_plane_state->data[0];
812812
unsigned int offset_x, offset_y;
813813
u16 x, y;
814814
u8 x_offset, y_offset;

0 commit comments

Comments
 (0)