public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/6] drm/i915: kill uncore_to_i915
Date: Tue, 18 Jun 2019 09:34:26 +0100	[thread overview]
Message-ID: <236a6f51-ecf9-6dc5-fb43-a72e7beb7729@linux.intel.com> (raw)
In-Reply-To: <20190617180935.505-4-daniele.ceraolospurio@intel.com>


On 17/06/2019 19:09, Daniele Ceraolo Spurio wrote:
> Let's get rid of it before it proliferates, since with split GT/Display
> uncores the container_of won't work anymore.
> 
> I've kept the rpm pointer as well to minimize the pointer chasing in the
> MMIO accessors.
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_drv.c     |  2 +-
>   drivers/gpu/drm/i915/i915_drv.h     |  5 -----
>   drivers/gpu/drm/i915/intel_uncore.c | 24 ++++++++++++------------
>   drivers/gpu/drm/i915/intel_uncore.h |  4 +++-
>   4 files changed, 16 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 6cf8f1838cec..d113296cbe34 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -894,7 +894,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv)
>   
>   	intel_device_info_subplatform_init(dev_priv);
>   
> -	intel_uncore_init_early(&dev_priv->uncore);
> +	intel_uncore_init_early(dev_priv, &dev_priv->uncore);

Would swapped parameter order make more sense?

intel_uncore_init_early -> "I am operating on uncore" -> pass in uncore 
first, and dev_priv as additional information second. I think that would 
be better. With that:

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

>   
>   	spin_lock_init(&dev_priv->irq_lock);
>   	spin_lock_init(&dev_priv->gpu_error.lock);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 7a9c2392cc7c..3b42588b7194 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1949,11 +1949,6 @@ static inline struct drm_i915_private *huc_to_i915(struct intel_huc *huc)
>   	return container_of(huc, struct drm_i915_private, huc);
>   }
>   
> -static inline struct drm_i915_private *uncore_to_i915(struct intel_uncore *uncore)
> -{
> -	return container_of(uncore, struct drm_i915_private, uncore);
> -}
> -
>   /* Simple iterator over all initialised engines */
>   #define for_each_engine(engine__, dev_priv__, id__) \
>   	for ((id__) = 0; \
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 63bdadacadcc..88a69bf713c9 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -322,7 +322,7 @@ static void __gen6_gt_wait_for_fifo(struct intel_uncore *uncore)
>   
>   	/* On VLV, FIFO will be shared by both SW and HW.
>   	 * So, we need to read the FREE_ENTRIES everytime */
> -	if (IS_VALLEYVIEW(uncore_to_i915(uncore)))
> +	if (IS_VALLEYVIEW(uncore->i915))
>   		n = fifo_free_entries(uncore);
>   	else
>   		n = uncore->fifo_count;
> @@ -493,7 +493,7 @@ static void __intel_uncore_early_sanitize(struct intel_uncore *uncore,
>   		DRM_DEBUG("unclaimed mmio detected on uncore init, clearing\n");
>   
>   	/* WaDisableShadowRegForCpd:chv */
> -	if (IS_CHERRYVIEW(uncore_to_i915(uncore))) {
> +	if (IS_CHERRYVIEW(uncore->i915)) {
>   		__raw_uncore_write32(uncore, GTFIFOCTL,
>   				     __raw_uncore_read32(uncore, GTFIFOCTL) |
>   				     GT_FIFO_CTL_BLOCK_ALL_POLICY_STALL |
> @@ -622,7 +622,7 @@ void intel_uncore_forcewake_user_put(struct intel_uncore *uncore)
>   	spin_lock_irq(&uncore->lock);
>   	if (!--uncore->user_forcewake.count) {
>   		if (intel_uncore_unclaimed_mmio(uncore))
> -			dev_info(uncore_to_i915(uncore)->drm.dev,
> +			dev_info(uncore->i915->drm.dev,
>   				 "Invalid mmio detected during user access\n");
>   
>   		uncore->unclaimed_mmio_check =
> @@ -1346,7 +1346,7 @@ static void fw_domain_fini(struct intel_uncore *uncore,
>   
>   static void intel_uncore_fw_domains_init(struct intel_uncore *uncore)
>   {
> -	struct drm_i915_private *i915 = uncore_to_i915(uncore);
> +	struct drm_i915_private *i915 = uncore->i915;
>   
>   	if (!intel_uncore_has_forcewake(uncore))
>   		return;
> @@ -1499,7 +1499,7 @@ static int i915_pmic_bus_access_notifier(struct notifier_block *nb,
>   
>   static int uncore_mmio_setup(struct intel_uncore *uncore)
>   {
> -	struct drm_i915_private *i915 = uncore_to_i915(uncore);
> +	struct drm_i915_private *i915 = uncore->i915;
>   	struct pci_dev *pdev = i915->drm.pdev;
>   	int mmio_bar;
>   	int mmio_size;
> @@ -1529,20 +1529,22 @@ static int uncore_mmio_setup(struct intel_uncore *uncore)
>   
>   static void uncore_mmio_cleanup(struct intel_uncore *uncore)
>   {
> -	struct drm_i915_private *i915 = uncore_to_i915(uncore);
> -	struct pci_dev *pdev = i915->drm.pdev;
> +	struct pci_dev *pdev = uncore->i915->drm.pdev;
>   
>   	pci_iounmap(pdev, uncore->regs);
>   }
>   
> -void intel_uncore_init_early(struct intel_uncore *uncore)
> +void intel_uncore_init_early(struct drm_i915_private *i915,
> +			     struct intel_uncore *uncore)
>   {
>   	spin_lock_init(&uncore->lock);
> +	uncore->i915 = i915;
> +	uncore->rpm = &i915->runtime_pm;
>   }
>   
>   int intel_uncore_init_mmio(struct intel_uncore *uncore)
>   {
> -	struct drm_i915_private *i915 = uncore_to_i915(uncore);
> +	struct drm_i915_private *i915 = uncore->i915;
>   	int ret;
>   
>   	ret = uncore_mmio_setup(uncore);
> @@ -1561,8 +1563,6 @@ int intel_uncore_init_mmio(struct intel_uncore *uncore)
>   	uncore->pmic_bus_access_nb.notifier_call =
>   		i915_pmic_bus_access_notifier;
>   
> -	uncore->rpm = &i915->runtime_pm;
> -
>   	if (!intel_uncore_has_forcewake(uncore)) {
>   		if (IS_GEN(i915, 5)) {
>   			ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, gen5);
> @@ -1627,7 +1627,7 @@ int intel_uncore_init_mmio(struct intel_uncore *uncore)
>    */
>   void intel_uncore_prune_mmio_domains(struct intel_uncore *uncore)
>   {
> -	struct drm_i915_private *i915 = uncore_to_i915(uncore);
> +	struct drm_i915_private *i915 = uncore->i915;
>   
>   	if (INTEL_GEN(i915) >= 11) {
>   		enum forcewake_domains fw_domains = uncore->fw_domains;
> diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
> index 94c00d3778b1..912616188ff5 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.h
> +++ b/drivers/gpu/drm/i915/intel_uncore.h
> @@ -102,6 +102,7 @@ struct intel_forcewake_range {
>   struct intel_uncore {
>   	void __iomem *regs;
>   
> +	struct drm_i915_private *i915;
>   	struct intel_runtime_pm *rpm;
>   
>   	spinlock_t lock; /** lock is also taken in irq contexts. */
> @@ -182,7 +183,8 @@ intel_uncore_has_fifo(const struct intel_uncore *uncore)
>   	return uncore->flags & UNCORE_HAS_FIFO;
>   }
>   
> -void intel_uncore_init_early(struct intel_uncore *uncore);
> +void intel_uncore_init_early(struct drm_i915_private *i915,
> +			     struct intel_uncore *uncore);
>   int intel_uncore_init_mmio(struct intel_uncore *uncore);
>   void intel_uncore_prune_mmio_domains(struct intel_uncore *uncore);
>   bool intel_uncore_unclaimed_mmio(struct intel_uncore *uncore);
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-06-18  8:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 18:09 [PATCH 0/6] Display uncore prep patches Daniele Ceraolo Spurio
2019-06-17 18:09 ` [PATCH 1/6] drm/i915: use vfuncs for reg_read/write_fw_domains Daniele Ceraolo Spurio
2019-06-18  8:31   ` Tvrtko Ursulin
2019-06-17 18:09 ` [PATCH 2/6] drm/i915: kill uncore_sanitize Daniele Ceraolo Spurio
2019-06-17 18:09 ` [PATCH 3/6] drm/i915: kill uncore_to_i915 Daniele Ceraolo Spurio
2019-06-18  8:34   ` Tvrtko Ursulin [this message]
2019-06-17 18:09 ` [PATCH 4/6] drm/i915: skip forcewake actions on forcewake-less uncore Daniele Ceraolo Spurio
2019-06-18  9:00   ` Tvrtko Ursulin
2019-06-18 21:12     ` Daniele Ceraolo Spurio
2019-06-19 22:05       ` Daniele Ceraolo Spurio
2019-06-18 10:22   ` Chris Wilson
2019-06-18 18:40     ` Daniele Ceraolo Spurio
2019-06-18 18:57       ` Chris Wilson
2019-06-17 18:09 ` [PATCH 5/6] drm/i915: dynamically allocate forcewake domains Daniele Ceraolo Spurio
2019-06-18  9:23   ` Tvrtko Ursulin
2019-06-18 23:06     ` Daniele Ceraolo Spurio
2019-06-18 23:23       ` Chris Wilson
2019-06-18 23:37         ` Daniele Ceraolo Spurio
2019-06-19 14:22       ` Tvrtko Ursulin
2019-06-17 18:09 ` [PATCH 6/6] drm/i915/gvt: decouple check_vgpu() from uncore_init() Daniele Ceraolo Spurio
2019-06-18 10:49   ` Chris Wilson
2019-06-17 18:53 ` ✗ Fi.CI.CHECKPATCH: warning for Display uncore prep patches Patchwork
2019-06-17 19:09 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-18  9:15 ` ✓ Fi.CI.IGT: " Patchwork

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=236a6f51-ecf9-6dc5-fb43-a72e7beb7729@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox