Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
On Thu, Jan 07, 2021 at 09:18:06AM +0800, Lu Baolu wrote: > The typical use case is > > if (iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)) { > rc = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX); > if (rc < 0) { > dev_warn(dev, "Failed to enable aux-domain: %d\n", > rc); > return rc; > } > } > > So please don't remove it. This doesn't have an upstream user, and did not have for years! If new users show up they can add it back. Note that the above API with a separate has vs enable is horrible anyway - the right way is to just enable and fail it with a specific error code if not supported. We have a general rule that APIs should only be introduced with their users, and this example just confirms the reasons of why that rule is in place once again.
Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
On 07/01/2021 01:18, Lu Baolu wrote: On 1/6/21 9:35 PM, John Garry wrote: Function iommu_dev_has_feature() has never been referenced in the tree, and there does not appear to be anything coming soon to use it, so delete it. Hi baolu, It will be used by the device driver which want to support the aux- domain capability, for example, below series is under discussion. https://lore.kernel.org/linux-pci/160408357912.912050.17005584526266191420.st...@djiang5-desk3.ch.intel.com/ So I did check linux-iommu lore for recent references, above, but did not see this one - that really should have cc'ed linux-iommu list (which it didn't). The typical use case is if (iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)) { rc = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX); if (rc < 0) { dev_warn(dev, "Failed to enable aux-domain: %d\n", rc); return rc; } } So please don't remove it. ok, fine. It also seems that this API has not had a user since it was introduced in v5.2. Thanks, John Ps. I suppose a v3 series is not needed ATM - this patch can just be dropped.
Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
On 1/6/21 9:35 PM, John Garry wrote: Function iommu_dev_has_feature() has never been referenced in the tree, and there does not appear to be anything coming soon to use it, so delete it. It will be used by the device driver which want to support the aux- domain capability, for example, below series is under discussion. https://lore.kernel.org/linux-pci/160408357912.912050.17005584526266191420.st...@djiang5-desk3.ch.intel.com/ The typical use case is if (iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)) { rc = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX); if (rc < 0) { dev_warn(dev, "Failed to enable aux-domain: %d\n", rc); return rc; } } So please don't remove it. Best regards, baolu Signed-off-by: John Garry --- drivers/iommu/iommu.c | 11 --- include/linux/iommu.h | 7 --- 2 files changed, 18 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 20201ef97b8f..91f7871f5a37 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2853,17 +2853,6 @@ EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids); /* * Per device IOMMU features. */ -bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat) -{ - const struct iommu_ops *ops = dev->bus->iommu_ops; - - if (ops && ops->dev_has_feat) - return ops->dev_has_feat(dev, feat); - - return false; -} -EXPORT_SYMBOL_GPL(iommu_dev_has_feature); - int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat) { const struct iommu_ops *ops = dev->bus->iommu_ops; diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 72059fcfa108..91d94c014f47 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -626,7 +626,6 @@ static inline void dev_iommu_priv_set(struct device *dev, void *priv) int iommu_probe_device(struct device *dev); void iommu_release_device(struct device *dev); -bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features f); int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f); int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f); bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features f); @@ -975,12 +974,6 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) return NULL; } -static inline bool -iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat) -{ - return false; -} - static inline bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat) {
[PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()
Function iommu_dev_has_feature() has never been referenced in the tree, and there does not appear to be anything coming soon to use it, so delete it. Signed-off-by: John Garry --- drivers/iommu/iommu.c | 11 --- include/linux/iommu.h | 7 --- 2 files changed, 18 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 20201ef97b8f..91f7871f5a37 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2853,17 +2853,6 @@ EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids); /* * Per device IOMMU features. */ -bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat) -{ - const struct iommu_ops *ops = dev->bus->iommu_ops; - - if (ops && ops->dev_has_feat) - return ops->dev_has_feat(dev, feat); - - return false; -} -EXPORT_SYMBOL_GPL(iommu_dev_has_feature); - int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat) { const struct iommu_ops *ops = dev->bus->iommu_ops; diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 72059fcfa108..91d94c014f47 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -626,7 +626,6 @@ static inline void dev_iommu_priv_set(struct device *dev, void *priv) int iommu_probe_device(struct device *dev); void iommu_release_device(struct device *dev); -bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features f); int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f); int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f); bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features f); @@ -975,12 +974,6 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) return NULL; } -static inline bool -iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat) -{ - return false; -} - static inline bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat) { -- 2.26.2