@@ -245,6 +245,12 @@ static struct work_struct ecclog_work;
245245#define DID_RPL_P_SKU4 0xa716
246246#define DID_RPL_P_SKU5 0xa718
247247
248+ /* Compute die IDs for Meteor Lake-PS with IBECC */
249+ #define DID_MTL_PS_SKU1 0x7d21
250+ #define DID_MTL_PS_SKU2 0x7d22
251+ #define DID_MTL_PS_SKU3 0x7d23
252+ #define DID_MTL_PS_SKU4 0x7d24
253+
248254static int get_mchbar (struct pci_dev * pdev , u64 * mchbar )
249255{
250256 union {
@@ -325,6 +331,29 @@ static bool tgl_ibecc_available(struct pci_dev *pdev)
325331 return !(CAPID_E_IBECC & v );
326332}
327333
334+ static bool mtl_ps_ibecc_available (struct pci_dev * pdev )
335+ {
336+ #define MCHBAR_MEMSS_IBECCDIS 0x13c00
337+ void __iomem * window ;
338+ u64 mchbar ;
339+ u32 val ;
340+
341+ if (get_mchbar (pdev , & mchbar ))
342+ return false;
343+
344+ window = ioremap (mchbar , MCHBAR_SIZE * 2 );
345+ if (!window ) {
346+ igen6_printk (KERN_ERR , "Failed to ioremap 0x%llx\n" , mchbar );
347+ return false;
348+ }
349+
350+ val = readl (window + MCHBAR_MEMSS_IBECCDIS );
351+ iounmap (window );
352+
353+ /* Bit6: 1 - IBECC is disabled, 0 - IBECC isn't disabled */
354+ return !GET_BITFIELD (val , 6 , 6 );
355+ }
356+
328357static u64 mem_addr_to_sys_addr (u64 maddr )
329358{
330359 if (maddr < igen6_tolud )
@@ -484,6 +513,17 @@ static struct res_config rpl_p_cfg = {
484513 .err_addr_to_imc_addr = adl_err_addr_to_imc_addr ,
485514};
486515
516+ static struct res_config mtl_ps_cfg = {
517+ .machine_check = true,
518+ .num_imc = 2 ,
519+ .imc_base = 0xd800 ,
520+ .ibecc_base = 0xd400 ,
521+ .ibecc_error_log_offset = 0x170 ,
522+ .ibecc_available = mtl_ps_ibecc_available ,
523+ .err_addr_to_sys_addr = adl_err_addr_to_sys_addr ,
524+ .err_addr_to_imc_addr = adl_err_addr_to_imc_addr ,
525+ };
526+
487527static const struct pci_device_id igen6_pci_tbl [] = {
488528 { PCI_VDEVICE (INTEL , DID_EHL_SKU5 ), (kernel_ulong_t )& ehl_cfg },
489529 { PCI_VDEVICE (INTEL , DID_EHL_SKU6 ), (kernel_ulong_t )& ehl_cfg },
@@ -521,6 +561,10 @@ static const struct pci_device_id igen6_pci_tbl[] = {
521561 { PCI_VDEVICE (INTEL , DID_RPL_P_SKU3 ), (kernel_ulong_t )& rpl_p_cfg },
522562 { PCI_VDEVICE (INTEL , DID_RPL_P_SKU4 ), (kernel_ulong_t )& rpl_p_cfg },
523563 { PCI_VDEVICE (INTEL , DID_RPL_P_SKU5 ), (kernel_ulong_t )& rpl_p_cfg },
564+ { PCI_VDEVICE (INTEL , DID_MTL_PS_SKU1 ), (kernel_ulong_t )& mtl_ps_cfg },
565+ { PCI_VDEVICE (INTEL , DID_MTL_PS_SKU2 ), (kernel_ulong_t )& mtl_ps_cfg },
566+ { PCI_VDEVICE (INTEL , DID_MTL_PS_SKU3 ), (kernel_ulong_t )& mtl_ps_cfg },
567+ { PCI_VDEVICE (INTEL , DID_MTL_PS_SKU4 ), (kernel_ulong_t )& mtl_ps_cfg },
524568 { },
525569};
526570MODULE_DEVICE_TABLE (pci , igen6_pci_tbl );
0 commit comments