process.c (6f84981772535e670e4e2df051a672af229b6694) process.c (ce514000da4f4b5f850f3339f805471e5c5c1caf)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Based on arch/arm/kernel/process.c
4 *
5 * Original Copyright (C) 1995 Linus Torvalds
6 * Copyright (C) 1996-2000 Russell King - Converted to ARM.
7 * Copyright (C) 2012 ARM Ltd.
8 */

--- 297 unchanged lines hidden (view full) ---

306 clear_tsk_thread_flag(dst, TIF_SVE);
307
308 /*
309 * In the unlikely event that we create a new thread with ZA
310 * enabled we should retain the ZA state so duplicate it here.
311 * This may be shortly freed if we exec() or if CLONE_SETTLS
312 * but it's simpler to do it here. To avoid confusing the rest
313 * of the code ensure that we have a sve_state allocated
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Based on arch/arm/kernel/process.c
4 *
5 * Original Copyright (C) 1995 Linus Torvalds
6 * Copyright (C) 1996-2000 Russell King - Converted to ARM.
7 * Copyright (C) 2012 ARM Ltd.
8 */

--- 297 unchanged lines hidden (view full) ---

306 clear_tsk_thread_flag(dst, TIF_SVE);
307
308 /*
309 * In the unlikely event that we create a new thread with ZA
310 * enabled we should retain the ZA state so duplicate it here.
311 * This may be shortly freed if we exec() or if CLONE_SETTLS
312 * but it's simpler to do it here. To avoid confusing the rest
313 * of the code ensure that we have a sve_state allocated
314 * whenever za_state is allocated.
314 * whenever sme_state is allocated.
315 */
316 if (thread_za_enabled(&src->thread)) {
317 dst->thread.sve_state = kzalloc(sve_state_size(src),
318 GFP_KERNEL);
319 if (!dst->thread.sve_state)
320 return -ENOMEM;
315 */
316 if (thread_za_enabled(&src->thread)) {
317 dst->thread.sve_state = kzalloc(sve_state_size(src),
318 GFP_KERNEL);
319 if (!dst->thread.sve_state)
320 return -ENOMEM;
321 dst->thread.za_state = kmemdup(src->thread.za_state,
322 za_state_size(src),
323 GFP_KERNEL);
324 if (!dst->thread.za_state) {
321
322 dst->thread.sme_state = kmemdup(src->thread.sme_state,
323 sme_state_size(src),
324 GFP_KERNEL);
325 if (!dst->thread.sme_state) {
325 kfree(dst->thread.sve_state);
326 dst->thread.sve_state = NULL;
327 return -ENOMEM;
328 }
329 } else {
326 kfree(dst->thread.sve_state);
327 dst->thread.sve_state = NULL;
328 return -ENOMEM;
329 }
330 } else {
330 dst->thread.za_state = NULL;
331 dst->thread.sme_state = NULL;
331 clear_tsk_thread_flag(dst, TIF_SME);
332 }
333
334 dst->thread.fp_type = FP_STATE_FPSIMD;
335
336 /* clear any pending asynchronous tag fault raised by the parent */
337 clear_tsk_thread_flag(dst, TIF_MTE_ASYNC_FAULT);
338

--- 421 unchanged lines hidden ---
332 clear_tsk_thread_flag(dst, TIF_SME);
333 }
334
335 dst->thread.fp_type = FP_STATE_FPSIMD;
336
337 /* clear any pending asynchronous tag fault raised by the parent */
338 clear_tsk_thread_flag(dst, TIF_MTE_ASYNC_FAULT);
339

--- 421 unchanged lines hidden ---