Skip to content

Commit 97d9a4e

Browse files
committed
Merge tag 'drm-intel-fixes-2020-02-20' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
drm/i915 fixes for v5.6-rc3: - Workaround missing Display Stream Compression (DSC) state readout by forcing modeset when its enabled at probe - Fix EHL port clock voltage level requirements - Fix queuing retire workers on the virtual engine - Fix use of partially initialized waiters - Stop using drm_pci_alloc/drm_pci/free - Fix rewind of RING_TAIL by forcing a context reload - Fix locking on resetting ring->head - Propagate our bug filing URL change to stable kernels Signed-off-by: Dave Airlie <[email protected]> From: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents c1368b3 + 15de9cb commit 97d9a4e

19 files changed

+168
-108
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8392,7 +8392,7 @@ M: Joonas Lahtinen <[email protected]>
83928392
M: Rodrigo Vivi <[email protected]>
83938393
83948394
W: https://01.org/linuxgraphics/
8395-
B: https://01.org/linuxgraphics/documentation/how-report-bugs
8395+
B: https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs
83968396
C: irc://chat.freenode.net/intel-gfx
83978397
Q: http://patchwork.freedesktop.org/project/intel-gfx/
83988398
T: git git://anongit.freedesktop.org/drm-intel

drivers/gpu/drm/i915/Kconfig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ config DRM_I915_CAPTURE_ERROR
7575
help
7676
This option enables capturing the GPU state when a hang is detected.
7777
This information is vital for triaging hangs and assists in debugging.
78-
Please report any hang to
79-
https://bugs.freedesktop.org/enter_bug.cgi?product=DRI
80-
for triaging.
78+
Please report any hang for triaging according to:
79+
https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs
8180

8281
If in doubt, say "Y".
8382

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4251,7 +4251,9 @@ static bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
42514251
void intel_ddi_compute_min_voltage_level(struct drm_i915_private *dev_priv,
42524252
struct intel_crtc_state *crtc_state)
42534253
{
4254-
if (INTEL_GEN(dev_priv) >= 11 && crtc_state->port_clock > 594000)
4254+
if (IS_ELKHARTLAKE(dev_priv) && crtc_state->port_clock > 594000)
4255+
crtc_state->min_voltage_level = 3;
4256+
else if (INTEL_GEN(dev_priv) >= 11 && crtc_state->port_clock > 594000)
42554257
crtc_state->min_voltage_level = 1;
42564258
else if (IS_CANNONLAKE(dev_priv) && crtc_state->port_clock > 594000)
42574259
crtc_state->min_voltage_level = 2;

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11087,7 +11087,7 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
1108711087
u32 base;
1108811088

1108911089
if (INTEL_INFO(dev_priv)->display.cursor_needs_physical)
11090-
base = obj->phys_handle->busaddr;
11090+
base = sg_dma_address(obj->mm.pages->sgl);
1109111091
else
1109211092
base = intel_plane_ggtt_offset(plane_state);
1109311093

@@ -17433,6 +17433,24 @@ static int intel_initial_commit(struct drm_device *dev)
1743317433
* have readout for pipe gamma enable.
1743417434
*/
1743517435
crtc_state->uapi.color_mgmt_changed = true;
17436+
17437+
/*
17438+
* FIXME hack to force full modeset when DSC is being
17439+
* used.
17440+
*
17441+
* As long as we do not have full state readout and
17442+
* config comparison of crtc_state->dsc, we have no way
17443+
* to ensure reliable fastset. Remove once we have
17444+
* readout for DSC.
17445+
*/
17446+
if (crtc_state->dsc.compression_enable) {
17447+
ret = drm_atomic_add_affected_connectors(state,
17448+
&crtc->base);
17449+
if (ret)
17450+
goto out;
17451+
crtc_state->uapi.mode_changed = true;
17452+
drm_dbg_kms(dev, "Force full modeset for DSC\n");
17453+
}
1743617454
}
1743717455
}
1743817456

