Re: [PATCH 11/25] drm/amdkfd: Centralize IOMMUv2 code and make it conditional
This patch is: Reviewed-by: Oded GabbayOn Thu, Feb 8, 2018 at 10:16 AM, Christian König wrote: > Am 07.02.2018 um 21:51 schrieb Felix Kuehling: > > On 2018-02-07 06:20 AM, Christian König wrote: > > Am 07.02.2018 um 02:32 schrieb Felix Kuehling: > > dGPUs work without IOMMUv2. Make IOMMUv2 initialization dependent on > ASIC information. Also allow building KFD without IOMMUv2 support. > This is still useful for dGPUs and prepares for enabling KFD on > architectures that don't support AMD IOMMUv2. > > v2: > * Centralize IOMMUv2 code to avoid #ifdefs in too many places > > Signed-off-by: Felix Kuehling > --- > drivers/gpu/drm/amd/amdkfd/Kconfig| 2 +- > drivers/gpu/drm/amd/amdkfd/Makefile | 4 + > drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 14 +- > drivers/gpu/drm/amd/amdkfd/kfd_device.c | 127 +++ > drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 + > drivers/gpu/drm/amd/amdkfd/kfd_iommu.c| 356 > ++ > drivers/gpu/drm/amd/amdkfd/kfd_iommu.h| 78 +++ > drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 14 +- > drivers/gpu/drm/amd/amdkfd/kfd_process.c | 138 +--- > drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 16 +- > drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 6 +- > 11 files changed, 493 insertions(+), 265 deletions(-) > create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.c > create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.h > > diff --git a/drivers/gpu/drm/amd/amdkfd/Kconfig > b/drivers/gpu/drm/amd/amdkfd/Kconfig > index bc5a294..5bbeb95 100644 > --- a/drivers/gpu/drm/amd/amdkfd/Kconfig > +++ b/drivers/gpu/drm/amd/amdkfd/Kconfig > @@ -4,6 +4,6 @@ > config HSA_AMD > tristate "HSA kernel driver for AMD GPU devices" > -depends on DRM_AMDGPU && AMD_IOMMU_V2 && X86_64 > +depends on DRM_AMDGPU && X86_64 > > You still need a weak dependency on AMD_IOMMU_V2 here, in other words > add "imply AMD_IOMMU_V2". > > This prevents illegal combinations like linking amdkfd into the kernel > while amd_iommu_v2 is a module. > > But it should still allow to completely disable amd_iommu_v2 and > compile amdkfd without support for it. > > Thanks, that's good to know. An updated patch is attached (to avoid > resending the whole series). > > > Patch is Acked-by: Christian König . > > Regards, > Christian. > > > Regards, > Felix > > Christian. > > help > Enable this if you want to use HSA features on AMD GPU devices. > diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile > b/drivers/gpu/drm/amd/amdkfd/Makefile > index a317e76..0d02422 100644 > --- a/drivers/gpu/drm/amd/amdkfd/Makefile > +++ b/drivers/gpu/drm/amd/amdkfd/Makefile > @@ -37,6 +37,10 @@ amdkfd-y:= kfd_module.o kfd_device.o > kfd_chardev.o kfd_topology.o \ > kfd_interrupt.o kfd_events.o cik_event_interrupt.o \ > kfd_dbgdev.o kfd_dbgmgr.o kfd_crat.o > +ifneq ($(CONFIG_AMD_IOMMU_V2),) > +amdkfd-y += kfd_iommu.o > +endif > + > amdkfd-$(CONFIG_DEBUG_FS) += kfd_debugfs.o > obj-$(CONFIG_HSA_AMD)+= amdkfd.o > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c > b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c > index 2bc2816..7493f47 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c > @@ -22,10 +22,10 @@ > #include > #include > -#include > #include "kfd_crat.h" > #include "kfd_priv.h" > #include "kfd_topology.h" > +#include "kfd_iommu.h" > /* GPU Processor ID base for dGPUs for which VCRAT needs to be > created. >* GPU processor ID are expressed with Bit[31]=1. > @@ -1037,15 +1037,11 @@ static int kfd_create_vcrat_image_gpu(void > *pcrat_image, > struct crat_subtype_generic *sub_type_hdr; > struct crat_subtype_computeunit *cu; > struct kfd_cu_info cu_info; > -struct amd_iommu_device_info iommu_info; > int avail_size = *size; > uint32_t total_num_of_cu; > int num_of_cache_entries = 0; > int cache_mem_filled = 0; > int ret = 0; > -const u32 required_iommu_flags = AMD_IOMMU_DEVICE_FLAG_ATS_SUP | > - AMD_IOMMU_DEVICE_FLAG_PRI_SUP | > - AMD_IOMMU_DEVICE_FLAG_PASID_SUP; > struct kfd_local_mem_info local_mem_info; > if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_GPU) > @@ -1106,12 +1102,8 @@ static int kfd_create_vcrat_image_gpu(void > *pcrat_image, > /* Check if this node supports IOMMU. During parsing this flag > will >* translate to HSA_CAP_ATS_PRESENT >*/ > -iommu_info.flags = 0; > -if (amd_iommu_device_info(kdev->pdev, _info) == 0) { > -if ((iommu_info.flags & required_iommu_flags) == > -required_iommu_flags) > -cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT; > -} > +if (!kfd_iommu_check_device(kdev)) > +cu->hsa_capability |=
Re: [PATCH 11/25] drm/amdkfd: Centralize IOMMUv2 code and make it conditional
Am 07.02.2018 um 21:51 schrieb Felix Kuehling: On 2018-02-07 06:20 AM, Christian König wrote: Am 07.02.2018 um 02:32 schrieb Felix Kuehling: dGPUs work without IOMMUv2. Make IOMMUv2 initialization dependent on ASIC information. Also allow building KFD without IOMMUv2 support. This is still useful for dGPUs and prepares for enabling KFD on architectures that don't support AMD IOMMUv2. v2: * Centralize IOMMUv2 code to avoid #ifdefs in too many places Signed-off-by: Felix Kuehling--- drivers/gpu/drm/amd/amdkfd/Kconfig | 2 +- drivers/gpu/drm/amd/amdkfd/Makefile | 4 + drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 14 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 127 +++ drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 + drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 356 ++ drivers/gpu/drm/amd/amdkfd/kfd_iommu.h | 78 +++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 14 +- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 138 +--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 16 +- drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 6 +- 11 files changed, 493 insertions(+), 265 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.c create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.h diff --git a/drivers/gpu/drm/amd/amdkfd/Kconfig b/drivers/gpu/drm/amd/amdkfd/Kconfig index bc5a294..5bbeb95 100644 --- a/drivers/gpu/drm/amd/amdkfd/Kconfig +++ b/drivers/gpu/drm/amd/amdkfd/Kconfig @@ -4,6 +4,6 @@ config HSA_AMD tristate "HSA kernel driver for AMD GPU devices" - depends on DRM_AMDGPU && AMD_IOMMU_V2 && X86_64 + depends on DRM_AMDGPU && X86_64 You still need a weak dependency on AMD_IOMMU_V2 here, in other words add "imply AMD_IOMMU_V2". This prevents illegal combinations like linking amdkfd into the kernel while amd_iommu_v2 is a module. But it should still allow to completely disable amd_iommu_v2 and compile amdkfd without support for it. Thanks, that's good to know. An updated patch is attached (to avoid resending the whole series). Patch is Acked-by: Christian König . Regards, Christian. Regards, Felix Christian. help Enable this if you want to use HSA features on AMD GPU devices. diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile b/drivers/gpu/drm/amd/amdkfd/Makefile index a317e76..0d02422 100644 --- a/drivers/gpu/drm/amd/amdkfd/Makefile +++ b/drivers/gpu/drm/amd/amdkfd/Makefile @@ -37,6 +37,10 @@ amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \ kfd_interrupt.o kfd_events.o cik_event_interrupt.o \ kfd_dbgdev.o kfd_dbgmgr.o kfd_crat.o +ifneq ($(CONFIG_AMD_IOMMU_V2),) +amdkfd-y += kfd_iommu.o +endif + amdkfd-$(CONFIG_DEBUG_FS) += kfd_debugfs.o obj-$(CONFIG_HSA_AMD) += amdkfd.o diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c index 2bc2816..7493f47 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -22,10 +22,10 @@ #include #include -#include #include "kfd_crat.h" #include "kfd_priv.h" #include "kfd_topology.h" +#include "kfd_iommu.h" /* GPU Processor ID base for dGPUs for which VCRAT needs to be created. * GPU processor ID are expressed with Bit[31]=1. @@ -1037,15 +1037,11 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image, struct crat_subtype_generic *sub_type_hdr; struct crat_subtype_computeunit *cu; struct kfd_cu_info cu_info; - struct amd_iommu_device_info iommu_info; int avail_size = *size; uint32_t total_num_of_cu; int num_of_cache_entries = 0; int cache_mem_filled = 0; int ret = 0; - const u32 required_iommu_flags = AMD_IOMMU_DEVICE_FLAG_ATS_SUP | - AMD_IOMMU_DEVICE_FLAG_PRI_SUP | - AMD_IOMMU_DEVICE_FLAG_PASID_SUP; struct kfd_local_mem_info local_mem_info; if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_GPU) @@ -1106,12 +1102,8 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image, /* Check if this node supports IOMMU. During parsing this flag will * translate to HSA_CAP_ATS_PRESENT */ - iommu_info.flags = 0; - if (amd_iommu_device_info(kdev->pdev, _info) == 0) { - if ((iommu_info.flags & required_iommu_flags) == - required_iommu_flags) - cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT; - } + if (!kfd_iommu_check_device(kdev)) + cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT; crat_table->length += sub_type_hdr->length; crat_table->total_entries++; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 83d6f41..4ac2d61 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -20,7 +20,9 @@ * OTHER
Re: [PATCH 11/25] drm/amdkfd: Centralize IOMMUv2 code and make it conditional
On 2018-02-07 06:20 AM, Christian König wrote: > Am 07.02.2018 um 02:32 schrieb Felix Kuehling: >> dGPUs work without IOMMUv2. Make IOMMUv2 initialization dependent on >> ASIC information. Also allow building KFD without IOMMUv2 support. >> This is still useful for dGPUs and prepares for enabling KFD on >> architectures that don't support AMD IOMMUv2. >> >> v2: >> * Centralize IOMMUv2 code to avoid #ifdefs in too many places >> >> Signed-off-by: Felix Kuehling>> --- >> drivers/gpu/drm/amd/amdkfd/Kconfig | 2 +- >> drivers/gpu/drm/amd/amdkfd/Makefile | 4 + >> drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 14 +- >> drivers/gpu/drm/amd/amdkfd/kfd_device.c | 127 +++ >> drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 + >> drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 356 >> ++ >> drivers/gpu/drm/amd/amdkfd/kfd_iommu.h | 78 +++ >> drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 14 +- >> drivers/gpu/drm/amd/amdkfd/kfd_process.c | 138 +--- >> drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 16 +- >> drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 6 +- >> 11 files changed, 493 insertions(+), 265 deletions(-) >> create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.c >> create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.h >> >> diff --git a/drivers/gpu/drm/amd/amdkfd/Kconfig >> b/drivers/gpu/drm/amd/amdkfd/Kconfig >> index bc5a294..5bbeb95 100644 >> --- a/drivers/gpu/drm/amd/amdkfd/Kconfig >> +++ b/drivers/gpu/drm/amd/amdkfd/Kconfig >> @@ -4,6 +4,6 @@ >> config HSA_AMD >> tristate "HSA kernel driver for AMD GPU devices" >> - depends on DRM_AMDGPU && AMD_IOMMU_V2 && X86_64 >> + depends on DRM_AMDGPU && X86_64 > > You still need a weak dependency on AMD_IOMMU_V2 here, in other words > add "imply AMD_IOMMU_V2". > > This prevents illegal combinations like linking amdkfd into the kernel > while amd_iommu_v2 is a module. > > But it should still allow to completely disable amd_iommu_v2 and > compile amdkfd without support for it. Thanks, that's good to know. An updated patch is attached (to avoid resending the whole series). Regards, Felix > > Christian. > >> help >> Enable this if you want to use HSA features on AMD GPU devices. >> diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile >> b/drivers/gpu/drm/amd/amdkfd/Makefile >> index a317e76..0d02422 100644 >> --- a/drivers/gpu/drm/amd/amdkfd/Makefile >> +++ b/drivers/gpu/drm/amd/amdkfd/Makefile >> @@ -37,6 +37,10 @@ amdkfd-y := kfd_module.o kfd_device.o >> kfd_chardev.o kfd_topology.o \ >> kfd_interrupt.o kfd_events.o cik_event_interrupt.o \ >> kfd_dbgdev.o kfd_dbgmgr.o kfd_crat.o >> +ifneq ($(CONFIG_AMD_IOMMU_V2),) >> +amdkfd-y += kfd_iommu.o >> +endif >> + >> amdkfd-$(CONFIG_DEBUG_FS) += kfd_debugfs.o >> obj-$(CONFIG_HSA_AMD) += amdkfd.o >> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c >> b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c >> index 2bc2816..7493f47 100644 >> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c >> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c >> @@ -22,10 +22,10 @@ >> #include >> #include >> -#include >> #include "kfd_crat.h" >> #include "kfd_priv.h" >> #include "kfd_topology.h" >> +#include "kfd_iommu.h" >> /* GPU Processor ID base for dGPUs for which VCRAT needs to be >> created. >> * GPU processor ID are expressed with Bit[31]=1. >> @@ -1037,15 +1037,11 @@ static int kfd_create_vcrat_image_gpu(void >> *pcrat_image, >> struct crat_subtype_generic *sub_type_hdr; >> struct crat_subtype_computeunit *cu; >> struct kfd_cu_info cu_info; >> - struct amd_iommu_device_info iommu_info; >> int avail_size = *size; >> uint32_t total_num_of_cu; >> int num_of_cache_entries = 0; >> int cache_mem_filled = 0; >> int ret = 0; >> - const u32 required_iommu_flags = AMD_IOMMU_DEVICE_FLAG_ATS_SUP | >> - AMD_IOMMU_DEVICE_FLAG_PRI_SUP | >> - AMD_IOMMU_DEVICE_FLAG_PASID_SUP; >> struct kfd_local_mem_info local_mem_info; >> if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_GPU) >> @@ -1106,12 +1102,8 @@ static int kfd_create_vcrat_image_gpu(void >> *pcrat_image, >> /* Check if this node supports IOMMU. During parsing this flag >> will >> * translate to HSA_CAP_ATS_PRESENT >> */ >> - iommu_info.flags = 0; >> - if (amd_iommu_device_info(kdev->pdev, _info) == 0) { >> - if ((iommu_info.flags & required_iommu_flags) == >> - required_iommu_flags) >> - cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT; >> - } >> + if (!kfd_iommu_check_device(kdev)) >> + cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT; >> crat_table->length += sub_type_hdr->length; >> crat_table->total_entries++; >> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c >> b/drivers/gpu/drm/amd/amdkfd/kfd_device.c >> index
Re: [PATCH 11/25] drm/amdkfd: Centralize IOMMUv2 code and make it conditional
Am 07.02.2018 um 02:32 schrieb Felix Kuehling: dGPUs work without IOMMUv2. Make IOMMUv2 initialization dependent on ASIC information. Also allow building KFD without IOMMUv2 support. This is still useful for dGPUs and prepares for enabling KFD on architectures that don't support AMD IOMMUv2. v2: * Centralize IOMMUv2 code to avoid #ifdefs in too many places Signed-off-by: Felix Kuehling--- drivers/gpu/drm/amd/amdkfd/Kconfig| 2 +- drivers/gpu/drm/amd/amdkfd/Makefile | 4 + drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 14 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 127 +++ drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 + drivers/gpu/drm/amd/amdkfd/kfd_iommu.c| 356 ++ drivers/gpu/drm/amd/amdkfd/kfd_iommu.h| 78 +++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 14 +- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 138 +--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 16 +- drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 6 +- 11 files changed, 493 insertions(+), 265 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.c create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.h diff --git a/drivers/gpu/drm/amd/amdkfd/Kconfig b/drivers/gpu/drm/amd/amdkfd/Kconfig index bc5a294..5bbeb95 100644 --- a/drivers/gpu/drm/amd/amdkfd/Kconfig +++ b/drivers/gpu/drm/amd/amdkfd/Kconfig @@ -4,6 +4,6 @@ config HSA_AMD tristate "HSA kernel driver for AMD GPU devices" - depends on DRM_AMDGPU && AMD_IOMMU_V2 && X86_64 + depends on DRM_AMDGPU && X86_64 You still need a weak dependency on AMD_IOMMU_V2 here, in other words add "imply AMD_IOMMU_V2". This prevents illegal combinations like linking amdkfd into the kernel while amd_iommu_v2 is a module. But it should still allow to completely disable amd_iommu_v2 and compile amdkfd without support for it. Christian. help Enable this if you want to use HSA features on AMD GPU devices. diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile b/drivers/gpu/drm/amd/amdkfd/Makefile index a317e76..0d02422 100644 --- a/drivers/gpu/drm/amd/amdkfd/Makefile +++ b/drivers/gpu/drm/amd/amdkfd/Makefile @@ -37,6 +37,10 @@ amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \ kfd_interrupt.o kfd_events.o cik_event_interrupt.o \ kfd_dbgdev.o kfd_dbgmgr.o kfd_crat.o +ifneq ($(CONFIG_AMD_IOMMU_V2),) +amdkfd-y += kfd_iommu.o +endif + amdkfd-$(CONFIG_DEBUG_FS) += kfd_debugfs.o obj-$(CONFIG_HSA_AMD) += amdkfd.o diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c index 2bc2816..7493f47 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -22,10 +22,10 @@ #include #include -#include #include "kfd_crat.h" #include "kfd_priv.h" #include "kfd_topology.h" +#include "kfd_iommu.h" /* GPU Processor ID base for dGPUs for which VCRAT needs to be created. * GPU processor ID are expressed with Bit[31]=1. @@ -1037,15 +1037,11 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image, struct crat_subtype_generic *sub_type_hdr; struct crat_subtype_computeunit *cu; struct kfd_cu_info cu_info; - struct amd_iommu_device_info iommu_info; int avail_size = *size; uint32_t total_num_of_cu; int num_of_cache_entries = 0; int cache_mem_filled = 0; int ret = 0; - const u32 required_iommu_flags = AMD_IOMMU_DEVICE_FLAG_ATS_SUP | -AMD_IOMMU_DEVICE_FLAG_PRI_SUP | -AMD_IOMMU_DEVICE_FLAG_PASID_SUP; struct kfd_local_mem_info local_mem_info; if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_GPU) @@ -1106,12 +1102,8 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image, /* Check if this node supports IOMMU. During parsing this flag will * translate to HSA_CAP_ATS_PRESENT */ - iommu_info.flags = 0; - if (amd_iommu_device_info(kdev->pdev, _info) == 0) { - if ((iommu_info.flags & required_iommu_flags) == - required_iommu_flags) - cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT; - } + if (!kfd_iommu_check_device(kdev)) + cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT; crat_table->length += sub_type_hdr->length; crat_table->total_entries++; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 83d6f41..4ac2d61 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -20,7 +20,9 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#if defined(CONFIG_AMD_IOMMU_V2_MODULE) || defined(CONFIG_AMD_IOMMU_V2) #include +#endif #include #include #include @@ -28,9 +30,11 @@