linux/drivers/gpu/drm/amd/display/dc
Rodrigo Siqueira 9ec051bf44 drm/amd/display: Rework dsc to isolate FPU operations
When we want to use float point operation on Linux
we need to use within special kernel protection
(`kernel_fpu_{begin,end}()`.), otherwise the kernel
can clobber userspace FPU register state. For detecting
these issues we use a tool named objtool (with -Ffa
flags) to highlight the FPU problems, all warnings can
be summed up as follows:

./tools/objtool/objtool check -Ffa
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.o

[..] dc/dsc/rc_calc.o: warning: objtool: get_qp_set()+0x2f8:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/rc_calc.o: warning: objtool: dsc_roundf()+0x5:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/rc_calc.o: warning: objtool: dsc_ceil()+0x5:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/rc_calc.o: warning: objtool: get_ofs_set()+0x3eb:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/rc_calc.o: warning: objtool: calc_rc_params()+0x3c:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/dc_dsc.o: warning: objtool:
get_dsc_bandwidth_range.isra.0()+0x8d:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/dc_dsc.o: warning: objtool: setup_dsc_config()+0x2ef:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/rc_calc_dpi.o: warning: objtool:copy_pps_fields()+0xbb:
FPU instruction outside of kernel_fpu_{begin,end}()
[..] dc/dsc/rc_calc_dpi.o: warning: objtool:
dscc_compute_dsc_parameters()+0x7b:
FPU instruction outside of kernel_fpu_{begin,end}()

This commit fixes the above issues by rework DSC as described:

1. Isolate all FPU operations in a single file;
2. Use FPU flags only in the file that handles FPU operations;
3. Isolate all functions that require float point operation in static
   functions;
4. Add a mid-layer function that does not use any float point operation,
   and that could be safely invoked in other parts of the code.
5. Keep float point operation under DC_FP_{START/END} macro.

CC: Christian König <christian.koenig@amd.com>
CC: Alexander Deucher <Alexander.Deucher@amd.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Tony Cheng <tony.cheng@amd.com>
CC: Harry Wentland <hwentlan@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Reviewed-by: Mikita Lipski <Mikita.Lipski@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-06-11 16:05:32 -04:00
..
basics drm/amd/dc: Kill dc_conn_log_hex_linux() 2020-04-01 14:44:59 -04:00
bios drm/amd/display: Pass command instead of header into DMUB service 2020-04-28 16:19:05 -04:00
calcs drm/amd/display: Avoid pipe split when plane is too small 2020-05-21 12:48:43 -04:00
clk_mgr drm/amd/display: dmcu wait loop calculation is incorrect in RV 2020-04-22 18:11:48 -04:00
core drm/amd/display: Revalidate bandwidth before commiting DC updates 2020-06-03 15:33:06 -04:00
dce drm/amd/display: move location of dmub_srv.h file 2020-05-05 13:12:33 -04:00
dce80 drm/amd/display: change from panel to panel cntl 2020-04-22 18:11:48 -04:00
dce100 drm/amd/display: change from panel to panel cntl 2020-04-22 18:11:48 -04:00
dce110 drm/amd/display: Move panel_cntl specific register from abm to panel_cntl. 2020-05-05 13:10:46 -04:00
dce112 drm/amd/display: Enable fp16 also on DCE-11.0 - DCE-12. (v2) 2020-05-21 12:46:51 -04:00
dce120 drm/amd/display: Enable fp16 also on DCE-11.0 - DCE-12. (v2) 2020-05-21 12:46:51 -04:00
dcn10 drm/amd/display: Fix potential integer wraparound resulting in a hang 2020-05-27 18:42:10 -04:00
dcn20 drm/amd/display: correct rn NUM_VMID 2020-05-21 12:48:43 -04:00
dcn21 drm/amd/display: correct rn NUM_VMID 2020-05-21 12:48:43 -04:00
dml drm/amd/display: Remove dml_common_def file 2020-05-21 12:48:43 -04:00
dsc drm/amd/display: Rework dsc to isolate FPU operations 2020-06-11 16:05:32 -04:00
gpio drm/amdgpu/display: extend DCN guards 2020-02-12 16:04:39 -05:00
hdcp drm/amd/display: query hdcp capability during link detect 2020-04-09 10:43:17 -04:00
inc drm/amd/display: Defer cursor lock until after VUPDATE 2020-05-21 12:48:43 -04:00
irq drm/amd/display: rename core_dc to dc 2019-12-05 16:26:39 -05:00
virtual drm/amd/display: determine USB C DP2 mode only when USB DP Alt is enabled 2020-04-09 10:43:17 -04:00
dc_bios_types.h drm/amd/display: make firmware info only load once during dc_bios create 2019-08-15 10:53:36 -05:00
dc_ddc_types.h drm/amd/display: Proper return of result when aux engine acquire fails 2019-10-25 16:50:09 -04:00
dc_dmub_srv.c drm/amd/display: move location of dmub_srv.h file 2020-05-05 13:12:33 -04:00
dc_dmub_srv.h drm/amd/display: move location of dmub_srv.h file 2020-05-05 13:12:33 -04:00
dc_dp_types.h drm/amd/display: Unify psr feature flags 2020-04-22 18:11:47 -04:00
dc_dsc.h drm/amd/display: Add debug option to override DSC target bpp increment 2019-12-18 16:09:11 -05:00
dc_helper.c drm/amd/display: Pass command instead of header into DMUB service 2020-04-28 16:19:05 -04:00
dc_hw_types.h drm/amd/display: Make cursor source translation adjustment optional 2020-04-09 10:43:17 -04:00
dc_link.h drm/amd/display: move location of dmub_srv.h file 2020-05-05 13:12:33 -04:00
dc_stream.h drm/amd/display: Unify psr feature flags 2020-04-22 18:11:47 -04:00
dc_types.h drm/amd/display: add addition dc type to translate to dmub fw type 2020-05-05 13:11:49 -04:00
dc.h drm/amd/display: 3.2.84 2020-05-05 13:12:47 -04:00
dm_cp_psp.h drm/amd/display: determine is mst hdcp based on stream instead of sink signal 2020-03-09 13:49:06 -04:00
dm_event_log.h
dm_helpers.h drm/amd/display: Drop CONFIG_DRM_AMD_DC_DCN2_0 and DSC_SUPPORTED 2019-11-13 15:29:44 -05:00
dm_pp_smu.h drm/amd/display: Drop CONFIG_DRM_AMD_DC_DCN2_1 flag 2019-11-13 15:29:44 -05:00
dm_services_types.h drm/amd/display: Add definition for number of backlight data points 2019-12-18 16:09:08 -05:00
dm_services.h drm/amd/display: Drop CONFIG_DRM_AMD_DC_DMUB guards 2019-11-13 15:29:42 -05:00
irq_types.h
Makefile drm/amd/display: rename DCN1_0 kconfig to DCN 2019-11-13 15:29:44 -05:00
os_types.h drm/amdgpu/dc: Use WARN_ON_ONCE for ASSERT 2020-04-30 16:48:47 -04:00