]>
Commit | Line | Data |
---|---|---|
b7ca0ba0 SL |
1 | From 75cae35b079e066f7396dbaa38b67d91cb3c2f81 Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Fri, 1 Mar 2024 14:28:11 +0100 | |
4 | Subject: drm/etnaviv: Restore some id values | |
5 | ||
6 | From: Christian Gmeiner <cgmeiner@igalia.com> | |
7 | ||
8 | [ Upstream commit b735ee173f84d5d0d0733c53946a83c12d770d05 ] | |
9 | ||
10 | The hwdb selection logic as a feature that allows it to mark some fields | |
11 | as 'don't care'. If we match with such a field we memcpy(..) | |
12 | the current etnaviv_chip_identity into ident. | |
13 | ||
14 | This step can overwrite some id values read from the GPU with the | |
15 | 'don't care' value. | |
16 | ||
17 | Fix this issue by restoring the affected values after the memcpy(..). | |
18 | ||
19 | As this is crucial for user space to know when this feature works as | |
20 | expected increment the minor version too. | |
21 | ||
22 | Fixes: 4078a1186dd3 ("drm/etnaviv: update hwdb selection logic") | |
23 | Cc: stable@vger.kernel.org | |
24 | Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> | |
25 | Reviewed-by: Tomeu Vizoso <tomeu@tomeuvizoso.net> | |
26 | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> | |
27 | Signed-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 | ||
33 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c | |
34 | index 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 | /* | |
46 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | |
47 | index 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 | -- | |
74 | 2.43.0 | |
75 |