Commit 74f800c7 authored by Matt Roper's avatar Matt Roper Committed by Rodrigo Vivi

drm/xe: Remove gen-based mmio offsets from hw engine init

During early generations of Intel GPUs, hardware engines would sometimes
move to new MMIO offsets from one platform/generation to the next.
These days engines the hardware teams put more effort into ensuring that
engines stay at consistent locations; even major design changes (like
the introduction of standalone media) keep the MMIO locations of the
engines constant.

Since all platforms supported by the Xe driver are new enough to have a
single MMIO offset for each engine (and since our crystal ball says that
these offsets are very unlikely to change again in the foreseeable
future), we can simplify the driver's engine definitions and remove the
gen-based MMIO bases.
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 353dfaaa
...@@ -31,11 +31,7 @@ struct engine_info { ...@@ -31,11 +31,7 @@ struct engine_info {
unsigned int class : 8; unsigned int class : 8;
unsigned int instance : 8; unsigned int instance : 8;
enum xe_force_wake_domains domain; enum xe_force_wake_domains domain;
/* mmio bases table *must* be sorted in reverse graphics_ver order */ u32 mmio_base;
struct engine_mmio_base {
unsigned int graphics_ver : 8;
unsigned int base : 24;
} mmio_bases[MAX_MMIO_BASES];
}; };
static const struct engine_info engine_infos[] = { static const struct engine_info engine_infos[] = {
...@@ -44,90 +40,70 @@ static const struct engine_info engine_infos[] = { ...@@ -44,90 +40,70 @@ static const struct engine_info engine_infos[] = {
.class = XE_ENGINE_CLASS_RENDER, .class = XE_ENGINE_CLASS_RENDER,
.instance = 0, .instance = 0,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = RENDER_RING_BASE,
{ .graphics_ver = 1, .base = RENDER_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS0] = { [XE_HW_ENGINE_BCS0] = {
.name = "bcs0", .name = "bcs0",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 0, .instance = 0,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = BLT_RING_BASE,
{ .graphics_ver = 6, .base = BLT_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS1] = { [XE_HW_ENGINE_BCS1] = {
.name = "bcs1", .name = "bcs1",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 1, .instance = 1,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS1_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS1_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS2] = { [XE_HW_ENGINE_BCS2] = {
.name = "bcs2", .name = "bcs2",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 2, .instance = 2,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS2_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS2_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS3] = { [XE_HW_ENGINE_BCS3] = {
.name = "bcs3", .name = "bcs3",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 3, .instance = 3,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS3_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS3_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS4] = { [XE_HW_ENGINE_BCS4] = {
.name = "bcs4", .name = "bcs4",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 4, .instance = 4,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS4_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS4_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS5] = { [XE_HW_ENGINE_BCS5] = {
.name = "bcs5", .name = "bcs5",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 5, .instance = 5,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS5_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS5_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS6] = { [XE_HW_ENGINE_BCS6] = {
.name = "bcs6", .name = "bcs6",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 6, .instance = 6,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS6_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS6_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS7] = { [XE_HW_ENGINE_BCS7] = {
.name = "bcs7", .name = "bcs7",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 7, .instance = 7,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS7_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS7_RING_BASE }
},
}, },
[XE_HW_ENGINE_BCS8] = { [XE_HW_ENGINE_BCS8] = {
.name = "bcs8", .name = "bcs8",
.class = XE_ENGINE_CLASS_COPY, .class = XE_ENGINE_CLASS_COPY,
.instance = 8, .instance = 8,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = XEHPC_BCS8_RING_BASE,
{ .graphics_ver = 12, .base = XEHPC_BCS8_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS0] = { [XE_HW_ENGINE_VCS0] = {
...@@ -135,166 +111,115 @@ static const struct engine_info engine_infos[] = { ...@@ -135,166 +111,115 @@ static const struct engine_info engine_infos[] = {
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 0, .instance = 0,
.domain = XE_FW_MEDIA_VDBOX0, .domain = XE_FW_MEDIA_VDBOX0,
.mmio_bases = { .mmio_base = GEN11_BSD_RING_BASE,
{ .graphics_ver = 11, .base = GEN11_BSD_RING_BASE },
{ .graphics_ver = 6, .base = GEN6_BSD_RING_BASE },
{ .graphics_ver = 4, .base = BSD_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS1] = { [XE_HW_ENGINE_VCS1] = {
.name = "vcs1", .name = "vcs1",
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 1, .instance = 1,
.domain = XE_FW_MEDIA_VDBOX1, .domain = XE_FW_MEDIA_VDBOX1,
.mmio_bases = { .mmio_base = GEN11_BSD2_RING_BASE,
{ .graphics_ver = 11, .base = GEN11_BSD2_RING_BASE },
{ .graphics_ver = 8, .base = GEN8_BSD2_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS2] = { [XE_HW_ENGINE_VCS2] = {
.name = "vcs2", .name = "vcs2",
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 2, .instance = 2,
.domain = XE_FW_MEDIA_VDBOX2, .domain = XE_FW_MEDIA_VDBOX2,
.mmio_bases = { .mmio_base = GEN11_BSD3_RING_BASE,
{ .graphics_ver = 11, .base = GEN11_BSD3_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS3] = { [XE_HW_ENGINE_VCS3] = {
.name = "vcs3", .name = "vcs3",
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 3, .instance = 3,
.domain = XE_FW_MEDIA_VDBOX3, .domain = XE_FW_MEDIA_VDBOX3,
.mmio_bases = { .mmio_base = GEN11_BSD4_RING_BASE,
{ .graphics_ver = 11, .base = GEN11_BSD4_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS4] = { [XE_HW_ENGINE_VCS4] = {
.name = "vcs4", .name = "vcs4",
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 4, .instance = 4,
.domain = XE_FW_MEDIA_VDBOX4, .domain = XE_FW_MEDIA_VDBOX4,
.mmio_bases = { .mmio_base = XEHP_BSD5_RING_BASE,
{ .graphics_ver = 12, .base = XEHP_BSD5_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS5] = { [XE_HW_ENGINE_VCS5] = {
.name = "vcs5", .name = "vcs5",
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 5, .instance = 5,
.domain = XE_FW_MEDIA_VDBOX5, .domain = XE_FW_MEDIA_VDBOX5,
.mmio_bases = { .mmio_base = XEHP_BSD6_RING_BASE,
{ .graphics_ver = 12, .base = XEHP_BSD6_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS6] = { [XE_HW_ENGINE_VCS6] = {
.name = "vcs6", .name = "vcs6",
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 6, .instance = 6,
.domain = XE_FW_MEDIA_VDBOX6, .domain = XE_FW_MEDIA_VDBOX6,
.mmio_bases = { .mmio_base = XEHP_BSD7_RING_BASE,
{ .graphics_ver = 12, .base = XEHP_BSD7_RING_BASE }
},
}, },
[XE_HW_ENGINE_VCS7] = { [XE_HW_ENGINE_VCS7] = {
.name = "vcs7", .name = "vcs7",
.class = XE_ENGINE_CLASS_VIDEO_DECODE, .class = XE_ENGINE_CLASS_VIDEO_DECODE,
.instance = 7, .instance = 7,
.domain = XE_FW_MEDIA_VDBOX7, .domain = XE_FW_MEDIA_VDBOX7,
.mmio_bases = { .mmio_base = XEHP_BSD8_RING_BASE,
{ .graphics_ver = 12, .base = XEHP_BSD8_RING_BASE }
},
}, },
[XE_HW_ENGINE_VECS0] = { [XE_HW_ENGINE_VECS0] = {
.name = "vecs0", .name = "vecs0",
.class = XE_ENGINE_CLASS_VIDEO_ENHANCE, .class = XE_ENGINE_CLASS_VIDEO_ENHANCE,
.instance = 0, .instance = 0,
.domain = XE_FW_MEDIA_VEBOX0, .domain = XE_FW_MEDIA_VEBOX0,
.mmio_bases = { .mmio_base = GEN11_VEBOX_RING_BASE,
{ .graphics_ver = 11, .base = GEN11_VEBOX_RING_BASE },
{ .graphics_ver = 7, .base = VEBOX_RING_BASE }
},
}, },
[XE_HW_ENGINE_VECS1] = { [XE_HW_ENGINE_VECS1] = {
.name = "vecs1", .name = "vecs1",
.class = XE_ENGINE_CLASS_VIDEO_ENHANCE, .class = XE_ENGINE_CLASS_VIDEO_ENHANCE,
.instance = 1, .instance = 1,
.domain = XE_FW_MEDIA_VEBOX1, .domain = XE_FW_MEDIA_VEBOX1,
.mmio_bases = { .mmio_base = GEN11_VEBOX2_RING_BASE,
{ .graphics_ver = 11, .base = GEN11_VEBOX2_RING_BASE }
},
}, },
[XE_HW_ENGINE_VECS2] = { [XE_HW_ENGINE_VECS2] = {
.name = "vecs2", .name = "vecs2",
.class = XE_ENGINE_CLASS_VIDEO_ENHANCE, .class = XE_ENGINE_CLASS_VIDEO_ENHANCE,
.instance = 2, .instance = 2,
.domain = XE_FW_MEDIA_VEBOX2, .domain = XE_FW_MEDIA_VEBOX2,
.mmio_bases = { .mmio_base = XEHP_VEBOX3_RING_BASE,
{ .graphics_ver = 12, .base = XEHP_VEBOX3_RING_BASE }
},
}, },
[XE_HW_ENGINE_VECS3] = { [XE_HW_ENGINE_VECS3] = {
.name = "vecs3", .name = "vecs3",
.class = XE_ENGINE_CLASS_VIDEO_ENHANCE, .class = XE_ENGINE_CLASS_VIDEO_ENHANCE,
.instance = 3, .instance = 3,
.domain = XE_FW_MEDIA_VEBOX3, .domain = XE_FW_MEDIA_VEBOX3,
.mmio_bases = { .mmio_base = XEHP_VEBOX4_RING_BASE,
{ .graphics_ver = 12, .base = XEHP_VEBOX4_RING_BASE }
},
}, },
[XE_HW_ENGINE_CCS0] = { [XE_HW_ENGINE_CCS0] = {
.name = "ccs0", .name = "ccs0",
.class = XE_ENGINE_CLASS_COMPUTE, .class = XE_ENGINE_CLASS_COMPUTE,
.instance = 0, .instance = 0,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = GEN12_COMPUTE0_RING_BASE,
{ .graphics_ver = 12, .base = GEN12_COMPUTE0_RING_BASE },
},
}, },
[XE_HW_ENGINE_CCS1] = { [XE_HW_ENGINE_CCS1] = {
.name = "ccs1", .name = "ccs1",
.class = XE_ENGINE_CLASS_COMPUTE, .class = XE_ENGINE_CLASS_COMPUTE,
.instance = 1, .instance = 1,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = GEN12_COMPUTE1_RING_BASE,
{ .graphics_ver = 12, .base = GEN12_COMPUTE1_RING_BASE },
},
}, },
[XE_HW_ENGINE_CCS2] = { [XE_HW_ENGINE_CCS2] = {
.name = "ccs2", .name = "ccs2",
.class = XE_ENGINE_CLASS_COMPUTE, .class = XE_ENGINE_CLASS_COMPUTE,
.instance = 2, .instance = 2,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = GEN12_COMPUTE2_RING_BASE,
{ .graphics_ver = 12, .base = GEN12_COMPUTE2_RING_BASE },
},
}, },
[XE_HW_ENGINE_CCS3] = { [XE_HW_ENGINE_CCS3] = {
.name = "ccs3", .name = "ccs3",
.class = XE_ENGINE_CLASS_COMPUTE, .class = XE_ENGINE_CLASS_COMPUTE,
.instance = 3, .instance = 3,
.domain = XE_FW_RENDER, .domain = XE_FW_RENDER,
.mmio_bases = { .mmio_base = GEN12_COMPUTE3_RING_BASE,
{ .graphics_ver = 12, .base = GEN12_COMPUTE3_RING_BASE },
},
}, },
}; };
static u32 engine_info_mmio_base(const struct engine_info *info,
unsigned int graphics_ver)
{
int i;
for (i = 0; i < MAX_MMIO_BASES; i++)
if (graphics_ver >= info->mmio_bases[i].graphics_ver)
break;
XE_BUG_ON(i == MAX_MMIO_BASES);
XE_BUG_ON(!info->mmio_bases[i].base);
return info->mmio_bases[i].base;
}
static void hw_engine_fini(struct drm_device *drm, void *arg) static void hw_engine_fini(struct drm_device *drm, void *arg)
{ {
struct xe_hw_engine *hwe = arg; struct xe_hw_engine *hwe = arg;
...@@ -346,7 +271,6 @@ void xe_hw_engine_enable_ring(struct xe_hw_engine *hwe) ...@@ -346,7 +271,6 @@ void xe_hw_engine_enable_ring(struct xe_hw_engine *hwe)
static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe, static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
enum xe_hw_engine_id id) enum xe_hw_engine_id id)
{ {
struct xe_device *xe = gt_to_xe(gt);
const struct engine_info *info; const struct engine_info *info;
if (WARN_ON(id >= ARRAY_SIZE(engine_infos) || !engine_infos[id].name)) if (WARN_ON(id >= ARRAY_SIZE(engine_infos) || !engine_infos[id].name))
...@@ -362,7 +286,7 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe, ...@@ -362,7 +286,7 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
hwe->gt = gt; hwe->gt = gt;
hwe->class = info->class; hwe->class = info->class;
hwe->instance = info->instance; hwe->instance = info->instance;
hwe->mmio_base = engine_info_mmio_base(info, GRAPHICS_VER(xe)); hwe->mmio_base = info->mmio_base;
hwe->domain = info->domain; hwe->domain = info->domain;
hwe->name = info->name; hwe->name = info->name;
hwe->fence_irq = &gt->fence_irq[info->class]; hwe->fence_irq = &gt->fence_irq[info->class];
......
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