[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aDETLwnxlt8PpHo3@Asurada-Nvidia>
Date: Fri, 23 May 2025 17:30:39 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
CC: "jgg@...dia.com" <jgg@...dia.com>, "corbet@....net" <corbet@....net>,
"will@...nel.org" <will@...nel.org>, "bagasdotme@...il.com"
<bagasdotme@...il.com>, "robin.murphy@....com" <robin.murphy@....com>,
"joro@...tes.org" <joro@...tes.org>, "thierry.reding@...il.com"
<thierry.reding@...il.com>, "vdumpa@...dia.com" <vdumpa@...dia.com>,
"jonathanh@...dia.com" <jonathanh@...dia.com>, "shuah@...nel.org"
<shuah@...nel.org>, "jsnitsel@...hat.com" <jsnitsel@...hat.com>,
"nathan@...nel.org" <nathan@...nel.org>, "peterz@...radead.org"
<peterz@...radead.org>, "Liu, Yi L" <yi.l.liu@...el.com>,
"mshavit@...gle.com" <mshavit@...gle.com>, "praan@...gle.com"
<praan@...gle.com>, "zhangzekun11@...wei.com" <zhangzekun11@...wei.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-tegra@...r.kernel.org"
<linux-tegra@...r.kernel.org>, "linux-kselftest@...r.kernel.org"
<linux-kselftest@...r.kernel.org>, "patches@...ts.linux.dev"
<patches@...ts.linux.dev>, "mochs@...dia.com" <mochs@...dia.com>,
"alok.a.tiwari@...cle.com" <alok.a.tiwari@...cle.com>, "vasant.hegde@....com"
<vasant.hegde@....com>, "dwmw2@...radead.org" <dwmw2@...radead.org>,
"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>
Subject: Re: [PATCH v5 14/29] iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC
ioctl
On Fri, May 23, 2025 at 08:00:02AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@...dia.com>
> > Sent: Sunday, May 18, 2025 11:22 AM
> >
> > + * @nesting_parent_iova: Base address of the queue memory in the guest
> > physical
> > + * address space
>
> 'nesting_parent' is a bit redundant. 'iova' should be sufficient as it
> implies a s2 input address.
Hmm, Jason suggested to highlight "nesting_parent":
https://lore.kernel.org/all/20250515160620.GJ382960@nvidia.com/
>
> > + * @length: Length of the queue memory
> > + *
> > + * Allocate a HW queue object for a vIOMMU-specific HW-accelerated
> > queue, which
> > + * allows HW to access a guest queue memory described using
> > @nesting_parent_iova
> > + * and @length.
> > + *
> > + * Upon success, the underlying physical pages of the guest queue memory
> > will be
> > + * pinned to prevent VMM from unmapping them in the IOAS until the HW
> > queue gets
> > + * destroyed.
>
> This is conditional.
Yea, forgot to delete that.
>
> > +void iommufd_hw_queue_destroy(struct iommufd_object *obj)
> > +{
> > + struct iommufd_hw_queue *hw_queue =
> > + container_of(obj, struct iommufd_hw_queue, obj);
> > + struct iommufd_viommu *viommu = hw_queue->viommu;
> > +
> > + if (viommu->ops->hw_queue_destroy)
> > + viommu->ops->hw_queue_destroy(hw_queue);
> > + iopt_unpin_pages(&viommu->hwpt->ioas->iopt, hw_queue-
> > >base_addr,
> > + hw_queue->length, true);
>
> Check the flag
Oh, right! Will fix.
> > +
> > + /* Validate if the underlying physical pages are contiguous */
> > + for (i = 1; i < max_npages && pages[i]; i++) {
>
> Page[i] must be valid otherwise it's a bug?
Yea, I think so. We can drop this pages[i].
Thanks!
Nicolin
Powered by blists - more mailing lists