i915/gem_softpin: Check the last 32b page is excluded
PATCH 1/1 i915/gem_softpin: Check the last 32b page is excluded
In order to prevent issues with 32b stateless address, the last page under 4G is excluded for non-48b objects.
--- tests/i915/gem_softpin.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
tests/i915/gem_softpin.c +37 -0
@@ -156,6 +156,39 @@ static void test_zero(int i915)gem_close (i915, object.handle); } +static void test_32b_last_page (int i915) +{ +uint64_t sz, gtt =gem_aperture_size (i915); +struct drm_i915_gem_exec_object2 object = { + .flags =EXEC_OBJECT_PINNED , + }; +struct drm_i915_gem_execbuffer2 execbuf = { + .buffers_ptr =to_user_pointer (&object), + .buffer_count =1 , + }; + +/* +* The last page under 32b is excluded for !48b objects in order to +* prevent issues with stateless addressing. +*/ + +igt_require (gtt >=1ull <<32 ); + object.handle =batch_create (i915, &sz), + + object.offset =1ull <<32 ; + object.offset -= sz; +igt_assert_f (__gem_execbuf (i915, &execbuf) == -EINVAL , +"execbuf succeeded with object.offset=%llx + %" PRIx64"\n" , + object.offset, sz); + + object.offset -=4096 ; +igt_assert_f (__gem_execbuf (i915, &execbuf) ==0 , +"execbuf failed with object.offset=%llx + %" PRIx64"\n" , + object.offset, sz); + +gem_close (i915, object.handle); +} +static void test_softpin (int fd) {const uint32_t size =1024 *1024 ;
@@ -622,6 +655,10 @@ igt_mainigt_require (gem_uses_full_ppgtt (fd));test_zero (fd); } + igt_subtest("32b-excludes-last-page") { +igt_require (gem_uses_full_ppgtt (fd)); +test_32b_last_page (fd); + } igt_subtest("softpin")test_softpin (fd);igt_subtest ("overlap" )
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 34 lines
-----Original Message-----
From: Chris Wilson <[email protected]>
Sent: Wednesday, December 16, 2020 12:53 PM
To: [email protected]
Cc: Chris Wilson <[email protected]>; Tang, CQ <[email protected]>
Subject: [PATCH i-g-t] i915/gem_softpin: Check the last 32b page is excludedIn order to prevent issues with 32b stateless address, the last page under 4G is excluded for non-48b objects.
Signed-off-by Chris Wilson <[email protected]>Cc CQ Tang <[email protected]>--- tests/i915/gem_softpin.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)tests/i915/gem_softpin.c index renamed from tests/i915/gem_softpin.c +0
-0
a3e6dcac3..703beb77d100644tests/i915/gem_softpin.c +7
-0@@ -156,6 +156,39 @@ static void test_zero(int i915)gem_close (i915, object.handle); } +static void test_32b_last_page (int i915) { +uint64_t sz, gtt =gem_aperture_size (i915); +struct drm_i915_gem_exec_object2 object = { + .flags =EXEC_OBJECT_PINNED , + }; +struct drm_i915_gem_execbuffer2 execbuf = { + .buffers_ptr =to_user_pointer (&object),
tests/i915/gem_softpin.c static void test_zero(int i915) · line 175
Quoted 10 lines
tests/i915/gem_softpin.c +10
-0+ .buffer_count = 1, + }; + +/* +* The last page under 32b is excluded for !48b objects in order to +* prevent issues with stateless addressing. +*/ + +igt_require (gtt >=1ull <<32 ); + object.handle = batch_create(i915, &sz),
Where is this batch_create() version?
--CQ
Quoted 31 lines
tests/i915/gem_softpin.c +20
-1+ + object.offset =1ull <<32 ; + object.offset -= sz; +igt_assert_f (__gem_execbuf (i915, &execbuf) == -EINVAL , +"execbuf succeeded with object.offset=%llx + %"PRIx64"\n", + object.offset, sz); + + object.offset -=4096 ; +igt_assert_f (__gem_execbuf (i915, &execbuf) ==0 , +"execbuf failed with object.offset=%llx + %" PRIx64"\n" , + object.offset, sz); + +gem_close (i915, object.handle); +} +static void test_softpin (int fd) {const uint32_t size =1024 *1024 ;@@ -622,6 +655,10 @@ igt_mainigt_require (gem_uses_full_ppgtt (fd));test_zero (fd); } + igt_subtest("32b-excludes-last-page") { +igt_require (gem_uses_full_ppgtt (fd)); +test_32b_last_page (fd); + } igt_subtest("softpin")test_softpin (fd);igt_subtest ("overlap" ) --
Quoted 1 line
2.29.2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Tang, CQ (2020-12-16 21:23:04)
Quoted 38 lines
Quoted 38 lines
-----Original Message-----
From: Chris Wilson <[email protected]>
Sent: Wednesday, December 16, 2020 12:53 PM
To: [email protected]
Cc: Chris Wilson <[email protected]>; Tang, CQ <[email protected]>
Subject: [PATCH i-g-t] i915/gem_softpin: Check the last 32b page is excludedIn order to prevent issues with 32b stateless address, the last page under 4G is excluded for non-48b objects.
Signed-off-by Chris Wilson <[email protected]>Cc CQ Tang <[email protected]>--- tests/i915/gem_softpin.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)tests/i915/gem_softpin.c index renamed from tests/i915/gem_softpin.c +0
-0
a3e6dcac3..703beb77d100644tests/i915/gem_softpin.c +11
-0@@ -156,6 +156,39 @@ static void test_zero(int i915)gem_close (i915, object.handle); } +static void test_32b_last_page (int i915) { +uint64_t sz, gtt =gem_aperture_size (i915); +struct drm_i915_gem_exec_object2 object = { + .flags =EXEC_OBJECT_PINNED , + }; +struct drm_i915_gem_execbuffer2 execbuf = { + .buffers_ptr =to_user_pointer (&object), + .buffer_count =1 , + }; + +/*
Quoted 8 lines
tests/i915/gem_softpin.c static void test_zero(int i915) · line 176
Quoted 6 lines
tests/i915/gem_softpin.c +6
-0+* The last page under 32b is excluded for !48b objects in order to +* prevent issues with stateless addressing. +*/ + +igt_require (gtt >=1ull <<32 ); + object.handle = batch_create(i915, &sz),Where is this
batch_create()version?
In upstream. Just the regular batch_create() but returning the allocated size.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx