Re: [PATCH] testsuite/spcache01: Clear allocated coherent cache memory

2021-10-19 Thread Chris Johns
On 20/10/21 2:46 am, Christian MAUDERER wrote:
> Am 19.10.21 um 16:48 schrieb Sebastian Huber:
>>
>>
>> On 18/10/2021 23:08, Chris Johns wrote:
>>> On 18/10/21 8:37 pm, Sebastian Huber wrote:
 On 18/10/2021 09:53, Chris Johns wrote:
> On 18/10/21 4:50 pm, Sebastian Huber wrote:
>> On 18/10/2021 07:19,chr...@rtems.org   wrote:
>>> From: Chris Johns
>>>
>>> - Coherent cache memory is used in libbsd for things like descriptors
>>>  and it optionally clears the memory on allocation. Test is works.
>> There is no guarantee that memset() and memcpy() work with cache coherent
>> memory. Such memory areas may disallow misaligned access for example.
> That seems reasonable however this change about testing the implicit
> requirements we have that memset works. LibBSD requires memset works ...
>
> https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/rtems/rtems-kernel-bus-dma.c?h=6-freebsd-12#n260
>
>
 Using memset() here could be a bug in libbsd.
>>> Yes, I also think so.
>>>
>>> But what is a suitable mechanism to make sure the arch or BSP handle it
>>> correctly? Maybe a clear routine in libbsd using the bus space API? That
>>> interface has to work or the drivers will not work.
>>
>> I think we had similar issues on another BSP. Christian, do you remember how
>> we solved this?
>>
> 
> I remember mainly problems with copying memory. I think the last time it
> resulted in an ugly "copy_from/to_io" function on the atsam:
> 
>   https://git.rtems.org/rtems/tree/bsps/arm/atsam/start/iocopy.c
> 

Thanks.

> The bus_space_* functions should work. Only problem is that a valid
> bus_space_tag is missing in this context. I think x86 uses it. I think for all
> other platforms it is unused.

I used the direct methods because it is internal and I think it is safe to
assume this is a linear address being returned from the allocator?

I have posted a patch which is working on the Versal. It is not optimized and
does not attempt to detect alignments to use larger word sizes for faster
clears. The amount of memory being allocated is not large.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] testsuite/spcache01: Clear allocated coherent cache memory

2021-10-19 Thread Christian MAUDERER

Am 19.10.21 um 16:48 schrieb Sebastian Huber:



On 18/10/2021 23:08, Chris Johns wrote:

On 18/10/21 8:37 pm, Sebastian Huber wrote:

On 18/10/2021 09:53, Chris Johns wrote:

On 18/10/21 4:50 pm, Sebastian Huber wrote:

On 18/10/2021 07:19,chr...@rtems.org   wrote:

From: Chris Johns

- Coherent cache memory is used in libbsd for things like descriptors
 and it optionally clears the memory on allocation. Test is 
works.
There is no guarantee that memset() and memcpy() work with cache 
coherent

memory. Such memory areas may disallow misaligned access for example.

That seems reasonable however this change about testing the implicit
requirements we have that memset works. LibBSD requires memset works 
...


https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/rtems/rtems-kernel-bus-dma.c?h=6-freebsd-12#n260 




Using memset() here could be a bug in libbsd.

Yes, I also think so.

But what is a suitable mechanism to make sure the arch or BSP handle it
correctly? Maybe a clear routine in libbsd using the bus space API? That
interface has to work or the drivers will not work.


I think we had similar issues on another BSP. Christian, do you remember 
how we solved this?




I remember mainly problems with copying memory. I think the last time it 
resulted in an ugly "copy_from/to_io" function on the atsam:


  https://git.rtems.org/rtems/tree/bsps/arm/atsam/start/iocopy.c

The bus_space_* functions should work. Only problem is that a valid 
bus_space_tag is missing in this context. I think x86 uses it. I think 
for all other platforms it is unused.


Best regards

Christian
--

embedded brains GmbH
Herr Christian MAUDERER
Dornierstr. 4
82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
phone: +49-89-18 94 741 - 18
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] testsuite/spcache01: Clear allocated coherent cache memory

2021-10-19 Thread Sebastian Huber



On 18/10/2021 23:08, Chris Johns wrote:

