[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5799215-8b55-90a8-7ca4-35f85ffb5969@arm.com>
Date: Thu, 30 Jun 2022 09:21:42 +0100
From: Robin Murphy <robin.murphy@....com>
To: Nicolin Chen <nicolinc@...dia.com>, Yong Wu <yong.wu@...iatek.com>
Cc: "Tian, Kevin" <kevin.tian@...el.com>,
Jason Gunthorpe <jgg@...dia.com>,
Baolu Lu <baolu.lu@...ux.intel.com>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
"cohuck@...hat.com" <cohuck@...hat.com>,
"jordan@...micpenguin.net" <jordan@...micpenguin.net>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
"thierry.reding@...il.com" <thierry.reding@...il.com>,
"will@...nel.org" <will@...nel.org>,
"alyssa@...enzweig.io" <alyssa@...enzweig.io>,
"jean-philippe@...aro.org" <jean-philippe@...aro.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"zhang.lyra@...il.com" <zhang.lyra@...il.com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"jonathanh@...dia.com" <jonathanh@...dia.com>,
"yangyingliang@...wei.com" <yangyingliang@...wei.com>,
"orsonzhai@...il.com" <orsonzhai@...il.com>,
"gerald.schaefer@...ux.ibm.com" <gerald.schaefer@...ux.ibm.com>,
"linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"christophe.jaillet@...adoo.fr" <christophe.jaillet@...adoo.fr>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"dwmw2@...radead.org" <dwmw2@...radead.org>,
"marcan@...can.st" <marcan@...can.st>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"baolin.wang7@...il.com" <baolin.wang7@...il.com>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v3 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain
and device/group
On 2022-06-29 20:47, Nicolin Chen wrote:
> On Fri, Jun 24, 2022 at 03:19:43PM -0300, Jason Gunthorpe wrote:
>> On Fri, Jun 24, 2022 at 06:35:49PM +0800, Yong Wu wrote:
>>
>>>>> It's not used in VFIO context. "return 0" just satisfy the iommu
>>>>> framework to go ahead. and yes, here we only allow the shared
>>>>> "mapping-domain" (All the devices share a domain created
>>>>> internally).
>>
>> What part of the iommu framework is trying to attach a domain and
>> wants to see success when the domain was not actually attached ?
>>
>>>> What prevent this driver from being used in VFIO context?
>>>
>>> Nothing prevent this. Just I didn't test.
>>
>> This is why it is wrong to return success here.
>
> Hi Yong, would you or someone you know be able to confirm whether
> this "return 0" is still a must or not?
From memory, it is unfortunately required, due to this driver being in
the rare position of having to support multiple devices in a single
address space on 32-bit ARM. Since the old ARM DMA code doesn't
understand groups, the driver sets up its own canonical
dma_iommu_mapping to act like a default domain, but then has to politely
say "yeah OK" to arm_setup_iommu_dma_ops() for each device so that they
do all end up with the right DMA ops rather than dying in screaming
failure (the ARM code's per-device mappings then get leaked, but we
can't really do any better).
The whole mess disappears in the proper default domain conversion, but
in the meantime, it's still safe to assume that nobody's doing VFIO with
embedded display/video codec/etc. blocks that don't even have reset drivers.
Thanks,
Robin.
Powered by blists - more mailing lists