Skip to content

Commit f53128e

Browse files
committed
Merge tag 'drm-xe-next-2025-10-28' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-next
Driver Changes: More xe3p support (Harish, Brian, Balasubramani, Matt Roper) Make panic support work on VRAM for display (Maarten) Fix stolen size check (Shuicheng) xe_pci_test update (Gustavo) VF migration updates (Tomasz) A couple of fixes around allocation and PM references (Matt Brost) Migration update for the MEM_COPY instruction (Matt Auld) Initial CRI support (Balasubramani, Matt Roper) Use SVM range helpers in PT layer (Matt Brost) Drop MAX_GT_TYPE_CHARS constant (Matt Roper) Fix spelling and typos (Sanjay) Fix VF FLR synchronization between all GTs (Michal) Add a Workaround (Nitin) Access VF's register using dedicated MMIO view (Michal) Signed-off-by: Simona Vetter <simona.vetter@ffwll.ch> From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Link: https://patch.msgid.link/aQCl9uJxN6CWJ8Vg@fedora
2 parents 1193484 + 4504e78 commit f53128e

63 files changed

Lines changed: 534 additions & 216 deletions

Some content is hidden

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

drivers/gpu/drm/xe/display/xe_panic.c

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@
88
#include "intel_fb.h"
99
#include "intel_panic.h"
1010
#include "xe_bo.h"
11+
#include "xe_res_cursor.h"
1112

1213
struct intel_panic {
13-
struct page **pages;
14+
struct xe_res_cursor res;
15+
struct iosys_map vmap;
16+
1417
int page;
15-
void *vaddr;
1618
};
1719

1820
static void xe_panic_kunmap(struct intel_panic *panic)
1921
{
20-
if (panic->vaddr) {
21-
drm_clflush_virt_range(panic->vaddr, PAGE_SIZE);
22-
kunmap_local(panic->vaddr);
23-
panic->vaddr = NULL;
22+
if (!panic->vmap.is_iomem && iosys_map_is_set(&panic->vmap)) {
23+
drm_clflush_virt_range(panic->vmap.vaddr, PAGE_SIZE);
24+
kunmap_local(panic->vmap.vaddr);
2425
}
26+
iosys_map_clear(&panic->vmap);
27+
panic->page = -1;
2528
}
2629

2730
/*
@@ -46,15 +49,29 @@ static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int
4649
new_page = offset >> PAGE_SHIFT;
4750
offset = offset % PAGE_SIZE;
4851
if (new_page != panic->page) {
49-
xe_panic_kunmap(panic);
52+
if (xe_bo_is_vram(bo)) {
53+
/* Display is always mapped on root tile */
54+
struct xe_vram_region *vram = xe_bo_device(bo)->mem.vram;
55+
56+
if (panic->page < 0 || new_page < panic->page) {
57+
xe_res_first(bo->ttm.resource, new_page * PAGE_SIZE,
58+
bo->ttm.base.size - new_page * PAGE_SIZE, &panic->res);
59+
} else {
60+
xe_res_next(&panic->res, PAGE_SIZE * (new_page - panic->page));
61+
}
62+
iosys_map_set_vaddr_iomem(&panic->vmap,
63+
vram->mapping + panic->res.start);
64+
} else {
65+
xe_panic_kunmap(panic);
66+
iosys_map_set_vaddr(&panic->vmap,
67+
ttm_bo_kmap_try_from_panic(&bo->ttm,
68+
new_page));
69+
}
5070
panic->page = new_page;
51-
panic->vaddr = ttm_bo_kmap_try_from_panic(&bo->ttm,
52-
panic->page);
53-
}
54-
if (panic->vaddr) {
55-
u32 *pix = panic->vaddr + offset;
56-
*pix = color;
5771
}
72+
73+
if (iosys_map_is_set(&panic->vmap))
74+
iosys_map_wr(&panic->vmap, offset, u32, color);
5875
}
5976

6077
struct intel_panic *intel_panic_alloc(void)
@@ -68,6 +85,12 @@ struct intel_panic *intel_panic_alloc(void)
6885

