[Intel-gfx] [PATCH 4/7] drm/i915/guc: use the memcpy_from_wc call from the drm
Lucas De Marchi
lucas.demarchi at intel.com
Tue Mar 1 08:07:23 UTC 2022
On Tue, Feb 22, 2022 at 08:22:03PM +0530, Balasubramani Vivekanandan wrote:
>memcpy_from_wc functions in i915_memcpy.c will be removed and replaced
>by the implementation in drm_cache.c.
>Updated to use the functions provided by drm_cache.c.
>
>Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan at intel.com>
>---
> drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
>index b53f61f3101f..1990762f07de 100644
>--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
>+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
>@@ -3,6 +3,7 @@
> * Copyright © 2014-2019 Intel Corporation
> */
>
>+#include <drm/drm_cache.h>
> #include <linux/debugfs.h>
>
> #include "gt/intel_gt.h"
>@@ -205,6 +206,7 @@ static void guc_read_update_log_buffer(struct intel_guc_log *log)
> enum guc_log_buffer_type type;
> void *src_data, *dst_data;
> bool new_overflow;
>+ struct iosys_map src_map;
>
> mutex_lock(&log->relay.lock);
>
>@@ -281,14 +283,17 @@ static void guc_read_update_log_buffer(struct intel_guc_log *log)
> }
>
> /* Just copy the newly written data */
>+ iosys_map_set_vaddr(&src_map, src_data);
src is not guaranteed to come from system memory.... src is coming from:
intel_guc_allocate_vma(), that may call either i915_gem_object_create_lmem()
or i915_gem_object_create_shmem() depending if the platforma has lmem.
I guess you will need to check if the obj is in lmem and initialize
src_map accordingly.
Lucas De Marchi
> if (read_offset > write_offset) {
>- i915_memcpy_from_wc(dst_data, src_data, write_offset);
>+ drm_memcpy_from_wc_vaddr(dst_data, &src_map,
>+ write_offset);
> bytes_to_copy = buffer_size - read_offset;
> } else {
> bytes_to_copy = write_offset - read_offset;
> }
>- i915_memcpy_from_wc(dst_data + read_offset,
>- src_data + read_offset, bytes_to_copy);
>+ iosys_map_incr(&src_map, read_offset);
>+ drm_memcpy_from_wc_vaddr(dst_data + read_offset, &src_map,
>+ bytes_to_copy);
>
> src_data += buffer_size;
> dst_data += buffer_size;
>--
>2.25.1
>
More information about the Intel-gfx
mailing list