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

Chris Wilson
2019-02-14T15:33:17Z

Quoting Matthew Auld (2019-02-14 14:57:08)
> From: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>

Why?

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

> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
> 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