diff mbox series

[v5,1/2] drm/i915: Migrate platform-dependent mock hugepage selftests to live

Message ID 20230227171920.2438319-1-jonathan.cavitt@intel.com (mailing list archive)
State New, archived
Headers show
Series [v5,1/2] drm/i915: Migrate platform-dependent mock hugepage selftests to live | expand

Commit Message

Cavitt, Jonathan Feb. 27, 2023, 5:19 p.m. UTC
Convert the igt_mock_ppgtt_huge_fill and igt_mock_ppgtt_64K mock selftests into
live selftests as their requirements have recently become platform-dependent.
Additionally, apply necessary platform dependency checks to these tests.

v2: Reorder

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 .../gpu/drm/i915/gem/selftests/huge_pages.c   | 22 ++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

Comments

Matthew Auld Feb. 28, 2023, 2:08 p.m. UTC | #1
On 27/02/2023 17:19, Jonathan Cavitt wrote:
> Convert the igt_mock_ppgtt_huge_fill and igt_mock_ppgtt_64K mock selftests into
> live selftests as their requirements have recently become platform-dependent.
> Additionally, apply necessary platform dependency checks to these tests.
> 
> v2: Reorder
> 
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>

r-b still stands for the series. Note that CI is busted atm though, so 
we can't merge this yet. Likely need to re-trigger testing for the 
series once CI/drm-tip is working again.


