Skip to content

Commit 83cd3be

Browse files
committed
Merge tag 'drm-xe-fixes-2024-01-25' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
Driver Changes: - Make an ops struct static - Fix an implicit 0 to NULL conversion - A couple of 32-bit fixes - A migration coherency fix for Lunar Lake. - An error path vm id leak fix - Remove PVC references in kunit tests Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ZbIb7l0EhpVp5cXE@fedora
2 parents b16702b + 9e3a13f commit 83cd3be

8 files changed

Lines changed: 31 additions & 30 deletions

File tree

drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
3535
u32 ofs, u64 *ptr, u32 size)
3636
{
3737
struct ttm_bo_kmap_obj map;
38-
void *virtual;
38+
void *src;
3939
bool is_iomem;
4040
int ret;
4141

42-
XE_WARN_ON(size != 8);
43-
4442
ret = xe_bo_lock(bo, true);
4543
if (ret)
4644
return ret;
@@ -50,11 +48,12 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
5048
goto out_unlock;
5149

5250
ofs &= ~PAGE_MASK;
53-
virtual = ttm_kmap_obj_virtual(&map, &is_iomem);
51+
src = ttm_kmap_obj_virtual(&map, &is_iomem);
52+
src += ofs;
5453
if (is_iomem)
55-
*ptr = readq((void __iomem *)(virtual + ofs));
54+
memcpy_fromio(ptr, (void __iomem *)src, size);
5655
else
57-
*ptr = *(u64 *)(virtual + ofs);
56+
memcpy(ptr, src, size);
5857

5958
ttm_bo_kunmap(&map);
6059
out_unlock:

drivers/gpu/drm/xe/tests/xe_wa_test.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ static const struct platform_test_case cases[] = {
7474
SUBPLATFORM_CASE(DG2, G11, B1),
7575
SUBPLATFORM_CASE(DG2, G12, A0),
7676
SUBPLATFORM_CASE(DG2, G12, A1),
77-
PLATFORM_CASE(PVC, B0),
78-
PLATFORM_CASE(PVC, B1),
79-
PLATFORM_CASE(PVC, C0),
8077
GMDID_CASE(METEORLAKE, 1270, A0, 1300, A0),
8178
GMDID_CASE(METEORLAKE, 1271, A0, 1300, A0),
8279
GMDID_CASE(LUNARLAKE, 2004, A0, 2000, A0),

drivers/gpu/drm/xe/xe_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ void xe_device_wmb(struct xe_device *xe)
613613
u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size)
614614
{
615615
return xe_device_has_flat_ccs(xe) ?
616-
DIV_ROUND_UP(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0;
616+
DIV_ROUND_UP_ULL(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0;
617617
}
618618

619619
bool xe_device_mem_access_ongoing(struct xe_device *xe)

drivers/gpu/drm/xe/xe_dma_buf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static int xe_dma_buf_begin_cpu_access(struct dma_buf *dma_buf,
175175
return 0;
176176
}
177177

178-
const struct dma_buf_ops xe_dmabuf_ops = {
178+
static const struct dma_buf_ops xe_dmabuf_ops = {
179179
.attach = xe_dma_buf_attach,
180180
.detach = xe_dma_buf_detach,
181181
.pin = xe_dma_buf_pin,

drivers/gpu/drm/xe/xe_hwmon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static int xe_hwmon_pcode_read_i1(struct xe_gt *gt, u32 *uval)
419419

420420
return xe_pcode_read(gt, PCODE_MBOX(PCODE_POWER_SETUP,
421421
POWER_SETUP_SUBCOMMAND_READ_I1, 0),
422-
uval, 0);
422+
uval, NULL);
423423
}
424424

425425
static int xe_hwmon_pcode_write_i1(struct xe_gt *gt, u32 uval)

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static void emit_pte(struct xe_migrate *m,
472472
/* Indirect access needs compression enabled uncached PAT index */
473473
if (GRAPHICS_VERx100(xe) >= 2000)
474474
pat_index = is_comp_pte ? xe->pat.idx[XE_CACHE_NONE_COMPRESSION] :
475-
xe->pat.idx[XE_CACHE_NONE];
475+
xe->pat.idx[XE_CACHE_WB];
476476
else
477477
pat_index = xe->pat.idx[XE_CACHE_WB];
478478

@@ -760,14 +760,14 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
760760
if (src_is_vram && xe_migrate_allow_identity(src_L0, &src_it))
761761
xe_res_next(&src_it, src_L0);
762762
else
763-
emit_pte(m, bb, src_L0_pt, src_is_vram, true, &src_it, src_L0,
764-
src);
763+
emit_pte(m, bb, src_L0_pt, src_is_vram, copy_system_ccs,
764+
&src_it, src_L0, src);
765765

766766
if (dst_is_vram && xe_migrate_allow_identity(src_L0, &dst_it))
767767
xe_res_next(&dst_it, src_L0);
768768
else
769-
emit_pte(m, bb, dst_L0_pt, dst_is_vram, true, &dst_it, src_L0,
770-
dst);
769+
emit_pte(m, bb, dst_L0_pt, dst_is_vram, copy_system_ccs,
770+
&dst_it, src_L0, dst);
771771

772772
if (copy_system_ccs)
773773
emit_pte(m, bb, ccs_pt, false, false, &ccs_it, ccs_size, src);
@@ -1009,8 +1009,8 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
10091009
if (clear_vram && xe_migrate_allow_identity(clear_L0, &src_it))
10101010
xe_res_next(&src_it, clear_L0);
10111011
else
1012-
emit_pte(m, bb, clear_L0_pt, clear_vram, true, &src_it, clear_L0,
1013-
dst);
1012+
emit_pte(m, bb, clear_L0_pt, clear_vram, clear_system_ccs,
1013+
&src_it, clear_L0, dst);
10141014

10151015
bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
10161016
update_idx = bb->len;

drivers/gpu/drm/xe/xe_mmio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ int xe_mmio_probe_vram(struct xe_device *xe)
272272
drm_info(&xe->drm, "VRAM[%u, %u]: Actual physical size %pa, usable size exclude stolen %pa, CPU accessible size %pa\n", id,
273273
tile->id, &tile->mem.vram.actual_physical_size, &tile->mem.vram.usable_size, &tile->mem.vram.io_size);
274274
drm_info(&xe->drm, "VRAM[%u, %u]: DPA range: [%pa-%llx], io range: [%pa-%llx]\n", id, tile->id,
275-
&tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + tile->mem.vram.actual_physical_size,
276-
&tile->mem.vram.io_start, tile->mem.vram.io_start + tile->mem.vram.io_size);
275+
&tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + (u64)tile->mem.vram.actual_physical_size,
276+
&tile->mem.vram.io_start, tile->mem.vram.io_start + (u64)tile->mem.vram.io_size);
277277

278278
/* calculate total size using tile size to get the correct HW sizing */
279279
total_size += tile_size;

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,22 +1855,18 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
18551855
mutex_lock(&xef->vm.lock);
18561856
err = xa_alloc(&xef->vm.xa, &id, vm, xa_limit_32b, GFP_KERNEL);
18571857
mutex_unlock(&xef->vm.lock);
1858-
if (err) {
1859-
xe_vm_close_and_put(vm);
1860-
return err;
1861-
}
1858+
if (err)
1859+
goto err_close_and_put;
18621860

18631861
if (xe->info.has_asid) {
18641862
mutex_lock(&xe->usm.lock);
18651863
err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
18661864
XA_LIMIT(1, XE_MAX_ASID - 1),
18671865
&xe->usm.next_asid, GFP_KERNEL);
18681866
mutex_unlock(&xe->usm.lock);
1869-
if (err < 0) {
1870-
xe_vm_close_and_put(vm);
1871-
return err;
1872-
}
1873-
err = 0;
1867+
if (err < 0)
1868+
goto err_free_id;
1869+
18741870
vm->usm.asid = asid;
18751871
}
18761872

@@ -1888,6 +1884,15 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
18881884
#endif
18891885

18901886
return 0;
1887+
1888+
err_free_id:
1889+
mutex_lock(&xef->vm.lock);
1890+
xa_erase(&xef->vm.xa, id);
1891+
mutex_unlock(&xef->vm.lock);
1892+
err_close_and_put:
1893+
xe_vm_close_and_put(vm);
1894+
1895+
return err;
18911896
}
18921897

18931898
int xe_vm_destroy_ioctl(struct drm_device *dev, void *data,

0 commit comments

Comments
 (0)