|
29 | 29 | #include "xe_guc_db_mgr.h" |
30 | 30 | #include "xe_guc_engine_activity.h" |
31 | 31 | #include "xe_guc_hwconfig.h" |
| 32 | +#include "xe_guc_klv_helpers.h" |
32 | 33 | #include "xe_guc_log.h" |
33 | 34 | #include "xe_guc_pc.h" |
34 | 35 | #include "xe_guc_relay.h" |
@@ -570,6 +571,57 @@ static int guc_g2g_start(struct xe_guc *guc) |
570 | 571 | return err; |
571 | 572 | } |
572 | 573 |
|
| 574 | +static int __guc_opt_in_features_enable(struct xe_guc *guc, u64 addr, u32 num_dwords) |
| 575 | +{ |
| 576 | + u32 action[] = { |
| 577 | + XE_GUC_ACTION_OPT_IN_FEATURE_KLV, |
| 578 | + lower_32_bits(addr), |
| 579 | + upper_32_bits(addr), |
| 580 | + num_dwords |
| 581 | + }; |
| 582 | + |
| 583 | + return xe_guc_ct_send_block(&guc->ct, action, ARRAY_SIZE(action)); |
| 584 | +} |
| 585 | + |
| 586 | +#define OPT_IN_MAX_DWORDS 16 |
| 587 | +int xe_guc_opt_in_features_enable(struct xe_guc *guc) |
| 588 | +{ |
| 589 | + struct xe_device *xe = guc_to_xe(guc); |
| 590 | + CLASS(xe_guc_buf, buf)(&guc->buf, OPT_IN_MAX_DWORDS); |
| 591 | + u32 count = 0; |
| 592 | + u32 *klvs; |
| 593 | + int ret; |
| 594 | + |
| 595 | + if (!xe_guc_buf_is_valid(buf)) |
| 596 | + return -ENOBUFS; |
| 597 | + |
| 598 | + klvs = xe_guc_buf_cpu_ptr(buf); |
| 599 | + |
| 600 | + /* |
| 601 | + * The extra CAT error type opt-in was added in GuC v70.17.0, which maps |
| 602 | + * to compatibility version v1.7.0. |
| 603 | + * Note that the GuC allows enabling this KLV even on platforms that do |
| 604 | + * not support the extra type; in such case the returned type variable |
| 605 | + * will be set to a known invalid value which we can check against. |
| 606 | + */ |
| 607 | + if (GUC_SUBMIT_VER(guc) >= MAKE_GUC_VER(1, 7, 0)) |
| 608 | + klvs[count++] = PREP_GUC_KLV_TAG(OPT_IN_FEATURE_EXT_CAT_ERR_TYPE); |
| 609 | + |
| 610 | + if (count) { |
| 611 | + xe_assert(xe, count <= OPT_IN_MAX_DWORDS); |
| 612 | + |
| 613 | + ret = __guc_opt_in_features_enable(guc, xe_guc_buf_flush(buf), count); |
| 614 | + if (ret < 0) { |
| 615 | + xe_gt_err(guc_to_gt(guc), |
| 616 | + "failed to enable GuC opt-in features: %pe\n", |
| 617 | + ERR_PTR(ret)); |
| 618 | + return ret; |
| 619 | + } |
| 620 | + } |
| 621 | + |
| 622 | + return 0; |
| 623 | +} |
| 624 | + |
573 | 625 | static void guc_fini_hw(void *arg) |
574 | 626 | { |
575 | 627 | struct xe_guc *guc = arg; |
@@ -763,6 +815,10 @@ int xe_guc_post_load_init(struct xe_guc *guc) |
763 | 815 |
|
764 | 816 | xe_guc_ads_populate_post_load(&guc->ads); |
765 | 817 |
|
| 818 | + ret = xe_guc_opt_in_features_enable(guc); |
| 819 | + if (ret) |
| 820 | + return ret; |
| 821 | + |
766 | 822 | if (xe_guc_g2g_wanted(guc_to_xe(guc))) { |
767 | 823 | ret = guc_g2g_start(guc); |
768 | 824 | if (ret) |
|
0 commit comments