public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dave Gordon <david.s.gordon@intel.com>
To: "Wang, Zhi A" <zhi.a.wang@intel.com>,
	"Daniel, Thomas" <thomas.daniel@intel.com>
Cc: "Intel-gfx@lists.freedesktop.org" <Intel-gfx@lists.freedesktop.org>
Subject: Re: About CTX_CONTEXT_CONTROL initialization in populate_lr_context() intel_lrc.c
Date: Tue, 10 Feb 2015 16:25:20 +0000	[thread overview]
Message-ID: <54DA30F0.1040707@intel.com> (raw)
In-Reply-To: <F3B0350DF4CB6849A642218320DE483D0E920043@SHSMSX101.ccr.corp.intel.com>

On 09/02/15 15:05, Wang, Zhi A wrote:
> Hi Gurus:
> Forgive my junior HW knowledge, I just found that in execlist
> context initialization function populate_lr_context(), this line:
>   
>           reg_state[CTX_CONTEXT_CONTROL+1] =
>                           _MASKED_BIT_ENABLE((1<<3) | MI_RESTORE_INHIBIT);
>   
> It seems the "Inhibit Synchronous Context Switch" bit is not set
> here, so when HW is trying to wait some events, e.g. semaphore, according to
> Bspec, per my basic understanding, it will switch out current context
> with some reason bit set. Here comes my question, I think if this
> situation happen, should i915 remember this context and try to
> re-schedule it in a proper time, e.g. before submitting a new context
> until the context_completed bit in CSB is set? I don't find a register
> that will remember the context switched out by waiting event, so I think
> it should be i915 to handle this situation or just set "Inhibit
> Synchronous Context Switch" bit here?...

But that's exactly what it does already ... it sets bit 3, which is the
"Inhibit Synchronous Context Switch" bit you refer to.

What's wrong here is that it should use a #define for this bit, and for
the "Restore Inhibit" bit -- for which it's actually using a value
defined in a completely different context (no pun intended), namely the
bits in a MI_SET_CONTEXT *instruction*. It just happens to work because
they have the same numerical value. So, what we need is:

<intel_lrc.h>

#define RING_CONTEXT_CONTROL(ring)   	   ((ring)->mmio_base+0x244)
#define	  CTX_CTRL_INHIBIT_SYN_CTX_SWITCH	(1 << 3)
#define	  CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT	(1 << 0)

and then change the line you pointed out to use the correct symbolic names.

.Dave.

> Thanks,
> Zhi.
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-02-10 16:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 15:05 About CTX_CONTEXT_CONTROL initialization in populate_lr_context() intel_lrc.c Wang, Zhi A
2015-02-10 13:27 ` Wang, Zhi A
2015-02-10 14:17   ` Daniel, Thomas
2015-02-10 14:43     ` Wang, Zhi A
2015-02-10 14:55       ` Daniel, Thomas
2015-02-10 14:57         ` Wang, Zhi A
2015-02-10 16:25 ` Dave Gordon [this message]
2015-02-10 22:18   ` Daniel Vetter
2015-02-11  0:18     ` Wang, Zhi A
2015-02-11  0:19     ` Wang, Zhi A

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=54DA30F0.1040707@intel.com \
    --to=david.s.gordon@intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=thomas.daniel@intel.com \
    --cc=zhi.a.wang@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