The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: <will@kernel.org>, <joro@8bytes.org>, <iommu@lists.linux.dev>,
	<jgg@nvidia.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu: Sort out domain user data
Date: Fri, 28 Feb 2025 12:20:53 -0800	[thread overview]
Message-ID: <Z8IapaN1ZD0wImak@Asurada-Nvidia> (raw)
In-Reply-To: <4e68d5820be06adc1b34fc0d1c9399481151daee.1740742271.git.robin.murphy@arm.com>

On Fri, Feb 28, 2025 at 11:31:11AM +0000, Robin Murphy wrote:
> +enum iommu_domain_cookie_type {
> +	IOMMU_NO_COOKIE,
> +	IOMMU_DMA_IOVA_COOKIE,
> +	IOMMU_DMA_MSI_COOKIE,
> +	IOMMU_FAULT_HANDLER_COOKIE,
> +	IOMMU_SVA_COOKIE,

I would like to change them to IOMMU_COOKIE_* so the iommufd one
wouldn't feel redundant like "IOMMU_IOMMUFD_COOKIE".

If you don't mind, I will make the following list:
-	IOMMU_NO_COOKIE,
-	IOMMU_DMA_IOVA_COOKIE,
-	IOMMU_DMA_MSI_COOKIE,
-	IOMMU_FAULT_HANDLER_COOKIE,
-	IOMMU_SVA_COOKIE,
+	IOMMU_COOKIE_NONE,
+	IOMMU_COOKIE_DMA_IOVA,
+	IOMMU_COOKIE_DMA_MSI,
+	IOMMU_COOKIE_FAULT_HANDLER,
+	IOMMU_COOKIE_SVA,
+	IOMMU_COOKIE_IOMMUFD,

then:
diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index 7de6e914232e..227514030655 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -413,6 +413,7 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
                iommufd_put_object(ucmd->ictx, &fault->obj);
        }
        hwpt->domain->iommufd_hwpt = hwpt;
+       hwpt->domain->cookie_type = IOMMU_COOKIE_IOMMUFD;

        cmd->out_hwpt_id = hwpt->obj.id;
        rc = iommufd_ucmd_respond(ucmd, sizeof(*cmd));

And I can put this in my cleanup series v3, as Jason is asking.

Thanks
Nicolin

  parent reply	other threads:[~2025-02-28 20:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 11:31 [PATCH] iommu: Sort out domain user data Robin Murphy
2025-02-28 17:38 ` Jason Gunthorpe
2025-02-28 20:20 ` Nicolin Chen [this message]
2025-03-03 17:27   ` Jason Gunthorpe
2025-03-03 17:47     ` Robin Murphy

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=Z8IapaN1ZD0wImak@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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