On Wed, Dec 11, 2024 at 11:36:42AM +0100, Anthony Iliopoulos via SeaBIOS wrote:
> Currently the mptable setup code only considers one core per cpu package
> for populating the cpu tables. The detection logic goes back to machines
> where the cpuid would signify the presence of multiple logical cores
> (HT) and presumably this change was made to prevent creating vcpus for
> each hyperthread.
>
> In practice this restriction is not required any longer especially since
> current processors feature many physical cores per socket, and it is
> preventing QEMU guests that don't enable ACPI from seeing more than one
> cores, unless those cores are explicitly placed across multiple sockets
> (one core per socket, specifically).
>
> During v6.2 QEMU changed the default cpu topology arrangement preference
> from arranging multiple cores spreaded across multiple sockets to
> placing them within the same socket [1]. In practice this means that
> without specifing explicitly the cpu topology and assuming QEMU
> defaults, a guest without ACPI will not be able to instantiate more than
> one core.
>
> Fix this by lifting the restriction of only populating the mptable with
> the first logical processor per package.
>
> [1] commit 4a0af2930a4e ("machine: Prefer cores over sockets in smp
> parsing since 6.2")
>
> Fixes: c0ad0e8febe5 ("Only add the first logical CPU in each physical
> CPU to the MPS tables.")
>
> Signed-off-by: Anthony Iliopoulos <[email protected]>
Alas, we found that we can't maintain these files - anytime we make
any change (for better or worse) it causes backwards compatibility
problems with clients. If you look at the top of mptable.c you'll
find:
// DO NOT ADD NEW FEATURES HERE. (See paravirt.c / biostables.c instead.)
So, if a change is needed to the mptable then code will be needed to
generate the desired table in qemu and pass it through to SeaBIOS.
Cheers,
-Kevin
> ---
> src/fw/mptable.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/src/fw/mptable.c b/src/fw/mptable.c
> index 47385cc5d32d..a939743691c9 100644
> --- a/src/fw/mptable.c
> +++ b/src/fw/mptable.c
> @@ -47,19 +47,13 @@ mptable_setup(void)
> cpuid_signature = 0x600;
> cpuid_features = 0x201;
> }
> - int pkgcpus = 1;
> - if (cpuid_features & (1 << 28)) {
> - /* Only populate the MPS tables with the first logical CPU in
> - each package */
> - pkgcpus = (ebx >> 16) & 0xff;
> - pkgcpus = 1 << (__fls(pkgcpus - 1) + 1); /* round up to power of 2 */
> - }
> +
> u8 apic_version = readl((u8*)BUILD_APIC_ADDR + 0x30) & 0xff;
>
> // CPU definitions.
> struct mpt_cpu *cpus = (void*)&config[1], *cpu = cpus;
> int i;
> - for (i = 0; i < MaxCountCPUs; i+=pkgcpus) {
> + for (i = 0; i < MaxCountCPUs; i++) {
> memset(cpu, 0, sizeof(*cpu));
> cpu->type = MPT_TYPE_CPU;
> cpu->apicid = i;
> --
> 2.47.0
>
> _______________________________________________
> SeaBIOS mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
_______________________________________________
SeaBIOS mailing list -- [email protected]
To unsubscribe send an email to [email protected]