[SeaBIOS] [PATCH RFC 1/2] paravirt: disable MPTable in case of more than 255 CPUs

Kevin O'Connor kevin at koconnor.net
Mon May 9 17:12:25 CEST 2016


On Mon, May 09, 2016 at 11:43:53AM +0200, Igor Mammedov wrote:
> MPTable doesn't support more than 254 CPUs and
> QEMU supplies an alternative MADT table which
> guest will use instead of it. So do not install
> MPTable if more than 254 CPUs are provided.
> 
> Signed-off-by: Igor Mammedov <imammedo at redhat.com>
> ---
>  src/fw/mptable.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/fw/mptable.c b/src/fw/mptable.c
> index 47385cc..aec26f8 100644
> --- a/src/fw/mptable.c
> +++ b/src/fw/mptable.c
> @@ -24,6 +24,10 @@ mptable_setup(void)
>      if (! CONFIG_MPTABLE)
>          return;
>  
> +    if (romfile_loadint("etc/max-cpus", 0) > 255) {
> +        dprintf(1, "MPTable doesn't support more than 254 CPUs. Skip it.\n");
> +        return;
> +    }
>      dprintf(3, "init MPTable\n");
>  
>      // Config structure in temp area.

Thanks.  I'd prefer to not make further modifications to fw/mptable.c
though.  I think it would be better to do something like (totally
untested):

--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -154,8 +154,14 @@ qemu_platform_setup(void)
     smp_setup();
 
     // Create bios tables
-    pirtable_setup();
-    mptable_setup();
+    if (romfile_find("etc/legacy-tables-loader")) {
+        // QEMU may specify the PIR and mptable (or leave empty for no tables)
+        romfile_loader_execute("etc/legacy-tables-loader");
+    } else {
+        // Load the legacy internal tables
+        pirtable_setup();
+        mptable_setup();
+    }
     smbios_setup();
 
     if (CONFIG_FW_ROMFILE_LOAD) {

And then QEMU can create an empty fw_cfg file to suppress both the
mptable and the pir table.  (Or, it can populate it to specify exactly
what QEMU wants in those tables.)

-Kevin



More information about the SeaBIOS mailing list