Thread (41 messages) 41 messages, 3 authors, 2025-07-10

Re: [PATCH v8 14/29] iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC ioctl

From: Nicolin Chen <hidden>
Date: 2025-07-09 18:55:35
Also in: linux-doc, linux-iommu, linux-kselftest, linux-patches, linux-tegra, lkml

On Wed, Jul 09, 2025 at 02:09:04PM -0300, Jason Gunthorpe wrote:
On Fri, Jul 04, 2025 at 06:13:30PM -0700, Nicolin Chen wrote:
quoted
+static struct iommufd_access *
+iommufd_hw_queue_alloc_phys(struct iommu_hw_queue_alloc *cmd,
+			    struct iommufd_viommu *viommu, phys_addr_t *base_pa)
+{
+	struct iommufd_access *access;
+	struct page **pages;
+	size_t max_npages;
+	size_t length;
+	u64 offset;
+	size_t i;
+	int rc;
+
+	offset =
+		cmd->nesting_parent_iova - PAGE_ALIGN(cmd->nesting_parent_iova);
PAGE_ALIGN is ALIGN UP, that is the wrong direction?

It is just:

      offset = cmd->nesting_parent_iova % PAGE_SIZE;

And this is missing:

	*base_pa = (page_to_pfn(pages[0]) << PAGE_SHIFT) + offset;

??
Yes, my bad. And I realized that all my testings are page aligned.
Maybe we could add an IOMMU_TEST_OP_HW_QUEUE_CHECK_ADDR..

Thanks
Nicolin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help