[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276B1C7B8827EE2102824998C98A@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Fri, 23 May 2025 08:00:02 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Nicolin Chen <nicolinc@...dia.com>, "jgg@...dia.com" <jgg@...dia.com>,
"corbet@....net" <corbet@....net>, "will@...nel.org" <will@...nel.org>
CC: "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
> 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.
> + * @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.
> +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
> +
> + /* 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?
Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Powered by blists - more mailing lists