OpenCloudOS-Kernel/drivers/gpu/drm
Daniel Vetter eb805623d8 drm/i915/skl: Add support to load SKL CSR firmware.
Display Context Save and Restore support is needed for
various SKL Display C states like DC5, DC6.

This implementation is added based on first version of DMC CSR program
that we received from h/w team.

Here we are using request_firmware based design.
Finally this firmware should end up in linux-firmware tree.

For SKL platform its mandatory to ensure that we load this
csr program before enabling DC states like DC5/DC6.

As CSR program gets reset on various conditions, we should ensure
to load it during boot and in future change to be added to load
this system resume sequence too.

v1: Initial relese as RFC patch

v2: Design change as per Daniel, Damien and Shobit's review comments
request firmware method followed.

v3: Some optimization and functional changes.
Pulled register defines into drivers/gpu/drm/i915/i915_reg.h
Used kmemdup to allocate and duplicate firmware content.
Ensured to free allocated buffer.

v4: Modified as per review comments from Satheesh and Daniel
Removed temporary buffer.
Optimized number of writes by replacing I915_WRITE with I915_WRITE64.

v5:
Modified as per review comemnts from Damien.
- Changed name for functions and firmware.
- Introduced HAS_CSR.
- Reverted back previous change and used csr_buf with u8 size.
- Using cpu_to_be64 for endianness change.

Modified as per review comments from Imre.
- Modified registers and macro names to be a bit closer to bspec terminology
and the existing register naming in the driver.
- Early return for non SKL platforms in intel_load_csr_program function.
- Added locking around CSR program load function as it may be called
concurrently during system/runtime resume.
- Releasing the fw before loading the program for consistency
- Handled error path during f/w load.

v6: Modified as per review comments from Imre.
- Corrected out_freecsr sequence.

v7: Modified as per review comments from Imre.
Fail loading fw if fw->size%8!=0.

v8: Rebase to latest.

v9: Rebase on top of -nightly (Damien)

v10: Enabled support for dmc firmware ver 1.0.
According to ver 1.0 in a single binary package all the firmware's that are
required for different stepping's of the product will be stored. The package
contains the css header, followed by the package header and the actual dmc
firmwares. Package header contains the firmware/stepping mapping table and
the corresponding firmware offsets to the individual binaries, within the
package. Each individual program binary contains the header and the payload
sections whose size is specified in the header section. This changes are done
to extract the specific firmaware from the package. (Animesh)

v11: Modified as per review comemnts from Imre.
- Added code comment from bpec for header structure elements.
- Added __packed to avoid structure padding.
- Added helper functions for stepping and substepping info.
- Added code comment for CSR_MAX_FW_SIZE.
- Disabled BXT firmware loading, will be enabled with dmc 1.0 support.
- Changed skl_stepping_info based on bspec, earlier used from config DB.
- Removed duplicate call of cpu_to_be* from intel_csr_load_program function.
- Used cpu_to_be32 instead of cpu_to_be64 as firmware binary in dword aligned.
- Added sanity check for header length.
- Added sanity check for mmio address got from firmware binary.
- kmalloc done separately for dmc header and dmc firmware. (Animesh)

v12: Modified as per review comemnts from Imre.
- Corrected the typo error in skl stepping info structure.
- Added out-of-bound access for skl_stepping_info.
- Sanity check for mmio address modified.
- Sanity check added for stepping and substeppig.
- Modified the intel_dmc_info structure, cache only the required header info. (Animesh)

v13: clarify firmware load error message.
The reason for a firmware loading failure can be obscure if the driver
is built-in. Provide an explanation to the user about the likely reason for
the failure and how to resolve it. (Imre)

v14: Suggested by Jani.
- fix s/I915/CONFIG_DRM_I915/ typo
- add fw_path to the firmware object instead of using a static ptr (Jani)

v15:
1) Changed the firmware name as dmc_gen9.bin, everytime for a new firmware version a symbolic link
with same name will help not to build kernel again.
2) Changes done as per review comments from Imre.
- Error check removed for intel_csr_ucode_init.
- Moved csr-specific data structure to intel_csr.h and optimization done on structure definition.
- fw->data used directly for parsing the header info & memory allocation
only done separately for payload. (Animesh)

v16:
- No need for out_regs label in i915_driver_load(), so removed it.
- Changed the firmware name as skl_dmc_ver1.bin, followed naming convention <platform>_dmc_<api-version>.bin (Animesh)

Issue: VIZ-2569
Signed-off-by: A.Sunil Kamath <sunil.kamath@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-05-08 13:03:10 +02:00
..
amd Merge tag 'drm-intel-next-2015-03-27-merge' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-04-01 08:21:46 +10:00
armada dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
ast drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
atmel-hlcdc drm: atmel-hlcdc: use appropriate enabled flag in suspend/resume 2015-03-16 16:10:42 +01:00
bochs drm/bochs: disable video before changing video mode 2015-04-01 08:28:15 +10:00
bridge Merge branch 'drm-dwhdmi-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into drm-next 2015-04-16 08:33:30 +10:00
cirrus Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2015-02-16 15:48:00 -08:00
exynos dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
gma500 drm/gma500: constify all struct drm_*_helper funcs pointers 2015-04-07 17:06:41 +02:00
i2c drm: adv7511: Refactor power management 2015-03-19 12:28:55 +02:00
i810
i915 drm/i915/skl: Add support to load SKL CSR firmware. 2015-05-08 13:03:10 +02:00
imx Merge branch 'drm-dwhdmi-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into drm-next 2015-04-16 08:33:30 +10:00
mga
mgag200 drm/mgag200: constify all struct drm_*_helper funcs pointers 2015-04-07 17:06:41 +02:00
msm Merge Linus master into drm-next 2015-04-20 13:05:20 +10:00
nouveau Merge tag 'topic/drm-misc-2015-04-15' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-04-16 08:34:24 +10:00
omapdrm dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
panel drm/panel: Add support for Ampire AM-800480R3TMQW-A1H 800x480 7" panel 2015-04-02 19:04:15 +02:00
qxl drm/qxl: rewrite framebuffer support 2015-05-07 13:09:25 +10:00
r128
radeon drm/radeon: fix userptr return value checking (v2) 2015-04-27 11:38:28 -04:00
rcar-du drm: Use of-graph helpers to loop over endpoints 2015-04-13 17:28:16 +10:00
rockchip drm/rockchip: fix error check when getting irq 2015-04-20 09:02:31 +08:00
savage
shmobile drm: Kconfig: Let all DRM_GEM_CMA_HELPER related macros depend on HAVE_DMA_ATTRS 2015-02-03 11:12:37 +10:00
sis
sti drm: sti: convert driver to atomic modeset 2015-03-19 13:35:16 +01:00
tdfx
tegra dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
tilcdc drm: Kconfig: Let all DRM_GEM_CMA_HELPER related macros depend on HAVE_DMA_ATTRS 2015-02-03 11:12:37 +10:00
ttm dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
udl dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
vgem drm/vgem: implement virtual GEM 2015-04-02 09:21:48 +10:00
via
vmwgfx Merge tag 'topic/drm-misc-2015-03-31' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-04-01 08:23:25 +10:00
Kconfig drm/vgem: implement virtual GEM 2015-04-02 09:21:48 +10:00
Makefile drm/vgem: implement virtual GEM 2015-04-02 09:21:48 +10:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic.c drm/atomic: Add for_each_{connector,crtc,plane}_in_state helper macros 2015-04-11 18:50:22 +02:00
drm_atomic_helper.c Merge tag 'topic/drm-misc-2015-05-06' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-05-07 13:02:39 +10:00
drm_auth.c drm: simplify authentication management 2015-05-05 09:45:57 +02:00
drm_bridge.c drm: Silence sparse warnings 2015-03-13 17:37:35 +01:00
drm_bufs.c
drm_cache.c drm/cache: Use wbinvd helpers 2014-12-16 08:56:55 +01:00
drm_context.c
drm_crtc.c Merge tag 'drm-intel-next-2015-04-23-fixed' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-05-08 20:51:06 +10:00
drm_crtc_helper.c drm/drm: constify all struct drm_*_helper funcs pointers 2015-04-07 18:11:25 +02:00
drm_crtc_internal.h drm/atomic: Hide drm.ko internal interfaces 2015-01-05 13:55:30 +01:00
drm_debugfs.c
drm_dma.c
drm_dp_helper.c drm: Fix for DP CTS test 4.2.2.5 - I2C DEFER handling 2015-04-20 09:29:41 -07:00
drm_dp_mst_topology.c Merge tag 'drm-intel-next-2015-03-13-merge' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-03-24 11:12:20 +10:00
drm_drv.c drm: simplify master cleanup 2015-05-05 09:46:38 +02:00
drm_edid.c
drm_edid_load.c drm/edid: set ELD for firmware and debugfs override EDIDs 2015-03-27 13:27:04 +02:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm/cma: use correct fb width/height 2015-03-11 22:08:07 +01:00
drm_fb_helper.c drm/drm: constify all struct drm_*_helper funcs pointers 2015-04-07 18:11:25 +02:00
drm_flip_work.c
drm_fops.c drm: simplify authentication management 2015-05-05 09:45:57 +02:00
drm_gem.c
drm_gem_cma_helper.c
drm_global.c
drm_hashtab.c
drm_info.c drm: Silence sparse warnings 2015-03-13 17:37:35 +01:00
drm_internal.h drm: simplify authentication management 2015-05-05 09:45:57 +02:00
drm_ioc32.c drm: Silence sparse warnings 2015-03-13 17:37:35 +01:00
drm_ioctl.c drm: line wrap DRM_IOCTL_DEF* macros 2015-03-31 09:18:40 +02:00
drm_irq.c drm: Zero out invalid vblank timestamp in drm_update_vblank_count. (v2) 2015-05-04 11:13:23 +02:00
drm_legacy.h
drm_lock.c
drm_memory.c
drm_mipi_dsi.c drm/mipi-dsi: Avoid potential NULL pointer dereference 2015-01-28 08:45:37 +01:00
drm_mm.c [PATCH] drm/mm: Fix support 4 GiB and larger ranges 2015-03-16 06:28:50 +10:00
drm_modes.c drm: mode: Allow NULL modes for equality check 2015-03-23 16:22:30 +01:00
drm_modeset_lock.c drm: fix a memleak on mutex failure path 2015-05-05 09:26:43 +02:00
drm_of.c drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs 2015-04-08 11:14:25 +02:00
drm_panel.c
drm_pci.c drm: Silence sparse warnings 2015-03-13 17:37:35 +01:00
drm_plane_helper.c drm/drm: constify all struct drm_*_helper funcs pointers 2015-04-07 18:11:25 +02:00
drm_platform.c
drm_prime.c dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
drm_probe_helper.c Merge tag 'topic/drm-misc-2015-05-06' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-05-07 13:02:39 +10:00
drm_rect.c
drm_scatter.c
drm_sysfs.c drm: Lighten sysfs connector 'status' 2015-03-10 09:59:36 +01:00
drm_trace.h tracing/drm: Remove unused TRACE_SYSTEM_STRING define 2015-04-07 12:29:23 -04:00
drm_trace_points.c
drm_vm.c drm: Silence sparse warnings 2015-03-13 17:37:35 +01:00
drm_vma_manager.c mm: remove rest usage of VM_NONLINEAR and pte_file() 2015-02-10 14:30:31 -08:00