Commit 83db7e0b authored by Alex Williamson's avatar Alex Williamson Committed by Bjorn Helgaas

PCI: Differentiate ACS controllable from enabled

We currently misinterpret that in order for an ACS feature to be
enabled it must be set in the control field.  In reality, this means
that the feature is not only enabled, but controllable.  Many of the
ACS capability bits are not required if the device behaves by default
in the way specified when both the capability and control bit are set
and does not support or allow the alternate mode.  We therefore need
to check the capabilities and mask out flags that are enabled but not
controllable.  Egress control seems to be the only flag which is
purely optional.
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarDonald Dutile <ddutile@redhat.com>
parent 0a67119f
...@@ -2362,12 +2362,20 @@ void pci_enable_acs(struct pci_dev *dev) ...@@ -2362,12 +2362,20 @@ void pci_enable_acs(struct pci_dev *dev)
static bool pci_acs_flags_enabled(struct pci_dev *pdev, u16 acs_flags) static bool pci_acs_flags_enabled(struct pci_dev *pdev, u16 acs_flags)
{ {
int pos; int pos;
u16 ctrl; u16 cap, ctrl;
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ACS); pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ACS);
if (!pos) if (!pos)
return false; return false;
/*
* Except for egress control, capabilities are either required
* or only required if controllable. Features missing from the
* capability field can therefore be assumed as hard-wired enabled.
*/
pci_read_config_word(pdev, pos + PCI_ACS_CAP, &cap);
acs_flags &= (cap | PCI_ACS_EC);
pci_read_config_word(pdev, pos + PCI_ACS_CTRL, &ctrl); pci_read_config_word(pdev, pos + PCI_ACS_CTRL, &ctrl);
return (ctrl & acs_flags) == acs_flags; return (ctrl & acs_flags) == acs_flags;
} }
...@@ -2442,9 +2450,6 @@ bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags) ...@@ -2442,9 +2450,6 @@ bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags)
if (!pdev->multifunction) if (!pdev->multifunction)
break; break;
acs_flags &= (PCI_ACS_RR | PCI_ACS_CR |
PCI_ACS_EC | PCI_ACS_DT);
return pci_acs_flags_enabled(pdev, acs_flags); return pci_acs_flags_enabled(pdev, acs_flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment