Pull drm updates from Dave Airlie:
"Highlights:
- New driver for logicvc - which is a display IP core.
- EDID parser rework to add new extensions
- fbcon scrolling improvements
- i915 has some more DG2 work but not enabled by default, but should
have enough features for userspace to work now.
Otherwise it's lots of work all over the place. Detailed summary:
New driver:
- logicvc
vfio:
- use aperture API
core:
- of: Add data-lane helpers and convert drivers
- connector: Remove deprecated ida_simple_get()
media:
- Add various RGB666 and RGB888 format constants
panel:
- Add HannStar HSD101PWW
- Add ETML0700Y5DHA
dma-buf:
- add sync-file API
- set dma mask for udmabuf devices
fbcon:
- Improve scrolling performance
- Sanitize input
fbdev:
- device unregistering fixes
- vesa: Support COMPILE_TEST
- Disable firmware-device registration when first native driver loads
aperture:
- fix segfault during hot-unplug
- export for use with other subsystems
client:
- use driver validated modes
dp:
- aux: make probing more reliable
- mst: Read extended DPCD capabilities during system resume
- Support waiting for HDP signal
- Port-validation fixes
edid:
- CEA data-block iterators
- struct drm_edid introduction
- implement HF-EEODB extension
gem:
- don't use fb format non-existing planes
probe-helper:
- use 640x480 as displayport fallback
scheduler:
- don't kill jobs in interrupt context
bridge:
- Add support for i.MX8qxp and i.MX8qm
- lots of fixes/cleanups
- Add TI-DLPC3433
- fy07024di26a30d: Optional GPIO reset
- ldb: Add reg and reg-name properties to bindings, Kconfig fixes
- lt9611: Fix display sensing;
- tc358767: DSI/DPI refactoring and DSI-to-eDP support, DSI lane handling
- tc358775: Fix clock settings
- ti-sn65dsi83: Allow GPIO to sleep
- adv7511: I2C fixes
- anx7625: Fix error handling; DPI fixes; Implement HDP timeout via callback
- fsl-ldb: Drop DE flip
- ti-sn65dsi86: Convert to atomic modesetting
amdgpu:
- use atomic fence helpers in DM
- fix VRAM address calculations
- export CRTC bpc via debugfs
- Initial devcoredump support
- Enable high priority gfx queue on asics which support it
- Adjust GART size on newer APUs for S/G display
- Soft reset for GFX 11 / SDMA 6
- Add gfxoff status query for vangogh
- Fix timestamps for cursor only commits
- Adjust GART size on newer APUs for S/G display
- fix buddy memory corruption
amdkfd:
- MMU notifier fixes
- P2P DMA support using dma-buf
- Add available memory IOCTL
- HMM profiler support
- Simplify GPUVM validation
- Unified memory for CWSR save/restore area
i915:
- General driver clean-up
- DG2 enabling (still under force probe)
- DG2 small BAR memory support
- HuC loading support
- DG2 workarounds
- DG2/ATS-M device IDs added
- Ponte Vecchio prep work and new blitter engines
- add Meteorlake support
- Fix sparse warnings
- DMC MMIO range checks
- Audio related fixes
- Runtime PM fixes
- PSR fixes
- Media freq factor and per-gt enhancements
- DSI fixes for ICL+
- Disable DMC flip queue handlers
- ADL_P voltage swing updates
- Use more the VBT for panel information
- Fix on Type-C ports with TBT mode
- Improve fastset and allow seamless M/N changes
- Accept more fixed modes with VRR/DMRRS panels
- Disable connector polling for a headless SKU
- ADL-S display PLL w/a
- Enable THP on Icelake and beyond
- Fix i915_gem_object_ggtt_pin_ww regression on old platforms
- Expose per tile media freq factor in sysfs
- Fix dma_resv fence handling in multi-batch execbuf
- Improve on suspend / resume time with VT-d enabled
- export CRTC bpc settings via debugfs
msm:
- gpu: a619 support
- gpu: Fix for unclocked GMU register access
- gpu: Devcore dump enhancements
- client utilization via fdinfo support
- fix fence rollover issue
- gem: Lockdep false-positive warning fix
- gem: Switch to pfn mappings
- WB support on sc7180
- dp: dropped custom bulk clock implementation
- fix link retraining on resolution change
- hdmi: dropped obsolete GPIO support
tegra:
- context isolation for host1x engines
- tegra234 soc support
mediatek:
- add vdosys0/1 for mt8195
- add MT8195 dp_intf driver
exynos:
- Fix resume function issue of exynos decon driver by calling
clk_disable_unprepare() properly if clk_prepare_enable() failed.
nouveau:
- set of misc fixes/cleanups
- display cleanups
gma500:
- Cleanup connector I2C handling
hyperv:
- Unify VRAM allocation of Gen1 and Gen2
meson:
- Support YUV422 output; Refcount fixes
mgag200:
- Support damage clipping
- Support gamma handling
- Protect concurrent HW access
- Fixes to connector
- Store model-specific limits in device-info structure
- fix PCI register init
panfrost:
- Valhall support
r128:
- Fix bit-shift overflow
rockchip:
- Locking fixes in error path
ssd130x:
- Fix built-in linkage
udl:
- Always advertize VGA connector
ast:
- Support multiple outputs
- fix black screen on resume
sun4i:
- HDMI PHY cleanups
vc4:
- Add support for BCM2711
vkms:
- Allocate output buffer with vmalloc()
mcde:
- Fix ref-count leak
mxsfb/lcdif:
- Support i.MX8MP LCD controller
stm/ltdc:
- Support dynamic Z order
- Support mirroring
ingenic:
- Fix display at maximum resolution"
* tag 'drm-next-2022-08-03' of git://anongit.freedesktop.org/drm/drm: (1480 commits)
drm/amd/display: Fix a compilation failure on PowerPC caused by FPU code
drm/amdgpu: enable support for psp 13.0.4 block
drm/amdgpu: add files for PSP 13.0.4
drm/amdgpu: add header files for MP 13.0.4
drm/amdgpu: correct RLC_RLCS_BOOTLOAD_STATUS offset and index
drm/amdgpu: send msg to IMU for the front-door loading
drm/amdkfd: use time_is_before_jiffies(a + b) to replace "jiffies - a > b"
drm/amdgpu: fix hive reference leak when reflecting psp topology info
drm/amd/pm: enable GFX ULV feature support for SMU13.0.0
drm/amd/pm: update driver if header for SMU 13.0.0
drm/amdgpu: move mes self test after drm sched re-started
drm/amdgpu: drop non-necessary call trace dump
drm/amdgpu: enable VCN cg and JPEG cg/pg
drm/amdgpu: vcn_4_0_2 video codec query
drm/amdgpu: add VCN_4_0_2 firmware support
drm/amdgpu: add VCN function in NBIO v7.7
drm/amdgpu: fix a vcn4 boot poll bug in emulation mode
drm/amd/amdgpu: add memory training support for PSP_V13
drm/amdkfd: remove an unnecessary amdgpu_bo_ref
drm/amd/pm: Add get_gfx_off_status interface for yellow carp
...
278 lines
8.5 KiB
C
278 lines
8.5 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2014-2019 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _INTEL_UC_FW_H_
|
|
#define _INTEL_UC_FW_H_
|
|
|
|
#include <linux/types.h>
|
|
#include "intel_uc_fw_abi.h"
|
|
#include "intel_device_info.h"
|
|
#include "i915_gem.h"
|
|
#include "i915_vma.h"
|
|
|
|
struct drm_printer;
|
|
struct drm_i915_private;
|
|
struct intel_gt;
|
|
|
|
/* Home of GuC, HuC and DMC firmwares */
|
|
#define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915"
|
|
|
|
/*
|
|
* +------------+---------------------------------------------------+
|
|
* | PHASE | FIRMWARE STATUS TRANSITIONS |
|
|
* +============+===================================================+
|
|
* | | UNINITIALIZED |
|
|
* +------------+- / | \ -+
|
|
* | | DISABLED <--/ | \--> NOT_SUPPORTED |
|
|
* | init_early | V |
|
|
* | | SELECTED |
|
|
* +------------+- / | \ -+
|
|
* | | MISSING <--/ | \--> ERROR |
|
|
* | fetch | V |
|
|
* | | AVAILABLE |
|
|
* +------------+- | \ -+
|
|
* | | | \--> INIT FAIL |
|
|
* | init | V |
|
|
* | | /------> LOADABLE <----<-----------\ |
|
|
* +------------+- \ / \ \ \ -+
|
|
* | | LOAD FAIL <--< \--> TRANSFERRED \ |
|
|
* | upload | \ / \ / |
|
|
* | | \---------/ \--> RUNNING |
|
|
* +------------+---------------------------------------------------+
|
|
*/
|
|
|
|
enum intel_uc_fw_status {
|
|
INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW */
|
|
INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */
|
|
INTEL_UC_FIRMWARE_DISABLED, /* disabled */
|
|
INTEL_UC_FIRMWARE_SELECTED, /* selected the blob we want to load */
|
|
INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */
|
|
INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */
|
|
INTEL_UC_FIRMWARE_AVAILABLE, /* blob found and copied in mem */
|
|
INTEL_UC_FIRMWARE_INIT_FAIL, /* failed to prepare fw objects for load */
|
|
INTEL_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */
|
|
INTEL_UC_FIRMWARE_LOAD_FAIL, /* failed to xfer or init/auth the fw */
|
|
INTEL_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */
|
|
INTEL_UC_FIRMWARE_RUNNING /* init/auth done */
|
|
};
|
|
|
|
enum intel_uc_fw_type {
|
|
INTEL_UC_FW_TYPE_GUC = 0,
|
|
INTEL_UC_FW_TYPE_HUC
|
|
};
|
|
#define INTEL_UC_FW_NUM_TYPES 2
|
|
|
|
/*
|
|
* This structure encapsulates all the data needed during the process
|
|
* of fetching, caching, and loading the firmware image into the uC.
|
|
*/
|
|
struct intel_uc_fw {
|
|
enum intel_uc_fw_type type;
|
|
union {
|
|
const enum intel_uc_fw_status status;
|
|
enum intel_uc_fw_status __status; /* no accidental overwrites */
|
|
};
|
|
const char *wanted_path;
|
|
const char *path;
|
|
bool user_overridden;
|
|
size_t size;
|
|
struct drm_i915_gem_object *obj;
|
|
/**
|
|
* @dummy: A vma used in binding the uc fw to ggtt. We can't define this
|
|
* vma on the stack as it can lead to a stack overflow, so we define it
|
|
* here. Safe to have 1 copy per uc fw because the binding is single
|
|
* threaded as it done during driver load (inherently single threaded)
|
|
* or during a GT reset (mutex guarantees single threaded).
|
|
*/
|
|
struct i915_vma_resource dummy;
|
|
struct i915_vma *rsa_data;
|
|
|
|
/*
|
|
* The firmware build process will generate a version header file with major and
|
|
* minor version defined. The versions are built into CSS header of firmware.
|
|
* i915 kernel driver set the minimal firmware version required per platform.
|
|
*/
|
|
u16 major_ver_wanted;
|
|
u16 minor_ver_wanted;
|
|
u16 major_ver_found;
|
|
u16 minor_ver_found;
|
|
|
|
struct {
|
|
const char *path;
|
|
u16 major_ver;
|
|
u16 minor_ver;
|
|
} fallback;
|
|
|
|
u32 rsa_size;
|
|
u32 ucode_size;
|
|
|
|
u32 private_data_size;
|
|
|
|
bool loaded_via_gsc;
|
|
};
|
|
|
|
#ifdef CONFIG_DRM_I915_DEBUG_GUC
|
|
void intel_uc_fw_change_status(struct intel_uc_fw *uc_fw,
|
|
enum intel_uc_fw_status status);
|
|
#else
|
|
static inline void intel_uc_fw_change_status(struct intel_uc_fw *uc_fw,
|
|
enum intel_uc_fw_status status)
|
|
{
|
|
uc_fw->__status = status;
|
|
}
|
|
#endif
|
|
|
|
static inline
|
|
const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
|
|
{
|
|
switch (status) {
|
|
case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
|
|
return "N/A";
|
|
case INTEL_UC_FIRMWARE_UNINITIALIZED:
|
|
return "UNINITIALIZED";
|
|
case INTEL_UC_FIRMWARE_DISABLED:
|
|
return "DISABLED";
|
|
case INTEL_UC_FIRMWARE_SELECTED:
|
|
return "SELECTED";
|
|
case INTEL_UC_FIRMWARE_MISSING:
|
|
return "MISSING";
|
|
case INTEL_UC_FIRMWARE_ERROR:
|
|
return "ERROR";
|
|
case INTEL_UC_FIRMWARE_AVAILABLE:
|
|
return "AVAILABLE";
|
|
case INTEL_UC_FIRMWARE_INIT_FAIL:
|
|
return "INIT FAIL";
|
|
case INTEL_UC_FIRMWARE_LOADABLE:
|
|
return "LOADABLE";
|
|
case INTEL_UC_FIRMWARE_LOAD_FAIL:
|
|
return "LOAD FAIL";
|
|
case INTEL_UC_FIRMWARE_TRANSFERRED:
|
|
return "TRANSFERRED";
|
|
case INTEL_UC_FIRMWARE_RUNNING:
|
|
return "RUNNING";
|
|
}
|
|
return "<invalid>";
|
|
}
|
|
|
|
static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
|
|
{
|
|
switch (status) {
|
|
case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
|
|
return -ENODEV;
|
|
case INTEL_UC_FIRMWARE_UNINITIALIZED:
|
|
return -EACCES;
|
|
case INTEL_UC_FIRMWARE_DISABLED:
|
|
return -EPERM;
|
|
case INTEL_UC_FIRMWARE_MISSING:
|
|
return -ENOENT;
|
|
case INTEL_UC_FIRMWARE_ERROR:
|
|
return -ENOEXEC;
|
|
case INTEL_UC_FIRMWARE_INIT_FAIL:
|
|
case INTEL_UC_FIRMWARE_LOAD_FAIL:
|
|
return -EIO;
|
|
case INTEL_UC_FIRMWARE_SELECTED:
|
|
return -ESTALE;
|
|
case INTEL_UC_FIRMWARE_AVAILABLE:
|
|
case INTEL_UC_FIRMWARE_LOADABLE:
|
|
case INTEL_UC_FIRMWARE_TRANSFERRED:
|
|
case INTEL_UC_FIRMWARE_RUNNING:
|
|
return 0;
|
|
}
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
|
|
{
|
|
switch (type) {
|
|
case INTEL_UC_FW_TYPE_GUC:
|
|
return "GuC";
|
|
case INTEL_UC_FW_TYPE_HUC:
|
|
return "HuC";
|
|
}
|
|
return "uC";
|
|
}
|
|
|
|
static inline enum intel_uc_fw_status
|
|
__intel_uc_fw_status(struct intel_uc_fw *uc_fw)
|
|
{
|
|
/* shouldn't call this before checking hw/blob availability */
|
|
GEM_BUG_ON(uc_fw->status == INTEL_UC_FIRMWARE_UNINITIALIZED);
|
|
return uc_fw->status;
|
|
}
|
|
|
|
static inline bool intel_uc_fw_is_supported(struct intel_uc_fw *uc_fw)
|
|
{
|
|
return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
|
|
}
|
|
|
|
static inline bool intel_uc_fw_is_enabled(struct intel_uc_fw *uc_fw)
|
|
{
|
|
return __intel_uc_fw_status(uc_fw) > INTEL_UC_FIRMWARE_DISABLED;
|
|
}
|
|
|
|
static inline bool intel_uc_fw_is_available(struct intel_uc_fw *uc_fw)
|
|
{
|
|
return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_AVAILABLE;
|
|
}
|
|
|
|
static inline bool intel_uc_fw_is_loadable(struct intel_uc_fw *uc_fw)
|
|
{
|
|
return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_LOADABLE;
|
|
}
|
|
|
|
static inline bool intel_uc_fw_is_loaded(struct intel_uc_fw *uc_fw)
|
|
{
|
|
return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_TRANSFERRED;
|
|
}
|
|
|
|
static inline bool intel_uc_fw_is_running(struct intel_uc_fw *uc_fw)
|
|
{
|
|
return __intel_uc_fw_status(uc_fw) == INTEL_UC_FIRMWARE_RUNNING;
|
|
}
|
|
|
|
static inline bool intel_uc_fw_is_overridden(const struct intel_uc_fw *uc_fw)
|
|
{
|
|
return uc_fw->user_overridden;
|
|
}
|
|
|
|
static inline void intel_uc_fw_sanitize(struct intel_uc_fw *uc_fw)
|
|
{
|
|
if (intel_uc_fw_is_loaded(uc_fw))
|
|
intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_LOADABLE);
|
|
}
|
|
|
|
static inline u32 __intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
|
|
{
|
|
return sizeof(struct uc_css_header) + uc_fw->ucode_size;
|
|
}
|
|
|
|
/**
|
|
* intel_uc_fw_get_upload_size() - Get size of firmware needed to be uploaded.
|
|
* @uc_fw: uC firmware.
|
|
*
|
|
* Get the size of the firmware and header that will be uploaded to WOPCM.
|
|
*
|
|
* Return: Upload firmware size, or zero on firmware fetch failure.
|
|
*/
|
|
static inline u32 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
|
|
{
|
|
if (!intel_uc_fw_is_available(uc_fw))
|
|
return 0;
|
|
|
|
return __intel_uc_fw_get_upload_size(uc_fw);
|
|
}
|
|
|
|
void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
|
|
enum intel_uc_fw_type type);
|
|
int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw);
|
|
void intel_uc_fw_cleanup_fetch(struct intel_uc_fw *uc_fw);
|
|
int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, u32 offset, u32 dma_flags);
|
|
int intel_uc_fw_init(struct intel_uc_fw *uc_fw);
|
|
void intel_uc_fw_fini(struct intel_uc_fw *uc_fw);
|
|
size_t intel_uc_fw_copy_rsa(struct intel_uc_fw *uc_fw, void *dst, u32 max_len);
|
|
void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p);
|
|
|
|
#endif
|