Skip to content

Commit 22c55ab

Browse files
committed
loongarch debug
1 parent edc48e2 commit 22c55ab

File tree

13 files changed

+38
-34
lines changed

13 files changed

+38
-34
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151
#define RING_START(base) XE_REG((base) + 0x38)
5252

5353
#define RING_CTL(base) XE_REG((base) + 0x3c)
54-
#define RING_CTL_SIZE(size) ((size) - PAGE_SIZE) /* in bytes -> pages */
55-
#define RING_CTL_SIZE(size) ((size) - PAGE_SIZE) /* in bytes -> pages */
54+
#define RING_CTL_SIZE(size) ((size) - XE_PAGE_SIZE) /* in bytes -> pages */
5655

5756
#define RING_PSMI_CTL(base) XE_REG((base) + 0x50, XE_REG_OPTION_MASKED)
5857
#define RC_SEMA_IDLE_MSG_DISABLE REG_BIT(12)

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
12121212
};
12131213
struct ttm_placement *placement;
12141214
uint32_t alignment;
1215-
size_t aligned_size;
1215+
size_t aligned_size = size;
12161216
int err;
12171217

12181218
/* Only kernel objects should set GT */
@@ -1233,13 +1233,13 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
12331233
alignment = SZ_64K >> PAGE_SHIFT;
12341234

12351235
} else {
1236-
aligned_size = ALIGN(size, SZ_4K);
1236+
aligned_size = ALIGN(size, PAGE_SIZE);
12371237
flags &= ~XE_BO_INTERNAL_64K;
1238-
alignment = SZ_4K >> PAGE_SHIFT;
1238+
alignment = PAGE_SIZE >> PAGE_SHIFT;
12391239
}
12401240

1241-
if (type == ttm_bo_type_device && aligned_size != size)
1242-
return ERR_PTR(-EINVAL);
1241+
// if (type == ttm_bo_type_device && aligned_size != size)
1242+
// return ERR_PTR(-EINVAL);
12431243

