@@ -246,6 +246,12 @@ static struct work_struct ecclog_work;
246246#define DID_RPL_P_SKU4 0xa716
247247#define DID_RPL_P_SKU5 0xa718
248248
249+ /* Compute die IDs for Meteor Lake-PS with IBECC */
250+ #define DID_MTL_PS_SKU1 0x7d21
251+ #define DID_MTL_PS_SKU2 0x7d22
252+ #define DID_MTL_PS_SKU3 0x7d23
253+ #define DID_MTL_PS_SKU4 0x7d24
254+
249255static int get_mchbar (struct pci_dev * pdev , u64 * mchbar )
250256{
251257 union {
@@ -326,6 +332,28 @@ static bool tgl_ibecc_available(struct pci_dev *pdev)
326332 return !(CAPID_E_IBECC & v );
327333}
328334
335+ static bool mtl_ps_ibecc_available (struct pci_dev * pdev )
336+ {
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 + 0x13c00 );
351+ iounmap (window );
352+
353+ /* Bit6: 1 - IBECC is disabled, 0 - IBECC isn't disabled */
354+ return !GET_BITFIELD (val , 6 , 6 );
355+ }
356+
329357static u64 mem_addr_to_sys_addr (u64 maddr )
330358{
331359 if (maddr < igen6_tolud )
@@ -485,6 +513,17 @@ static struct res_config rpl_p_cfg = {
485513 .err_addr_to_imc_addr = adl_err_addr_to_imc_addr ,
486514};
487515
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+
488527static const struct pci_device_id igen6_pci_tbl [] = {
489528 { PCI_VDEVICE (INTEL , DID_EHL_SKU5 ), (kernel_ulong_t )& ehl_cfg },
490529 { PCI_VDEVICE (INTEL , DID_EHL_SKU6 ), (kernel_ulong_t )& ehl_cfg },
@@ -522,6 +561,10 @@ static const struct pci_device_id igen6_pci_tbl[] = {
522561 { PCI_VDEVICE (INTEL , DID_RPL_P_SKU3 ), (kernel_ulong_t )& rpl_p_cfg },
523562 { PCI_VDEVICE (INTEL , DID_RPL_P_SKU4 ), (kernel_ulong_t )& rpl_p_cfg },
524563 { 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 },
525568 { },
526569};
527570MODULE_DEVICE_TABLE (pci , igen6_pci_tbl );
0 commit comments