Skip to content

Commit 6a0dea0

Browse files
committed
drm/msm: support firmware-name for zap fw (v2)
Since zap firmware can be device specific, allow for a firmware-name property in the zap node to specify which firmware to load, similarly to the scheme used for dsp/wifi/etc. v2: only need a single error msg when we can't load from firmware-name specified path, and fix comment [Bjorn A.] Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jordan Crouse <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]>
1 parent d4bbcad commit 6a0dea0

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
2626
{
2727
struct device *dev = &gpu->pdev->dev;
2828
const struct firmware *fw;
29+
const char *signed_fwname = NULL;
2930
struct device_node *np, *mem_np;
3031
struct resource r;
3132
phys_addr_t mem_phys;
@@ -58,8 +59,31 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
5859

5960
mem_phys = r.start;
6061

61-
/* Request the MDT file for the firmware */
62-
fw = adreno_request_fw(to_adreno_gpu(gpu), fwname);
62+
/*
63+
* Check for a firmware-name property. This is the new scheme
64+
* to handle firmware that may be signed with device specific
65+
* keys, allowing us to have a different zap fw path for different
66+
* devices.
67+
*
68+
* If the firmware-name property is found, we bypass the
69+
* adreno_request_fw() mechanism, because we don't need to handle
70+
* the /lib/firmware/qcom/* vs /lib/firmware/* case.
71+
*
72+
* If the firmware-name property is not found, for backwards
73+
* compatibility we fall back to the fwname from the gpulist
74+
* table.
75+
*/
76+
of_property_read_string_index(np, "firmware-name", 0, &signed_fwname);
77+
if (signed_fwname) {
78+
fwname = signed_fwname;
79+
ret = request_firmware_direct(&fw, fwname, gpu->dev->dev);
80+
if (ret)
81+
fw = ERR_PTR(ret);
82+
} else {
83+
/* Request the MDT file from the default location: */
84+
fw = adreno_request_fw(to_adreno_gpu(gpu), fwname);
85+
}
86+
6387
if (IS_ERR(fw)) {
6488
DRM_DEV_ERROR(dev, "Unable to load %s\n", fwname);
6589
return PTR_ERR(fw);
@@ -95,7 +119,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
95119
* not. But since we've already gotten through adreno_request_fw()
96120
* we know which of the two cases it is:
97121
*/
98-
if (to_adreno_gpu(gpu)->fwloc == FW_LOCATION_LEGACY) {
122+
if (signed_fwname || (to_adreno_gpu(gpu)->fwloc == FW_LOCATION_LEGACY)) {
99123
ret = qcom_mdt_load(dev, fw, fwname, pasid,
100124
mem_region, mem_phys, mem_size, NULL);
101125
} else {

0 commit comments

Comments
 (0)