mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
Merge branch 'pci/ptm'
- Enable PTM only if device advertises support for a relevant role, to prevent invalid PTM Requests that cause ACS violations that are reported as AER Uncorrectable Non-Fatal errors (Mika Westerberg) * pci/ptm: PCI/PTM: Enable only if device advertises relevant role
This commit is contained in:
commit
c1e900de22
|
|
@ -81,6 +81,11 @@ void pci_ptm_init(struct pci_dev *dev)
|
|||
dev->ptm_granularity = 0;
|
||||
}
|
||||
|
||||
if (cap & PCI_PTM_CAP_RES)
|
||||
dev->ptm_responder = 1;
|
||||
if (cap & PCI_PTM_CAP_REQ)
|
||||
dev->ptm_requester = 1;
|
||||
|
||||
if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||
|
||||
pci_pcie_type(dev) == PCI_EXP_TYPE_UPSTREAM)
|
||||
pci_enable_ptm(dev, NULL);
|
||||
|
|
@ -144,6 +149,24 @@ static int __pci_enable_ptm(struct pci_dev *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (pci_pcie_type(dev)) {
|
||||
case PCI_EXP_TYPE_ROOT_PORT:
|
||||
if (!dev->ptm_root)
|
||||
return -EINVAL;
|
||||
break;
|
||||
case PCI_EXP_TYPE_UPSTREAM:
|
||||
if (!dev->ptm_responder)
|
||||
return -EINVAL;
|
||||
break;
|
||||
case PCI_EXP_TYPE_ENDPOINT:
|
||||
case PCI_EXP_TYPE_LEG_END:
|
||||
if (!dev->ptm_requester)
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pci_read_config_dword(dev, ptm + PCI_PTM_CTRL, &ctrl);
|
||||
|
||||
ctrl |= PCI_PTM_CTRL_ENABLE;
|
||||
|
|
|
|||
|
|
@ -500,6 +500,8 @@ struct pci_dev {
|
|||
#ifdef CONFIG_PCIE_PTM
|
||||
u16 ptm_cap; /* PTM Capability */
|
||||
unsigned int ptm_root:1;
|
||||
unsigned int ptm_responder:1;
|
||||
unsigned int ptm_requester:1;
|
||||
unsigned int ptm_enabled:1;
|
||||
u8 ptm_granularity;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user