# Re: \[PATCH 4/9\] cpu/SMT: Create topology\_smt\_threads\_supported()

- From: Thomas Gleixner \<hidden\>
- Date: 2023-06-10 22:15:59 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2023/06/2228841
- Thread: https://ratatoskr.run/linuxppc-dev/2023/05/2208839/t.md

```text
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
```
