i915: CAGF and RC6 changes for MTL
Subsystems (2)
cover i915: CAGF and RC6 changes for MTL
This series includes the code changes to get CAGF, RC State and C6 Residency of MTL. The series depends on:
https://patchwork.freedesktop.org/series/107908/
We have included 3 patches from from the above series as part of this series in order for this series to compile. These are the first 3 patches authored by Matt Roper. Please do not review these first 3 patches. Only patch 4 and 5 needs review.
Badal Nilawar (2):
INTEL_DII: drm/i915/mtl: Modify CAGF functions for MTL
INTEL_DII: drm/i915/mtl: Add C6 residency support for MTL SAMedia
Matt Roper (3):
drm/i915: Prepare more multi-GT initialization drm/i915: Rename and expose common GT early init routine drm/i915/xelpmp: Expose media as another GT
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 70 +++++++++++++++---- drivers/gpu/drm/i915/gt/intel_gt.h | 2 +- drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c | 56 +++++++++++++++ drivers/gpu/drm/i915/gt/intel_gt_regs.h | 26 +++++++ drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 9 ++- drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 + drivers/gpu/drm/i915/gt/intel_rc6.c | 5 +- drivers/gpu/drm/i915/gt/intel_rps.c | 5 ++ drivers/gpu/drm/i915/gt/intel_sa_media.c | 39 +++++++++++ drivers/gpu/drm/i915/gt/intel_sa_media.h | 15 ++++ drivers/gpu/drm/i915/gt/selftest_rc6.c | 9 ++- drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_pci.c | 15 ++++ drivers/gpu/drm/i915/i915_pmu.c | 8 ++- drivers/gpu/drm/i915/intel_device_info.h | 19 +++++ drivers/gpu/drm/i915/intel_uncore.c | 16 ++++- drivers/gpu/drm/i915/intel_uncore.h | 20 +++++- .../gpu/drm/i915/selftests/mock_gem_device.c | 1 + 20 files changed, 301 insertions(+), 22 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_sa_media.c create mode 100644 drivers/gpu/drm/i915/gt/intel_sa_media.h
Signature · 1 line
2.25.1
PATCH 1/5 drm/i915: Prepare more multi-GT initialization
From: Matt Roper <[email protected]>
We're going to introduce an additional intel_gt for MTL's media unit soon. Let's provide a bit more multi-GT initialization framework in preparation for that. The initialization will pull the list of GTs for a platform from the device info structure. Although necessary for the immediate MTL media enabling, this same framework will also be used farther down the road when we enable remote tiles on xehpsdv and pvc.
v2:
- Re-add missing test for !HAS_EXTRA_GT_LIST in intel_gt_probe_all().
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 54 ++++++++++++++++--- drivers/gpu/drm/i915/gt/intel_gt.h | 1 - drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 ++ drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/intel_device_info.h | 16 ++++++ .../gpu/drm/i915/selftests/mock_gem_device.c | 1 + 7 files changed, 70 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +1 -1
@@ -736,7 +736,7 @@ static intel_engine_mask_t init_engine_mask(struct intel_gt *gt)u16 vdbox_mask;u16 vebox_mask; - info->engine_mask =RUNTIME_INFO (i915)->platform_engine_mask; +GEM_BUG_ON (!info->engine_mask);if (GRAPHICS_VER (i915) <11 )return info->engine_mask;
drivers/gpu/drm/i915/gt/intel_gt.c +47 -7
81 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gt.h +0 -1
@@ -54,7 +54,6 @@ void intel_gt_driver_register(struct intel_gt *gt);void intel_gt_driver_unregister (struct intel_gt *gt);void intel_gt_driver_remove (struct intel_gt *gt);void intel_gt_driver_release (struct intel_gt *gt); -void intel_gt_driver_late_release_all (struct drm_i915_private *i915);int intel_gt_wait_for_idle (struct intel_gt *gt,long timeout);
drivers/gpu/drm/i915/gt/intel_gt_types.h +3 -0
@@ -83,6 +83,9 @@ struct gt_defaults {struct intel_gt {struct drm_i915_private *i915; +const char *name; +enum intel_gt_type type; +struct intel_uncore *uncore;struct i915_ggtt *ggtt;
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -918,6 +918,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_REGION (i915, i) (RUNTIME_INFO(i915)->memory_regions & (i))#define HAS_LMEM (i915) HAS_REGION(i915, REGION_LMEM) +#define HAS_EXTRA_GT_LIST (dev_priv) (INTEL_INFO(dev_priv)->extra_gt_list) +/* * Platform has the dedicated compression control state for each lmem surfaces * stored in lmem to support the 3D and media compression formats.
drivers/gpu/drm/i915/intel_device_info.h +16 -0
@@ -245,6 +245,20 @@ struct intel_runtime_info { }; }; +enum intel_gt_type { +GT_PRIMARY , +GT_TILE , +}; + +struct intel_gt_definition { +enum intel_gt_type type; +char *name; +int (*setup)(struct intel_gt *gt, +phys_addr_t phys_addr); +u32 mapping_base; +intel_engine_mask_t engine_mask; +}; +struct intel_device_info {struct ip_version media;
@@ -252,6 +266,8 @@ struct intel_device_info {unsigned int dma_mask_size;/* available DMA address bits */ +const struct intel_gt_definition *extra_gt_list; +u8 gt;/* GT number, 0 if undefined */ #define DEFINE_FLAG (name) u8 name:1
drivers/gpu/drm/i915/selftests/mock_gem_device.c +1 -0
@@ -115,6 +115,7 @@ static struct dev_pm_domain pm_domain = {static void mock_gt_probe (struct drm_i915_private *i915) { i915->gt[0 ] = &i915->gt0; + i915->gt[0 ]->name ="Mock GT" ; }struct drm_i915_private *mock_gem_device (void )
Signature · 1 line
2.25.1
PATCH 2/5 drm/i915: Rename and expose common GT early init routine
In reply to Badal NilawarFrom: Matt Roper <[email protected]>
The common early GT init is needed for initialization of all GT types (root/primary, remote tile, standalone media). Since standalone media (coming in the next patch) will be implemented in a separate file, rename and expose the function for use.
--- drivers/gpu/drm/i915/gt/intel_gt.c | 6 +++--- drivers/gpu/drm/i915/gt/intel_gt.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt.c +3 -3
@@ -35,7 +35,7 @@#include "intel_uncore.h" #include "shmem_utils.h" -static void __intel_gt_init_early (struct intel_gt *gt) +void intel_gt_common_init_early (struct intel_gt *gt) {spin_lock_init (>->irq_lock);
@@ -65,7 +65,7 @@ void intel_root_gt_init_early(struct drm_i915_private *i915) gt->i915 = i915; gt->uncore = &i915->uncore; -__intel_gt_init_early (gt); +intel_gt_common_init_early (gt); }static int intel_gt_probe_lmem (struct intel_gt *gt)
@@ -797,7 +797,7 @@ static int intel_gt_tile_setup(struct intel_gt *gt, phys_addr_t phys_addr) gt->uncore = uncore; gt->uncore->debug = mmio_debug; -__intel_gt_init_early (gt); +intel_gt_common_init_early (gt); }intel_uncore_init_early (gt->uncore, gt);
drivers/gpu/drm/i915/gt/intel_gt.h +1 -0
@@ -44,6 +44,7 @@ static inline struct intel_gt *gsc_to_gt(struct intel_gsc *gsc) return container_of(gsc, struct intel_gt, gsc); } +void intel_gt_common_init_early (struct intel_gt *gt);void intel_root_gt_init_early (struct drm_i915_private *i915);int intel_gt_assign_ggtt (struct intel_gt *gt);int intel_gt_init_mmio (struct intel_gt *gt);
Signature · 1 line
2.25.1
PATCH 3/5 drm/i915/xelpmp: Expose media as another GT
In reply to Badal NilawarFrom: Matt Roper <[email protected]>
Xe_LPM+ platforms have "standalone media." I.e., the media unit is designed as an additional GT with its own engine list, GuC, forcewake, etc. Let's allow platforms to include media GTs in their device info.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gt/intel_gt.c | 12 ++++++-- drivers/gpu/drm/i915/gt/intel_gt_regs.h | 8 +++++ drivers/gpu/drm/i915/gt/intel_sa_media.c | 39 ++++++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_sa_media.h | 15 +++++++++ drivers/gpu/drm/i915/i915_pci.c | 15 +++++++++ drivers/gpu/drm/i915/intel_device_info.h | 5 ++- drivers/gpu/drm/i915/intel_uncore.c | 16 ++++++++-- drivers/gpu/drm/i915/intel_uncore.h | 20 ++++++++++-- 9 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_sa_media.c create mode 100644 drivers/gpu/drm/i915/gt/intel_sa_media.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -123,6 +123,7 @@ gt-y += \ gt/intel_ring.o \ gt/intel_ring_submission.o \ gt/intel_rps.o \ + gt/intel_sa_media.o \ gt/intel_sseu.o \ gt/intel_sseu_debugfs.o \ gt/intel_timeline.o \
drivers/gpu/drm/i915/gt/intel_gt.c +9 -3
@@ -776,10 +776,15 @@ void intel_gt_driver_late_release_all(struct drm_i915_private *i915) } } -static int intel_gt_tile_setup (struct intel_gt *gt,phys_addr_t phys_addr) +static int intel_gt_tile_setup (struct intel_gt *gt, +phys_addr_t phys_addr, +u32 gsi_offset) {int ret; +/* GSI offset is only applicable for media GTs */ +drm_WARN_ON (>->i915->drm, gsi_offset); +if (!gt_is_root (gt)) {struct intel_uncore_mmio_debug *mmio_debug;struct intel_uncore *uncore;
@@ -840,7 +845,7 @@ int intel_gt_probe_all(struct drm_i915_private *i915) gt->info.engine_mask =RUNTIME_INFO (i915)->platform_engine_mask;drm_dbg (&i915->drm,"Setting up %s\n" , gt->name); - ret =intel_gt_tile_setup (gt, phys_addr); + ret =intel_gt_tile_setup (gt, phys_addr,0 );if (ret)return ret;
@@ -873,7 +878,8 @@ int intel_gt_probe_all(struct drm_i915_private *i915) goto err; } - ret = gtdef->setup (gt, phys_addr + gtdef->mapping_base); + ret = gtdef->setup (gt, phys_addr + gtdef->mapping_base, + gtdef->gsi_offset);if (ret) goto err;
drivers/gpu/drm/i915/gt/intel_gt_regs.h +8 -0
@@ -1578,4 +1578,12 @@#define GEN12_SFC_DONE (n) _MMIO(0x1cc000 + (n) * 0x1000) +/* +* Standalone Media's non-engine GT registers are located at their regular GT +* offsets plus 0x380000. This extra offset is stored inside the intel_uncore +* structure so that the existing code can be used for both GTs without +* modification. +*/ +#define MTL_MEDIA_GSI_BASE 0x380000 +#endif /* __INTEL_GT_REGS__ */
drivers/gpu/drm/i915/gt/intel_sa_media.c new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2021 Intel Corporation +*/ + +#include <drm/drm_managed.h> + +#include "i915_drv.h" +#include "gt/intel_gt.h" +#include "gt/intel_sa_media.h" + +int intel_sa_mediagt_setup (struct intel_gt *gt,phys_addr_t phys_addr, +u32 gsi_offset) +{ +struct drm_i915_private *i915 = gt->i915; +struct intel_uncore *uncore; + + uncore =drmm_kzalloc (&i915->drm,sizeof (*uncore),GFP_KERNEL ); +if (!uncore) +return -ENOMEM ; + + uncore->gsi_offset = gsi_offset; + +intel_gt_common_init_early (gt); +intel_uncore_init_early (uncore, gt); + +/* +* Standalone media shares the general MMIO space with the primary +* GT. We'll re-use the primary GT's mapping. +*/ + uncore->regs = i915->uncore.regs; +if (drm_WARN_ON (&i915->drm, uncore->regs ==NULL )) +return -EIO ; + + gt->uncore = uncore; + gt->phys_addr = phys_addr; + +return 0 ; +}
drivers/gpu/drm/i915/gt/intel_sa_media.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2021 Intel Corporation +*/ +#ifndef __INTEL_SA_MEDIA__ +#define __INTEL_SA_MEDIA__ + +#include <linux/types.h> + +struct intel_gt ; + +int intel_sa_mediagt_setup (struct intel_gt *gt,phys_addr_t phys_addr, +u32 gsi_offset); + +#endif /* __INTEL_SA_MEDIA_H__ */
drivers/gpu/drm/i915/i915_pci.c +15 -0
@@ -26,6 +26,9 @@#include <drm/drm_drv.h> #include <drm/i915_pciids.h> +#include "gt/intel_gt_regs.h" +#include "gt/intel_sa_media.h" +#include "i915_driver.h" #include "i915_drv.h" #include "i915_pci.h"
@@ -1115,6 +1118,17 @@ static const struct intel_device_info pvc_info = { .display.has_cdclk_crawl = 1, \ .__runtime.fbc_mask = BIT(INTEL_FBC_A) | BIT(INTEL_FBC_B) +static const struct intel_gt_definition xelpmp_extra_gt[] = { + { + .type =GT_MEDIA , + .name ="Standalone Media GT" , + .setup = intel_sa_mediagt_setup, + .gsi_offset =MTL_MEDIA_GSI_BASE , + .engine_mask =BIT (VECS0 ) |BIT (VCS0 ) |BIT (VCS2 ), + }, + {} +}; +__maybe_unused static const struct intel_device_info mtl_info = {XE_HP_FEATURES ,
@@ -1128,6 +1142,7 @@ static const struct intel_device_info mtl_info = { .media.ver = 13,PLATFORM (INTEL_METEORLAKE ), .display.has_modular_fia = 1, + .extra_gt_list = xelpmp_extra_gt, .has_flat_ccs = 0, .has_snoop = 1, .__runtime.memory_regions = REGION_SMEM | REGION_STOLEN_LMEM,
drivers/gpu/drm/i915/intel_device_info.h +4 -1
@@ -248,14 +248,17 @@ struct intel_runtime_info {enum intel_gt_type {GT_PRIMARY ,GT_TILE , +GT_MEDIA , };struct intel_gt_definition {enum intel_gt_type type;char *name;int (*setup)(struct intel_gt *gt, -phys_addr_t phys_addr); +phys_addr_t phys_addr, +u32 gsi_offset);u32 mapping_base; +u32 gsi_offset;intel_engine_mask_t engine_mask; };
drivers/gpu/drm/i915/intel_uncore.c +14 -2
@@ -1771,10 +1771,15 @@ __gen2_read(64)#undef GEN2_READ_FOOTER#undef GEN2_READ_HEADER +#define IS_GSI_REG (reg) ((reg) < 0x40000) +#define GEN6_READ_HEADER (x) \ - u32 offset = i915_mmio_reg_offset(reg); \ + u32 offset; \ unsigned long irqflags; \ u##x val = 0; \ + if (IS_GSI_REG(reg.reg)) \ + reg.reg += uncore->gsi_offset; \ + offset = i915_mmio_reg_offset(reg); \ assert_rpm_wakelock_held(uncore->rpm); \ spin_lock_irqsave(&uncore->lock, irqflags); \ unclaimed_reg_debug(uncore, reg, true, true)
@@ -1876,8 +1881,11 @@ __gen2_write(32)#undef GEN2_WRITE_HEADER#define GEN6_WRITE_HEADER \ - u32 offset = i915_mmio_reg_offset(reg); \ + u32 offset; \ unsigned long irqflags; \ + if (IS_GSI_REG(reg.reg)) \ + reg.reg += uncore->gsi_offset; \ + offset = i915_mmio_reg_offset(reg); \ trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \ assert_rpm_wakelock_held(uncore->rpm); \ spin_lock_irqsave(&uncore->lock, irqflags); \
@@ -2256,6 +2264,10 @@ int intel_uncore_setup_mmio(struct intel_uncore *uncore, phys_addr_t phys_addr)void intel_uncore_cleanup_mmio (struct intel_uncore *uncore) { +/* The media GT re-uses the primary GT's register mapping */ +if (uncore->gt->type ==GT_MEDIA ) +return ; +iounmap (uncore->regs); }
drivers/gpu/drm/i915/intel_uncore.h +18 -2
@@ -135,6 +135,16 @@ struct intel_uncore {spinlock_t lock;/** lock is also taken in irq contexts. */ +/* +* Do we need to apply an additional offset to reach the beginning +* of the basic non-engine GT registers (referred to as "GSI" on +* newer platforms, or "GT block" on older platforms)? If so, we'll +* track that here and apply it transparently to registers in the +* appropriate range to maintain compatibility with our existing +* register definitions and GT code. +*/ +u32 gsi_offset; +unsigned int flags;#define UNCORE_HAS_FORCEWAKE BIT(0)#define UNCORE_HAS_FPGA_DBG_UNCLAIMED BIT(1)
@@ -299,14 +309,20 @@ intel_wait_for_register_fw(struct intel_uncore *uncore, static inline u##x__ __raw_uncore_read##x__(const struct intel_uncore *uncore, \ i915_reg_t reg) \ { \ - return read##s__(uncore->regs + i915_mmio_reg_offset(reg)); \ + u32 offset = i915_mmio_reg_offset(reg); \ + if (offset < 0x40000) \ + offset += uncore->gsi_offset; \ + return read##s__(uncore->regs + offset); \ }#define __raw_write (x__, s__) \ static inline void __raw_uncore_write##x__(const struct intel_uncore *uncore, \ i915_reg_t reg, u##x__ val) \ { \ - write##s__(val, uncore->regs + i915_mmio_reg_offset(reg)); \ + u32 offset = i915_mmio_reg_offset(reg); \ + if (offset < 0x40000) \ + offset += uncore->gsi_offset; \ + write##s__(val, uncore->regs + offset); \ } __raw_read(8, b)__raw_read (16 , w)
Signature · 1 line
2.25.1