Skip to content

Commit 0838fc3

Browse files
author
Rob Clark
committed
drm/msm/adreno: Check for recognized GPU before bind
If we have a newer dtb than kernel, we could end up in a situation where the GPU device is present in the dtb, but not in the drivers device table. We don't want this to prevent the display from probing. So check that we recognize the GPU before adding the GPU component. v2: use %pOF Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/657701/
1 parent 1efb737 commit 0838fc3

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

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

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,26 @@ static int find_chipid(struct device_node *node, uint32_t *chipid)
182182
return 0;
183183
}
184184

185+
bool adreno_has_gpu(struct device_node *node)
186+
{
187+
const struct adreno_info *info;
188+
uint32_t chip_id;
189+
int ret;
190+
191+
ret = find_chipid(node, &chip_id);
192+
if (ret)
193+
return false;
194+
195+
info = adreno_info(chip_id);
196+
if (!info) {
197+
pr_warn("%pOF: Unknown GPU revision: %"ADRENO_CHIPID_FMT"\n",
198+
node, ADRENO_CHIPID_ARGS(chip_id));
199+
return false;
200+
}
201+
202+
return true;
203+
}
204+
185205
static int adreno_bind(struct device *dev, struct device *master, void *data)
186206
{
187207
static struct adreno_platform_config config = {};
@@ -192,18 +212,17 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
192212
int ret;
193213

194214
ret = find_chipid(dev->of_node, &config.chip_id);
195-
if (ret)
215+
/* We shouldn't have gotten this far if we can't parse the chip_id */
216+
if (WARN_ON(ret))
196217
return ret;
197218

198219
dev->platform_data = &config;
199220
priv->gpu_pdev = to_platform_device(dev);
200221

201222
info = adreno_info(config.chip_id);
202-
if (!info) {
203-
dev_warn(drm->dev, "Unknown GPU revision: %"ADRENO_CHIPID_FMT"\n",
204-
ADRENO_CHIPID_ARGS(config.chip_id));
223+
/* We shouldn't have gotten this far if we don't recognize the GPU: */
224+
if (!WARN_ON(info))
205225
return -ENXIO;
206-
}
207226

208227
config.info = info;
209228

drivers/gpu/drm/msm/msm_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ static int add_gpu_components(struct device *dev,
10341034
if (!np)
10351035
return 0;
10361036

1037-
if (of_device_is_available(np))
1037+
if (of_device_is_available(np) && adreno_has_gpu(np))
10381038
drm_of_component_match_add(dev, matchptr, component_compare_of, np);
10391039

10401040
of_node_put(np);

drivers/gpu/drm/msm/msm_gpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ msm_gpu_create_private_address_space(struct msm_gpu *gpu, struct task_struct *ta
662662
void msm_gpu_cleanup(struct msm_gpu *gpu);
663663

664664
struct msm_gpu *adreno_load_gpu(struct drm_device *dev);
665+
bool adreno_has_gpu(struct device_node *node);
665666
void __init adreno_register(void);
666667
void __exit adreno_unregister(void);
667668

0 commit comments

Comments
 (0)