[SeaBIOS] [PATCH] KVM vcpu hotplug seabios infrastructure

Liu, Jinsong jinsong.liu at intel.com
Mon Jun 7 11:33:40 CEST 2010


Kevin,

Thanks a lot for comments!
It's my fault not to speak clear about the patch.

This patch is ported from original KVM bochs bios.
During porting, we find that some points need be updated in order to work well with HVM guest:
--------------------------------
1). The 1st issue is vcpu number HVM support. As we know, Win2000 only support 15 cpus (otherwise will BSOD), and other os can support more cpus. To solve the issue, we use mk_ssdt.c, acpi-ssdt.dsl and makefile rules. When compiling, mk_ssdt.c and acpi-ssdt.dsl will produce 2 middle asl code, and next step produce 2 aml files (acpi-ssdt-15.hex and acpi-ssdt-anycpu.hex, which contain 2 aml array acpi_ssdt_15[] and acpi_ssdt_anycpu[]). When HVM booting, according to commandline vcpu number parameter (-smp N), build_ssdt() will choose which aml array it will use. If N<=15, build_ssdt will use acpi_ssdt_15[] to support Win2000 guest. If N>15, build_ssdt will use acpi_ssdt_anycpu[] to support other os (We define here 64 cpus same as what linux 2.6.32 current use).

2). As for madt, firstly according to Gleb's comments, we protect it as 'E820_NVS' so that os will not destroy it for whatever reason. Secondly, we add/sub 1 to madt checksum when add/remove 1 vcpu to keep checksum correct.

3). For Processor obj define, old bochs bios define it under \_PR. Theoretically it's OK as ACPI 1.0 say. However, in real test, we find that linux cannot support \_PR obj well. In this patch, we define Processor under \_SB as ACPI 2.0 say, cpu hot-add and hot-remove are both OK (Our test platform is linux2.6.32).

4). For Processor _MAT method, old bochs bios directly return MAT. In real test, we find that some os like linux 2.6.30 parse it error as 'integer', because MAT is 64bit which will make parse confuse under different ACPI version. In this patch, we explicitly transfer it as 'ToBuffer' so that os will correctly parse it as 'buffer'; 

5). For processor _STA method, old bochs return '0x9' for cpu hot-remove. This value is not quite match what ACPI 4.0 said, and (if I didn't remember wrong) work abnormally under linux 2.6.32 when hot-remove cpu. In this patch, we return value '0x0', tested under linux 2.6.32, cpu hot-remove work well;

6). For _EJ0 method, old bochs didn't define it. In this patch we difine '_EJ0' for Processor so that HVM linux has an 'eject' file under /sys/devices/LNXSYSTM:00/LNXSYBUS:00/LNXCPU:xx/eject. When cpu hot-remove, hvm linux kernel will trigger an uevent to userspace daemon, and then the daemon echo 1 to the eject file to remove cpu. This is tested under linux 2.6.32 and works OK when cpu hot-remove.
----------------------------------

As for iasl, I notice that current Makefile use iasl at dsdt build rules. I understand for user it seldom used if no change dsdt.
In our patch, how about use iasl (ssdt build rules) in Makefile, and I will build ssdt in my local server, and then send the compile result to you which contain acpi-ssdt[] aml array? We provide user a full built bios.bin and user don't need run 'iasl' when Makefile.


Thanks,
Jinsong


Kevin O'Connor wrote:
> On Mon, May 24, 2010 at 08:18:37PM +0800, Liu, Jinsong wrote:
>> Gleb Natapov wrote:
>>> On Tue, May 18, 2010 at 05:08:29PM +0800, Liu, Jinsong wrote:
>>>> Hi, Kevin, Gleb, Avi, and Yunhong
>>>> 
>>>> I have updated vcpu hotplug seabios infrastructure, as attached.
>>>> Please kindly review it, thanks!
> 
> It's not clear to me what this patch tries to accomplish.  Can you
> give an overview of what this patch does differently than the current
> code and why it is better?
> 
> Also, it looks like your patch requires iasl to compile seabios.  I'd
> prefer not to do that if possible.
> 
> -Kevin




More information about the SeaBIOS mailing list