intel/dev: generate helpers to identify platform workarounds
authorMark Janes <markjanes@swizzler.org>
Fri, 17 Feb 2023 00:12:43 +0000 (16:12 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 2 Mar 2023 00:01:27 +0000 (00:01 +0000)
commit3c9a8f7a6d25c0d70351d3ea27930de74e6c94ba
tree5c0e8e3c0509cd7923dd27f50be22945d92142cc
parentf11aab743b64954f78ef6eb944ff65b8f14fff19
intel/dev: generate helpers to identify platform workarounds

Workarounds for defects in Intel silicon have been manually
implemented:

 - consult defect database for the current platform

 - add workaround code behind platform ifdef or devinfo->ver checks

Some bugs have occurred due to the manual process.  Typical failure
modes:

 - defect database is updated after a platform is enabled

 - version checks are overly broad (eg gfx11+) for defects that were
   fixed (eg in gfx12)

 - version checks are too narrow for defects that were extended to
   subsequent platforms.

 - missed workarounds

This commit automates workaround handling:

 - Internal automation queries the defect database to collate and
   summarize defect documentation in json.

 - mesa_defs.json describes all public defects and impacted platforms.
   Defects which are extended to subsequent platforms are listed under
   the original defect.

 - gen_wa_helpers.py generates workaround helpers to be called
   in place of version checks:

   - NEEDS_WORKAROUND_{ID} provides a compile time check suitable for
     use in genX routines.

   - intel_device_info_needs_wa() provides a more precise runtime
     check, differentiating platforms within a generation and
     platform steppings.

Internal automation will generate new mesa_defs.json as needed.
Workarounds enabled with these helpers will apply correctly based on
updated information in Intel's defect database.

Reviewed-by: Dylan Baker <dylan@pnwbakers>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20825>
src/intel/dev/gen_wa_helpers.py [new file with mode: 0644]
src/intel/dev/intel_device_info.c
src/intel/dev/intel_device_info.h
src/intel/dev/mesa_defs.json [new file with mode: 0644]
src/intel/dev/meson.build