platform/ae350: Initialize Coherent Manager as early as possible
PATCH 2/2 platform/ae350: Initialize Coherent Manager as early as possible
Coherent Manager will guarantee cache coherency as well as
the correctness of atomic extension instruction on Andes 45 series on ae350.
This feature needs to be enabled before the first
A extension instruction, thus initialize it as early as possible.
--- platform/andes/ae350/platform.c | 32 ++++++++++++++++++ platform/andes/ae350/platform.h | 60 ++++++++++++++++++--------------- 2 files changed, 64 insertions(+), 28 deletions(-)
platform/andes/ae350/platform.c +32 -0
@@ -28,6 +28,38 @@ static struct plic_data plic = { .num_src = AE350_PLIC_NUM_SOURCES, }; +static bool is_andestar45_series (void ) +{ +uintptr_t marchid =csr_read (CSR_MARCHID ); + +return ((marchid &0xF0 ) >>4 ==4 && + (marchid &0xF ) ==5 ) ? true : false; +} + +/* per harts early initialization */ +void harts_early_init (void ) +{ +uintptr_t mcache_ctl_val =csr_read (CSR_MCACHECTL ); + +if (is_andestar45_series ()) { +if (!(mcache_ctl_val &V5_MCACHE_CTL_DC_COHEN_EN )) + mcache_ctl_val |=V5_MCACHE_CTL_DC_COHEN_EN ; + +csr_write (CSR_MCACHECTL , mcache_ctl_val); + +/* +* Check DC_COHEN_EN, if cannot write to mcache_ctl, +* we assume this bitmap not support L2 CM +*/ + mcache_ctl_val =csr_read (CSR_MCACHECTL ); +if ((mcache_ctl_val &V5_MCACHE_CTL_DC_COHEN_EN )) { +/* Wait for DC_COHSTA bit be set */ +while (!(mcache_ctl_val &V5_MCACHE_CTL_DC_COHSTA_EN )) + mcache_ctl_val =csr_read (CSR_MCACHECTL ); + } + } +} +/* Platform final initialization. */ static int ae350_final_init (bool cold_boot) {
platform/andes/ae350/platform.h +32 -28
91 lines not on this page · raw message
Signature · 1 line
2.17.0
PATCH 2/2 platform/ae350: Initialize Coherent Manager as early as possible
Quoted 6 lines · Leo Yu-Chi Liang
Coherent Manager will guarantee cache coherency as well as
the correctness of atomic extension instruction on Andes 45 series on ae350.This feature needs to be enabled before the first
A extension instruction, thus initialize it as early as possible.
Why should this be OpenSBI?s responsibility, rather than in whatever firmware you have running before OpenSBI that does whatever low-level platform initialisation is needed like DRAM training (which so far has been kept out of OpenSBI)? This kind of thing makes it impossible to use a generic OpenSBI image, unlike other platforms that have moved towards supporting that. Especially as you explicitly mention U-Boot here, its SPL is the ideal place for this kind of thing, not in OpenSBI.
Jess
PATCH 2/2 platform/ae350: Initialize Coherent Manager as early as possible
Quoted 9 lines · Jessica Clarke
Quoted 6 lines · Leo Yu-Chi Liang
Coherent Manager will guarantee cache coherency as well as
the correctness of atomic extension instruction on Andes 45 series on ae350.This feature needs to be enabled before the first
A extension instruction, thus initialize it as early as possible.
Quoted 7 lines
Why should this be OpenSBI?s responsibility, rather than in whatever firmware you have running before OpenSBI that does whatever low-level platform initialisation is needed like DRAM training (which so far has been kept out of OpenSBI)? This kind of thing makes it impossible to use a generic OpenSBI image, unlike other platforms that have moved towards supporting that. Especially as you explicitly mention U-Boot here, its SPL is the ideal place for this kind of thing, not in OpenSBI.
I share the same concern. This kind of very early platform specific HART initialization makes it impossible for platforms to eventually use generic platform firmwares.
Further, I see that this is being done in the _start() path and not in the _start_warm() path so HART hotplug will not be able to do this kind of very early platform specific HART initialization.
Is this for a FPGA platform where there is no booting stage before OpenSBI firmware ? If yes then can this very early platform init be done in the FPGA boot-up scripts ?
If there is no other way then I am afraid Andes platform won't benefit from generic platform firmwares and Andes will end-up maintaining their own OpenSBI platform support.
Regards,
Anup
Quoted 8 lines
Jess
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 2/2 platform/ae350: Initialize Coherent Manager as early as possible
Quoted 30 lines · Anup Patel
Quoted 9 lines · Jessica Clarke
Quoted 6 lines · Leo Yu-Chi Liang
Coherent Manager will guarantee cache coherency as well as
the correctness of atomic extension instruction on Andes 45 series on ae350.This feature needs to be enabled before the first
A extension instruction, thus initialize it as early as possible.Quoted 7 lines
Why should this be OpenSBI?s responsibility, rather than in whatever firmware you have running before OpenSBI that does whatever low-level platform initialisation is needed like DRAM training (which so far has been kept out of OpenSBI)? This kind of thing makes it impossible to use a generic OpenSBI image, unlike other platforms that have moved towards supporting that. Especially as you explicitly mention U-Boot here, its SPL is the ideal place for this kind of thing, not in OpenSBI.
I share the same concern. This kind of very early platform specific HART initialization makes it impossible for platforms to eventually use generic platform firmwares.
Further, I see that this is being done in the
_start()path and not in the_start_warm()path so HART hotplug will not be able to do this kind of very early platform specific HART initialization.Is this for a FPGA platform where there is no booting stage before OpenSBI firmware ? If yes then can this very early platform init be done in the FPGA boot-up scripts ?
Quoted 7 lines
If there is no other way then I am afraid Andes platform won't benefit from generic platform firmwares and Andes will end-up maintaining their own OpenSBI platform support.
Regards,
Anup
Hi Anup and Jess,
Thanks for the explanation and sorry for forgetting to prepand a RFC before "PATCH" to clarify this is just a RFC patch.
Yes, we are developing on a FPGA platform without prior boot stage before OpenSBI, and we can actually do that in a boot up script.
As this kind of approach would draw too much concern, I will drop them. Thanks again for the comment.
Best regards,
Leo
Quoted 8 lines
Quoted 8 lines
Jess
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi