Lines Matching +full:pairs +full:- +full:one
1 // SPDX-License-Identifier: GPL-2.0-only
26 u64 id = -1ULL; in hwprobe_arch_id()
33 switch (pair->key) { in hwprobe_arch_id()
51 * If there's a mismatch for the given set, return -1 in the in hwprobe_arch_id()
55 id = -1ULL; in hwprobe_arch_id()
60 pair->value = id; in hwprobe_arch_id()
69 pair->value = 0; in hwprobe_isa_ext0()
71 pair->value |= RISCV_HWPROBE_IMA_FD; in hwprobe_isa_ext0()
74 pair->value |= RISCV_HWPROBE_IMA_C; in hwprobe_isa_ext0()
77 pair->value |= RISCV_HWPROBE_IMA_V; in hwprobe_isa_ext0()
88 if (__riscv_isa_extension_available(isainfo->isa, RISCV_ISA_EXT_##ext)) \ in hwprobe_isa_ext0()
89 pair->value |= RISCV_HWPROBE_EXT_##ext; \ in hwprobe_isa_ext0()
171 pair->value &= ~missing; in hwprobe_isa_ext0()
186 u64 perf = -1ULL; in hwprobe_misaligned()
191 if (perf == -1ULL) in hwprobe_misaligned()
200 if (perf == -1ULL) in hwprobe_misaligned()
222 u64 perf = -1ULL; in hwprobe_vec_misaligned()
228 if (perf == -1ULL) in hwprobe_vec_misaligned()
237 if (perf == -1ULL) in hwprobe_vec_misaligned()
258 switch (pair->key) { in hwprobe_one_pair()
265 * The kernel already assumes that the base single-letter ISA in hwprobe_one_pair()
271 pair->value = RISCV_HWPROBE_BASE_BEHAVIOR_IMA; in hwprobe_one_pair()
280 pair->value = hwprobe_misaligned(cpus); in hwprobe_one_pair()
284 pair->value = hwprobe_vec_misaligned(cpus); in hwprobe_one_pair()
288 pair->value = 0; in hwprobe_one_pair()
290 pair->value = riscv_cboz_block_size; in hwprobe_one_pair()
293 pair->value = 0; in hwprobe_one_pair()
295 pair->value = riscv_cbom_block_size; in hwprobe_one_pair()
298 pair->value = user_max_virt_addr(); in hwprobe_one_pair()
302 pair->value = riscv_timebase; in hwprobe_one_pair()
315 * call, but get their element key set to -1 and value set to 0 in hwprobe_one_pair()
319 pair->key = -1; in hwprobe_one_pair()
320 pair->value = 0; in hwprobe_one_pair()
325 static int hwprobe_get_values(struct riscv_hwprobe __user *pairs, in hwprobe_get_values() argument
336 return -EINVAL; in hwprobe_get_values()
352 return -EFAULT; in hwprobe_get_values()
355 * Userspace must provide at least one online CPU, without that in hwprobe_get_values()
360 return -EINVAL; in hwprobe_get_values()
363 for (out = 0; out < pair_count; out++, pairs++) { in hwprobe_get_values()
366 if (get_user(pair.key, &pairs->key)) in hwprobe_get_values()
367 return -EFAULT; in hwprobe_get_values()
371 ret = put_user(pair.key, &pairs->key); in hwprobe_get_values()
373 ret = put_user(pair.value, &pairs->value); in hwprobe_get_values()
376 return -EFAULT; in hwprobe_get_values()
382 static int hwprobe_get_cpus(struct riscv_hwprobe __user *pairs, in hwprobe_get_cpus() argument
393 return -EINVAL; in hwprobe_get_cpus()
396 return -EINVAL; in hwprobe_get_cpus()
403 return -EFAULT; in hwprobe_get_cpus()
416 ret = copy_from_user(&pair, &pairs[i], sizeof(pair)); in hwprobe_get_cpus()
418 return -EFAULT; in hwprobe_get_cpus()
422 pair = (struct riscv_hwprobe){ .key = -1, }; in hwprobe_get_cpus()
423 ret = copy_to_user(&pairs[i], &pair, sizeof(pair)); in hwprobe_get_cpus()
425 return -EFAULT; in hwprobe_get_cpus()
450 return -EFAULT; in hwprobe_get_cpus()
455 static int do_riscv_hwprobe(struct riscv_hwprobe __user *pairs, in do_riscv_hwprobe() argument
461 return hwprobe_get_cpus(pairs, pair_count, cpusetsize, in do_riscv_hwprobe()
464 return hwprobe_get_values(pairs, pair_count, cpusetsize, in do_riscv_hwprobe()
487 avd->all_cpu_hwprobe_values[key] = pair.value; in init_hwprobe_vdso_data()
500 * populated) or any value returns -1 (varies across CPUs), then the in init_hwprobe_vdso_data()
503 avd->homogeneous_cpus = id_bitsmash != 0 && id_bitsmash != -1; in init_hwprobe_vdso_data()
511 SYSCALL_DEFINE5(riscv_hwprobe, struct riscv_hwprobe __user *, pairs, in SYSCALL_DEFINE5() argument
515 return do_riscv_hwprobe(pairs, pair_count, cpusetsize, in SYSCALL_DEFINE5()