diff mbox

[v1] Remove dependency on cpu/@0 for booting

Message ID 1469610962-13335-1-git-send-email-nikunj@linux.vnet.ibm.com
State Rejected
Headers show

Commit Message

Nikunj A Dadhania July 27, 2016, 9:16 a.m. UTC
With the addition of cpu hotplug in QEMU, cpu@0 can be removed as well.
SLOF should not depend on it. Find the first child in the "/cpus" node
and get the timer base frequency and set it as the chosen cpu as well

Reported-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
---
 board-qemu/slof/tree.fs | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Alexey Kardashevskiy Aug. 3, 2016, 3:18 a.m. UTC | #1
On 27/07/16 19:16, Nikunj A Dadhania wrote:
> With the addition of cpu hotplug in QEMU, cpu@0 can be removed as well.
> SLOF should not depend on it. Find the first child in the "/cpus" node
> and get the timer base frequency and set it as the chosen cpu as well
> 
> Reported-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>



Thanks, applied.



> ---
>  board-qemu/slof/tree.fs | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/board-qemu/slof/tree.fs b/board-qemu/slof/tree.fs
> index 78dafab..76a9ecc 100644
> --- a/board-qemu/slof/tree.fs
> +++ b/board-qemu/slof/tree.fs
> @@ -45,7 +45,9 @@ device-end
>  
>  \ Fixup timebase frequency from device-tree
>  : fixup-tbfreq
> -    " /cpus/@0" find-device
> +    " /cpus" find-device
> +    get-node child dup 0= ABORT" CPU not found" THEN
> +    set-node
>      " timebase-frequency" get-node get-package-property IF
>          2drop
>      ELSE
> @@ -167,7 +169,14 @@ populate-pci-busses
>  
>  6c0 cp
>  
> -s" /cpus/@0" open-dev encode-int s" cpu" set-chosen
> +\ Do not assume that cpu0 is available
> +: set-chosen-cpu
> +    " /cpus" find-device
> +    get-node child dup 0= ABORT" CPU not found" THEN
> +    node>path open-dev encode-int s" cpu" set-chosen
> +;
> +set-chosen-cpu
> +
>  s" /memory@0" open-dev encode-int s" memory" set-chosen
>  
>  6e0 cp
>
Alexey Kardashevskiy Aug. 3, 2016, 3:47 a.m. UTC | #2
On 03/08/16 13:18, Alexey Kardashevskiy wrote:
> On 27/07/16 19:16, Nikunj A Dadhania wrote:
>> With the addition of cpu hotplug in QEMU, cpu@0 can be removed as well.
>> SLOF should not depend on it. Find the first child in the "/cpus" node
>> and get the timer base frequency and set it as the chosen cpu as well
>>
>> Reported-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
>> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> 
> 
> 
> Thanks, applied.

Oops. No, not applied.

/home/aik/qemu-system-ppc64 -enable-kvm -m 4G \
-trace events=qemu_trace_events -nodefaults \
-chardev stdio,id=STDIO0,signal=off,mux=on \
-device spapr-vty,id=svty0,chardev=STDIO0,reg=0x71000100 \
-mon id=MON0,chardev=STDIO0,mode=readline -nographic -vga none \
-machine pseries -smp 16,threads=8 -L /home/aik/t/qemu-ppc64-bios/ \
-bios ./slof.bin \
-chardev socket,id=SOCKET0,server,nowait,host=localhost,port=30000 \
-mon chardev=SOCKET0,mode=readline

produces SLOF prompt with:

-2 >



> 
> 
> 
>> ---
>>  board-qemu/slof/tree.fs | 13 +++++++++++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/board-qemu/slof/tree.fs b/board-qemu/slof/tree.fs
>> index 78dafab..76a9ecc 100644
>> --- a/board-qemu/slof/tree.fs
>> +++ b/board-qemu/slof/tree.fs
>> @@ -45,7 +45,9 @@ device-end
>>  
>>  \ Fixup timebase frequency from device-tree
>>  : fixup-tbfreq
>> -    " /cpus/@0" find-device
>> +    " /cpus" find-device
>> +    get-node child dup 0= ABORT" CPU not found" THEN
>> +    set-node
>>      " timebase-frequency" get-node get-package-property IF
>>          2drop
>>      ELSE
>> @@ -167,7 +169,14 @@ populate-pci-busses
>>  
>>  6c0 cp
>>  
>> -s" /cpus/@0" open-dev encode-int s" cpu" set-chosen
>> +\ Do not assume that cpu0 is available
>> +: set-chosen-cpu
>> +    " /cpus" find-device
>> +    get-node child dup 0= ABORT" CPU not found" THEN
>> +    node>path open-dev encode-int s" cpu" set-chosen
>> +;
>> +set-chosen-cpu
>> +
>>  s" /memory@0" open-dev encode-int s" memory" set-chosen
>>  
>>  6e0 cp
>>
> 
>
Nikunj A Dadhania Aug. 3, 2016, 5:19 a.m. UTC | #3
Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> On 03/08/16 13:18, Alexey Kardashevskiy wrote:
>> On 27/07/16 19:16, Nikunj A Dadhania wrote:
>>> With the addition of cpu hotplug in QEMU, cpu@0 can be removed as well.
>>> SLOF should not depend on it. Find the first child in the "/cpus" node
>>> and get the timer base frequency and set it as the chosen cpu as well
>>>
>>> Reported-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
>>> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> 
>> 
>> 
>> Thanks, applied.
>
> Oops. No, not applied.
>
> /home/aik/qemu-system-ppc64 -enable-kvm -m 4G \
> -trace events=qemu_trace_events -nodefaults \
> -chardev stdio,id=STDIO0,signal=off,mux=on \
> -device spapr-vty,id=svty0,chardev=STDIO0,reg=0x71000100 \
> -mon id=MON0,chardev=STDIO0,mode=readline -nographic -vga none \
> -machine pseries -smp 16,threads=8 -L /home/aik/t/qemu-ppc64-bios/ \
> -bios ./slof.bin \
> -chardev socket,id=SOCKET0,server,nowait,host=localhost,port=30000 \
> -mon chardev=SOCKET0,mode=readline
>
> produces SLOF prompt with:
>
> -2 >

Got that... :(

>>>  board-qemu/slof/tree.fs | 13 +++++++++++--
>>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/board-qemu/slof/tree.fs b/board-qemu/slof/tree.fs
>>> index 78dafab..76a9ecc 100644
>>> --- a/board-qemu/slof/tree.fs
>>> +++ b/board-qemu/slof/tree.fs
>>> @@ -45,7 +45,9 @@ device-end
>>>  
>>>  \ Fixup timebase frequency from device-tree
>>>  : fixup-tbfreq
>>> -    " /cpus/@0" find-device
>>> +    " /cpus" find-device
>>> +    get-node child dup 0= ABORT" CPU not found" THEN

Need to remove THEN at the end..

>>> +    set-node
>>>      " timebase-frequency" get-node get-package-property IF
>>>          2drop
>>>      ELSE
>>> @@ -167,7 +169,14 @@ populate-pci-busses
>>>  
>>>  6c0 cp
>>>  
>>> -s" /cpus/@0" open-dev encode-int s" cpu" set-chosen
>>> +\ Do not assume that cpu0 is available
>>> +: set-chosen-cpu
>>> +    " /cpus" find-device
>>> +    get-node child dup 0= ABORT" CPU not found" THEN

And here.. missed that.

>>> +    node>path open-dev encode-int s" cpu" set-chosen
>>> +;
>>> +set-chosen-cpu
>>> +
>>>  s" /memory@0" open-dev encode-int s" memory" set-chosen
>>>  
>>>  6e0 cp
>>>

Will send updated patch.

Regards
Nikunj
diff mbox

Patch

diff --git a/board-qemu/slof/tree.fs b/board-qemu/slof/tree.fs
index 78dafab..76a9ecc 100644
--- a/board-qemu/slof/tree.fs
+++ b/board-qemu/slof/tree.fs
@@ -45,7 +45,9 @@  device-end
 
 \ Fixup timebase frequency from device-tree
 : fixup-tbfreq
-    " /cpus/@0" find-device
+    " /cpus" find-device
+    get-node child dup 0= ABORT" CPU not found" THEN
+    set-node
     " timebase-frequency" get-node get-package-property IF
         2drop
     ELSE
@@ -167,7 +169,14 @@  populate-pci-busses
 
 6c0 cp
 
-s" /cpus/@0" open-dev encode-int s" cpu" set-chosen
+\ Do not assume that cpu0 is available
+: set-chosen-cpu
+    " /cpus" find-device
+    get-node child dup 0= ABORT" CPU not found" THEN
+    node>path open-dev encode-int s" cpu" set-chosen
+;
+set-chosen-cpu
+
 s" /memory@0" open-dev encode-int s" memory" set-chosen
 
 6e0 cp