Re: [PATCH RESEND v7 12/12] drm/i915: Move the GGTT from i915 private data to the GT

2021-12-13 Thread Andi Shyti
Hi Matt,

On Mon, Dec 13, 2021 at 10:16:47AM -0800, Matt Roper wrote:
> On Sun, Dec 12, 2021 at 05:21:17PM +0200, Andi Shyti wrote:
> > GGTT was available both through i915->ggtt and gt->ggtt, and we
> > eventually want to get rid of the i915->ggtt one.
> > Move the GGTT from i915 to gt and use to_gt() for accesssing the
> > ggtt.
> > 
> > Signed-off-by: Andi Shyti 
> > Cc: Michal Wajdeczko 
> > Cc: Matt Roper 
> > ---
> ...
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h 
> > b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> > index 14216cc471b1..02fc7641b82e 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> > @@ -69,7 +69,7 @@ enum intel_submission_method {
> >  struct intel_gt {
> > struct drm_i915_private *i915;
> > struct intel_uncore *uncore;
> > -   struct i915_ggtt *ggtt;
> > +   struct i915_ggtt ggtt;
> >  
> > struct intel_uc uc;
> >  
> 
> I'm not sure this is the direction we want to go.  Although it works for
> the initial multi-tile support, there's some other stuff coming up soon
> that will require two intel_gt's to share the same ggtt rather than
> each having an independent one.

Sure... I sent this just to have an opinion, I'm dropping it.

Thanks,
Andi


Re: [PATCH RESEND v7 12/12] drm/i915: Move the GGTT from i915 private data to the GT

2021-12-13 Thread Matt Roper
On Sun, Dec 12, 2021 at 05:21:17PM +0200, Andi Shyti wrote:
> GGTT was available both through i915->ggtt and gt->ggtt, and we
> eventually want to get rid of the i915->ggtt one.
> Move the GGTT from i915 to gt and use to_gt() for accesssing the
> ggtt.
> 
> Signed-off-by: Andi Shyti 
> Cc: Michal Wajdeczko 
> Cc: Matt Roper 
> ---
...
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h 
> b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> index 14216cc471b1..02fc7641b82e 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> @@ -69,7 +69,7 @@ enum intel_submission_method {
>  struct intel_gt {
>   struct drm_i915_private *i915;
>   struct intel_uncore *uncore;
> - struct i915_ggtt *ggtt;
> + struct i915_ggtt ggtt;
>  
>   struct intel_uc uc;
>  

I'm not sure this is the direction we want to go.  Although it works for
the initial multi-tile support, there's some other stuff coming up soon
that will require two intel_gt's to share the same ggtt rather than
each having an independent one.


Matt

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795


Re: [PATCH RESEND v7 12/12] drm/i915: Move the GGTT from i915 private data to the GT

2021-12-13 Thread kernel test robot
Hi Andi,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-tip/drm-tip]
[also build test ERROR on drm/drm-next]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next v5.16-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Andi-Shyti/More-preparation-for-multi-gt-patches/20211212-232416
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-a003-20211213 
(https://download.01.org/0day-ci/archive/20211213/202112132358.iwecweww-...@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/0day-ci/linux/commit/98ef49d710790dda7a193c10b5b7f28516f730bc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Andi-Shyti/More-preparation-for-multi-gt-patches/20211212-232416
git checkout 98ef49d710790dda7a193c10b5b7f28516f730bc
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gvt/gtt.c:321:25: error: passing 'struct i915_ggtt' to 
>> parameter of incompatible type 'struct i915_ggtt *'; take the address with &
   e->val64 = read_pte64(vgpu->gvt->gt->ggtt, index);
 ^~~
 &
   drivers/gpu/drm/i915/gvt/gtt.c:282:41: note: passing argument to parameter 
'ggtt' here
   static u64 read_pte64(struct i915_ggtt *ggtt, unsigned long index)
   ^
   drivers/gpu/drm/i915/gvt/gtt.c:346:15: error: passing 'struct i915_ggtt' to 
parameter of incompatible type 'struct i915_ggtt *'; take the address with &
   write_pte64(vgpu->gvt->gt->ggtt, index, e->val64);
   ^~~
   &
   drivers/gpu/drm/i915/gvt/gtt.c:296:43: note: passing argument to parameter 
'ggtt' here
   static void write_pte64(struct i915_ggtt *ggtt, unsigned long index, u64 pte)
 ^
   drivers/gpu/drm/i915/gvt/gtt.c:2900:17: error: passing 'struct i915_ggtt' to 
parameter of incompatible type 'struct i915_ggtt *'; take the address with &
   write_pte64(vgpu->gvt->gt->ggtt, offset + 
idx, pte);
   ^~~
   &
   drivers/gpu/drm/i915/gvt/gtt.c:296:43: note: passing argument to parameter 
'ggtt' here
   static void write_pte64(struct i915_ggtt *ggtt, unsigned long index, u64 pte)
 ^
   drivers/gpu/drm/i915/gvt/gtt.c:2908:17: error: passing 'struct i915_ggtt' to 
parameter of incompatible type 'struct i915_ggtt *'; take the address with &
   write_pte64(vgpu->gvt->gt->ggtt, offset + 
idx, pte);
   ^~~
   &
   drivers/gpu/drm/i915/gvt/gtt.c:296:43: note: passing argument to parameter 
'ggtt' here
   static void write_pte64(struct i915_ggtt *ggtt, unsigned long index, u64 pte)
 ^
   4 errors generated.


vim +321 drivers/gpu/drm/i915/gvt/gtt.c

2707e44466881d Zhi Wang 2016-03-28  302  
4b2dbbc22541e4 Changbin Du  2017-08-02  303  static inline int 
gtt_get_entry64(void *pt,
2707e44466881d Zhi Wang 2016-03-28  304 struct 
intel_gvt_gtt_entry *e,
2707e44466881d Zhi Wang 2016-03-28  305 unsigned long index, 
bool hypervisor_access, unsigned long gpa,
2707e44466881d Zhi Wang 2016-03-28  306 struct intel_vgpu *vgpu)
2707e44466881d Zhi Wang 2016-03-28  307  {
2707e44466881d Zhi Wang 2016-03-28  308 const struct 
intel_gvt_device_info *info = >gvt->device_info;
2707e44466881d Zhi Wang 2016-03-28  309 int ret;
2707e44466881d Zhi Wang 2016-03-28  310  
2707e44466881d Zhi Wang 2016-03-28  311 if 
(WARN_ON(info->gtt_entry_size != 8))
4b2dbbc22541e4 Changbin Du  2017-08-02  312 return -EINVAL;
2707e44466881d Zhi Wang 2016-03-28  313  
2707e44466881d Zhi Wang 2016-03-28  314 if (hypervisor_access) {
2707e44466881d Zhi Wang 2016-03-28  315 ret = 

[PATCH RESEND v7 12/12] drm/i915: Move the GGTT from i915 private data to the GT

2021-12-12 Thread Andi Shyti
GGTT was available both through i915->ggtt and gt->ggtt, and we
eventually want to get rid of the i915->ggtt one.
Move the GGTT from i915 to gt and use to_gt() for accesssing the
ggtt.

Signed-off-by: Andi Shyti 
Cc: Michal Wajdeczko 
Cc: Matt Roper 
---
 drivers/gpu/drm/i915/display/intel_fbc.c  |  2 +-
 drivers/gpu/drm/i915/display/intel_fbdev.c|  2 +-
 .../drm/i915/display/intel_plane_initial.c|  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.h   |  2 +-
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c|  4 +--
 drivers/gpu/drm/i915/gem/i915_gem_mman.c  | 19 +++---
 drivers/gpu/drm/i915/gem/i915_gem_pm.c|  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c  |  6 ++---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c|  8 +++---
 drivers/gpu/drm/i915/gem/i915_gem_tiling.c| 17 +++-
 .../i915/gem/selftests/i915_gem_client_blt.c  |  6 ++---
 .../i915/gem/selftests/i915_gem_coherency.c   |  2 +-
 .../drm/i915/gem/selftests/i915_gem_context.c |  4 +--
 .../drm/i915/gem/selftests/i915_gem_mman.c| 21 ---
 .../drm/i915/gem/selftests/i915_gem_object.c  |  2 +-
 drivers/gpu/drm/i915/gt/gen6_ppgtt.c  |  6 ++---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c |  4 +--
 drivers/gpu/drm/i915/gt/intel_ggtt.c  | 14 +-
 drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c  |  6 ++---
 drivers/gpu/drm/i915/gt/intel_gt.c|  9 ++-
 drivers/gpu/drm/i915/gt/intel_gt.h|  1 -
 drivers/gpu/drm/i915/gt/intel_gt_pm.c |  2 +-
 drivers/gpu/drm/i915/gt/intel_gt_types.h  |  2 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c   |  4 +--
 drivers/gpu/drm/i915/gt/intel_region_lmem.c   |  4 +--
 drivers/gpu/drm/i915/gt/intel_renderstate.c   |  2 +-
 drivers/gpu/drm/i915/gt/intel_reset.c |  8 +++---
 drivers/gpu/drm/i915/gt/intel_ring.c  |  2 +-
 .../gpu/drm/i915/gt/intel_ring_submission.c   |  2 +-
 drivers/gpu/drm/i915/gt/intel_timeline.c  |  2 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c   |  2 +-
 drivers/gpu/drm/i915/gt/mock_engine.c |  2 +-
 drivers/gpu/drm/i915/gt/selftest_execlists.c  | 10 +++
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |  6 ++---
 drivers/gpu/drm/i915/gt/selftest_lrc.c|  2 +-
 drivers/gpu/drm/i915/gt/selftest_mocs.c   |  2 +-
 drivers/gpu/drm/i915/gt/selftest_reset.c  |  2 +-
 .../gpu/drm/i915/gt/selftest_workarounds.c|  2 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc.c|  6 ++---
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c  |  6 ++---
 drivers/gpu/drm/i915/gvt/aperture_gm.c| 26 +--
 drivers/gpu/drm/i915/gvt/dmabuf.c |  2 +-
 drivers/gpu/drm/i915/gvt/gvt.h|  2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c  |  2 +-
 drivers/gpu/drm/i915/i915_debugfs.c   |  4 +--
 drivers/gpu/drm/i915/i915_driver.c|  6 ++---
 drivers/gpu/drm/i915/i915_drv.h   |  4 +--
 drivers/gpu/drm/i915/i915_gem.c   | 23 
 drivers/gpu/drm/i915/i915_gem_gtt.c   |  6 ++---
 drivers/gpu/drm/i915/i915_getparam.c  |  2 +-
 drivers/gpu/drm/i915/i915_gpu_error.c | 10 +++
 drivers/gpu/drm/i915/i915_gpu_error.h |  4 +--
 drivers/gpu/drm/i915/i915_perf.c  |  6 ++---
 drivers/gpu/drm/i915/i915_request.c   |  2 +-
 drivers/gpu/drm/i915/i915_vma.c   |  2 +-
 drivers/gpu/drm/i915/selftests/i915_gem.c |  8 +++---
 .../gpu/drm/i915/selftests/i915_gem_evict.c   | 12 -
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  8 +++---
 drivers/gpu/drm/i915/selftests/i915_request.c |  2 +-
 drivers/gpu/drm/i915/selftests/i915_vma.c |  4 +--
 .../gpu/drm/i915/selftests/mock_gem_device.c  |  6 ++---
 drivers/gpu/drm/i915/selftests/mock_gtt.c |  1 -
 62 files changed, 173 insertions(+), 176 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c 
b/drivers/gpu/drm/i915/display/intel_fbc.c
index 98319c0322d7..484cb2a80723 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -595,7 +595,7 @@ static void ivb_fbc_activate(struct intel_fbc *fbc)
else if (DISPLAY_VER(i915) == 9)
skl_fbc_program_cfb_stride(fbc);
 
-   if (to_gt(i915)->ggtt->num_fences)
+   if (to_gt(i915)->ggtt.num_fences)
snb_fbc_program_fence(fbc);
 
intel_de_write(i915, ILK_DPFC_CONTROL,
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c 
b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 41d279db2be6..ffecfec465c3 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -180,7 +180,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
struct drm_device *dev = helper->dev;
struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
-   struct i915_ggtt *ggtt = to_gt(dev_priv)->ggtt;
+