Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iommu/amd: Introduce struct amd_iommu_viommu

Which stores reference to nested parent domain assigned during the call to
struct iommu_ops.viommu_init(). Information in the nest parent is needed
when setting up the nested translation.

Note that the viommu initialization will be introduced in subsequent
commit.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

authored by

Suravee Suthikulpanit and committed by
Joerg Roedel
e113a725 b43a29de

+29
+6
drivers/iommu/amd/amd_iommu_types.h
··· 17 17 #include <linux/list.h> 18 18 #include <linux/spinlock.h> 19 19 #include <linux/pci.h> 20 + #include <linux/iommufd.h> 20 21 #include <linux/irqreturn.h> 21 22 #include <linux/generic_pt/iommu.h> 22 23 ··· 494 493 struct pdom_iommu_info { 495 494 struct amd_iommu *iommu; /* IOMMUs attach to protection domain */ 496 495 u32 refcnt; /* Count of attached dev/pasid per domain/IOMMU */ 496 + }; 497 + 498 + struct amd_iommu_viommu { 499 + struct iommufd_viommu core; 500 + struct protection_domain *parent; /* nest parent domain for this viommu */ 497 501 }; 498 502 499 503 /*
+2
drivers/iommu/amd/iommu.c
··· 3120 3120 .is_attach_deferred = amd_iommu_is_attach_deferred, 3121 3121 .def_domain_type = amd_iommu_def_domain_type, 3122 3122 .page_response = amd_iommu_page_response, 3123 + .get_viommu_size = amd_iommufd_get_viommu_size, 3124 + .viommu_init = amd_iommufd_viommu_init, 3123 3125 }; 3124 3126 3125 3127 #ifdef CONFIG_IRQ_REMAP
+16
drivers/iommu/amd/iommufd.c
··· 29 29 30 30 return hwinfo; 31 31 } 32 + 33 + size_t amd_iommufd_get_viommu_size(struct device *dev, enum iommu_viommu_type viommu_type) 34 + { 35 + return VIOMMU_STRUCT_SIZE(struct amd_iommu_viommu, core); 36 + } 37 + 38 + int amd_iommufd_viommu_init(struct iommufd_viommu *viommu, struct iommu_domain *parent, 39 + const struct iommu_user_data *user_data) 40 + { 41 + struct protection_domain *pdom = to_pdomain(parent); 42 + struct amd_iommu_viommu *aviommu = container_of(viommu, struct amd_iommu_viommu, core); 43 + 44 + aviommu->parent = pdom; 45 + 46 + return 0; 47 + }
+5
drivers/iommu/amd/iommufd.h
··· 8 8 9 9 #if IS_ENABLED(CONFIG_AMD_IOMMU_IOMMUFD) 10 10 void *amd_iommufd_hw_info(struct device *dev, u32 *length, u32 *type); 11 + size_t amd_iommufd_get_viommu_size(struct device *dev, enum iommu_viommu_type viommu_type); 12 + int amd_iommufd_viommu_init(struct iommufd_viommu *viommu, struct iommu_domain *parent, 13 + const struct iommu_user_data *user_data); 11 14 #else 12 15 #define amd_iommufd_hw_info NULL 16 + #define amd_iommufd_viommu_init NULL 17 + #define amd_iommufd_get_viommu_size NULL 13 18 #endif /* CONFIG_AMD_IOMMU_IOMMUFD */ 14 19 15 20 #endif /* AMD_IOMMUFD_H */