diff mbox series

drm/i915: Make sure dsm_size has correct granularity

Message ID 20230124150047.9490-1-nirmoy.das@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Make sure dsm_size has correct granularity | expand

Commit Message

Nirmoy Das Jan. 24, 2023, 3 p.m. UTC
DSM granularity is 1MB so make sure we stick to that.

Cc: Matthew Auld <matthew.auld@intel.com>
Suggested-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrzej Hajda Jan. 25, 2023, 7:47 a.m. UTC | #1
On 24.01.2023 16:00, Nirmoy Das wrote:
> DSM granularity is 1MB so make sure we stick to that.
> 
> Cc: Matthew Auld <matthew.auld@intel.com>
> Suggested-by: Lucas De Marchi <lucas.demarchi@intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>   drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> index 90a967374b1a..0c027263f09e 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> @@ -909,7 +909,7 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
>   		dsm_base = intel_uncore_read64(uncore, GEN12_DSMBASE) & GEN12_BDSM_MASK;
>   		if (WARN_ON(lmem_size < dsm_base))
>   			return ERR_PTR(-ENODEV);
> -		dsm_size = lmem_size - dsm_base;
> +		dsm_size = ALIGN_DOWN(lmem_size - dsm_base, 1 * SZ_1M);

1st seen "1 * SZ_1M", usually it is just SZ_1M, up to you.

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

>   	}
>   
>   	io_size = dsm_size;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
index 90a967374b1a..0c027263f09e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -909,7 +909,7 @@  i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
 		dsm_base = intel_uncore_read64(uncore, GEN12_DSMBASE) & GEN12_BDSM_MASK;
 		if (WARN_ON(lmem_size < dsm_base))
 			return ERR_PTR(-ENODEV);
-		dsm_size = lmem_size - dsm_base;
+		dsm_size = ALIGN_DOWN(lmem_size - dsm_base, 1 * SZ_1M);
 	}
 
 	io_size = dsm_size;