[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMQSlvlVEE3G4R/8@Asurada-Nvidia>
Date: Fri, 28 Jul 2023 12:10:14 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Yi Liu <yi.l.liu@...el.com>, Jason Gunthorpe <jgg@...dia.com>
CC: <joro@...tes.org>, <alex.williamson@...hat.com>,
<kevin.tian@...el.com>, <robin.murphy@....com>,
<baolu.lu@...ux.intel.com>, <cohuck@...hat.com>,
<eric.auger@...hat.com>, <kvm@...r.kernel.org>,
<mjrosato@...ux.ibm.com>, <chao.p.peng@...ux.intel.com>,
<yi.y.sun@...ux.intel.com>, <peterx@...hat.com>,
<jasowang@...hat.com>, <shameerali.kolothum.thodi@...wei.com>,
<lulu@...hat.com>, <suravee.suthikulpanit@....com>,
<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <zhenzhong.duan@...el.com>
Subject: Re: [PATCH v3 08/17] iommufd: IOMMU_HWPT_ALLOC allocation with user
data
On Fri, Jul 28, 2023 at 02:55:57PM -0300, Jason Gunthorpe wrote:
> On Mon, Jul 24, 2023 at 04:03:57AM -0700, Yi Liu wrote:
>
> > + switch (pt_obj->type) {
> > + case IOMMUFD_OBJ_IOAS:
> > + ioas = container_of(pt_obj, struct iommufd_ioas, obj);
> > + break;
> > + case IOMMUFD_OBJ_HW_PAGETABLE:
> > + /* pt_id points HWPT only when hwpt_type is !IOMMU_HWPT_TYPE_DEFAULT */
> > + if (cmd->hwpt_type == IOMMU_HWPT_TYPE_DEFAULT) {
> > + rc = -EINVAL;
> > + goto out_put_pt;
> > + }
> > +
> > + parent = container_of(pt_obj, struct iommufd_hw_pagetable, obj);
> > + /*
> > + * Cannot allocate user-managed hwpt linking to auto_created
> > + * hwpt. If the parent hwpt is already a user-managed hwpt,
> > + * don't allocate another user-managed hwpt linking to it.
> > + */
> > + if (parent->auto_domain || parent->parent) {
> > + rc = -EINVAL;
> > + goto out_put_pt;
> > + }
> > + ioas = parent->ioas;
>
> Why do we set ioas here? I would think it should be NULL.
>
> I think it is looking like a mistake to try and re-use
> iommufd_hw_pagetable_alloc() directly for the nested case. It should
> not have a IOAS argument, it should not do enforce_cc, or iopt_*
> functions
>
> So must of the function is removed. Probably better to make a new
> ioas-less function for the nesting case.
OK.
@Yi, along with the PATCH-6 (IOMMU_RESV_SW_MSI), I will rework
on this -- mainly breaking up NESTED hwpt with IOAS.
Thanks
Nic
Powered by blists - more mailing lists