Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 /*
0003  * Copyright © 2019 Intel Corporation
0004  */
0005 
0006 #ifndef __I915_MEMCPY_H__
0007 #define __I915_MEMCPY_H__
0008 
0009 #include <linux/types.h>
0010 
0011 struct drm_i915_private;
0012 
0013 void i915_memcpy_init_early(struct drm_i915_private *i915);
0014 
0015 bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len);
0016 void i915_unaligned_memcpy_from_wc(void *dst, const void *src, unsigned long len);
0017 
0018 /* The movntdqa instructions used for memcpy-from-wc require 16-byte alignment,
0019  * as well as SSE4.1 support. i915_memcpy_from_wc() will report if it cannot
0020  * perform the operation. To check beforehand, pass in the parameters to
0021  * to i915_can_memcpy_from_wc() - since we only care about the low 4 bits,
0022  * you only need to pass in the minor offsets, page-aligned pointers are
0023  * always valid.
0024  *
0025  * For just checking for SSE4.1, in the foreknowledge that the future use
0026  * will be correctly aligned, just use i915_has_memcpy_from_wc().
0027  */
0028 #define i915_can_memcpy_from_wc(dst, src, len) \
0029     i915_memcpy_from_wc((void *)((unsigned long)(dst) | (unsigned long)(src) | (len)), NULL, 0)
0030 
0031 #define i915_has_memcpy_from_wc() \
0032     i915_memcpy_from_wc(NULL, NULL, 0)
0033 
0034 #endif /* __I915_MEMCPY_H__ */