[SeaBIOS] [PATCH for-1.10-stable] drop "etc/boot-cpus" fw_cfg file and reuse legacy QEMU_CFG_NB_CPUS

Kevin O'Connor kevin at koconnor.net
Tue Nov 15 15:54:47 CET 2016


On Fri, Nov 11, 2016 at 04:35:15PM +0100, Igor Mammedov wrote:
> since QEMU_CFG_NB_CPUS not going away anytime soon
> and serves the same purpose as just added "etc/boot-cpus" fw_cfg
> drop support for "etc/boot-cpus" while this code is not
> in use yet (i.e. QEMU with "etc/boot-cpus" hasn't been released)
> and reuse QEMU_CFG_NB_CPUS instead of it.
[...]
>  u16
>  qemu_get_present_cpus_count(void)
>  {
> -    u16 smp_count;
> -    if (!boot_cpus_file_sz) {
> -        smp_count = rtc_read(CMOS_BIOS_SMP_COUNT) + 1;
> -    } else {
> -        qemu_cfg_read_entry(&smp_count, boot_cpus_sel, boot_cpus_file_sz);
> +    u16 smp_count = 0;
> +    qemu_cfg_read_entry(&smp_count, QEMU_CFG_NB_CPUS, sizeof smp_count);
> +    u16 cmos_cpu_count = rtc_read(CMOS_BIOS_SMP_COUNT) + 1;
> +    if (smp_count < cmos_cpu_count) {
> +        smp_count = cmos_cpu_count;
>      }
>      return smp_count;
>  }

Just to confirm the forwards and backwards compatibility here - if the
above SeaBIOS code runs on QEMU version pre-2.8 then cmos_cpu_count
will always be greater than or equal to QEMU_CFG_NB_CPUS, and if
SeaBIOS runs on QEMU >= v2.8 then QEMU_CFG_NB_CPUS will always be
greater than or equal to cmos_cpu_count?

-Kevin

P.S. minor nit, but I prefer sizeof treated as a function (ie,
sizeof(smp_count) ), but I can fixup on commit.



More information about the SeaBIOS mailing list