Skip to content

Commit db44bd5

Browse files
weihuang-amdjoergroedel
authored andcommitted
iommu/amd: Add support for enabling/disabling IOMMU features
Add support for struct iommu_ops.dev_{enable/disable}_feat. Please note that the empty feature switches will be populated by subsequent patches. Signed-off-by: Wei Huang <wei.huang2@amd.com> Co-developed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20240418103400.6229-4-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent c5ebd09 commit db44bd5

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

drivers/iommu/amd/iommu.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,6 +2791,32 @@ static const struct iommu_dirty_ops amd_dirty_ops = {
27912791
.read_and_clear_dirty = amd_iommu_read_and_clear_dirty,
27922792
};
27932793

2794+
static int amd_iommu_dev_enable_feature(struct device *dev,
2795+
enum iommu_dev_features feat)
2796+
{
2797+
int ret;
2798+
2799+
switch (feat) {
2800+
default:
2801+
ret = -EINVAL;
2802+
break;
2803+
}
2804+
return ret;
2805+
}
2806+
2807+
static int amd_iommu_dev_disable_feature(struct device *dev,
2808+
enum iommu_dev_features feat)
2809+
{
2810+
int ret;
2811+
2812+
switch (feat) {
2813+
default:
2814+
ret = -EINVAL;
2815+
break;
2816+
}
2817+
return ret;
2818+
}
2819+
27942820
const struct iommu_ops amd_iommu_ops = {
27952821
.capable = amd_iommu_capable,
27962822
.domain_alloc = amd_iommu_domain_alloc,
@@ -2803,6 +2829,8 @@ const struct iommu_ops amd_iommu_ops = {
28032829
.is_attach_deferred = amd_iommu_is_attach_deferred,
28042830
.pgsize_bitmap = AMD_IOMMU_PGSIZES,
28052831
.def_domain_type = amd_iommu_def_domain_type,
2832+
.dev_enable_feat = amd_iommu_dev_enable_feature,
2833+
.dev_disable_feat = amd_iommu_dev_disable_feature,
28062834
.default_domain_ops = &(const struct iommu_domain_ops) {
28072835
.attach_dev = amd_iommu_attach_device,
28082836
.map_pages = amd_iommu_map_pages,

0 commit comments

Comments
 (0)