diff mbox series

[RFC,v2,2/2] drm/amd/display: Use PPC FPU functions

Message ID 20210721044801.840501-3-Anson.Jacob@amd.com
State RFC
Headers show
Series PPC: Add generic FPU api similar to x86 | expand
Related show

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_sparse fail sparse (mpc885_ads_defconfig, ubuntu-21.04, ppc64) failed at step Build.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu fail kernel (mpc885_ads_defconfig, fedora-34) failed at step build.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 8 jobs.

Commit Message

Anson Jacob July 21, 2021, 4:48 a.m. UTC
Use kernel_fpu_begin & kernel_fpu_end for PPC

Depends on "ppc/fpu: Add generic FPU api similar to x86"

v2:
- Got rid of macro switch for PPC as header file with same
  name as x86 is added by previous patch in the series

Signed-off-by: Anson Jacob <Anson.Jacob@amd.com>
CC: Christoph Hellwig <hch@infradead.org>
CC: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
CC: Harry Wentland <harry.wentland@amd.com>
CC: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/display/dc/os_types.h | 29 -----------------------
 1 file changed, 29 deletions(-)

Comments

Christian König July 21, 2021, 6:29 a.m. UTC | #1
Am 21.07.21 um 06:48 schrieb Anson Jacob:
> Use kernel_fpu_begin & kernel_fpu_end for PPC
>
> Depends on "ppc/fpu: Add generic FPU api similar to x86"
>
> v2:
> - Got rid of macro switch for PPC as header file with same
>    name as x86 is added by previous patch in the series
>
> Signed-off-by: Anson Jacob <Anson.Jacob@amd.com>
> CC: Christoph Hellwig <hch@infradead.org>
> CC: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
> CC: Harry Wentland <harry.wentland@amd.com>
> CC: Christian König <christian.koenig@amd.com>

Looks good in general, but question is what about other architectures 
like ARM?

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/display/dc/os_types.h | 29 -----------------------
>   1 file changed, 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h
> index 126c2f3a4dd3..47ef434f93d8 100644
> --- a/drivers/gpu/drm/amd/display/dc/os_types.h
> +++ b/drivers/gpu/drm/amd/display/dc/os_types.h
> @@ -51,38 +51,9 @@
>   #define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__)
>   
>   #if defined(CONFIG_DRM_AMD_DC_DCN)
> -#if defined(CONFIG_X86)
>   #include <asm/fpu/api.h>
>   #define DC_FP_START() kernel_fpu_begin()
>   #define DC_FP_END() kernel_fpu_end()
> -#elif defined(CONFIG_PPC64)
> -#include <asm/switch_to.h>
> -#include <asm/cputable.h>
> -#define DC_FP_START() { \
> -	if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
> -		preempt_disable(); \
> -		enable_kernel_vsx(); \
> -	} else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
> -		preempt_disable(); \
> -		enable_kernel_altivec(); \
> -	} else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
> -		preempt_disable(); \
> -		enable_kernel_fp(); \
> -	} \
> -}
> -#define DC_FP_END() { \
> -	if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
> -		disable_kernel_vsx(); \
> -		preempt_enable(); \
> -	} else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
> -		disable_kernel_altivec(); \
> -		preempt_enable(); \
> -	} else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
> -		disable_kernel_fp(); \
> -		preempt_enable(); \
> -	} \
> -}
> -#endif
>   #endif
>   
>   /*
Christoph Hellwig July 21, 2021, 6:51 a.m. UTC | #2
On Wed, Jul 21, 2021 at 08:29:43AM +0200, Christian K??nig wrote:
> Looks good in general, but question is what about other architectures like
> ARM?

DRM_AMD_DC_DCN currently requires X86 || PPC64.

Maybe a good think would be to add a new KERNEL_FPU_API Kconfig symbol,
selected by x86 and powerpc (I think ppc32 should be fine too now) so
that we get these arch dependencies out of the driver.
Christian König July 21, 2021, 9:24 a.m. UTC | #3
Am 21.07.21 um 08:51 schrieb Christoph Hellwig:
> On Wed, Jul 21, 2021 at 08:29:43AM +0200, Christian K??nig wrote:
>> Looks good in general, but question is what about other architectures like
>> ARM?
> DRM_AMD_DC_DCN currently requires X86 || PPC64.

And exactly that's the problem I'm noting here. At least officially AMD 
claims that we support ARM and some very brave still use the hardware 
together with MIPS as well.

> Maybe a good think would be to add a new KERNEL_FPU_API Kconfig symbol,
> selected by x86 and powerpc (I think ppc32 should be fine too now) so
> that we get these arch dependencies out of the driver.

Good idea.

Christian.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h
index 126c2f3a4dd3..47ef434f93d8 100644
--- a/drivers/gpu/drm/amd/display/dc/os_types.h
+++ b/drivers/gpu/drm/amd/display/dc/os_types.h
@@ -51,38 +51,9 @@ 
 #define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__)
 
 #if defined(CONFIG_DRM_AMD_DC_DCN)
-#if defined(CONFIG_X86)
 #include <asm/fpu/api.h>
 #define DC_FP_START() kernel_fpu_begin()
 #define DC_FP_END() kernel_fpu_end()
-#elif defined(CONFIG_PPC64)
-#include <asm/switch_to.h>
-#include <asm/cputable.h>
-#define DC_FP_START() { \
-	if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
-		preempt_disable(); \
-		enable_kernel_vsx(); \
-	} else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
-		preempt_disable(); \
-		enable_kernel_altivec(); \
-	} else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
-		preempt_disable(); \
-		enable_kernel_fp(); \
-	} \
-}
-#define DC_FP_END() { \
-	if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
-		disable_kernel_vsx(); \
-		preempt_enable(); \
-	} else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
-		disable_kernel_altivec(); \
-		preempt_enable(); \
-	} else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
-		disable_kernel_fp(); \
-		preempt_enable(); \
-	} \
-}
-#endif
 #endif
 
 /*