lib: sbi_domain: Re-work boot-time assignment of HARTs to non-ROOT domains

Assign a non-ROOT domain to a HART on first come first serve basis if the
HART is listed as a possible HART of the non-ROOT domain. If no non-ROOT
domain list a HART as possible HART then the HART is assigned to the ROOT
domain.

This allows us to drop the OpenSBI specific DT property from each CPU DT
node (aka "opensbi-domain" Dt property).

Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com>
Reviewed-by: Pawandeep Oza <pawandeep.oza@oss.qualcomm.com>
Tested-by: Pawandeep Oza <pawandeep.oza@oss.qualcomm.com>
Reviewed-by: Yu-Chien Peter Lin <peter.lin@sifive.com>
Link: https://lore.kernel.org/r/20260905131748.922920-3-anup.patel@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Anup Patel
2026-09-16 09:21:21 +05:30
committed by Anup Patel
parent 6dc5a896b1
commit 71faf5a307
5 changed files with 42 additions and 142 deletions
+14 -27
View File
@@ -183,23 +183,16 @@ The DT properties of a domain instance DT node are as follows:
domain instance. If not specified, defaults to the coldboot HART. Note that
if the coldboot HART is assigned to this domain, it will be forced as
the boot HART regardless of this property.
* **next-arg1** (Optional) - The 64 bit next booting stage arg1 for the
domain instance. If this DT property is not available and coldboot HART
is not assigned to the domain instance then **next booting stage arg1 of coldboot HART**
is used as default value.
* **next-addr** (Optional) - The 64 bit next booting stage address for the
domain instance. If this DT property is not available and coldboot HART
is not assigned to the domain instance then **0x0** is used as default
value. If this DT property is not available and coldboot HART is assigned
to the domain instance then **next booting stage address of coldboot HART**
is used as default value.
* **next-arg1** (Optional) - The 64 bit next booting stage arg1
for the domain instance. If this DT property is not available
then **next booting stage arg1 of coldboot HART** is used as default value.
* **next-addr** (Optional) - The 64 bit next booting stage address
for the domain instance. If this DT property is not available
then **next booting stage address of coldboot HART** is used as default value.
* **next-mode** (Optional) - The 32 bit next booting stage mode for the
domain instance. The possible values of this DT property are: **0x1**
(S-mode), and **0x0** (U-mode). If this DT property is not available
and coldboot HART is not assigned to the domain instance then **0x1**
is used as default value. If this DT property is not available and
coldboot HART is assigned to the domain instance then **next booting
stage mode of coldboot HART** is used as default value.
then **next booting stage mode of coldboot HART** is used as default value.
* **system-reset-allowed** (Optional) - A boolean flag representing
whether the domain instance is allowed to do system reset.
* **system-suspend-allowed** (Optional) - A boolean flag representing
@@ -207,15 +200,14 @@ The DT properties of a domain instance DT node are as follows:
### Assigning HART To Domain Instance
By default, all HARTs are assigned to **the ROOT domain**. The OpenSBI
platform support can provide the HART to domain instance assignment using
platform specific callback.
At boot-time, a HART is assigned to a non-ROOT domain on first come
first serve basis if the HART is listed as a possible HART of the
non-ROOT domain. If no non-ROOT domain list a HART as possible HART
then the HART is assigned to **the ROOT domain**.
The HART to domain instance assignment can be parsed from the device tree
using optional DT property **opensbi-domain** in each CPU DT node. The
value of DT property **opensbi-domain** is the DT phandle of the domain
instance DT node. If **opensbi-domain** DT property is not specified then
corresponding HART is assigned to **the ROOT domain**.
At runtime, the assignment of a HART can change from one domain to
another domain as long as the HART is listed in possible HARTs of
both domains.
### Domain Configuration Only Accessible to OpenSBI
@@ -289,7 +281,6 @@ be done:
device_type = "cpu";
reg = <0x00>;
compatible = "riscv";
opensbi-domain = <&tdomain>;
...
};
@@ -297,7 +288,6 @@ be done:
device_type = "cpu";
reg = <0x01>;
compatible = "riscv";
opensbi-domain = <&udomain>;
...
};
@@ -305,7 +295,6 @@ be done:
device_type = "cpu";
reg = <0x02>;
compatible = "riscv";
opensbi-domain = <&udomain>;
...
};
@@ -313,7 +302,6 @@ be done:
device_type = "cpu";
reg = <0x03>;
compatible = "riscv";
opensbi-domain = <&udomain>;
...
};
@@ -321,7 +309,6 @@ be done:
device_type = "cpu";
reg = <0x04>;
compatible = "riscv";
opensbi-domain = <&udomain>;
...
};
};