iommu/amd: Enable PCI features based on attached domain capability
authorVasant Hegde <vasant.hegde@amd.com>
Thu, 18 Apr 2024 10:33:53 +0000 (10:33 +0000)
committerJoerg Roedel <jroedel@suse.de>
Fri, 26 Apr 2024 10:16:00 +0000 (12:16 +0200)
commit25efbb055863079bbd47b32fc6d3c4a6f082daf1
tree6f740cd6307b1c13e7cd565befa03b4bd86f58e8
parentc9e8701132e6cc162d082e7dad8a2e9110f5f8fd
iommu/amd: Enable PCI features based on attached domain capability

Commit eda8c2860ab6 ("iommu/amd: Enable device ATS/PASID/PRI capabilities
independently") changed the way it enables device capability while
attaching devices. I missed to account the attached domain capability.
Meaning if domain is not capable of handling PASID/PRI (ex: paging
domain with v1 page table) then enabling device feature is not required.

This patch enables PASID/PRI only if domain is capable of handling SVA.
Also move pci feature enablement to do_attach() function so that we make
SVA capability in one place. Finally make PRI enable/disable functions as
static functions.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240418103400.6229-9-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/amd_iommu.h
drivers/iommu/amd/iommu.c