> ---
>   .../gpu/drm/i915/gem/selftests/huge_pages.c   | 22 ++++++++++++++-----
>   1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> index defece0bcb81..375f119ab261 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> @@ -710,7 +710,7 @@ static void close_object_list(struct list_head *objects,
>   	}
>   }
>   
> -static int igt_mock_ppgtt_huge_fill(void *arg)
> +static int igt_ppgtt_huge_fill(void *arg)
>   {
>   	struct i915_ppgtt *ppgtt = arg;
>   	struct drm_i915_private *i915 = ppgtt->vm.i915;
> @@ -784,7 +784,8 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>   		GEM_BUG_ON(!expected_gtt);
>   		GEM_BUG_ON(size);
>   
> -		if (expected_gtt & I915_GTT_PAGE_SIZE_4K)
> +		if (expected_gtt & I915_GTT_PAGE_SIZE_4K &&
> +		    GRAPHICS_VER_FULL(i915) < IP_VER(12, 50))
>   			expected_gtt &= ~I915_GTT_PAGE_SIZE_64K;
>   
>   		i915_vma_unpin(vma);
> @@ -831,7 +832,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>   	return err;
>   }
>   
> -static int igt_mock_ppgtt_64K(void *arg)
> +static int igt_ppgtt_64K(void *arg)
>   {
>   	struct i915_ppgtt *ppgtt = arg;
>   	struct drm_i915_private *i915 = ppgtt->vm.i915;
> @@ -913,6 +914,17 @@ static int igt_mock_ppgtt_64K(void *arg)
>   		unsigned int offset = objects[i].offset;
>   		unsigned int flags = PIN_USER;
>   
> +		/*
> +		 * For modern GTT models, the requirements for marking a page-table
> +		 * as 64K have been relaxed.  Account for this.
> +		 */
> +
> +		if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
> +			expected_gtt = 0;
> +			expected_gtt |= size & (SZ_64K | SZ_2M) ? I915_GTT_PAGE_SIZE_64K : 0;
> +			expected_gtt |= size & SZ_4K ? I915_GTT_PAGE_SIZE_4K : 0;
> +		}
> +
>   		for (single = 0; single <= 1; single++) {
>   			obj = fake_huge_pages_object(i915, size, !!single);
>   			if (IS_ERR(obj))
> @@ -1910,8 +1922,6 @@ int i915_gem_huge_page_mock_selftests(void)
>   		SUBTEST(igt_mock_exhaust_device_supported_pages),
>   		SUBTEST(igt_mock_memory_region_huge_pages),
>   		SUBTEST(igt_mock_ppgtt_misaligned_dma),
> -		SUBTEST(igt_mock_ppgtt_huge_fill),
> -		SUBTEST(igt_mock_ppgtt_64K),
>   	};
>   	struct drm_i915_private *dev_priv;
>   	struct i915_ppgtt *ppgtt;
> @@ -1962,6 +1972,8 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *i915)
>   		SUBTEST(igt_ppgtt_sanity_check),
>   		SUBTEST(igt_ppgtt_compact),
>   		SUBTEST(igt_ppgtt_mixed),
> +		SUBTEST(igt_ppgtt_huge_fill),
> +		SUBTEST(igt_ppgtt_64K),
>   	};
>   
>   	if (!HAS_PPGTT(i915)) {
Matthew Auld March 2, 2023, 10:36 a.m. UTC | #2
On 28/02/2023 14:08, Matthew Auld wrote:
> On 27/02/2023 17:19, Jonathan Cavitt wrote:
>> Convert the igt_mock_ppgtt_huge_fill and igt_mock_ppgtt_64K mock 
>> selftests into
>> live selftests as their requirements have recently become 
>> platform-dependent.
>> Additionally, apply necessary platform dependency checks to these tests.
>>
>> v2: Reorder
>>
>> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> 
> r-b still stands for the series. Note that CI is busted atm though, so 
> we can't merge this yet. Likely need to re-trigger testing for the 
> series once CI/drm-tip is working again.

CI looks to be back. Can you trigger a retest through patchwork, or 
resend the series?

> 
> 
>> ---
>>   .../gpu/drm/i915/gem/selftests/huge_pages.c   | 22 ++++++++++++++-----
>>   1 file changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c 
>> b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>> index defece0bcb81..375f119ab261 100644
>> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>> @@ -710,7 +710,7 @@ static void close_object_list(struct list_head 
>> *objects,
>>       }
>>   }
>> -static int igt_mock_ppgtt_huge_fill(void *arg)
>> +static int igt_ppgtt_huge_fill(void *arg)
>>   {
>>       struct i915_ppgtt *ppgtt = arg;
>>       struct drm_i915_private *i915 = ppgtt->vm.i915;
>> @@ -784,7 +784,8 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>>           GEM_BUG_ON(!expected_gtt);
>>           GEM_BUG_ON(size);
>> -        if (expected_gtt & I915_GTT_PAGE_SIZE_4K)
>> +        if (expected_gtt & I915_GTT_PAGE_SIZE_4K &&
>> +            GRAPHICS_VER_FULL(i915) < IP_VER(12, 50))
>>               expected_gtt &= ~I915_GTT_PAGE_SIZE_64K;
>>           i915_vma_unpin(vma);
>> @@ -831,7 +832,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>>       return err;
>>   }
>> -static int igt_mock_ppgtt_64K(void *arg)
>> +static int igt_ppgtt_64K(void *arg)
>>   {
>>       struct i915_ppgtt *ppgtt = arg;
>>       struct drm_i915_private *i915 = ppgtt->vm.i915;
>> @@ -913,6 +914,17 @@ static int igt_mock_ppgtt_64K(void *arg)
>>           unsigned int offset = objects[i].offset;
>>           unsigned int flags = PIN_USER;
>> +        /*
>> +         * For modern GTT models, the requirements for marking a 
>> page-table
>> +         * as 64K have been relaxed.  Account for this.
>> +         */
>> +
>> +        if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
>> +            expected_gtt = 0;
>> +            expected_gtt |= size & (SZ_64K | SZ_2M) ? 
>> I915_GTT_PAGE_SIZE_64K : 0;
>> +            expected_gtt |= size & SZ_4K ? I915_GTT_PAGE_SIZE_4K : 0;
>> +        }
>> +
>>           for (single = 0; single <= 1; single++) {
>>               obj = fake_huge_pages_object(i915, size, !!single);
>>               if (IS_ERR(obj))
>> @@ -1910,8 +1922,6 @@ int i915_gem_huge_page_mock_selftests(void)
>>           SUBTEST(igt_mock_exhaust_device_supported_pages),
>>           SUBTEST(igt_mock_memory_region_huge_pages),
>>           SUBTEST(igt_mock_ppgtt_misaligned_dma),
>> -        SUBTEST(igt_mock_ppgtt_huge_fill),
>> -        SUBTEST(igt_mock_ppgtt_64K),
>>       };
>>       struct drm_i915_private *dev_priv;
>>       struct i915_ppgtt *ppgtt;
>> @@ -1962,6 +1972,8 @@ int i915_gem_huge_page_live_selftests(struct 
>> drm_i915_private *i915)
>>           SUBTEST(igt_ppgtt_sanity_check),
>>           SUBTEST(igt_ppgtt_compact),
>>           SUBTEST(igt_ppgtt_mixed),
>> +        SUBTEST(igt_ppgtt_huge_fill),
>> +        SUBTEST(igt_ppgtt_64K),
>>       };
>>       if (!HAS_PPGTT(i915)) {
Cavitt, Jonathan March 2, 2023, 2:49 p.m. UTC | #3
-----Original Message-----
From: Auld, Matthew <matthew.auld@intel.com> 
Sent: Thursday, March 2, 2023 2:36 AM
To: Cavitt, Jonathan <jonathan.cavitt@intel.com>; intel-gfx@lists.freedesktop.org
Cc: Dutt, Sudeep <sudeep.dutt@intel.com>; thomas.hellstrom@linux.intel.com; maarten.lankhorst@linux.intel.com; Vetter, Daniel <daniel.vetter@intel.com>; De Marchi, Lucas <lucas.demarchi@intel.com>; chris.p.wilson@linux.intel.com
Subject: Re: [PATCH v5 1/2] drm/i915: Migrate platform-dependent mock hugepage selftests to live
> 
> On 28/02/2023 14:08, Matthew Auld wrote:
> > On 27/02/2023 17:19, Jonathan Cavitt wrote:
> >> Convert the igt_mock_ppgtt_huge_fill and igt_mock_ppgtt_64K mock 
> >> selftests into
> >> live selftests as their requirements have recently become 
> >> platform-dependent.
> >> Additionally, apply necessary platform dependency checks to these tests.
> >>
> >> v2: Reorder
> >>
> >> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> > 
> > r-b still stands for the series. Note that CI is busted atm though, so 
> > we can't merge this yet. Likely need to re-trigger testing for the 
> > series once CI/drm-tip is working again.
> 
> CI looks to be back. Can you trigger a retest through patchwork, or 
> resend the series?

Retest request submitted.
-Jonathan Cavitt

> 
> > 
> > 
> >> ---
> >>   .../gpu/drm/i915/gem/selftests/huge_pages.c   | 22 ++++++++++++++-----
> >>   1 file changed, 17 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c 
> >> b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> >> index defece0bcb81..375f119ab261 100644
> >> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> >> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> >> @@ -710,7 +710,7 @@ static void close_object_list(struct list_head 
> >> *objects,
> >>       }
> >>   }
> >> -static int igt_mock_ppgtt_huge_fill(void *arg)
> >> +static int igt_ppgtt_huge_fill(void *arg)
> >>   {
> >>       struct i915_ppgtt *ppgtt = arg;
> >>       struct drm_i915_private *i915 = ppgtt->vm.i915;
> >> @@ -784,7 +784,8 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
> >>           GEM_BUG_ON(!expected_gtt);
> >>           GEM_BUG_ON(size);
> >> -        if (expected_gtt & I915_GTT_PAGE_SIZE_4K)
> >> +        if (expected_gtt & I915_GTT_PAGE_SIZE_4K &&
> >> +            GRAPHICS_VER_FULL(i915) < IP_VER(12, 50))
> >>               expected_gtt &= ~I915_GTT_PAGE_SIZE_64K;
> >>           i915_vma_unpin(vma);
> >> @@ -831,7 +832,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
> >>       return err;
> >>   }
> >> -static int igt_mock_ppgtt_64K(void *arg)
> >> +static int igt_ppgtt_64K(void *arg)
> >>   {
> >>       struct i915_ppgtt *ppgtt = arg;
> >>       struct drm_i915_private *i915 = ppgtt->vm.i915;
> >> @@ -913,6 +914,17 @@ static int igt_mock_ppgtt_64K(void *arg)
> >>           unsigned int offset = objects[i].offset;
> >>           unsigned int flags = PIN_USER;
> >> +        /*
> >> +         * For modern GTT models, the requirements for marking a 
> >> page-table
> >> +         * as 64K have been relaxed.  Account for this.
> >> +         */
> >> +
> >> +        if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
> >> +            expected_gtt = 0;
> >> +            expected_gtt |= size & (SZ_64K | SZ_2M) ? 
> >> I915_GTT_PAGE_SIZE_64K : 0;
> >> +            expected_gtt |= size & SZ_4K ? I915_GTT_PAGE_SIZE_4K : 0;
> >> +        }
> >> +
> >>           for (single = 0; single <= 1; single++) {
> >>               obj = fake_huge_pages_object(i915, size, !!single);
> >>               if (IS_ERR(obj))
> >> @@ -1910,8 +1922,6 @@ int i915_gem_huge_page_mock_selftests(void)
> >>           SUBTEST(igt_mock_exhaust_device_supported_pages),
> >>           SUBTEST(igt_mock_memory_region_huge_pages),
> >>           SUBTEST(igt_mock_ppgtt_misaligned_dma),
> >> -        SUBTEST(igt_mock_ppgtt_huge_fill),
> >> -        SUBTEST(igt_mock_ppgtt_64K),
> >>       };
> >>       struct drm_i915_private *dev_priv;
> >>       struct i915_ppgtt *ppgtt;
> >> @@ -1962,6 +1972,8 @@ int i915_gem_huge_page_live_selftests(struct 
> >> drm_i915_private *i915)
> >>           SUBTEST(igt_ppgtt_sanity_check),
> >>           SUBTEST(igt_ppgtt_compact),
> >>           SUBTEST(igt_ppgtt_mixed),
> >> +        SUBTEST(igt_ppgtt_huge_fill),
> >> +        SUBTEST(igt_ppgtt_64K),
> >>       };
> >>       if (!HAS_PPGTT(i915)) {
>
Cavitt, Jonathan March 13, 2023, 3:57 p.m. UTC | #4
-----Original Message-----
From: Auld, Matthew <matthew.auld@intel.com> 
Sent: Thursday, March 2, 2023 2:36 AM
To: Cavitt, Jonathan <jonathan.cavitt@intel.com>; intel-gfx@lists.freedesktop.org
Cc: Dutt, Sudeep <sudeep.dutt@intel.com>; thomas.hellstrom@linux.intel.com; maarten.lankhorst@linux.intel.com; Vetter, Daniel <daniel.vetter@intel.com>; De Marchi, Lucas <lucas.demarchi@intel.com>; chris.p.wilson@linux.intel.com
Subject: Re: [PATCH v5 1/2] drm/i915: Migrate platform-dependent mock hugepage selftests to live
>
>On 28/02/2023 14:08, Matthew Auld wrote:
>> On 27/02/2023 17:19, Jonathan Cavitt wrote:
>>> Convert the igt_mock_ppgtt_huge_fill and igt_mock_ppgtt_64K mock 
>>> selftests into
>>> live selftests as their requirements have recently become 
>>> platform-dependent.
>>> Additionally, apply necessary platform dependency checks to these tests.
>>>
>>> v2: Reorder
>>>
>>> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
>> 
>> r-b still stands for the series. Note that CI is busted atm though, so 
>> we can't merge this yet. Likely need to re-trigger testing for the 
>> series once CI/drm-tip is working again.
>
>CI looks to be back. Can you trigger a retest through patchwork, or 
>resend the series?

The retest was submitted, but the mock hugepages subtest returned with a failure.
It didn't do so in the first run, nor did it fail in the prior revision (the one with the
incorrect patch order).  Do you have any guidance for forward progress?
-Jonathan Cavitt

