mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-01 06:39:05 +00:00

Add a new hwprobe key "RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0" which allows userspace to probe for the new RISCV_ISA_VENDOR_EXT_XTHEADVECTOR vendor extension. This new key will allow userspace code to probe for which thead vendor extensions are supported. This API is modeled to be consistent with RISCV_HWPROBE_KEY_IMA_EXT_0. The bitmask returned will have each bit corresponding to a supported thead vendor extension of the cpumask set. Just like RISCV_HWPROBE_KEY_IMA_EXT_0, this allows a userspace program to determine all of the supported thead vendor extensions in one call. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> Reviewed-by: Evan Green <evan@rivosinc.com> Tested-by: Yangyu Chen <cyy@cyyself.name> Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-10-236c22791ef9@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
20 lines
537 B
C
20 lines
537 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#include <asm/vendor_extensions/thead.h>
|
|
#include <asm/vendor_extensions/thead_hwprobe.h>
|
|
#include <asm/vendor_extensions/vendor_hwprobe.h>
|
|
|
|
#include <linux/cpumask.h>
|
|
#include <linux/types.h>
|
|
|
|
#include <uapi/asm/hwprobe.h>
|
|
#include <uapi/asm/vendor/thead.h>
|
|
|
|
void hwprobe_isa_vendor_ext_thead_0(struct riscv_hwprobe *pair, const struct cpumask *cpus)
|
|
{
|
|
VENDOR_EXTENSION_SUPPORTED(pair, cpus,
|
|
riscv_isa_vendor_ext_list_thead.per_hart_isa_bitmap, {
|
|
VENDOR_EXT_KEY(XTHEADVECTOR);
|
|
});
|
|
}
|