Skip to content

Commit 377b2f1

Browse files
committed
Merge tag 'drm-xe-next-2025-06-18' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-next
UAPI Changes: - Expose media OA units (Ashutosh) Merge: - Restore GuC submit UAF fix around queue destruction accidentally removed in a drm-xe-fixes merge (Auld) Core Changes: - drm/gpusvm: Introduce devmem_only flag for allocation (Himal) - drm/gpusvm: Add timeslicing support to GPU SVM (Brost) Driver Changes: - Make gem shrinker drm managed (Thomas) - SRIOV VF Post-migration recovery of GGTT nodes and CTB (Tomasz) - Some W/A additions and updates (Aradhya, Shekhar, Vinay, Daniele) - Prefetch Support for svm ranges (Himal, Brost) - Don't allocate managed BO for each policy change (Michal) - Simplify and fix diff calculation in GuC submit (Lucas) - Track FAST_REQ GuC H2Gs to report where errors came from (John) - SRIOV PF: Don't allow LMEM provisioning if LMTT isn't available (Piotr) - Check if all domains awake for MOCS dump (Tejas) - Make creation of SLPC debugfs files conditional (Aradhya) - Default auto_link_downgrade status to false (Aradhya) - Use xe_mmio_read32() to read mtcfg register (Shuicheng) - Updates in PCI ID tables (Atwood, Shekhar) - SRIOV VF: Fail migration recovery if fixups needed but not supported (Tomasz) - Add missing documentation around freq and RPa (Rodrigo) - Some other SVM related fixes (Himal, Auld, Brost, Maarten) - Allow to trigger GT resets using debugfs writes (Michal) - Optimise CCS case for WB pages (Auld) - Create LRC BO without VM (Niranjana) - Initialize MOCS index early (Bala) - HWMON fixes for BMG (Karthik, Lucas) - Drop redundant conversion to bool (Raag) - Rework eviction rejection of bound external bos (Thomas) - Stop re-submitting signalled jobs (Auld) - Small fixes and cleanups for PXP (Daniele) - Convert some print messages to GT-oriented ones (Michal) - Resend potentially lost GuC H2G MMIO request (Michal) - Add configfs to load with fewer engines (Lucas) - Remove unmatched xe_vm_unlock from __xe_exec_queue_init (Maciej) - SRIOV VF: Small updates around GGTT handling (Michal) - Make VMA tile_present, tile_invalidated access rules clear (Brost) - Xe3 Tuning: Disable NULL query for Anyhit Shader (Nitin) - Fixes for VF GuC version (Daniele) - Don't store the xe device pointer inside xe_ttm_tt (Dave) - Small improvements in topology code (Michal) - Stop relying on GGTT internals (Maarten) - GSM size should be constant on most platforms (Roper) - Reorder 'Get pages failed' message (Brost) - WA BB related fixes and improvements (Lucas, Brost) - Fix early wedge on GuC load failure (Daniele) - Add helper function to inject fault into ct_dead_capture (Satyanarayana) - Determine ATS / PTA programming during early sw init (Roper) - Consolidate PAT programming logic for pre-Xe2 and post-Xe2 (Roper) - Fix kconfig prompt (Lucas) - Convert xe_pci tests to parametrized tests (Michal) - Do not kill VM in PT code on -ENODATA (Brost) - Move LRC_ENGINE_ID_PPHWSP_OFFSET outside of parallel offset (Brost) - Enable media OA (Ashutosh) - GuC log level tuning (Lucas) - Add xe_vm_has_valid_gpu_mapping helper (Brost) - Opportunistically skip TLB invalidaion on unbind (Brost) Signed-off-by: Dave Airlie <[email protected]> From: Rodrigo Vivi <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2 parents 45215c5 + 8aa7306 commit 377b2f1

Some content is hidden

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

86 files changed

+3229
-1138
lines changed

Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,51 @@ Contact: [email protected]
148148
Description: RO. Fan 3 speed in RPM.
149149

150150
Only supported for particular Intel Xe graphics platforms.
151+
152+
What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap
153+
Date: May 2025
154+
KernelVersion: 6.15
155+
156+
Description: RW. Card burst (PL2) power limit in microwatts.
157+
158+
The power controller will throttle the operating frequency
159+
if the power averaged over a window (typically milli seconds)
160+
exceeds this limit. A read value of 0 means that the PL2
161+
power limit is disabled, writing 0 disables the limit.
162+
PL2 is greater than PL1 and its time window is lesser
163+
compared to PL1.
164+
165+
Only supported for particular Intel Xe graphics platforms.
166+
167+
What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_cap
168+
Date: May 2025
169+
KernelVersion: 6.15
170+
171+
Description: RW. Package burst (PL2) power limit in microwatts.
172+
173+
The power controller will throttle the operating frequency
174+
if the power averaged over a window (typically milli seconds)
175+
exceeds this limit. A read value of 0 means that the PL2
176+
power limit is disabled, writing 0 disables the limit.
177+
PL2 is greater than PL1 and its time window is lesser
178+
compared to PL1.
179+
180+
Only supported for particular Intel Xe graphics platforms.
181+
182+
What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap_interval
183+
Date: May 2025
184+
KernelVersion: 6.15
185+
186+
Description: RW. Card burst power limit interval (Tau in PL2/Tau) in
187+
milliseconds over which sustained power is averaged.
188+
189+
Only supported for particular Intel Xe graphics platforms.
190+
191+
What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_cap_interval
192+
Date: May 2025
193+
KernelVersion: 6.15
194+
195+
Description: RW. Package burst power limit interval (Tau in PL2/Tau) in
196+
milliseconds over which sustained power is averaged.
197+
198+
Only supported for particular Intel Xe graphics platforms.

Documentation/gpu/xe/xe_configfs.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
33
.. _xe_configfs:
44

5-
============
5+
===========
66
Xe Configfs
7-
============
7+
===========
88

99
.. kernel-doc:: drivers/gpu/drm/xe/xe_configfs.c
1010
:doc: Xe Configfs
11+
12+
Internal API
13+
============
14+
15+
.. kernel-doc:: drivers/gpu/drm/xe/xe_configfs.c
16+
:internal:

drivers/gpu/drm/drm_gpusvm.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,40 @@ static void drm_gpusvm_driver_lock_held(struct drm_gpusvm *gpusvm)
980980
}
981981
#endif
982982

