Lines Matching +full:tile +full:- +full:cache
1 // SPDX-License-Identifier: GPL-2.0-only
47 "AVX-512 opmask",
48 "AVX-512 Hi256",
49 "AVX-512 ZMM_Hi256",
53 "Control-flow User registers",
54 "Control-flow Kernel registers (unused)",
59 "AMX Tile config",
60 "AMX Tile data",
82 { [ 0 ... XFEATURE_MAX - 1] = -1};
84 { [ 0 ... XFEATURE_MAX - 1] = -1};
106 * missing AVX feature - this is the most informative message in cpu_has_xfeatures()
114 xfeature_idx = fls64(xfeatures_print)-1; in cpu_has_xfeatures()
115 max_idx = ARRAY_SIZE(xfeature_names)-1; in cpu_has_xfeatures()
143 * Non-compacted format and legacy features use the cached fixed in xfeature_get_offset()
182 * xfd cache too. in fpu__init_cpu_xstate()
239 * invalid, leave it to -1. in setup_xstate_cache()
247 * In our xstate size checks, we assume that the highest-numbered in setup_xstate_cache()
376 * that init_fpstate contains all non-zero init state. This only in setup_init_fpu_buf()
407 if (hdr->xfeatures & ~fpstate->user_xfeatures) in validate_user_xstate_header()
408 return -EINVAL; in validate_user_xstate_header()
411 if (hdr->xcomp_bv) in validate_user_xstate_header()
412 return -EINVAL; in validate_user_xstate_header()
418 BUILD_BUG_ON(sizeof(hdr->reserved) != 48); in validate_user_xstate_header()
421 if (memchr_inv(hdr->reserved, 0, sizeof(hdr->reserved))) in validate_user_xstate_header()
422 return -EINVAL; in validate_user_xstate_header()
464 * check_xtile_data_against_struct - Check tile data state size.
466 * Calculate the state size by multiplying the single tile size which is
470 * @size: The tile data state size
472 * Returns: 0 on success, -EINVAL on mismatch.
487 * Cross-check each tile size and find the maximum number of in check_xtile_data_against_struct()
494 * Check the tile size info: in check_xtile_data_against_struct()
507 return -EINVAL; in check_xtile_data_against_struct()
519 return -EINVAL; in check_xtile_data_against_struct()
562 unsigned int topmost = fls64(xfeatures) - 1; in xstate_calculate_size()
574 * This essentially double-checks what the cpu told us about
579 * covered by these checks. Only the size of the buffer for task->fpu
610 * Note the SDM's wording here. "sub-function 0" only enumerates
622 * - CPUID function 0DH, sub-function 1: in get_compacted_size()
654 * This is the size required for the task->fpu buffer. in get_xsave_compacted_size()
658 /* Re-enable independent features so XSAVES will work on them again. */ in get_xsave_compacted_size()
668 * - CPUID function 0DH, sub-function 0: in get_xsave_size_user()
704 return -EINVAL; in init_xstate_size()
738 fpstate_reset(¤t->thread.fpu); in fpu__init_disable_system_xstate()
843 /* Cache size, offset and flags for initialization */ in fpu__init_system_xstate()
851 fpstate_reset(¤t->thread.fpu); in fpu__init_system_xstate()
854 * Update info used for ptrace frames; use standard-format size and no in fpu__init_system_xstate()
925 wrmsrl(MSR_IA32_XFD, current->thread.fpu.fpstate->xfd); in fpu__resume_cpu()
935 u64 xcomp_bv = xsave->header.xcomp_bv; in __raw_xsave_addr()
992 if (!(xsave->header.xfeatures & BIT_ULL(xfeature_nr))) in get_xsave_addr()
1015 return -EINVAL; in arch_set_user_pkey_access()
1019 * values originating from in-kernel users. Complain in arch_set_user_pkey_access()
1023 return -EINVAL; in arch_set_user_pkey_access()
1053 * __copy_xstate_to_uabi_buf - Copy kernel saved xstate to a UABI buffer
1072 struct xregs_state *xsave = &fpstate->regs.xsave; in __copy_xstate_to_uabi_buf()
1079 header.xfeatures = xsave->header.xfeatures; in __copy_xstate_to_uabi_buf()
1092 header.xfeatures &= fpstate->user_xfeatures & xfeatures; in __copy_xstate_to_uabi_buf()
1097 copy_feature(header.xfeatures & XFEATURE_MASK_FP, &to, &xsave->i387, in __copy_xstate_to_uabi_buf()
1098 &xinit->i387, off_mxcsr); in __copy_xstate_to_uabi_buf()
1102 &to, &xsave->i387.mxcsr, &xinit->i387.mxcsr, in __copy_xstate_to_uabi_buf()
1107 &to, &xsave->i387.st_space, &xinit->i387.st_space, in __copy_xstate_to_uabi_buf()
1108 sizeof(xsave->i387.st_space)); in __copy_xstate_to_uabi_buf()
1110 /* Copy the SSE state - shared with YMM, but independently managed */ in __copy_xstate_to_uabi_buf()
1112 &to, &xsave->i387.xmm_space, &xinit->i387.xmm_space, in __copy_xstate_to_uabi_buf()
1113 sizeof(xsave->i387.xmm_space)); in __copy_xstate_to_uabi_buf()
1119 membuf_zero(&to, sizeof(xsave->i387.padding)); in __copy_xstate_to_uabi_buf()
1121 /* Copy xsave->i387.sw_reserved */ in __copy_xstate_to_uabi_buf()
1122 membuf_write(&to, xstate_fx_sw_bytes, sizeof(xsave->i387.sw_reserved)); in __copy_xstate_to_uabi_buf()
1124 /* Copy the user space relevant state of @xsave->header */ in __copy_xstate_to_uabi_buf()
1134 * In non-compacted format, disabled features still occupy in __copy_xstate_to_uabi_buf()
1151 membuf_zero(&to, xstate_offsets[i] - zerofrom); in __copy_xstate_to_uabi_buf()
1167 * Keep track of the last copied state in the non-compacted in __copy_xstate_to_uabi_buf()
1179 * copy_xstate_to_uabi_buf - Copy kernel saved xstate to a UABI buffer
1193 __copy_xstate_to_uabi_buf(to, tsk->thread.fpu.fpstate, in copy_xstate_to_uabi_buf()
1194 tsk->thread.fpu.fpstate->user_xfeatures, in copy_xstate_to_uabi_buf()
1195 tsk->thread.pkru, copy_mode); in copy_xstate_to_uabi_buf()
1205 return -EFAULT; in copy_from_buffer()
1212 * copy_uabi_to_xstate - Copy a UABI format buffer to the kernel xstate
1242 struct xregs_state *xsave = &fpstate->regs.xsave; in copy_uabi_to_xstate()
1250 return -EFAULT; in copy_uabi_to_xstate()
1253 return -EINVAL; in copy_uabi_to_xstate()
1262 return -EFAULT; in copy_uabi_to_xstate()
1266 return -EINVAL; in copy_uabi_to_xstate()
1270 xsave->i387.mxcsr = mxcsr[0]; in copy_uabi_to_xstate()
1271 xsave->i387.mxcsr_mask = mxcsr[1]; in copy_uabi_to_xstate()
1285 return -EFAULT; in copy_uabi_to_xstate()
1293 *pkru = xpkru->pkru; in copy_uabi_to_xstate()
1304 * The state that came in from userspace was user-state only. in copy_uabi_to_xstate()
1307 xsave->header.xfeatures &= XFEATURE_MASK_SUPERVISOR_ALL; in copy_uabi_to_xstate()
1312 xsave->header.xfeatures |= hdr.xfeatures; in copy_uabi_to_xstate()
1318 * Convert from a ptrace standard-format kernel buffer to kernel XSAVE[S]
1327 * Convert from a sigreturn standard-format user-space buffer to kernel
1334 return copy_uabi_to_xstate(tsk->thread.fpu.fpstate, NULL, ubuf, &tsk->thread.pkru); in copy_sigframe_from_user_to_xstate()
1353 * xsaves - Save selected components to a kernel xstate buffer
1376 * xrstors - Restore selected components from a kernel xstate buffer
1402 void *addr = get_xsave_addr(&fps->regs.xsave, xfeature); in fpstate_clear_xstate_component()
1421 if (fpstate->xfd == xfd) in xstate_op_valid()
1425 * The XFD MSR does not match fpstate->xfd. That's invalid when in xstate_op_valid()
1428 if (fpstate->xfd == current->thread.fpu.fpstate->xfd) in xstate_op_valid()
1446 * the buffer area for XFD-disabled state components. in xstate_op_valid()
1454 mask &= ~fpstate->xfeatures; in xstate_op_valid()
1483 if (fpu->fpstate && fpu->fpstate != &fpu->__fpstate) in arch_initcall()
1484 vfree(fpu->fpstate); in arch_initcall()
1488 * fpstate_realloc - Reallocate struct fpstate for the requested new features
1496 * Note vs. vmalloc(): If the task with a vzalloc()-allocated buffer
1497 * terminates quickly, vfree()-induced IPIs may be a concern, but tasks
1500 * Returns: 0 on success, -ENOMEM on allocation error.
1505 struct fpu *fpu = ¤t->thread.fpu; in fpstate_realloc()
1514 return -ENOMEM; in fpstate_realloc()
1515 newfps->size = ksize; in fpstate_realloc()
1516 newfps->user_size = usize; in fpstate_realloc()
1517 newfps->is_valloc = true; in fpstate_realloc()
1520 * When a guest FPU is supplied, use @guest_fpu->fpstate in fpstate_realloc()
1523 curfps = guest_fpu ? guest_fpu->fpstate : fpu->fpstate; in fpstate_realloc()
1526 in_use = fpu->fpstate == curfps; in fpstate_realloc()
1529 newfps->is_guest = true; in fpstate_realloc()
1530 newfps->is_confidential = curfps->is_confidential; in fpstate_realloc()
1531 newfps->in_use = curfps->in_use; in fpstate_realloc()
1532 guest_fpu->xfeatures |= xfeatures; in fpstate_realloc()
1533 guest_fpu->uabi_size = usize; in fpstate_realloc()
1545 newfps->xfeatures = curfps->xfeatures | xfeatures; in fpstate_realloc()
1546 newfps->user_xfeatures = curfps->user_xfeatures | xfeatures; in fpstate_realloc()
1547 newfps->xfd = curfps->xfd & ~xfeatures; in fpstate_realloc()
1550 xstate_init_xcomp_bv(&newfps->regs.xsave, newfps->xfeatures); in fpstate_realloc()
1553 guest_fpu->fpstate = newfps; in fpstate_realloc()
1556 fpu->fpstate = newfps; in fpstate_realloc()
1558 fpu->fpstate = newfps; in fpstate_realloc()
1562 xfd_update_state(fpu->fpstate); in fpstate_realloc()
1566 if (curfps && curfps->is_valloc) in fpstate_realloc()
1574 struct task_struct *thread, *leader = current->group_leader; in validate_sigaltstack()
1577 lockdep_assert_held(¤t->sighand->siglock); in validate_sigaltstack()
1580 framesize -= fpu_user_cfg.max_size; in validate_sigaltstack()
1583 if (thread->sas_ss_size && thread->sas_ss_size < framesize) in validate_sigaltstack()
1584 return -ENOSPC; in validate_sigaltstack()
1598 struct fpu *fpu = ¤t->group_leader->thread.fpu; in __xstate_request_perm()
1625 perm = guest ? &fpu->guest_perm : &fpu->perm; in __xstate_request_perm()
1627 WRITE_ONCE(perm->__state_perm, mask); in __xstate_request_perm()
1629 perm->__state_size = ksize; in __xstate_request_perm()
1630 perm->__user_state_size = usize; in __xstate_request_perm()
1647 return -EINVAL; in xstate_request_perm()
1656 return -EOPNOTSUPP; in xstate_request_perm()
1659 return -EOPNOTSUPP; in xstate_request_perm()
1667 spin_lock_irq(¤t->sighand->siglock); in xstate_request_perm()
1672 ret = -EBUSY; in xstate_request_perm()
1675 spin_unlock_irq(¤t->sighand->siglock); in xstate_request_perm()
1693 spin_lock_irq(¤t->sighand->siglock); in __xfd_enable_feature()
1697 spin_unlock_irq(¤t->sighand->siglock); in __xfd_enable_feature()
1698 return -EPERM; in __xfd_enable_feature()
1701 fpu = ¤t->group_leader->thread.fpu; in __xfd_enable_feature()
1702 perm = guest_fpu ? &fpu->guest_perm : &fpu->perm; in __xfd_enable_feature()
1703 ksize = perm->__state_size; in __xfd_enable_feature()
1704 usize = perm->__user_state_size; in __xfd_enable_feature()
1712 spin_unlock_irq(¤t->sighand->siglock); in __xfd_enable_feature()
1719 return -EFAULT; in __xfd_enable_feature()
1731 return -EPERM; in xstate_request_perm()
1742 * fpu_xstate_prctl - xstate permission operations
1791 return -EOPNOTSUPP; in fpu_xstate_prctl()
1796 return -EINVAL; in fpu_xstate_prctl()
1807 unsigned long timestamp = READ_ONCE(task->thread.fpu.avx512_timestamp); in avx512_status()
1812 * Report -1 if no AVX512 usage in avx512_status()
1814 delta = -1; in avx512_status()
1816 delta = (long)(jiffies - timestamp); in avx512_status()