RE: [PATCH v2 04/21] x86/virt/tdx: Add skeleton for detecting and initializing TDX on demand

From: Tian, Kevin
Date: Wed Mar 23 2022 - 02:49:35 EST


> From: Kai Huang <kai.huang@xxxxxxxxx>
> Sent: Sunday, March 13, 2022 6:50 PM
> +static bool seamrr_enabled(void)
> +{
> + /*
> + * To detect any BIOS misconfiguration among cores, all logical
> + * cpus must have been brought up at least once. This is true
> + * unless 'maxcpus' kernel command line is used to limit the
> + * number of cpus to be brought up during boot time. However
> + * 'maxcpus' is basically an invalid operation mode due to the
> + * MCE broadcast problem, and it should not be used on a TDX
> + * capable machine. Just do paranoid check here and WARN()
> + * if not the case.
> + */
> + if (WARN_ON_ONCE(!cpumask_equal(&cpus_booted_once_mask,
> + cpu_present_mask)))
> + return false;
> +

cpu_present_mask doesn't always represent BIOS-enabled CPUs as it
can be further restricted by 'nr_cpus' and 'possible_cpus'. From this
angle above check doesn't capture all misconfigured boot options
which is incompatible with TDX. Then is such partial check still useful
or better to just document those restrictions and let TDX module
capture any violation later as what you explained in __init_tdx()?

Thanks
Kevin