6986
int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
7087
{
88+
struct intel_framebuffer *fb = (struct intel_framebuffer *)sb->private;
89+
struct xe_bo *bo = gem_to_xe_bo(intel_fb_bo(&fb->base));
90+
91+
if (xe_bo_is_vram(bo) && !xe_bo_is_visible_vram(bo))
92+
return -ENODEV;
93+
7194
panic->page = -1;
7295
sb->set_pixel = xe_panic_page_set_pixel;
7396
return 0;
@@ -76,5 +99,4 @@ int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
7699
void intel_panic_finish(struct intel_panic *panic)
77100
{
78101
xe_panic_kunmap(panic);
79-
panic->page = -1;
80102
}

drivers/gpu/drm/xe/instructions/xe_gpu_commands.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
#define XY_FAST_COPY_BLT_D1_DST_TILE4 REG_BIT(30)
3232
#define XE2_XY_FAST_COPY_BLT_MOCS_INDEX_MASK GENMASK(23, 20)
3333

34+
#define MEM_COPY_CMD (2 << 29 | 0x5a << 22 | 0x8)
35+
#define MEM_COPY_PAGE_COPY_MODE REG_BIT(19)
36+
#define MEM_COPY_MATRIX_COPY REG_BIT(17)
37+
#define MEM_COPY_SRC_MOCS_INDEX_MASK GENMASK(31, 28)
38+
#define MEM_COPY_DST_MOCS_INDEX_MASK GENMASK(6, 3)
39+
3440
#define PVC_MEM_SET_CMD (2 << 29 | 0x5b << 22)
3541
#define PVC_MEM_SET_CMD_LEN_DW 7
3642
#define PVC_MEM_SET_MATRIX REG_BIT(17)

drivers/gpu/drm/xe/regs/xe_gt_regs.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
#define GMD_ID XE_REG(0xd8c)
3838
#define GMD_ID_ARCH_MASK REG_GENMASK(31, 22)
3939
#define GMD_ID_RELEASE_MASK REG_GENMASK(21, 14)
40+
/*
41+
* Spec defines these bits as "Reserved", but then make them assume some
42+
* meaning that depends on the ARCH. To avoid any confusion, call them
43+
* SUBIP_FLAG_MASK.
44+
*/
45+
#define GMD_ID_SUBIP_FLAG_MASK REG_GENMASK(13, 6)
4046
#define GMD_ID_REVID REG_GENMASK(5, 0)
4147

4248
#define FORCEWAKE_ACK_GSC XE_REG(0xdf8)
@@ -168,6 +174,7 @@
168174

169175
#define XEHP_SLICE_COMMON_ECO_CHICKEN1 XE_REG_MCR(0x731c, XE_REG_OPTION_MASKED)
170176
#define MSC_MSAA_REODER_BUF_BYPASS_DISABLE REG_BIT(14)
177+
#define FAST_CLEAR_VALIGN_FIX REG_BIT(13)
171178

172179
#define XE2LPM_CCCHKNREG1 XE_REG(0x82a8)
173180

@@ -544,6 +551,9 @@
544551
#define SARB_CHICKEN1 XE_REG_MCR(0xe90c)
545552
#define COMP_CKN_IN REG_GENMASK(30, 29)
546553

554+
#define MAIN_GAMCTRL_MODE XE_REG(0xef00)
555+
#define MAIN_GAMCTRL_QUEUE_SELECT REG_BIT(0)
556+
547557
#define RCU_MODE XE_REG(0x14800, XE_REG_OPTION_MASKED)
548558
#define RCU_MODE_FIXED_SLICE_CCS_MODE REG_BIT(1)
549559
#define RCU_MODE_CCS_ENABLE REG_BIT(0)

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,27 @@ static void check_media_ip(struct kunit *test)
4444
KUNIT_ASSERT_EQ(test, mask, 0);
4545
}
4646

47-
static void check_platform_gt_count(struct kunit *test)
47+
static void check_platform_desc(struct kunit *test)
4848
{
4949
const struct pci_device_id *pci = test->param_value;
5050
const struct xe_device_desc *desc =
5151
(const struct xe_device_desc *)pci->driver_data;
52-
int max_gt = desc->max_gt_per_tile;
5352

54-
KUNIT_ASSERT_GT(test, max_gt, 0);
55-
KUNIT_ASSERT_LE(test, max_gt, XE_MAX_GT_PER_TILE);
53+
KUNIT_EXPECT_GT(test, desc->dma_mask_size, 0);
54+
55+
KUNIT_EXPECT_GT(test, (unsigned int)desc->max_gt_per_tile, 0);
56+
KUNIT_EXPECT_LE(test, (unsigned int)desc->max_gt_per_tile, XE_MAX_GT_PER_TILE);
57+
58+
KUNIT_EXPECT_GT(test, desc->va_bits, 0);
59+
KUNIT_EXPECT_LE(test, desc->va_bits, 64);
60+
61+
KUNIT_EXPECT_GT(test, desc->vm_max_level, 0);
5662
}
5763

5864
static struct kunit_case xe_pci_tests[] = {
5965
KUNIT_CASE_PARAM(check_graphics_ip, xe_pci_graphics_ip_gen_param),
6066
KUNIT_CASE_PARAM(check_media_ip, xe_pci_media_ip_gen_param),
61-
KUNIT_CASE_PARAM(check_platform_gt_count, xe_pci_id_gen_param),
67+
KUNIT_CASE_PARAM(check_platform_desc, xe_pci_id_gen_param),
6268
{}
6369
};
6470

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,23 @@ static bool xe_ttm_resource_visible(struct ttm_resource *mem)
610610
return vres->used_visible_size == mem->size;
611611
}
612612

613+
/**
614+
* xe_bo_is_visible_vram - check if BO is placed entirely in visible VRAM.
615+
* @bo: The BO
616+
*
617+
* This function checks whether a given BO resides entirely in memory visible from the CPU
618+
*
619+
* Returns: true if the BO is entirely visible, false otherwise.
620+
*
621+
*/
622+
bool xe_bo_is_visible_vram(struct xe_bo *bo)
623+
{
624+
if (drm_WARN_ON(bo->ttm.base.dev, !xe_bo_is_vram(bo)))
625+
return false;
626+
627+
return xe_ttm_resource_visible(bo->ttm.resource);
628+
}
629+
613630
static int xe_ttm_io_mem_reserve(struct ttm_device *bdev,
614631
struct ttm_resource *mem)
615632
{
@@ -1635,7 +1652,7 @@ static int xe_ttm_access_memory(struct ttm_buffer_object *ttm_bo,
16351652
if (!mem_type_is_vram(ttm_bo->resource->mem_type))
16361653
return -EIO;
16371654

1638-
if (!xe_ttm_resource_visible(ttm_bo->resource) || len >= SZ_16K) {
1655+
if (!xe_bo_is_visible_vram(bo) || len >= SZ_16K) {
16391656
struct xe_migrate *migrate =
16401657
mem_type_to_migrate(xe, ttm_bo->resource->mem_type);
16411658

@@ -2105,7 +2122,7 @@ void xe_bo_free(struct xe_bo *bo)
21052122
* if the function should allocate a new one.
21062123
* @tile: The tile to select for migration of this bo, and the tile used for
21072124
* GGTT binding if any. Only to be non-NULL for ttm_bo_type_kernel bos.
2108-
* @resv: Pointer to a locked shared reservation object to use fo this bo,
2125+
* @resv: Pointer to a locked shared reservation object to use for this bo,
21092126
* or NULL for the xe_bo to use its own.
21102127
* @bulk: The bulk move to use for LRU bumping, or NULL for external bos.
21112128
* @size: The storage size to use for the bo.
@@ -2259,6 +2276,12 @@ static int __xe_bo_fixed_placement(struct xe_device *xe,
22592276
struct ttm_place *place = bo->placements;
22602277
u32 vram_flag, vram_stolen_flags;
22612278

2279+
/*
2280+
* to allow fixed placement in GGTT of a VF, post-migration fixups would have to
2281+
* include selecting a new fixed offset and shifting the page ranges for it
2282+
*/
2283+
xe_assert(xe, !IS_SRIOV_VF(xe) || !(bo->flags & XE_BO_FLAG_GGTT));
2284+
22622285
if (flags & (XE_BO_FLAG_USER | XE_BO_FLAG_SYSTEM))
22632286
return -EINVAL;
22642287

@@ -2629,7 +2652,7 @@ struct xe_bo *xe_bo_create_pin_map(struct xe_device *xe, struct xe_tile *tile,
26292652
* @size: The storage size to use for the bo.
26302653
* @type: The TTM buffer object type.
26312654
* @flags: XE_BO_FLAG_ flags.
2632-
* @intr: Whether to execut any waits for backing store interruptible.
2655+
* @intr: Whether to execute any waits for backing store interruptible.
26332656
*
26342657
* Create a pinned and mapped bo. The bo will be external and not associated
26352658
* with a VM.

drivers/gpu/drm/xe/xe_bo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ int xe_bo_read(struct xe_bo *bo, u64 offset, void *dst, int size);
274274

275275
bool mem_type_is_vram(u32 mem_type);
276276
bool xe_bo_is_vram(struct xe_bo *bo);
277+
bool xe_bo_is_visible_vram(struct xe_bo *bo);
277278
bool xe_bo_is_stolen(struct xe_bo *bo);
278279
bool xe_bo_is_stolen_devmem(struct xe_bo *bo);
279280
bool xe_bo_is_vm_bound(struct xe_bo *bo);

drivers/gpu/drm/xe/xe_bo_doc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* BO management
1313
* =============
1414
*
15-
* TTM manages (placement, eviction, etc...) all BOs in XE.
15+
* TTM manages (placement, eviction, etc...) all BOs in Xe.
1616
*
1717
* BO creation
1818
* ===========
@@ -29,7 +29,7 @@
2929
* a kernel BO (e.g. engine state, memory for page tables, etc...). These BOs
3030
* are typically mapped in the GGTT (any kernel BOs aside memory for page tables
3131
* are in the GGTT), are pinned (can't move or be evicted at runtime), have a
32-
* vmap (XE can access the memory via xe_map layer) and have contiguous physical
32+
* vmap (Xe can access the memory via xe_map layer) and have contiguous physical
3333
* memory.
3434
*
3535
* More details of why kernel BOs are pinned and contiguous below.
@@ -40,7 +40,7 @@
4040
* A user BO is created via the DRM_IOCTL_XE_GEM_CREATE IOCTL. Once it is
4141
* created the BO can be mmap'd (via DRM_IOCTL_XE_GEM_MMAP_OFFSET) for user
4242
* access and it can be bound for GPU access (via DRM_IOCTL_XE_VM_BIND). All
43-
* user BOs are evictable and user BOs are never pinned by XE. The allocation of
43+
* user BOs are evictable and user BOs are never pinned by Xe. The allocation of
4444
* the backing store can be deferred from creation time until first use which is
4545
* either mmap, bind, or pagefault.
4646
*
@@ -84,7 +84,7 @@
8484
* ====================
8585
*
8686
* All eviction (or in other words, moving a BO from one memory location to
87-
* another) is routed through TTM with a callback into XE.
87+
* another) is routed through TTM with a callback into Xe.
8888
*
8989
* Runtime eviction
9090
* ----------------

drivers/gpu/drm/xe/xe_configfs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Overview
2828
* ========
2929
*
30-
* Configfs is a filesystem-based manager of kernel objects. XE KMD registers a
30+
* Configfs is a filesystem-based manager of kernel objects. Xe KMD registers a
3131
* configfs subsystem called ``xe`` that creates a directory in the mounted
3232
* configfs directory. The user can create devices under this directory and
3333
* configure them as necessary. See Documentation/filesystems/configfs.rst for
@@ -301,7 +301,6 @@ struct engine_info {
301301
/* Some helpful macros to aid on the sizing of buffer allocation when parsing */
302302
#define MAX_ENGINE_CLASS_CHARS 5
303303
#define MAX_ENGINE_INSTANCE_CHARS 2
304-
#define MAX_GT_TYPE_CHARS 7
305304

306305
static const struct engine_info engine_info[] = {
307306
{ .cls = "rcs", .mask = XE_HW_ENGINE_RCS_MASK, .engine_class = XE_ENGINE_CLASS_RENDER },
@@ -313,7 +312,7 @@ static const struct engine_info engine_info[] = {
313312
};
314313

315314
static const struct {
316-
const char name[MAX_GT_TYPE_CHARS + 1];
315+
const char *name;
317316
enum xe_gt_type type;
318317
} gt_types[] = {
319318
{ .name = "primary", .type = XE_GT_TYPE_MAIN },

drivers/gpu/drm/xe/xe_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ static void xe_device_wedged_fini(struct drm_device *drm, void *arg)
12171217
*
12181218
* /sys/bus/pci/devices/<device>/survivability_mode
12191219
*
1220-
* - Admin/userpsace consumer can use firmware flashing tools like fwupd to flash
1220+
* - Admin/userspace consumer can use firmware flashing tools like fwupd to flash
12211221
* firmware and restore device to normal operation.
12221222
*/
12231223

drivers/gpu/drm/xe/xe_device_types.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ struct xe_tile {
222222
};
223223

224224
/**
225-
* struct xe_device - Top level struct of XE device
225+
* struct xe_device - Top level struct of Xe device
226226
*/
227227
struct xe_device {
228228
/** @drm: drm device */
@@ -245,9 +245,9 @@ struct xe_device {
245245
u32 media_verx100;
246246
/** @info.mem_region_mask: mask of valid memory regions */
247247
u32 mem_region_mask;
248-
/** @info.platform: XE platform enum */
248+
/** @info.platform: Xe platform enum */
249249
enum xe_platform platform;
250-
/** @info.subplatform: XE subplatform enum */
250+
/** @info.subplatform: Xe subplatform enum */
251251
enum xe_subplatform subplatform;
252252
/** @info.devid: device ID */
253253
u16 devid;
@@ -300,6 +300,8 @@ struct xe_device {
300300
* pcode mailbox commands.
301301
*/
302302
u8 has_mbx_power_limits:1;
303+
/** @info.has_mem_copy_instr: Device supports MEM_COPY instruction */
304+
u8 has_mem_copy_instr:1;
303305
/** @info.has_pxp: Device has PXP support */
304306
u8 has_pxp:1;
305307
/** @info.has_range_tlb_inval: Has range based TLB invalidations */
@@ -659,7 +661,7 @@ struct xe_device {
659661
};
660662

661663
/**
662-
* struct xe_file - file handle for XE driver
664+
* struct xe_file - file handle for Xe driver
663665
*/
664666
struct xe_file {
665667
/** @xe: xe DEVICE **/

0 commit comments

Comments
 (0)