Commit 054f4eba authored by Zhi Wang's avatar Zhi Wang Committed by Zhenyu Wang

drm/i915/gvt: Introduce page table type of current level in GTT type enumerations

Need to figure out page table type of current level by GTT entry type
during getting a scratch page table entry.
Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
parent 74220648
...@@ -156,13 +156,15 @@ int intel_gvt_ggtt_h2g_index(struct intel_vgpu *vgpu, unsigned long h_index, ...@@ -156,13 +156,15 @@ int intel_gvt_ggtt_h2g_index(struct intel_vgpu *vgpu, unsigned long h_index,
struct gtt_type_table_entry { struct gtt_type_table_entry {
int entry_type; int entry_type;
int pt_type;
int next_pt_type; int next_pt_type;
int pse_entry_type; int pse_entry_type;
}; };
#define GTT_TYPE_TABLE_ENTRY(type, e_type, npt_type, pse_type) \ #define GTT_TYPE_TABLE_ENTRY(type, e_type, cpt_type, npt_type, pse_type) \
[type] = { \ [type] = { \
.entry_type = e_type, \ .entry_type = e_type, \
.pt_type = cpt_type, \
.next_pt_type = npt_type, \ .next_pt_type = npt_type, \
.pse_entry_type = pse_type, \ .pse_entry_type = pse_type, \
} }
...@@ -170,55 +172,68 @@ struct gtt_type_table_entry { ...@@ -170,55 +172,68 @@ struct gtt_type_table_entry {
static struct gtt_type_table_entry gtt_type_table[] = { static struct gtt_type_table_entry gtt_type_table[] = {
GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_ROOT_L4_ENTRY, GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_ROOT_L4_ENTRY,
GTT_TYPE_PPGTT_ROOT_L4_ENTRY, GTT_TYPE_PPGTT_ROOT_L4_ENTRY,
GTT_TYPE_INVALID,
GTT_TYPE_PPGTT_PML4_PT, GTT_TYPE_PPGTT_PML4_PT,
GTT_TYPE_INVALID), GTT_TYPE_INVALID),
GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_PML4_PT, GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_PML4_PT,
GTT_TYPE_PPGTT_PML4_EN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_TYPE_PPGTT_PTE_4K_ENTRY,
GTT_TYPE_PPGTT_PTE_PT,
GTT_TYPE_INVALID, GTT_TYPE_INVALID,
GTT_TYPE_INVALID), GTT_TYPE_INVALID),
GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_PTE_2M_ENTRY, GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_PTE_2M_ENTRY,
GTT_TYPE_PPGTT_PDE_ENTRY, GTT_TYPE_PPGTT_PDE_ENTRY,
GTT_TYPE_PPGTT_PDE_PT,
GTT_TYPE_INVALID, GTT_TYPE_INVALID,
GTT_TYPE_PPGTT_PTE_2M_ENTRY), GTT_TYPE_PPGTT_PTE_2M_ENTRY),
GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_PTE_1G_ENTRY, GTT_TYPE_TABLE_ENTRY(GTT_TYPE_PPGTT_PTE_1G_ENTRY,
GTT_TYPE_PPGTT_PDP_ENTRY, GTT_TYPE_PPGTT_PDP_ENTRY,
GTT_TYPE_PPGTT_PDP_PT,
GTT_TYPE_INVALID, GTT_TYPE_INVALID,
GTT_TYPE_PPGTT_PTE_1G_ENTRY), GTT_TYPE_PPGTT_PTE_1G_ENTRY),
GTT_TYPE_TABLE_ENTRY(GTT_TYPE_GGTT_PTE, GTT_TYPE_TABLE_ENTRY(GTT_TYPE_GGTT_PTE,
GTT_TYPE_GGTT_PTE, GTT_TYPE_GGTT_PTE,
GTT_TYPE_INVALID, GTT_TYPE_INVALID,
GTT_TYPE_INVALID,
GTT_TYPE_INVALID), GTT_TYPE_INVALID),
}; };
...@@ -227,6 +242,11 @@ static inline int get_next_pt_type(int type) ...@@ -227,6 +242,11 @@ static inline int get_next_pt_type(int type)
return gtt_type_table[type].next_pt_type; return gtt_type_table[type].next_pt_type;
} }
static inline int get_pt_type(int type)
{
return gtt_type_table[type].pt_type;
}
static inline int get_entry_type(int type) static inline int get_entry_type(int type)
{ {
return gtt_type_table[type].entry_type; return gtt_type_table[type].entry_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment