Skip to contentSkip to conversation

drm/i915: Return mappable aperture size

RFC PATCH In review Antonio Argenziano 3 participants 6 messages Mar 7, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 drm/i915: Return mappable aperture size

Extend the API to return the mappable aperture size directly in the I915_GEM_GET_APERTURE IOCTL.

Cc Matthew Auld <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 include/uapi/drm/i915_drm.h     | 5 +++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +2 -0
index 0b23cf3be718..d109f6dbe992 100644
@@ -221,6 +221,8 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
 	args->aper_size = ggtt->vm.total;
 	args->aper_available_size = args->aper_size - pinned;
 
+	args->mappable_aperture_size = ggtt->mappable_end;
+
 	return 0;
 }
 
include/uapi/drm/i915_drm.h +5 -0
index aa2d4c73a97d..bcab66664579 100644
@@ -1284,6 +1284,11 @@ struct drm_i915_gem_get_aperture {
 	 * bytes
 	 */
 	__u64 aper_available_size;
+
+	/**
+	 * Total size of the mappable aperture.
+	 */
+	__u64 mappable_aperture_size;
 };
 
 struct drm_i915_get_pipe_from_crtc_id {
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

RFC PATCH 2/2 drm/i915: Account for platform without mappable aperture when returning size

Some devices will not expose a mappable aperture anymore so we need to return an appropriate value in that case.

Cc Matthew Auld <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +2 -1
index d109f6dbe992..5125a5329100 100644
@@ -221,7 +221,8 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
 	args->aper_size = ggtt->vm.total;
 	args->aper_available_size = args->aper_size - pinned;
 
-	args->mappable_aperture_size = ggtt->mappable_end;
+	args->mappable_aperture_size =
+			HAS_MAPPABLE_APERTURE(to_i915(dev)) ? ggtt->mappable_end : (__u64)-ENODEV;
 
 	return 0;
 }
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [RFC PATCH 2/2] drm/i915: Account for platform without mappable aperture when returning size

Quoting Antonio Argenziano (2019-03-07 19:11:15)

Quoted 17 lines

Some devices will not expose a mappable aperture anymore so we need to return an appropriate value in that case.

Cc Matthew Auld <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index d109f6dbe992..5125a5329100 100644

drivers/gpu/drm/i915/i915_gem.c i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, · line 225

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c +2 -1
@@ -221,7 +221,8 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
        args->aper_size = ggtt->vm.total;
        args->aper_available_size = args->aper_size - pinned;
 
-       args->mappable_aperture_size = ggtt->mappable_end;
+       args->mappable_aperture_size =
+                       HAS_MAPPABLE_APERTURE(to_i915(dev)) ? ggtt->mappable_end : (__u64)-ENODEV;

Looking above, args->aper_size will also be 0 so that'll be a good clue for ENODEV. So maybe we can get away with the ambiguous 0 here as we can use aper_size to differentiate the classes of HW.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [RFC PATCH 2/2] drm/i915: Account for platform without mappable aperture when returning size

Quoted 21 lines · Chris Wilson

Quoting Antonio Argenziano (2019-03-07 19:11:15)

Quoted 20 lines

Some devices will not expose a mappable aperture anymore so we need to return an appropriate value in that case.

Cc Matthew Auld <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
  drivers/gpu/drm/i915/i915_gem.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index d109f6dbe992..5125a5329100 100644
@@ -221,7 +221,8 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
         args->aper_size = ggtt->vm.total;
         args->aper_available_size = args->aper_size - pinned;
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_gem.c i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, · line 225

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem.c +2 -1
-       args->mappable_aperture_size = ggtt->mappable_end;
+       args->mappable_aperture_size =
+                       HAS_MAPPABLE_APERTURE(to_i915(dev)) ? ggtt->mappable_end : (__u64)-ENODEV;

Looking above, args->aper_size will also be 0 so that'll be a good clue

Is it? ggtt should still be there so that shouldn't be zero.

Antonio

Quoted 4 lines

for ENODEV. So maybe we can get away with the ambiguous 0 here as we can use aper_size to differentiate the classes of HW.
-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [RFC PATCH 2/2] drm/i915: Account for platform without mappable aperture when returning size

Quoting Antonio Argenziano (2019-03-07 22:21:17)

Quoted 24 lines · Chris Wilson
Quoted 21 lines

Quoting Antonio Argenziano (2019-03-07 19:11:15)

Quoted 20 lines

Some devices will not expose a mappable aperture anymore so we need to return an appropriate value in that case.

Cc Matthew Auld <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Chris Wilson <[email protected]>
---
  drivers/gpu/drm/i915/i915_gem.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index d109f6dbe992..5125a5329100 100644
@@ -221,7 +221,8 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
         args->aper_size = ggtt->vm.total;
         args->aper_available_size = args->aper_size - pinned;
 
Quoted 7 lines
Quoted 5 lines

drivers/gpu/drm/i915/i915_gem.c i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, · line 225

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem.c +2 -1
-       args->mappable_aperture_size = ggtt->mappable_end;
+       args->mappable_aperture_size =
+                       HAS_MAPPABLE_APERTURE(to_i915(dev)) ? ggtt->mappable_end : (__u64)-ENODEV;

Looking above, args->aper_size will also be 0 so that'll be a good clue

Is it? ggtt should still be there so that shouldn't be zero.

Fair enough. We could lie though. Userspace isn't allowed to directly access aper after gen7 (full-ppgtt), only via GGTT mmaps. With no more GGTT mmaps, aper_size is ostensibly meaningless.

However, you never know, so keeping the information we do have and reporting no mappable HW as ENODEV has a certain charm. Let's see if anyone else has a better idea.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✗ Fi.CI.BAT: failure for series starting with [RFC,1/2] drm/i915: Return mappable aperture size

In reply to Antonio Argenziano
== Series Details ==

== Series Details ==

Series: series starting with [RFC,1/2] drm/i915: Return mappable aperture size
URL : https://patchwork.freedesktop.org/series/57705/
State : failure

== Summary ==

CALL scripts/checksyscalls.sh
DESCEND objtool
CHK include/generated/compile.h
CC [M] drivers/gpu/drm/i915/i915_gem.o
drivers/gpu/drm/i915/i915_gem.c: In function ‘i915_gem_get_aperture_ioctl’:
drivers/gpu/drm/i915/i915_gem.c:225:4: error: implicit declaration of function ‘HAS_MAPPABLE_APERTURE’ [-Werror=implicit-function-declaration]

    HAS_MAPPABLE_APERTURE(to_i915(dev)) ? ggtt->mappable_end : (__u64)-ENODEV;
    ^~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
scripts/Makefile.build:276: recipe for target 'drivers/gpu/drm/i915/i915_gem.o' failed make[4]: *** [drivers/gpu/drm/i915/i915_gem.o] Error 1 scripts/Makefile.build:492: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:492: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:492: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:1043: recipe for target 'drivers' failed
make: *** [drivers] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx