This is pretty ugly. See a suggestion inline.

On 2019-09-10 4:12 a.m., Huang, Ray wrote:
>> -----Original Message-----
>> From: S, Shirish <shiris...@amd.com>
>> Sent: Tuesday, September 10, 2019 3:54 PM
>> To: Deucher, Alexander <alexander.deuc...@amd.com>; Koenig, Christian
>> <christian.koe...@amd.com>; Huang, Ray <ray.hu...@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org; S, Shirish <shiris...@amd.com>
>> Subject: [PATCH] drm/amdgpu: fix build error without CONFIG_HSA_AMD
>>
>> If CONFIG_HSA_AMD is not set, build fails:
>>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.o: In function
>> `amdgpu_device_ip_early_init':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1626: undefined
>> reference to `sched_policy'
>>
>> Use CONFIG_HSA_AMD to guard this.
>>
>> Fixes: 1abb680ad371 ("drm/amdgpu: disable gfxoff while use no H/W
>> scheduling policy")
>>
>> Signed-off-by: Shirish S <shiris...@amd.com>
> + Felix for his awareness.
>
> Reviewed-by: Huang Rui <ray.hu...@amd.com>
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 2 ++
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
>>   2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 1030cb30720c..a1516a3ae9a8 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -169,7 +169,9 @@ extern int amdgpu_discovery;  extern int
>> amdgpu_mes;  extern int amdgpu_noretry;  extern int
>> amdgpu_force_asic_type;
>> +#ifdef CONFIG_HSA_AMD
>>   extern int sched_policy;

#else
static const int sched_policy = KFD_SCHED_POLICY_HWS;
#endif

This way you don't need another set of ugly #ifdefs in amdgpu_device.c.

Regards,
   Felix


>> +#endif
>>
>>   #ifdef CONFIG_DRM_AMDGPU_SI
>>   extern int amdgpu_si_support;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index bd423dd64e18..2535db27f821 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -1623,7 +1623,11 @@ static int amdgpu_device_ip_early_init(struct
>> amdgpu_device *adev)
>>      }
>>
>>      adev->pm.pp_feature = amdgpu_pp_feature_mask;
>> -    if (amdgpu_sriov_vf(adev) || sched_policy ==
>> KFD_SCHED_POLICY_NO_HWS)
>> +    if (amdgpu_sriov_vf(adev)
>> +        #ifdef CONFIG_HSA_AMD
>> +        || sched_policy == KFD_SCHED_POLICY_NO_HWS
>> +        #endif
>> +        )
>>              adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
>>
>>      for (i = 0; i < adev->num_ip_blocks; i++) {
>> --
>> 2.20.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to