Skip to content

Commit c3e6976

Browse files
Changbin Duzhenyw
authored andcommitted
drm/i915/gvt: Add GTT clear_pse operation
Add clear_pse operation in case we need to split huge gtt into small pages. v2: correct description. Signed-off-by: Changbin Du <[email protected]> Signed-off-by: Zhenyu Wang <[email protected]>
1 parent 7163484 commit c3e6976

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,24 @@ static bool gen8_gtt_test_pse(struct intel_gvt_gtt_entry *e)
390390
return !!(e->val64 & _PAGE_PSE);
391391
}
392392

393+
static void gen8_gtt_clear_pse(struct intel_gvt_gtt_entry *e)
394+
{
395+
if (gen8_gtt_test_pse(e)) {
396+
switch (e->type) {
397+
case GTT_TYPE_PPGTT_PTE_2M_ENTRY:
398+
e->val64 &= ~_PAGE_PSE;
399+
e->type = GTT_TYPE_PPGTT_PDE_ENTRY;
400+
break;
401+
case GTT_TYPE_PPGTT_PTE_1G_ENTRY:
402+
e->type = GTT_TYPE_PPGTT_PDP_ENTRY;
403+
e->val64 &= ~_PAGE_PSE;
404+
break;
405+
default:
406+
WARN_ON(1);
407+
}
408+
}
409+
}
410+
393411
static bool gen8_gtt_test_ips(struct intel_gvt_gtt_entry *e)
394412
{
395413
if (GEM_WARN_ON(e->type != GTT_TYPE_PPGTT_PDE_ENTRY))
@@ -477,6 +495,7 @@ static struct intel_gvt_gtt_pte_ops gen8_gtt_pte_ops = {
477495
.set_present = gtt_entry_set_present,
478496
.test_present = gen8_gtt_test_present,
479497
.test_pse = gen8_gtt_test_pse,
498+
.clear_pse = gen8_gtt_clear_pse,
480499
.clear_ips = gen8_gtt_clear_ips,
481500
.test_ips = gen8_gtt_test_ips,
482501
.clear_64k_splited = gen8_gtt_clear_64k_splited,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct intel_gvt_gtt_pte_ops {
6363
void (*clear_present)(struct intel_gvt_gtt_entry *e);
6464
void (*set_present)(struct intel_gvt_gtt_entry *e);
6565
bool (*test_pse)(struct intel_gvt_gtt_entry *e);
66+
void (*clear_pse)(struct intel_gvt_gtt_entry *e);
6667
bool (*test_ips)(struct intel_gvt_gtt_entry *e);
6768
void (*clear_ips)(struct intel_gvt_gtt_entry *e);
6869
bool (*test_64k_splited)(struct intel_gvt_gtt_entry *e);

0 commit comments

Comments
 (0)