[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YxqwQ+3OICPdEtk0@Asurada-Nvidia>
Date: Thu, 8 Sep 2022 20:17:23 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Joerg Roedel <joro@...tes.org>, Jason Gunthorpe <jgg@...dia.com>
CC: <will@...nel.org>, <robin.murphy@....com>,
<alex.williamson@...hat.com>, <suravee.suthikulpanit@....com>,
<marcan@...can.st>, <sven@...npeter.dev>, <alyssa@...enzweig.io>,
<robdclark@...il.com>, <dwmw2@...radead.org>,
<baolu.lu@...ux.intel.com>, <mjrosato@...ux.ibm.com>,
<gerald.schaefer@...ux.ibm.com>, <orsonzhai@...il.com>,
<baolin.wang@...ux.alibaba.com>, <zhang.lyra@...il.com>,
<thierry.reding@...il.com>, <vdumpa@...dia.com>,
<jonathanh@...dia.com>, <jean-philippe@...aro.org>,
<cohuck@...hat.com>, <tglx@...utronix.de>,
<shameerali.kolothum.thodi@...wei.com>,
<thunder.leizhen@...wei.com>, <christophe.jaillet@...adoo.fr>,
<yangyingliang@...wei.com>, <jon@...id-run.com>,
<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<asahi@...ts.linux.dev>, <linux-arm-kernel@...ts.infradead.org>,
<linux-arm-msm@...r.kernel.org>, <linux-s390@...r.kernel.org>,
<linux-tegra@...r.kernel.org>,
<virtualization@...ts.linux-foundation.org>, <kvm@...r.kernel.org>,
<kevin.tian@...el.com>
Subject: Re: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible
domain and device/group
On Thu, Sep 08, 2022 at 01:14:42PM -0300, Jason Gunthorpe wrote:
> > I am wondering if this can be solved by better defining what the return
> > codes mean and adjust the call-back functions to match the definition.
> > Something like:
> >
> > -ENODEV : Device not mapped my an IOMMU
> > -EBUSY : Device attached and domain can not be changed
> > -EINVAL : Device and domain are incompatible
> > ...
>
> Yes, this was gone over in a side thread the pros/cons, so lets do
> it. Nicolin will come with something along these lines.
I have started this effort by combining this list and the one from
the side thread:
@@ -266,6 +266,13 @@ struct iommu_ops {
/**
* struct iommu_domain_ops - domain specific operations
* @attach_dev: attach an iommu domain to a device
+ * Rules of its return errno:
+ * ENOMEM - Out of memory
+ * EINVAL - Device and domain are incompatible
+ * EBUSY - Device is attached to a domain and cannot be changed
+ * ENODEV - Device or domain is messed up: device is not mapped
+ * to an IOMMU, no domain can attach, and etc.
+ * <others> - Same behavior as ENODEV, use is discouraged
* @detach_dev: detach an iommu domain from a device
* @map: map a physically contiguous memory region to an iommu domain
* @map_pages: map a physically contiguous set of pages of the same size to
I am now going through every single return value of ->attach_dev to
make sure the list above applies. And I will also incorporate things
like Robin's comments at the AMD IOMMU driver.
And if the change occurs to be bigger, I guess that separating it to
be an IOMMU series from this VFIO one might be better.
Thanks
Nic
Powered by blists - more mailing lists