Discussion:
problems with iommu and userspace DMA to hugepages, how to add iommu mapings from userspace.
Lars Segerlund
2016-11-10 11:16:19 UTC
Permalink
Hi,

I am getting these errors from a userspace 'device driver' ,

[599805.585424] DMAR: DRHD: handling fault status reg 202
[599805.585431] DMAR: DMAR:[DMA Read] Request device [03:00.0] fault addr
4c0008000
DMAR:[fault reason 06] PTE Read access is not set

Basicly i mapp a dma engine in a PCIe card by uio to a userspace library,
and then allocate hugepages ( continous ), do a virt to phys translation
via /proc/self/.... setup a dma and turn it on.

The message tells me I lack iommu mappings for the memory regions i try to
read/write , so far so good nothing unexpected.

My problem is that I have to run with intel_iommu=on iommu=pt flags to the
kernel due to other hard/software on the machine, I can't turn iommu off
completely.

So I have the question is it possible to add iommu mappings from userspace
? through iommu groups in /sys/.. ?

So far all applications that does something similar either uses vfio or
some kernel driver callback and I would prefer not to do this.
( I had high hopes for dpdk pmd driver but so far no luck ).

All hints and help appreciated ! :-D

/ regards, Lars Segerlund.
Alex Williamson
2016-11-10 14:04:32 UTC
Permalink
On Thu, 10 Nov 2016 12:16:19 +0100
Post by Lars Segerlund
Hi,
I am getting these errors from a userspace 'device driver' ,
[599805.585424] DMAR: DRHD: handling fault status reg 202
[599805.585431] DMAR: DMAR:[DMA Read] Request device [03:00.0] fault addr
4c0008000
DMAR:[fault reason 06] PTE Read access is not set
Basicly i mapp a dma engine in a PCIe card by uio to a userspace library,
and then allocate hugepages ( continous ), do a virt to phys translation
via /proc/self/.... setup a dma and turn it on.
The message tells me I lack iommu mappings for the memory regions i try to
read/write , so far so good nothing unexpected.
My problem is that I have to run with intel_iommu=on iommu=pt flags to the
kernel due to other hard/software on the machine, I can't turn iommu off
completely.
So I have the question is it possible to add iommu mappings from userspace
? through iommu groups in /sys/.. ?
So far all applications that does something similar either uses vfio or
some kernel driver callback and I would prefer not to do this.
( I had high hopes for dpdk pmd driver but so far no luck ).
vfio is the right way to do this.

Loading...