Skip to content

Commit 7163484

Browse files
Changbin Duzhenyw
authored andcommitted
drm/i915/gvt: Add software PTE flag to mark special 64K splited entry
This add a software PTE flag on the Ignored bit of PTE. It will be used to identify splited 64K shadow entries. v2: fix mask definition. Signed-off-by: Changbin Du <[email protected]> Signed-off-by: Zhenyu Wang <[email protected]>
1 parent 40b2717 commit 7163484

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

drivers/gpu/drm/i915/gvt/gtt.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ static inline int gtt_set_entry64(void *pt,
348348
#define ADDR_64K_MASK GENMASK_ULL(GTT_HAW - 1, 16)
349349
#define ADDR_4K_MASK GENMASK_ULL(GTT_HAW - 1, 12)
350350

351+
#define GTT_SPTE_FLAG_MASK GENMASK_ULL(62, 52)
352+
#define GTT_SPTE_FLAG_64K_SPLITED BIT(52) /* splited 64K gtt entry */
353+
351354
static unsigned long gen8_gtt_get_pfn(struct intel_gvt_gtt_entry *e)
352355
{
353356
unsigned long pfn;
@@ -427,6 +430,21 @@ static void gtt_entry_set_present(struct intel_gvt_gtt_entry *e)
427430
e->val64 |= _PAGE_PRESENT;
428431
}
429432

433+
static bool gen8_gtt_test_64k_splited(struct intel_gvt_gtt_entry *e)
434+
{
435+
return !!(e->val64 & GTT_SPTE_FLAG_64K_SPLITED);
436+
}
437+
438+
static void gen8_gtt_set_64k_splited(struct intel_gvt_gtt_entry *e)
439+
{
440+
e->val64 |= GTT_SPTE_FLAG_64K_SPLITED;
441+
}
442+
443+
static void gen8_gtt_clear_64k_splited(struct intel_gvt_gtt_entry *e)
444+
{
445+
e->val64 &= ~GTT_SPTE_FLAG_64K_SPLITED;
446+
}
447+
430448
/*
431449
* Per-platform GMA routines.
432450
*/
@@ -461,6 +479,9 @@ static struct intel_gvt_gtt_pte_ops gen8_gtt_pte_ops = {
461479
.test_pse = gen8_gtt_test_pse,
462480
.clear_ips = gen8_gtt_clear_ips,
463481
.test_ips = gen8_gtt_test_ips,
482+
.clear_64k_splited = gen8_gtt_clear_64k_splited,
483+
.set_64k_splited = gen8_gtt_set_64k_splited,
484+
.test_64k_splited = gen8_gtt_test_64k_splited,
464485
.get_pfn = gen8_gtt_get_pfn,
465486
.set_pfn = gen8_gtt_set_pfn,
466487
};

drivers/gpu/drm/i915/gvt/gtt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ struct intel_gvt_gtt_pte_ops {
6565
bool (*test_pse)(struct intel_gvt_gtt_entry *e);
6666
bool (*test_ips)(struct intel_gvt_gtt_entry *e);
6767
void (*clear_ips)(struct intel_gvt_gtt_entry *e);
68+
bool (*test_64k_splited)(struct intel_gvt_gtt_entry *e);
69+
void (*clear_64k_splited)(struct intel_gvt_gtt_entry *e);
70+
void (*set_64k_splited)(struct intel_gvt_gtt_entry *e);
6871
void (*set_pfn)(struct intel_gvt_gtt_entry *e, unsigned long pfn);
6972
unsigned long (*get_pfn)(struct intel_gvt_gtt_entry *e);
7073
};

0 commit comments

Comments
 (0)