DG2 VRAM_SR Support
Subsystems (3)
v3 cover DG2 VRAM_SR Support
This series add DG2 D3Cold VRAM_SR support.
TODO: GT and GuC Interface state save/restore on VRAM_SR entry/exit.
Anshuman Gupta (8):
drm/i915/dgfx: OpRegion VRAM Self Refresh Support drm/i915/dg1: OpRegion PCON DG1 MBD config support drm/i915/dg2: Add DG2_NB_MBD subplatform drm/i915/dg2: DG2 MBD config drm/i915/dgfx: Add has_lmem_sr drm/i915/dgfx: Setup VRAM SR with D3COLD Drm/i915/rpm: Enable D3Cold VRAM SR Support drm/i915/rpm: d3cold Policy
Tvrtko Ursulin (1):
drm/i915/xehpsdv: Store lmem region in gt
drivers/gpu/drm/i915/display/intel_opregion.c | 101 +++++++++++++++++- drivers/gpu/drm/i915/display/intel_opregion.h | 17 +++ drivers/gpu/drm/i915/gt/intel_gt.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 + drivers/gpu/drm/i915/i915_driver.c | 25 +++++ drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/i915_params.c | 4 + drivers/gpu/drm/i915/i915_params.h | 1 + drivers/gpu/drm/i915/i915_pci.c | 2 + drivers/gpu/drm/i915/i915_reg.h | 4 + drivers/gpu/drm/i915/intel_device_info.c | 14 +++ drivers/gpu/drm/i915/intel_device_info.h | 4 +- drivers/gpu/drm/i915/intel_pcode.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 95 ++++++++++++++++ drivers/gpu/drm/i915/intel_pm.h | 3 + drivers/gpu/drm/i915/intel_runtime_pm.c | 3 +- drivers/gpu/drm/i915/intel_runtime_pm.h | 7 ++ include/drm/i915_pciids.h | 23 ++-- 18 files changed, 302 insertions(+), 11 deletions(-)
Signature · 1 line
2.26.2
PATCH v3 1/9 drm/i915/dgfx: OpRegion VRAM Self Refresh Support
Intel DGFX cards provides a feature Video Ram Self Refrsh(vram_sr). vram_sr can be enabled with runtime suspend D3Cold flow and with opportunistic S0ix system wide suspend flow as well.
vram_sr feature requires Host BIOS support, vram_sr will be enable/disable by HOST BIOS using ACPI OpRegion.
OpRegion vram_sr is only applicable on Motherboard Down cards.
Adding OpRegion vram_sr support in order to enable/disable vram_sr on discrete cards.
v2:
- Added opregion->header NULL check. [Jani]
- Bundled opregion->asle NULL check to early return. [Jani]
- Use static inline for dummy declaration. [Jani]
BSpec: 53440
--- drivers/gpu/drm/i915/display/intel_opregion.c | 78 ++++++++++++++++++- drivers/gpu/drm/i915/display/intel_opregion.h | 17 ++++ 2 files changed, 94 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_opregion.c +77 -1
@@ -55,6 +55,8 @@#define MBOX_ASLE_EXT BIT(4)/* Mailbox #5 */ #define MBOX_BACKLIGHT BIT(5)/* Mailbox #2 (valid from v3.x) */ +#define PCON_DGFX_BIOS_SUPPORTS_VRSR BIT(11) +#define PCON_DGFX_BIOS_SUPPORTS_VRSR_FIELD_VALID BIT(12)#define PCON_HEADLESS_SKU BIT(13)struct opregion_header {
@@ -132,7 +134,8 @@ struct opregion_asle {u64 rvda;/* Physical (2.0) or relative from opregion (2.1+) * address of raw VBT data. */ u32 rvds;/* Size of raw vbt data */ -u8 rsvd[58 ]; +u8 vrsr;/* DGFX Video Ram Self Refresh */ +u8 rsvd[57 ]; } __packed;/* OpRegion mailbox #5: ASLE ext */
@@ -203,6 +206,9 @@ struct opregion_asle_ext {#define ASLE_PHED_EDID_VALID_MASK 0x3 +/* VRAM SR */ +#define ASLE_VRSR_ENABLE BIT(0) +/* Software System Control Interrupt (SWSCI) */ #define SWSCI_SCIC_INDICATOR (1 << 0)#define SWSCI_SCIC_MAIN_FUNCTION_SHIFT 1
@@ -923,6 +929,8 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv) opregion->header->over.minor, opregion->header->over.revision); +drm_dbg (&dev_priv->drm,"OpRegion PCON values 0x%x\n" , opregion->header->pcon); + mboxes = opregion->header->mboxes;if (mboxes &MBOX_ACPI ) {drm_dbg (&dev_priv->drm,"Public ACPI methods supported\n" );
@@ -1248,3 +1256,71 @@ void intel_opregion_unregister(struct drm_i915_private *i915) opregion->vbt =NULL ; opregion->lid_state =NULL ; } + +/** +* intel_opregion_vram_sr_required(). +* @i915 i915 device priv data. +* +* It checks whether a DGFX card is Mother Board Down config depending +* on respective discrete platform. +* +* Returns: +* It returns a boolean whether opregion vram_sr support is required. +*/ +bool +intel_opregion_vram_sr_required (struct drm_i915_private *i915) +{ +return false; +} + +/** +* intel_opregion_bios_supports_vram_sr() - get HOST BIOS vram_sr +* capability support. +* @i915: pointer to i915 device. +* +* It checks opregion pcon vram_sr fields to get HOST BIOS vram_sr +* capability support. It is only applocable to DGFX. +* +* Returns: +* true when bios supports vram_sr, or false if bios doesn't support. +*/ +bool intel_opregion_bios_supports_vram_sr (struct drm_i915_private *i915) +{ +struct intel_opregion *opregion = &i915->opregion; + +if (!IS_DGFX (i915)) +return false; + +if (!opregion->header) +return false; + +if (opregion->header->pcon &PCON_DGFX_BIOS_SUPPORTS_VRSR_FIELD_VALID ) +return opregion->header->pcon &PCON_DGFX_BIOS_SUPPORTS_VRSR ; +else +return false; +} + +/** +* intel_opregion_vram_sr() - enable/disable vram_sr. +* @i915: pointer to i915 device. +* @enable: Argument to enable/disable vram_sr. +* +* It enables/disables vram_sr in opregion ASLE MBOX, based upon that +* HOST BIOS will enables and disbales VRAM_SR during +* ACPI _PS3/_OFF and _PS/_ON glue method. +*/ +void intel_opregion_vram_sr (struct drm_i915_private *i915,bool enable) +{ +struct intel_opregion *opregion = &i915->opregion; + +if (!opregion->header || !opregion->asle) +return ; + +if (!intel_opregion_vram_sr_required (i915)) +return ; + +if (enable) + opregion->asle->vrsr |=ASLE_VRSR_ENABLE ; +else + opregion->asle->vrsr &= ~ASLE_VRSR_ENABLE ; +}
drivers/gpu/drm/i915/display/intel_opregion.h +17 -0
@@ -75,6 +75,9 @@ int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv, pci_power_t state);int intel_opregion_get_panel_type (struct drm_i915_private *dev_priv);struct edid *intel_opregion_get_edid (struct intel_connector *connector); +bool intel_opregion_vram_sr_required (struct drm_i915_private *i915); +bool intel_opregion_bios_supports_vram_sr (struct drm_i915_private *i915); +void intel_opregion_vram_sr (struct drm_i915_private *i915,bool enable);bool intel_opregion_headless_sku (struct drm_i915_private *i915);
@@ -134,6 +137,20 @@ static inline bool intel_opregion_headless_sku(struct drm_i915_private *i915)return false; } +static inline bool intel_opregion_vram_sr_required (struct drm_i915_private *i915) +{ +return false; +} + +static inline bool intel_opregion_bios_supports_vram_sr (struct drm_i915_private *i915) +{ +return false; +} + +static inline void intel_opregion_vram_sr (struct drm_i915_private *i915,bool enable) +{ +} +#endif /* CONFIG_ACPI */ #endif
Signature · 1 line
2.26.2
PATCH v3 2/9 drm/i915/dg1: OpRegion PCON DG1 MBD config support
In reply to Anshuman GuptaDGFX cards support both Add in Card(AIC) and Mother Board Down(MBD) configs. MBD config requires HOST BIOS GPIO toggling support in order to enable/disable vram_sr using ACPI OpRegion.
i915 requires to check OpRegion PCON MBD Config bits to discover whether DG1 Card is MBD config before enabling vram_sr.
v2:
- Removed IS_DG1() cond from intel_opregion_dg1_mbd_config. [Jani]
- Moved intel_opregion_vram_sr_required() to prev patch.
BSpec: 53440
--- drivers/gpu/drm/i915/display/intel_opregion.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/i915/display/intel_opregion.c +21 -0
@@ -55,6 +55,8 @@#define MBOX_ASLE_EXT BIT(4)/* Mailbox #5 */ #define MBOX_BACKLIGHT BIT(5)/* Mailbox #2 (valid from v3.x) */ +#define PCON_DG1_MBD_CONFIG BIT(9) +#define PCON_DG1_MBD_CONFIG_FIELD_VALID BIT(10)#define PCON_DGFX_BIOS_SUPPORTS_VRSR BIT(11)#define PCON_DGFX_BIOS_SUPPORTS_VRSR_FIELD_VALID BIT(12)#define PCON_HEADLESS_SKU BIT(13)
@@ -1257,6 +1259,19 @@ void intel_opregion_unregister(struct drm_i915_private *i915) opregion->lid_state =NULL ; } +static bool intel_opregion_dg1_mbd_config (struct drm_i915_private *i915) +{ +struct intel_opregion *opregion = &i915->opregion; + +if (!opregion->header) +return false; + +if (opregion->header->pcon &PCON_DG1_MBD_CONFIG_FIELD_VALID ) +return opregion->header->pcon &PCON_DG1_MBD_CONFIG ; +else +return false; +} +/** * intel_opregion_vram_sr_required(). * @i915 i915 device priv data.
@@ -1270,6 +1285,12 @@ void intel_opregion_unregister(struct drm_i915_private *i915)bool intel_opregion_vram_sr_required (struct drm_i915_private *i915) { +if (!IS_DGFX (i915)) +return false; + +if (IS_DG1 (i915)) +return intel_opregion_dg1_mbd_config (i915); +return false; }
Signature · 1 line
2.26.2
PATCH v3 3/9 drm/i915/dg2: Add DG2_NB_MBD subplatform
In reply to Anshuman GuptaDG2 NB SKU need to distinguish between MBD and AIC to probe the VRAM Self Refresh feature support. Adding those sub platform accordingly.
v2:
- Adding only required MBD subplatform. [Jani, Matt]
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_device_info.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_device_info.h | 3 ++- include/drm/i915_pciids.h | 23 ++++++++++++++++------- 4 files changed, 34 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1012,6 +1012,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, IS_SUBPLATFORM(dev_priv, INTEL_DG2, INTEL_SUBPLATFORM_G11)#define IS_DG2_G12 (dev_priv) \ IS_SUBPLATFORM(dev_priv, INTEL_DG2, INTEL_SUBPLATFORM_G12) +#define IS_DG2_MBD (dev_priv) \ + IS_SUBPLATFORM(dev_priv, INTEL_DG2, INTEL_SUBPLATFORM_MBD)#define IS_ADLS_RPLS (dev_priv) \ IS_SUBPLATFORM(dev_priv, INTEL_ALDERLAKE_S, INTEL_SUBPLATFORM_RPL)#define IS_ADLP_N (dev_priv) \
drivers/gpu/drm/i915/intel_device_info.c +14 -0
@@ -189,16 +189,25 @@ static const u16 subplatform_rpl_ids[] = {static const u16 subplatform_g10_ids[] = {INTEL_DG2_G10_IDS (0 ), +INTEL_DG2_G10_NB_MBD_IDS (0 ),INTEL_ATS_M150_IDS (0 ), };static const u16 subplatform_g11_ids[] = {INTEL_DG2_G11_IDS (0 ), +INTEL_DG2_G11_NB_MBD_IDS (0 ),INTEL_ATS_M75_IDS (0 ), };static const u16 subplatform_g12_ids[] = {INTEL_DG2_G12_IDS (0 ), +INTEL_DG2_G12_NB_MBD_IDS (0 ), +}; + +static const u16 subplatform_mbd_ids[] = { +INTEL_DG2_G10_NB_MBD_IDS (0 ), +INTEL_DG2_G11_NB_MBD_IDS (0 ), +INTEL_DG2_G12_NB_MBD_IDS (0 ), };static bool find_devid (u16 id,const u16 *p,unsigned int num)
@@ -257,6 +266,11 @@ void intel_device_info_subplatform_init(struct drm_i915_private *i915) mask =BIT (INTEL_SUBPLATFORM_G12 ); } +if (find_devid (devid, subplatform_mbd_ids, +ARRAY_SIZE (subplatform_mbd_ids))) { + mask |=BIT (INTEL_SUBPLATFORM_MBD ); + } +GEM_BUG_ON (mask & ~INTEL_SUBPLATFORM_MASK );RUNTIME_INFO (i915)->platform_mask[pi] |= mask;
drivers/gpu/drm/i915/intel_device_info.h +2 -1
@@ -97,7 +97,7 @@ enum intel_platform {* it is fine for the same bit to be used on multiple parent platforms. */ -#define INTEL_SUBPLATFORM_BITS (3) +#define INTEL_SUBPLATFORM_BITS (4)#define INTEL_SUBPLATFORM_MASK (BIT(INTEL_SUBPLATFORM_BITS) - 1)/* HSW/BDW/SKL/KBL/CFL */
@@ -114,6 +114,7 @@ enum intel_platform {#define INTEL_SUBPLATFORM_G10 0#define INTEL_SUBPLATFORM_G11 1#define INTEL_SUBPLATFORM_G12 2 +#define INTEL_SUBPLATFORM_MBD 3/* ADL */ #define INTEL_SUBPLATFORM_RPL 0
include/drm/i915_pciids.h +16 -7
@@ -693,32 +693,41 @@INTEL_VGA_DEVICE (0xA7A9 , info) /* DG2 */ -#define INTEL_DG2_G10_IDS (info) \ +#define INTEL_DG2_G10_NB_MBD_IDS (info) \ INTEL_VGA_DEVICE(0x5690, info), \ INTEL_VGA_DEVICE(0x5691, info), \ - INTEL_VGA_DEVICE(0x5692, info), \ + INTEL_VGA_DEVICE(0x5692, info) + +#define INTEL_DG2_G11_NB_MBD_IDS (info) \ + INTEL_VGA_DEVICE(0x5693, info), \ + INTEL_VGA_DEVICE(0x5694, info), \ + INTEL_VGA_DEVICE(0x5695, info) + +#define INTEL_DG2_G12_NB_MBD_IDS (info) \ + INTEL_VGA_DEVICE(0x5696, info), \ + INTEL_VGA_DEVICE(0x5697, info) + +#define INTEL_DG2_G10_IDS (info) \ INTEL_VGA_DEVICE(0x56A0, info), \ INTEL_VGA_DEVICE(0x56A1, info), \ INTEL_VGA_DEVICE(0x56A2, info)#define INTEL_DG2_G11_IDS (info) \ - INTEL_VGA_DEVICE(0x5693, info), \ - INTEL_VGA_DEVICE(0x5694, info), \ - INTEL_VGA_DEVICE(0x5695, info), \ INTEL_VGA_DEVICE(0x56A5, info), \ INTEL_VGA_DEVICE(0x56A6, info), \ INTEL_VGA_DEVICE(0x56B0, info), \ INTEL_VGA_DEVICE(0x56B1, info)#define INTEL_DG2_G12_IDS (info) \ - INTEL_VGA_DEVICE(0x5696, info), \ - INTEL_VGA_DEVICE(0x5697, info), \ INTEL_VGA_DEVICE(0x56A3, info), \ INTEL_VGA_DEVICE(0x56A4, info), \ INTEL_VGA_DEVICE(0x56B2, info), \ INTEL_VGA_DEVICE(0x56B3, info)#define INTEL_DG2_IDS (info) \ + INTEL_DG2_G10_NB_MBD_IDS(info), \ + INTEL_DG2_G11_NB_MBD_IDS(info), \ + INTEL_DG2_G12_NB_MBD_IDS(info), \ INTEL_DG2_G10_IDS(info), \ INTEL_DG2_G11_IDS(info), \ INTEL_DG2_G12_IDS(info)
Signature · 1 line
2.26.2
PATCH v3 4/9 drm/i915/dg2: DG2 MBD config
In reply to Anshuman GuptaAdd DG2 Motherboard Down Config check condition
to intel_opregion_vram_sr_required().
v2:
- Use MBD Subplatform to check DG2 MBD. [Jani]
BSpec: 44477
--- drivers/gpu/drm/i915/display/intel_opregion.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/display/intel_opregion.c +2 -0
@@ -1290,6 +1290,8 @@ intel_opregion_vram_sr_required(struct drm_i915_private *i915)if (IS_DG1 (i915))return intel_opregion_dg1_mbd_config (i915); +else if (IS_DG2_MBD (i915)) +return true;return false; }
Signature · 1 line
2.26.2
PATCH v3 5/9 drm/i915/dgfx: Add has_lmem_sr
In reply to Anshuman GuptaAdd has_lmem_sr platform specific flag to know,
whether platform has VRAM self refresh support.
As of now both DG1 and DG2 client platforms supports VRAM self refresh with D3Cold but let it enable first on DG2 as primary lead platform for D3Cold support. Let it get enable on DG1 once this feature is stable.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_pci.c | 2 ++ drivers/gpu/drm/i915/intel_device_info.h | 1 + 3 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1301,6 +1301,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_REGION (i915, i) (INTEL_INFO(i915)->memory_regions & (i))#define HAS_LMEM (i915) HAS_REGION(i915, REGION_LMEM) +#define HAS_LMEM_SR (i915) (INTEL_INFO(i915)->has_lmem_sr)/* * Platform has the dedicated compression control state for each lmem surfaces
drivers/gpu/drm/i915/i915_pci.c +2 -0
@@ -917,6 +917,7 @@ static const struct intel_device_info dg1_info = { DGFX_FEATURES, .graphics.rel =10 ,PLATFORM (INTEL_DG1 ), + .has_lmem_sr = 0, .display.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D), .require_force_probe = 1, .platform_engine_mask =
@@ -1074,6 +1075,7 @@ static const struct intel_device_info xehpsdv_info = {static const struct intel_device_info dg2_info = {DG2_FEATURES ,XE_LPD_FEATURES , + .has_lmem_sr =1 , .display.cpu_transcoder_mask =BIT (TRANSCODER_A ) |BIT (TRANSCODER_B ) |BIT (TRANSCODER_C ) |BIT (TRANSCODER_D ), .require_force_probe =1 ,
drivers/gpu/drm/i915/intel_device_info.h +1 -0
@@ -155,6 +155,7 @@ enum intel_ppgtt_type {func (has_l3_ccs_read); \func (has_l3_dpf); \func (has_llc); \ +func (has_lmem_sr); \func (has_logical_ring_contexts); \func (has_logical_ring_elsq); \func (has_media_ratio_mode); \
Signature · 1 line
2.26.2
PATCH v3 6/9 drm/i915/dgfx: Setup VRAM SR with D3COLD
In reply to Anshuman GuptaSetup VRAM Self Refresh with D3COLD state.
VRAM Self Refresh will retain the context of VRAM, driver need to save any corresponding hardware state that needs to be restore on D3COLD exit.
v2:
- Moved intel_pcode_enable_vram_sr to intel_pm.c. [Jani]
- Removed vram_sr.lock. [Jani]
- Dropped Redundant !HAS_LMEM_SR(i915). [Jani]
--- drivers/gpu/drm/i915/i915_driver.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_reg.h | 4 +++ drivers/gpu/drm/i915/intel_pcode.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 45 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_pm.h | 2 ++ 6 files changed, 56 insertions(+)
drivers/gpu/drm/i915/i915_driver.c +2 -0
@@ -652,6 +652,8 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)if (ret) goto err_msi; +intel_pm_vram_sr_setup (dev_priv); +/* * Fill the dram structure to get the system dram info. This will be * used for memory latency calculation.
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -624,6 +624,8 @@ struct drm_i915_private {u32 bxt_phy_grc;u32 suspend_count; +bool vram_sr_supported; +struct i915_suspend_saved_registers regfile;struct vlv_s0ix_state *vlv_s0ix_state;
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -6766,6 +6766,8 @@#define DG1_PCODE_STATUS 0x7E#define DG1_UNCORE_GET_INIT_STATUS 0x0#define DG1_UNCORE_INIT_STATUS_COMPLETE 0x1 +#define DG1_PCODE_D3_VRAM_SR 0x71 +#define DG1_ENABLE_SR 0x1#define GEN12_PCODE_READ_SAGV_BLOCK_TIME_US 0x23#define XEHPSDV_PCODE_FREQUENCY_CONFIG 0x6e/* xehpsdv, pvc */ /* XEHPSDV_PCODE_FREQUENCY_CONFIG sub-commands (param1) */
@@ -6779,6 +6781,8 @@#define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8#define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16#define GEN6_PCODE_DATA1 _MMIO(0x13812C) +#define VRAM_CAPABILITY _MMIO(0x138144) +#define VRAM_SUPPORTED REG_BIT(0)/* IVYBRIDGE DPF */ #define GEN7_L3CDERRST1 (slice) _MMIO(0xB008 + (slice) * 0x200)/* L3CD Error Status 1 */
drivers/gpu/drm/i915/intel_pcode.h +1 -0
@@ -9,6 +9,7 @@#include <linux/types.h> struct intel_uncore ; +struct drm_i915_private ;int snb_pcode_read (struct intel_uncore *uncore,u32 mbox,u32 *val,u32 *val1); int snb_pcode_write_timeout(struct intel_uncore *uncore, u32 mbox, u32 val,
drivers/gpu/drm/i915/intel_pm.c +45 -0
51 lines not on this page · raw message
drivers/gpu/drm/i915/intel_pm.h +2 -0
@@ -31,6 +31,8 @@ int ilk_wm_max_level(const struct drm_i915_private *dev_priv);void intel_init_pm (struct drm_i915_private *dev_priv);void intel_init_clock_gating_hooks (struct drm_i915_private *dev_priv);void intel_pm_setup (struct drm_i915_private *dev_priv); +void intel_pm_vram_sr_setup (struct drm_i915_private *i915); +int intel_pm_vram_sr (struct drm_i915_private *i915,bool enable);void g4x_wm_get_hw_state (struct drm_i915_private *dev_priv);void vlv_wm_get_hw_state (struct drm_i915_private *dev_priv);void ilk_wm_get_hw_state (struct drm_i915_private *dev_priv);
Signature · 1 line
2.26.2
PATCH v3 7/9 Drm/i915/rpm: Enable D3Cold VRAM SR Support
In reply to Anshuman GuptaIntel Client DGFX card supports D3Cold with two option. D3Cold-off zero watt, D3Cold-VRAM Self Refresh.
i915 requires to evict the lmem objects to smem in order to support D3Cold-Off, which increases i915 the suspend/resume latency. Enabling VRAM Self Refresh feature optimize the latency with additional power cost which required to retain the lmem.
Adding intel_runtime_idle (runtime_idle callback) to enable VRAM_SR, it will be used for policy to choose between D3Cold-off vs D3Cold-VRAM_SR.
Since we have introduced i915 runtime_idle callback.
It need to be warranted that Runtime PM Core invokes runtime_idle callback when runtime usages count becomes zero. That requires to use pm_runtime_put instead of pm_runtime_put_autosuspend.
TODO: GT and GuC Interface state save/restore on VRAM_SR entry/exit.
v2:
- Remove drm_dbg("VRAM Self Refresh enabled"). [Jani]
--- drivers/gpu/drm/i915/i915_driver.c | 26 +++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_runtime_pm.c | 3 +-- 2 files changed, 27 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +26 -0
@@ -1573,6 +1573,31 @@ static int i915_pm_restore(struct device *kdev)return i915_pm_resume (kdev); } +static int intel_runtime_idle (struct device *kdev) +{ +struct drm_i915_private *i915 =kdev_to_i915 (kdev); +int ret =1 ; + +if (!HAS_LMEM_SR (i915)) { +/*TODO: Prepare for D3Cold-Off */ + goto out; + } + +disable_rpm_wakeref_asserts (&i915->runtime_pm); + + ret =intel_pm_vram_sr (i915, true); +if (!ret) + ret =1 ; + +enable_rpm_wakeref_asserts (&i915->runtime_pm); + +out: +pm_runtime_mark_last_busy (kdev); +pm_runtime_autosuspend (kdev); + +return ret; +} +static int intel_runtime_suspend (struct device *kdev) {struct drm_i915_private *dev_priv =kdev_to_i915 (kdev);
@@ -1758,6 +1783,7 @@ const struct dev_pm_ops i915_pm_ops = { .restore = i915_pm_restore,/* S0ix (via runtime suspend) event handlers */ + .runtime_idle = intel_runtime_idle, .runtime_suspend = intel_runtime_suspend, .runtime_resume = intel_runtime_resume, };
drivers/gpu/drm/i915/intel_runtime_pm.c +1 -2
@@ -492,8 +492,7 @@ static void __intel_runtime_pm_put(struct intel_runtime_pm *rpm,intel_runtime_pm_release (rpm, wakelock); -pm_runtime_mark_last_busy (kdev); -pm_runtime_put_autosuspend (kdev); +pm_runtime_put (kdev); }/**
Signature · 1 line
2.26.2
PATCH v3 8/9 drm/i915/xehpsdv: Store lmem region in gt
In reply to Anshuman GuptaFrom: Tvrtko Ursulin <[email protected]>
Store a pointer to respective local memory region in intel_gt so it can be used when memory local to a GT needs to be allocated.
v2:
- Use forward decalaration instead of heder file. [Jani]
--- drivers/gpu/drm/i915/gt/intel_gt.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/gt/intel_gt.c +1 -0
@@ -93,6 +93,7 @@ static int intel_gt_probe_lmem(struct intel_gt *gt)GEM_BUG_ON (!HAS_REGION (i915, id));GEM_BUG_ON (i915->mm.regions[id]); i915->mm.regions[id] = mem; + gt->lmem = mem;return 0 ; }
drivers/gpu/drm/i915/gt/intel_gt_types.h +3 -0
@@ -34,6 +34,7 @@ struct drm_i915_private;struct i915_ggtt ;struct intel_engine_cs ;struct intel_uncore ; +struct intel_memory_region ;struct intel_mmio_range {u32 start;
@@ -202,6 +203,8 @@ struct intel_gt {*/ phys_addr_t phys_addr; +struct intel_memory_region *lmem; +struct intel_gt_info {unsigned int id;
Signature · 1 line
2.26.2
PATCH v3 9/9 drm/i915/rpm: d3cold Policy
In reply to Anshuman GuptaAdd d3cold_sr_lmem_threshold modparam to choose between d3cold-off zero watt and d3cold-VRAM Self Refresh. i915 requires to evict the lmem objects to smem in order to support d3cold-Off. if platform does not supports vram_sr feature then fall back to d3hot by disabling d3cold to avoid the rpm suspend/resume latency.
Extend the d3cold_sr_lmem_threshold modparam to debugfs i915_params so that, it can be used by igt test.
If gfx root port is not capable of sending PME from d3cold or doesn't have _PR3 power resources then only d3hot state can be supported.
Adding intel_pm_prepare_targeted_d3_state() to choose the correct target d3 state and cache it to intel_runtime_pm structure, it can be used in rpm suspend/resume callback accordingly.
FIXME: Eviction of lmem objects in case of D3Cold off is wip.
v2:
- Proivded abstraction to prepare the target d3 state. [Jani]
--- drivers/gpu/drm/i915/i915_driver.c | 11 ++---- drivers/gpu/drm/i915/i915_params.c | 4 ++ drivers/gpu/drm/i915/i915_params.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 50 +++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_pm.h | 1 + drivers/gpu/drm/i915/intel_runtime_pm.h | 7 ++++ 6 files changed, 67 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +4 -7
@@ -1578,20 +1578,14 @@ static int intel_runtime_idle(struct device *kdev)struct drm_i915_private *i915 =kdev_to_i915 (kdev);int ret =1 ; -if (!HAS_LMEM_SR (i915)) { -/*TODO: Prepare for D3Cold-Off */ - goto out; - } -disable_rpm_wakeref_asserts (&i915->runtime_pm); - ret =intel_pm_vram_sr (i915, true); + ret =intel_pm_prepare_targeted_d3_state (i915);if (!ret) ret =1 ;enable_rpm_wakeref_asserts (&i915->runtime_pm); -out:pm_runtime_mark_last_busy (kdev);pm_runtime_autosuspend (kdev);
@@ -1703,6 +1697,9 @@ static int intel_runtime_resume(struct device *kdev)drm_WARN_ON_ONCE (&dev_priv->drm,atomic_read (&rpm->wakeref_count));disable_rpm_wakeref_asserts (rpm); +if (rpm->d3_state ==INTEL_D3COLD_VRAM_SR ) + ret =intel_pm_vram_sr (dev_priv, false); +intel_opregion_notify_adapter (dev_priv,PCI_D0 ); rpm->suspended = false;pci_d3cold_enable (pdev);
drivers/gpu/drm/i915/i915_params.c +4 -0
@@ -197,6 +197,10 @@ i915_param_named(enable_gvt, bool, 0400, "Enable support for Intel GVT-g graphics virtualization host support(default:false)");#endif +i915_param_named_unsafe (d3cold_sr_lmem_threshold, int,0600 , +"Enable Vidoe RAM Self refresh when size of lmem is greater to this threshold. " +"It helps to optimize the suspend/resume latecy. (default: 300mb)" ); +#if CONFIG_DRM_I915_REQUEST_TIMEOUT i915_param_named_unsafe (request_timeout_ms, uint,0600 ,"Default request/fence/batch buffer expiration timeout." );
drivers/gpu/drm/i915/i915_params.h +1 -0
@@ -74,6 +74,7 @@ struct drm_printer; param(char *, force_probe, CONFIG_DRM_I915_FORCE_PROBE, 0400) \ param(unsigned int, request_timeout_ms, CONFIG_DRM_I915_REQUEST_TIMEOUT, CONFIG_DRM_I915_REQUEST_TIMEOUT ? 0600 : 0) \ param(unsigned int, lmem_size, 0, 0400) \ + param(int, d3cold_sr_lmem_threshold, 300, 0600) \/* leave bools at the end to not create holes */ \ param(bool, enable_hangcheck, true, 0600) \param (bool, load_detect_test, false,0600 ) \
drivers/gpu/drm/i915/intel_pm.c +50 -0
56 lines not on this page · raw message
drivers/gpu/drm/i915/intel_pm.h +1 -0
@@ -33,6 +33,7 @@ void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv);void intel_pm_setup (struct drm_i915_private *dev_priv);void intel_pm_vram_sr_setup (struct drm_i915_private *i915);int intel_pm_vram_sr (struct drm_i915_private *i915,bool enable); +int intel_pm_prepare_targeted_d3_state (struct drm_i915_private *i915);void g4x_wm_get_hw_state (struct drm_i915_private *dev_priv);void vlv_wm_get_hw_state (struct drm_i915_private *dev_priv);void ilk_wm_get_hw_state (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_runtime_pm.h +7 -0
@@ -22,6 +22,12 @@ enum i915_drm_suspend_mode { I915_DRM_SUSPEND_HIBERNATE, }; +enum intel_gfx_d3_state { +INTEL_D3HOT , +INTEL_D3COLD_OFF , +INTEL_D3COLD_VRAM_SR , +}; +/* * This struct helps tracking the state needed for runtime PM, which puts the * device in PCI D3 state. Notice that when this happens, nothing on the
@@ -52,6 +58,7 @@ struct intel_runtime_pm {bool suspended;bool irqs_enabled;bool no_wakeref_tracking; +enum intel_gfx_d3_state d3_state;#if IS_ENABLED (CONFIG_DRM_I915_DEBUG_RUNTIME_PM )/*
Signature · 1 line
2.26.2
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for DG2 VRAM_SR Support (rev4)
In reply to Anshuman Gupta== Series Details ==
== Series Details ==
Series: DG2 VRAM_SR Support (rev4)
URL : https://patchwork.freedesktop.org/series/104128/
State : failure
== Summary ==
Error: make failed
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
CC [M] drivers/gpu/drm/i915/intel_pm.odrivers/gpu/drm/i915/intel_pm.c:8304:5: error: no previous prototype for ‘intel_pcode_enable_vram_sr’ [-Werror=missing-prototypes]
int intel_pcode_enable_vram_sr(struct drm_i915_private *i915)
^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errorsscripts/Makefile.build:249: recipe for target 'drivers/gpu/drm/i915/intel_pm.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_pm.o] Error 1 scripts/Makefile.build:466: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:466: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:466: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:1843: recipe for target 'drivers' failed
make: *** [drivers] Error 2