From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
Intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v3] drm/i915: Consolidate TLB invalidation flow
Date: Thu, 2 Feb 2023 08:33:50 +0000 [thread overview]
Message-ID: <117482b6-7baf-5b79-27ed-7c33630bd86d@linux.intel.com> (raw)
In-Reply-To: <f575e344-e915-c85f-49cd-28fa426bcfd6@intel.com>
On 02/02/2023 07:43, Andrzej Hajda wrote:
> On 01.02.2023 17:51, Tvrtko Ursulin wrote:
[snip]
>> +static int intel_engine_init_tlb_invalidation(struct intel_engine_cs
>> *engine)
>> +{
>> + static const union intel_engine_tlb_inv_reg gen8_regs[] = {
>> + [RENDER_CLASS].reg = GEN8_RTCR,
>> + [VIDEO_DECODE_CLASS].reg = GEN8_M1TCR, /* , GEN8_M2TCR */
>> + [VIDEO_ENHANCEMENT_CLASS].reg = GEN8_VTCR,
>> + [COPY_ENGINE_CLASS].reg = GEN8_BTCR,
>> + };
>> + static const union intel_engine_tlb_inv_reg gen12_regs[] = {
>> + [RENDER_CLASS].reg = GEN12_GFX_TLB_INV_CR,
>> + [VIDEO_DECODE_CLASS].reg = GEN12_VD_TLB_INV_CR,
>> + [VIDEO_ENHANCEMENT_CLASS].reg = GEN12_VE_TLB_INV_CR,
>> + [COPY_ENGINE_CLASS].reg = GEN12_BLT_TLB_INV_CR,
>> + [COMPUTE_CLASS].reg = GEN12_COMPCTX_TLB_INV_CR,
>> + };
>> + static const union intel_engine_tlb_inv_reg xehp_regs[] = {
>> + [RENDER_CLASS].mcr_reg = XEHP_GFX_TLB_INV_CR,
>> + [VIDEO_DECODE_CLASS].mcr_reg = XEHP_VD_TLB_INV_CR,
>> + [VIDEO_ENHANCEMENT_CLASS].mcr_reg = XEHP_VE_TLB_INV_CR,
>> + [COPY_ENGINE_CLASS].mcr_reg = XEHP_BLT_TLB_INV_CR,
>> + [COMPUTE_CLASS].mcr_reg = XEHP_COMPCTX_TLB_INV_CR,
>> + };
>> + struct drm_i915_private *i915 = engine->i915;
>> + const union intel_engine_tlb_inv_reg *regs;
>> + union intel_engine_tlb_inv_reg reg;
>> + unsigned int class = engine->class;
>> + unsigned int num = 0;
>> + u32 val;
>> +
>> + /*
>> + * New platforms should not be added with catch-all-newer (>=)
>> + * condition so that any later platform added triggers the below
>> warning
>> + * and in turn mandates a human cross-check of whether the
>> invalidation
>> + * flows have compatible semantics.
>> + *
>> + * For instance with the 11.00 -> 12.00 transition three out of five
>> + * respective engine registers were moved to masked type. Then
>> after the
>> + * 12.00 -> 12.50 transition multi cast handling is required too.
>> + */
>> +
>> + if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 50) ||
>> + GRAPHICS_VER_FULL(i915) == IP_VER(12, 55)) {
>> + regs = xehp_regs;
>> + num = ARRAY_SIZE(xehp_regs);
>> + } else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) ||
>> + GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) {
>> + regs = gen12_regs;
>> + num = ARRAY_SIZE(gen12_regs);
>> + } else if (GRAPHICS_VER(i915) >= 8 && GRAPHICS_VER(i915) <= 11) {
>> + regs = gen8_regs;
>> + num = ARRAY_SIZE(gen8_regs);
>> + } else if (GRAPHICS_VER(i915) < 8) {
>> + return 0;
>> + }
>> +
>> + if (gt_WARN_ONCE(engine->gt, !num,
>> + "Platform does not implement TLB invalidation!"))
>> + return -ENODEV;
>> +
>> + if (gt_WARN_ON_ONCE(engine->gt,
>> + class >= num ||
>> + (!regs[class].reg.reg &&
>> + !regs[class].mcr_reg.reg)))
>> + return -ERANGE;
>> +
>> + reg = regs[class];
>> +
>> + if (GRAPHICS_VER(i915) == 8 && class == VIDEO_DECODE_CLASS) {
>
> As selftest pointed out it should cover also gen 9-11.
> Btw maybe it is worth to convert this pseudo array indexing to direct
> assignment:
> if ((GRAPHICS_VER(i915) <= 11 && class == VIDEO_DECODE_CLASS &&
> engine->instance == 1) {
> reg.reg = GEN8_M2TCR;
> val = 0;
> }
Yes good call, v4 sent.
Btw - do you have any idea why the test is suppressed already?! CI told
me BAT was a success...
Regards,
Tvrtko
next prev parent reply other threads:[~2023-02-02 8:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 16:51 [Intel-gfx] [PATCH v3] drm/i915: Consolidate TLB invalidation flow Tvrtko Ursulin
2023-02-01 18:04 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2023-02-01 18:20 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-02-01 19:49 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-02-02 7:43 ` [Intel-gfx] [PATCH v3] " Andrzej Hajda
2023-02-02 8:33 ` Tvrtko Ursulin [this message]
2023-02-02 9:39 ` Andrzej Hajda
2023-02-15 8:14 ` Tvrtko Ursulin
2023-02-13 18:44 ` Matt Roper
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=117482b6-7baf-5b79-27ed-7c33630bd86d@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
/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