Skip to content

Commit 11724ee

Browse files
matt-aulddanvet
authored andcommitted
drm/i915/gtt/dg1: add PTE_LM plumbing for ppGTT
For the PTEs we get an LM bit, to signal whether the page resides in SMEM or LMEM. BSpec: 45040 v2: just use gen8_pte_encode for dg1 Signed-off-by: Matthew Auld <[email protected]> Cc: Joonas Lahtinen <[email protected]> Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Signed-off-by: Niranjana Vishwanathapura <[email protected]> Signed-off-by: Venkata Sandeep Dhanalakota <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Chris Wilson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Daniel Vetter <[email protected]>
1 parent c538d54 commit 11724ee

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

drivers/gpu/drm/i915/gt/gen8_ppgtt.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include <linux/log2.h>
77

8+
#include "gem/i915_gem_lmem.h"
9+
810
#include "gen8_ppgtt.h"
911
#include "i915_scatterlist.h"
1012
#include "i915_trace.h"
@@ -35,6 +37,9 @@ static u64 gen8_pte_encode(dma_addr_t addr,
3537
if (unlikely(flags & PTE_READ_ONLY))
3638
pte &= ~_PAGE_RW;
3739

40+
if (flags & PTE_LM)
41+
pte |= GEN12_PPGTT_PTE_LM;
42+
3843
switch (level) {
3944
case I915_CACHE_NONE:
4045
pte |= PPAT_UNCACHED;
@@ -558,6 +563,7 @@ static void gen8_ppgtt_insert(struct i915_address_space *vm,
558563

559564
static int gen8_init_scratch(struct i915_address_space *vm)
560565
{
566+
u32 pte_flags;
561567
int ret;
562568
int i;
563569

@@ -581,9 +587,13 @@ static int gen8_init_scratch(struct i915_address_space *vm)
581587
if (ret)
582588
return ret;
583589

590+
pte_flags = vm->has_read_only;
591+
if (i915_gem_object_is_lmem(vm->scratch[0]))
592+
pte_flags |= PTE_LM;
593+
584594
vm->scratch[0]->encode =
585595
gen8_pte_encode(px_dma(vm->scratch[0]),
586-
I915_CACHE_LLC, vm->has_read_only);
596+
I915_CACHE_LLC, pte_flags);
587597

588598
for (i = 1; i <= vm->top; i++) {
589599
struct drm_i915_gem_object *obj;

drivers/gpu/drm/i915/gt/intel_gtt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ typedef u64 gen8_pte_t;
8585
#define BYT_PTE_SNOOPED_BY_CPU_CACHES REG_BIT(2)
8686
#define BYT_PTE_WRITEABLE REG_BIT(1)
8787

88+
#define GEN12_PPGTT_PTE_LM BIT_ULL(11)
89+
8890
/*
8991
* Cacheability Control is a 4-bit value. The low three bits are stored in bits
9092
* 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
@@ -264,6 +266,7 @@ struct i915_address_space {
264266
enum i915_cache_level level,
265267
u32 flags); /* Create a valid PTE */
266268
#define PTE_READ_ONLY BIT(0)
269+
#define PTE_LM BIT(1)
267270

268271
void (*allocate_va_range)(struct i915_address_space *vm,
269272
struct i915_vm_pt_stash *stash,

drivers/gpu/drm/i915/gt/intel_ppgtt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include <linux/slab.h>
77

8+
#include "gem/i915_gem_lmem.h"
9+
810
#include "i915_trace.h"
911
#include "intel_gtt.h"
1012
#include "gen6_ppgtt.h"
@@ -192,6 +194,8 @@ void ppgtt_bind_vma(struct i915_address_space *vm,
192194
pte_flags = 0;
193195
if (i915_gem_object_is_readonly(vma->obj))
194196
pte_flags |= PTE_READ_ONLY;
197+
if (i915_gem_object_is_lmem(vma->obj))
198+
pte_flags |= PTE_LM;
195199

196200
vm->insert_entries(vm, vma, cache_level, pte_flags);
197201
wmb();

0 commit comments

Comments
 (0)