From: Nicolin Chen <nicolinc@nvidia.com>
To: <jgg@nvidia.com>, <kevin.tian@intel.com>, <tglx@linutronix.de>,
<maz@kernel.org>
Cc: <joro@8bytes.org>, <will@kernel.org>, <robin.murphy@arm.com>,
<shuah@kernel.org>, <iommu@lists.linux.dev>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kselftest@vger.kernel.org>, <eric.auger@redhat.com>,
<baolu.lu@linux.intel.com>, <yi.l.liu@intel.com>,
<yury.norov@gmail.com>, <jacob.pan@linux.microsoft.com>,
<patches@lists.linux.dev>
Subject: [PATCH v1 09/13] iommufd: Pass in idev to iopt_table_enforce_dev_resv_regions
Date: Sat, 8 Feb 2025 01:02:42 -0800 [thread overview]
Message-ID: <ee3e7827ffe8691dae09f7604161b5bc6d6393bc.1739005085.git.nicolinc@nvidia.com> (raw)
In-Reply-To: <cover.1739005085.git.nicolinc@nvidia.com>
The iopt_table_enforce_dev_resv_regions needs to access the sw_msi_start
and sw_msi_size stored in the idev, set by user space. So, pass in idev
pointer instead.
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
drivers/iommu/iommufd/iommufd_private.h | 2 +-
drivers/iommu/iommufd/device.c | 5 ++---
drivers/iommu/iommufd/io_pagetable.c | 3 ++-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h
index c0df549c7d34..7a9cc6e61152 100644
--- a/drivers/iommu/iommufd/iommufd_private.h
+++ b/drivers/iommu/iommufd/iommufd_private.h
@@ -115,7 +115,7 @@ int iopt_table_add_domain(struct io_pagetable *iopt,
void iopt_table_remove_domain(struct io_pagetable *iopt,
struct iommu_domain *domain);
int iopt_table_enforce_dev_resv_regions(struct io_pagetable *iopt,
- struct device *dev,
+ struct iommufd_device *idev,
phys_addr_t *sw_msi_start);
int iopt_set_allow_iova(struct io_pagetable *iopt,
struct rb_root_cached *allowed_iova);
diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index 882cc51a3feb..5ecd96c04e89 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -452,8 +452,7 @@ iommufd_device_attach_reserved_iova(struct iommufd_device *idev,
lockdep_assert_held(&idev->igroup->lock);
- rc = iopt_table_enforce_dev_resv_regions(&hwpt_paging->ioas->iopt,
- idev->dev,
+ rc = iopt_table_enforce_dev_resv_regions(&hwpt_paging->ioas->iopt, idev,
&idev->sw_msi_start);
if (rc)
return rc;
@@ -664,7 +663,7 @@ iommufd_device_do_replace_reserved_iova(struct iommufd_device *idev,
if (!old_hwpt_paging || hwpt_paging->ioas != old_hwpt_paging->ioas) {
list_for_each_entry(cur, &igroup->device_list, group_item) {
rc = iopt_table_enforce_dev_resv_regions(
- &hwpt_paging->ioas->iopt, cur->dev, NULL);
+ &hwpt_paging->ioas->iopt, cur, NULL);
if (rc)
goto err_unresv;
}
diff --git a/drivers/iommu/iommufd/io_pagetable.c b/drivers/iommu/iommufd/io_pagetable.c
index 8a790e597e12..441da0314a54 100644
--- a/drivers/iommu/iommufd/io_pagetable.c
+++ b/drivers/iommu/iommufd/io_pagetable.c
@@ -1423,9 +1423,10 @@ void iopt_remove_access(struct io_pagetable *iopt,
/* Narrow the valid_iova_itree to include reserved ranges from a device. */
int iopt_table_enforce_dev_resv_regions(struct io_pagetable *iopt,
- struct device *dev,
+ struct iommufd_device *idev,
phys_addr_t *sw_msi_start)
{
+ struct device *dev = idev->dev;
struct iommu_resv_region *resv;
LIST_HEAD(resv_regions);
unsigned int num_hw_msi = 0;
--
2.43.0
next prev parent reply other threads:[~2025-02-08 9:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-08 9:02 [PATCH v1 00/13] iommu: Add MSI mapping support with nested SMMU Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 01/13] genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie Nicolin Chen
2025-02-13 11:54 ` Thomas Gleixner
2025-02-13 13:57 ` Jason Gunthorpe
2025-02-13 21:34 ` Nicolin Chen
2025-02-13 20:28 ` Jacob Pan
2025-02-13 21:02 ` Nicolin Chen
2025-02-13 21:33 ` Jacob Pan
2025-02-08 9:02 ` [PATCH v1 02/13] genirq/msi: Rename iommu_dma_compose_msi_msg() to msi_msg_set_addr() Nicolin Chen
2025-02-13 12:11 ` Thomas Gleixner
2025-02-13 14:37 ` Jason Gunthorpe
2025-02-08 9:02 ` [PATCH v1 03/13] iommu: Make iommu_dma_prepare_msi() into a generic operation Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 04/13] irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by the irqchips that need it Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 05/13] iommu: Turn fault_data to iommufd private pointer Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 06/13] iommufd: Implement sw_msi support natively Nicolin Chen
2025-02-11 18:16 ` Jason Gunthorpe
2025-02-11 19:04 ` Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 07/13] iommu: Turn iova_cookie to dma-iommu private pointer Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 08/13] iommufd/device: Move sw_msi_start from igroup to idev Nicolin Chen
2025-02-09 18:41 ` Jason Gunthorpe
2025-02-10 23:25 ` Nicolin Chen
2025-02-08 9:02 ` Nicolin Chen [this message]
2025-02-08 9:02 ` [PATCH v1 10/13] iommufd: Add IOMMU_OPTION_SW_MSI_START/SIZE ioctls Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 11/13] iommufd/selftest: Add MOCK_FLAGS_DEVICE_NO_ATTACH Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 12/13] iommufd/selftest: Add a testing reserved region Nicolin Chen
2025-02-08 9:02 ` [PATCH v1 13/13] iommufd/selftest: Add coverage for IOMMU_OPTION_SW_MSI_START/SIZE Nicolin Chen
2025-02-19 13:37 ` [PATCH v1 00/13] iommu: Add MSI mapping support with nested SMMU Jason Gunthorpe
2025-02-19 16:06 ` Nicolin Chen
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=ee3e7827ffe8691dae09f7604161b5bc6d6393bc.1739005085.git.nicolinc@nvidia.com \
--to=nicolinc@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jacob.pan@linux.microsoft.com \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maz@kernel.org \
--cc=patches@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.com \
--cc=yury.norov@gmail.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
all inboxes | Powered by JetHome®