983+
/**
984+
* drm_gpusvm_find_vma_start() - Find start address for first VMA in range
985+
* @gpusvm: Pointer to the GPU SVM structure
986+
* @start: The inclusive start user address.
987+
* @end: The exclusive end user address.
988+
*
989+
* Returns: The start address of first VMA within the provided range,
990+
* ULONG_MAX otherwise. Assumes start_addr < end_addr.
991+
*/
992+
unsigned long
993+
drm_gpusvm_find_vma_start(struct drm_gpusvm *gpusvm,
994+
unsigned long start,
995+
unsigned long end)
996+
{
997+
struct mm_struct *mm = gpusvm->mm;
998+
struct vm_area_struct *vma;
999+
unsigned long addr = ULONG_MAX;
1000+
1001+
if (!mmget_not_zero(mm))
1002+
return addr;
1003+
1004+
mmap_read_lock(mm);
1005+
1006+
vma = find_vma_intersection(mm, start, end);
1007+
if (vma)
1008+
addr = vma->vm_start;
1009+
1010+
mmap_read_unlock(mm);
1011+
mmput(mm);
1012+
1013+
return addr;
1014+
}
1015+
EXPORT_SYMBOL_GPL(drm_gpusvm_find_vma_start);
1016+
9831017
/**
9841018
* drm_gpusvm_range_find_or_insert() - Find or insert GPU SVM range
9851019
* @gpusvm: Pointer to the GPU SVM structure

drivers/gpu/drm/xe/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config DRM_XE
3-
tristate "Intel Xe Graphics"
3+
tristate "Intel Xe2 Graphics"
44
depends on DRM && PCI && (m || (y && KUNIT=y))
55
depends on INTEL_VSEC || !INTEL_VSEC
66
depends on X86_PLATFORM_DEVICES || !(X86 && ACPI)
@@ -31,7 +31,6 @@ config DRM_XE
3131
select ACPI_VIDEO if X86 && ACPI
3232
select ACPI_WMI if X86 && ACPI
3333
select SYNC_FILE
34-
select IOSF_MBI
3534
select CRC32
3635
select SND_HDA_I915 if SND_HDA_CORE
3736
select CEC_CORE if CEC_NOTIFIER
@@ -46,7 +45,8 @@ config DRM_XE
4645
select AUXILIARY_BUS
4746
select HMM_MIRROR
4847
help
49-
Experimental driver for Intel Xe series GPUs
48+
Driver for Intel Xe2 series GPUs and later. Experimental support
49+
for Xe series is also available.
5050

5151
If "M" is selected, the module will be called xe.
5252

drivers/gpu/drm/xe/Kconfig.debug

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ config DRM_XE_KUNIT_TEST
8686

8787
If in doubt, say "N".
8888

89-
config DRM_XE_LARGE_GUC_BUFFER
90-
bool "Enable larger guc log buffer"
89+
config DRM_XE_DEBUG_GUC
90+
bool "Enable extra GuC related debug options"
91+
depends on DRM_XE_DEBUG
9192
default n
93+
select STACKDEPOT
9294
help
9395
Choose this option when debugging guc issues.
94-
Buffer should be large enough for complex issues.
96+
The GuC log buffer is increased to the maximum allowed, which should
97+
be large enough for complex issues. The tracking of FAST_REQ messages
98+
is extended to include a record of the calling stack, which is then
99+
dumped on a FAST_REQ error notification.
95100

96101
Recommended for driver developers only.
97102

drivers/gpu/drm/xe/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ xe-y += \
139139
xe_guc_relay.o \
140140
xe_memirq.o \
141141
xe_sriov.o \
142-
xe_sriov_vf.o
142+
xe_sriov_vf.o \
143+
xe_tile_sriov_vf.o
143144

144145
xe-$(CONFIG_PCI_IOV) += \
145146
xe_gt_sriov_pf.o \

drivers/gpu/drm/xe/abi/guc_actions_abi.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,37 @@ enum xe_guc_preempt_options {
161161
XE_GUC_PREEMPT_OPTION_DROP_SUBMIT_Q = 0x8,
162162
};
163163

164+
enum xe_guc_register_context_param_offsets {
165+
XE_GUC_REGISTER_CONTEXT_DATA_0_MBZ = 0,
166+
XE_GUC_REGISTER_CONTEXT_DATA_1_FLAGS,
167+
XE_GUC_REGISTER_CONTEXT_DATA_2_CONTEXT_INDEX,
168+
XE_GUC_REGISTER_CONTEXT_DATA_3_ENGINE_CLASS,
169+
XE_GUC_REGISTER_CONTEXT_DATA_4_ENGINE_SUBMIT_MASK,
170+
XE_GUC_REGISTER_CONTEXT_DATA_5_WQ_DESC_ADDR_LOWER,
171+
XE_GUC_REGISTER_CONTEXT_DATA_6_WQ_DESC_ADDR_UPPER,
172+
XE_GUC_REGISTER_CONTEXT_DATA_7_WQ_BUF_BASE_LOWER,
173+
XE_GUC_REGISTER_CONTEXT_DATA_8_WQ_BUF_BASE_UPPER,
174+
XE_GUC_REGISTER_CONTEXT_DATA_9_WQ_BUF_SIZE,
175+
XE_GUC_REGISTER_CONTEXT_DATA_10_HW_LRC_ADDR,
176+
XE_GUC_REGISTER_CONTEXT_MSG_LEN,
177+
};
178+
179+
enum xe_guc_register_context_multi_lrc_param_offsets {
180+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_0_MBZ = 0,
181+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_1_FLAGS,
182+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_2_PARENT_CONTEXT,
183+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_3_ENGINE_CLASS,
184+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_4_ENGINE_SUBMIT_MASK,
185+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_5_WQ_DESC_ADDR_LOWER,
186+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_6_WQ_DESC_ADDR_UPPER,
187+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_7_WQ_BUF_BASE_LOWER,
188+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_8_WQ_BUF_BASE_UPPER,
189+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_9_WQ_BUF_SIZE,
190+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_10_NUM_CTXS,
191+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_DATA_11_HW_LRC_ADDR,
192+
XE_GUC_REGISTER_CONTEXT_MULTI_LRC_MSG_MIN_LEN = 11,
193+
};
194+
164195
enum xe_guc_report_status {
165196
XE_GUC_REPORT_STATUS_UNKNOWN = 0x0,
166197
XE_GUC_REPORT_STATUS_ACKED = 0x1,

drivers/gpu/drm/xe/abi/guc_errors_abi.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#ifndef _ABI_GUC_ERRORS_ABI_H
77
#define _ABI_GUC_ERRORS_ABI_H
88

9-
enum xe_guc_response_status {
10-
XE_GUC_RESPONSE_STATUS_SUCCESS = 0x0,
9+
enum xe_guc_response {
1110
XE_GUC_RESPONSE_ERROR_PROTOCOL = 0x04,
1211
XE_GUC_RESPONSE_INVALID_STATE = 0x0A,
1312
XE_GUC_RESPONSE_UNSUPPORTED_VERSION = 0x0B,
@@ -21,12 +20,20 @@ enum xe_guc_response_status {
2120
XE_GUC_RESPONSE_CANNOT_COMPLETE_ACTION = 0x41,
2221
XE_GUC_RESPONSE_INVALID_KLV_DATA = 0x50,
2322
XE_GUC_RESPONSE_INVALID_PARAMS = 0x60,
23+
XE_GUC_RESPONSE_INVALID_CONTEXT_INDEX = 0x61,
24+
XE_GUC_RESPONSE_INVALID_CONTEXT_REGISTRATION = 0x62,
25+
XE_GUC_RESPONSE_INVALID_DOORBELL_ID = 0x63,
26+
XE_GUC_RESPONSE_INVALID_ENGINE_ID = 0x64,
2427
XE_GUC_RESPONSE_INVALID_BUFFER_RANGE = 0x70,
2528
XE_GUC_RESPONSE_INVALID_BUFFER = 0x71,
29+
XE_GUC_RESPONSE_BUFFER_ALREADY_REGISTERED = 0x72,
2630
XE_GUC_RESPONSE_INVALID_GGTT_ADDRESS = 0x80,
2731
XE_GUC_RESPONSE_PENDING_ACTION = 0x90,
32+
XE_GUC_RESPONSE_CONTEXT_NOT_REGISTERED = 0x100,
33+
XE_GUC_RESPONSE_CONTEXT_ALREADY_REGISTERED = 0X101,
2834
XE_GUC_RESPONSE_INVALID_SIZE = 0x102,
2935
XE_GUC_RESPONSE_MALFORMED_KLV = 0x103,
36+
XE_GUC_RESPONSE_INVALID_CONTEXT = 0x104,
3037
XE_GUC_RESPONSE_INVALID_KLV_KEY = 0x105,
3138
XE_GUC_RESPONSE_DATA_TOO_LARGE = 0x106,
3239
XE_GUC_RESPONSE_VF_MIGRATED = 0x107,
@@ -40,10 +47,11 @@ enum xe_guc_response_status {
4047
XE_GUC_RESPONSE_CTB_NOT_REGISTERED = 0x304,
4148
XE_GUC_RESPONSE_CTB_IN_USE = 0x305,
4249
XE_GUC_RESPONSE_CTB_INVALID_DESC = 0x306,
50+
XE_GUC_RESPONSE_HW_TIMEOUT = 0x30C,
4351
XE_GUC_RESPONSE_CTB_SOURCE_INVALID_DESCRIPTOR = 0x30D,
4452
XE_GUC_RESPONSE_CTB_DESTINATION_INVALID_DESCRIPTOR = 0x30E,
4553
XE_GUC_RESPONSE_INVALID_CONFIG_STATE = 0x30F,
46-
XE_GUC_RESPONSE_STATUS_GENERIC_FAIL = 0xF000,
54+
XE_GUC_RESPONSE_GENERIC_FAIL = 0xF000,
4755
};
4856

4957
enum xe_guc_load_status {

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

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ write_dpt_rotated(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs, u32 bo_
2323
struct xe_device *xe = xe_bo_device(bo);
2424
struct xe_ggtt *ggtt = xe_device_get_root_tile(xe)->mem.ggtt;
2525
u32 column, row;
26+
u64 pte = xe_ggtt_encode_pte_flags(ggtt, bo, xe->pat.idx[XE_CACHE_NONE]);
2627

2728
/* TODO: Maybe rewrite so we can traverse the bo addresses sequentially,
2829
* by writing dpt/ggtt in a different order?
@@ -32,10 +33,9 @@ write_dpt_rotated(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs, u32 bo_
3233
u32 src_idx = src_stride * (height - 1) + column + bo_ofs;
3334

3435
for (row = 0; row < height; row++) {
35-
u64 pte = ggtt->pt_ops->pte_encode_bo(bo, src_idx * XE_PAGE_SIZE,
36-
xe->pat.idx[XE_CACHE_NONE]);
36+
u64 addr = xe_bo_addr(bo, src_idx * XE_PAGE_SIZE, XE_PAGE_SIZE);
3737

38-
iosys_map_wr(map, *dpt_ofs, u64, pte);
38+
iosys_map_wr(map, *dpt_ofs, u64, pte | addr);
3939
*dpt_ofs += 8;
4040
src_idx -= src_stride;
4141
}
@@ -55,17 +55,15 @@ write_dpt_remapped(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs,
5555
{
5656
struct xe_device *xe = xe_bo_device(bo);
5757
struct xe_ggtt *ggtt = xe_device_get_root_tile(xe)->mem.ggtt;
58-
u64 (*pte_encode_bo)(struct xe_bo *bo, u64 bo_offset, u16 pat_index)
59-
= ggtt->pt_ops->pte_encode_bo;
6058
u32 column, row;
59+
u64 pte = xe_ggtt_encode_pte_flags(ggtt, bo, xe->pat.idx[XE_CACHE_NONE]);
6160

6261
for (row = 0; row < height; row++) {
6362
u32 src_idx = src_stride * row + bo_ofs;
6463

6564
for (column = 0; column < width; column++) {
66-
iosys_map_wr(map, *dpt_ofs, u64,
67-
pte_encode_bo(bo, src_idx * XE_PAGE_SIZE,
68-
xe->pat.idx[XE_CACHE_NONE]));
65+
u64 addr = xe_bo_addr(bo, src_idx * XE_PAGE_SIZE, XE_PAGE_SIZE);
66+
iosys_map_wr(map, *dpt_ofs, u64, pte | addr);
6967

7068
*dpt_ofs += 8;
7169
src_idx++;
@@ -129,13 +127,13 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
129127
return PTR_ERR(dpt);
130128

131129
if (view->type == I915_GTT_VIEW_NORMAL) {
130+
u64 pte = xe_ggtt_encode_pte_flags(ggtt, bo, xe->pat.idx[XE_CACHE_NONE]);
132131
u32 x;
133132

134133
for (x = 0; x < size / XE_PAGE_SIZE; x++) {
135-
u64 pte = ggtt->pt_ops->pte_encode_bo(bo, x * XE_PAGE_SIZE,
136-
xe->pat.idx[XE_CACHE_NONE]);
134+
u64 addr = xe_bo_addr(bo, x * XE_PAGE_SIZE, XE_PAGE_SIZE);
137135

138-
iosys_map_wr(&dpt->vmap, x * 8, u64, pte);
136+
iosys_map_wr(&dpt->vmap, x * 8, u64, pte | addr);
139137
}
140138
} else if (view->type == I915_GTT_VIEW_REMAPPED) {
141139
const struct intel_remapped_info *remap_info = &view->remapped;
@@ -173,15 +171,15 @@ write_ggtt_rotated(struct xe_bo *bo, struct xe_ggtt *ggtt, u32 *ggtt_ofs, u32 bo
173171
{
174172
struct xe_device *xe = xe_bo_device(bo);
175173
u32 column, row;
174+
u64 pte = ggtt->pt_ops->pte_encode_flags(bo, xe->pat.idx[XE_CACHE_NONE]);
176175

177176
for (column = 0; column < width; column++) {
178177
u32 src_idx = src_stride * (height - 1) + column + bo_ofs;
179178

180179
for (row = 0; row < height; row++) {
181-
u64 pte = ggtt->pt_ops->pte_encode_bo(bo, src_idx * XE_PAGE_SIZE,
182-
xe->pat.idx[XE_CACHE_NONE]);
180+
u64 addr = xe_bo_addr(bo, src_idx * XE_PAGE_SIZE, XE_PAGE_SIZE);
183181

184-
ggtt->pt_ops->ggtt_set_pte(ggtt, *ggtt_ofs, pte);
182+
ggtt->pt_ops->ggtt_set_pte(ggtt, *ggtt_ofs, pte | addr);
185183
*ggtt_ofs += XE_PAGE_SIZE;
186184
src_idx -= src_stride;
187185
}
@@ -199,14 +197,15 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
199197
struct drm_gem_object *obj = intel_fb_bo(&fb->base);
200198
struct xe_bo *bo = gem_to_xe_bo(obj);
201199
struct xe_device *xe = to_xe_device(fb->base.dev);
202-
struct xe_ggtt *ggtt = xe_device_get_root_tile(xe)->mem.ggtt;
200+
struct xe_tile *tile0 = xe_device_get_root_tile(xe);
201+
struct xe_ggtt *ggtt = tile0->mem.ggtt;
203202
u32 align;
204203
int ret;
205204

206205
/* TODO: Consider sharing framebuffer mapping?
207206
* embed i915_vma inside intel_framebuffer
208207
*/
209-
xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile));
208+
xe_pm_runtime_get_noresume(xe);
210209
ret = mutex_lock_interruptible(&ggtt->lock);
211210
if (ret)
212211
goto out;
@@ -215,29 +214,22 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
215214
if (xe_bo_is_vram(bo) && ggtt->flags & XE_GGTT_FLAGS_64K)
216215
align = max_t(u32, align, SZ_64K);
217216

218-
if (bo->ggtt_node[ggtt->tile->id] && view->type == I915_GTT_VIEW_NORMAL) {
219-
vma->node = bo->ggtt_node[ggtt->tile->id];
217+
if (bo->ggtt_node[tile0->id] && view->type == I915_GTT_VIEW_NORMAL) {
218+
vma->node = bo->ggtt_node[tile0->id];
220219
} else if (view->type == I915_GTT_VIEW_NORMAL) {
221-
u32 x, size = bo->ttm.base.size;
222-
223220
vma->node = xe_ggtt_node_init(ggtt);
224221
if (IS_ERR(vma->node)) {
225222
ret = PTR_ERR(vma->node);
226223
goto out_unlock;
227224
}
228225

229-
ret = xe_ggtt_node_insert_locked(vma->node, size, align, 0);
226+
ret = xe_ggtt_node_insert_locked(vma->node, bo->size, align, 0);
230227
if (ret) {
231228
xe_ggtt_node_fini(vma->node);
232229
goto out_unlock;
233230
}
234231

235-
for (x = 0; x < size; x += XE_PAGE_SIZE) {
236-
u64 pte = ggtt->pt_ops->pte_encode_bo(bo, x,
237-
xe->pat.idx[XE_CACHE_NONE]);
238-
239-
ggtt->pt_ops->ggtt_set_pte(ggtt, vma->node->base.start + x, pte);
240-
}
232+
xe_ggtt_map_bo(ggtt, vma->node, bo, xe->pat.idx[XE_CACHE_NONE]);
241233
} else {
242234
u32 i, ggtt_ofs;
243235
const struct intel_rotation_info *rot_info = &view->rotated;
@@ -271,7 +263,7 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
271263
out_unlock:
272264
mutex_unlock(&ggtt->lock);
273265
out:
274-
xe_pm_runtime_put(tile_to_xe(ggtt->tile));
266+
xe_pm_runtime_put(xe);
275267
return ret;
276268
}
277269

@@ -348,7 +340,7 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
348340

349341
static void __xe_unpin_fb_vma(struct i915_vma *vma)
350342
{
351-
u8 tile_id = vma->node->ggtt->tile->id;
343+
u8 tile_id = xe_device_get_root_tile(xe_bo_device(vma->bo))->id;
352344

353345
if (!refcount_dec_and_test(&vma->ref))
354346
return;

0 commit comments

Comments
 (0)