Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
arch/x86/crypto/ghash-clmulni-intel_glue.c
static int ghash_async_init_tfm(struct crypto_tfm *tfm) { struct cryptd_ahash *cryptd_tfm; struct ghash_async_ctx *ctx = crypto_tfm_ctx(tfm); cryptd_tfm = cryptd_alloc_ahash("__ghash-pclmulqdqni", CRYPTO_ALG_INTERNAL, CRYPTO_ALG_INTERNAL); if (IS_ERR(cryptd_tfm)) return P...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/ghash-clmulni-intel_glue.c
static void ghash_async_exit_tfm(struct crypto_tfm *tfm) { struct ghash_async_ctx *ctx = crypto_tfm_ctx(tfm); cryptd_free_ahash(ctx->cryptd_tfm); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/ghash-clmulni-intel_glue.c
static int __init ghash_pclmulqdqni_mod_init(void) { int err; if (!x86_match_cpu(pcmul_cpu_id)) return -ENODEV; err = crypto_register_shash(&ghash_alg); if (err) goto err_out; err = crypto_register_ahash(&ghash_async_alg); if (err) goto err_shash; return 0; err_shash: crypto_unregister_...
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/ghash-clmulni-intel_glue.c
static void __exit ghash_pclmulqdqni_mod_exit(void) { crypto_unregister_ahash(&ghash_async_alg); crypto_unregister_shash(&ghash_alg); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/nhpoly1305-avx2-glue.c
static int nhpoly1305_avx2_update(struct shash_desc *desc, const u8 *src, unsigned int srclen) { if (srclen < 64 || !crypto_simd_usable()) return crypto_nhpoly1305_update(desc, src, srclen); do { unsigned int n = min_t(unsigned int, srclen, SZ_4K); kernel_fpu_begin()...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/poly1305_glue.c
static void convert_to_base2_64(void *ctx) { struct poly1305_arch_internal *state = ctx; u32 cy; if (!state->is_base2_26) return; cy = state->h[0] >> 26; state->h[0] &= 0x3ffffff; state->h[1] += cy; cy = state->h[1] >> 26; state->h[1] &= 0x3ffffff; state->h[2] += cy; cy = state->h[2] >> 26; ...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/poly1305_glue.c
void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE]) { poly1305_simd_init(&dctx->h, key); dctx->s[0] = get_unaligned_le32(&key[16]); dctx->s[1] = get_unaligned_le32(&key[20]); dctx->s[2] = get_unaligned_le32(&key[24]); dctx->s[3] = get_unaligned_le3...
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/poly1305_glue.c
void poly1305_final_arch(struct poly1305_desc_ctx *dctx, u8 *dst) { if (unlikely(dctx->buflen)) { dctx->buf[dctx->buflen++] = 1; memset(dctx->buf + dctx->buflen, 0, POLY1305_BLOCK_SIZE - dctx->buflen); poly1305_simd_blocks(&dctx->h, dctx->buf, POLY1305_BLOCK_SIZE, 0); } poly1305_simd_emit(&dctx->h, ...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/poly1305_glue.c
static int crypto_poly1305_init(struct shash_desc *desc) { struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc); *dctx = (struct poly1305_desc_ctx){}; return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/polyval-clmulni_glue.c
static void internal_polyval_mul(u8 *op1, const u8 *op2) { if (likely(crypto_simd_usable())) { kernel_fpu_begin(); clmul_polyval_mul(op1, op2); kernel_fpu_end(); } else { polyval_mul_non4k(op1, op2); } }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/serpent-sse2.h
static inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src) { serpent_dec_blk_8way(ctx, dst, src); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/serpent_avx2_glue.c
static int cbc_decrypt(struct skcipher_request *req) { CBC_WALK_START(req, SERPENT_BLOCK_SIZE, SERPENT_PARALLEL_BLOCKS); CBC_DEC_BLOCK(SERPENT_AVX2_PARALLEL_BLOCKS, serpent_cbc_dec_16way); CBC_DEC_BLOCK(SERPENT_PARALLEL_BLOCKS, serpent_cbc_dec_8way_avx); CBC_DEC_BLOCK(1, __serpent_decrypt); CBC_WALK_END(); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/serpent_avx2_glue.c
static void __exit serpent_avx2_fini(void) { simd_unregister_skciphers(serpent_algs, ARRAY_SIZE(serpent_algs), serpent_simd_algs); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/serpent_avx_glue.c
static int ecb_decrypt(struct skcipher_request *req) { ECB_WALK_START(req, SERPENT_BLOCK_SIZE, SERPENT_PARALLEL_BLOCKS); ECB_BLOCK(SERPENT_PARALLEL_BLOCKS, serpent_ecb_dec_8way_avx); ECB_BLOCK(1, __serpent_decrypt); ECB_WALK_END(); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/serpent_avx_glue.c
static int cbc_decrypt(struct skcipher_request *req) { CBC_WALK_START(req, SERPENT_BLOCK_SIZE, SERPENT_PARALLEL_BLOCKS); CBC_DEC_BLOCK(SERPENT_PARALLEL_BLOCKS, serpent_cbc_dec_8way_avx); CBC_DEC_BLOCK(1, __serpent_decrypt); CBC_WALK_END(); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/serpent_sse2_glue.c
static int ecb_decrypt(struct skcipher_request *req) { ECB_WALK_START(req, SERPENT_BLOCK_SIZE, SERPENT_PARALLEL_BLOCKS); ECB_BLOCK(SERPENT_PARALLEL_BLOCKS, serpent_dec_blk_xway); ECB_BLOCK(1, __serpent_decrypt); ECB_WALK_END(); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/serpent_sse2_glue.c
static void __exit serpent_sse2_exit(void) { simd_unregister_skciphers(serpent_algs, ARRAY_SIZE(serpent_algs), serpent_simd_algs); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int sha1_update(struct shash_desc *desc, const u8 *data, unsigned int len, sha1_block_fn *sha1_xform) { struct sha1_state *sctx = shash_desc_ctx(desc); if (!crypto_simd_usable() || (sctx->count % SHA1_BLOCK_SIZE) + len < SHA1_BLOCK_SIZE) return crypto_sha1_update(desc, data,...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int sha1_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out, sha1_block_fn *sha1_xform) { if (!crypto_simd_usable()) return crypto_sha1_finup(desc, data, len, out); kernel_fpu_begin(); if (len) sha1_base_do_update(desc, data, len, sha1_xform); sha1_ba...
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int sha1_ssse3_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return sha1_finup(desc, data, len, out, sha1_transform_ssse3); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static void unregister_sha1_ssse3(void) { if (boot_cpu_has(X86_FEATURE_SSSE3)) crypto_unregister_shash(&sha1_ssse3_alg); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int sha1_avx_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return sha1_finup(desc, data, len, out, sha1_transform_avx); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static bool avx_usable(void) { if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) { if (boot_cpu_has(X86_FEATURE_AVX)) pr_info("AVX detected but unusable.\n"); return false; } return true; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int register_sha1_avx(void) { if (avx_usable()) return crypto_register_shash(&sha1_avx_alg); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static bool avx2_usable(void) { if (avx_usable() && boot_cpu_has(X86_FEATURE_AVX2) && boot_cpu_has(X86_FEATURE_BMI1) && boot_cpu_has(X86_FEATURE_BMI2)) return true; return false; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int register_sha1_avx2(void) { if (avx2_usable()) return crypto_register_shash(&sha1_avx2_alg); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int sha1_ni_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return sha1_finup(desc, data, len, out, sha1_ni_transform); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha1_ssse3_glue.c
static int register_sha1_ni(void) { if (boot_cpu_has(X86_FEATURE_SHA_NI)) return crypto_register_shash(&sha1_ni_alg); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha256_ssse3_glue.c
static int sha256_ssse3_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return sha256_finup(desc, data, len, out, sha256_transform_ssse3); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha256_ssse3_glue.c
static int sha256_ssse3_final(struct shash_desc *desc, u8 *out) { return sha256_ssse3_finup(desc, NULL, 0, out); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha256_ssse3_glue.c
static int sha256_avx_final(struct shash_desc *desc, u8 *out) { return sha256_avx_finup(desc, NULL, 0, out); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha256_ssse3_glue.c
static int sha256_ni_final(struct shash_desc *desc, u8 *out) { return sha256_ni_finup(desc, NULL, 0, out); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha256_ssse3_glue.c
static int register_sha256_ni(void) { if (boot_cpu_has(X86_FEATURE_SHA_NI)) return crypto_register_shashes(sha256_ni_algs, ARRAY_SIZE(sha256_ni_algs)); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha256_ssse3_glue.c
static int __init sha256_ssse3_mod_init(void) { if (register_sha256_ssse3()) goto fail; if (register_sha256_avx()) { unregister_sha256_ssse3(); goto fail; } if (register_sha256_avx2()) { unregister_sha256_avx(); unregister_sha256_ssse3(); goto fail; } if (register_sha256_ni()) { ...
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha512_ssse3_glue.c
static int register_sha512_ssse3(void) { if (boot_cpu_has(X86_FEATURE_SSSE3)) return crypto_register_shashes(sha512_ssse3_algs, ARRAY_SIZE(sha512_ssse3_algs)); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha512_ssse3_glue.c
static int sha512_avx_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return sha512_finup(desc, data, len, out, sha512_transform_avx); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha512_ssse3_glue.c
static int register_sha512_avx(void) { if (avx_usable()) return crypto_register_shashes(sha512_avx_algs, ARRAY_SIZE(sha512_avx_algs)); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha512_ssse3_glue.c
static void unregister_sha512_avx(void) { if (avx_usable()) crypto_unregister_shashes(sha512_avx_algs, ARRAY_SIZE(sha512_avx_algs)); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sha512_ssse3_glue.c
static int __init sha512_ssse3_mod_init(void) { if (!x86_match_cpu(module_cpu_ids)) return -ENODEV; if (register_sha512_ssse3()) goto fail; if (register_sha512_avx()) { unregister_sha512_ssse3(); goto fail; } if (register_sha512_avx2()) { unregister_sha512_avx(); unregister_sha512_...
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sm3_avx_glue.c
static int __init sm3_avx_mod_init(void) { const char *feature_name; if (!boot_cpu_has(X86_FEATURE_AVX)) { pr_info("AVX instruction are not detected.\n"); return -ENODEV; } if (!boot_cpu_has(X86_FEATURE_BMI2)) { pr_info("BMI2 instruction are not detected.\n"); return -ENODEV; } if (!cpu_...
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx2_glue.c
static int cfb_decrypt(struct skcipher_request *req) { return sm4_avx_cfb_decrypt(req, SM4_CRYPT16_BLOCK_SIZE, sm4_aesni_avx2_cfb_dec_blk16); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx2_glue.c
static int ctr_crypt(struct skcipher_request *req) { return sm4_avx_ctr_crypt(req, SM4_CRYPT16_BLOCK_SIZE, sm4_aesni_avx2_ctr_enc_blk16); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx_glue.c
static int sm4_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key, unsigned int key_len) { struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm); return sm4_expandkey(ctx, key, key_len); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx_glue.c
int sm4_avx_ecb_encrypt(struct skcipher_request *req) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm); return ecb_do_crypt(req, ctx->rkey_enc); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx_glue.c
int sm4_avx_ecb_decrypt(struct skcipher_request *req) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm); return ecb_do_crypt(req, ctx->rkey_dec); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx_glue.c
int sm4_avx_cbc_decrypt(struct skcipher_request *req, unsigned int bsize, sm4_crypt_func func) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm); struct skcipher_walk walk; unsigned int nbytes; int err; err = skcipher_walk_v...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx_glue.c
int sm4_cfb_encrypt(struct skcipher_request *req) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm); struct skcipher_walk walk; unsigned int nbytes; int err; err = skcipher_walk_virt(&walk, req, false); while ((nbytes = walk.nbytes) > 0) { u8...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx_glue.c
int sm4_avx_ctr_crypt(struct skcipher_request *req, unsigned int bsize, sm4_crypt_func func) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm); struct skcipher_walk walk; unsigned int nbytes; int err; err = skcipher_walk_virt(&...
[ 1, 0 ]
Linux Kernel
arch/x86/crypto/sm4_aesni_avx_glue.c
static int __init sm4_init(void) { const char *feature_name; if (!boot_cpu_has(X86_FEATURE_AVX) || !boot_cpu_has(X86_FEATURE_AES) || !boot_cpu_has(X86_FEATURE_OSXSAVE)) { pr_info("AVX or AES-NI instructions are not detected.\n"); return -ENODEV; } if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEA...
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/twofish_avx_glue.c
static int cbc_decrypt(struct skcipher_request *req) { CBC_WALK_START(req, TF_BLOCK_SIZE, TWOFISH_PARALLEL_BLOCKS); CBC_DEC_BLOCK(TWOFISH_PARALLEL_BLOCKS, twofish_cbc_dec_8way); CBC_DEC_BLOCK(3, twofish_dec_blk_cbc_3way); CBC_DEC_BLOCK(1, twofish_dec_blk); CBC_WALK_END(); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/twofish_glue.c
static void twofish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { twofish_enc_blk(crypto_tfm_ctx(tfm), dst, src); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/twofish_glue.c
static void __exit twofish_glue_fini(void) { crypto_unregister_alg(&alg); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/twofish_glue_3way.c
static inline void twofish_enc_blk_3way(const void *ctx, u8 *dst, const u8 *src) { __twofish_enc_blk_3way(ctx, dst, src, false); }
[ 0, 0 ]
Linux Kernel
arch/x86/crypto/twofish_glue_3way.c
static int ecb_encrypt(struct skcipher_request *req) { ECB_WALK_START(req, TF_BLOCK_SIZE, -1); ECB_BLOCK(3, twofish_enc_blk_3way); ECB_BLOCK(1, twofish_enc_blk); ECB_WALK_END(); }
[ 0, 0 ]
Linux Kernel
arch/x86/entry/common.c
static __always_inline bool do_syscall_x32(struct pt_regs *regs, int nr) { unsigned int xnr = nr - __X32_SYSCALL_BIT; if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) { xnr = array_index_nospec(xnr, X32_NR_syscalls); regs->ax = x32_sys_call_table[xnr](regs); return true; } retu...
[ 1, 0 ]
Linux Kernel
arch/x86/entry/common.c
static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs, int nr) { unsigned int unr = nr; if (likely(unr < IA32_NR_syscalls)) { unr = array_index_nospec(unr, IA32_NR_syscalls); regs->ax = ia32_sys_call_table[unr](regs); } else if (nr != -1...
[ 1, 0 ]
Linux Kernel
arch/x86/entry/common.c
__visible noinstr long do_fast_syscall_32(struct pt_regs *regs) { unsigned long landing_pad = (unsigned long)current->mm->context.vdso + vdso_image_32.sym_int80_landing_pad; /* * SYSENTER loses EIP, and even SYSCALL32 needs us to skip forward * so that 'regs->ip -= 2' lands bac...
[ 1, 0 ]
Linux Kernel
arch/x86/entry/common.c
static __always_inline void restore_inhcall(bool inhcall) { __this_cpu_write(xen_in_preemptible_hcall, inhcall); } #else
[ 0, 0 ]
Linux Kernel
arch/x86/entry/vdso/vclock_gettime.c
__kernel_old_time_t __vdso_time(__kernel_old_time_t *t) { return __cvdso_time(t); }
[ 0, 0 ]
Linux Kernel
arch/x86/entry/vdso/vdso2c.c
static void fail(const char *format, ...) { va_list ap; va_start(ap, format); fprintf(stderr, "Error: "); vfprintf(stderr, format, ap); if (outfilename) unlink(outfilename); exit(1); va_end(ap); } #define GLE(x, bits, ifnot) \ __builtin_choose_expr...
[ 0, 0 ]
Linux Kernel
arch/x86/entry/vdso/vdso32-setup.c
static __init int ia32_binfmt_init(void) { register_sysctl_table(abi_root_table2); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/entry/vdso/vma.c
void __init init_vdso_image(const struct vdso_image *image) { BUG_ON(image->size % PAGE_SIZE != 0); apply_alternatives( (struct alt_instr *)(image->data + image->alt), (struct alt_instr *)(image->data + image->alt + image->alt_len)); }
[ 1, 0 ]
Linux Kernel
arch/x86/entry/vdso/vma.c
static int map_vdso_randomized(const struct vdso_image *image) { unsigned long addr = vdso_addr(current->mm->start_stack, image->size - image->sym_vvar_start); return map_vdso(image, addr); }
[ 1, 0 ]
Linux Kernel
arch/x86/entry/vdso/vma.c
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) { return load_vdso32(); } #endif
[ 0, 0 ]
Linux Kernel
arch/x86/entry/vdso/vma.c
static int __init init_vdso(void) { BUILD_BUG_ON(VDSO_CLOCKMODE_MAX >= 32); init_vdso_image(&vdso_image_64); #ifdef CONFIG_X86_X32_ABI init_vdso_image(&vdso_image_x32); #endif return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/entry/vsyscall/vsyscall_64.c
static void warn_bad_vsyscall(const char *level, struct pt_regs *regs, const char *message) { if (!show_unhandled_signals) return; printk_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n", level, current->comm, task_pid_nr(current), messag...
[ 1, 0 ]
Linux Kernel
arch/x86/entry/vsyscall/vsyscall_64.c
static int addr_to_vsyscall_nr(unsigned long addr) { int nr; if ((addr & ~0xC00UL) != VSYSCALL_ADDR) return -EINVAL; nr = (addr & 0xC00UL) >> 10; if (nr >= 3) return -EINVAL; return nr; }
[ 0, 0 ]
Linux Kernel
arch/x86/entry/vsyscall/vsyscall_64.c
void __init map_vsyscall(void) { extern char __vsyscall_page; unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page); if (vsyscall_mode == EMULATE) { __set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall, PAGE_KERNEL_VVAR); set_vsyscall_pgtable_user_bits(swapper_pg_dir); } if (vsyscall_mode == XONL...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/brs.c
static inline unsigned int brs_to(int idx) { return MSR_AMD_SAMP_BR_FROM + 2 * idx + 1; }
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/brs.c
static bool __init amd_brs_detect(void) { if (!cpu_feature_enabled(X86_FEATURE_BRS)) return false; switch (boot_cpu_data.x86) { case 0x19: x86_pmu.lbr_nr = 16; /* No hardware filtering supported */ x86_pmu.lbr_sel_map = NULL; x86_pmu.lbr_sel_mask = 0; break; default: return false; ...
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/brs.c
void amd_brs_reset(void) { if (!cpu_feature_enabled(X86_FEATURE_BRS)) return; set_debug_extn_cfg(0); /* * Mark first entry as poisoned */ wrmsrl(brs_to(0), BRS_POISON); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/brs.c
int __init amd_brs_init(void) { if (!amd_brs_detect()) return -EOPNOTSUPP; pr_cont("%d-deep BRS, ", x86_pmu.lbr_nr); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/brs.c
void amd_brs_enable_all(void) { struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); if (cpuc->lbr_users) amd_brs_enable(); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/brs.c
static void amd_brs_poison_buffer(void) { union amd_debug_extn_cfg cfg; unsigned int idx; cfg.val = get_debug_extn_cfg(); /* idx is most recently written entry */ idx = amd_brs_get_tos(&cfg); /* Poison target of entry */ wrmsrl(brs_to(idx), BRS_POISON); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/brs.c
void __init amd_brs_lopwr_init(void) { static_call_update(perf_lopwr_cb, perf_amd_brs_lopwr_cb); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static inline int amd_pmu_addr_offset(int index, bool eventsel) { int offset; if (!index) return index; if (eventsel) offset = event_offsets[index]; else offset = count_offsets[index]; if (offset) return offset; if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) offset = index; else ...
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static void amd_pmu_cpu_dead(int cpu) { struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); kfree(cpuhw->lbr_sel); cpuhw->lbr_sel = NULL; if (!x86_pmu.amd_nb_constraints) return; if (cpuhw->amd_nb) { struct amd_nb *nb = cpuhw->amd_nb; if (nb->nb_id == -1 || --nb->refcnt == 0) kf...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static inline void amd_pmu_set_global_ctl(u64 ctl) { wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_CTL, ctl); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static bool amd_pmu_test_overflow_status(int idx) { return amd_pmu_get_global_status() & BIT_ULL(idx); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static void amd_pmu_enable_event(struct perf_event *event) { x86_pmu_enable_event(event); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static void amd_pmu_v2_enable_all(int added) { amd_pmu_lbr_enable_all(); amd_pmu_core_enable_all(); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static void amd_pmu_disable_all(void) { amd_brs_disable_all(); x86_pmu_disable_all(); amd_pmu_check_overflow(); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static void amd_pmu_v2_disable_all(void) { amd_pmu_core_disable_all(); amd_pmu_lbr_disable_all(); amd_pmu_check_overflow(); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static int amd_pmu_handle_irq(struct pt_regs *regs) { struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); int handled; int pmu_enabled; pmu_enabled = cpuc->enabled; cpuc->enabled = 0; amd_brs_disable_all(); /* Drain BRS is in use (could be inactive) */ if (cpuc->lbr_users) amd_brs_drain();...
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static void amd_put_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) { if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw)) __amd_put_nb_event_constraints(cpuc, event); }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static void amd_pmu_limit_period(struct perf_event *event, s64 *left) { if (has_branch_stack(event) && *left > x86_pmu.lbr_nr) *left -= x86_pmu.lbr_nr; }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
static umode_t amd_brs_is_visible(struct kobject *kobj, struct attribute *attr, int i) { return static_cpu_has(X86_FEATURE_BRS) && x86_pmu.lbr_nr ? attr->mode : 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/core.c
__init int amd_pmu_init(void) { int ret; if (boot_cpu_data.x86 < 6) return -ENODEV; x86_pmu = amd_pmu; ret = amd_core_pmu_init(); if (ret) return ret; if (num_possible_cpus() == 1) { /* * No point in allocating data structures to serialize * against other CPUs, when there is only t...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static int perf_ibs_precise_event(struct perf_event *event, u64 *config) { switch (event->attr.precise_ip) { case 0: return -ENOENT; case 1: case 2: break; default: return -EOPNOTSUPP; } switch (event->attr.type) { case PERF_TYPE_HARDWARE: switch (event->attr.config) { case PERF_COU...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static int perf_ibs_set_period(struct perf_ibs *perf_ibs, struct hw_perf_event *hwc, u64 *period) { int overflow; overflow = perf_event_set_period(hwc, 1 << 4, perf_ibs->max_period, period); local64_set(&hwc->prev_count, 0); return overflow; }
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static void perf_ibs_start(struct perf_event *event, int flags) { struct hw_perf_event *hwc = &event->hw; struct perf_ibs *perf_ibs = container_of(event->pmu, struct perf_ibs, pmu); struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu); u64 period, config = 0; if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOP...
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static void perf_ibs_stop(struct perf_event *event, int flags) { struct hw_perf_event *hwc = &event->hw; struct perf_ibs *perf_ibs = container_of(event->pmu, struct perf_ibs, pmu); struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu); u64 config; int stopping; if (test_and_set_bit(IBS_STOPPING, pcpu->s...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static void perf_ibs_read(struct perf_event *event) {}
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static umode_t cnt_ctl_is_visible(struct kobject *kobj, struct attribute *attr, int i) { return ibs_caps & IBS_CAPS_OPCNT ? attr->mode : 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static void perf_ibs_get_mem_op(union ibs_op_data3 *op_data3, struct perf_sample_data *data) { union perf_mem_data_src *data_src = &data->data_src; data_src->mem_op = PERF_MEM_OP_NA; if (op_data3->ld_op) data_src->mem_op = PERF_MEM_OP_LOAD; else if (op_data3->st_op) da...
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static void perf_ibs_get_mem_snoop(union ibs_op_data2 *op_data2, struct perf_sample_data *data) { union perf_mem_data_src *data_src = &data->data_src; u8 ibs_data_src; data_src->mem_snoop = PERF_MEM_SNOOP_NA; if (!perf_ibs_cache_hit_st_valid() || data_src->mem_op != PERF_ME...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static void perf_ibs_get_tlb_lvl(union ibs_op_data3 *op_data3, struct perf_sample_data *data) { union perf_mem_data_src *data_src = &data->data_src; data_src->mem_dtlb = PERF_MEM_TLB_NA; if (!op_data3->dc_lin_addr_valid) return; if (!op_data3->dc_l1tlb_miss) { data_s...
[ 0, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static __u64 perf_ibs_get_op_data2(struct perf_ibs_data *ibs_data, union ibs_op_data3 *op_data3) { __u64 val = ibs_data->regs[ibs_op_msr_idx(MSR_AMD64_IBSOPDATA2)]; if (boot_cpu_data.x86 == 0x19 && boot_cpu_data.x86_model <= 0xF && (op_data3->sw_pf || op_data3->dc_miss_no_m...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static __init int perf_ibs_fetch_init(void) { if (boot_cpu_data.x86 >= 0x16 && boot_cpu_data.x86 <= 0x18) perf_ibs_fetch.fetch_count_reset_broken = 1; if (boot_cpu_data.x86 == 0x19 && boot_cpu_data.x86_model < 0x10) perf_ibs_fetch.fetch_ignore_if_zero_rip = 1; if (ibs_caps & IBS_CAPS_ZEN4) perf_ibs...
[ 1, 0 ]
Linux Kernel
arch/x86/events/amd/ibs.c
static inline int put_eilvt(int offset) { return !setup_APIC_eilvt(offset, 0, 0, 1); }
[ 0, 0 ]