>
>> 
>> 
>>> ---
>>>   .../gpu/drm/i915/gem/selftests/huge_pages.c   | 22 ++++++++++++++-----
>>>   1 file changed, 17 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c 
>>> b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>>> index defece0bcb81..375f119ab261 100644
>>> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>>> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>>> @@ -710,7 +710,7 @@ static void close_object_list(struct list_head 
>>> *objects,
>>>       }
>>>   }
>>> -static int igt_mock_ppgtt_huge_fill(void *arg)
>>> +static int igt_ppgtt_huge_fill(void *arg)
>>>   {
>>>       struct i915_ppgtt *ppgtt = arg;
>>>       struct drm_i915_private *i915 = ppgtt->vm.i915;
>>> @@ -784,7 +784,8 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>>>           GEM_BUG_ON(!expected_gtt);
>>>           GEM_BUG_ON(size);
>>> -        if (expected_gtt & I915_GTT_PAGE_SIZE_4K)
>>> +        if (expected_gtt & I915_GTT_PAGE_SIZE_4K &&
>>> +            GRAPHICS_VER_FULL(i915) < IP_VER(12, 50))
>>>               expected_gtt &= ~I915_GTT_PAGE_SIZE_64K;
>>>           i915_vma_unpin(vma);
>>> @@ -831,7 +832,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>>>       return err;
>>>   }
>>> -static int igt_mock_ppgtt_64K(void *arg)
>>> +static int igt_ppgtt_64K(void *arg)
>>>   {
>>>       struct i915_ppgtt *ppgtt = arg;
>>>       struct drm_i915_private *i915 = ppgtt->vm.i915;
>>> @@ -913,6 +914,17 @@ static int igt_mock_ppgtt_64K(void *arg)
>>>           unsigned int offset = objects[i].offset;
>>>           unsigned int flags = PIN_USER;
>>> +        /*
>>> +         * For modern GTT models, the requirements for marking a 
>>> page-table
>>> +         * as 64K have been relaxed.  Account for this.
>>> +         */
>>> +
>>> +        if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
>>> +            expected_gtt = 0;
>>> +            expected_gtt |= size & (SZ_64K | SZ_2M) ? 
>>> I915_GTT_PAGE_SIZE_64K : 0;
>>> +            expected_gtt |= size & SZ_4K ? I915_GTT_PAGE_SIZE_4K : 0;
>>> +        }
>>> +
>>>           for (single = 0; single <= 1; single++) {
>>>               obj = fake_huge_pages_object(i915, size, !!single);
>>>               if (IS_ERR(obj))
>>> @@ -1910,8 +1922,6 @@ int i915_gem_huge_page_mock_selftests(void)
>>>           SUBTEST(igt_mock_exhaust_device_supported_pages),
>>>           SUBTEST(igt_mock_memory_region_huge_pages),
>>>           SUBTEST(igt_mock_ppgtt_misaligned_dma),
>>> -        SUBTEST(igt_mock_ppgtt_huge_fill),
>>> -        SUBTEST(igt_mock_ppgtt_64K),
>>>       };
>>>       struct drm_i915_private *dev_priv;
>>>       struct i915_ppgtt *ppgtt;
>>> @@ -1962,6 +1972,8 @@ int i915_gem_huge_page_live_selftests(struct 
>>> drm_i915_private *i915)
>>>           SUBTEST(igt_ppgtt_sanity_check),
>>>           SUBTEST(igt_ppgtt_compact),
>>>           SUBTEST(igt_ppgtt_mixed),
>>> +        SUBTEST(igt_ppgtt_huge_fill),
>>> +        SUBTEST(igt_ppgtt_64K),
>>>       };
>>>       if (!HAS_PPGTT(i915)) {
>
Matthew Auld March 13, 2023, 5:24 p.m. UTC | #5
On 13/03/2023 15:57, Cavitt, Jonathan wrote:
> -----Original Message-----
> From: Auld, Matthew <matthew.auld@intel.com>
> Sent: Thursday, March 2, 2023 2:36 AM
> To: Cavitt, Jonathan <jonathan.cavitt@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: Dutt, Sudeep <sudeep.dutt@intel.com>; thomas.hellstrom@linux.intel.com; maarten.lankhorst@linux.intel.com; Vetter, Daniel <daniel.vetter@intel.com>; De Marchi, Lucas <lucas.demarchi@intel.com>; chris.p.wilson@linux.intel.com
> Subject: Re: [PATCH v5 1/2] drm/i915: Migrate platform-dependent mock hugepage selftests to live
>>
>> On 28/02/2023 14:08, Matthew Auld wrote:
>>> On 27/02/2023 17:19, Jonathan Cavitt wrote:
>>>> Convert the igt_mock_ppgtt_huge_fill and igt_mock_ppgtt_64K mock
>>>> selftests into
>>>> live selftests as their requirements have recently become
>>>> platform-dependent.
>>>> Additionally, apply necessary platform dependency checks to these tests.
>>>>
>>>> v2: Reorder
>>>>
>>>> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
>>>
>>> r-b still stands for the series. Note that CI is busted atm though, so
>>> we can't merge this yet. Likely need to re-trigger testing for the
>>> series once CI/drm-tip is working again.
>>
>> CI looks to be back. Can you trigger a retest through patchwork, or
>> resend the series?
> 
> The retest was submitted, but the mock hugepages subtest returned with a failure.
> It didn't do so in the first run, nor did it fail in the prior revision (the one with the
> incorrect patch order).  Do you have any guidance for forward progress?

