Re: [PATCH V4] PCI: Extend ACS configurability

From: Jiri Slaby
Date: Wed Sep 25 2024 - 01:30:24 EST


On 25. 09. 24, 7:06, Jiri Slaby wrote:
@@ -1047,23 +1066,33 @@ static void pci_std_enable_acs(struct pci_dev *dev)
   */
  static void pci_enable_acs(struct pci_dev *dev)
  {
-    if (!pci_acs_enable)
-        goto disable_acs_redir;
+    struct pci_acs caps;
+    int pos;
+
+    pos = dev->acs_cap;
+    if (!pos)
+        return;
-    if (!pci_dev_specific_enable_acs(dev))
-        goto disable_acs_redir;
+    pci_read_config_word(dev, pos + PCI_ACS_CAP, &caps.cap);
+    pci_read_config_word(dev, pos + PCI_ACS_CTRL, &caps.ctrl);
+    caps.fw_ctrl = caps.ctrl;
-    pci_std_enable_acs(dev);
+    /* If an iommu is present we start with kernel default caps */
+    if (pci_acs_enable) {

AFAIU pci_acs_enable is set from iommus' code via pci_request_acs(). Which is much later than when bridges are initialized here, right?

+        if (pci_dev_specific_enable_acs(dev))
+            pci_std_enable_acs(dev, &caps);

So this is never called, IMO.

+    }

thanks,
--
js
suse labs