lkml.org 
[lkml]   [2022]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] swiotlb: ensure io_tlb_default_mem spinlock always initialised
From
On 11/07/2022 12:01, Robin Murphy wrote:
> On 2022-07-11 11:42, Ben Dooks wrote:
>> On 11/07/2022 11:39, Christoph Hellwig wrote:
>>> On Mon, Jul 11, 2022 at 11:24:51AM +0100, Ben Dooks wrote:
>>>> On 11/07/2022 11:21, Christoph Hellwig wrote:
>>>>> On Mon, Jul 11, 2022 at 11:07:17AM +0100, Robin Murphy wrote:
>>>>>> If none of your peripherals should need SWIOTLB, then the fact that
>>>>>> you're ending up in swiotlb_map() at all is a clear sign that
>>>>>> something's wrong. Most likely someone's forgotten to set their DMA
>>>>>> masks correctly.
>>>>>
>>>>> Yes.
>>>>
>>>> Possibly, we had at least one driver which attempted to set a 32 bit
>>>> DMA mask which had to be removed as the DMA layer accepts this but
>>>> since there is no DMA32 memory the allocator then just fails.
>>>>
>>>> I expect the above may need to be a separate discussion(s) of how to
>>>> default the DMA mask and how to stop the implicit acceptance of setting
>>>> a 32-bit DMA mask.
>>>
>>> No.  Linux simply assumes you can do 32-bit DMA and this won't
>>> change.  So we'll need to fix your platform to support swiotlb
>>> eventually.
>>
>> Ok, is there any examples currently in the kernel that have no memory
>> in the DMA32 zone that do use swiotlb?
>
> The arm64 code originally made an assumption that a system with that
> kind of memory layout would use a DMA offset in the interconnect, and so
> placed ZONE_DMA32 in the first 4GB of available RAM rather than actual
> physical address space. The only relatively mainstream platform we
> subsequently saw with all RAM above 32 bits was AMD Seattle, which also
> *didn't* use a DMA offset, so it "worked" by virtue of this bodge in the
> sense that allocations didn't fail, but DMA transactions would then
> disappear off into nowhere when the device truncated the MSBs of
> whatever too-big DMA address it was given.
>
> I think that stuff's long gone by now, and if any of handful of
> remaining Seattle users plug in a 32-bit PCIe device and try to use it
> with the IOMMU disabled, they'll probably see the fireworks as intended.
>
> Much as we'd like to make DMA an explicit opt-in for all drivers, that's
> something which can only really be solved 30 years ago.

I need to go back and check through what we did to get some that worked
for us, and then come back and try and make some idea of how that is
best done with upstream kernel.

It might be possible for the PCIe controller to do some sort of very
simple IOMMU for the case where we might have somehow an PCI device
added to the system, but that is a very rare use-case I expect and
if someone does it they can do the effort of updating the PCIe code
and everything else that goes with it.

--
Ben

\
 
 \ /
  Last update: 2022-07-11 14:55    [W:0.075 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site