public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Bob Paauwe <bob.j.paauwe@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH] drm/i915: Make 48bit full ppgtt configuration generic (v2)
Date: Thu,  6 Sep 2018 13:04:09 -0700	[thread overview]
Message-ID: <20180906200409.4069910-1-bob.j.paauwe@intel.com> (raw)
In-Reply-To: <20180831154704.3800568-1-bob.j.paauwe@intel.com>

48 bit ppgtt device configuration is really just extended address
range full ppgtt and may actually be something other than 48 bits.

Change USES_FULL_48BIT_PPGTT() to USES_FULL_4LVL_PPGTT() to better
describe that a 4 level walk table extended range PPGTT is being
used. Add a new device info field that specifies the number of
bits to prepare for cases where the range is not 32 or 48 bits.

v2: keep USES_FULL_PPGTT() unchanged (Chris)

Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
CC: Rodrigo Vivi <rodrigo.vivi@intel.com>
CC: Michel Thierry <michel.thierry@intel.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.h                  |  2 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c              | 19 ++++++++++---------
 drivers/gpu/drm/i915/i915_pci.c                  |  7 +++++--
 drivers/gpu/drm/i915/intel_device_info.h         |  3 +++
 drivers/gpu/drm/i915/selftests/huge_pages.c      |  2 +-
 drivers/gpu/drm/i915/selftests/mock_gem_device.c |  2 ++
 6 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 5a4da5b723fd..a367686fd735 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2569,7 +2569,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 
 #define USES_PPGTT(dev_priv)		(i915_modparams.enable_ppgtt)
 #define USES_FULL_PPGTT(dev_priv)	(i915_modparams.enable_ppgtt >= 2)
-#define USES_FULL_48BIT_PPGTT(dev_priv)	(i915_modparams.enable_ppgtt == 3)
+#define USES_FULL_4LVL_PPGTT(dev_priv)	((dev_priv)->info.full_ppgtt_bits > 32)
 #define HAS_PAGE_SIZES(dev_priv, sizes) ({ \
 	GEM_BUG_ON((sizes) == 0); \
 	((sizes) & ~(dev_priv)->info.page_sizes) == 0; \
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index eb0e446d6482..530a4c1452b3 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -137,18 +137,18 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 			       	int enable_ppgtt)
 {
 	bool has_full_ppgtt;
-	bool has_full_48bit_ppgtt;
+	bool has_full_4lvl_ppgtt;
 
 	if (!dev_priv->info.has_aliasing_ppgtt)
 		return 0;
 
 	has_full_ppgtt = dev_priv->info.has_full_ppgtt;
-	has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt;
+	has_full_4lvl_ppgtt = USES_FULL_4LVL_PPGTT(dev_priv);
 
 	if (intel_vgpu_active(dev_priv)) {
 		/* GVT-g has no support for 32bit ppgtt */
 		has_full_ppgtt = false;
-		has_full_48bit_ppgtt = intel_vgpu_has_full_48bit_ppgtt(dev_priv);
+		has_full_4lvl_ppgtt = intel_vgpu_has_full_48bit_ppgtt(dev_priv);
 	}
 
 	/*
@@ -164,7 +164,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 	if (enable_ppgtt == 2 && has_full_ppgtt)
 		return 2;
 
-	if (enable_ppgtt == 3 && has_full_48bit_ppgtt)
+	if (enable_ppgtt == 3 && has_full_4lvl_ppgtt)
 		return 3;
 
 	/* Disable ppgtt on SNB if VT-d is on. */
@@ -173,7 +173,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 		return 0;
 	}
 
-	if (has_full_48bit_ppgtt)
+	if (has_full_4lvl_ppgtt)
 		return 3;
 
 	if (has_full_ppgtt)
@@ -1647,9 +1647,10 @@ static struct i915_hw_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
 	ppgtt->vm.i915 = i915;
 	ppgtt->vm.dma = &i915->drm.pdev->dev;
 
