Skip to content

Commit efd7cdf

Browse files
committed
sub directory gt/ is at linux 5.6.19.
1 parent eae76da commit efd7cdf

9 files changed

Lines changed: 108 additions & 55 deletions

File tree

sys/external/bsd/drm2/dist/drm/i915/gt/gen8_ppgtt.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,30 @@ static u64 gen8_pde_encode(const dma_addr_t addr,
3030
return pde;
3131
}
3232

33+
static u64 gen8_pte_encode(dma_addr_t addr,
34+
enum i915_cache_level level,
35+
u32 flags)
36+
{
37+
gen8_pte_t pte = addr | _PAGE_PRESENT | _PAGE_RW;
38+
39+
if (unlikely(flags & PTE_READ_ONLY))
40+
pte &= ~_PAGE_RW;
41+
42+
switch (level) {
43+
case I915_CACHE_NONE:
44+
pte |= PPAT_UNCACHED;
45+
break;
46+
case I915_CACHE_WT:
47+
pte |= PPAT_DISPLAY_ELLC;
48+
break;
49+
default:
50+
pte |= PPAT_CACHED;
51+
break;
52+
}
53+
54+
return pte;
55+
}
56+
3357
static void gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)
3458
{
3559
struct drm_i915_private *i915 = ppgtt->vm.i915;
@@ -805,6 +829,8 @@ struct i915_ppgtt *gen8_ppgtt_create(struct intel_gt *gt)
805829
ppgtt->vm.allocate_va_range = gen8_ppgtt_alloc;
806830
ppgtt->vm.clear_range = gen8_ppgtt_clear;
807831

832+
ppgtt->vm.pte_encode = gen8_pte_encode;
833+
808834
if (intel_vgpu_active(gt->i915))
809835
gen8_ppgtt_notify_vgt(ppgtt, true);
810836

sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,4 @@ intel_engine_has_preempt_reset(const struct intel_engine_cs *engine)
357357
return intel_engine_has_preemption(engine);
358358
}
359359

360-
static inline bool
361-
intel_engine_has_timeslices(const struct intel_engine_cs *engine)
362-
{
363-
if (!IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
364-
return false;
365-
366-
return intel_engine_has_semaphores(engine);
367-
}
368-
369360
#endif /* _INTEL_RINGBUFFER_H_ */

sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,11 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id)
305305
engine->id = id;
306306
engine->legacy_idx = INVALID_ENGINE;
307307
engine->mask = BIT(id);
308-
engine->i915 = gt->i915;
308+
engine->i915 = i915;
309309
engine->gt = gt;
310310
engine->uncore = gt->uncore;
311311
engine->hw_id = engine->guc_id = info->hw_id;
312-
engine->mmio_base = __engine_mmio_base(gt->i915, info->mmio_bases);
312+
engine->mmio_base = __engine_mmio_base(i915, info->mmio_bases);
313313

314314
engine->class = info->class;
315315
engine->instance = info->instance;
@@ -324,11 +324,15 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id)
324324
engine->props.timeslice_duration_ms =
325325
CONFIG_DRM_I915_TIMESLICE_DURATION;
326326

327+
/* Override to uninterruptible for OpenCL workloads. */
328+
if (INTEL_GEN(i915) == 12 && engine->class == RENDER_CLASS)
329+
engine->props.preempt_timeout_ms = 0;
330+
327331
engine->context_size = intel_engine_context_size(gt, engine->class);
328332
if (WARN_ON(engine->context_size > BIT(20)))
329333
engine->context_size = 0;
330334
if (engine->context_size)
331-
DRIVER_CAPS(gt->i915)->has_logical_contexts = true;
335+
DRIVER_CAPS(i915)->has_logical_contexts = true;
332336

333337
/* Nothing to do here, execute in order of dependencies */
334338
engine->schedule = NULL;
@@ -344,7 +348,7 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id)
344348
gt->engine_class[info->class][info->instance] = engine;
345349
gt->engine[id] = engine;
346350

347-
gt->i915->engine[id] = engine;
351+
i915->engine[id] = engine;
348352

349353
return 0;
350354
}

sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_types.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,11 @@ struct intel_engine_cs {
488488
#define I915_ENGINE_SUPPORTS_STATS BIT(1)
489489
#define I915_ENGINE_HAS_PREEMPTION BIT(2)
490490
#define I915_ENGINE_HAS_SEMAPHORES BIT(3)
491-
#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(4)
492-
#define I915_ENGINE_IS_VIRTUAL BIT(5)
493-
#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6)
494-
#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7)
491+
#define I915_ENGINE_HAS_TIMESLICES BIT(4)
492+
#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(5)
493+
#define I915_ENGINE_IS_VIRTUAL BIT(6)
494+
#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(7)
495+
#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(8)
495496
unsigned int flags;
496497

497498
/*
@@ -588,6 +589,15 @@ intel_engine_has_semaphores(const struct intel_engine_cs *engine)
588589
return engine->flags & I915_ENGINE_HAS_SEMAPHORES;
589590
}
590591

592+
static inline bool
593+
intel_engine_has_timeslices(const struct intel_engine_cs *engine)
594+
{
595+
if (!IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
596+
return false;
597+
598+
return engine->flags & I915_ENGINE_HAS_TIMESLICES;
599+
}
600+
591601
static inline bool
592602
intel_engine_needs_breadcrumb_tasklet(const struct intel_engine_cs *engine)
593603
{

sys/external/bsd/drm2/dist/drm/i915/gt/intel_ggtt.c

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ static void gmch_ggtt_invalidate(struct i915_ggtt *ggtt)
193193
intel_gtt_chipset_flush();
194194
}
195195

196+
static u64 gen8_ggtt_pte_encode(dma_addr_t addr,
197+
enum i915_cache_level level,
198+
u32 flags)
199+
{
200+
return addr | _PAGE_PRESENT;
201+
}
202+
196203
#ifdef __NetBSD__
197204
static inline void
198205
gen8_set_pte(bus_space_tag_t bst, bus_space_handle_t bsh, unsigned i,
@@ -228,9 +235,9 @@ static void gen8_ggtt_insert_page(struct i915_address_space *vm,
228235

229236
#ifdef __NetBSD__
230237
gen8_set_pte(ggtt->gsmt, ggtt->gsmh, offset / I915_GTT_PAGE_SIZE,
231-
gen8_pte_encode(addr, level, 0));
238+
gen8_ggtt_pte_encode(addr, level, 0));
232239
#else
233-
gen8_set_pte(pte, gen8_pte_encode(addr, level, 0));
240+
gen8_set_pte(pte, gen8_ggtt_pte_encode(addr, level, 0));
234241
#endif
235242

236243
ggtt->invalidate(ggtt);
@@ -250,7 +257,8 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm,
250257
struct sgt_iter sgt_iter;
251258
gen8_pte_t __iomem *gtt_entries;
252259
#endif
253-
const gen8_pte_t pte_encode = gen8_pte_encode(0, level, 0);
260+
gen8_pte_t __iomem *gte;
261+
gen8_pte_t __iomem *end;
254262
dma_addr_t addr;
255263

256264
/*
@@ -274,11 +282,17 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm,
274282
KASSERT(len == 0);
275283
}
276284
#else
277-
gtt_entries = (gen8_pte_t __iomem *)ggtt->gsm;
278-
gtt_entries += vma->node.start / I915_GTT_PAGE_SIZE;
279-
for_each_sgt_daddr(addr, sgt_iter, vma->pages)
280-
gen8_set_pte(gtt_entries++, pte_encode | addr);
285+
gte = (gen8_pte_t __iomem *)ggtt->gsm;
286+
gte += vma->node.start / I915_GTT_PAGE_SIZE;
287+
end = gte + vma->node.size / I915_GTT_PAGE_SIZE;
288+
289+
for_each_sgt_daddr(addr, iter, vma->pages)
290+
gen8_set_pte(gte++, pte_encode | addr);
291+
GEM_BUG_ON(gte > end);
281292
#endif
293+
/* Fill the allocated but "unused" space beyond the end of the buffer */
294+
while (gte < end)
295+
gen8_set_pte(gte++, vm->scratch[0].encode);
282296

283297
/*
284298
* We want to flush the TLBs only after we're certain all the PTE
@@ -329,8 +343,8 @@ static void gen6_ggtt_insert_entries(struct i915_address_space *vm,
329343
unsigned seg;
330344
unsigned pgno;
331345
#else
332-
gen6_pte_t __iomem *entries = (gen6_pte_t __iomem *)ggtt->gsm;
333-
unsigned int i = vma->node.start / I915_GTT_PAGE_SIZE;
346+
gen6_pte_t __iomem *gte;
347+
gen6_pte_t __iomem *end;
334348
struct sgt_iter iter;
335349
#endif
336350
dma_addr_t addr;
@@ -355,8 +369,17 @@ static void gen6_ggtt_insert_entries(struct i915_address_space *vm,
355369
/* XXX KASSERT(pgno <= ...)? */
356370
}
357371
#else
372+
gte = (gen6_pte_t __iomem *)ggtt->gsm;
373+
gte += vma->node.start / I915_GTT_PAGE_SIZE;
374+
end = gte + vma->node.size / I915_GTT_PAGE_SIZE;
375+
358376
for_each_sgt_daddr(addr, iter, vma->pages)
359-
iowrite32(vm->pte_encode(addr, level, flags), &entries[i++]);
377+
iowrite32(vm->pte_encode(addr, level, flags), gte++);
378+
GEM_BUG_ON(gte > end);
379+
380+
/* Fill the allocated but "unused" space beyond the end of the buffer */
381+
while (gte < end)
382+
iowrite32(vm->scratch[0].encode, gte++);
360383
#endif
361384

