]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-5.10/drm-etnaviv-restore-some-id-values.patch
5.10-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.10 / drm-etnaviv-restore-some-id-values.patch
CommitLineData
b7ca0ba0
SL
1From 75cae35b079e066f7396dbaa38b67d91cb3c2f81 Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Fri, 1 Mar 2024 14:28:11 +0100
4Subject: drm/etnaviv: Restore some id values
5
6From: Christian Gmeiner <cgmeiner@igalia.com>
7
8[ Upstream commit b735ee173f84d5d0d0733c53946a83c12d770d05 ]
9
10The hwdb selection logic as a feature that allows it to mark some fields
11as 'don't care'. If we match with such a field we memcpy(..)
12the current etnaviv_chip_identity into ident.
13
14This step can overwrite some id values read from the GPU with the
15'don't care' value.
16
17Fix this issue by restoring the affected values after the memcpy(..).
18
19As this is crucial for user space to know when this feature works as
20expected increment the minor version too.
21
22Fixes: 4078a1186dd3 ("drm/etnaviv: update hwdb selection logic")
23Cc: stable@vger.kernel.org
24Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
25Reviewed-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
26Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
27Signed-off-by: Sasha Levin <sashal@kernel.org>
28---
29 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 2 +-
30 drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 9 +++++++++
31 2 files changed, 10 insertions(+), 1 deletion(-)
32
33diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
34index a9a3afaef9a1c..edf9387069cdc 100644
35--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
36+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
37@@ -511,7 +511,7 @@ static struct drm_driver etnaviv_drm_driver = {
38 .desc = "etnaviv DRM",
39 .date = "20151214",
40 .major = 1,
41- .minor = 3,
42+ .minor = 4,
43 };
44
45 /*
46diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
47index 167971a09be79..e9b777ab3be7f 100644
48--- a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
49+++ b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
50@@ -73,6 +73,9 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
51 bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
52 {
53 struct etnaviv_chip_identity *ident = &gpu->identity;
54+ const u32 product_id = ident->product_id;
55+ const u32 customer_id = ident->customer_id;
56+ const u32 eco_id = ident->eco_id;
57 int i;
58
59 for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) {
60@@ -86,6 +89,12 @@ bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
61 etnaviv_chip_identities[i].eco_id == ~0U)) {
62 memcpy(ident, &etnaviv_chip_identities[i],
63 sizeof(*ident));
64+
65+ /* Restore some id values as ~0U aka 'don't care' might been used. */
66+ ident->product_id = product_id;
67+ ident->customer_id = customer_id;
68+ ident->eco_id = eco_id;
69+
70 return true;
71 }
72 }
73--
742.43.0
75