12441244
if (!bo) {
12451245
bo = xe_bo_alloc();
@@ -1249,7 +1249,8 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
12491249

12501250
bo->ccs_cleared = false;
12511251
bo->tile = tile;
1252-
bo->size = size;
1252+
//bo->size = size;
1253+
bo->size = aligned_size;
12531254
bo->flags = flags;
12541255
bo->cpu_caching = cpu_caching;
12551256
bo->ttm.base.funcs = &xe_gem_object_funcs;
@@ -1262,7 +1263,7 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
12621263
INIT_LIST_HEAD(&bo->client_link);
12631264
#endif
12641265

1265-
drm_gem_private_object_init(&xe->drm, &bo->ttm.base, size);
1266+
drm_gem_private_object_init(&xe->drm, &bo->ttm.base, aligned_size);
12661267

12671268
if (resv) {
12681269
ctx.allow_res_evict = !(flags & XE_BO_CREATE_NO_RESV_EVICT);

drivers/gpu/drm/xe/xe_ggtt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static u64 xelp_ggtt_pte_encode_bo(struct xe_bo *bo, u64 bo_offset,
3030
{
3131
u64 pte;
3232

33-
pte = xe_bo_addr(bo, bo_offset, XE_PAGE_SIZE);
33+
pte = xe_bo_addr(bo, bo_offset, XE_PAGE_SIZE) & ~XE_PTE_MASK;
3434
pte |= XE_PAGE_PRESENT;
3535

3636
if (xe_bo_is_vram(bo) || xe_bo_is_stolen_devmem(bo))

drivers/gpu/drm/xe/xe_guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static u32 guc_ctl_feature_flags(struct xe_guc *guc)
7070

7171
static u32 guc_ctl_log_params_flags(struct xe_guc *guc)
7272
{
73-
u32 offset = guc_bo_ggtt_addr(guc, guc->log.bo) >> PAGE_SHIFT;
73+
u32 offset = guc_bo_ggtt_addr(guc, guc->log.bo) >> XE_PTE_SHIFT;
7474
u32 flags;
7575

7676
#if (((CRASH_BUFFER_SIZE) % SZ_1M) == 0)
@@ -123,7 +123,7 @@ static u32 guc_ctl_log_params_flags(struct xe_guc *guc)
123123

124124
static u32 guc_ctl_ads_flags(struct xe_guc *guc)
125125
{
126-
u32 ads = guc_bo_ggtt_addr(guc, guc->ads.bo) >> PAGE_SHIFT;
126+
u32 ads = guc_bo_ggtt_addr(guc, guc->ads.bo) >> XE_PTE_SHIFT;
127127
u32 flags = ads << GUC_ADS_ADDR_SHIFT;
128128

129129
return flags;

drivers/gpu/drm/xe/xe_guc_ads.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ static size_t guc_ads_regset_size(struct xe_guc_ads *ads)
128128

129129
static size_t guc_ads_golden_lrc_size(struct xe_guc_ads *ads)
130130
{
131-
return PAGE_ALIGN(ads->golden_lrc_size);
131+
return ALIGN(ads->golden_lrc_size, XE_PAGE_SIZE);
132132
}
133133

134134
static size_t guc_ads_capture_size(struct xe_guc_ads *ads)
135135
{
136136
/* FIXME: Allocate a proper capture list */
137-
return PAGE_ALIGN(PAGE_SIZE);
137+
return XE_PAGE_SIZE;
138138
}
139139

140140
static size_t guc_ads_um_queues_size(struct xe_guc_ads *ads)
@@ -149,7 +149,7 @@ static size_t guc_ads_um_queues_size(struct xe_guc_ads *ads)
149149

150150
static size_t guc_ads_private_data_size(struct xe_guc_ads *ads)
151151
{
152-
return PAGE_ALIGN(ads_to_guc(ads)->fw.private_data_size);
152+
return ALIGN(ads_to_guc(ads)->fw.private_data_size, XE_PAGE_SIZE);
153153
}
154154

155155
static size_t guc_ads_regset_offset(struct xe_guc_ads *ads)
@@ -164,7 +164,7 @@ static size_t guc_ads_golden_lrc_offset(struct xe_guc_ads *ads)
164164
offset = guc_ads_regset_offset(ads) +
165165
guc_ads_regset_size(ads);
166166

167-
return PAGE_ALIGN(offset);
167+
return ALIGN(offset, XE_PAGE_SIZE);
168168
}
169169

170170
static size_t guc_ads_capture_offset(struct xe_guc_ads *ads)
@@ -174,7 +174,7 @@ static size_t guc_ads_capture_offset(struct xe_guc_ads *ads)
174174
offset = guc_ads_golden_lrc_offset(ads) +
175175
guc_ads_golden_lrc_size(ads);
176176

177-
return PAGE_ALIGN(offset);
177+
return ALIGN(offset, XE_PAGE_SIZE);
178178
}
179179

180180
static size_t guc_ads_um_queues_offset(struct xe_guc_ads *ads)
@@ -184,7 +184,7 @@ static size_t guc_ads_um_queues_offset(struct xe_guc_ads *ads)
184184
offset = guc_ads_capture_offset(ads) +
185185
guc_ads_capture_size(ads);
186186

187-
return PAGE_ALIGN(offset);
187+
return ALIGN(offset, XE_PAGE_SIZE);
188188
}
189189

190190
static size_t guc_ads_private_data_offset(struct xe_guc_ads *ads)
@@ -194,7 +194,7 @@ static size_t guc_ads_private_data_offset(struct xe_guc_ads *ads)
194194
offset = guc_ads_um_queues_offset(ads) +
195195
guc_ads_um_queues_size(ads);
196196

197-
return PAGE_ALIGN(offset);
197+
return ALIGN(offset, XE_PAGE_SIZE);
198198
}
199199

200200
static size_t guc_ads_size(struct xe_guc_ads *ads)
@@ -253,7 +253,7 @@ static size_t calculate_golden_lrc_size(struct xe_guc_ads *ads)
253253
continue;
254254

255255
real_size = xe_lrc_size(xe, class);
256-
alloc_size = PAGE_ALIGN(real_size);
256+
alloc_size = ALIGN(real_size, XE_PAGE_SIZE); // 这里究竟如何对齐
257257
total_size += alloc_size;
258258
}
259259

@@ -637,7 +637,7 @@ static void guc_populate_golden_lrc(struct xe_guc_ads *ads)
637637
xe_gt_assert(gt, gt->default_lrc[class]);
638638

639639
real_size = xe_lrc_size(xe, class);
640-
alloc_size = PAGE_ALIGN(real_size);
640+
alloc_size = ALIGN(real_size, XE_PAGE_SIZE); // 这里究竟如何对齐
641641
total_size += alloc_size;
642642

643643
/*

drivers/gpu/drm/xe/xe_guc_ct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
136136
struct xe_bo *bo;
137137
int err;
138138

139-
xe_assert(xe, !(guc_ct_size() % PAGE_SIZE));
139+
xe_assert(xe, !(guc_ct_size() % XE_PAGE_SIZE));
140140

141141
drmm_mutex_init(&xe->drm, &ct->lock);
142142
spin_lock_init(&ct->fast_lock);

drivers/gpu/drm/xe/xe_guc_log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static size_t guc_log_size(void)
4545
* | Capture logs |
4646
* +===============================+ + CAPTURE_SIZE
4747
*/
48-
return PAGE_SIZE + CRASH_BUFFER_SIZE + DEBUG_BUFFER_SIZE +
48+
return XE_PAGE_SIZE + CRASH_BUFFER_SIZE + DEBUG_BUFFER_SIZE +
4949
CAPTURE_BUFFER_SIZE;
5050
}
5151

