Skip to content

Commit 87a23fe

Browse files
trusinowiczkwachows
authored andcommitted
accel/ivpu: Enable MCA ECC signalling based on MSR
Add new boot parameter for NPU5+ that enables ECC signalling for on-chip memory based on the value of MSR_INTEGRITY_CAPS register. Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com> Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com> Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com> Link: https://lore.kernel.org/r/20250925145020.1446208-1-maciej.falkowski@linux.intel.com
1 parent 306e640 commit 87a23fe

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

drivers/accel/ivpu/ivpu_fw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ static void ivpu_fw_boot_params_print(struct ivpu_device *vdev, struct vpu_boot_
606606
boot_params->system_time_us);
607607
ivpu_dbg(vdev, FW_BOOT, "boot_params.power_profile = 0x%x\n",
608608
boot_params->power_profile);
609+
ivpu_dbg(vdev, FW_BOOT, "boot_params.vpu_uses_ecc_mca_signal = 0x%x\n",
610+
boot_params->vpu_uses_ecc_mca_signal);
609611
}
610612

611613
void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params *boot_params)
@@ -708,6 +710,8 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
708710
boot_params->d0i3_entry_vpu_ts = 0;
709711
if (IVPU_WA(disable_d0i2))
710712
boot_params->power_profile |= BIT(1);
713+
boot_params->vpu_uses_ecc_mca_signal =
714+
ivpu_hw_uses_ecc_mca_signal(vdev) ? VPU_BOOT_MCA_ECC_BOTH : 0;
711715

712716
boot_params->system_time_us = ktime_to_us(ktime_get_real());
713717
wmb(); /* Flush WC buffers after writing bootparams */

drivers/accel/ivpu/ivpu_hw.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "ivpu_hw_btrs.h"
99
#include "ivpu_hw_ip.h"
1010

11+
#include <asm/msr-index.h>
12+
#include <asm/msr.h>
1113
#include <linux/dmi.h>
1214
#include <linux/fault-inject.h>
1315
#include <linux/pm_runtime.h>
@@ -22,6 +24,8 @@ MODULE_PARM_DESC(fail_hw, "<interval>,<probability>,<space>,<times>");
2224

2325
#define FW_SHARED_MEM_ALIGNMENT SZ_512K /* VPU MTRR limitation */
2426

27+
#define ECC_MCA_SIGNAL_ENABLE_MASK 0xff
28+
2529
static char *platform_to_str(u32 platform)
2630
{
2731
switch (platform) {
@@ -395,3 +399,22 @@ irqreturn_t ivpu_hw_irq_handler(int irq, void *ptr)
395399
pm_runtime_mark_last_busy(vdev->drm.dev);
396400
return IRQ_HANDLED;
397401
}
402+
403+
bool ivpu_hw_uses_ecc_mca_signal(struct ivpu_device *vdev)
404+
{
405+
unsigned long long msr_integrity_caps;
406+
int ret;
407+
408+
if (ivpu_hw_ip_gen(vdev) < IVPU_HW_IP_50XX)
409+
return false;
410+
411+
ret = rdmsrq_safe(MSR_INTEGRITY_CAPS, &msr_integrity_caps);
412+
if (ret) {
413+
ivpu_warn(vdev, "Error reading MSR_INTEGRITY_CAPS: %d", ret);
414+
return false;
415+
}
416+
417+
ivpu_dbg(vdev, MISC, "MSR_INTEGRITY_CAPS: 0x%llx\n", msr_integrity_caps);
418+
419+
return msr_integrity_caps & ECC_MCA_SIGNAL_ENABLE_MASK;
420+
}

drivers/accel/ivpu/ivpu_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ void ivpu_irq_handlers_init(struct ivpu_device *vdev);
6363
void ivpu_hw_irq_enable(struct ivpu_device *vdev);
6464
void ivpu_hw_irq_disable(struct ivpu_device *vdev);
6565
irqreturn_t ivpu_hw_irq_handler(int irq, void *ptr);
66+
bool ivpu_hw_uses_ecc_mca_signal(struct ivpu_device *vdev);
6667

6768
static inline u32 ivpu_hw_btrs_irq_handler(struct ivpu_device *vdev, int irq)
6869
{

0 commit comments

Comments
 (0)