From 785a324debb2906e3a63324f6e5240dc84780806 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 16 Dec 2021 13:27:32 -0800 Subject: [PATCH] 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 Part-of: --- src/freedreno/common/freedreno_dev_info.c | 18 ++++++++++++++++++ src/freedreno/common/freedreno_devices.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/freedreno/common/freedreno_dev_info.c b/src/freedreno/common/freedreno_dev_info.c index 725444eeb2d..d32695c5fc4 100644 --- a/src/freedreno/common/freedreno_dev_info.c +++ b/src/freedreno/common/freedreno_dev_info.c @@ -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; } } diff --git a/src/freedreno/common/freedreno_devices.py b/src/freedreno/common/freedreno_devices.py index 4bcdec0e237..54736dc2146 100644 --- a/src/freedreno/common/freedreno_devices.py +++ b/src/freedreno/common/freedreno_devices.py @@ -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,