[PATCH rtems v2 3/3] bsps/fdt: Make sure data is cache aligned.
Christian Mauderer
christian.mauderer at embedded-brains.de
Wed Jul 22 04:58:13 UTC 2020
Hello Gedare,
I'll re-check to make absolutely sure and push it afterwards.
Best regards
Christian
On 20/07/2020 22:01, Gedare Bloom wrote:
> looks good if it works, thanks Christian!
>
> On Sun, Jul 19, 2020 at 11:47 PM Christian Mauderer
> <christian.mauderer at embedded-brains.de> wrote:
>>
>> The cache of the fdt blob is flushed after copy. Therefore it should be
>> aligned.
>> ---
>> bsps/shared/start/bsp-fdt.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/bsps/shared/start/bsp-fdt.c b/bsps/shared/start/bsp-fdt.c
>> index 7e8d8922a8..50a485eb16 100644
>> --- a/bsps/shared/start/bsp-fdt.c
>> +++ b/bsps/shared/start/bsp-fdt.c
>> @@ -29,10 +29,11 @@
>>
>> #ifdef BSP_FDT_BLOB_READ_ONLY
>> static const uint32_t
>> -bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)] = { 0xdeadbeef };
>> +bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)] CPU_STRUCTURE_ALIGNMENT =
>> + { 0xdeadbeef };
>> #else
>> static uint32_t
>> -bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)];
>> +bsp_fdt_blob[BSP_FDT_BLOB_SIZE_MAX / sizeof(uint32_t)] CPU_STRUCTURE_ALIGNMENT;
>> #endif
>>
>> void bsp_fdt_copy(const void *src)
>> @@ -48,6 +49,7 @@ void bsp_fdt_copy(const void *src)
>>
>> if (s != d) {
>> size_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(src));
>> + size_t aligned_size = roundup2(m, CPU_CACHE_LINE_BYTES);
>> size_t n = (m + sizeof(*d) - 1) / sizeof(*d);
>> size_t i;
>>
>> @@ -55,7 +57,7 @@ void bsp_fdt_copy(const void *src)
>> d[i] = s[i];
>> }
>>
>> - rtems_cache_flush_multiple_data_lines(d, m);
>> + rtems_cache_flush_multiple_data_lines(d, aligned_size);
>> }
>> }
>>
>> --
>> 2.26.2
>>
--
--------------------------------------------
embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.mauderer at embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax: +49-89-18 94 741 - 08
PGP: Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list