intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Praveen Paneri <praveen.paneri@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	intel-gfx@lists.freedesktop.org, Zhe Wang <zhe1.wang@intel.com>,
	rodrigo.vivi@intel.com
Subject: Re: [PATCH v3] drm/i915/bxt: Broxton decoupled MMIO
Date: Wed, 5 Oct 2016 08:47:24 +0530	[thread overview]
Message-ID: <57F470C4.4020604@intel.com> (raw)
In-Reply-To: <20161004195644.GA28117@nuc-i3427.alporthouse.com>

Thanks Chris for the review. Will fix these and resend.

~Praveen

On Wednesday 05 October 2016 01:26 AM, Chris Wilson wrote:
> On Tue, Oct 04, 2016 at 09:16:06PM +0530, Praveen Paneri wrote:
>> +#define HAS_DECOUPLED_MMIO(dev) (INTEL_INFO(dev)->has_decoupled_mmio \
>> +		&& IS_BXT_REVID(dev, BXT_REVID_C0, REVID_FOREVER))
>
> Edit dev_priv->info.has_decoupled_mmio on init.
>
>> +static void __gen9_decoupled_mmio_access(struct drm_i915_private *dev_priv,
>> +					 u32 reg,
>> +					 enum forcewake_domains fw_engine,
>> +					 enum decoupled_ops operation)
>> +{
>> +	enum decoupled_power_domains dpd_engine;
>> +	u32 ctrl_reg_data = 0;
>> +
>> +	dpd_engine = fw2dpd_engine[fw_engine - 1];
>
> 	enum decoupled_power_domains dpd = fw2dpd_engine[fw_engine - 1];
>
> enum decoupled_power_domain
>
> And don't call it fw_engine. fw_domain, if you must.
>
>> +
>> +	ctrl_reg_data |= reg;
>> +	ctrl_reg_data |= (operation << GEN9_DECOUPLED_OP_SHIFT);
>> +	ctrl_reg_data |= (dpd_engine << GEN9_DECOUPLED_PD_SHIFT);
>> +	__raw_i915_write32(dev_priv, GEN9_DECOUPLED_REG0_DW1, ctrl_reg_data);
>> +
>> +	ctrl_reg_data |= GEN9_DECOUPLED_DW1_GO;
>> +	__raw_i915_write32(dev_priv, GEN9_DECOUPLED_REG0_DW1, ctrl_reg_data);
>> +
>> +	if (wait_for_atomic((__raw_i915_read32(dev_priv,
>> +			GEN9_DECOUPLED_REG0_DW1) & GEN9_DECOUPLED_DW1_GO) == 0,
>> +			FORCEWAKE_ACK_TIMEOUT_MS))
>> +		DRM_ERROR("Decoupled MMIO wait timed out\n");
>> +}
>> +
>> +static inline u32 __gen9_decoupled_mmio_read(struct drm_i915_private *dev_priv,
>> +                                      u32 reg,
>> +                                      enum forcewake_domains fw)
>
> __gen9_decoupeld_mmio_read32()
>
>> +{
>> +	__gen9_decoupled_mmio_access(dev_priv,
>> +			reg,
>> +			fw_engine,
>> +			GEN9_DECOUPLED_OP_READ);
>
> 	__gen9_decoupled_mmio_access(dev_priv, reg, fw, GEN9_DECOUPLED_OP_READ);
>
>> +
>> +	return __raw_i915_read32(dev_priv,
>> +			GEN9_DECOUPLED_REG0_DW0);
>
> Everywhere! Please be careful with alignment.
>
>> +#define __gen9_decoupled_read(x) \
>> +static u##x \
>> +gen9_decoupled_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
>> +	enum forcewake_domains fw_engine; \
>> +	GEN6_READ_HEADER(x); \
>> +	fw_engine = __fwtable_reg_read_fw_domains(offset); \
>> +	if (!fw_engine || !(fw_engine & ~dev_priv->uncore.fw_domains_active)) { \
>> +		val = __raw_i915_read##x(dev_priv, reg); \
>> +	} else { \
>> +		unsigned i; \
>> +		u32 *ptr_data = (u32 *) &val; \
>> +		for (i = 0; i < x/32; i++, offset += sizeof(u32), ptr_data++) \
>> +			*ptr_data = __gen9_decoupled_mmio_read(dev_priv, \
>> +						     offset, \
>> +						     fw_engine); \
>> +	} \
>> +	GEN6_READ_FOOTER; \
>> +}
>
> Reverse it,
>
> 	if (domain & ~dev_priv->uncore.fw_domains_active) {
> 		u32 *ptr = (u32 *)&val;
> 		unsigned i;
>
> 		for (i = 0; i < x/32; i++, offset += sizeof(u32), ptr++)
> 			*ptr = __gen9_decoupled_mmio_read32(dev_priv, offset, domain);
> 	} else {
> 		val = __raw_i915_read##x(dev_priv, reg);
> 	}
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-10-05  3:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06  5:24 [PATCH] drm/i915/bxt: Broxton decoupled MMIO Praveen Paneri
2016-09-06  5:51 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-09-06  6:36 ` [PATCH] " Chris Wilson
2016-09-19 17:05   ` Praveen Paneri
2016-09-19 17:15     ` [PATCH v2] " Praveen Paneri
2016-09-23  9:49       ` Tvrtko Ursulin
2016-09-26 11:08         ` Paneri, Praveen
2016-09-26 20:23           ` Tvrtko Ursulin
2016-10-04 15:46             ` [PATCH v3] " Praveen Paneri
2016-10-04 17:43               ` Vivi, Rodrigo
2016-10-04 19:56               ` Chris Wilson
2016-10-05  3:17                 ` Praveen Paneri [this message]
2016-10-05  6:24                 ` Praveen Paneri
2016-11-15  6:40                 ` [PATCH v4] " Praveen Paneri
2016-11-15  9:36                   ` Tvrtko Ursulin
2016-11-15 10:07                     ` Chris Wilson
2016-11-15 13:17                       ` Praveen Paneri
2016-11-15 14:44                         ` Tvrtko Ursulin
2016-11-15 17:19                           ` [PATCH v5] " Praveen Paneri
2016-11-16  8:25                             ` Tvrtko Ursulin
2016-11-16  9:03                               ` Praveen Paneri
2016-11-16  9:08                                 ` Tvrtko Ursulin
2016-11-16  9:18                                   ` Chris Wilson
2016-11-15 10:56                     ` [PATCH v4] " Praveen Paneri
2016-11-15 10:59                       ` Tvrtko Ursulin
2016-10-05 13:50               ` [PATCH v3] " Tvrtko Ursulin
2016-10-10 17:03             ` [PATCH v2] " Carlos Santa
2016-09-19 17:55 ` ✗ Fi.CI.BAT: warning for drm/i915/bxt: Broxton decoupled MMIO (rev2) Patchwork
2016-10-04 16:19 ` ✗ Fi.CI.BAT: warning for drm/i915/bxt: Broxton decoupled MMIO (rev3) Patchwork
2016-11-15  7:16 ` ✓ Fi.CI.BAT: success for drm/i915/bxt: Broxton decoupled MMIO (rev4) Patchwork
2016-11-15 18:15 ` ✓ Fi.CI.BAT: success for drm/i915/bxt: Broxton decoupled MMIO (rev5) Patchwork
2016-11-16  9:38   ` Tvrtko Ursulin

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=57F470C4.4020604@intel.com \
    --to=praveen.paneri@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=zhe1.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;
as well as URLs for NNTP newsgroup(s).