362385
/*
@@ -1064,7 +1087,7 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)
10641087
ggtt->vm.vma_ops.set_pages = ggtt_set_pages;
10651088
ggtt->vm.vma_ops.clear_pages = clear_pages;
10661089

1067-
ggtt->vm.pte_encode = gen8_pte_encode;
1090+
ggtt->vm.pte_encode = gen8_ggtt_pte_encode;
10681091

10691092
setup_private_pat(ggtt->vm.gt->uncore);
10701093

sys/external/bsd/drm2/dist/drm/i915/gt/intel_gtt.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -575,30 +575,6 @@ void gtt_write_workarounds(struct intel_gt *gt)
575575
}
576576
}
577577

578-
u64 gen8_pte_encode(dma_addr_t addr,
579-
enum i915_cache_level level,
580-
u32 flags)
581-
{
582-
gen8_pte_t pte = addr | _PAGE_PRESENT | _PAGE_RW;
583-
584-
if (unlikely(flags & PTE_READ_ONLY))
585-
pte &= ~_PAGE_RW;
586-
587-
switch (level) {
588-
case I915_CACHE_NONE:
589-
pte |= PPAT_UNCACHED;
590-
break;
591-
case I915_CACHE_WT:
592-
pte |= PPAT_DISPLAY_ELLC;
593-
break;
594-
default:
595-
pte |= PPAT_CACHED;
596-
break;
597-
}
598-
599-
return pte;
600-
}
601-
602578
static void tgl_setup_private_ppat(struct intel_uncore *uncore)
603579
{
604580
/* TGL doesn't support LLC or AGE settings */

sys/external/bsd/drm2/dist/drm/i915/gt/intel_lrc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,9 @@ static void defer_request(struct i915_request *rq, struct list_head * const pl)
16991699
struct i915_request *w =
17001700
container_of(p->waiter, typeof(*w), sched);
17011701

1702+
if (p->flags & I915_DEPENDENCY_WEAK)
1703+
continue;
1704+
17021705
/* Leave semaphores spinning on the other engines */
17031706
if (w->engine != rq->engine)
17041707
continue;
@@ -4286,8 +4289,11 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
42864289
engine->flags |= I915_ENGINE_SUPPORTS_STATS;
42874290
if (!intel_vgpu_active(engine->i915)) {
42884291
engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
4289-
if (HAS_LOGICAL_RING_PREEMPTION(engine->i915))
4292+
if (HAS_LOGICAL_RING_PREEMPTION(engine->i915)) {
42904293
engine->flags |= I915_ENGINE_HAS_PREEMPTION;
4294+
if (IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
4295+
engine->flags |= I915_ENGINE_HAS_TIMESLICES;
4296+
}
42914297
}
42924298

42934299
if (INTEL_GEN(engine->i915) >= 12)

sys/external/bsd/drm2/dist/drm/i915/gt/intel_rps.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ static void rps_enable_interrupts(struct intel_rps *rps)
9494
gen6_gt_pm_enable_irq(gt, rps->pm_events);
9595
spin_unlock_irq(&gt->irq_lock);
9696

97-
set(gt->uncore, GEN6_PMINTRMSK, rps_pm_mask(rps, rps->cur_freq));
97+
intel_uncore_write(gt->uncore,
98+
GEN6_PMINTRMSK, rps_pm_mask(rps, rps->last_freq));
9899
}
99100

100101
static void gen6_rps_reset_interrupts(struct intel_rps *rps)
@@ -128,7 +129,8 @@ static void rps_disable_interrupts(struct intel_rps *rps)
128129

129130
rps->pm_events = 0;
130131

131-
set(gt->uncore, GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u));
132+
intel_uncore_write(gt->uncore,
133+
GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u));
132134

133135
spin_lock_irq(&gt->irq_lock);
134136
gen6_gt_pm_disable_irq(gt, GEN6_PM_RPS_EVENTS);
@@ -774,6 +776,19 @@ void intel_rps_park(struct intel_rps *rps)
774776
intel_uncore_forcewake_get(rps_to_uncore(rps), FORCEWAKE_MEDIA);
775777
rps_set(rps, rps->idle_freq, false);
776778
intel_uncore_forcewake_put(rps_to_uncore(rps), FORCEWAKE_MEDIA);
779+
780+
/*
781+
* Since we will try and restart from the previously requested
782+
* frequency on unparking, treat this idle point as a downclock
783+
* interrupt and reduce the frequency for resume. If we park/unpark
784+
* more frequently than the rps worker can run, we will not respond
785+
* to any EI and never see a change in frequency.
786+
*
787+
* (Note we accommodate Cherryview's limitation of only using an
788+
* even bin by applying it to all.)
789+
*/
790+
rps->cur_freq =
791+
max_t(int, round_down(rps->cur_freq - 1, 2), rps->min_freq);
777792
}
778793

779794
void intel_rps_boost(struct i915_request *rq)

sys/external/bsd/drm2/dist/drm/i915/gt/intel_timeline.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ int intel_timeline_read_hwsp(struct i915_request *from,
524524

525525
rcu_read_lock();
526526
cl = rcu_dereference(from->hwsp_cacheline);
527+
if (i915_request_completed(from)) /* confirm cacheline is valid */
528+
goto unlock;
527529
if (unlikely(!i915_active_acquire_if_busy(&cl->active)))
528530
goto unlock; /* seqno wrapped and completed! */
529531
if (unlikely(i915_request_completed(from)))

0 commit comments

Comments
 (0)