From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/i915: have virtual PCH detection return a PCH id
Date: Mon, 5 Feb 2018 14:27:37 -0800 [thread overview]
Message-ID: <20180205222737.vclnap3zjyierdmd@intel.com> (raw)
In-Reply-To: <197cf635261a1c628371ffaaee90e8647493af4d.1517851783.git.jani.nikula@intel.com>
On Mon, Feb 05, 2018 at 05:31:38PM +0000, Jani Nikula wrote:
> Simplify intel_virt_detect_pch() by making it return a PCH id rather
> than returning the PCH type and setting PCH id for some PCHs. Map the
> PCH id to PCH type using the shared routine. This gives us sanity check
> on the supported combinations also in the virtualized setting.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.c | 66 ++++++++++++++++++++++-------------------
> 1 file changed, 35 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 52666c6cbbcc..f675fc41a1c8 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -202,9 +202,10 @@ static bool intel_is_virt_pch(unsigned short id,
> sdevice == PCI_SUBDEVICE_ID_QEMU));
> }
>
> -static enum intel_pch intel_virt_detect_pch(struct drm_i915_private *dev_priv)
> +static unsigned short
> +intel_virt_detect_pch(const struct drm_i915_private *dev_priv)
> {
> - enum intel_pch ret = PCH_NOP;
> + unsigned short id = 0;
>
> /*
> * In a virtualized passthrough environment we can be in a
> @@ -213,28 +214,25 @@ static enum intel_pch intel_virt_detect_pch(struct drm_i915_private *dev_priv)
> * make an educated guess as to which PCH is really there.
> */
>
> - if (IS_GEN5(dev_priv)) {
> - ret = PCH_IBX;
> - DRM_DEBUG_KMS("Assuming Ibex Peak PCH\n");
> - } else if (IS_GEN6(dev_priv) || IS_IVYBRIDGE(dev_priv)) {
> - ret = PCH_CPT;
> - DRM_DEBUG_KMS("Assuming CougarPoint PCH\n");
> - } else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> - ret = PCH_LPT;
> - if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv))
> - dev_priv->pch_id = INTEL_PCH_LPT_LP_DEVICE_ID_TYPE;
> - else
> - dev_priv->pch_id = INTEL_PCH_LPT_DEVICE_ID_TYPE;
> - DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
> - } else if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv)) {
> - ret = PCH_SPT;
> - DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
> - } else if (IS_COFFEELAKE(dev_priv) || IS_CANNONLAKE(dev_priv)) {
> - ret = PCH_CNP;
> - DRM_DEBUG_KMS("Assuming CannonPoint PCH\n");
> - }
> + if (IS_GEN5(dev_priv))
> + id = INTEL_PCH_IBX_DEVICE_ID_TYPE;
> + else if (IS_GEN6(dev_priv) || IS_IVYBRIDGE(dev_priv))
> + id = INTEL_PCH_CPT_DEVICE_ID_TYPE;
> + else if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv))
> + id = INTEL_PCH_LPT_LP_DEVICE_ID_TYPE;
> + else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
> + id = INTEL_PCH_LPT_DEVICE_ID_TYPE;
> + else if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv))
> + id = INTEL_PCH_SPT_DEVICE_ID_TYPE;
> + else if (IS_COFFEELAKE(dev_priv) || IS_CANNONLAKE(dev_priv))
> + id = INTEL_PCH_CNP_DEVICE_ID_TYPE;
> +
> + if (id)
> + DRM_DEBUG_KMS("Assuming PCH ID %04x\n", id);
> + else
> + DRM_DEBUG_KMS("Assuming no PCH\n");
>
> - return ret;
> + return id;
> }
>
> static void intel_detect_pch(struct drm_i915_private *dev_priv)
> @@ -269,19 +267,25 @@ static void intel_detect_pch(struct drm_i915_private *dev_priv)
>
> id = pch->device & INTEL_PCH_DEVICE_ID_MASK;
>
> - dev_priv->pch_id = id;
> -
> pch_type = intel_pch_type(dev_priv, id);
> if (pch_type != PCH_NONE) {
> dev_priv->pch_type = pch_type;
> + dev_priv->pch_id = id;
> + break;
> } else if (intel_is_virt_pch(id, pch->subsystem_vendor,
> - pch->subsystem_device)) {
> - dev_priv->pch_type = intel_virt_detect_pch(dev_priv);
> - } else {
> - continue;
> + pch->subsystem_device)) {
> + id = intel_virt_detect_pch(dev_priv);
> + if (id) {
> + pch_type = intel_pch_type(dev_priv, id);
> + if (WARN_ON(pch_type == PCH_NONE))
> + pch_type = PCH_NOP;
> + } else {
> + pch_type = PCH_NOP;
> + }
> + dev_priv->pch_type = pch_type;
> + dev_priv->pch_id = id;
> + break;
> }
> -
> - break;
> }
> if (!pch)
> DRM_DEBUG_KMS("No PCH found.\n");
> --
> 2.11.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-02-05 22:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 17:31 [PATCH 0/4] drm/i915: pch detection refactoring Jani Nikula
2018-02-05 17:31 ` [PATCH 1/4] drm/i915: abstract PCH type detection from PCH id Jani Nikula
2018-02-05 22:21 ` Rodrigo Vivi
2018-02-13 15:35 ` Jani Nikula
2018-02-13 15:55 ` Ville Syrjälä
2018-02-05 17:31 ` [PATCH 2/4] drm/i915: abstract virtual PCH id detection Jani Nikula
2018-02-05 22:22 ` Rodrigo Vivi
2018-02-05 17:31 ` [PATCH 3/4] drm/i915: have virtual PCH detection return a PCH id Jani Nikula
2018-02-05 22:27 ` Rodrigo Vivi [this message]
2018-02-05 17:31 ` [PATCH 4/4] drm/i915: introduce INTEL_PCH_ID() and use it Jani Nikula
2018-02-05 22:28 ` Rodrigo Vivi
2018-02-05 18:20 ` ✓ Fi.CI.BAT: success for drm/i915: pch detection refactoring Patchwork
2018-02-05 20:39 ` ✗ Fi.CI.IGT: warning " Patchwork
2018-02-06 11:06 ` ✗ Fi.CI.BAT: " Patchwork
2018-02-07 12:43 ` ✓ Fi.CI.BAT: success " 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=20180205222737.vclnap3zjyierdmd@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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 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.