[PATCH 4/9] cpu/SMT: Create topology_smt_threads_supported()

Thomas Gleixner tglx at linutronix.de
Sun Jun 11 08:15:52 AEST 2023


On Thu, May 25 2023 at 01:56, Michael Ellerman wrote:
> +/**
> + * topology_smt_threads_supported - Check if the given number of SMT threads
> + *				    is supported.
> + *
> + * @threads:	The number of SMT threads.
> + */
> +bool topology_smt_threads_supported(unsigned int threads)
> +{
> +	// Only support a single thread or all threads.
> +	return threads == 1 || threads == smp_num_siblings;
> +}

You can make that a simple core function when cpu_smt_*_threads is
consistent along the lines of my previous reply.

static bool cpu_smt_num_threads_valid(unsigned int threads)
{
        if (IS_ENABLED(CONFIG_SMT_NUM_THREADS_DYNAMIC))
		return threads >= 1 && threads <= cpu_smt_max_threads;
        return threads == 1 || threads == cpu_smt_max_threads;
}

Or something like that.

Thanks,

        tglx


More information about the Linuxppc-dev mailing list