1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * Kernel interface for the s390 arch_random_* 4 * 5 * Copyright IBM Corp. 2017, 2022 6 * 7 * Author: Harald Freudenberger <freude@de.ibm 8 * 9 */ 10 11 #ifndef _ASM_S390_ARCHRANDOM_H 12 #define _ASM_S390_ARCHRANDOM_H 13 14 #include <linux/static_key.h> 15 #include <linux/preempt.h> 16 #include <linux/atomic.h> 17 #include <asm/cpacf.h> 18 19 DECLARE_STATIC_KEY_FALSE(s390_arch_random_avai 20 extern atomic64_t s390_arch_random_counter; 21 22 static inline size_t __must_check arch_get_ran 23 { 24 return 0; 25 } 26 27 static inline size_t __must_check arch_get_ran 28 { 29 if (static_branch_likely(&s390_arch_ra 30 in_task()) { 31 cpacf_trng(NULL, 0, (u8 *)v, m 32 atomic64_add(max_longs * sizeo 33 return max_longs; 34 } 35 return 0; 36 } 37 38 #endif /* _ASM_S390_ARCHRANDOM_H */ 39
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.