iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* IOVA allocation dependency between firmware buffer and remaining buffers
@ 2020-04-20 15:54 Ajay kumar
  2020-04-24 15:04 ` Ajay kumar
  0 siblings, 1 reply; 19+ messages in thread
From: Ajay kumar @ 2020-04-20 15:54 UTC (permalink / raw)
  To: iommu, linux-arm-kernel, linux-mm; +Cc: shaik.ameer


[-- Attachment #1.1: Type: text/plain, Size: 1641 bytes --]

Hi All,

I have an IOMMU master which has limitations as mentioned below:
1) The IOMMU master internally executes a firmware, and the firmware memory
is allocated by the same master driver.
The firmware buffer address should be of the lowest range than other address
allocated by the device, or in other words, all the remaining buffer
addresses
should always be in a higher range than the firmware address.
2) None of the buffer addresses should go beyond 0xC000_0000

example:
If firmware buffer address is buf_fw = 0x8000_5000;
All other addresses given to the device should be greater than
(0x8000_5000 + firmware size) and less than 0xC000_0000

Currently, this is being handled with one of the below hacks:
1) By keeping dma_mask in lower range while allocating firmware buffer,
and then increasing the dma_mask to higher range for other buffers.
2) By reserving IOVA for firmware at the lowest range and creating direct
mappings for the same.

I want to know if there is a better way this can be handled with current
framework, or if anybody is facing similar problems with their devices,
please share how it is taken care.

I also think there should be some way the masters can specify the IOVA
range they want to limit to for current allocation.
Something like a new iommu_ops callback like below:
limit_iova_alloc_range(dev, iova_start, iova_end)

And, in my driver, the sequence will be:
limit_iova_alloc_range(dev, 0x0000_0000, 0x1000_0000); /* via helpers */
alloc( ) firmware buffer using DMA API
limit_iova_alloc_range(dev, 0x1000_0000, 0xC000_0000); /* via helpers */
alloc( ) other buffers using DMA API

Thanks,
Ajay Kumar

[-- Attachment #1.2: Type: text/html, Size: 2114 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

end of thread, other threads:[~2020-09-28  6:53 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 15:54 IOVA allocation dependency between firmware buffer and remaining buffers Ajay kumar
2020-04-24 15:04 ` Ajay kumar
2020-04-24 15:29   ` Robin Murphy
2020-04-24 16:15     ` Shaik Ameer Basha
2020-09-23  6:48       ` Marek Szyprowski
2020-09-23  6:58         ` Christoph Hellwig
2020-09-23  7:45           ` Ajay kumar
2020-09-23 13:47             ` Christoph Hellwig
2020-09-23  8:25           ` Ajay Kumar
2020-09-24  8:28         ` Joerg Roedel
2020-09-24  8:46           ` Marek Szyprowski
2020-09-24 10:16             ` Thierry Reding
2020-09-24 10:40               ` Robin Murphy
2020-09-24 10:47                 ` Marek Szyprowski
2020-09-24 11:06                   ` Robin Murphy
2020-09-24 14:14                     ` Shaik Ameer Basha
2020-09-28  6:52                     ` Marek Szyprowski
2020-09-24 10:41               ` Marek Szyprowski
2020-09-24 14:33                 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).