diff mbox series

[2/4] drm/i915/xehpsdv: set min page-size to 64K

Message ID 20211208141613.7251-3-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Basic enabling of 64k page support | expand

Commit Message

Ramalingam C Dec. 8, 2021, 2:16 p.m. UTC
From: Matthew Auld <matthew.auld@intel.com>

LMEM should be allocated at 64K granularity, since 4K page support will
eventually be dropped for LMEM when using the PPGTT.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Stuart Summers <stuart.summers@intel.com>
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c  | 6 +++++-
 drivers/gpu/drm/i915/gt/intel_region_lmem.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Matthew Auld Dec. 8, 2021, 2:34 p.m. UTC | #1
On Wed, 8 Dec 2021 at 14:16, Ramalingam C <ramalingam.c@intel.com> wrote:
>
> From: Matthew Auld <matthew.auld@intel.com>
>
> LMEM should be allocated at 64K granularity, since 4K page support will
> eventually be dropped for LMEM when using the PPGTT.

s/will eventually be dropped/has been dropped/ as per Thomas' suggestion.

>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
> Reviewed-by: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_stolen.c  | 6 +++++-
>  drivers/gpu/drm/i915/gt/intel_region_lmem.c | 5 ++++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> index bce03d74a0b4..ba90ab47d838 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> @@ -780,6 +780,7 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
>         struct intel_uncore *uncore = &i915->uncore;
>         struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>         struct intel_memory_region *mem;
> +       resource_size_t min_page_size;
>         resource_size_t io_start;
>         resource_size_t lmem_size;
>         u64 lmem_base;
> @@ -791,8 +792,11 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
>         lmem_size = pci_resource_len(pdev, 2) - lmem_base;
>         io_start = pci_resource_start(pdev, 2) + lmem_base;
>
> +       min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K :
> +                                               I915_GTT_PAGE_SIZE_4K;
> +
>         mem = intel_memory_region_create(i915, lmem_base, lmem_size,
> -                                        I915_GTT_PAGE_SIZE_4K, io_start,
> +                                        min_page_size, io_start,
>                                          type, instance,
>                                          &i915_region_stolen_lmem_ops);
>         if (IS_ERR(mem))
> diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> index 9ea49e0a27c0..fde2dcb59809 100644
> --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> @@ -197,6 +197,7 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
>         struct intel_uncore *uncore = gt->uncore;
>         struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>         struct intel_memory_region *mem;
> +       resource_size_t min_page_size;
>         resource_size_t io_start;
>         resource_size_t lmem_size;
>         int err;
> @@ -211,10 +212,12 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
>         if (GEM_WARN_ON(lmem_size > pci_resource_len(pdev, 2)))
>                 return ERR_PTR(-ENODEV);
>
> +       min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K :
> +                                               I915_GTT_PAGE_SIZE_4K;
>         mem = intel_memory_region_create(i915,
>                                          0,
>                                          lmem_size,
> -                                        I915_GTT_PAGE_SIZE_4K,
> +                                        min_page_size,
>                                          io_start,
>                                          INTEL_MEMORY_LOCAL,
>                                          0,
> --
> 2.20.1
>
Thomas Hellstrom Dec. 8, 2021, 3:10 p.m. UTC | #2
On 12/8/21 15:34, Matthew Auld wrote:
> On Wed, 8 Dec 2021 at 14:16, Ramalingam C <ramalingam.c@intel.com> wrote:
>> From: Matthew Auld <matthew.auld@intel.com>
>>
>> LMEM should be allocated at 64K granularity, since 4K page support will
>> eventually be dropped for LMEM when using the PPGTT.
> s/will eventually be dropped/has been dropped/ as per Thomas' suggestion.

Or perhaps something along the lines of

Conditionally allocate LMEM with 64K granularity, since 4K page support 
for LMEM will be dropped on some platforms when using the PPGTT.

/Thomas



>
>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> Reviewed-by: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
>> ---
>>   drivers/gpu/drm/i915/gem/i915_gem_stolen.c  | 6 +++++-
>>   drivers/gpu/drm/i915/gt/intel_region_lmem.c | 5 ++++-
>>   2 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
>> index bce03d74a0b4..ba90ab47d838 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
>> @@ -780,6 +780,7 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
>>          struct intel_uncore *uncore = &i915->uncore;
>>          struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>>          struct intel_memory_region *mem;
>> +       resource_size_t min_page_size;
>>          resource_size_t io_start;
>>          resource_size_t lmem_size;
>>          u64 lmem_base;
>> @@ -791,8 +792,11 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
>>          lmem_size = pci_resource_len(pdev, 2) - lmem_base;
>>          io_start = pci_resource_start(pdev, 2) + lmem_base;
>>
>> +       min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K :
>> +                                               I915_GTT_PAGE_SIZE_4K;
>> +
>>          mem = intel_memory_region_create(i915, lmem_base, lmem_size,
>> -                                        I915_GTT_PAGE_SIZE_4K, io_start,
>> +                                        min_page_size, io_start,
>>                                           type, instance,
>>                                           &i915_region_stolen_lmem_ops);
>>          if (IS_ERR(mem))
>> diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
>> index 9ea49e0a27c0..fde2dcb59809 100644
>> --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
>> +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
>> @@ -197,6 +197,7 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
>>          struct intel_uncore *uncore = gt->uncore;
>>          struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>>          struct intel_memory_region *mem;
>> +       resource_size_t min_page_size;
>>          resource_size_t io_start;
>>          resource_size_t lmem_size;
>>          int err;
>> @@ -211,10 +212,12 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
>>          if (GEM_WARN_ON(lmem_size > pci_resource_len(pdev, 2)))
>>                  return ERR_PTR(-ENODEV);
>>
>> +       min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K :
>> +                                               I915_GTT_PAGE_SIZE_4K;
>>          mem = intel_memory_region_create(i915,
>>                                           0,
>>                                           lmem_size,
>> -                                        I915_GTT_PAGE_SIZE_4K,
>> +                                        min_page_size,
>>                                           io_start,
>>                                           INTEL_MEMORY_LOCAL,
>>                                           0,
>> --
>> 2.20.1
>>
Andi Shyti Dec. 8, 2021, 4:09 p.m. UTC | #3
Hi Ram,

On Wed, Dec 08, 2021 at 07:46:11PM +0530, Ramalingam C wrote:
> From: Matthew Auld <matthew.auld@intel.com>
> 
> LMEM should be allocated at 64K granularity, since 4K page support will
> eventually be dropped for LMEM when using the PPGTT.
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
> Reviewed-by: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi
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 bce03d74a0b4..ba90ab47d838 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -780,6 +780,7 @@  i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
 	struct intel_uncore *uncore = &i915->uncore;
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 	struct intel_memory_region *mem;
+	resource_size_t min_page_size;
 	resource_size_t io_start;
 	resource_size_t lmem_size;
 	u64 lmem_base;
@@ -791,8 +792,11 @@  i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
 	lmem_size = pci_resource_len(pdev, 2) - lmem_base;
 	io_start = pci_resource_start(pdev, 2) + lmem_base;
 
+	min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K :
+						I915_GTT_PAGE_SIZE_4K;
+
 	mem = intel_memory_region_create(i915, lmem_base, lmem_size,
-					 I915_GTT_PAGE_SIZE_4K, io_start,
+					 min_page_size, io_start,
 					 type, instance,
 					 &i915_region_stolen_lmem_ops);
 	if (IS_ERR(mem))
diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
index 9ea49e0a27c0..fde2dcb59809 100644
--- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
+++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
@@ -197,6 +197,7 @@  static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
 	struct intel_uncore *uncore = gt->uncore;
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 	struct intel_memory_region *mem;
+	resource_size_t min_page_size;
 	resource_size_t io_start;
 	resource_size_t lmem_size;
 	int err;
@@ -211,10 +212,12 @@  static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
 	if (GEM_WARN_ON(lmem_size > pci_resource_len(pdev, 2)))
 		return ERR_PTR(-ENODEV);
 
+	min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K :
+						I915_GTT_PAGE_SIZE_4K;
 	mem = intel_memory_region_create(i915,
 					 0,
 					 lmem_size,
-					 I915_GTT_PAGE_SIZE_4K,
+					 min_page_size,
 					 io_start,
 					 INTEL_MEMORY_LOCAL,
 					 0,