On 18/10/21 8:37 pm, Sebastian Huber wrote:

On 18/10/2021 09:53, Chris Johns wrote:

On 18/10/21 4:50 pm, Sebastian Huber wrote:

On 18/10/2021 07:19,chr...@rtems.org   wrote:

From: Chris Johns

- Coherent cache memory is used in libbsd for things like descriptors
     and it optionally clears the memory on allocation. Test is works.

There is no guarantee that memset() and memcpy() work with cache coherent
memory. Such memory areas may disallow misaligned access for example.

That seems reasonable however this change about testing the implicit
requirements we have that memset works. LibBSD requires memset works ...

https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/rtems/rtems-kernel-bus-dma.c?h=6-freebsd-12#n260


Using memset() here could be a bug in libbsd.

Yes, I also think so.

But what is a suitable mechanism to make sure the arch or BSP handle it
correctly? Maybe a clear routine in libbsd using the bus space API? That
interface has to work or the drivers will not work.


I think we had similar issues on another BSP. Christian, do you remember 
how we solved this?


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] testsuite/spcache01: Clear allocated coherent cache memory

2021-10-18 Thread Chris Johns
On 18/10/21 8:37 pm, Sebastian Huber wrote:
> On 18/10/2021 09:53, Chris Johns wrote:
>> On 18/10/21 4:50 pm, Sebastian Huber wrote:
>>> On 18/10/2021 07:19,chr...@rtems.org  wrote:
 From: Chris Johns

 - Coherent cache memory is used in libbsd for things like descriptors
     and it optionally clears the memory on allocation. Test is works.
>>> There is no guarantee that memset() and memcpy() work with cache coherent
>>> memory. Such memory areas may disallow misaligned access for example.
>> That seems reasonable however this change about testing the implicit
>> requirements we have that memset works. LibBSD requires memset works ...
>>
>> https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/rtems/rtems-kernel-bus-dma.c?h=6-freebsd-12#n260
>>
> 
> Using memset() here could be a bug in libbsd.

Yes, I also think so.

But what is a suitable mechanism to make sure the arch or BSP handle it
correctly? Maybe a clear routine in libbsd using the bus space API? That
interface has to work or the drivers will not work.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] testsuite/spcache01: Clear allocated coherent cache memory

2021-10-18 Thread Sebastian Huber

On 18/10/2021 09:53, Chris Johns wrote:

On 18/10/21 4:50 pm, Sebastian Huber wrote:

On 18/10/2021 07:19,chr...@rtems.org  wrote:

From: Chris Johns

- Coherent cache memory is used in libbsd for things like descriptors
    and it optionally clears the memory on allocation. Test is works.

There is no guarantee that memset() and memcpy() work with cache coherent
memory. Such memory areas may disallow misaligned access for example.

That seems reasonable however this change about testing the implicit
requirements we have that memset works. LibBSD requires memset works ...

https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/rtems/rtems-kernel-bus-dma.c?h=6-freebsd-12#n260


Using memset() here could be a bug in libbsd.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] testsuite/spcache01: Clear allocated coherent cache memory

2021-10-18 Thread Chris Johns
On 18/10/21 4:50 pm, Sebastian Huber wrote:
> On 18/10/2021 07:19, chr...@rtems.org wrote:
>> From: Chris Johns
>>
>> - Coherent cache memory is used in libbsd for things like descriptors
>>    and it optionally clears the memory on allocation. Test is works.
> 
> There is no guarantee that memset() and memcpy() work with cache coherent
> memory. Such memory areas may disallow misaligned access for example.

That seems reasonable however this change about testing the implicit
requirements we have that memset works. LibBSD requires memset works ...

https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/rtems/rtems-kernel-bus-dma.c?h=6-freebsd-12#n260

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] testsuite/spcache01: Clear allocated coherent cache memory

2021-10-17 Thread Sebastian Huber

On 18/10/2021 07:19, chr...@rtems.org wrote:

From: Chris Johns

- Coherent cache memory is used in libbsd for things like descriptors
   and it optionally clears the memory on allocation. Test is works.


There is no guarantee that memset() and memcpy() work with cache 
coherent memory. Such memory areas may disallow misaligned access for 
example.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel