Skip to contentSkip to conversation

amd iommu configuration

DISCUSSION Steven J Abner 4 participants 4 messages Sep 2, 2022 – Sep 6, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi
I was referred to you from [email protected] about the following issue.
Here is as was written:
On 9/1/22 11:36, Steven J Abner wrote:
Hi
Building a kernel tailored for AMD 2400g on ASRock B450 using 5.18.12 as base.
I stumbled across an odd situation and which lacked Kconfig info and lead to oddity. /drivers/iommu/amd/Kconfig states 'config AMD_IOMMU_V2' is 'tristate' but unlike many
other tristate configures doesn't mention that module name is 'iommu_v2.ko' and loading should be done by adding to modules-load.d.

The oddity is that by loading as module is as follows (differences):

builtin iommu_v2 version dmesg:
amdgpu: HMM registered 2048MB device memory
amdgpu: Topology: Add APU node [0x0:0x0]
amdgpu: Topology: Add APU node [0x15dd:0x1002]
AMD-Vi: AMD IOMMUv2 loaded and initialized
kfd kfd: amdgpu: added device 1002:15dd
kfd kfd: amdgpu: Allocated 3969056 bytes on gart memmap_init_zone_device initialised 524288 pages in 0ms

module not loaded due to missing iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU kfd kfd: amdgpu: GC IP 090100 not supported in kfd

module load through iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU
AMD-Vi: AMD IOMMUv2 loaded and initialized kfd kfd: amdgpu: GC IP 090100 not supported in kfd

Note, only difference on witk/without iommu.conf is:
AMD-Vi: AMD IOMMUv2 loaded and initialized

So does this mean missing features by not having builtin? If not, should Kconfig have hint about module and loading?

Steve

I wish to be personally CC'ed the answers/comments posted to the list in response to my posting, please:) Not a list member.

I hope you can assist linux people and myself. I assumed from dmesg that it must be builtin. But also wonder if it should be in amdgpu or tied to it. Steve

#2 lore raw

Steven,

[+Felix, amd-fgx list]

Quoted 15 lines · Steven J Abner

Hi
I was referred to you from [email protected] about the following issue. Here is as was written:
On 9/1/22 11:36, Steven J Abner wrote:
Hi
Building a kernel tailored for AMD 2400g on ASRock B450 using 5.18.12 as base. I stumbled across an odd situation and which lacked Kconfig info and lead to oddity.
/drivers/iommu/amd/Kconfig states 'config AMD_IOMMU_V2' is 'tristate' but unlike many
other tristate configures doesn't mention that module name is 'iommu_v2.ko' and loading should be done by adding to modules-load.d.

The oddity is that by loading as module is as follows (differences):

Quoted 8 lines

builtin iommu_v2 version dmesg:
amdgpu: HMM registered 2048MB device memory
amdgpu: Topology: Add APU node [0x0:0x0]
amdgpu: Topology: Add APU node [0x15dd:0x1002]
AMD-Vi: AMD IOMMUv2 loaded and initialized
kfd kfd: amdgpu: added device 1002:15dd
kfd kfd: amdgpu: Allocated 3969056 bytes on gart memmap_init_zone_device initialised 524288 pages in 0ms

IOMMU V2 modules provides IOMMU feature like attaching device to process. I think amdgpu uses those features if available. So in this case amdgpu is using those IOMMU features.

Quoted 14 lines

module not loaded due to missing iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU kfd kfd: amdgpu: GC IP 090100 not supported in kfd

module load through iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU
AMD-Vi: AMD IOMMUv2 loaded and initialized kfd kfd: amdgpu: GC IP 090100 not supported in kfd

Quoted 2 lines

Note, only difference on witk/without iommu.conf is:
AMD-Vi: AMD IOMMUv2 loaded and initialized

I think in this case iommu_v2.ko module got loaded after GPU initialized. Hence amdgpu is not using iommu v2 features.

Quoted 3 lines

So does this mean missing features by not having builtin? If not, should Kconfig have hint about module and loading?

@Felix,
I see that drivers/gpu/drm/amd/amdkfd/Kconfig contains below line

    imply AMD_IOMMU_V2 if X86_64

Should we change s/imply/select ?

-Vasant

Quoted 11 lines

Steve

I wish to be personally CC'ed the answers/comments posted to the list in response to my posting, please:) Not a list member.

I hope you can assist linux people and myself. I assumed from dmesg that it must be builtin. But also wonder if it should be in amdgpu or tied to it. Steve

#3 lore raw
Quoted 59 lines · Vasant Hegde

Steven,

[+Felix, amd-fgx list]

Quoted 15 lines · Steven J Abner

Hi
I was referred to you from [email protected] about the following issue. Here is as was written:
On 9/1/22 11:36, Steven J Abner wrote:
Hi
Building a kernel tailored for AMD 2400g on ASRock B450 using 5.18.12 as base. I stumbled across an odd situation and which lacked Kconfig info and lead to oddity.
/drivers/iommu/amd/Kconfig states 'config AMD_IOMMU_V2' is 'tristate' but unlike many
other tristate configures doesn't mention that module name is 'iommu_v2.ko' and loading should be done by adding to modules-load.d.

The oddity is that by loading as module is as follows (differences):

Quoted 8 lines

builtin iommu_v2 version dmesg:
amdgpu: HMM registered 2048MB device memory
amdgpu: Topology: Add APU node [0x0:0x0]
amdgpu: Topology: Add APU node [0x15dd:0x1002]
AMD-Vi: AMD IOMMUv2 loaded and initialized
kfd kfd: amdgpu: added device 1002:15dd
kfd kfd: amdgpu: Allocated 3969056 bytes on gart memmap_init_zone_device initialised 524288 pages in 0ms

IOMMU V2 modules provides IOMMU feature like attaching device to process. I think amdgpu uses those features if available. So in this case amdgpu is using those IOMMU features.

Quoted 14 lines

module not loaded due to missing iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU kfd kfd: amdgpu: GC IP 090100 not supported in kfd

module load through iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU
AMD-Vi: AMD IOMMUv2 loaded and initialized kfd kfd: amdgpu: GC IP 090100 not supported in kfd

Quoted 2 lines

Note, only difference on witk/without iommu.conf is:
AMD-Vi: AMD IOMMUv2 loaded and initialized

I think in this case iommu_v2.ko module got loaded after GPU initialized. Hence amdgpu is not using iommu v2 features.

Quoted 3 lines

So does this mean missing features by not having builtin? If not, should Kconfig have hint about module and loading?

Quoted 6 lines

@Felix,
I see that drivers/gpu/drm/amd/amdkfd/Kconfig contains below line

     imply AMD_IOMMU_V2 if X86_64

Should we change s/imply/select ?

"select" might help when KFD is built-in, but it probably still wants a MODULE_SOFTDEP() to enforce load order when they're both modular.

Robin.

#4 lore raw
Quoted 60 lines · Robin Murphy
Quoted 59 lines · Vasant Hegde

Steven,

[+Felix, amd-fgx list]

Quoted 15 lines · Steven J Abner

Hi
I was referred to you from [email protected] about the following issue. Here is as was written:
On 9/1/22 11:36, Steven J Abner wrote:
Hi
Building a kernel tailored for AMD 2400g on ASRock B450 using 5.18.12 as base. I stumbled across an odd situation and which lacked Kconfig info and lead to oddity.
/drivers/iommu/amd/Kconfig states 'config AMD_IOMMU_V2' is 'tristate' but unlike many
other tristate configures doesn't mention that module name is 'iommu_v2.ko' and loading should be done by adding to modules-load.d.

The oddity is that by loading as module is as follows (differences):

Quoted 8 lines

builtin iommu_v2 version dmesg:
amdgpu: HMM registered 2048MB device memory
amdgpu: Topology: Add APU node [0x0:0x0]
amdgpu: Topology: Add APU node [0x15dd:0x1002]
AMD-Vi: AMD IOMMUv2 loaded and initialized
kfd kfd: amdgpu: added device 1002:15dd
kfd kfd: amdgpu: Allocated 3969056 bytes on gart memmap_init_zone_device initialised 524288 pages in 0ms

IOMMU V2 modules provides IOMMU feature like attaching device to process. I think amdgpu uses those features if available. So in this case amdgpu is using those IOMMU features.

Quoted 14 lines

module not loaded due to missing iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU kfd kfd: amdgpu: GC IP 090100 not supported in kfd

module load through iommu.conf dmesg:
amdgpu: CRAT table disabled by module option
amdgpu: Topology: Add CPU node
amdgpu: Virtual CRAT table created for CPU
AMD-Vi: AMD IOMMUv2 loaded and initialized kfd kfd: amdgpu: GC IP 090100 not supported in kfd

Quoted 2 lines

Note, only difference on witk/without iommu.conf is:
AMD-Vi: AMD IOMMUv2 loaded and initialized

I think in this case iommu_v2.ko module got loaded after GPU initialized. Hence amdgpu is not using iommu v2 features.

Quoted 3 lines

So does this mean missing features by not having builtin? If not, should Kconfig have hint about module and loading?

Quoted 8 lines
Quoted 6 lines

@Felix,
   I see that drivers/gpu/drm/amd/amdkfd/Kconfig contains below line imply AMD_IOMMU_V2 if X86_64

   Should we change s/imply/select ?

"select" might help when KFD is built-in, but it probably still wants a MODULE_SOFTDEP() to enforce load order when they're both modular.

We don't want to make it a hard dependency because only a small subset of all AMD GPUs use iommuv2, and we have fallbacks in place for even those to work without it.

Regards,
  Felix

Quoted 2 lines

Robin.