Home | History | Annotate | Line # | Download | only in i915
      1  1.1  riastrad /*	$NetBSD: i915_memcpy.h,v 1.2 2021/12/18 23:45:28 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /* SPDX-License-Identifier: MIT */
      4  1.1  riastrad /*
      5  1.1  riastrad  * Copyright  2019 Intel Corporation
      6  1.1  riastrad  */
      7  1.1  riastrad 
      8  1.1  riastrad #ifndef __I915_MEMCPY_H__
      9  1.1  riastrad #define __I915_MEMCPY_H__
     10  1.1  riastrad 
     11  1.1  riastrad #include <linux/types.h>
     12  1.1  riastrad 
     13  1.1  riastrad struct drm_i915_private;
     14  1.1  riastrad 
     15  1.1  riastrad void i915_memcpy_init_early(struct drm_i915_private *i915);
     16  1.1  riastrad 
     17  1.1  riastrad bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len);
     18  1.1  riastrad void i915_unaligned_memcpy_from_wc(void *dst, void *src, unsigned long len);
     19  1.1  riastrad 
     20  1.1  riastrad /* The movntdqa instructions used for memcpy-from-wc require 16-byte alignment,
     21  1.1  riastrad  * as well as SSE4.1 support. i915_memcpy_from_wc() will report if it cannot
     22  1.1  riastrad  * perform the operation. To check beforehand, pass in the parameters to
     23  1.1  riastrad  * to i915_can_memcpy_from_wc() - since we only care about the low 4 bits,
     24  1.1  riastrad  * you only need to pass in the minor offsets, page-aligned pointers are
     25  1.1  riastrad  * always valid.
     26  1.1  riastrad  *
     27  1.1  riastrad  * For just checking for SSE4.1, in the foreknowledge that the future use
     28  1.1  riastrad  * will be correctly aligned, just use i915_has_memcpy_from_wc().
     29  1.1  riastrad  */
     30  1.1  riastrad #define i915_can_memcpy_from_wc(dst, src, len) \
     31  1.1  riastrad 	i915_memcpy_from_wc((void *)((unsigned long)(dst) | (unsigned long)(src) | (len)), NULL, 0)
     32  1.1  riastrad 
     33  1.1  riastrad #define i915_has_memcpy_from_wc() \
     34  1.1  riastrad 	i915_memcpy_from_wc(NULL, NULL, 0)
     35  1.1  riastrad 
     36  1.1  riastrad #endif /* __I915_MEMCPY_H__ */
     37