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

Jason Gunthorpe
2025-01-16T19:01:22Z

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);

?

Jason