All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@sifive.com>
To: Conor.Dooley@microchip.com, robin.murphy@arm.com, hch@lst.de
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
	iommu@lists.linux-foundation.org, sudip.mukherjee@sifive.com,
	jude.onyenegecha@sifive.com, m.szyprowski@samsung.com
Subject: Re: [PATCH] swiotlb: ensure io_tlb_default_mem spinlock always initialised
Date: Mon, 11 Jul 2022 13:45:44 +0100	[thread overview]
Message-ID: <7906385d-d3f5-113a-4d31-8e9564c3c6ab@sifive.com> (raw)
In-Reply-To: <fc216e29-7dfb-5265-33d1-b547b8b7bd52@microchip.com>

On 11/07/2022 12:52, Conor.Dooley@microchip.com wrote:
> 
> 
> 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.
> 
> 
> Out of curiosity Ben, can you shed any more light on the platform?

Not at the moment, sorry.


  reply	other threads:[~2022-07-11 12:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 17:08 [PATCH] swiotlb: ensure io_tlb_default_mem spinlock always initialised Ben Dooks
2022-07-08 20:32 ` Robin Murphy
2022-07-11  7:26   ` Ben Dooks
2022-07-11 10:07     ` Robin Murphy
2022-07-11 10:21       ` Christoph Hellwig
2022-07-11 10:24         ` Ben Dooks
2022-07-11 10:39           ` Christoph Hellwig
2022-07-11 10:42             ` Ben Dooks
2022-07-11 11:01               ` Robin Murphy
2022-07-11 11:52                 ` Conor.Dooley
2022-07-11 12:45                   ` Ben Dooks [this message]
2022-07-11 12:56                     ` Conor.Dooley
2022-07-11 12:54                 ` Ben Dooks
2022-07-11 13:40                   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7906385d-d3f5-113a-4d31-8e9564c3c6ab@sifive.com \
    --to=ben.dooks@sifive.com \
    --cc=Conor.Dooley@microchip.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=iommu@lists.linux.dev \
    --cc=jude.onyenegecha@sifive.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=sudip.mukherjee@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.