On Fri, May 25, 2018 at 09:39:59AM +0100, Jonathan Cameron wrote: > Date: Fri, 25 May 2018 09:39:59 +0100 > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > To: Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx> > CC: Jean-Philippe Brucker <jean-philippe.brucker@xxxxxxx>, > "xieyisheng1@xxxxxxxxxx" <xieyisheng1@xxxxxxxxxx>, "kvm@xxxxxxxxxxxxxxx" > <kvm@xxxxxxxxxxxxxxx>, "linux-pci@xxxxxxxxxxxxxxx" > <linux-pci@xxxxxxxxxxxxxxx>, "xuzaibo@xxxxxxxxxx" <xuzaibo@xxxxxxxxxx>, > Will Deacon <Will.Deacon@xxxxxxx>, "okaya@xxxxxxxxxxxxxx" > <okaya@xxxxxxxxxxxxxx>, "linux-mm@xxxxxxxxx" <linux-mm@xxxxxxxxx>, > "yi.l.liu@xxxxxxxxx" <yi.l.liu@xxxxxxxxx>, "ashok.raj@xxxxxxxxx" > <ashok.raj@xxxxxxxxx>, "tn@xxxxxxxxxxxx" <tn@xxxxxxxxxxxx>, > "joro@xxxxxxxxxx" <joro@xxxxxxxxxx>, "robdclark@xxxxxxxxx" > <robdclark@xxxxxxxxx>, "bharatku@xxxxxxxxxx" <bharatku@xxxxxxxxxx>, > "linux-acpi@xxxxxxxxxxxxxxx" <linux-acpi@xxxxxxxxxxxxxxx>, > "liudongdong3@xxxxxxxxxx" <liudongdong3@xxxxxxxxxx>, "rfranz@xxxxxxxxxx" > <rfranz@xxxxxxxxxx>, "devicetree@xxxxxxxxxxxxxxx" > <devicetree@xxxxxxxxxxxxxxx>, "kevin.tian@xxxxxxxxx" > <kevin.tian@xxxxxxxxx>, Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>, > "alex.williamson@xxxxxxxxxx" <alex.williamson@xxxxxxxxxx>, > "rgummal@xxxxxxxxxx" <rgummal@xxxxxxxxxx>, "thunder.leizhen@xxxxxxxxxx" > <thunder.leizhen@xxxxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" > <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, "shunyong.yang@xxxxxxxxxxxxxxxx" > <shunyong.yang@xxxxxxxxxxxxxxxx>, "dwmw2@xxxxxxxxxxxxx" > <dwmw2@xxxxxxxxxxxxx>, "liubo95@xxxxxxxxxx" <liubo95@xxxxxxxxxx>, > "jcrouse@xxxxxxxxxxxxxx" <jcrouse@xxxxxxxxxxxxxx>, > "iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx" <iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx>, > Robin Murphy <Robin.Murphy@xxxxxxx>, "christian.koenig@xxxxxxx" > <christian.koenig@xxxxxxx>, "nwatters@xxxxxxxxxxxxxx" > <nwatters@xxxxxxxxxxxxxx>, "baolu.lu@xxxxxxxxxxxxxxx" > <baolu.lu@xxxxxxxxxxxxxxx>, liguozhu@xxxxxxxxxxxxx, > kenneth-lee-2012@xxxxxxxxxxx > Subject: Re: [PATCH v2 03/40] iommu/sva: Manage process address spaces > Message-ID: <20180525093959.000040a7@xxxxxxxxxx> > Organization: Huawei > X-Mailer: Claws Mail 3.15.0 (GTK+ 2.24.31; x86_64-w64-mingw32) > > +CC Kenneth Lee > > On Fri, 25 May 2018 09:33:11 +0300 > Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx> wrote: > > > On Thu, May 24, 2018 at 04:04:39PM +0100, Jean-Philippe Brucker wrote: > > > On 24/05/18 12:50, Ilias Apalodimas wrote: > > > >> Interesting, I hadn't thought about this use-case before. At first I > > > >> thought you were talking about mdev devices assigned to VMs, but I think > > > >> you're referring to mdevs assigned to userspace drivers instead? Out of > > > >> curiosity, is it only theoretical or does someone actually need this? > > > > > > > > There has been some non upstreamed efforts to have mdev and produce userspace > > > > drivers. Huawei is using it on what they call "wrapdrive" for crypto devices and > > > > we did a proof of concept for ethernet interfaces. At the time we choose not to > > > > involve the IOMMU for the reason you mentioned, but having it there would be > > > > good. > > > > > > I'm guessing there were good reasons to do it that way but I wonder, is > > > it not simpler to just have the kernel driver create a /dev/foo, with a > > > standard ioctl/mmap/poll interface? Here VFIO adds a layer of > > > indirection, and since the mediating driver has to implement these > > > operations already, what is gained? > > The best reason i can come up with is "common code". You already have one API > > doing that for you so we replicate it in a /dev file? > > The mdev approach still needs extentions to support what we tried to do (i.e > > mdev bus might need yo have access on iommu_ops), but as far as i undestand it's > > a possible case. Hi, Jean, Please allow me to share my understanding here: https://zhuanlan.zhihu.com/p/35489035 The reason we do not use the /dev/foo scheme is that the devices to be shared are programmable accelerators. We cannot fix up the kernel driver for them. > > > > > > Thanks, > > > Jean > > (p.s. I sent this mail on May 26 from my public email count. But it seems the email server is blocked. I resent it from my company count until my colleague told me just now. Sorry for inconvenience) -- -Kenneth(Hisilicon)