* [PATCH v2] drm/amdgpu: conditionally compile amdgpu's amdkfd files
@ 2018-05-18 19:42 Oded Gabbay
[not found] ` <20180518194250.3813-1-oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Oded Gabbay @ 2018-05-18 19:42 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, felix.kuehling-5C7GfCeVMHo
In case CONFIG_HSA_AMD is not chosen, there is no need to compile amdkfd
files that reside inside amdgpu dirver. In addition, because amdkfd
depends on x86_64 architecture and amdgpu is not, compiling amdkfd files
under i386 architecture can cause compiler errors and warnings.
This patch modifies amdgpu's makefile to build amdkfd files only if
CONFIG_HSA_AMD is chosen. The only file to be compiled unconditionally
is amdgpu_amdkfd.c
Direct calls from amdgpu driver proper to functions in other
amdgpu_amdkfd_*.c files were changed to calls to functions inside
amdgpu_amdkfd.c. These functions call the original functions using a
function pointer to allow compilation without the original functions.
v2:
Instead of using function pointers, use stub functions that are compiled
only if amdkfd is not compiled.
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/Makefile | 13 +++++++--
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 46 ++++++++++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 12 ++++----
3 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile
index 68e9f584c570..e03ee41cedcb 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -56,8 +56,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
# add asic specific block
amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
- ci_smc.o ci_dpm.o dce_v8_0.o gfx_v7_0.o cik_sdma.o uvd_v4_2.o vce_v2_0.o \
- amdgpu_amdkfd_gfx_v7.o
+ ci_smc.o ci_dpm.o dce_v8_0.o gfx_v7_0.o cik_sdma.o uvd_v4_2.o vce_v2_0.o
amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o
@@ -130,13 +129,21 @@ amdgpu-y += \
vcn_v1_0.o
# add amdkfd interfaces
+amdgpu-y += amdgpu_amdkfd.o
+
+ifneq ($(CONFIG_HSA_AMD),)
amdgpu-y += \
- amdgpu_amdkfd.o \
amdgpu_amdkfd_fence.o \
amdgpu_amdkfd_gpuvm.o \
amdgpu_amdkfd_gfx_v8.o \
amdgpu_amdkfd_gfx_v9.o
+ifneq ($(CONFIG_DRM_AMDGPU_CIK),)
+amdgpu-y += amdgpu_amdkfd_gfx_v7.o
+endif
+
+endif
+
# add cgs
amdgpu-y += amdgpu_cgs.o
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index bd36ee9f7e6d..b0b39bd83f0f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -50,7 +50,9 @@ int amdgpu_amdkfd_init(void)
kgd2kfd = NULL;
}
+
#elif defined(CONFIG_HSA_AMD)
+
ret = kgd2kfd_init(KFD_INTERFACE_VERSION, &kgd2kfd);
if (ret)
kgd2kfd = NULL;
@@ -58,7 +60,10 @@ int amdgpu_amdkfd_init(void)
#else
ret = -ENOENT;
#endif
+
+#if defined(CONFIG_HSA_AMD_MODULE) || defined(CONFIG_HSA_AMD)
amdgpu_amdkfd_gpuvm_init_mem_limits();
+#endif
return ret;
}
@@ -464,3 +469,44 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
return false;
}
+
+#if !defined(CONFIG_HSA_AMD_MODULE) && !defined(CONFIG_HSA_AMD)
+bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm)
+{
+ return false;
+}
+
+void amdgpu_amdkfd_unreserve_system_memory_limit(struct amdgpu_bo *bo)
+{
+}
+
+void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
+ struct amdgpu_vm *vm)
+{
+}
+
+struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)
+{
+ return NULL;
+}
+
+int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem, struct mm_struct *mm)
+{
+ return 0;
+}
+
+struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
+{
+ return NULL;
+}
+
+struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
+{
+ return NULL;
+}
+
+struct kfd2kgd_calls *amdgpu_amdkfd_gfx_9_0_get_functions(void)
+{
+ return NULL;
+}
+#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 12367a9951e8..a8418a3f4e9d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
@@ -156,14 +156,14 @@ uint64_t amdgpu_amdkfd_get_vram_usage(struct kgd_dev *kgd);
/* GPUVM API */
int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm,
- void **process_info,
- struct dma_fence **ef);
+ void **process_info,
+ struct dma_fence **ef);
int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
- struct file *filp,
- void **vm, void **process_info,
- struct dma_fence **ef);
+ struct file *filp,
+ void **vm, void **process_info,
+ struct dma_fence **ef);
void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
- struct amdgpu_vm *vm);
+ struct amdgpu_vm *vm);
void amdgpu_amdkfd_gpuvm_destroy_process_vm(struct kgd_dev *kgd, void *vm);
uint32_t amdgpu_amdkfd_gpuvm_get_process_page_dir(void *vm);
int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
--
2.14.3
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/amdgpu: conditionally compile amdgpu's amdkfd files
[not found] ` <20180518194250.3813-1-oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-05-18 20:06 ` Felix Kuehling
[not found] ` <6cf89c5a-61d9-041b-5296-ec57d8361a40-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Felix Kuehling @ 2018-05-18 20:06 UTC (permalink / raw)
To: Oded Gabbay, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Two more comments inline. One cosmetic, one real issue. With that fixed,
this patch is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Regards,
Felix
On 2018-05-18 03:42 PM, Oded Gabbay wrote:
> In case CONFIG_HSA_AMD is not chosen, there is no need to compile amdkfd
> files that reside inside amdgpu dirver. In addition, because amdkfd
> depends on x86_64 architecture and amdgpu is not, compiling amdkfd files
> under i386 architecture can cause compiler errors and warnings.
>
> This patch modifies amdgpu's makefile to build amdkfd files only if
> CONFIG_HSA_AMD is chosen. The only file to be compiled unconditionally
> is amdgpu_amdkfd.c
>
> Direct calls from amdgpu driver proper to functions in other
> amdgpu_amdkfd_*.c files were changed to calls to functions inside
> amdgpu_amdkfd.c. These functions call the original functions using a
> function pointer to allow compilation without the original functions.
The above paragraph needs to be updated.
>
> v2:
> Instead of using function pointers, use stub functions that are compiled
> only if amdkfd is not compiled.
>
> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
> ---
> drivers/gpu/drm/amd/amdgpu/Makefile | 13 +++++++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 46 ++++++++++++++++++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 12 ++++----
> 3 files changed, 62 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile
> index 68e9f584c570..e03ee41cedcb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> @@ -56,8 +56,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
>
> # add asic specific block
> amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
> - ci_smc.o ci_dpm.o dce_v8_0.o gfx_v7_0.o cik_sdma.o uvd_v4_2.o vce_v2_0.o \
> - amdgpu_amdkfd_gfx_v7.o
> + ci_smc.o ci_dpm.o dce_v8_0.o gfx_v7_0.o cik_sdma.o uvd_v4_2.o vce_v2_0.o
>
> amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o
>
> @@ -130,13 +129,21 @@ amdgpu-y += \
> vcn_v1_0.o
>
> # add amdkfd interfaces
> +amdgpu-y += amdgpu_amdkfd.o
> +
> +ifneq ($(CONFIG_HSA_AMD),)
> amdgpu-y += \
> - amdgpu_amdkfd.o \
> amdgpu_amdkfd_fence.o \
> amdgpu_amdkfd_gpuvm.o \
> amdgpu_amdkfd_gfx_v8.o \
> amdgpu_amdkfd_gfx_v9.o
>
> +ifneq ($(CONFIG_DRM_AMDGPU_CIK),)
> +amdgpu-y += amdgpu_amdkfd_gfx_v7.o
> +endif
> +
> +endif
> +
> # add cgs
> amdgpu-y += amdgpu_cgs.o
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> index bd36ee9f7e6d..b0b39bd83f0f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> @@ -50,7 +50,9 @@ int amdgpu_amdkfd_init(void)
> kgd2kfd = NULL;
> }
>
> +
> #elif defined(CONFIG_HSA_AMD)
> +
> ret = kgd2kfd_init(KFD_INTERFACE_VERSION, &kgd2kfd);
> if (ret)
> kgd2kfd = NULL;
> @@ -58,7 +60,10 @@ int amdgpu_amdkfd_init(void)
> #else
> ret = -ENOENT;
> #endif
> +
> +#if defined(CONFIG_HSA_AMD_MODULE) || defined(CONFIG_HSA_AMD)
> amdgpu_amdkfd_gpuvm_init_mem_limits();
> +#endif
>
> return ret;
> }
> @@ -464,3 +469,44 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
>
> return false;
> }
> +
> +#if !defined(CONFIG_HSA_AMD_MODULE) && !defined(CONFIG_HSA_AMD)
> +bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm)
> +{
> + return false;
> +}
> +
> +void amdgpu_amdkfd_unreserve_system_memory_limit(struct amdgpu_bo *bo)
> +{
> +}
> +
> +void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
> + struct amdgpu_vm *vm)
> +{
> +}
> +
> +struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)
> +{
> + return NULL;
> +}
> +
> +int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem, struct mm_struct *mm)
> +{
> + return 0;
> +}
> +
> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
> +{
> + return NULL;
I think this will cause an oops in amdgpu_amdkfd_probe because that
function doesn't handle kgd2kfd == NULL. You could remove
amdgpu_amdkfd_gfx_*_get_functions and instead turn amdgpu_amdkfd_probe
itself into a stub to simplify this. That's the only place where
*_get_functions are called.
> +}
> +
> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
> +{
> + return NULL;
> +}
> +
> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_9_0_get_functions(void)
> +{
> + return NULL;
> +}
> +#endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> index 12367a9951e8..a8418a3f4e9d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> @@ -156,14 +156,14 @@ uint64_t amdgpu_amdkfd_get_vram_usage(struct kgd_dev *kgd);
>
> /* GPUVM API */
> int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm,
> - void **process_info,
> - struct dma_fence **ef);
> + void **process_info,
> + struct dma_fence **ef);
> int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
> - struct file *filp,
> - void **vm, void **process_info,
> - struct dma_fence **ef);
> + struct file *filp,
> + void **vm, void **process_info,
> + struct dma_fence **ef);
> void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
> - struct amdgpu_vm *vm);
> + struct amdgpu_vm *vm);
> void amdgpu_amdkfd_gpuvm_destroy_process_vm(struct kgd_dev *kgd, void *vm);
> uint32_t amdgpu_amdkfd_gpuvm_get_process_page_dir(void *vm);
> int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/amdgpu: conditionally compile amdgpu's amdkfd files
[not found] ` <6cf89c5a-61d9-041b-5296-ec57d8361a40-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-18 21:57 ` Oded Gabbay
[not found] ` <CAFCwf11LQ00m+VEHjjoTJirwx_N5L9gYAMULD3Bta9_pU6toZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Oded Gabbay @ 2018-05-18 21:57 UTC (permalink / raw)
To: Felix Kuehling; +Cc: amd-gfx list
On Fri, May 18, 2018 at 11:06 PM, Felix Kuehling <felix.kuehling@amd.com> wrote:
> Two more comments inline. One cosmetic, one real issue. With that fixed,
> this patch is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
>
> Regards,
> Felix
>
> On 2018-05-18 03:42 PM, Oded Gabbay wrote:
>> In case CONFIG_HSA_AMD is not chosen, there is no need to compile amdkfd
>> files that reside inside amdgpu dirver. In addition, because amdkfd
>> depends on x86_64 architecture and amdgpu is not, compiling amdkfd files
>> under i386 architecture can cause compiler errors and warnings.
>>
>> This patch modifies amdgpu's makefile to build amdkfd files only if
>> CONFIG_HSA_AMD is chosen. The only file to be compiled unconditionally
>> is amdgpu_amdkfd.c
>>
>> Direct calls from amdgpu driver proper to functions in other
>> amdgpu_amdkfd_*.c files were changed to calls to functions inside
>> amdgpu_amdkfd.c. These functions call the original functions using a
>> function pointer to allow compilation without the original functions.
>
> The above paragraph needs to be updated.
Yeah, I'll send v3.
>
>>
>> v2:
>> Instead of using function pointers, use stub functions that are compiled
>> only if amdkfd is not compiled.
>>
>> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/Makefile | 13 +++++++--
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 46 ++++++++++++++++++++++++++++++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 12 ++++----
>> 3 files changed, 62 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile
>> index 68e9f584c570..e03ee41cedcb 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/Makefile
>> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
>> @@ -56,8 +56,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
>>
>> # add asic specific block
>> amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
>> - ci_smc.o ci_dpm.o dce_v8_0.o gfx_v7_0.o cik_sdma.o uvd_v4_2.o vce_v2_0.o \
>> - amdgpu_amdkfd_gfx_v7.o
>> + ci_smc.o ci_dpm.o dce_v8_0.o gfx_v7_0.o cik_sdma.o uvd_v4_2.o vce_v2_0.o
>>
>> amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce_v6_0.o si_dpm.o si_smc.o
>>
>> @@ -130,13 +129,21 @@ amdgpu-y += \
>> vcn_v1_0.o
>>
>> # add amdkfd interfaces
>> +amdgpu-y += amdgpu_amdkfd.o
>> +
>> +ifneq ($(CONFIG_HSA_AMD),)
>> amdgpu-y += \
>> - amdgpu_amdkfd.o \
>> amdgpu_amdkfd_fence.o \
>> amdgpu_amdkfd_gpuvm.o \
>> amdgpu_amdkfd_gfx_v8.o \
>> amdgpu_amdkfd_gfx_v9.o
>>
>> +ifneq ($(CONFIG_DRM_AMDGPU_CIK),)
>> +amdgpu-y += amdgpu_amdkfd_gfx_v7.o
>> +endif
>> +
>> +endif
>> +
>> # add cgs
>> amdgpu-y += amdgpu_cgs.o
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
>> index bd36ee9f7e6d..b0b39bd83f0f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
>> @@ -50,7 +50,9 @@ int amdgpu_amdkfd_init(void)
>> kgd2kfd = NULL;
>> }
>>
>> +
>> #elif defined(CONFIG_HSA_AMD)
>> +
>> ret = kgd2kfd_init(KFD_INTERFACE_VERSION, &kgd2kfd);
>> if (ret)
>> kgd2kfd = NULL;
>> @@ -58,7 +60,10 @@ int amdgpu_amdkfd_init(void)
>> #else
>> ret = -ENOENT;
>> #endif
>> +
>> +#if defined(CONFIG_HSA_AMD_MODULE) || defined(CONFIG_HSA_AMD)
>> amdgpu_amdkfd_gpuvm_init_mem_limits();
>> +#endif
>>
>> return ret;
>> }
>> @@ -464,3 +469,44 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
>>
>> return false;
>> }
>> +
>> +#if !defined(CONFIG_HSA_AMD_MODULE) && !defined(CONFIG_HSA_AMD)
>> +bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm)
>> +{
>> + return false;
>> +}
>> +
>> +void amdgpu_amdkfd_unreserve_system_memory_limit(struct amdgpu_bo *bo)
>> +{
>> +}
>> +
>> +void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
>> + struct amdgpu_vm *vm)
>> +{
>> +}
>> +
>> +struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)
>> +{
>> + return NULL;
>> +}
>> +
>> +int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem, struct mm_struct *mm)
>> +{
>> + return 0;
>> +}
>> +
>> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
>> +{
>> + return NULL;
>
> I think this will cause an oops in amdgpu_amdkfd_probe because that
> function doesn't handle kgd2kfd == NULL. You could remove
> amdgpu_amdkfd_gfx_*_get_functions and instead turn amdgpu_amdkfd_probe
> itself into a stub to simplify this. That's the only place where
> *_get_functions are called.
Actually this function will never be called if amdkfd is not compiled,
because amdgpu_amdkfd_probe will exit immediately due to the if
statement at the start of that function (which checks kgd2kfd is not
NULL). I did see that kgd2kfd is not initialized to NULL in case
amdkfd is not compiled and I fixed that in v3.
I prefer not to add stub for probe because then I will have to #ifdef
around the real probe function and I prefer to minimize #ifdefs
Oded
>
>> +}
>> +
>> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
>> +{
>> + return NULL;
>> +}
>> +
>> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_9_0_get_functions(void)
>> +{
>> + return NULL;
>> +}
>> +#endif
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
>> index 12367a9951e8..a8418a3f4e9d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
>> @@ -156,14 +156,14 @@ uint64_t amdgpu_amdkfd_get_vram_usage(struct kgd_dev *kgd);
>>
>> /* GPUVM API */
>> int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm,
>> - void **process_info,
>> - struct dma_fence **ef);
>> + void **process_info,
>> + struct dma_fence **ef);
>> int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
>> - struct file *filp,
>> - void **vm, void **process_info,
>> - struct dma_fence **ef);
>> + struct file *filp,
>> + void **vm, void **process_info,
>> + struct dma_fence **ef);
>> void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
>> - struct amdgpu_vm *vm);
>> + struct amdgpu_vm *vm);
>> void amdgpu_amdkfd_gpuvm_destroy_process_vm(struct kgd_dev *kgd, void *vm);
>> uint32_t amdgpu_amdkfd_gpuvm_get_process_page_dir(void *vm);
>> int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/amdgpu: conditionally compile amdgpu's amdkfd files
[not found] ` <CAFCwf11LQ00m+VEHjjoTJirwx_N5L9gYAMULD3Bta9_pU6toZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-05-18 22:12 ` Felix Kuehling
0 siblings, 0 replies; 4+ messages in thread
From: Felix Kuehling @ 2018-05-18 22:12 UTC (permalink / raw)
To: Oded Gabbay; +Cc: amd-gfx list
On 2018-05-18 05:57 PM, Oded Gabbay wrote:
>>> +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
>>> +{
>>> + return NULL;
>> I think this will cause an oops in amdgpu_amdkfd_probe because that
>> function doesn't handle kgd2kfd == NULL. You could remove
>> amdgpu_amdkfd_gfx_*_get_functions and instead turn amdgpu_amdkfd_probe
>> itself into a stub to simplify this. That's the only place where
>> *_get_functions are called.
> Actually this function will never be called if amdkfd is not compiled,
> because amdgpu_amdkfd_probe will exit immediately due to the if
> statement at the start of that function (which checks kgd2kfd is not
> NULL).
Ah, I missed that.
> I did see that kgd2kfd is not initialized to NULL in case
> amdkfd is not compiled and I fixed that in v3.
kgd2kfd is global uninitialized data. That should be implicitly
initialized to 0. I've got checkpatch warnings before for initializing
global variables to 0 explicitly. Anyway, doing the initialization
explicitly in the code like you did in v3 doesn't do any harm and it
makes things more clear.
Thanks,
Felix
> I prefer not to add stub for probe because then I will have to #ifdef
> around the real probe function and I prefer to minimize #ifdefs
>
> Oded
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-18 22:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18 19:42 [PATCH v2] drm/amdgpu: conditionally compile amdgpu's amdkfd files Oded Gabbay
[not found] ` <20180518194250.3813-1-oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-18 20:06 ` Felix Kuehling
[not found] ` <6cf89c5a-61d9-041b-5296-ec57d8361a40-5C7GfCeVMHo@public.gmane.org>
2018-05-18 21:57 ` Oded Gabbay
[not found] ` <CAFCwf11LQ00m+VEHjjoTJirwx_N5L9gYAMULD3Bta9_pU6toZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-18 22:12 ` Felix Kuehling
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.