|
14 | 14 | #include "intel_pxp.h" |
15 | 15 | #include "intel_pxp_gsccs.h" |
16 | 16 | #include "intel_pxp_irq.h" |
| 17 | +#include "intel_pxp_regs.h" |
17 | 18 | #include "intel_pxp_session.h" |
18 | 19 | #include "intel_pxp_tee.h" |
19 | 20 | #include "intel_pxp_types.h" |
@@ -61,21 +62,22 @@ bool intel_pxp_is_active(const struct intel_pxp *pxp) |
61 | 62 | return IS_ENABLED(CONFIG_DRM_I915_PXP) && pxp && pxp->arb_is_valid; |
62 | 63 | } |
63 | 64 |
|
64 | | -/* KCR register definitions */ |
65 | | -#define KCR_INIT _MMIO(0x320f0) |
66 | | -/* Setting KCR Init bit is required after system boot */ |
67 | | -#define KCR_INIT_ALLOW_DISPLAY_ME_WRITES REG_BIT(14) |
| 65 | +static void kcr_pxp_set_status(const struct intel_pxp *pxp, bool enable) |
| 66 | +{ |
| 67 | + u32 val = enable ? _MASKED_BIT_ENABLE(KCR_INIT_ALLOW_DISPLAY_ME_WRITES) : |
| 68 | + _MASKED_BIT_DISABLE(KCR_INIT_ALLOW_DISPLAY_ME_WRITES); |
| 69 | + |
| 70 | + intel_uncore_write(pxp->ctrl_gt->uncore, KCR_INIT(pxp->kcr_base), val); |
| 71 | +} |
68 | 72 |
|
69 | | -static void kcr_pxp_enable(struct intel_gt *gt) |
| 73 | +static void kcr_pxp_enable(const struct intel_pxp *pxp) |
70 | 74 | { |
71 | | - intel_uncore_write(gt->uncore, KCR_INIT, |
72 | | - _MASKED_BIT_ENABLE(KCR_INIT_ALLOW_DISPLAY_ME_WRITES)); |
| 75 | + kcr_pxp_set_status(pxp, true); |
73 | 76 | } |
74 | 77 |
|
75 | | -static void kcr_pxp_disable(struct intel_gt *gt) |
| 78 | +static void kcr_pxp_disable(const struct intel_pxp *pxp) |
76 | 79 | { |
77 | | - intel_uncore_write(gt->uncore, KCR_INIT, |
78 | | - _MASKED_BIT_DISABLE(KCR_INIT_ALLOW_DISPLAY_ME_WRITES)); |
| 80 | + kcr_pxp_set_status(pxp, false); |
79 | 81 | } |
80 | 82 |
|
81 | 83 | static int create_vcs_context(struct intel_pxp *pxp) |
@@ -127,6 +129,11 @@ static void pxp_init_full(struct intel_pxp *pxp) |
127 | 129 | init_completion(&pxp->termination); |
128 | 130 | complete_all(&pxp->termination); |
129 | 131 |
|
| 132 | + if (pxp->ctrl_gt->type == GT_MEDIA) |
| 133 | + pxp->kcr_base = MTL_KCR_BASE; |
| 134 | + else |
| 135 | + pxp->kcr_base = GEN12_KCR_BASE; |
| 136 | + |
130 | 137 | intel_pxp_session_management_init(pxp); |
131 | 138 |
|
132 | 139 | ret = create_vcs_context(pxp); |
@@ -369,14 +376,13 @@ int intel_pxp_start(struct intel_pxp *pxp) |
369 | 376 |
|
370 | 377 | void intel_pxp_init_hw(struct intel_pxp *pxp) |
371 | 378 | { |
372 | | - kcr_pxp_enable(pxp->ctrl_gt); |
| 379 | + kcr_pxp_enable(pxp); |
373 | 380 | intel_pxp_irq_enable(pxp); |
374 | 381 | } |
375 | 382 |
|
376 | 383 | void intel_pxp_fini_hw(struct intel_pxp *pxp) |
377 | 384 | { |
378 | | - kcr_pxp_disable(pxp->ctrl_gt); |
379 | | - |
| 385 | + kcr_pxp_disable(pxp); |
380 | 386 | intel_pxp_irq_disable(pxp); |
381 | 387 | } |
382 | 388 |
|
|
0 commit comments