drivers/gpu/drm/i915/gem/i915_gem_context.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,22 @@ static int __context_set_persistence(struct i915_gem_context *ctx, bool state)
565565
if (!(ctx->i915->caps.scheduler & I915_SCHEDULER_CAP_PREEMPTION))
566566
return -ENODEV;
567567

568+
/*
569+
* If the cancel fails, we then need to reset, cleanly!
570+
*
571+
* If the per-engine reset fails, all hope is lost! We resort
572+
* to a full GPU reset in that unlikely case, but realistically
573+
* if the engine could not reset, the full reset does not fare
574+
* much better. The damage has been done.
575+
*
576+
* However, if we cannot reset an engine by itself, we cannot
577+
* cleanup a hanging persistent context without causing
578+
* colateral damage, and we should not pretend we can by
579+
* exposing the interface.
580+
*/
581+
if (!intel_has_reset_engine(&ctx->i915->gt))
582+
return -ENODEV;
583+
568584
i915_gem_context_clear_persistence(ctx);
569585
}
570586

drivers/gpu/drm/i915/gem/i915_gem_object_types.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,6 @@ struct drm_i915_gem_object {
285285

286286
void *gvt_info;
287287
};
288-
289-
/** for phys allocated objects */
290-
struct drm_dma_handle *phys_handle;
291288
};
292289

293290
static inline struct drm_i915_gem_object *

drivers/gpu/drm/i915/gem/i915_gem_phys.c

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22,88 +22,87 @@
2222
static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
2323
{
2424
struct address_space *mapping = obj->base.filp->f_mapping;
25-
struct drm_dma_handle *phys;
26-
struct sg_table *st;
2725
struct scatterlist *sg;
28-
char *vaddr;
26+
struct sg_table *st;
27+
dma_addr_t dma;
28+
void *vaddr;
29+
void *dst;
2930
int i;
30-
int err;
3131

3232
if (WARN_ON(i915_gem_object_needs_bit17_swizzle(obj)))
3333
return -EINVAL;
3434

35-
/* Always aligning to the object size, allows a single allocation
35+
/*
36+
* Always aligning to the object size, allows a single allocation
3637
* to handle all possible callers, and given typical object sizes,
3738
* the alignment of the buddy allocation will naturally match.
3839
*/
39-
phys = drm_pci_alloc(obj->base.dev,
40-
roundup_pow_of_two(obj->base.size),
41-
roundup_pow_of_two(obj->base.size));
42-
if (!phys)
40+
vaddr = dma_alloc_coherent(&obj->base.dev->pdev->dev,
41+
roundup_pow_of_two(obj->base.size),
42+
&dma, GFP_KERNEL);
43+
if (!vaddr)
4344
return -ENOMEM;
4445

45-
vaddr = phys->vaddr;
46+
st = kmalloc(sizeof(*st), GFP_KERNEL);
47+
if (!st)
48+
goto err_pci;
49+
50+
if (sg_alloc_table(st, 1, GFP_KERNEL))
51+
goto err_st;
52+
53+
sg = st->sgl;
54+
sg->offset = 0;
55+
sg->length = obj->base.size;
56+
57+
sg_assign_page(sg, (struct page *)vaddr);
58+
sg_dma_address(sg) = dma;
59+
sg_dma_len(sg) = obj->base.size;
60+
61+
dst = vaddr;
4662
for (i = 0; i < obj->base.size / PAGE_SIZE; i++) {
4763
struct page *page;
48-
char *src;
64+
void *src;
4965

5066
page = shmem_read_mapping_page(mapping, i);
51-
if (IS_ERR(page)) {
52-
err = PTR_ERR(page);
53-
goto err_phys;
54-
}
67+
if (IS_ERR(page))
68+
goto err_st;
5569

5670
src = kmap_atomic(page);
57-
memcpy(vaddr, src, PAGE_SIZE);
58-
drm_clflush_virt_range(vaddr, PAGE_SIZE);
71+
memcpy(dst, src, PAGE_SIZE);
72+
drm_clflush_virt_range(dst, PAGE_SIZE);
5973
kunmap_atomic(src);
6074

6175
put_page(page);
62-
vaddr += PAGE_SIZE;
76+
dst += PAGE_SIZE;
6377
}
6478

6579
intel_gt_chipset_flush(&to_i915(obj->base.dev)->gt);
6680

67-
st = kmalloc(sizeof(*st), GFP_KERNEL);
68-
if (!st) {
69-
err = -ENOMEM;
70-
goto err_phys;
71-
}
72-
73-
if (sg_alloc_table(st, 1, GFP_KERNEL)) {
74-
kfree(st);
75-
err = -ENOMEM;
76-
goto err_phys;
77-
}
78-
79-
sg = st->sgl;
80-
sg->offset = 0;
81-
sg->length = obj->base.size;
82-
83-
sg_dma_address(sg) = phys->busaddr;
84-
sg_dma_len(sg) = obj->base.size;
85-
86-
obj->phys_handle = phys;
87-
8881
__i915_gem_object_set_pages(obj, st, sg->length);
8982

9083
return 0;
9184

92-
err_phys:
93-
drm_pci_free(obj->base.dev, phys);
94-
95-
return err;
85+
err_st:
86+
kfree(st);
87+
err_pci:
88+
dma_free_coherent(&obj->base.dev->pdev->dev,
89+
roundup_pow_of_two(obj->base.size),
90+
vaddr, dma);
91+
return -ENOMEM;
9692
}
9793

9894
static void
9995
i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
10096
struct sg_table *pages)
10197
{
98+
dma_addr_t dma = sg_dma_address(pages->sgl);
99+
void *vaddr = sg_page(pages->sgl);
100+
102101
__i915_gem_object_release_shmem(obj, pages, false);
103102

104103
if (obj->mm.dirty) {
105104
struct address_space *mapping = obj->base.filp->f_mapping;
106-
char *vaddr = obj->phys_handle->vaddr;
105+
void *src = vaddr;
107106
int i;
108107

109108
for (i = 0; i < obj->base.size / PAGE_SIZE; i++) {
@@ -115,23 +114,26 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
115114
continue;
116115

117116
dst = kmap_atomic(page);
118-
drm_clflush_virt_range(vaddr, PAGE_SIZE);
119-
memcpy(dst, vaddr, PAGE_SIZE);
117+
drm_clflush_virt_range(src, PAGE_SIZE);
118+
memcpy(dst, src, PAGE_SIZE);
120119
kunmap_atomic(dst);
121120

122121
set_page_dirty(page);
123122
if (obj->mm.madv == I915_MADV_WILLNEED)
124123
mark_page_accessed(page);
125124
put_page(page);
126-
vaddr += PAGE_SIZE;
125+
126+
src += PAGE_SIZE;
127127
}
128128
obj->mm.dirty = false;
129129
}
130130

131131
sg_free_table(pages);
132132
kfree(pages);
133133

134-
drm_pci_free(obj->base.dev, obj->phys_handle);
134+
dma_free_coherent(&obj->base.dev->pdev->dev,
135+
roundup_pow_of_two(obj->base.size),
136+
vaddr, dma);
135137
}
136138

137139
static void phys_release(struct drm_i915_gem_object *obj)

drivers/gpu/drm/i915/gt/intel_breadcrumbs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ static void add_retire(struct intel_breadcrumbs *b, struct intel_timeline *tl)
136136
struct intel_engine_cs *engine =
137137
container_of(b, struct intel_engine_cs, breadcrumbs);
138138

139+
if (unlikely(intel_engine_is_virtual(engine)))
140+
engine = intel_virtual_engine_get_sibling(engine, 0);
141+
139142
intel_engine_add_retire(engine, tl);
140143
}
141144

drivers/gpu/drm/i915/gt/intel_gt_requests.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ static bool add_retire(struct intel_engine_cs *engine,
9999
void intel_engine_add_retire(struct intel_engine_cs *engine,
100100
struct intel_timeline *tl)
101101
{
102+
/* We don't deal well with the engine disappearing beneath us */
103+
GEM_BUG_ON(intel_engine_is_virtual(engine));
104+
102105
if (add_retire(engine, tl))
103106
schedule_work(&engine->retire_work);
104107
}

0 commit comments

Comments
 (0)