* [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units
@ 2025-10-09 15:06 Ard Biesheuvel
2025-10-09 16:19 ` Christian König
2025-10-12 14:22 ` kernel test robot
0 siblings, 2 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2025-10-09 15:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-kernel, Ard Biesheuvel, Austin Zheng, Jun Lei,
Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
Christian König, amd-gfx, dri-devel
From: Ard Biesheuvel <ardb@kernel.org>
Test the existing CPP macro _LINUX_FPU_COMPILATION_UNIT, which is set
when building source files that are permitted to use floating point,
in the implementation of DC_FP_START/END so that those are only usable
in non-FP code. This is a requirement of the generic kernel mode FPU
API, as some architectures (i.e., arm64) cannot safely enable FP codegen
in arbitrary code.
Cc: Austin Zheng <austin.zheng@amd.com>
Cc: Jun Lei <jun.lei@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Rodrigo Siqueira <siqueira@igalia.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h | 8 ++++++++
drivers/gpu/drm/amd/display/dc/os_types.h | 2 --
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
index b8275b397920..4e921632bc4e 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
@@ -31,4 +31,12 @@ void dc_assert_fp_enabled(void);
void dc_fpu_begin(const char *function_name, const int line);
void dc_fpu_end(const char *function_name, const int line);
+#ifndef _LINUX_FPU_COMPILATION_UNIT
+#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
+#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
+#else
+#define DC_FP_START() BUILD_BUG()
+#define DC_FP_END() BUILD_BUG()
+#endif
+
#endif /* __DC_FPU_H__ */
diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h
index 782316348941..6af831710489 100644
--- a/drivers/gpu/drm/amd/display/dc/os_types.h
+++ b/drivers/gpu/drm/amd/display/dc/os_types.h
@@ -55,8 +55,6 @@
#if defined(CONFIG_DRM_AMD_DC_FP)
#include "amdgpu_dm/dc_fpu.h"
-#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
-#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
#endif /* CONFIG_DRM_AMD_DC_FP */
/*
--
2.51.0.710.ga91ca5db03-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units
2025-10-09 15:06 [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units Ard Biesheuvel
@ 2025-10-09 16:19 ` Christian König
2025-10-09 20:40 ` Harry Wentland
2025-10-12 14:22 ` kernel test robot
1 sibling, 1 reply; 5+ messages in thread
From: Christian König @ 2025-10-09 16:19 UTC (permalink / raw)
To: Ard Biesheuvel, linux-kernel
Cc: linux-arm-kernel, Ard Biesheuvel, Austin Zheng, Jun Lei,
Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher, amd-gfx,
dri-devel
On 09.10.25 17:06, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
>
> Test the existing CPP macro _LINUX_FPU_COMPILATION_UNIT, which is set
> when building source files that are permitted to use floating point,
> in the implementation of DC_FP_START/END so that those are only usable
> in non-FP code. This is a requirement of the generic kernel mode FPU
> API, as some architectures (i.e., arm64) cannot safely enable FP codegen
> in arbitrary code.
If I'm not completely mistaken that is actually an issue on basically all architectures, at least x86 is affected as well if I'm not completely mistaken.
> Cc: Austin Zheng <austin.zheng@amd.com>
> Cc: Jun Lei <jun.lei@amd.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Rodrigo Siqueira <siqueira@igalia.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Anyway, patch looks sane to me but I'm not so deep in the DC code to fully judge.
Fell free to add Acked-by: Christian König <christian.koenig@amd.com>, but Harry and Leo need to take a look.
Thanks,
Christian.
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h | 8 ++++++++
> drivers/gpu/drm/amd/display/dc/os_types.h | 2 --
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
> index b8275b397920..4e921632bc4e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
> @@ -31,4 +31,12 @@ void dc_assert_fp_enabled(void);
> void dc_fpu_begin(const char *function_name, const int line);
> void dc_fpu_end(const char *function_name, const int line);
>
> +#ifndef _LINUX_FPU_COMPILATION_UNIT
> +#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
> +#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
> +#else
> +#define DC_FP_START() BUILD_BUG()
> +#define DC_FP_END() BUILD_BUG()
> +#endif
> +
> #endif /* __DC_FPU_H__ */
> diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h
> index 782316348941..6af831710489 100644
> --- a/drivers/gpu/drm/amd/display/dc/os_types.h
> +++ b/drivers/gpu/drm/amd/display/dc/os_types.h
> @@ -55,8 +55,6 @@
>
> #if defined(CONFIG_DRM_AMD_DC_FP)
> #include "amdgpu_dm/dc_fpu.h"
> -#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
> -#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
> #endif /* CONFIG_DRM_AMD_DC_FP */
>
> /*
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units
2025-10-09 16:19 ` Christian König
@ 2025-10-09 20:40 ` Harry Wentland
2025-10-09 21:27 ` Ard Biesheuvel
0 siblings, 1 reply; 5+ messages in thread
From: Harry Wentland @ 2025-10-09 20:40 UTC (permalink / raw)
To: Christian König, Ard Biesheuvel, linux-kernel
Cc: linux-arm-kernel, Ard Biesheuvel, Austin Zheng, Jun Lei, Leo Li,
Rodrigo Siqueira, Alex Deucher, amd-gfx, dri-devel
On 2025-10-09 12:19, Christian König wrote:
> On 09.10.25 17:06, Ard Biesheuvel wrote:
>> From: Ard Biesheuvel <ardb@kernel.org>
>>
>> Test the existing CPP macro _LINUX_FPU_COMPILATION_UNIT, which is set
>> when building source files that are permitted to use floating point,
>> in the implementation of DC_FP_START/END so that those are only usable
>> in non-FP code. This is a requirement of the generic kernel mode FPU
>> API, as some architectures (i.e., arm64) cannot safely enable FP codegen
>> in arbitrary code.
>
> If I'm not completely mistaken that is actually an issue on basically all architectures, at least x86 is affected as well if I'm not completely mistaken.
>
>> Cc: Austin Zheng <austin.zheng@amd.com>
>> Cc: Jun Lei <jun.lei@amd.com>
>> Cc: Harry Wentland <harry.wentland@amd.com>
>> Cc: Leo Li <sunpeng.li@amd.com>
>> Cc: Rodrigo Siqueira <siqueira@igalia.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: "Christian König" <christian.koenig@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>
> Anyway, patch looks sane to me but I'm not so deep in the DC code to fully judge.
>
> Fell free to add Acked-by: Christian König <christian.koenig@amd.com>, but Harry and Leo need to take a look.
>
Thanks. Good safe-guard. Flags a bunch of issues in the
current code. Let me fix them before merging it.
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Harry
> Thanks,
> Christian.
>
>> ---
>> drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h | 8 ++++++++
>> drivers/gpu/drm/amd/display/dc/os_types.h | 2 --
>> 2 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
>> index b8275b397920..4e921632bc4e 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h
>> @@ -31,4 +31,12 @@ void dc_assert_fp_enabled(void);
>> void dc_fpu_begin(const char *function_name, const int line);
>> void dc_fpu_end(const char *function_name, const int line);
>>
>> +#ifndef _LINUX_FPU_COMPILATION_UNIT
>> +#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
>> +#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
>> +#else
>> +#define DC_FP_START() BUILD_BUG()
>> +#define DC_FP_END() BUILD_BUG()
>> +#endif
>> +
>> #endif /* __DC_FPU_H__ */
>> diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h
>> index 782316348941..6af831710489 100644
>> --- a/drivers/gpu/drm/amd/display/dc/os_types.h
>> +++ b/drivers/gpu/drm/amd/display/dc/os_types.h
>> @@ -55,8 +55,6 @@
>>
>> #if defined(CONFIG_DRM_AMD_DC_FP)
>> #include "amdgpu_dm/dc_fpu.h"
>> -#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
>> -#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
>> #endif /* CONFIG_DRM_AMD_DC_FP */
>>
>> /*
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units
2025-10-09 20:40 ` Harry Wentland
@ 2025-10-09 21:27 ` Ard Biesheuvel
0 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2025-10-09 21:27 UTC (permalink / raw)
To: Harry Wentland
Cc: Christian König, Ard Biesheuvel, linux-kernel,
linux-arm-kernel, Austin Zheng, Jun Lei, Leo Li, Rodrigo Siqueira,
Alex Deucher, amd-gfx, dri-devel
On Thu, 9 Oct 2025 at 13:41, Harry Wentland <harry.wentland@amd.com> wrote:
>
>
>
> On 2025-10-09 12:19, Christian König wrote:
> > On 09.10.25 17:06, Ard Biesheuvel wrote:
> >> From: Ard Biesheuvel <ardb@kernel.org>
> >>
> >> Test the existing CPP macro _LINUX_FPU_COMPILATION_UNIT, which is set
> >> when building source files that are permitted to use floating point,
> >> in the implementation of DC_FP_START/END so that those are only usable
> >> in non-FP code. This is a requirement of the generic kernel mode FPU
> >> API, as some architectures (i.e., arm64) cannot safely enable FP codegen
> >> in arbitrary code.
> >
> > If I'm not completely mistaken that is actually an issue on basically all architectures, at least x86 is affected as well if I'm not completely mistaken.
> >
> >> Cc: Austin Zheng <austin.zheng@amd.com>
> >> Cc: Jun Lei <jun.lei@amd.com>
> >> Cc: Harry Wentland <harry.wentland@amd.com>
> >> Cc: Leo Li <sunpeng.li@amd.com>
> >> Cc: Rodrigo Siqueira <siqueira@igalia.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: "Christian König" <christian.koenig@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> >
> > Anyway, patch looks sane to me but I'm not so deep in the DC code to fully judge.
> >
> > Fell free to add Acked-by: Christian König <christian.koenig@amd.com>, but Harry and Leo need to take a look.
> >
>
> Thanks. Good safe-guard. Flags a bunch of issues in the
> current code. Let me fix them before merging it.
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
Thanks.
I already fixed a bunch here:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ddbfac152830e38d488ff8e45ab7eaf5d72f8527
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units
2025-10-09 15:06 [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units Ard Biesheuvel
2025-10-09 16:19 ` Christian König
@ 2025-10-12 14:22 ` kernel test robot
1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-10-12 14:22 UTC (permalink / raw)
To: Ard Biesheuvel, linux-kernel
Cc: llvm, oe-kbuild-all, linux-arm-kernel, Ard Biesheuvel,
Austin Zheng, Jun Lei, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, amd-gfx, dri-devel
Hi Ard,
kernel test robot noticed the following build errors:
[auto build test ERROR on soc/for-next]
[also build test ERROR on linus/master v6.17 next-20251010]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ard-Biesheuvel/drm-amd-Permit-DC_FP_START-END-only-in-non-FP-compilation-units/20251010-120206
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link: https://lore.kernel.org/r/20251009150621.3886079-2-ardb%2Bgit%40google.com
patch subject: [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: x86_64-randconfig-071-20251010 (https://download.01.org/0day-ci/archive/20251011/202510110219.Z6t2PJbZ-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251011/202510110219.Z6t2PJbZ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202510110219.Z6t2PJbZ-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_wrapper.c:563:2: error: call to '__compiletime_assert_610' declared with 'error' attribute: BUILD_BUG failed
563 | DC_FP_START();
| ^
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/dc_fpu.h:38:23: note: expanded from macro 'DC_FP_START'
38 | #define DC_FP_START() BUILD_BUG()
| ^
include/linux/build_bug.h:59:21: note: expanded from macro 'BUILD_BUG'
59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
| ^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:583:2: note: expanded from macro '_compiletime_assert'
583 | __compiletime_assert(condition, msg, prefix, suffix)
| ^
include/linux/compiler_types.h:576:4: note: expanded from macro '__compiletime_assert'
576 | prefix ## suffix(); \
| ^
<scratch space>:39:1: note: expanded from here
39 | __compiletime_assert_610
| ^
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_wrapper.c:615:2: error: call to '__compiletime_assert_612' declared with 'error' attribute: BUILD_BUG failed
615 | DC_FP_START();
| ^
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/dc_fpu.h:38:23: note: expanded from macro 'DC_FP_START'
38 | #define DC_FP_START() BUILD_BUG()
| ^
include/linux/build_bug.h:59:21: note: expanded from macro 'BUILD_BUG'
59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
| ^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:583:2: note: expanded from macro '_compiletime_assert'
583 | __compiletime_assert(condition, msg, prefix, suffix)
| ^
include/linux/compiler_types.h:576:4: note: expanded from macro '__compiletime_assert'
576 | prefix ## suffix(); \
| ^
<scratch space>:45:1: note: expanded from here
45 | __compiletime_assert_612
| ^
2 errors generated.
vim +563 drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_wrapper.c
7966f319c66d94 Qingqing Zhuo 2023-07-28 547
269c1d1443d668 Yan Li 2025-05-14 548 bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2,
269c1d1443d668 Yan Li 2025-05-14 549 enum dc_validate_mode validate_mode)
7966f319c66d94 Qingqing Zhuo 2023-07-28 550 {
7966f319c66d94 Qingqing Zhuo 2023-07-28 551 bool out = false;
7966f319c66d94 Qingqing Zhuo 2023-07-28 552
cc263c3a0c9f38 Joshua Aberback 2024-03-07 553 if (!dml2)
7966f319c66d94 Qingqing Zhuo 2023-07-28 554 return false;
cc263c3a0c9f38 Joshua Aberback 2024-03-07 555 dml2_apply_debug_options(in_dc, dml2);
7966f319c66d94 Qingqing Zhuo 2023-07-28 556
00c391102abc13 Aurabindo Pillai 2024-03-20 557 /* DML2.1 validation path */
00c391102abc13 Aurabindo Pillai 2024-03-20 558 if (dml2->architecture == dml2_architecture_21) {
269c1d1443d668 Yan Li 2025-05-14 559 out = dml21_validate(in_dc, context, dml2, validate_mode);
00c391102abc13 Aurabindo Pillai 2024-03-20 560 return out;
00c391102abc13 Aurabindo Pillai 2024-03-20 561 }
7966f319c66d94 Qingqing Zhuo 2023-07-28 562
366e77cd4923c3 Huacai Chen 2025-03-27 @563 DC_FP_START();
366e77cd4923c3 Huacai Chen 2025-03-27 564
269c1d1443d668 Yan Li 2025-05-14 565 /* Use dml_validate_only for DC_VALIDATE_MODE_ONLY and DC_VALIDATE_MODE_AND_STATE_INDEX path */
269c1d1443d668 Yan Li 2025-05-14 566 if (validate_mode != DC_VALIDATE_MODE_AND_PROGRAMMING)
b02b0fc488ba6e Yan Li 2025-05-21 567 out = dml2_validate_only(context, validate_mode);
7966f319c66d94 Qingqing Zhuo 2023-07-28 568 else
b02b0fc488ba6e Yan Li 2025-05-21 569 out = dml2_validate_and_build_resource(in_dc, context, validate_mode);
366e77cd4923c3 Huacai Chen 2025-03-27 570
366e77cd4923c3 Huacai Chen 2025-03-27 571 DC_FP_END();
366e77cd4923c3 Huacai Chen 2025-03-27 572
7966f319c66d94 Qingqing Zhuo 2023-07-28 573 return out;
7966f319c66d94 Qingqing Zhuo 2023-07-28 574 }
7966f319c66d94 Qingqing Zhuo 2023-07-28 575
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-12 14:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 15:06 [PATCH] drm/amd: Permit DC_FP_START/END only in non-FP compilation units Ard Biesheuvel
2025-10-09 16:19 ` Christian König
2025-10-09 20:40 ` Harry Wentland
2025-10-09 21:27 ` Ard Biesheuvel
2025-10-12 14:22 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).