Few misc fixes
cover Few misc fixes
This series adds few fixes which were discovered while adding ACLINT support in OpenSBI.
These patches can be found in misc_fixes_v1 branch at:
https://github.com/avpatel/opensbi.git
Anup Patel (2):
lib: Check region base for merging in sbi_domain_root_add_memregion()
lib: utils: Try other FDT drivers when we see SBI_ENODEV
lib/sbi/sbi_domain.c | 3 ++- lib/utils/ipi/fdt_ipi.c | 3 +++ lib/utils/irqchip/fdt_irqchip.c | 3 +++ lib/utils/reset/fdt_reset.c | 3 +++ lib/utils/serial/fdt_serial.c | 5 +++++ lib/utils/timer/fdt_timer.c | 3 +++ 6 files changed, 19 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
PATCH 1/2 lib: Check region base for merging in sbi_domain_root_add_memregion()
We can merge region B onto region A only if base of region A is aligned to region A order + 1.
--- lib/sbi/sbi_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/sbi/sbi_domain.c +2 -1
@@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg)if (!nreg1->order)continue ; -if ((nreg->base +BIT (nreg->order)) == nreg1->base && +if (!(nreg->base & (BIT (nreg->order +1 ) -1 )) && + (nreg->base +BIT (nreg->order)) == nreg1->base && nreg->order == nreg1->order && nreg->flags == nreg1->flags) { nreg->order++;
Signature · 1 line
2.25.1
PATCH 1/2 lib: Check region base for merging in sbi_domain_root_add_memregion()
Quoted 27 lines · Anup Patel
We can merge region B onto region A only if base of region A is aligned to region A order + 1.
Signed-off-by Anup Patel <[email protected]>--- lib/sbi/sbi_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/sbi/sbi_domain.c +2
-2@@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg)if (!nreg1->order)continue ; -if ((nreg->base +BIT (nreg->order)) == nreg1->base && +if (!(nreg->base & (BIT (nreg->order +1 ) -1 )) && + (nreg->base +BIT (nreg->order)) == nreg1->base && nreg->order == nreg1->order && nreg->flags == nreg1->flags) { nreg->order++; --2.25.1
Quoted 4 lines
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
Signature · 2 lines
Regards, Atish
PATCH 1/2 lib: Check region base for merging in sbi_domain_root_add_memregion()
In reply to Anup Patel? 2021-05-20?? 21:29 +0530?Anup Patel???
Quoted 4 lines
We can merge region B onto region A only if base of region A is aligned to region A order + 1.
Signed-off-by Anup Patel <[email protected]>
Quoted 26 lines
--- lib/sbi/sbi_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/sbi/sbi_domain.c +0
-1@@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg)if (!nreg1->order)continue ; - if ((nreg->base + BIT(nreg->order)) == nreg1-Quoted 1 line
base &&
lib/sbi/sbi_domain.c +1
-0+ if (!(nreg->base & (BIT(nreg->order + 1) - 1))&&
lib/sbi/sbi_domain.c +1
-0+ (nreg->base + BIT(nreg->order)) == nreg1-Quoted 1 line
base &&
lib/sbi/sbi_domain.c +0
-0nreg->order == nreg1->order && nreg->flags == nreg1->flags) { nreg->order++;Signature · 1 line
2.25.1
Anup Patel
AppliedPATCH 1/2 lib: Check region base for merging in sbi_domain_root_add_memregion()
Quoted 11 lines
-----Original Message-----
From: Xiang W <[email protected]>
Sent: 21 May 2021 12:09
To: Anup Patel <[email protected]>; Atish Patra <[email protected]>; Alistair Francis <[email protected]>
Cc: Anup Patel <[email protected]>; opensbi at lists.infradead.org
Subject: Re: [PATCH 1/2] lib: Check region base for merging insbi_domain_root_add_memregion()
Quoted 7 lines
? 2021-05-20?? 21:29 +0530?Anup Patel???
Quoted 4 lines
We can merge region B onto region A only if base of region A is aligned to region A order + 1.
Signed-off-by Anup Patel <[email protected]>Reviewed-by Xiang W <[email protected]>
Applied this patch to the riscv/opensbi repo
Regards,
Anup
Quoted 27 lines
Quoted 27 lines
--- lib/sbi/sbi_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/sbi/sbi_domain.c index renamed from lib/sbi/sbi_domain.c +0
-084f30b9..3096af0 100644
lib/sbi/sbi_domain.c +0
-1@@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg)if (!nreg1->order)continue ; - if ((nreg->base + BIT(nreg->order)) == nreg1-Quoted 1 line
base &&
lib/sbi/sbi_domain.c +1
-0+ if (!(nreg->base & (BIT(nreg->order + 1) - 1))&&
lib/sbi/sbi_domain.c +1
-0+ (nreg->base + BIT(nreg->order)) == nreg1-Quoted 1 line
base &&
lib/sbi/sbi_domain.c +0
-1nreg->order == nreg1->order && nreg->flags == nreg1->flags) { nreg->order++; --2.25.1
PATCH 2/2 lib: utils: Try other FDT drivers when we see SBI_ENODEV
In reply to Anup PatelWe should try other FDT drivers when we see SBI_ENODEV returned by cold_init() of FDT driver.
--- lib/utils/ipi/fdt_ipi.c | 3 +++ lib/utils/irqchip/fdt_irqchip.c | 3 +++ lib/utils/reset/fdt_reset.c | 3 +++ lib/utils/serial/fdt_serial.c | 5 +++++ lib/utils/timer/fdt_timer.c | 3 +++ 5 files changed, 17 insertions(+)
lib/utils/ipi/fdt_ipi.c +3 -0
@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/ipi/fdt_ipi.h>
@@ -54,6 +55,8 @@ static int fdt_ipi_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }
lib/utils/irqchip/fdt_irqchip.c +3 -0
@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/irqchip/fdt_irqchip.h>
@@ -47,6 +48,8 @@ static int fdt_irqchip_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }
lib/utils/reset/fdt_reset.c +3 -0
@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/reset/fdt_reset.h>
@@ -39,6 +40,8 @@ int fdt_reset_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }
lib/utils/serial/fdt_serial.c +5 -0
@@ -8,6 +8,7 @@*/ #include <libfdt.h> +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/serial/fdt_serial.h>
@@ -59,6 +60,8 @@ int fdt_serial_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }
@@ -80,6 +83,8 @@ int fdt_serial_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }
lib/utils/timer/fdt_timer.c +3 -0
@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/timer/fdt_timer.h>
@@ -54,6 +55,8 @@ static int fdt_timer_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }
Signature · 1 line
2.25.1
PATCH 2/2 lib: utils: Try other FDT drivers when we see SBI_ENODEV
Quoted 131 lines · Anup Patel
We should try other FDT drivers when we see
SBI_ENODEVreturned bycold_init()of FDT driver.Signed-off-by Anup Patel <[email protected]>--- lib/utils/ipi/fdt_ipi.c | 3 +++ lib/utils/irqchip/fdt_irqchip.c | 3 +++ lib/utils/reset/fdt_reset.c | 3 +++ lib/utils/serial/fdt_serial.c | 5 +++++ lib/utils/timer/fdt_timer.c | 3 +++ 5 files changed, 17 insertions(+)lib/utils/ipi/fdt_ipi.c +3
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/ipi/fdt_ipi.h> @@ -54,6 +55,8 @@ static int fdt_ipi_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/irqchip/fdt_irqchip.c +3
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/irqchip/fdt_irqchip.h> @@ -47,6 +48,8 @@ static int fdt_irqchip_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/reset/fdt_reset.c +3
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/reset/fdt_reset.h> @@ -39,6 +40,8 @@ int fdt_reset_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/serial/fdt_serial.c +5
-0@@ -8,6 +8,7 @@*/ #include <libfdt.h> +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/serial/fdt_serial.h> @@ -59,6 +60,8 @@ int fdt_serial_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }@@ -80,6 +83,8 @@ int fdt_serial_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/timer/fdt_timer.c +3
-1@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/timer/fdt_timer.h> @@ -54,6 +55,8 @@ static int fdt_timer_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; } --2.25.1
Quoted 4 lines
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
Signature · 2 lines
Regards, Atish
PATCH 2/2 lib: utils: Try other FDT drivers when we see SBI_ENODEV
In reply to Anup Patel? 2021-05-20?? 21:29 +0530?Anup Patel???
Quoted 4 lines
We should try other FDT drivers when we see
SBI_ENODEVreturned bycold_init()of FDT driver.Signed-off-by Anup Patel <[email protected]>
Quoted 133 lines
--- lib/utils/ipi/fdt_ipi.c | 3 +++ lib/utils/irqchip/fdt_irqchip.c | 3 +++ lib/utils/reset/fdt_reset.c | 3 +++ lib/utils/serial/fdt_serial.c | 5 +++++ lib/utils/timer/fdt_timer.c | 3 +++ 5 files changed, 17 insertions(+)lib/utils/ipi/fdt_ipi.c +3
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/ipi/fdt_ipi.h> @@ -54,6 +55,8 @@ static int fdt_ipi_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc;lib/utils/ipi/fdt_ipi.c +0
-0}lib/utils/irqchip/fdt_irqchip.c +3
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/irqchip/fdt_irqchip.h> @@ -47,6 +48,8 @@ static int fdt_irqchip_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc;lib/utils/irqchip/fdt_irqchip.c +0
-0}lib/utils/reset/fdt_reset.c +3
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/reset/fdt_reset.h> @@ -39,6 +40,8 @@ int fdt_reset_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/serial/fdt_serial.c +5
-0@@ -8,6 +8,7 @@*/ #include <libfdt.h> +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/serial/fdt_serial.h> @@ -59,6 +60,8 @@ int fdt_serial_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }@@ -80,6 +83,8 @@ int fdt_serial_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/timer/fdt_timer.c +3
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/timer/fdt_timer.h> @@ -54,6 +55,8 @@ static int fdt_timer_cold_init(void) drv->match_table, &match)) >= 0) {if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc;}
Signature · 1 line
2.25.1
Anup Patel
AppliedPATCH 2/2 lib: utils: Try other FDT drivers when we see SBI_ENODEV
Quoted 11 lines
-----Original Message-----
From: Xiang W <[email protected]>
Sent: 21 May 2021 12:09
To: Anup Patel <[email protected]>; Atish Patra <[email protected]>; Alistair Francis <[email protected]>
Cc: Anup Patel <[email protected]>; opensbi at lists.infradead.org
Subject: Re: [PATCH 2/2] lib: utils: Try other FDT drivers when we seeSBI_ENODEV
Quoted 7 lines
? 2021-05-20?? 21:29 +0530?Anup Patel???
Quoted 4 lines
We should try other FDT drivers when we see
SBI_ENODEVreturned bycold_init()of FDT driver.Signed-off-by Anup Patel <[email protected]>Reviewed-by Xiang W <[email protected]>
Applied this patch to the riscv/opensbi repo
Regards,
Anup
Quoted 130 lines
Quoted 130 lines
--- lib/utils/ipi/fdt_ipi.c | 3 +++ lib/utils/irqchip/fdt_irqchip.c | 3 +++ lib/utils/reset/fdt_reset.c | 3 +++ lib/utils/serial/fdt_serial.c | 5 +++++ lib/utils/timer/fdt_timer.c | 3 +++ 5 files changed, 17 insertions(+)lib/utils/ipi/fdt_ipi.c index renamed from lib/utils/ipi/fdt_ipi.c +0
-0efca37e..3932f50 100644
lib/utils/ipi/fdt_ipi.c +1
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include<
sbi_utils/ipi/fdt_ipi.h> @@ -54,6 +55,8 @@ static intfdt_ipi_cold_init(void)
drv->match_table, &match)) >=
0) {lib/utils/ipi/fdt_ipi.c +2
-0if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }(quoted diff) +0
-0
b/lib/utils/irqchip/fdt_irqchip.cindex 3630be6..1306d50 100644lib/utils/irqchip/fdt_irqchip.c +1
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include<
sbi_utils/irqchip/fdt_irqchip.h> @@ -47,6 +48,8 @@ static intfdt_irqchip_cold_init(void)
drv->match_table, &match)) >=
0) {lib/utils/irqchip/fdt_irqchip.c +2
-0if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/reset/fdt_reset.c +1
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include<
sbi_utils/reset/fdt_reset.h> @@ -39,6 +40,8 @@ intfdt_reset_init(void)lib/utils/reset/fdt_reset.c +2
-0if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }(quoted diff) +0
-0
b/lib/utils/serial/fdt_serial.cindex bad3387..25982ec 100644lib/utils/serial/fdt_serial.c +1
-0@@ -8,6 +8,7 @@*/ #include <libfdt.h> +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include<
sbi_utils/serial/fdt_serial.h> @@ -59,6 +60,8 @@ intfdt_serial_init(void)lib/utils/serial/fdt_serial.c +4
-0if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }@@ -80,6 +83,8 @@ int fdt_serial_init(void)if (drv->init) { rc = drv->init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; }lib/utils/timer/fdt_timer.c +1
-0@@ -7,6 +7,7 @@* Anup Patel <[email protected]> */ +#include <sbi/sbi_error.h> #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> #include<
sbi_utils/timer/fdt_timer.h> @@ -54,6 +55,8 @@ static intfdt_timer_cold_init(void)
drv->match_table, &match)) >=
0) {lib/utils/timer/fdt_timer.c +2
-1if (drv->cold_init) { rc = drv->cold_init (fdt, noff, match); +if (rc ==SBI_ENODEV ) +continue ;if (rc)return rc; } --2.25.1