I think there were some more CI issues. But from the logs it looks like 
we just need to fix the arg handling and related bits, AFAICT. Sent a 
version to trybot (only compile tested):

https://patchwork.freedesktop.org/patch/526566/?series=115072&rev=1

> -Jonathan Cavitt
> 
>>
>>>
>>>
>>>> ---
>>>>    .../gpu/drm/i915/gem/selftests/huge_pages.c   | 22 ++++++++++++++-----
>>>>    1 file changed, 17 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>>>> b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>>>> index defece0bcb81..375f119ab261 100644
>>>> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>>>> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>>>> @@ -710,7 +710,7 @@ static void close_object_list(struct list_head
>>>> *objects,
>>>>        }
>>>>    }
>>>> -static int igt_mock_ppgtt_huge_fill(void *arg)
>>>> +static int igt_ppgtt_huge_fill(void *arg)
>>>>    {
>>>>        struct i915_ppgtt *ppgtt = arg;
>>>>        struct drm_i915_private *i915 = ppgtt->vm.i915;
>>>> @@ -784,7 +784,8 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>>>>            GEM_BUG_ON(!expected_gtt);
>>>>            GEM_BUG_ON(size);
>>>> -        if (expected_gtt & I915_GTT_PAGE_SIZE_4K)
>>>> +        if (expected_gtt & I915_GTT_PAGE_SIZE_4K &&
>>>> +            GRAPHICS_VER_FULL(i915) < IP_VER(12, 50))
>>>>                expected_gtt &= ~I915_GTT_PAGE_SIZE_64K;
>>>>            i915_vma_unpin(vma);
>>>> @@ -831,7 +832,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
>>>>        return err;
>>>>    }
>>>> -static int igt_mock_ppgtt_64K(void *arg)
>>>> +static int igt_ppgtt_64K(void *arg)
>>>>    {
>>>>        struct i915_ppgtt *ppgtt = arg;
>>>>        struct drm_i915_private *i915 = ppgtt->vm.i915;
>>>> @@ -913,6 +914,17 @@ static int igt_mock_ppgtt_64K(void *arg)
>>>>            unsigned int offset = objects[i].offset;
>>>>            unsigned int flags = PIN_USER;
>>>> +        /*
>>>> +         * For modern GTT models, the requirements for marking a
>>>> page-table
>>>> +         * as 64K have been relaxed.  Account for this.
>>>> +         */
>>>> +
>>>> +        if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
>>>> +            expected_gtt = 0;
>>>> +            expected_gtt |= size & (SZ_64K | SZ_2M) ?
>>>> I915_GTT_PAGE_SIZE_64K : 0;
>>>> +            expected_gtt |= size & SZ_4K ? I915_GTT_PAGE_SIZE_4K : 0;
>>>> +        }
>>>> +
>>>>            for (single = 0; single <= 1; single++) {
>>>>                obj = fake_huge_pages_object(i915, size, !!single);
>>>>                if (IS_ERR(obj))
>>>> @@ -1910,8 +1922,6 @@ int i915_gem_huge_page_mock_selftests(void)
>>>>            SUBTEST(igt_mock_exhaust_device_supported_pages),
>>>>            SUBTEST(igt_mock_memory_region_huge_pages),
>>>>            SUBTEST(igt_mock_ppgtt_misaligned_dma),
>>>> -        SUBTEST(igt_mock_ppgtt_huge_fill),
>>>> -        SUBTEST(igt_mock_ppgtt_64K),
>>>>        };
>>>>        struct drm_i915_private *dev_priv;
>>>>        struct i915_ppgtt *ppgtt;
>>>> @@ -1962,6 +1972,8 @@ int i915_gem_huge_page_live_selftests(struct
>>>> drm_i915_private *i915)
>>>>            SUBTEST(igt_ppgtt_sanity_check),
>>>>            SUBTEST(igt_ppgtt_compact),
>>>>            SUBTEST(igt_ppgtt_mixed),
>>>> +        SUBTEST(igt_ppgtt_huge_fill),
>>>> +        SUBTEST(igt_ppgtt_64K),
>>>>        };
>>>>        if (!HAS_PPGTT(i915)) {
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
index defece0bcb81..375f119ab261 100644
--- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
@@ -710,7 +710,7 @@  static void close_object_list(struct list_head *objects,
 	}
 }
 
