On 1/17/25 05:28, Jason Gunthorpe wrote:
On Thu, Jan 16, 2025 at 05:21:29PM -0800, Tushar Dave wrote:
- /* 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?
I think so, I'm just wondering if this is not quite it either - this
will always throw away any changes any of the other calls made to
ctrl prior to getting here.
Yes.
So we skip the above if the kernel command line does not refer to the
device?
That is correct as well.
Ie if the command line refers to the device then it always superceeds
everything, otherwise the other stuff keeps working the way it worked
before??
Yup.
If kernel commandline is present (either config_acs or disable_acs_redir) and
device match occurs in function '__pci_config_acs', we discard any changes done
to ctrl by kernel prior to this call. Else we do not touch ctrl and it works as
before.
And IMO, that is how it should be. This gives admin a control to configure ACS
using kernel parameter based on ACS value that FW has set (and not kernel).
-Tushar
Jason