Re: [PATCH 1/1] PCI: Fix Extend ACS configurability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/16/25 11:01, Jason Gunthorpe wrote:
On Wed, Jan 15, 2025 at 07:11:25PM -0800, Tushar Dave wrote:
@@ -1028,10 +1032,15 @@ static void __pci_config_acs(struct pci_dev *dev,
struct pci_acs *caps,

         pci_dbg(dev, "ACS mask  = %#06x\n", mask);
         pci_dbg(dev, "ACS flags = %#06x\n", flags);
+       pci_dbg(dev, "ACS control = %#06x\n", caps->ctrl);
+       pci_dbg(dev, "ACS fw_ctrl = %#06x\n", caps->fw_ctrl);

         /* If mask is 0 then we copy the bit from the firmware setting. */
-       caps->ctrl = (caps->ctrl & ~mask) | (caps->fw_ctrl & mask);
-       caps->ctrl |= flags;
+       caps->ctrl = (caps->ctrl & mask) | (caps->fw_ctrl & ~mask);
+
+       /* Apply the flags */
+       caps->ctrl &= ~mask;
+       caps->ctrl |= (flags & mask);

caps->ctrl = (caps->ctrl & mask) & ~mask == 0 - so this is kind of confusing.

What we want is to take the fw_ctl for all bits where mask is 0 and
take flags for all bits where it is 1?

   caps->ctrl = (caps->fw_ctrl & ~mask) | (flags & mask);

?

Yes :)

-       /* If mask is 0 then we copy the bit from the firmware setting. */
-       caps->ctrl = (caps->ctrl & ~mask) | (caps->fw_ctrl & mask);
-       caps->ctrl |= flags;
+       /* For mask bits that are 0 copy them from the firmware setting
+        * and apply flags for all the mask bits that are 1.
+        */
+       caps->ctrl = (caps->fw_ctrl & ~mask) | (flags & mask);


I ran some sanity tests and looks good. Can I send V2 now?

-Tushar


Jason




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux