Re: [Intel-gfx] [PATCH 5/7] drm/i915/mtl: Handle wopcm per-GT and limit calculations.
On 9/23/2022 2:24 AM, Jani Nikula wrote: On Thu, 22 Sep 2022, Daniele Ceraolo Spurio wrote: From: Aravind Iddamsetty With MTL standalone media architecture the wopcm layout has changed with separate partitioning in WOPCM for GCD/GT GuC and SA Media GuC. The size of WOPCM is 4MB with lower 2MB for SA Media and upper 2MB for GCD/GT. +=+===> ++ <== WOPCM TOP ^ ^ || | | || |GCD| GCD RC6 Image| |GuC|Power Context | |WOPCM || |Size ++ | | | GCD GuC Image| | | || | v || | +===> ++ <== SA Media GuC WOPCM Top | ^ || | SA Media|| |GuC| SA Media RC6 Image | | WOPCM |Power Context | |Size || WOPCM | ++ | | || | | | SA Media GuC Image | | v || | +===> ++ <== GuC WOPCM base | | WOPCM RSVD | | +--- + <== HuC Firmware Top v | HuC FW| +=> ++ <== WOPCM Base Given that MTL has GuC deprivilege, the WOPCM registers are pre-locked by the bios. Therefore, we can skip all the math for the partitioning and just limit ourselves to sanity checking the values. Signed-off-by: Aravind Iddamsetty Signed-off-by: Daniele Ceraolo Spurio Cc: Matt Roper Cc: John Harrison Cc: Alan Previn --- drivers/gpu/drm/i915/Makefile | 7 +-- drivers/gpu/drm/i915/gt/intel_ggtt.c| 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_types.h| 2 + drivers/gpu/drm/i915/{ => gt}/intel_wopcm.c | 48 +++-- drivers/gpu/drm/i915/{ => gt}/intel_wopcm.h | 0 drivers/gpu/drm/i915/gt/uc/intel_uc.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c| 14 +++--- drivers/gpu/drm/i915/i915_driver.c | 2 - drivers/gpu/drm/i915/i915_drv.h | 3 -- drivers/gpu/drm/i915/i915_gem.c | 5 ++- 11 files changed, 56 insertions(+), 32 deletions(-) rename drivers/gpu/drm/i915/{ => gt}/intel_wopcm.c (86%) rename drivers/gpu/drm/i915/{ => gt}/intel_wopcm.h (100%) diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index a26edcdadc21..6ed4c745b226 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -129,7 +129,9 @@ gt-y += \ gt/intel_timeline.o \ gt/intel_workarounds.o \ gt/shmem_utils.o \ - gt/sysfs_engines.o + gt/sysfs_engines.o \ + gt/intel_wopcm.o The comment near the top of the file: # Please keep these build lists sorted! D'oh! My monkey brain saw that "wopcm" was correctly ordered after "engines" and completely ignored the first part of the name :/ Will fix next rev. Daniele + # x86 intel-gtt module support gt-$(CONFIG_X86) += gt/intel_ggtt_gmch.o # autogenerated null render state @@ -183,8 +185,7 @@ i915-y += \ i915_trace_points.o \ i915_ttm_buddy_manager.o \ i915_vma.o \ - i915_vma_resource.o \ - intel_wopcm.o + i915_vma_resource.o # general-purpose microcontroller (GuC) support i915-y += gt/uc/intel_uc.o \ diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c index 30cf5c3369d9..605e1aa674d4 100644 --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c @@ -560,7 +560,7 @@ static int init_ggtt(struct i915_ggtt *ggtt) * why. */ ggtt->pin_bias = max_t(u32, I915_GTT_PAGE_SIZE, - intel_wopcm_guc_size(>vm.i915->wopcm)); + intel_wopcm_guc_size(>vm.gt->wopcm)); ret = intel_vgt_balloon(ggtt); if (ret) diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c index b367cfff48d5..a95eb0b656d2 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -56,6 +56,7 @@ void intel_gt_common_init_early(struct intel_gt *gt) seqcount_mutex_init(>tlb.seqno, >tlb.invalidate_lock); intel_gt_pm_init_early(gt); + intel_wopcm_init_early(>wopcm); intel_uc_init_early(>uc); intel_rps_init_early(>rps); } diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h index f19c2de77ff6..c20a32d2700f 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h @@ -30,6 +30,7 @@ #include "intel_migrate_types.h" #include "intel_wakeref.h" #include "pxp/intel_pxp_types.h"
Re: [Intel-gfx] [PATCH 5/7] drm/i915/mtl: Handle wopcm per-GT and limit calculations.
On Thu, 22 Sep 2022, Daniele Ceraolo Spurio wrote: > From: Aravind Iddamsetty > > With MTL standalone media architecture the wopcm layout has changed with > separate partitioning in WOPCM for GCD/GT GuC and SA Media GuC. The size > of WOPCM is 4MB with lower 2MB for SA Media and upper 2MB for GCD/GT. > > +=+===> ++ <== WOPCM TOP > ^ ^ || > | | || > |GCD| GCD RC6 Image| > |GuC|Power Context | > |WOPCM || > |Size ++ > | | | GCD GuC Image| > | | || > | v || > | +===> ++ <== SA Media GuC WOPCM Top > | ^ || > | SA Media|| > |GuC| SA Media RC6 Image | > | WOPCM |Power Context | > |Size || > WOPCM | ++ > | | || > | | | SA Media GuC Image | > | v || > | +===> ++ <== GuC WOPCM base > | | WOPCM RSVD | > | +--- + <== HuC Firmware Top > v | HuC FW| > +=> ++ <== WOPCM Base > > Given that MTL has GuC deprivilege, the WOPCM registers are pre-locked > by the bios. Therefore, we can skip all the math for the partitioning > and just limit ourselves to sanity checking the values. > > Signed-off-by: Aravind Iddamsetty > Signed-off-by: Daniele Ceraolo Spurio > Cc: Matt Roper > Cc: John Harrison > Cc: Alan Previn > --- > drivers/gpu/drm/i915/Makefile | 7 +-- > drivers/gpu/drm/i915/gt/intel_ggtt.c| 2 +- > drivers/gpu/drm/i915/gt/intel_gt.c | 1 + > drivers/gpu/drm/i915/gt/intel_gt_types.h| 2 + > drivers/gpu/drm/i915/{ => gt}/intel_wopcm.c | 48 +++-- > drivers/gpu/drm/i915/{ => gt}/intel_wopcm.h | 0 > drivers/gpu/drm/i915/gt/uc/intel_uc.c | 4 +- > drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c| 14 +++--- > drivers/gpu/drm/i915/i915_driver.c | 2 - > drivers/gpu/drm/i915/i915_drv.h | 3 -- > drivers/gpu/drm/i915/i915_gem.c | 5 ++- > 11 files changed, 56 insertions(+), 32 deletions(-) > rename drivers/gpu/drm/i915/{ => gt}/intel_wopcm.c (86%) > rename drivers/gpu/drm/i915/{ => gt}/intel_wopcm.h (100%) > > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile > index a26edcdadc21..6ed4c745b226 100644 > --- a/drivers/gpu/drm/i915/Makefile > +++ b/drivers/gpu/drm/i915/Makefile > @@ -129,7 +129,9 @@ gt-y += \ > gt/intel_timeline.o \ > gt/intel_workarounds.o \ > gt/shmem_utils.o \ > - gt/sysfs_engines.o > + gt/sysfs_engines.o \ > + gt/intel_wopcm.o The comment near the top of the file: # Please keep these build lists sorted! > + > # x86 intel-gtt module support > gt-$(CONFIG_X86) += gt/intel_ggtt_gmch.o > # autogenerated null render state > @@ -183,8 +185,7 @@ i915-y += \ > i915_trace_points.o \ > i915_ttm_buddy_manager.o \ > i915_vma.o \ > - i915_vma_resource.o \ > - intel_wopcm.o > + i915_vma_resource.o > > # general-purpose microcontroller (GuC) support > i915-y += gt/uc/intel_uc.o \ > diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c > b/drivers/gpu/drm/i915/gt/intel_ggtt.c > index 30cf5c3369d9..605e1aa674d4 100644 > --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c > +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c > @@ -560,7 +560,7 @@ static int init_ggtt(struct i915_ggtt *ggtt) >* why. >*/ > ggtt->pin_bias = max_t(u32, I915_GTT_PAGE_SIZE, > -intel_wopcm_guc_size(>vm.i915->wopcm)); > +intel_wopcm_guc_size(>vm.gt->wopcm)); > > ret = intel_vgt_balloon(ggtt); > if (ret) > diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c > b/drivers/gpu/drm/i915/gt/intel_gt.c > index b367cfff48d5..a95eb0b656d2 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt.c > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c > @@ -56,6 +56,7 @@ void intel_gt_common_init_early(struct intel_gt *gt) > seqcount_mutex_init(>tlb.seqno, >tlb.invalidate_lock); > intel_gt_pm_init_early(gt); > > + intel_wopcm_init_early(>wopcm); > intel_uc_init_early(>uc); > intel_rps_init_early(>rps); > } > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h > b/drivers/gpu/drm/i915/gt/intel_gt_types.h > index f19c2de77ff6..c20a32d2700f 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h > +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h > @@ -30,6 +30,7 @@ > #include "intel_migrate_types.h" > #include "intel_wakeref.h" > #include "pxp/intel_pxp_types.h" > +#include "intel_wopcm.h" > > struct drm_i915_private; > struct
[PATCH 5/7] drm/i915/mtl: Handle wopcm per-GT and limit calculations.
From: Aravind Iddamsetty With MTL standalone media architecture the wopcm layout has changed with separate partitioning in WOPCM for GCD/GT GuC and SA Media GuC. The size of WOPCM is 4MB with lower 2MB for SA Media and upper 2MB for GCD/GT. +=+===> ++ <== WOPCM TOP ^ ^ || | | || |GCD| GCD RC6 Image| |GuC|Power Context | |WOPCM || |Size ++ | | | GCD GuC Image| | | || | v || | +===> ++ <== SA Media GuC WOPCM Top | ^ || | SA Media|| |GuC| SA Media RC6 Image | | WOPCM |Power Context | |Size || WOPCM | ++ | | || | | | SA Media GuC Image | | v || | +===> ++ <== GuC WOPCM base | | WOPCM RSVD | | +--- + <== HuC Firmware Top v | HuC FW| +=> ++ <== WOPCM Base Given that MTL has GuC deprivilege, the WOPCM registers are pre-locked by the bios. Therefore, we can skip all the math for the partitioning and just limit ourselves to sanity checking the values. Signed-off-by: Aravind Iddamsetty Signed-off-by: Daniele Ceraolo Spurio Cc: Matt Roper Cc: John Harrison Cc: Alan Previn --- drivers/gpu/drm/i915/Makefile | 7 +-- drivers/gpu/drm/i915/gt/intel_ggtt.c| 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_types.h| 2 + drivers/gpu/drm/i915/{ => gt}/intel_wopcm.c | 48 +++-- drivers/gpu/drm/i915/{ => gt}/intel_wopcm.h | 0 drivers/gpu/drm/i915/gt/uc/intel_uc.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c| 14 +++--- drivers/gpu/drm/i915/i915_driver.c | 2 - drivers/gpu/drm/i915/i915_drv.h | 3 -- drivers/gpu/drm/i915/i915_gem.c | 5 ++- 11 files changed, 56 insertions(+), 32 deletions(-) rename drivers/gpu/drm/i915/{ => gt}/intel_wopcm.c (86%) rename drivers/gpu/drm/i915/{ => gt}/intel_wopcm.h (100%) diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index a26edcdadc21..6ed4c745b226 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -129,7 +129,9 @@ gt-y += \ gt/intel_timeline.o \ gt/intel_workarounds.o \ gt/shmem_utils.o \ - gt/sysfs_engines.o + gt/sysfs_engines.o \ + gt/intel_wopcm.o + # x86 intel-gtt module support gt-$(CONFIG_X86) += gt/intel_ggtt_gmch.o # autogenerated null render state @@ -183,8 +185,7 @@ i915-y += \ i915_trace_points.o \ i915_ttm_buddy_manager.o \ i915_vma.o \ - i915_vma_resource.o \ - intel_wopcm.o + i915_vma_resource.o # general-purpose microcontroller (GuC) support i915-y += gt/uc/intel_uc.o \ diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c index 30cf5c3369d9..605e1aa674d4 100644 --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c @@ -560,7 +560,7 @@ static int init_ggtt(struct i915_ggtt *ggtt) * why. */ ggtt->pin_bias = max_t(u32, I915_GTT_PAGE_SIZE, - intel_wopcm_guc_size(>vm.i915->wopcm)); + intel_wopcm_guc_size(>vm.gt->wopcm)); ret = intel_vgt_balloon(ggtt); if (ret) diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c index b367cfff48d5..a95eb0b656d2 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -56,6 +56,7 @@ void intel_gt_common_init_early(struct intel_gt *gt) seqcount_mutex_init(>tlb.seqno, >tlb.invalidate_lock); intel_gt_pm_init_early(gt); + intel_wopcm_init_early(>wopcm); intel_uc_init_early(>uc); intel_rps_init_early(>rps); } diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h index f19c2de77ff6..c20a32d2700f 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h @@ -30,6 +30,7 @@ #include "intel_migrate_types.h" #include "intel_wakeref.h" #include "pxp/intel_pxp_types.h" +#include "intel_wopcm.h" struct drm_i915_private; struct i915_ggtt; @@ -97,6 +98,7 @@ struct intel_gt { struct intel_uc uc; struct intel_gsc gsc; + struct intel_wopcm wopcm; struct { /* Serialize global tlb invalidations */ diff --git a/drivers/gpu/drm/i915/intel_wopcm.c b/drivers/gpu/drm/i915/gt/intel_wopcm.c similarity index 86%