From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: fei.yang@intel.com, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris.p.wilson@linux.intel.com>,
Matt Roper <matthew.d.roper@intel.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v5 2/5] drm/i915: use pat_index instead of cache_level
Date: Thu, 4 May 2023 13:51:20 +0100 [thread overview]
Message-ID: <4c464bd6-9edc-3098-5c24-6d6da2a75c39@linux.intel.com> (raw)
In-Reply-To: <20230503230211.2834340-3-fei.yang@intel.com>
On 04/05/2023 00:02, fei.yang@intel.com wrote:
> From: Fei Yang <fei.yang@intel.com>
>
> Currently the KMD is using enum i915_cache_level to set caching policy for
> buffer objects. This is flaky because the PAT index which really controls
> the caching behavior in PTE has far more levels than what's defined in the
> enum. In addition, the PAT index is platform dependent, having to translate
> between i915_cache_level and PAT index is not reliable, and makes the code
> more complicated.
>
>>From UMD's perspective there is also a necessity to set caching policy for
> performance fine tuning. It's much easier for the UMD to directly use PAT
> index because the behavior of each PAT index is clearly defined in Bspec.
> Having the abstracted i915_cache_level sitting in between would only cause
> more ambiguity.
>
> For these reasons this patch replaces i915_cache_level with PAT index. Also
> note, the cache_level is not completely removed yet, because the KMD still
> has the need of creating buffer objects with simple cache settings such as
> cached, uncached, or writethrough. For such simple cases, using cache_level
> would help simplify the code.
>
> Cc: Chris Wilson <chris.p.wilson@linux.intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Fei Yang <fei.yang@intel.com>
> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
[snip]
> diff --git a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
> index bb6998d67133..f2334a713c4e 100644
> --- a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
> +++ b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
> @@ -56,7 +56,7 @@ static u64 gen8_pte_encode(dma_addr_t addr,
> }
^^^
How come there are no changes to gen8_pte_encode?
vvv
>
> static u64 mtl_pte_encode(dma_addr_t addr,
> - enum i915_cache_level level,
> + unsigned int pat_index,
> u32 flags)
Prototype and implementation changed here for mtl_pte_encode.
And we have:
if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 70))
ppgtt->vm.pte_encode = mtl_pte_encode;
else
ppgtt->vm.pte_encode = gen8_pte_encode;
So should be same prototype. And:
u64 (*pte_encode)(dma_addr_t addr,
- enum i915_cache_level level,
+ unsigned int pat_index,
u32 flags); /* Create a valid PTE */
Patch relies on the compiler considering enum equal to unsigned int?
But the implementation of gen8_pte_encode and most ggtt counterparts is
looking at the passed in pat index and thinks it is cache level.
How is that supposed to work?! Or I am blind and am missing something?
Regards,
Tvrtko
next prev parent reply other threads:[~2023-05-04 12:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 23:02 [Intel-gfx] [PATCH v5 0/5] drm/i915: Allow user to set cache at BO creation fei.yang
2023-05-03 23:02 ` [Intel-gfx] [PATCH v5 1/5] drm/i915: preparation for using PAT index fei.yang
2023-05-03 23:02 ` [Intel-gfx] [PATCH v5 2/5] drm/i915: use pat_index instead of cache_level fei.yang
2023-05-04 12:51 ` Tvrtko Ursulin [this message]
2023-05-04 16:06 ` Yang, Fei
2023-05-05 9:50 ` Tvrtko Ursulin
2023-05-06 8:03 ` Yang, Fei
2023-05-03 23:02 ` [Intel-gfx] [PATCH v5 3/5] drm/i915: make sure correct pte encode is used fei.yang
2023-05-03 23:02 ` [Intel-gfx] [PATCH v5 4/5] drm/i915/mtl: end support for set caching ioctl fei.yang
2023-05-03 23:02 ` [Intel-gfx] [PATCH v5 5/5] drm/i915: Allow user to set cache at BO creation fei.yang
2023-05-03 23:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Allow user to set cache at BO creation (rev5) Patchwork
2023-05-03 23:46 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-05-03 23:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-05-04 2:05 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c464bd6-9edc-3098-5c24-6d6da2a75c39@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris.p.wilson@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=fei.yang@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox