On 2022-12-09 00:44, Jason Gunthorpe wrote:
On Thu, Dec 08, 2022 at 02:48:25PM -0700, Alex Williamson wrote:
On Thu, 8 Dec 2022 16:26:29 -0400
Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
iommu_group_for_each_dev() exits the loop at the first callback that
returns 1 - thus returning 1 fails to check the rest of the devices in the
group.
msi_remap (aka secure MSI) requires that all the devices in the group
support it, not just any one. This is only a theoretical problem as no
current drivers will have different secure MSI properties within a group.
Which is exactly how Robin justified the behavior in the referenced
commit:
As with domains, any capability must in practice be consistent for
devices in a given group - and after all it's still the same
capability which was expected to be consistent across an entire bus!
- so there's no need for any complicated validation.
That suggests to me that it's intentional that we break if any device
supports the capability and therefore this isn't so much a "Fixes:", as
it is a refactoring expressly to support msi_device_has_secure_msi(),
which cannot make these sort of assumptions as a non-group API. Thanks,
Sure, lets drop the fixes and your analysis seems correct
Yup, Alex is spot on - the fact is that all the IOMMU drivers supporting
this cap have always returned global values, and continue to do so right
up until we remove it later, so there's really no benefit in pretending
otherwise. I'd say just fold this into patch #3 to keep it even simpler.
Thanks,
Robin.