[SLOF] [PATCH slof v2] fdt: Pass the resulting device tree to QEMU

Alexey Kardashevskiy aik at ozlabs.ru
Tue Oct 3 09:22:38 AEDT 2017


On 03/10/17 03:18, Greg Kurz wrote:
> On Mon,  2 Oct 2017 16:38:19 +1100
> Alexey Kardashevskiy <aik at ozlabs.ru> wrote:
> 
>> This creates flatten device tree and passes it to QEMU via a custom
>> hypercall right before jumping to RTAS.
>>
>> On a machine with 256 CPUs and 256 virtual Intel E1000 devices the blob
>> is 360KB (356KB structs and 20KB of strings), building such a tree takes
>> ~2s on a POWER8 box. A simple tree with 1 CPU and a couple of devices
>> takes 38ms and creates 16KB blob.
>>
>> This preloads strings with 40 property names from CPU and PCI device nodes
>> and the strings lookup only searches within these. Without string reusing
>> at all, the strings blob is 200KB and rendering time is 1.7sec; with
>> unlimited reusing, the strings blob is 4KB and rendering time is 2.8sec.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
>> ---
>>
>> Changes:
>> v2:
>> * fixed comments from review
>> * added strings cache
>> * changed last_compat_vers from 0x17 to 0x16 as suggested by dwg
>>
> 
> I wanted to give a try with PHB hotplug and SLOF breaks, because...

How does it break exactly? I agree I do not clear the stack but it did not
show up in any form :-/


> 
> [...]
>> diff --git a/board-qemu/slof/rtas.fs b/board-qemu/slof/rtas.fs
>> index 54d3929..5beb079 100644
>> --- a/board-qemu/slof/rtas.fs
>> +++ b/board-qemu/slof/rtas.fs
>> @@ -98,6 +98,10 @@ find-qemu-rtas
>>  ;
>>  
>>  : rtas-quiesce ( -- )
>> +    " /" find-node
>> +    fdt-flatten-tree
>> +    dup hv-update-dt
> 
> .. this leaves the hcall return value on the stack. Maybe add:
> 
>    ?dup IF
>       \ Ignore hcall not implemented error, print error otherwise
>       dup -2 <> IF ." HV-UPDATE-DT error: " . cr ELSE drop THEN
>    THEN
> 
>> +    fdt-flatten-tree-free
>>      " quiesce" rtas-get-token rtas-cb rtas>token l!
>>      0 rtas-cb rtas>nargs l!
>>      0 rtas-cb rtas>nret l!
>> diff --git a/lib/libhvcall/hvcall.code b/lib/libhvcall/hvcall.code
>> index 8349748..6ff5715 100644
>> --- a/lib/libhvcall/hvcall.code
>> +++ b/lib/libhvcall/hvcall.code
>> @@ -136,3 +136,8 @@ PRIM(hv_X2d_update_X2d_phandle)
>>  	uint32_t old_phandle = TOS.u;
>>  	TOS.u = hv_generic(KVMPPC_H_UPDATE_PHANDLE, old_phandle, new_phandle);
>>  MIRP
>> +
>> +PRIM(hv_X2d_update_X2d_dt)
>> +	unsigned long dt = TOS.u;
>> +	TOS.u = hv_generic(KVMPPC_H_UPDATE_DT, dt);
>> +MIRP
>> diff --git a/lib/libhvcall/hvcall.in b/lib/libhvcall/hvcall.in
>> index ab7513a..b59e3f7 100644
>> --- a/lib/libhvcall/hvcall.in
>> +++ b/lib/libhvcall/hvcall.in
>> @@ -32,4 +32,5 @@ cod(hv-logical-memop)
>>  cod(hv-cas)
>>  cod(hv-rtas-update)
>>  cod(hv-update-phandle)
>> +cod(hv-update-dt)
>>  cod(get-print-version)
> 


-- 
Alexey


More information about the SLOF mailing list