Re: [Intel-gfx] [RFC PATCH 10/42] drm/i915/lmem: add helper to get CPU visible pfn

2019-02-14 Thread Chris Wilson
Quoting Matthew Auld (2019-02-14 14:57:08)
> From: Abdiel Janulgue 

Why?

So can something without a CPU visible struct page even have a pfn?

> Signed-off-by: Abdiel Janulgue 
> Signed-off-by: Matthew Auld 
> Cc: Joonas Lahtinen 
> ---
>  drivers/gpu/drm/i915/intel_region_lmem.c | 11 +++
>  drivers/gpu/drm/i915/intel_region_lmem.h |  3 +++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_region_lmem.c 
> b/drivers/gpu/drm/i915/intel_region_lmem.c
> index 4a205639cbb6..b398becb2733 100644
> --- a/drivers/gpu/drm/i915/intel_region_lmem.c
> +++ b/drivers/gpu/drm/i915/intel_region_lmem.c
> @@ -65,6 +65,17 @@ static const struct intel_memory_region_ops 
> region_lmem_ops = {
> .object_create = region_lmem_object_create,
>  };
>  
> +unsigned long i915_gem_object_lmem_io_pfn(struct drm_i915_gem_object *obj,
> + unsigned long n)
> +{
> +   struct intel_memory_region *mem = obj->memory_region;
> +   resource_size_t offset;
> +
> +   offset = i915_gem_object_get_dma_address(obj, n);

Magic of type convenience?

We definitely do not want to be returning a dma_address as a CPU
address. The semantics here needs to be cleaned up.
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [RFC PATCH 10/42] drm/i915/lmem: add helper to get CPU visible pfn

2019-02-14 Thread Matthew Auld
From: Abdiel Janulgue 

Signed-off-by: Abdiel Janulgue 
Signed-off-by: Matthew Auld 
Cc: Joonas Lahtinen 
---
 drivers/gpu/drm/i915/intel_region_lmem.c | 11 +++
 drivers/gpu/drm/i915/intel_region_lmem.h |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_region_lmem.c 
b/drivers/gpu/drm/i915/intel_region_lmem.c
index 4a205639cbb6..b398becb2733 100644
--- a/drivers/gpu/drm/i915/intel_region_lmem.c
+++ b/drivers/gpu/drm/i915/intel_region_lmem.c
@@ -65,6 +65,17 @@ static const struct intel_memory_region_ops region_lmem_ops 
= {
.object_create = region_lmem_object_create,
 };
 
+unsigned long i915_gem_object_lmem_io_pfn(struct drm_i915_gem_object *obj,
+ unsigned long n)
+{
+   struct intel_memory_region *mem = obj->memory_region;
+   resource_size_t offset;
+
+   offset = i915_gem_object_get_dma_address(obj, n);
+
+   return (mem->io_start + offset) >> PAGE_SHIFT;
+}
+
 bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
 {
struct intel_memory_region *region = obj->memory_region;
diff --git a/drivers/gpu/drm/i915/intel_region_lmem.h 
b/drivers/gpu/drm/i915/intel_region_lmem.h
index 7204f61aab44..1aa24bd28690 100644
--- a/drivers/gpu/drm/i915/intel_region_lmem.h
+++ b/drivers/gpu/drm/i915/intel_region_lmem.h
@@ -25,6 +25,9 @@
 #ifndef __INTEL_REGION_LMEM_H
 #define __INTEL_REGION_LMEM_H
 
+unsigned long i915_gem_object_lmem_io_pfn(struct drm_i915_gem_object *obj,
+ unsigned long n);
+
 bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
 
 struct drm_i915_gem_object *
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx