Skip to content

Commit b735ee1

Browse files
Christian Gmeinerlynxeye-dev
authored andcommitted
drm/etnaviv: Restore some id values
The hwdb selection logic as a feature that allows it to mark some fields as 'don't care'. If we match with such a field we memcpy(..) the current etnaviv_chip_identity into ident. This step can overwrite some id values read from the GPU with the 'don't care' value. Fix this issue by restoring the affected values after the memcpy(..). As this is crucial for user space to know when this feature works as expected increment the minor version too. Fixes: 4078a11 ("drm/etnaviv: update hwdb selection logic") Cc: stable@vger.kernel.org Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Tomeu Vizoso <tomeu@tomeuvizoso.net> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
1 parent c995999 commit b735ee1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

drivers/gpu/drm/etnaviv/etnaviv_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ static const struct drm_driver etnaviv_drm_driver = {
505505
.desc = "etnaviv DRM",
506506
.date = "20151214",
507507
.major = 1,
508-
.minor = 3,
508+
.minor = 4,
509509
};
510510

511511
/*

drivers/gpu/drm/etnaviv/etnaviv_hwdb.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
299299
bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
300300
{
301301
struct etnaviv_chip_identity *ident = &gpu->identity;
302+
const u32 product_id = ident->product_id;
303+
const u32 customer_id = ident->customer_id;
304+
const u32 eco_id = ident->eco_id;
302305
int i;
303306

304307
for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) {
@@ -312,6 +315,12 @@ bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
312315
etnaviv_chip_identities[i].eco_id == ~0U)) {
313316
memcpy(ident, &etnaviv_chip_identities[i],
314317
sizeof(*ident));
318+
319+
/* Restore some id values as ~0U aka 'don't care' might been used. */
320+
ident->product_id = product_id;
321+
ident->customer_id = customer_id;
322+
ident->eco_id = eco_id;
323+
315324
return true;
316325
}
317326
}

0 commit comments

Comments
 (0)