-	ppgtt->vm.total = USES_FULL_48BIT_PPGTT(i915) ?
-		1ULL << 48 :
-		1ULL << 32;
+	if ((i915_modparams.enable_ppgtt < 3) && USES_FULL_4LVL_PPGTT(i915))
+		ppgtt->vm.total = 1ULL << 32;
+	else
+		ppgtt->vm.total = 1ULL << i915->info.full_ppgtt_bits;
 
 	/*
 	 * From bdw, there is support for read-only pages in the PPGTT.
@@ -1788,7 +1789,7 @@ static void gen8_ppgtt_enable(struct drm_i915_private *dev_priv)
 	enum intel_engine_id id;
 
 	for_each_engine(engine, dev_priv, id) {
-		u32 four_level = USES_FULL_48BIT_PPGTT(dev_priv) ?
+		u32 four_level = USES_FULL_4LVL_PPGTT(dev_priv) ?
 				 GEN8_GFX_PPGTT_48B : 0;
 		I915_WRITE(RING_MODE_GEN7(engine),
 			   _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE | four_level));
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index d6f7b9fe1d26..a99c1f6de64e 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -299,6 +299,7 @@ static const struct intel_device_info intel_sandybridge_m_gt2_info = {
 	.has_rc6p = 1, \
 	.has_aliasing_ppgtt = 1, \
 	.has_full_ppgtt = 1, \
+	.full_ppgtt_bits = 32, \
 	GEN_DEFAULT_PIPEOFFSETS, \
 	GEN_DEFAULT_PAGE_SIZES, \
 	IVB_CURSOR_OFFSETS
@@ -353,6 +354,7 @@ static const struct intel_device_info intel_valleyview_info = {
 	.has_hotplug = 1,
 	.has_aliasing_ppgtt = 1,
 	.has_full_ppgtt = 1,
+	.full_ppgtt_bits = 32, \
 	.has_snoop = true,
 	.has_coherent_ggtt = false,
 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING,
@@ -399,7 +401,7 @@ static const struct intel_device_info intel_haswell_gt3_info = {
 	.page_sizes = I915_GTT_PAGE_SIZE_4K | \
 		      I915_GTT_PAGE_SIZE_2M, \
 	.has_logical_ring_contexts = 1, \
-	.has_full_48bit_ppgtt = 1, \
+	.full_ppgtt_bits = 48, \
 	.has_64bit_reloc = 1, \
 	.has_reset_engine = 1
 
@@ -445,6 +447,7 @@ static const struct intel_device_info intel_cherryview_info = {
 	.has_gmch_display = 1,
 	.has_aliasing_ppgtt = 1,
 	.has_full_ppgtt = 1,
+	.full_ppgtt_bits = 32, \
 	.has_reset_engine = 1,
 	.has_snoop = true,
 	.has_coherent_ggtt = false,
@@ -520,7 +523,7 @@ static const struct intel_device_info intel_skylake_gt4_info = {
 	.has_guc = 1, \
 	.has_aliasing_ppgtt = 1, \
 	.has_full_ppgtt = 1, \
-	.has_full_48bit_ppgtt = 1, \
+	.full_ppgtt_bits = 48, \
 	.has_reset_engine = 1, \
 	.has_snoop = true, \
 	.has_coherent_ggtt = false, \
diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
index 6eecd64734d5..083590e98195 100644
--- a/drivers/gpu/drm/i915/intel_device_info.h
+++ b/drivers/gpu/drm/i915/intel_device_info.h
@@ -182,6 +182,9 @@ struct intel_device_info {
 		u16 degamma_lut_size;
 		u16 gamma_lut_size;
 	} color;
+
+	/* PPGTT bit size */
+	int full_ppgtt_bits;
 };
 
 struct intel_driver_caps {
diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
index e272127783fe..9f74244ef3e1 100644
--- a/drivers/gpu/drm/i915/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
@@ -1434,7 +1434,7 @@ static int igt_ppgtt_pin_update(void *arg)
 	 * huge-gtt-pages.
 	 */
 
-	if (!USES_FULL_48BIT_PPGTT(dev_priv)) {
+	if (!USES_FULL_4LVL_PPGTT(dev_priv)) {
 		pr_info("48b PPGTT not supported, skipping\n");
 		return 0;
 	}
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 43ed8b28aeaa..33d7225edbbb 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -181,6 +181,8 @@ struct drm_i915_private *mock_gem_device(void)
 		I915_GTT_PAGE_SIZE_64K |
 		I915_GTT_PAGE_SIZE_2M;
 
+	mkwrite_device_info(i915)->full_ppgtt_bits = 48;
+
 	mock_uncore_init(i915);
 	i915_gem_init__mm(i915);
 
-- 
2.14.4

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

  parent reply	other threads:[~2018-09-06 20:04 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 15:47 [PATCH] drm/i915: Rename full ppgtt configuration to be more generic Bob Paauwe
2018-08-31 15:51 ` Chris Wilson
2018-08-31 17:43   ` Bob Paauwe
2018-08-31 20:21   ` Rodrigo Vivi
2018-09-04 17:42     ` Bob Paauwe
2018-08-31 16:41 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-09-01  1:07 ` ✓ Fi.CI.IGT: " Patchwork
2018-09-06 20:04 ` Bob Paauwe [this message]
2018-09-06 20:08   ` [PATCH] drm/i915: Make 48bit full ppgtt configuration generic (v2) Chris Wilson
2018-09-06 20:32     ` Bob Paauwe
2018-09-06 21:12     ` Rodrigo Vivi
2018-09-06 21:10   ` Rodrigo Vivi
2018-09-07 16:29     ` Bob Paauwe
2018-09-10 17:12   ` [PATCH] drm/i915: Make 48bit full ppgtt configuration generic (v3) Bob Paauwe
2018-09-10 17:32     ` Rodrigo Vivi
2018-09-10 18:51       ` Bob Paauwe
2018-09-10 19:56     ` Chris Wilson
2018-09-10 20:34       ` Bob Paauwe
2018-09-10 20:35         ` Chris Wilson
2018-09-12 16:04     ` [PATCH] drm/i915: Make 48bit full ppgtt configuration generic (v4) Bob Paauwe
2018-09-12 16:10       ` Chris Wilson
2018-09-13 17:02         ` Bob Paauwe
2018-09-13 17:05           ` Ville Syrjälä
2018-09-13 17:12             ` Bob Paauwe
2018-09-13 17:22               ` Ville Syrjälä
2018-09-14 15:51                 ` Bob Paauwe
2018-10-02 17:41                   ` Chris Wilson
2018-10-02 17:39       ` [PATCH] drm/i915: Make 48bit full ppgtt configuration generic (v6) Bob Paauwe
2018-10-02 17:43         ` Chris Wilson
2018-10-08 18:14         ` [PATCH] drm/i915: Make 48bit full ppgtt configuration generic (v7) Bob Paauwe
2018-10-11 10:01           ` Chris Wilson
2018-10-29 21:39           ` [PATCH 1/3] " Bob Paauwe
2018-10-29 21:39             ` [PATCH 2/3] drm/i915: Remove HAS_4LVL_PPGTT Bob Paauwe
2018-10-29 21:39             ` [PATCH 3/3] drm/i915: Remove HAS_FULL_PPGTT and device_info.ppgtt enum Bob Paauwe
2018-10-29 21:45               ` Chris Wilson
2018-10-29 21:47             ` [PATCH 1/3] drm/i915: Make 48bit full ppgtt configuration generic (v7) Chris Wilson
2018-10-31 15:54             ` [PATCH 1/3] drm/i915: Make 48bit full ppgtt configuration generic (v8) Bob Paauwe
2018-10-31 15:54               ` [PATCH 2/3] drm/i915: Remove HAS_4LVL_PPGTT Bob Paauwe
2018-10-31 15:54               ` [PATCH 3/3] drm/i915: Remove HAS_FULL_PPGTT and device_info.ppgtt enum (v2) Bob Paauwe
2018-11-07 22:28               ` [PATCH 1/3] drm/i915: Make 48bit full ppgtt configuration generic (v9) Bob Paauwe
2018-11-07 22:28                 ` [PATCH 2/3] drm/i915: Remove HAS_4LVL_PPGTT Bob Paauwe
2018-11-07 22:28                 ` [PATCH 3/3] drm/i915: Remove HAS_FULL_PPGTT and device_info.ppgtt enum (v2) Bob Paauwe
2018-11-08 12:21                   ` kbuild test robot
2018-11-08  8:54                 ` [PATCH 1/3] drm/i915: Make 48bit full ppgtt configuration generic (v9) kbuild test robot
2018-11-08 21:56                 ` [PATCH 1/3] drm/i915: Make 48bit full ppgtt configuration generic (v10) Bob Paauwe
2018-11-08 21:56                   ` [PATCH 2/3] drm/i915: Remove HAS_4LVL_PPGTT Bob Paauwe
2018-11-08 21:56                   ` [PATCH 3/3] drm/i915: Remove HAS_FULL_PPGTT and device_info.ppgtt enum (v2) Bob Paauwe
2018-09-06 20:16 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Rename full ppgtt configuration to be more generic (rev2) Patchwork
2018-09-06 20:35 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-06 21:25 ` ✓ Fi.CI.IGT: " Patchwork
2018-09-10 18:15 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Rename full ppgtt configuration to be more generic (rev3) Patchwork
2018-09-10 18:16 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-09-10 18:35 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-09-12 17:19 ` ✓ Fi.CI.BAT: success for drm/i915: Rename full ppgtt configuration to be more generic (rev4) Patchwork
2018-09-12 23:57 ` ✓ Fi.CI.IGT: " Patchwork
2018-10-02 17:50 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Rename full ppgtt configuration to be more generic (rev5) Patchwork
2018-10-02 18:06 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-03  8:29 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-10-03  9:54   ` Martin Peres
2018-10-08 18:32 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Rename full ppgtt configuration to be more generic (rev6) Patchwork
2018-10-08 18:32 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-08 18:51 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-08 19:45 ` ✓ Fi.CI.IGT: " Patchwork
2018-11-07 12:59 ` ✗ Fi.CI.BAT: failure " 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=20180906200409.4069910-1-bob.j.paauwe@intel.com \
    --to=bob.j.paauwe@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@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