-static int igt_mock_ppgtt_huge_fill(void *arg)
+static int igt_ppgtt_huge_fill(void *arg)
 {
 	struct i915_ppgtt *ppgtt = arg;
 	struct drm_i915_private *i915 = ppgtt->vm.i915;
@@ -784,7 +784,8 @@  static int igt_mock_ppgtt_huge_fill(void *arg)
 		GEM_BUG_ON(!expected_gtt);
 		GEM_BUG_ON(size);
 
-		if (expected_gtt & I915_GTT_PAGE_SIZE_4K)
+		if (expected_gtt & I915_GTT_PAGE_SIZE_4K &&
+		    GRAPHICS_VER_FULL(i915) < IP_VER(12, 50))
 			expected_gtt &= ~I915_GTT_PAGE_SIZE_64K;
 
 		i915_vma_unpin(vma);
@@ -831,7 +832,7 @@  static int igt_mock_ppgtt_huge_fill(void *arg)
 	return err;
 }
 
-static int igt_mock_ppgtt_64K(void *arg)
+static int igt_ppgtt_64K(void *arg)
 {
 	struct i915_ppgtt *ppgtt = arg;
 	struct drm_i915_private *i915 = ppgtt->vm.i915;
@@ -913,6 +914,17 @@  static int igt_mock_ppgtt_64K(void *arg)
 		unsigned int offset = objects[i].offset;
 		unsigned int flags = PIN_USER;
 
+		/*
+		 * For modern GTT models, the requirements for marking a page-table
+		 * as 64K have been relaxed.  Account for this.
+		 */
+
+		if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+			expected_gtt = 0;
+			expected_gtt |= size & (SZ_64K | SZ_2M) ? I915_GTT_PAGE_SIZE_64K : 0;
+			expected_gtt |= size & SZ_4K ? I915_GTT_PAGE_SIZE_4K : 0;
+		}
+
 		for (single = 0; single <= 1; single++) {
 			obj = fake_huge_pages_object(i915, size, !!single);
 			if (IS_ERR(obj))
@@ -1910,8 +1922,6 @@  int i915_gem_huge_page_mock_selftests(void)
 		SUBTEST(igt_mock_exhaust_device_supported_pages),
 		SUBTEST(igt_mock_memory_region_huge_pages),
 		SUBTEST(igt_mock_ppgtt_misaligned_dma),
-		SUBTEST(igt_mock_ppgtt_huge_fill),
-		SUBTEST(igt_mock_ppgtt_64K),
 	};
 	struct drm_i915_private *dev_priv;
 	struct i915_ppgtt *ppgtt;
@@ -1962,6 +1972,8 @@  int i915_gem_huge_page_live_selftests(struct drm_i915_private *i915)
 		SUBTEST(igt_ppgtt_sanity_check),
 		SUBTEST(igt_ppgtt_compact),
 		SUBTEST(igt_ppgtt_mixed),
+		SUBTEST(igt_ppgtt_huge_fill),
+		SUBTEST(igt_ppgtt_64K),
 	};
 
 	if (!HAS_PPGTT(i915)) {