From: Oscar Mateo <oscar.mateo@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/4] drm/i915: Disable dynamic setup of device_info->num_rings
Date: Fri, 9 Feb 2018 15:46:31 -0800 [thread overview]
Message-ID: <b8f01c8b-0096-548b-9b6c-ad407707a78c@intel.com> (raw)
In-Reply-To: <20180209223535.30229-4-chris@chris-wilson.co.uk>
On 02/09/2018 02:35 PM, Chris Wilson wrote:
> In order to allow the compiler to use a known constant number of
> available engines, disable modification of intel_device_static_info
> during engine bring up. Instead of trying to gracefully hide the broken
> setup, error out -- in theory, this should be caught during power on.
We are about to have a case for dynamic number of available engines.
It's one of the ICL patches:
drm/i915/icl: Check for fused-off VDBOX and VEBOX instances
intel_device_runtime_info as well?
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/i915_pci.c | 34 +++++++++++++++++-----------------
> drivers/gpu/drm/i915/intel_engine_cs.c | 16 +++++-----------
> 2 files changed, 22 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index a10404686710..1e5bc971e975 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -31,6 +31,7 @@
>
> #define GEN(x) .gen = (x), .gen_mask = BIT((x) - 1)
> #define PLATFORM(x) .platform = (x), .platform_mask = BIT(x)
> +#define RINGS(x) .ring_mask = (x), .num_rings = hweight32(x)
>
> #define GEN_DEFAULT_PIPEOFFSETS \
> .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
> @@ -67,12 +68,12 @@
>
> #define GEN2_FEATURES \
> GEN(2), \
> + RINGS(RENDER_RING), \
> .num_pipes = 1, \
> .has_overlay = 1, .overlay_needs_physical = 1, \
> .has_gmch_display = 1, \
> .hws_needs_physical = 1, \
> .unfenced_needs_alignment = 1, \
> - .ring_mask = RENDER_RING, \
> .has_snoop = true, \
> GEN_DEFAULT_PIPEOFFSETS, \
> GEN_DEFAULT_PAGE_SIZES, \
> @@ -106,9 +107,9 @@ static const struct intel_device_info intel_i865g_info = {
>
> #define GEN3_FEATURES \
> GEN(3), \
> + RINGS(RENDER_RING), \
> .num_pipes = 2, \
> .has_gmch_display = 1, \
> - .ring_mask = RENDER_RING, \
> .has_snoop = true, \
> GEN_DEFAULT_PIPEOFFSETS, \
> GEN_DEFAULT_PAGE_SIZES, \
> @@ -173,10 +174,10 @@ static const struct intel_device_info intel_pineview_info = {
>
> #define GEN4_FEATURES \
> GEN(4), \
> + RINGS(RENDER_RING), \
> .num_pipes = 2, \
> .has_hotplug = 1, \
> .has_gmch_display = 1, \
> - .ring_mask = RENDER_RING, \
> .has_snoop = true, \
> GEN_DEFAULT_PIPEOFFSETS, \
> GEN_DEFAULT_PAGE_SIZES, \
> @@ -203,22 +204,22 @@ static const struct intel_device_info intel_i965gm_info = {
> static const struct intel_device_info intel_g45_info = {
> GEN4_FEATURES,
> PLATFORM(INTEL_G45),
> - .ring_mask = RENDER_RING | BSD_RING,
> + RINGS(RENDER_RING | BSD_RING),
> };
>
> static const struct intel_device_info intel_gm45_info = {
> GEN4_FEATURES,
> PLATFORM(INTEL_GM45),
> + RINGS(RENDER_RING | BSD_RING),
> .is_mobile = 1, .has_fbc = 1,
> .supports_tv = 1,
> - .ring_mask = RENDER_RING | BSD_RING,
> };
>
> #define GEN5_FEATURES \
> GEN(5), \
> + RINGS(RENDER_RING | BSD_RING), \
> .num_pipes = 2, \
> .has_hotplug = 1, \
> - .ring_mask = RENDER_RING | BSD_RING, \
> .has_snoop = true, \
> /* ilk does support rc6, but we do not implement [power] contexts */ \
> .has_rc6 = 0, \
> @@ -239,10 +240,10 @@ static const struct intel_device_info intel_ironlake_m_info = {
>
> #define GEN6_FEATURES \
> GEN(6), \
> + RINGS(RENDER_RING | BSD_RING | BLT_RING), \
> .num_pipes = 2, \
> .has_hotplug = 1, \
> .has_fbc = 1, \
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
> .has_llc = 1, \
> .has_rc6 = 1, \
> .has_rc6p = 1, \
> @@ -283,10 +284,10 @@ static const struct intel_device_info intel_sandybridge_m_gt2_info = {
>
> #define GEN7_FEATURES \
> GEN(7), \
> + RINGS(RENDER_RING | BSD_RING | BLT_RING), \
> .num_pipes = 3, \
> .has_hotplug = 1, \
> .has_fbc = 1, \
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
> .has_llc = 1, \
> .has_rc6 = 1, \
> .has_rc6p = 1, \
> @@ -338,6 +339,7 @@ static const struct intel_device_info intel_ivybridge_q_info = {
> static const struct intel_device_info intel_valleyview_info = {
> PLATFORM(INTEL_VALLEYVIEW),
> GEN(7),
> + RINGS(RENDER_RING | BSD_RING | BLT_RING),
> .is_lp = 1,
> .num_pipes = 2,
> .has_psr = 1,
> @@ -348,7 +350,6 @@ static const struct intel_device_info intel_valleyview_info = {
> .has_aliasing_ppgtt = 1,
> .has_full_ppgtt = 1,
> .has_snoop = true,
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING,
> .display_mmio_offset = VLV_DISPLAY_BASE,
> GEN_DEFAULT_PAGE_SIZES,
> GEN_DEFAULT_PIPEOFFSETS,
> @@ -357,7 +358,7 @@ static const struct intel_device_info intel_valleyview_info = {
>
> #define G75_FEATURES \
> GEN7_FEATURES, \
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
> + RINGS(RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING), \
> .has_ddi = 1, \
> .has_fpga_dbg = 1, \
> .has_psr = 1, \
> @@ -421,17 +422,17 @@ static const struct intel_device_info intel_broadwell_rsvd_info = {
>
> static const struct intel_device_info intel_broadwell_gt3_info = {
> BDW_PLATFORM,
> + RINGS(RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING),
> .gt = 3,
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
> };
>
> static const struct intel_device_info intel_cherryview_info = {
> PLATFORM(INTEL_CHERRYVIEW),
> GEN(8),
> + RINGS(RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING),
> .num_pipes = 3,
> .has_hotplug = 1,
> .is_lp = 1,
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
> .has_64bit_reloc = 1,
> .has_psr = 1,
> .has_runtime_pm = 1,
> @@ -481,8 +482,7 @@ static const struct intel_device_info intel_skylake_gt2_info = {
>
> #define SKL_GT3_PLUS_PLATFORM \
> SKL_PLATFORM, \
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING
> -
> + RINGS(RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING)
>
> static const struct intel_device_info intel_skylake_gt3_info = {
> SKL_GT3_PLUS_PLATFORM,
> @@ -496,9 +496,9 @@ static const struct intel_device_info intel_skylake_gt4_info = {
>
> #define GEN9_LP_FEATURES \
> GEN(9), \
> + RINGS(RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING), \
> .is_lp = 1, \
> .has_hotplug = 1, \
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
> .num_pipes = 3, \
> .has_64bit_reloc = 1, \
> .has_ddi = 1, \
> @@ -554,8 +554,8 @@ static const struct intel_device_info intel_kabylake_gt2_info = {
>
> static const struct intel_device_info intel_kabylake_gt3_info = {
> KBL_PLATFORM,
> + RINGS(RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING),
> .gt = 3,
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
> };
>
> #define CFL_PLATFORM \
> @@ -575,7 +575,7 @@ static const struct intel_device_info intel_coffeelake_gt2_info = {
> static const struct intel_device_info intel_coffeelake_gt3_info = {
> CFL_PLATFORM,
> .gt = 3,
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
> + RINGS(RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING),
> };
>
> #define GEN10_FEATURES \
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 0ad9184eba97..c65fce102d65 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -263,18 +263,12 @@ intel_engine_setup(struct drm_i915_private *dev_priv,
> */
> int intel_engines_init_mmio(struct drm_i915_private *dev_priv)
> {
> - struct intel_device_info *device_info = mkwrite_device_info(dev_priv);
> - const unsigned int ring_mask = INTEL_INFO(dev_priv)->ring_mask;
> struct intel_engine_cs *engine;
> enum intel_engine_id id;
> unsigned int mask = 0;
> unsigned int i;
> int err;
>
> - WARN_ON(ring_mask == 0);
> - WARN_ON(ring_mask &
> - GENMASK(sizeof(mask) * BITS_PER_BYTE - 1, I915_NUM_ENGINES));
> -
> for (i = 0; i < ARRAY_SIZE(intel_engines); i++) {
> if (!HAS_ENGINE(dev_priv, i))
> continue;
> @@ -291,17 +285,17 @@ int intel_engines_init_mmio(struct drm_i915_private *dev_priv)
> * are added to the driver by a warning and disabling the forgotten
> * engines.
> */
> - if (WARN_ON(mask != ring_mask))
> - device_info->ring_mask = mask;
> + if (GEM_WARN_ON(mask != INTEL_INFO(dev_priv)->ring_mask)) {
> + err = -ENODEV;
> + goto cleanup;
> + }
>
> /* We always presume we have at least RCS available for later probing */
> - if (WARN_ON(!HAS_ENGINE(dev_priv, RCS))) {
> + if (GEM_WARN_ON(!HAS_ENGINE(dev_priv, RCS))) {
> err = -ENODEV;
> goto cleanup;
> }
>
> - device_info->num_rings = hweight32(mask);
> -
> i915_check_and_clear_faults(dev_priv);
>
> return 0;
_______________________________________________
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-09 23:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 22:35 [PATCH 1/4] drm/i915: Store gen_mask inside the static device info Chris Wilson
2018-02-09 22:35 ` [PATCH 2/4] drm/i915: Always define GEN as part of GENx_FEATURES Chris Wilson
2018-02-14 22:40 ` Rodrigo Vivi
2018-02-09 22:35 ` [PATCH 3/4] drm/i915: Store platform_mask inside the static device info Chris Wilson
2018-02-14 22:45 ` Rodrigo Vivi
2018-02-15 7:55 ` Chris Wilson
2018-02-09 22:35 ` [PATCH 4/4] drm/i915: Disable dynamic setup of device_info->num_rings Chris Wilson
2018-02-09 23:46 ` Oscar Mateo [this message]
2018-02-10 8:39 ` Chris Wilson
2018-02-12 17:48 ` Ville Syrjälä
2018-02-09 23:13 ` ✓ Fi.CI.BAT: success for series starting with [1/4] drm/i915: Store gen_mask inside the static device info Patchwork
2018-02-10 0:24 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-02-12 9:58 ` [PATCH 1/4] " Jani Nikula
2018-02-12 10:05 ` Chris Wilson
2018-02-14 22:39 ` Rodrigo Vivi
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=b8f01c8b-0096-548b-9b6c-ad407707a78c@intel.com \
--to=oscar.mateo@intel.com \
--cc=chris@chris-wilson.co.uk \
--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