|
10 | 10 | #include <linux/compiler_types.h> |
11 | 11 | #include <linux/fault-inject.h> |
12 | 12 |
|
| 13 | +#include <generated/xe_device_wa_oob.h> |
13 | 14 | #include <generated/xe_wa_oob.h> |
14 | 15 |
|
15 | 16 | #include "regs/xe_engine_regs.h" |
@@ -876,8 +877,33 @@ static __maybe_unused const struct xe_rtp_entry oob_was[] = { |
876 | 877 |
|
877 | 878 | static_assert(ARRAY_SIZE(oob_was) - 1 == _XE_WA_OOB_COUNT); |
878 | 879 |
|
| 880 | +static __maybe_unused const struct xe_rtp_entry device_oob_was[] = { |
| 881 | +#include <generated/xe_device_wa_oob.c> |
| 882 | + {} |
| 883 | +}; |
| 884 | + |
| 885 | +static_assert(ARRAY_SIZE(device_oob_was) - 1 == _XE_DEVICE_WA_OOB_COUNT); |
| 886 | + |
879 | 887 | __diag_pop(); |
880 | 888 |
|
| 889 | +/** |
| 890 | + * xe_wa_process_device_oob - process OOB workaround table |
| 891 | + * @xe: device instance to process workarounds for |
| 892 | + * |
| 893 | + * process OOB workaround table for this device, marking in @xe the |
| 894 | + * workarounds that are active. |
| 895 | + */ |
| 896 | + |
| 897 | +void xe_wa_process_device_oob(struct xe_device *xe) |
| 898 | +{ |
| 899 | + struct xe_rtp_process_ctx ctx = XE_RTP_PROCESS_CTX_INITIALIZER(xe); |
| 900 | + |
| 901 | + xe_rtp_process_ctx_enable_active_tracking(&ctx, xe->wa_active.oob, ARRAY_SIZE(device_oob_was)); |
| 902 | + |
| 903 | + xe->wa_active.oob_initialized = true; |
| 904 | + xe_rtp_process(&ctx, device_oob_was); |
| 905 | +} |
| 906 | + |
881 | 907 | /** |
882 | 908 | * xe_wa_process_oob - process OOB workaround table |
883 | 909 | * @gt: GT instance to process workarounds for |
@@ -946,6 +972,28 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe) |
946 | 972 | xe_rtp_process_to_sr(&ctx, lrc_was, ARRAY_SIZE(lrc_was), &hwe->reg_lrc); |
947 | 973 | } |
948 | 974 |
|
| 975 | +/** |
| 976 | + * xe_wa_device_init - initialize device with workaround oob bookkeeping |
| 977 | + * @xe: Xe device instance to initialize |
| 978 | + * |
| 979 | + * Returns 0 for success, negative with error code otherwise |
| 980 | + */ |
| 981 | +int xe_wa_device_init(struct xe_device *xe) |
| 982 | +{ |
| 983 | + unsigned long *p; |
| 984 | + |
| 985 | + p = drmm_kzalloc(&xe->drm, |
| 986 | + sizeof(*p) * BITS_TO_LONGS(ARRAY_SIZE(device_oob_was)), |
| 987 | + GFP_KERNEL); |
| 988 | + |
| 989 | + if (!p) |
| 990 | + return -ENOMEM; |
| 991 | + |
| 992 | + xe->wa_active.oob = p; |
| 993 | + |
| 994 | + return 0; |
| 995 | +} |
| 996 | + |
949 | 997 | /** |
950 | 998 | * xe_wa_init - initialize gt with workaround bookkeeping |
951 | 999 | * @gt: GT instance to initialize |
@@ -980,6 +1028,16 @@ int xe_wa_init(struct xe_gt *gt) |
980 | 1028 | } |
981 | 1029 | ALLOW_ERROR_INJECTION(xe_wa_init, ERRNO); /* See xe_pci_probe() */ |
982 | 1030 |
|
| 1031 | +void xe_wa_device_dump(struct xe_device *xe, struct drm_printer *p) |
| 1032 | +{ |
| 1033 | + size_t idx; |
| 1034 | + |
| 1035 | + drm_printf(p, "Device OOB Workarounds\n"); |
| 1036 | + for_each_set_bit(idx, xe->wa_active.oob, ARRAY_SIZE(device_oob_was)) |
| 1037 | + if (device_oob_was[idx].name) |
| 1038 | + drm_printf_indent(p, 1, "%s\n", device_oob_was[idx].name); |
| 1039 | +} |
| 1040 | + |
983 | 1041 | void xe_wa_dump(struct xe_gt *gt, struct drm_printer *p) |
984 | 1042 | { |
985 | 1043 | size_t idx; |
|
0 commit comments