public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Michel Thierry <michel.thierry@intel.com>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: deepak.s@intel.com
Subject: Re: [PATCH] drm/i915: Consider HW CSB write pointer before resetting the sw read pointer
Date: Fri, 25 Sep 2015 18:33:35 +0100	[thread overview]
Message-ID: <5605856F.8020903@intel.com> (raw)
In-Reply-To: <87fv22a4gt.fsf@gaia.fi.intel.com>

On 9/25/2015 4:44 PM, Mika Kuoppala wrote:
> Michel Thierry <michel.thierry@intel.com> writes:
>> -	ring->next_context_status_buffer = 0;
>> +
>> +	/*
>> +	 * Instead of resetting the Context Status Buffer (CSB) read pointer to
>> +	 * zero, we need to read the write pointer from hardware and use its
>> +	 * value because "this register is power context save restored".
>> +	 * Effectively, these states have been observed:
>> +	 *
>> +	 *      | Suspend-to-idle (freeze) | Suspend-to-RAM (mem) |
>> +	 * BDW  | CSB regs not reset       | CSB regs reset       |
>> +	 * CHT  | CSB regs not reset       | CSB regs not reset   |
>> +	 */
>> +	next_context_status_buffer_hw = I915_READ(RING_CONTEXT_STATUS_PTR(ring)) & 0x07;
>> +
>> +	/*
>> +	 * When the CSB registers are reset (also after power-up / gpu reset),
>> +	 * CSB write pointer is set to all 1's, which is not valid, use 0 in
>> +	 * this special case.
>> +	 */
>> +	if (next_context_status_buffer_hw == 0x7)
>> +		next_context_status_buffer_hw = 0;
>
>
> If hardware has been reset and we have b111 here, I assume
> the first write will be at index zero.
>
> If we look at the interrupt code there is while (read_pointer <
> write_pointer). Initializing next status buffer to zero
> would mean that you miss the first write to csb[0].
>
> If b111 is found, I think the correct value is 5.

Correct, it needs to be set to 5. Luckily, csb[0] would always be 
Idle-to-Active, which we ignore.

>
> -Mika
>
>

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

  reply	other threads:[~2015-09-25 17:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 14:43 [PATCH] drm/i915: Consider HW CSB write pointer before resetting the sw read pointer Michel Thierry
2015-09-25 15:44 ` Mika Kuoppala
2015-09-25 17:33   ` Michel Thierry [this message]
2015-09-28 12:25 ` [PATCH v2] " Michel Thierry
2015-09-28 13:17 ` [PATCH v3] " Michel Thierry
2015-09-28 14:00   ` Mika Kuoppala
2015-09-28 14:12     ` Daniel Vetter
2015-09-28 14:30       ` Jani Nikula
2015-09-28 13:49 ` [PATCH v2] " Michel Thierry

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=5605856F.8020903@intel.com \
    --to=michel.thierry@intel.com \
    --cc=deepak.s@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.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