Re: [RFT v2] iommu/amd: use subsys_initcall() on amdv2 iommu
From: Joerg Roedel
Date: Mon Apr 25 2016 - 06:23:56 EST
On Mon, Apr 18, 2016 at 02:03:50PM +0200, Luis R. Rodriguez wrote:
> You said that with my patch you saw AMD IOMMUv2 kick off first,
> that was intentional as I thought that's what you needed. Can
> someone please describe the requirements?
>
> Also what does drm use that you say has a conflict already? What
> drm code are we talking about exactly ?
The required order is:
1. AMD IOMMUv1 (in-kernel only, initialized at boot time after PCI)
2. AMD IOMMUv2 (in-kernel or as module, provides demand paging
and uses v1 interfaces to talk to the IOMMU)
3. AMD-KFD (Implements compute offloading to the GPU and
uses AMD IOMMUv2 functionality, also provides a
symbol for the radeon driver)
4. DRM with (Checks if the symbol provided by AMD-KFD is
Radeon available at init time and does the KFD
initialization from there, because the GPU needs
to be up first)
So AMD IOMMUv2 does not initialize (but it does load to have the symbols
available for drivers that optionally use its functionality) without the
AMD IOMMUv1 driver, as it can't access the IOMMU hardware then.
AMD-KFD does not load without AMD IOMMUv2 being loaded, as it depends on
its symbols. AMD-KFD on the other hand needs to be loaded before the
radeon driver (but this it not enforced by symbols), because otherwise
the radeon driver will not initialize the AMD-KFD driver.
When AMD-KFD is loaded and you load radeon then, you get the KFD
functionality in the kernel. Then you can move on to the fun getting the
userspace running and actually execute anything on the GPU. But thats
another story.
I know what you think, and I agree: It's a big mess :)
Regards,
Joerg