Linux IOMMU Development
 help / color / mirror / Atom feed
From: Yi Liu <yi.l.liu@intel.com>
To: joro@8bytes.org, jgg@nvidia.com, kevin.tian@intel.com
Cc: nicolinc@nvidia.com, kvm@vger.kernel.org, yi.l.liu@intel.com,
	iommu@lists.linux.dev, baolu.lu@linux.intel.com
Subject: [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core
Date: Sun,  8 Sep 2024 04:42:56 -0700	[thread overview]
Message-ID: <20240908114256.979518-3-yi.l.liu@intel.com> (raw)
In-Reply-To: <20240908114256.979518-1-yi.l.liu@intel.com>

The IOMMU core sets the iommu_attach_handle->domain for the
iommu_attach_group_handle() path, while the iommu_replace_group_handle()
sets it on the caller side. Make the two paths aligned on it.

Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
 drivers/iommu/iommu.c         | 1 +
 drivers/iommu/iommufd/fault.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index ed6c5cb60c5a..83c8e617a2c5 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -3578,6 +3578,7 @@ int iommu_replace_group_handle(struct iommu_group *group,
 		ret = xa_reserve(&group->pasid_array, IOMMU_NO_PASID, GFP_KERNEL);
 		if (ret)
 			goto err_unlock;
+		handle->domain = new_domain;
 	}
 
 	ret = __iommu_group_set_domain(group, new_domain);
diff --git a/drivers/iommu/iommufd/fault.c b/drivers/iommu/iommufd/fault.c
index a643d5c7c535..c4715261f2c7 100644
--- a/drivers/iommu/iommufd/fault.c
+++ b/drivers/iommu/iommufd/fault.c
@@ -161,7 +161,6 @@ static int __fault_domain_replace_dev(struct iommufd_device *idev,
 		if (!handle)
 			return -ENOMEM;
 
-		handle->handle.domain = hwpt->domain;
 		handle->idev = idev;
 		ret = iommu_replace_group_handle(idev->igroup->group,
 						 hwpt->domain, &handle->handle);
-- 
2.34.1


  parent reply	other threads:[~2024-09-08 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-08 11:42 [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Yi Liu
2024-09-08 11:42 ` [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call Yi Liu
2024-09-09  7:29   ` Baolu Lu
2024-09-11  6:33   ` Tian, Kevin
2024-09-08 11:42 ` Yi Liu [this message]
2024-09-09  7:31   ` [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core Baolu Lu
2024-09-11  6:33   ` Tian, Kevin
2024-09-14 14:13 ` [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240908114256.979518-3-yi.l.liu@intel.com \
    --to=yi.l.liu@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox