diff mbox series

[v2,04/11] lib: sbi: Auto start domain only if boot HART within limits

Message ID 20201204155224.733188-5-anup.patel@wdc.com
State Accepted
Headers show
Series OpenSBI domain configuration using device tree | expand

Commit Message

Anup Patel Dec. 4, 2020, 3:52 p.m. UTC
The sbi_domain_finalize() should auto start a domain only if the
boot HART is withing limits (i.e. less than SBI_HARTMASK_MAX_BITS).

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
---
 lib/sbi/sbi_domain.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Anup Patel Dec. 5, 2020, 9:50 a.m. UTC | #1
> -----Original Message-----
> From: Anup Patel <Anup.Patel@wdc.com>
> Sent: 04 December 2020 21:22
> To: Atish Patra <Atish.Patra@wdc.com>; Alistair Francis
> <Alistair.Francis@wdc.com>
> Cc: Anup Patel <anup@brainfault.org>; opensbi@lists.infradead.org; Anup
> Patel <Anup.Patel@wdc.com>; Alistair Francis <Alistair.Francis@wdc.com>
> Subject: [PATCH v2 04/11] lib: sbi: Auto start domain only if boot HART within
> limits
> 
> The sbi_domain_finalize() should auto start a domain only if the boot HART is
> withing limits (i.e. less than SBI_HARTMASK_MAX_BITS).
> 
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Reviewed-by: Atish Patra <atish.patra@wdc.com>
> ---
>  lib/sbi/sbi_domain.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index
> ac920b8..ecb098c 100644
> --- a/lib/sbi/sbi_domain.c
> +++ b/lib/sbi/sbi_domain.c
> @@ -403,6 +403,10 @@ int sbi_domain_finalize(struct sbi_scratch *scratch,
> u32 cold_hartid)
>  		/* Domain boot HART */
>  		dhart = dom->boot_hartid;
> 
> +		/* Ignore of boot HART is off limits */
> +		if (SBI_HARTMASK_MAX_BITS <= dhart)
> +			continue;
> +
>  		/* Ignore if boot HART not possible for this domain */
>  		if (!sbi_hartmask_test_hart(dhart, dom->possible_harts))
>  			continue;
> --
> 2.25.1

Applied this patch to the riscv/opensbi repo.

Regards,
Anup
diff mbox series

Patch

diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
index ac920b8..ecb098c 100644
--- a/lib/sbi/sbi_domain.c
+++ b/lib/sbi/sbi_domain.c
@@ -403,6 +403,10 @@  int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid)
 		/* Domain boot HART */
 		dhart = dom->boot_hartid;
 
+		/* Ignore of boot HART is off limits */
+		if (SBI_HARTMASK_MAX_BITS <= dhart)
+			continue;
+
 		/* Ignore if boot HART not possible for this domain */
 		if (!sbi_hartmask_test_hart(dhart, dom->possible_harts))
 			continue;