From: jsg Date: Tue, 8 Aug 2023 10:16:51 +0000 (+0000) Subject: adapt more functions to the i915_gem_phys hack X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0db1f4c520efc3c84762bae533bac016a1d36f83;p=openbsd adapt more functions to the i915_gem_phys hack linux stashes a dma va in the vm_page pointer part of the scatterlist. We use a pointer to a struct with the dma tag and map. --- diff --git a/sys/dev/pci/drm/i915/gem/i915_gem_phys.c b/sys/dev/pci/drm/i915/gem/i915_gem_phys.c index 5f73a07e487..cc496f702a4 100644 --- a/sys/dev/pci/drm/i915/gem/i915_gem_phys.c +++ b/sys/dev/pci/drm/i915/gem/i915_gem_phys.c @@ -205,7 +205,12 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, int i915_gem_object_pwrite_phys(struct drm_i915_gem_object *obj, const struct drm_i915_gem_pwrite *args) { +#ifdef __linux__ void *vaddr = sg_page(obj->mm.pages->sgl) + args->offset; +#else + struct drm_dmamem *dmah = (void *)sg_page(obj->mm.pages->sgl); + void *vaddr = dmah->kva + args->offset; +#endif char __user *user_data = u64_to_user_ptr(args->data_ptr); struct drm_i915_private *i915 = to_i915(obj->base.dev); int err; @@ -236,7 +241,12 @@ int i915_gem_object_pwrite_phys(struct drm_i915_gem_object *obj, int i915_gem_object_pread_phys(struct drm_i915_gem_object *obj, const struct drm_i915_gem_pread *args) { +#ifdef __linux__ void *vaddr = sg_page(obj->mm.pages->sgl) + args->offset; +#else + struct drm_dmamem *dmah = (void *)sg_page(obj->mm.pages->sgl); + void *vaddr = dmah->kva + args->offset; +#endif char __user *user_data = u64_to_user_ptr(args->data_ptr); int err;