Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b49bfd32 authored by Youquan,Song's avatar Youquan,Song Committed by Jesse Barnes
Browse files

PCIe AER: prevent AER injection if hardware masks error reporting



The Correcteable/Uncorrectable Error Mask Registers are used by PCIe AER
driver which will controls the reporting of individual errors to PCIe RC
via PCIe error messages.

If hardware masks special error reporting to RC, the aer_inject driver
should not inject aer error.

Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
Signed-off-by: default avatarYouquan, Song <youquan.song@intel.com>
Acked-by: default avatarYing, Huang <ying.huang@intel.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 1ae861e6
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ static int aer_inject(struct aer_error_inj *einj)
	unsigned long flags;
	unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn);
	int pos_cap_err, rp_pos_cap_err;
	u32 sever;
	u32 sever, mask;
	int ret = 0;

	dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn);
@@ -374,6 +374,24 @@ static int aer_inject(struct aer_error_inj *einj)
	err->header_log2 = einj->header_log2;
	err->header_log3 = einj->header_log3;

	pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask);
	if (einj->cor_status && !(einj->cor_status & ~mask)) {
		ret = -EINVAL;
		printk(KERN_WARNING "The correctable error(s) is masked "
				"by device\n");
		spin_unlock_irqrestore(&inject_lock, flags);
		goto out_put;
	}

	pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask);
	if (einj->uncor_status && !(einj->uncor_status & ~mask)) {
		ret = -EINVAL;
		printk(KERN_WARNING "The uncorrectable error(s) is masked "
				"by device\n");
		spin_unlock_irqrestore(&inject_lock, flags);
		goto out_put;
	}

	rperr = __find_aer_error_by_dev(rpdev);
	if (!rperr) {
		rperr = rperr_alloc;