You are not logged in.

#1 2013-08-20 13:30:25

And1G
Member
From: Deutschland
Registered: 2012-08-07
Posts: 41

IOMMU explanation of kernel parameters

Hello!

I've set up an HTPC with an AMD A4-5300 CPU, A75 (Hudson-D3) chipset and a PCIe sound card (Asus Xonar DX). Whenever I tried to get a sound out of it (e.g. aplay blubb.wav) I only got dozens of these messages in the kernel log:

[   46.215678] AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x0000000000100000 flags=0x0050]

The messages appeared only on the first aplay command. When the program finished and I ran it again, I got no additional messages but sadly also no sound.

Spending two evenings on this problem with google I found out it might be some trouble with IOMMU features of the processor or mainboard. So after trying out several of the options, I found iommu=soft in the kernel parameters got the sound to work fine. I have the possible options from here: https://www.kernel.org/doc/Documentatio … ptions.txt

But I don't really understand what's the matter with this IOMMU thing. It seems like a memory management for I/O Components and seems related to DMA access. But what does the IOMMU do? Which side effects come with these options? I understand the "soft" option in that way, that some features present in hardware are now managed in software. "can be used to prevent the of an available hardware IOMMU" sounds even worse since the option might completely disable the hardware feature. But is this really bad? I mean with the option I finally have good quality audio output but for what price? Can I expect disadvantages from this setting? Since I'm not really into all this kernel and hardware stuff, this all seems so confusing. Or is it possible that the error causing the above message has a totally different source and it's just luck that the option kind of worked around it?
Can anyone here maybe explain even a little bit about the IOMMU and what might have caused these problems?
I opened a thread in the multimedia section here where I asked for help to get audio output but no one replied. So I think the people living over there are also not familiar with the topic. And since I found kind of a workaround which is hardware related I hope it is ok to open this other thread to maybe get some explanation about what I have really done there...

Offline

#2 2013-08-21 19:33:48

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: IOMMU explanation of kernel parameters

IOMMU is a chipset component which filters or redirects memory reads/writes performed by other devices.

Some PCI devices, including these Xonars, are incapable of accessing memory above 4GB. On AMD systems, Linux (ab)uses so-called GART as a poor man's IOMMU (until recently, most PCs didn't have dedicated IOMMUs) to remap Xonar's memory reads so that it thinks it's reading from below 4GB while it really isn't.

With "iommu=soft" the kernel doesn't use GART and instead copies all data intended for the Xonar to some sub-4GB buffer. In your case this doesn't cause noticeable performance hit because soundcards don't transfer lots of data to begin with.

But ideally, the GART hack should work. I have no idea why it doesn't; it could be some problem with Linux PCI code, sound drivers, IOMMU drivers or even the hardware. Maybe disabling the "real" IOMMU (amd_iommu=off) will help. Also, try updating the kernel or switching to linux-lts.

EDIT:
Sorry, I was wrong, the GART hack isn't supposed to work if you have IOMMU enabled - in such case Linux uses IOMMU for the same purpose. So, without having the card at hand, I have no idea why your IOMMU is being set-up incorrectly; it could be... and so on, the rest stays the same smile

Last edited by mich41 (2013-08-22 10:16:46)

Offline

#3 2013-08-22 16:50:24

And1G
Member
From: Deutschland
Registered: 2012-08-07
Posts: 41

Re: IOMMU explanation of kernel parameters

Thanks for the detailed explanation!
But isn't the GART something Video Card related? Or is it that what you mean with "abusing" the GART?

So when I set "iommu=soft" the IOMMU basically gets disabled? Quoting the file about the boot options, it says:

3. <arch/x86_64/kernel/pci-swiotlb.c> : Software IOMMU implementation. Used
      e.g. if there is no hardware IOMMU in the system and it is need because
      you have >3GB memory or told the kernel to us it (iommu=soft))
      Kernel boot message: "PCI-DMA: Using software bounce buffering
      for IO (SWIOTLB)"

What I don't fully understand... Is the IOMMU actually a CPU feature or is it on the mainboard's hand? For what I read, the A-Processors from AMD are IOMMU supported, so my setup should work with it. Or could it be my mainboard not having correct support for it? (MSI FM2-A75IA-E53)
For testing, I disabled the IOMMU switch in GRUB, dmesg shows the kernel already automatically chooses software buffering. ("[    0.654086] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)") but then I get those tons of AMD-Vi messages. When I set the IOMMU to force software buffering, I have not a single problem. The entry in dmesg also tells it is using software bounce buffering. But shouldn't there be no difference if the kernel chooses the software option or if I force it to do so?

Offline

#4 2013-08-22 17:52:23

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: IOMMU explanation of kernel parameters

Read about "iommu" and "amd_iommu" in Documentation/kernel-parameters.txt and Documentation/x86/x86-64/boot-options.txt.

It's quite messy, "iommu" controls only GART, SWIOTLB and Calgary (IBM) while AMD-V and Intel VT-d have their own options. I couldn't find this in docs, but your kernel messages suggest that AMD-V disables GART and "iommu=soft" disables AMD-V.

Unless GART has been removed from latest APUs, disabling AMD-V with "amd_iommu=off" and removing "iommu=whatever" should give

PCI-DMA: using GART IOMMU.

and will very likely work because it's old and well tested code.

As I stated before, I don't know what's going on. IOMMU seems to be present and enabled by BIOS. Maybe BIOS screws something up or maybe it's Linux. You can try different BIOS and kernel versions. Or get kernel source and start debugging it yourself. Or report bug to ALSA developers - if they say that it works for them on the same kernel version, you will know that MSI is to blame. Who in turn will blame Linux smile

Last edited by mich41 (2013-08-22 18:17:18)

Offline

#5 2016-02-03 18:38:01

sinatosk
Member
Registered: 2010-11-28
Posts: 87

Re: IOMMU explanation of kernel parameters

hi, old thread I know

I'm using Asus Xonar D2X and upgraded from 4.1.16 to 4.4.1-2 on Asus Sabertooth 990FX 2.0 with AMD 8350, bios 2301 with AMD-Vi enabled in bios and my sound was lost...

as soon as I tried to play any sound... I would get error in dmesg

AMD-Vi: Event logged [IO_PAGE_FAULT device=06:00.0 domain=0x0000 address=0x0000000000100000 flags=0x0050]

adding

iommu=soft

to my kernel options worked for me while bios option still turned on

Offline

#6 2016-02-03 23:27:19

R00KIE
Forum Moderator
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: IOMMU explanation of kernel parameters

@sinatosk
Please don't necrobump https://wiki.archlinux.org/index.php/Fo … bumping.22

Your problem seems like a regression and should be reported upstream so it can be fixed.

Closing.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB