/** * i915_memcpy_from_wc: perform an accelerated *aligned* read from WC * @dst: destination pointer * @src: source pointer * @len: how many bytes to copy * * i915_memcpy_from_wc copies @len bytes from @src to @dst using * non-temporal instructions where available. Note that all arguments * (@src, @dst) must be aligned to 16 bytes and @len must be a multiple * of 16. * * To test whether accelerated reads from WC are supported, use * i915_memcpy_from_wc(NULL, NULL, 0); * * Returns true if the copy was successful, false if the preconditions * are not met.
*/ bool i915_memcpy_from_wc(void *dst, constvoid *src, unsignedlong len)
{ if (unlikely(((unsignedlong)dst | (unsignedlong)src | len) & 15)) returnfalse;
if (static_branch_likely(&has_movntdqa)) { if (likely(len))
__memcpy_ntdqa(dst, src, len >> 4); returntrue;
}
returnfalse;
}
/** * i915_unaligned_memcpy_from_wc: perform a mostly accelerated read from WC * @dst: destination pointer * @src: source pointer * @len: how many bytes to copy * * Like i915_memcpy_from_wc(), the unaligned variant copies @len bytes from * @src to @dst using * non-temporal instructions where available, but * accepts that its arguments may not be aligned, but are valid for the * potential 16-byte read past the end.
*/ void i915_unaligned_memcpy_from_wc(void *dst, constvoid *src, unsignedlong len)
{ unsignedlong addr;
CI_BUG_ON(!i915_has_memcpy_from_wc());
addr = (unsignedlong)src; if (!IS_ALIGNED(addr, 16)) { unsignedlong x = min(ALIGN(addr, 16) - addr, len);
memcpy(dst, src, x);
len -= x;
dst += x;
src += x;
}
if (likely(len))
__memcpy_ntdqu(dst, src, DIV_ROUND_UP(len, 16));
}
void i915_memcpy_init_early(struct drm_i915_private *dev_priv)
{ /* * Some hypervisors (e.g. KVM) don't support VEX-prefix instructions * emulation. So don't enable movntdqa in hypervisor guest.
*/ if (static_cpu_has(X86_FEATURE_XMM4_1) &&
!boot_cpu_has(X86_FEATURE_HYPERVISOR))
static_branch_enable(&has_movntdqa);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.