[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aA+5009M6QTjjIpO@Asurada-Nvidia>
Date: Mon, 28 Apr 2025 10:24:35 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>
CC: <jgg@...dia.com>, <kevin.tian@...el.com>, <corbet@....net>,
<will@...nel.org>, <bagasdotme@...il.com>, <robin.murphy@....com>,
<joro@...tes.org>, <thierry.reding@...il.com>, <vdumpa@...dia.com>,
<jonathanh@...dia.com>, <shuah@...nel.org>, <jsnitsel@...hat.com>,
<nathan@...nel.org>, <peterz@...radead.org>, <yi.l.liu@...el.com>,
<mshavit@...gle.com>, <praan@...gle.com>, <zhangzekun11@...wei.com>,
<iommu@...ts.linux.dev>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-tegra@...r.kernel.org>, <linux-kselftest@...r.kernel.org>,
<patches@...ts.linux.dev>, <mochs@...dia.com>, <alok.a.tiwari@...cle.com>,
<vasant.hegde@....com>
Subject: Re: [PATCH v2 05/22] iommufd: Add iommufd_struct_destroy to revert
iommufd_viommu_alloc
On Sun, Apr 27, 2025 at 02:55:40PM +0800, Baolu Lu wrote:
> On 4/26/25 13:58, Nicolin Chen wrote:
> > An IOMMU driver that allocated a vIOMMU may want to revert the allocation,
> > if it encounters an internal error after the allocation. So, there needs a
> > destroy helper for drivers to use.
>
> A brief explanation or a small code snippet illustrating a typical
> allocation and potential abort scenario would be helpful.
Will add the followings:
"
For instance:
static my_viommu_alloc()
{
...
my_viommu = iommufd_vcmdq_alloc(viomm, struct my_viommu, core);
...
ret = init_my_viommu();
if (ret) {
iommufd_struct_destroy(viommu->ictx, my_viommu, core);
return ERR_PTR(ret);
}
return &my_viommu->core;
}
"
Thanks
Nicolin
Powered by blists - more mailing lists