Hi,

On 2020/2/17 5:57, Sai Praneeth Prakhya wrote:
The functionality needed for iommu_ops->dev_def_domain_type() is already
provided by device_def_domain_type() in intel_iommu.c. But, every call back
function in intel_iommu_ops starts with intel_iommu prefix, hence rename
device_def_domain_type() to intel_iommu_dev_def_domain_type() so that it
follows the same semantics.

How about keep device_def_domain_type() and call it in the new
intel_iommu_dev_def_domain_type()?

Best regards,
baolu


Cc: Christoph Hellwig <h...@lst.de>
Cc: Joerg Roedel <j...@8bytes.org>
Cc: Ashok Raj <ashok....@intel.com>
Cc: Will Deacon <will.dea...@arm.com>
Cc: Lu Baolu <baolu...@linux.intel.com>
Cc: Sohil Mehta <sohil.me...@intel.com>
Cc: Robin Murphy <robin.mur...@arm.com>
Cc: Jacob Pan <jacob.jun....@linux.intel.com>
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com>
---
  drivers/iommu/intel-iommu.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 64ddccf1d5fe..68f10d271ac0 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3034,7 +3034,7 @@ static bool device_is_rmrr_locked(struct device *dev)
   *  - IOMMU_DOMAIN_IDENTITY: device requires an identical mapping domain
   *  - 0: both identity and dynamic domains work for this device
   */
-static int device_def_domain_type(struct device *dev)
+static int intel_iommu_dev_def_domain_type(struct device *dev)
  {
        if (dev_is_pci(dev)) {
                struct pci_dev *pdev = to_pci_dev(dev);
@@ -5796,7 +5796,8 @@ static int intel_iommu_add_device(struct device *dev)
        domain = iommu_get_domain_for_dev(dev);
        dmar_domain = to_dmar_domain(domain);
        if (domain->type == IOMMU_DOMAIN_DMA) {
-               if (device_def_domain_type(dev) == IOMMU_DOMAIN_IDENTITY) {
+               if (intel_iommu_dev_def_domain_type(dev) ==
+                   IOMMU_DOMAIN_IDENTITY) {
                        ret = iommu_request_dm_for_dev(dev);
                        if (ret) {
                                dmar_remove_one_dev_info(dev);
@@ -5807,7 +5808,7 @@ static int intel_iommu_add_device(struct device *dev)
                        }
                }
        } else {
-               if (device_def_domain_type(dev) == IOMMU_DOMAIN_DMA) {
+               if (intel_iommu_dev_def_domain_type(dev) == IOMMU_DOMAIN_DMA) {
                        ret = iommu_request_dma_domain_for_dev(dev);
                        if (ret) {
                                dmar_remove_one_dev_info(dev);
@@ -6194,6 +6195,7 @@ const struct iommu_ops intel_iommu_ops = {
        .dev_enable_feat        = intel_iommu_dev_enable_feat,
        .dev_disable_feat       = intel_iommu_dev_disable_feat,
        .is_attach_deferred     = intel_iommu_is_attach_deferred,
+       .dev_def_domain_type    = intel_iommu_dev_def_domain_type,
        .pgsize_bitmap          = INTEL_IOMMU_PGSIZES,
  };
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to