freedreno: Handle wildcard fuse-id in device matching

A future kernel update will add fuse-id in the upper bits of the
chip_id.  Do avoid breaking device matching, add a way to include
a wildcard/fallback fuse-id.  (Note that this only effects un-
released devices.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14506>
This commit is contained in:
Rob Clark 2021-12-16 13:27:32 -08:00 committed by Marge Bot
parent 6b8e3aeeb7
commit 785a324deb
2 changed files with 19 additions and 1 deletions

View File

@ -58,6 +58,24 @@ dev_id_compare(const struct fd_dev_id *ref, const struct fd_dev_id *id)
((ref->chip_id & UINT64_C(0xffffff00)) ==
(id->chip_id & UINT64_C(0xffffff00))))
return true;
#define WILDCARD_FUSE_ID UINT64_C(0x0000ffff00000000)
/* If the reference id has wildcard fuse-id value (ie. bits 47..32
* are all ones, then try matching ignoring the device fuse-id:
*/
if ((ref->chip_id & WILDCARD_FUSE_ID) == WILDCARD_FUSE_ID) {
uint64_t chip_id = id->chip_id | WILDCARD_FUSE_ID;
/* (c) exact match (ignoring the fuse-id from kernel):
*/
if (ref->chip_id == chip_id)
return true;
/* (d) device table entry has 0xff wildcard patch_id and core/
* major/minor match (ignoring fuse-id from kernel):
*/
if (((ref->chip_id & 0xff) == 0xff) &&
((ref->chip_id & UINT64_C(0xffffff00)) ==
(chip_id & UINT64_C(0xffffff00))))
return true;
}
return false;
}
}

View File

@ -327,7 +327,7 @@ add_gpus([
))
add_gpus([
GPUId(chip_id=0x06030500, name="Adreno 7c Gen 3"),
GPUId(chip_id=0xffff06030500, name="Adreno 7c Gen 3"),
], A6xxGPUInfo(
a6xx_gen4,
num_sp_cores = 2,