drivers/gpu/drm/xe/xe_guc_pc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
865865
{
866866
struct xe_device *xe = pc_to_xe(pc);
867867
struct xe_gt *gt = pc_to_gt(pc);
868-
u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));
868+
u32 size = ALIGN(sizeof(struct slpc_shared_data), XE_PAGE_SIZE);
869869
int ret;
870870

871871
xe_gt_assert(gt, xe_device_uc_enabled(xe));
@@ -984,7 +984,7 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
984984
struct xe_tile *tile = gt_to_tile(gt);
985985
struct xe_device *xe = gt_to_xe(gt);
986986
struct xe_bo *bo;
987-
u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));
987+
u32 size = ALIGN(sizeof(struct slpc_shared_data), XE_PAGE_SIZE);
988988

989989
if (xe->info.skip_guc_pc)
990990
return 0;

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static void emit_pte(struct xe_migrate *m,
506506
u64 addr, flags = 0;
507507
bool devmem = false;
508508

509-
addr = xe_res_dma(cur) & PAGE_MASK;
509+
addr = xe_res_dma(cur) & ~XE_PTE_MASK;
510510
if (is_vram) {
511511
if (vm->flags & XE_VM_FLAG_64K) {
512512
u64 va = cur_ofs * XE_PAGE_SIZE / 8;
@@ -527,7 +527,7 @@ static void emit_pte(struct xe_migrate *m,
527527
bb->cs[bb->len++] = lower_32_bits(addr);
528528
bb->cs[bb->len++] = upper_32_bits(addr);
529529

530-
xe_res_next(cur, min_t(u32, size, PAGE_SIZE));
530+
xe_res_next(cur, min_t(u32, size, XE_PAGE_SIZE));
531531
cur_ofs += 8;
532532
}
533533
}
@@ -720,7 +720,7 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
720720

721721
if (copy_system_ccs)
722722
xe_res_first_sg(xe_bo_sg(src_bo), xe_bo_ccs_pages_start(src_bo),
723-
PAGE_ALIGN(xe_device_ccs_bytes(xe, size)),
723+
PAGE_ALIGN(xe_device_ccs_bytes(xe, size)), // 这里的对齐?
724724
&ccs_it);
725725

726726
while (size) {

drivers/gpu/drm/xe/xe_pt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ __xe_pt_bind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queue
12301230
xe_bo_assert_held(xe_vma_bo(vma));
12311231
xe_vm_assert_held(vm);
12321232

1233-
vm_dbg(&xe_vma_vm(vma)->xe->drm,
1233+
drm_info(&xe_vma_vm(vma)->xe->drm,
12341234
"Preparing bind, with range [%llx...%llx) engine %p.\n",
12351235
xe_vma_start(vma), xe_vma_end(vma), q);
12361236

0 commit comments

Comments
 (0)