diff mbox

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

Message ID 1470201841-25916-1-git-send-email-nikunj@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Nikunj A Dadhania Aug. 3, 2016, 5:24 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, 7:02 a.m. UTC | #1
On 03/08/16 15:24, 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>

This is better, 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..46f7e8f 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"
> +    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"
> +    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
>
diff mbox

Patch

diff --git a/board-qemu/slof/tree.fs b/board-qemu/slof/tree.fs
index 78dafab..46f7e8f 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"
+    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"
+    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