Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4580iob; Wed, 11 May 2022 08:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhXt9ZE1nSO/GGO5x3xiZCo/59KQM99TjiA8TxAlPn/CVBr3SQdWo0kEReceTCPF0FhCM5 X-Received: by 2002:a62:a516:0:b0:505:722e:15d5 with SMTP id v22-20020a62a516000000b00505722e15d5mr25929802pfm.52.1652282517597; Wed, 11 May 2022 08:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652282517; cv=none; d=google.com; s=arc-20160816; b=h8CnuNT3SbcJhOBsi596Rsa9m4KeMC/i1W6rBublFNIzDvDo/z0YlPLRKUymATs92J KUdKCZIKIKL+DCMk6wq2vvo9LJ0ECPyByFSL8fPAegl/QaI6cHYA4dLQpRSYrPZ1JWD6 CeaaeTvjoZr0dAW8KMNxb1MUOTaZseZhoGJhhPRFygbsl/Dldu/GX7v+HTk2ElDUKTW5 jgoHobT0GFBWZGyOEkPtwpp7Nqw+2qQ0t8+tHGz3m83m23Z9n/YCLcTnvevmVnX8SvH4 KOwfhmHz1uAJfXUd3oqQ7L+gI/kdrlbk34CadkrldNCerqxdBSeRn7/SHtQ7+uZzV645 Alig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=LYCeesMidTOE3gt1M/6Zoob+drfqXBtnRLafk/aV7f4=; b=TM/ECUVkrY4zbpMvPBxbzL3nd1SDOKSLAb1DZHKdBCpIrr5hUqskU+Nj5U1z9c7ZYo 5P1meAejf7ua2cgz201fQVcwXfdX1I2gUGWYlA3INmfbcCtnLB+HsEkK5+5M9NNCU3gQ cPp0+28L73Zbe8SDZWZaGgoOuZHnyzsQvUH0t8f9BslbCY5074fevR1oHHFhEE5Dsyd/ tYVwbub7N2tY6++WoFk6HAdvt7qqOfdZgoJp0Ru1uQ2hVRJfJrSTbQ2jXodwmURSmTgV FV+Ys7XqZOy+K80LzsGVQFXq3cyPdw8xuRqs5RWExtwPF4kv0Ks1gzCJdqnmCDeXG/jA 7tBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b7JwQq9d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nv18-20020a17090b1b5200b001dc439d1eefsi116582pjb.104.2022.05.11.08.21.45; Wed, 11 May 2022 08:21:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b7JwQq9d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243056AbiEKL0a (ORCPT + 99 others); Wed, 11 May 2022 07:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241406AbiEKLZD (ORCPT ); Wed, 11 May 2022 07:25:03 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57F3F235C2E for ; Wed, 11 May 2022 04:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652268298; x=1683804298; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=0mBxdYYhd/ynDopbSkM/840fXVGCFQrMoEdfUTAyB3M=; b=b7JwQq9dSeWR6oWw9U5jHN0ndWnP91DQVFIrHbjyAT4mLNuNoS+cADv5 qlB2kjMoGiAySOsdEmxONq918C6hafCo/5YpUCbv5jxHEPFrA3Rk3+lZC B7E3n+h1S+pnBmLONwcWtBIlaWxqf1tqvUvF0cp464CHDV5h2llxsWjkO uURDfbPoIDu1Fu1c20pcVlFzUO2KbjD0+pfiiLlsstde9vr++W6eR30M5 1VZhrWD2VJq6gurZSAEqnhkJVpOzOs3Dl1I9Q1Dw4MXr0yExWtuw16foz LTQK0+0PxaqLK8gU6zXHJ3Xyyas10QCDHiSlyDDVrQ1xvZSN9m2AChU9h w==; X-IronPort-AV: E=McAfee;i="6400,9594,10343"; a="356093662" X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="356093662" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 04:24:58 -0700 X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="636377532" Received: from mstribae-mobl1.ger.corp.intel.com (HELO [10.249.254.135]) ([10.249.254.135]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 04:24:55 -0700 Message-ID: Subject: Re: [PATCH 2/4] drm/i915: setup ggtt scratch page after memory regions From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Robert Beckett , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: Matthew Auld , linux-kernel@vger.kernel.org Date: Wed, 11 May 2022 13:24:53 +0200 In-Reply-To: <20220503191316.1145124-3-bob.beckett@collabora.com> References: <20220503191316.1145124-1-bob.beckett@collabora.com> <20220503191316.1145124-3-bob.beckett@collabora.com> Organization: Intel Sweden AB, Registration Number: 556189-6027 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-3.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2022-05-03 at 19:13 +0000, Robert Beckett wrote: > reorder scratch page allocation so that memory regions are available Nit: s/reorder/Reorder/ Reviewed-by: Thomas Hellström > to allocate the buffers > > Signed-off-by: Robert Beckett > --- >  drivers/gpu/drm/i915/gt/intel_gt_gmch.c | 20 ++++++++++++++++++-- >  drivers/gpu/drm/i915/gt/intel_gt_gmch.h |  6 ++++++ >  drivers/gpu/drm/i915/i915_driver.c      | 16 ++++++++++------ >  3 files changed, 34 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_gmch.c > b/drivers/gpu/drm/i915/gt/intel_gt_gmch.c > index 18e488672d1b..5411df1734ac 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt_gmch.c > +++ b/drivers/gpu/drm/i915/gt/intel_gt_gmch.c > @@ -440,8 +440,6 @@ static int ggtt_probe_common(struct i915_ggtt > *ggtt, u64 size) >         struct drm_i915_private *i915 = ggtt->vm.i915; >         struct pci_dev *pdev = to_pci_dev(i915->drm.dev); >         phys_addr_t phys_addr; > -       u32 pte_flags; > -       int ret; >   >         GEM_WARN_ON(pci_resource_len(pdev, 0) != > gen6_gttmmadr_size(i915)); >         phys_addr = pci_resource_start(pdev, 0) + > gen6_gttadr_offset(i915); > @@ -463,6 +461,24 @@ static int ggtt_probe_common(struct i915_ggtt > *ggtt, u64 size) >         } >   >         kref_init(&ggtt->vm.resv_ref); > + > +       return 0; > +} > + > +/** > + * i915_ggtt_setup_scratch_page - setup ggtt scratch page > + * @i915: i915 device > + */ > +int i915_ggtt_setup_scratch_page(struct drm_i915_private *i915) > +{ > +       struct i915_ggtt *ggtt = to_gt(i915)->ggtt; > +       u32 pte_flags; > +       int ret; > + > +       /* gen5- scratch setup currently happens in @intel_gtt_init > */ > +       if (GRAPHICS_VER(i915) <= 5) > +               return 0; > + >         ret = setup_scratch_page(&ggtt->vm); >         if (ret) { >                 drm_err(&i915->drm, "Scratch setup failed\n"); > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_gmch.h > b/drivers/gpu/drm/i915/gt/intel_gt_gmch.h > index 75ed55c1f30a..c6b79cb78637 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt_gmch.h > +++ b/drivers/gpu/drm/i915/gt/intel_gt_gmch.h > @@ -15,6 +15,7 @@ int intel_gt_gmch_gen6_probe(struct i915_ggtt > *ggtt); >  int intel_gt_gmch_gen8_probe(struct i915_ggtt *ggtt); >  int intel_gt_gmch_gen5_probe(struct i915_ggtt *ggtt); >  int intel_gt_gmch_gen5_enable_hw(struct drm_i915_private *i915); > +int i915_ggtt_setup_scratch_page(struct drm_i915_private *i915); >   >  /* Stubs for non-x86 platforms */ >  #else > @@ -41,6 +42,11 @@ static inline int > intel_gt_gmch_gen5_enable_hw(struct drm_i915_private *i915) >         /* No HW should be enabled for this case yet, return fail */ >         return -ENODEV; >  } > + > +static inline int i915_ggtt_setup_scratch_page(struct > drm_i915_private *i915) > +{ > +       return 0; > +} >  #endif >   >  #endif /* __INTEL_GT_GMCH_H__ */ > diff --git a/drivers/gpu/drm/i915/i915_driver.c > b/drivers/gpu/drm/i915/i915_driver.c > index 90b0ce5051af..f67476b2f349 100644 > --- a/drivers/gpu/drm/i915/i915_driver.c > +++ b/drivers/gpu/drm/i915/i915_driver.c > @@ -69,6 +69,7 @@ >  #include "gem/i915_gem_mman.h" >  #include "gem/i915_gem_pm.h" >  #include "gt/intel_gt.h" > +#include "gt/intel_gt_gmch.h" >  #include "gt/intel_gt_pm.h" >  #include "gt/intel_rc6.h" >   > @@ -589,12 +590,16 @@ static int i915_driver_hw_probe(struct > drm_i915_private *dev_priv) >   >         ret = intel_gt_tiles_init(dev_priv); >         if (ret) > -               goto err_mem_regions; > +               goto err_ggtt; > + > +       ret = i915_ggtt_setup_scratch_page(dev_priv); > +       if (ret) > +               goto err_ggtt; >   >         ret = i915_ggtt_enable_hw(dev_priv); >         if (ret) { >                 drm_err(&dev_priv->drm, "failed to enable GGTT\n"); > -               goto err_mem_regions; > +               goto err_ggtt; >         } >   >         pci_set_master(pdev); > @@ -646,11 +651,10 @@ static int i915_driver_hw_probe(struct > drm_i915_private *dev_priv) >  err_msi: >         if (pdev->msi_enabled) >                 pci_disable_msi(pdev); > -err_mem_regions: > -       intel_memory_regions_driver_release(dev_priv); >  err_ggtt: >         i915_ggtt_driver_release(dev_priv); >         i915_gem_drain_freed_objects(dev_priv); > +       intel_memory_regions_driver_release(dev_priv); >         i915_ggtt_driver_late_release(dev_priv); >  err_perf: >         i915_perf_fini(dev_priv); > @@ -896,9 +900,9 @@ int i915_driver_probe(struct pci_dev *pdev, const > struct pci_device_id *ent) >         intel_modeset_driver_remove_nogem(i915); >  out_cleanup_hw: >         i915_driver_hw_remove(i915); > -       intel_memory_regions_driver_release(i915); >         i915_ggtt_driver_release(i915); >         i915_gem_drain_freed_objects(i915); > +       intel_memory_regions_driver_release(i915); >         i915_ggtt_driver_late_release(i915); >  out_cleanup_mmio: >         i915_driver_mmio_release(i915); > @@ -955,9 +959,9 @@ static void i915_driver_release(struct drm_device > *dev) >   >         i915_gem_driver_release(dev_priv); >   > -       intel_memory_regions_driver_release(dev_priv); >         i915_ggtt_driver_release(dev_priv); >         i915_gem_drain_freed_objects(dev_priv); > +       intel_memory_regions_driver_release(dev_priv); >         i915_ggtt_driver_late_release(dev_priv); >   >         i915_driver_mmio_release(dev_priv);