Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- drivers/gpu/drm/i915/i915_drv.h | 3 ++- drivers/gpu/drm/i915/i915_gem.c | 6 +++--- drivers/gpu/drm/i915/intel_device_info.c | 1 + drivers/gpu/drm/i915/intel_device_info.h | 1 + drivers/gpu/drm/i915/selftests/huge_pages.c | 16 ++++++++-------- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 +- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index a7c96b609b48..f3fad1a5b5bd 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -507,7 +507,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data) seq_printf(m, "%llu [%pa] gtt total\n", ggtt->base.total, &ggtt->mappable_end); seq_printf(m, "Supported page sizes: %s\n", - stringify_page_sizes(DEVICE_INFO(dev_priv)->page_sizes, + stringify_page_sizes(DRIVER_CAPS(dev_priv)->page_sizes, buf, sizeof(buf))); seq_putc(m, '\n'); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 4383a76c9522..a662d5f28080 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2547,6 +2547,7 @@ runtime_info(const struct drm_i915_private *dev_priv) #define DEVICE_INFO(dev_priv) device_info((dev_priv)) #define RUNTIME_INFO(dev_priv) runtime_info((dev_priv)) +#define DRIVER_CAPS(dev_priv) (&(dev_priv)->caps) #define INTEL_GEN(dev_priv) (DEVICE_INFO(dev_priv)->gen) #define INTEL_DEVID(dev_priv) (RUNTIME_INFO(dev_priv)->device_id) @@ -2770,7 +2771,7 @@ runtime_info(const struct drm_i915_private *dev_priv) #define USES_FULL_48BIT_PPGTT(dev_priv) (i915_modparams.enable_ppgtt == 3) #define HAS_PAGE_SIZES(dev_priv, sizes) ({ \ GEM_BUG_ON((sizes) == 0); \ - ((sizes) & ~DEVICE_INFO(dev_priv)->page_sizes) == 0; \ + ((sizes) & ~DRIVER_CAPS(dev_priv)->page_sizes) == 0; \ }) #define HAS_OVERLAY(dev_priv) (DEVICE_INFO(dev_priv)->has_overlay) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 2235ad3064e8..2a351a4d5389 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2545,7 +2545,7 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj, unsigned int sg_page_sizes) { struct drm_i915_private *i915 = to_i915(obj->base.dev); - unsigned long supported = DEVICE_INFO(i915)->page_sizes; + unsigned long supported = DRIVER_CAPS(i915)->page_sizes; int i; lockdep_assert_held(&obj->mm.lock); @@ -5268,9 +5268,9 @@ int i915_gem_init(struct drm_i915_private *dev_priv) * support huge page entries - we will need to check either hypervisor * mm can support huge guest page or just do emulation in gvt. */ + DRIVER_CAPS(dev_priv)->page_sizes = DEVICE_INFO(dev_priv)->page_sizes; if (intel_vgpu_active(dev_priv)) - mkwrite_device_info(dev_priv)->page_sizes = - I915_GTT_PAGE_SIZE_4K; + DRIVER_CAPS(dev_priv)->page_sizes = I915_GTT_PAGE_SIZE_4K; dev_priv->mm.unordered_timeline = dma_fence_context_alloc(1); diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index 79d5d5eb4471..1a5b2c1c9df9 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -593,4 +593,5 @@ void intel_driver_caps_print(const struct intel_driver_caps *caps, struct drm_printer *p) { drm_printf(p, "scheduler: %x\n", caps->scheduler); + drm_printf(p, "page sizes: %x\n", caps->page_sizes); } diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h index d5f34f124e34..09e0200f7afa 100644 --- a/drivers/gpu/drm/i915/intel_device_info.h +++ b/drivers/gpu/drm/i915/intel_device_info.h @@ -175,6 +175,7 @@ struct intel_device_runtime_info { /* device info probed at runtime */ struct intel_driver_caps { unsigned int scheduler; + unsigned int page_sizes; /* page sizes supported by the driver */ }; static inline unsigned int sseu_subslice_total(const struct sseu_dev_info *sseu) diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c index e86ec61f4945..9708f4e43e23 100644 --- a/drivers/gpu/drm/i915/selftests/huge_pages.c +++ b/drivers/gpu/drm/i915/selftests/huge_pages.c @@ -339,7 +339,7 @@ fake_huge_pages_object(struct drm_i915_private *i915, u64 size, bool single) static int igt_check_page_sizes(struct i915_vma *vma) { struct drm_i915_private *i915 = to_i915(vma->obj->base.dev); - unsigned int supported = DEVICE_INFO(i915)->page_sizes; + unsigned int supported = DRIVER_CAPS(i915)->page_sizes; struct drm_i915_gem_object *obj = vma->obj; int err = 0; @@ -380,7 +380,7 @@ static int igt_mock_exhaust_device_supported_pages(void *arg) { struct i915_hw_ppgtt *ppgtt = arg; struct drm_i915_private *i915 = ppgtt->base.i915; - unsigned int saved_mask = DEVICE_INFO(i915)->page_sizes; + unsigned int saved_mask = DRIVER_CAPS(i915)->page_sizes; struct drm_i915_gem_object *obj; struct i915_vma *vma; int i, j, single; @@ -399,7 +399,7 @@ static int igt_mock_exhaust_device_supported_pages(void *arg) combination |= page_sizes[j]; } - mkwrite_device_info(i915)->page_sizes = combination; + DRIVER_CAPS(i915)->page_sizes = combination; for (single = 0; single <= 1; ++single) { obj = fake_huge_pages_object(i915, combination, !!single); @@ -450,7 +450,7 @@ static int igt_mock_exhaust_device_supported_pages(void *arg) out_put: i915_gem_object_put(obj); out_device: - mkwrite_device_info(i915)->page_sizes = saved_mask; + DRIVER_CAPS(i915)->page_sizes = saved_mask; return err; } @@ -459,7 +459,7 @@ static int igt_mock_ppgtt_misaligned_dma(void *arg) { struct i915_hw_ppgtt *ppgtt = arg; struct drm_i915_private *i915 = ppgtt->base.i915; - unsigned long supported = DEVICE_INFO(i915)->page_sizes; + unsigned long supported = DRIVER_CAPS(i915)->page_sizes; struct drm_i915_gem_object *obj; int bit; int err; @@ -1181,7 +1181,7 @@ static int igt_ppgtt_exhaust_huge(void *arg) { struct i915_gem_context *ctx = arg; struct drm_i915_private *i915 = ctx->i915; - unsigned long supported = DEVICE_INFO(i915)->page_sizes; + unsigned long supported = DRIVER_CAPS(i915)->page_sizes; static unsigned int pages[ARRAY_SIZE(page_sizes)]; struct drm_i915_gem_object *obj; unsigned int size_mask; @@ -1272,7 +1272,7 @@ static int igt_ppgtt_exhaust_huge(void *arg) i915_gem_object_unpin_pages(obj); i915_gem_object_put(obj); out_device: - mkwrite_device_info(i915)->page_sizes = supported; + DRIVER_CAPS(i915)->page_sizes = supported; return err; } @@ -1408,7 +1408,7 @@ static int igt_ppgtt_pin_update(void *arg) { struct i915_gem_context *ctx = arg; struct drm_i915_private *dev_priv = ctx->i915; - unsigned long supported = DEVICE_INFO(dev_priv)->page_sizes; + unsigned long supported = DRIVER_CAPS(dev_priv)->page_sizes; struct i915_hw_ppgtt *ppgtt = ctx->ppgtt; struct drm_i915_gem_object *obj; struct i915_vma *vma; diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c index 3175db70cc6e..b8f22988d8d5 100644 --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c @@ -176,7 +176,7 @@ struct drm_i915_private *mock_gem_device(void) mkwrite_device_info(i915)->gen = -1; - mkwrite_device_info(i915)->page_sizes = + DRIVER_CAPS(i915)->page_sizes = I915_GTT_PAGE_SIZE_4K | I915_GTT_PAGE_SIZE_64K | I915_GTT_PAGE_SIZE_2M; -- 2.16.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx