On Thu, Apr 11, 2024 at 09:11:22PM -0700, Charlie Jenkins wrote:

> +static void hwprobe_isa_vendor_ext0(struct riscv_hwprobe *pair,
> +                                 const struct cpumask *cpus)
> +{
> +     int cpu;
> +     u64 missing = 0;
> +
> +     pair->value = 0;
> +
> +     struct riscv_hwprobe mvendorid = {
> +             .key = RISCV_HWPROBE_KEY_MVENDORID,
> +             .value = 0
> +     };
> +
> +     hwprobe_arch_id(&mvendorid, cpus);
> +
> +     /* Set value to zero if CPUs in the set do not have the same vendor. */
> +     if (mvendorid.value == -1ULL)
> +             return;
> +
> +     /*
> +      * Loop through and record vendor extensions that 1) anyone has, and
> +      * 2) anyone doesn't have.
> +      */
> +     for_each_cpu(cpu, cpus) {
> +             struct riscv_isainfo *isavendorinfo = &hart_isa_vendor[cpu];
> +
> +#define VENDOR_EXT_KEY(ext)                                                  
>         \
> +     do {                                                                    
>         \
> +             if (__riscv_isa_vendor_extension_available(isavendorinfo->isa,  
>         \
> +                                                      
> RISCV_ISA_VENDOR_EXT_##ext))   \
> +                     pair->value |= RISCV_HWPROBE_VENDOR_EXT_##ext;          
>         \
> +             else                                                            
>         \
> +                     missing |= RISCV_HWPROBE_VENDOR_EXT_##ext;              
>         \
> +     } while (false)
> +
> +     /*
> +      * Only use VENDOR_EXT_KEY() for extensions which can be exposed to 
> userspace,
> +      * regardless of the kernel's configuration, as no other checks, besides
> +      * presence in the hart_vendor_isa bitmap, are made.
> +      */
> +     VENDOR_EXT_KEY(XTHEADVECTOR);

Reading the comment here, I don't think you can do this. All vector
support in userspace is continent on kernel configuration options.

> +
> +#undef VENDOR_EXT_KEY
> +     }
> +
> +     /* Now turn off reporting features if any CPU is missing it. */
> +     pair->value &= ~missing;
> +}

Attachment: signature.asc
Description: PGP signature

Reply via email to