[Intel-gfx] [PATCH V3 1/8] drm/i915/gt: Add support of mocs propagation
Matt Roper
matthew.d.roper at intel.com
Wed Sep 1 17:56:56 UTC 2021
On Mon, Aug 30, 2021 at 09:52:33PM +0530, Ayaz A Siddiqui wrote:
> Now there are lots of Command and registers that require mocs index
> programming.
> So propagating mocs_index from mocs to gt so that it can be
> used directly without having platform-specific checks.
>
> Cc: CQ Tang<cq.tang at intel.com>
> Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui at intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_gt_types.h | 4 ++++
> drivers/gpu/drm/i915/gt/intel_mocs.c | 10 ++++++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> index a81e21bf1bd1a..88601a2d2c229 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> @@ -192,6 +192,10 @@ struct intel_gt {
>
> unsigned long mslice_mask;
> } info;
> +
> + struct i915_mocs_index_gt {
Do we actually plan to use the name 'i915_mocs_index_gt' anywhere else
in the code? If not, an anonymous struct is probably fine.
> + u8 uc_index;
> + } mocs;
> };
>
> enum intel_gt_scratch_field {
> diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.c b/drivers/gpu/drm/i915/gt/intel_mocs.c
> index 582c4423b95d6..10cc508c1a4f6 100644
> --- a/drivers/gpu/drm/i915/gt/intel_mocs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_mocs.c
> @@ -22,6 +22,7 @@ struct drm_i915_mocs_table {
> unsigned int size;
> unsigned int n_entries;
> const struct drm_i915_mocs_entry *table;
> + u8 uc_index;
> };
>
> /* Defines for the tables (XXX_MOCS_0 - XXX_MOCS_63) */
> @@ -340,6 +341,8 @@ static unsigned int get_mocs_settings(const struct drm_i915_private *i915,
> {
> unsigned int flags;
>
> + memset(table, 0, sizeof(struct drm_i915_mocs_table));
> +
> if (IS_DG1(i915)) {
> table->size = ARRAY_SIZE(dg1_mocs_table);
> table->table = dg1_mocs_table;
> @@ -504,6 +507,12 @@ static u32 global_mocs_offset(void)
> return i915_mmio_reg_offset(GEN12_GLOBAL_MOCS(0));
> }
>
> +static void set_mocs_index(struct intel_gt *gt,
> + struct drm_i915_mocs_table *table)
> +{
> + gt->mocs.uc_index = table->uc_index;
> +}
> +
> void intel_mocs_init(struct intel_gt *gt)
> {
> struct drm_i915_mocs_table table;
> @@ -515,6 +524,7 @@ void intel_mocs_init(struct intel_gt *gt)
> flags = get_mocs_settings(gt->i915, &table);
> if (flags & HAS_GLOBAL_MOCS)
> __init_mocs_table(gt->uncore, &table, global_mocs_offset());
> + set_mocs_index(gt, &table);
We could probably just inline the
gt->mocs.uc_index = table->uc_index;
rather than creating a separate function; it doesn't look like
set_mocs_index() gets used anywhere else.
Aside from the two minor cleanups,
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> }
>
> #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
> --
> 2.26.2
>
--
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
More information about the Intel-gfx
mailing list