From: Dave Gordon <david.s.gordon@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 11/15] drm/i915: Interrupt routing for GuC submission
Date: Mon, 06 Jul 2015 17:07:31 +0100 [thread overview]
Message-ID: <559AA7C3.8040409@intel.com> (raw)
In-Reply-To: <20150706141404.GH2156@phenom.ffwll.local>
On 06/07/15 15:14, Daniel Vetter wrote:
> On Fri, Jul 03, 2015 at 01:30:33PM +0100, Dave Gordon wrote:
>> Turn on interrupt steering to route necessary interrupts to GuC.
>>
>> Issue: VIZ-4884
>> Signed-off-by: Alex Dai <yu.dai@intel.com>
>> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
>> ---
>> drivers/gpu/drm/i915/i915_reg.h | 11 +++++--
>> drivers/gpu/drm/i915/intel_guc_loader.c | 51 +++++++++++++++++++++++++++++++++
>> 2 files changed, 60 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
>> index eefb847..9f32c6c 100644
>> --- a/drivers/gpu/drm/i915/i915_reg.h
>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>> @@ -1659,12 +1659,18 @@ enum skl_disp_power_wells {
>> #define GFX_MODE_GEN7 0x0229c
>> #define RING_MODE_GEN7(ring) ((ring)->mmio_base+0x29c)
>> #define GFX_RUN_LIST_ENABLE (1<<15)
>> +#define GFX_INTERRUPT_STEERING (1<<14)
>> #define GFX_TLB_INVALIDATE_EXPLICIT (1<<13)
>> #define GFX_SURFACE_FAULT_ENABLE (1<<12)
>> #define GFX_REPLAY_MODE (1<<11)
>> #define GFX_PSMI_GRANULARITY (1<<10)
>> #define GFX_PPGTT_ENABLE (1<<9)
>>
>> +#define GFX_FORWARD_VBLANK_MASK (3<<5)
>> +#define GFX_FORWARD_VBLANK_NEVER (0<<5)
>> +#define GFX_FORWARD_VBLANK_ALWAYS (1<<5)
>> +#define GFX_FORWARD_VBLANK_COND (2<<5)
>> +
>> #define VLV_DISPLAY_BASE 0x180000
>> #define VLV_MIPI_BASE VLV_DISPLAY_BASE
>>
>> @@ -5677,11 +5683,12 @@ enum skl_disp_power_wells {
>> #define GEN8_GT_IIR(which) (0x44308 + (0x10 * (which)))
>> #define GEN8_GT_IER(which) (0x4430c + (0x10 * (which)))
>>
>> -#define GEN8_BCS_IRQ_SHIFT 16
>> #define GEN8_RCS_IRQ_SHIFT 0
>> -#define GEN8_VCS2_IRQ_SHIFT 16
>> +#define GEN8_BCS_IRQ_SHIFT 16
>> #define GEN8_VCS1_IRQ_SHIFT 0
>> +#define GEN8_VCS2_IRQ_SHIFT 16
>> #define GEN8_VECS_IRQ_SHIFT 0
>> +#define GEN8_WD_IRQ_SHIFT 16
>>
>> #define GEN8_DE_PIPE_ISR(pipe) (0x44400 + (0x10 * (pipe)))
>> #define GEN8_DE_PIPE_IMR(pipe) (0x44404 + (0x10 * (pipe)))
>> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
>> index eb76c34..ef5f3d5 100644
>> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
>> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
>> @@ -62,6 +62,53 @@
>> #define I915_SKL_GUC_UCODE "i915/skl_guc_ver3.bin"
>> MODULE_FIRMWARE(I915_SKL_GUC_UCODE);
>>
>> +static void direct_interrupts_to_host(struct drm_i915_private *dev_priv)
>> +{
>> + struct intel_engine_cs *ring;
>> + int i, irqs;
>> +
>> + /* tell all command streamers NOT to forward interrupts and vblank to GuC */
>> + irqs = _MASKED_FIELD(GFX_FORWARD_VBLANK_MASK, GFX_FORWARD_VBLANK_NEVER);
>> + irqs |= _MASKED_BIT_DISABLE(GFX_INTERRUPT_STEERING);
>> + for_each_ring(ring, dev_priv, i)
>> + I915_WRITE(RING_MODE_GEN7(ring), irqs);
>> +
>> + /* tell DE to send nothing to GuC */
>> + I915_WRITE(DE_GUCRMR, ~0);
>> +
>> + /* route all GT interrupts to the host */
>> + I915_WRITE(GUC_BCS_RCS_IER, 0);
>> + I915_WRITE(GUC_VCS2_VCS1_IER, 0);
>> + I915_WRITE(GUC_WD_VECS_IER, 0);
>> +}
>> +
>> +static void direct_interrupts_to_guc(struct drm_i915_private *dev_priv)
>> +{
>> + struct intel_engine_cs *ring;
>> + int i, irqs;
>> +
>> + /* tell all command streamers to forward interrupts and vblank to GuC */
>> + irqs = _MASKED_FIELD(GFX_FORWARD_VBLANK_MASK, GFX_FORWARD_VBLANK_ALWAYS);
>> + irqs |= _MASKED_BIT_ENABLE(GFX_INTERRUPT_STEERING);
>> + for_each_ring(ring, dev_priv, i)
>> + I915_WRITE(RING_MODE_GEN7(ring), irqs);
>> +
>> + /* tell DE to send (all) flip_done to GuC */
>> + irqs = DERRMR_PIPEA_PRI_FLIP_DONE | DERRMR_PIPEA_SPR_FLIP_DONE |
>> + DERRMR_PIPEB_PRI_FLIP_DONE | DERRMR_PIPEB_SPR_FLIP_DONE |
>> + DERRMR_PIPEC_PRI_FLIP_DONE | DERRMR_PIPEC_SPR_FLIP_DONE;
>> + /* Unmasked bits will cause GuC response message to be sent */
>> + I915_WRITE(DE_GUCRMR, ~irqs);
>> +
>> + /* route USER_INTERRUPT to Host, all others are sent to GuC. */
>> + irqs = GT_RENDER_USER_INTERRUPT << GEN8_RCS_IRQ_SHIFT |
>> + GT_RENDER_USER_INTERRUPT << GEN8_BCS_IRQ_SHIFT;
>> + /* These three registers have the same bit definitions */
>> + I915_WRITE(GUC_BCS_RCS_IER, ~irqs);
>> + I915_WRITE(GUC_VCS2_VCS1_IER, ~irqs);
>> + I915_WRITE(GUC_WD_VECS_IER, ~irqs);
>> +}
>> +
>> static u32 get_gttype(struct drm_i915_private *dev_priv)
>> {
>> /* XXX: GT type based on PCI device ID? field seems unused by fw */
>> @@ -417,6 +464,7 @@ int intel_guc_ucode_load(struct drm_device *dev)
>> intel_uc_fw_status_repr(guc_fw->uc_fw_fetch_status),
>> intel_uc_fw_status_repr(guc_fw->uc_fw_load_status));
>>
>> + direct_interrupts_to_host(dev_priv);
>> i915_guc_submission_disable(dev);
>>
>> if (guc_fw->uc_fw_fetch_status == INTEL_UC_FIRMWARE_NONE)
>> @@ -450,6 +498,7 @@ int intel_guc_ucode_load(struct drm_device *dev)
>> err = i915_guc_submission_enable(dev);
>> if (err)
>> goto fail;
>> + direct_interrupts_to_guc(dev_priv);
>
> This looks like still some remnants from when guc loading could fail and
> we needed to switch between cpu and guc submission at runtime. Problem is
> that you don't own the interrupt state at this point (since interrupts are
> already enabled) and hence there could be problems with races.
>
> Simplest solution would be to just set up the interrupt routing we want
> statically at driver load time in the respective irq callbacks (looking at
> guc-or-not-guc module option). That means we bake the guc submission y/n
> decision into the driver load sequence very early, but it does simplify
> things. And that's one of the reasons I don't like runtime fallbacks.
> -Daniel
We can't send interrupts to the GuC before its firmware is ready for
them, hence we /can't/ set it up statically. We /must/ start with all
interrupts directed to the host, and switch them to the GuC only once
the firmware is loaded and running. (I suppose it would be simpler if
the GuC firmware *took* control of the interrupts when it started,
rather than having i915 *give* the interrupts to the GuC, but that would
leave even more opportunities for confusion).
This isn't really "runtime", this *is* still in the driver load stage,
although rather later than irq setup.
For the important interrupts that we're switching to the GuC (i.e.
context switch) we DO know that there aren't any in flight already,
because we can't submit anything that would result in a context switch
until the GuC is up & running. For others (e.g. VBLANK, FLIP_DONE) it
doesn't matter; the GuC doesn't initiate these classes of interrupts
anyway, and it doesn't keep track of specific occurences or try to pair
up actions and resulting events. AFAIK, it's just listening in to those
interrupts to see what's going on, presumably for power-management purposes.
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-07-06 16:07 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-03 12:30 [PATCH 00/15 v3] Batch submission via GuC Dave Gordon
2015-07-03 12:30 ` [PATCH 01/15] drm/i915: Add i915_gem_object_create_from_data() Dave Gordon
2015-07-03 12:30 ` [PATCH 02/15] drm/i915: Embedded microcontroller (uC) firmware loading support Dave Gordon
2015-07-06 14:06 ` Daniel Vetter
2015-07-06 18:24 ` Dave Gordon
2015-07-06 19:17 ` Daniel Vetter
2015-07-03 12:30 ` [PATCH 03/15] drm/i915: Add GuC-related module parameters Dave Gordon
2015-07-06 14:08 ` Daniel Vetter
2015-07-03 12:30 ` [PATCH 04/15] drm/i915: Add GuC-related header files Dave Gordon
2015-07-03 12:30 ` [PATCH 05/15] drm/i915: GuC-specific firmware loader Dave Gordon
2015-07-06 14:28 ` Daniel Vetter
2015-07-06 16:37 ` Dave Gordon
2015-07-06 18:12 ` Daniel Vetter
2015-07-03 12:30 ` [PATCH 06/15] drm/i915: Debugfs interface to read GuC load status Dave Gordon
2015-07-03 12:30 ` [PATCH 07/15] drm/i915: Expose two LRC functions for GuC submission mode Dave Gordon
2015-07-03 12:30 ` [PATCH 08/15] drm/i915: GuC submission setup, phase 1 Dave Gordon
2015-07-03 12:30 ` [PATCH 09/15] drm/i915: Enable GuC firmware log Dave Gordon
2015-07-03 12:30 ` [PATCH 10/15] drm/i915: Implementation of GuC client Dave Gordon
2015-07-06 14:10 ` Daniel Vetter
2015-07-03 12:30 ` [PATCH 11/15] drm/i915: Interrupt routing for GuC submission Dave Gordon
2015-07-06 14:14 ` Daniel Vetter
2015-07-06 16:07 ` Dave Gordon [this message]
2015-07-06 18:21 ` Daniel Vetter
2015-07-07 0:00 ` Yu Dai
2015-07-07 9:06 ` Daniel Vetter
2015-07-07 16:19 ` Yu Dai
2015-07-03 12:30 ` [PATCH 12/15] drm/i915: Integrate GuC-based command submission Dave Gordon
2015-07-03 12:30 ` [PATCH 13/15] drm/i915: Debugfs interface for GuC submission statistics Dave Gordon
2015-07-03 12:30 ` [PATCH 14/15] Documentation/drm: kerneldoc for GuC Dave Gordon
2015-07-06 14:16 ` Daniel Vetter
2015-07-03 12:30 ` [PATCH 15/15] drm/i915: Enable GuC submission, where supported Dave Gordon
2015-07-06 14:29 ` [PATCH 00/15 v3] Batch submission via GuC Daniel Vetter
2015-07-07 19:03 ` O'Rourke, Tom
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=559AA7C3.8040409@intel.com \
--to=david.s.gordon@intel.com \
--cc=daniel@ffwll.ch \
--cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.