Commit 8e8e9c26 authored by Matthew Auld's avatar Matthew Auld
Browse files

drm/xe: unconditionally apply PINNED for pin_map()



Some users apply PINNED and some don't when using pin_map(). The pin in
pin_map() should imply PINNED so just unconditionally apply it and clean
up all users.

Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarSatyanarayana K V P <satyanarayana.k.v.p@intel.com>
Link: https://lore.kernel.org/r/20250403102440.266113-14-matthew.auld@intel.com
parent 7f387e60
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
					   NULL, size,
					   ttm_bo_type_kernel, XE_BO_FLAG_SCANOUT |
					   XE_BO_FLAG_STOLEN |
					   XE_BO_FLAG_GGTT | XE_BO_FLAG_PINNED);
					   XE_BO_FLAG_GGTT);
		if (!IS_ERR(obj))
			drm_info(&xe->drm, "Allocated fbdev into stolen\n");
		else
@@ -56,7 +56,7 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
		obj = xe_bo_create_pin_map(xe, xe_device_get_root_tile(xe), NULL, size,
					   ttm_bo_type_kernel, XE_BO_FLAG_SCANOUT |
					   XE_BO_FLAG_VRAM_IF_DGFX(xe_device_get_root_tile(xe)) |
					   XE_BO_FLAG_GGTT | XE_BO_FLAG_PINNED);
					   XE_BO_FLAG_GGTT);
	}

	if (IS_ERR(obj)) {
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ initial_plane_bo(struct xe_device *xe,
	if (plane_config->size == 0)
		return NULL;

	flags = XE_BO_FLAG_PINNED | XE_BO_FLAG_SCANOUT | XE_BO_FLAG_GGTT;
	flags = XE_BO_FLAG_SCANOUT | XE_BO_FLAG_GGTT;

	base = round_down(plane_config->base, page_size);
	if (IS_DGFX(xe)) {
+3 −6
Original line number Diff line number Diff line
@@ -202,8 +202,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)

	big = xe_bo_create_pin_map(xe, tile, m->q->vm, SZ_4M,
				   ttm_bo_type_kernel,
				   XE_BO_FLAG_VRAM_IF_DGFX(tile) |
				   XE_BO_FLAG_PINNED);
				   XE_BO_FLAG_VRAM_IF_DGFX(tile));
	if (IS_ERR(big)) {
		KUNIT_FAIL(test, "Failed to allocate bo: %li\n", PTR_ERR(big));
		goto vunmap;
@@ -211,8 +210,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)

	pt = xe_bo_create_pin_map(xe, tile, m->q->vm, XE_PAGE_SIZE,
				  ttm_bo_type_kernel,
				  XE_BO_FLAG_VRAM_IF_DGFX(tile) |
				  XE_BO_FLAG_PINNED);
				  XE_BO_FLAG_VRAM_IF_DGFX(tile));
	if (IS_ERR(pt)) {
		KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n",
			   PTR_ERR(pt));
@@ -222,8 +220,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
	tiny = xe_bo_create_pin_map(xe, tile, m->q->vm,
				    2 * SZ_4K,
				    ttm_bo_type_kernel,
				    XE_BO_FLAG_VRAM_IF_DGFX(tile) |
				    XE_BO_FLAG_PINNED);
				    XE_BO_FLAG_VRAM_IF_DGFX(tile));
	if (IS_ERR(tiny)) {
		KUNIT_FAIL(test, "Failed to allocate tiny fake pt: %li\n",
			   PTR_ERR(tiny));
+1 −1
Original line number Diff line number Diff line
@@ -2024,7 +2024,7 @@ struct xe_bo *xe_bo_create_pin_map_at_aligned(struct xe_device *xe,
		flags |= XE_BO_FLAG_GGTT;

	bo = xe_bo_create_locked_range(xe, tile, vm, size, start, end, type,
				       flags | XE_BO_FLAG_NEEDS_CPU_ACCESS,
				       flags | XE_BO_FLAG_NEEDS_CPU_ACCESS | XE_BO_FLAG_PINNED,
				       alignment);
	if (IS_ERR(bo))
		return bo;
+1 −1
Original line number Diff line number Diff line
@@ -365,7 +365,7 @@ int xe_ggtt_init(struct xe_ggtt *ggtt)
	 * scratch entries, rather keep the scratch page in system memory on
	 * platforms where 64K pages are needed for VRAM.
	 */
	flags = XE_BO_FLAG_PINNED;
	flags = 0;
	if (ggtt->flags & XE_GGTT_FLAGS_64K)
		flags |= XE_BO_FLAG_SYSTEM;
	else
Loading