All of lore.kernel.org
 help / color / mirror / Atom feed
* Mapping unchached memory with UDD
@ 2019-03-14 10:38 Wolfgang Grandegger
  2019-03-14 14:32 ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2019-03-14 10:38 UTC (permalink / raw)
  To: Xenomai

Hello,

I'm writing a little UDD driver to handling interrupts and shared memory
to communicate with a co-processor. Is it possible to setup and map a
"mem_region" for *uncahced* memory. Will it be automatically uncached if
it's of type UDD_MEM_PHY?

TIA,

Wolfgang.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Mapping unchached memory with UDD
  2019-03-14 10:38 Mapping unchached memory with UDD Wolfgang Grandegger
@ 2019-03-14 14:32 ` Philippe Gerum
  2019-03-16 11:48   ` Wolfgang Grandegger
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2019-03-14 14:32 UTC (permalink / raw)
  To: Wolfgang Grandegger, Xenomai


Hi Wolfgang,

On 3/14/19 11:38 AM, Wolfgang Grandegger via Xenomai wrote:
> Hello,
> 
> I'm writing a little UDD driver to handling interrupts and shared memory
> to communicate with a co-processor. Is it possible to setup and map a
> "mem_region" for *uncahced* memory. Will it be automatically uncached if
> it's of type UDD_MEM_PHY?
> 

Yep. Such requests is routed to RTDM's iomem mapping helper, which does:

static int mmap_iomem_helper(struct vm_area_struct *vma, phys_addr_t pa)
{
	pgprot_t prot = PAGE_SHARED;
	unsigned long len;

	len = vma->vm_end - vma->vm_start;
	...
	vma->vm_page_prot = pgprot_noncached(prot);

	return remap_pfn_range(vma, vma->vm_start, pa >> PAGE_SHIFT,
			       len, vma->vm_page_prot);
}

-- 
Philippe.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Mapping unchached memory with UDD
  2019-03-14 14:32 ` Philippe Gerum
@ 2019-03-16 11:48   ` Wolfgang Grandegger
  2019-03-16 13:39     ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2019-03-16 11:48 UTC (permalink / raw)
  To: Philippe Gerum, Xenomai

Hello Philippe,

Am 14.03.19 um 15:32 schrieb Philippe Gerum:
> 
> Hi Wolfgang,
> 
> On 3/14/19 11:38 AM, Wolfgang Grandegger via Xenomai wrote:
>> Hello,
>>
>> I'm writing a little UDD driver to handling interrupts and shared memory
>> to communicate with a co-processor. Is it possible to setup and map a
>> "mem_region" for *uncahced* memory. Will it be automatically uncached if
>> it's of type UDD_MEM_PHY?
>>
> 
> Yep. Such requests is routed to RTDM's iomem mapping helper, which does:
> 
> static int mmap_iomem_helper(struct vm_area_struct *vma, phys_addr_t pa)
> {
> 	pgprot_t prot = PAGE_SHARED;
> 	unsigned long len;
> 
> 	len = vma->vm_end - vma->vm_start;
> 	...
> 	vma->vm_page_prot = pgprot_noncached(prot);
> 
> 	return remap_pfn_range(vma, vma->vm_start, pa >> PAGE_SHIFT,
> 			       len, vma->vm_page_prot);
> }

I was aware of that code! I suspected some other magic when mapping
system memory with UDD_MEM_PHY. Maybe it's a barrier issue in the A9 or
M4 code.

Thanks,

Wolfgang.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Mapping unchached memory with UDD
  2019-03-16 11:48   ` Wolfgang Grandegger
@ 2019-03-16 13:39     ` Philippe Gerum
  2019-03-16 17:19       ` Wolfgang Grandegger
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2019-03-16 13:39 UTC (permalink / raw)
  To: Wolfgang Grandegger, Xenomai

On 3/16/19 12:48 PM, Wolfgang Grandegger wrote:
> Hello Philippe,
> 
> Am 14.03.19 um 15:32 schrieb Philippe Gerum:
>>
>> Hi Wolfgang,
>>
>> On 3/14/19 11:38 AM, Wolfgang Grandegger via Xenomai wrote:
>>> Hello,
>>>
>>> I'm writing a little UDD driver to handling interrupts and shared memory
>>> to communicate with a co-processor. Is it possible to setup and map a
>>> "mem_region" for *uncahced* memory. Will it be automatically uncached if
>>> it's of type UDD_MEM_PHY?
>>>
>>
>> Yep. Such requests is routed to RTDM's iomem mapping helper, which does:
>>
>> static int mmap_iomem_helper(struct vm_area_struct *vma, phys_addr_t pa)
>> {
>> 	pgprot_t prot = PAGE_SHARED;
>> 	unsigned long len;
>>
>> 	len = vma->vm_end - vma->vm_start;
>> 	...
>> 	vma->vm_page_prot = pgprot_noncached(prot);
>>
>> 	return remap_pfn_range(vma, vma->vm_start, pa >> PAGE_SHIFT,
>> 			       len, vma->vm_page_prot);
>> }
> 
> I was aware of that code! I suspected some other magic when mapping
> system memory with UDD_MEM_PHY. Maybe it's a barrier issue in the A9 or
> M4 code.
> 

Any DMA in between?


-- 
Philippe.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Mapping unchached memory with UDD
  2019-03-16 13:39     ` Philippe Gerum
@ 2019-03-16 17:19       ` Wolfgang Grandegger
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Grandegger @ 2019-03-16 17:19 UTC (permalink / raw)
  To: Philippe Gerum, Xenomai


Am 16.03.19 um 14:39 schrieb Philippe Gerum:
> On 3/16/19 12:48 PM, Wolfgang Grandegger wrote:
>> Hello Philippe,
>>
>> Am 14.03.19 um 15:32 schrieb Philippe Gerum:
>>>
>>> Hi Wolfgang,
>>>
>>> On 3/14/19 11:38 AM, Wolfgang Grandegger via Xenomai wrote:
>>>> Hello,
>>>>
>>>> I'm writing a little UDD driver to handling interrupts and shared memory
>>>> to communicate with a co-processor. Is it possible to setup and map a
>>>> "mem_region" for *uncahced* memory. Will it be automatically uncached if
>>>> it's of type UDD_MEM_PHY?
>>>>
>>>
>>> Yep. Such requests is routed to RTDM's iomem mapping helper, which does:
>>>
>>> static int mmap_iomem_helper(struct vm_area_struct *vma, phys_addr_t pa)
>>> {
>>> 	pgprot_t prot = PAGE_SHARED;
>>> 	unsigned long len;
>>>
>>> 	len = vma->vm_end - vma->vm_start;
>>> 	...
>>> 	vma->vm_page_prot = pgprot_noncached(prot);
>>>
>>> 	return remap_pfn_range(vma, vma->vm_start, pa >> PAGE_SHIFT,
>>> 			       len, vma->vm_page_prot);
>>> }
>>
>> I was aware of that code! I suspected some other magic when mapping
>> system memory with UDD_MEM_PHY. Maybe it's a barrier issue in the A9 or
>> M4 code.
>>
> 
> Any DMA in between?

No, just programmed I/O.

Wolfgang.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-16 17:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 10:38 Mapping unchached memory with UDD Wolfgang Grandegger
2019-03-14 14:32 ` Philippe Gerum
2019-03-16 11:48   ` Wolfgang Grandegger
2019-03-16 13:39     ` Philippe Gerum
2019-03-16 17:19       ` Wolfgang Grandegger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.