[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiKAdWpSav4+qYT4_LDSQm=7pO8RqKEoQoJsyDVtTCk3Q@mail.gmail.com>
Date: Thu, 10 Jun 2021 12:41:26 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Horia Geantă <horia.geanta@....com>,
Christoph Hellwig <hch@....de>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc: Dominique MARTINET <dominique.martinet@...ark-techno.com>,
Jianxiong Gao <jxgao@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Lukas Hartmann <lukas@...mn.com>,
Aymen Sghaier <aymen.sghaier@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>
Subject: Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)
On Thu, Jun 10, 2021 at 7:52 AM Horia Geantă <horia.geanta@....com> wrote:
>
> Documentation/core-api/dma-api.rst explicitly allows for partial syncs:
> Synchronise a single contiguous or scatter/gather mapping for the CPU
> and device. With the sync_sg API, all the parameters must be the same
> as those passed into the single mapping API. With the sync_single API,
> you can use dma_handle and size parameters that aren't identical to
> those passed into the single mapping API to do a partial sync.
>
> AFAICS commit 16fc3cef33a0 ("swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single")
> is breaking this functionality.
How about a patch like the attached? Does that fix things for you.
Christoph? Comments - that commit removed the offset calculation
entirely, because the old
(unsigned long)tlb_addr & (IO_TLB_SIZE - 1)
was wrong, but instead of removing it, I think it should have just
fixed it to be
(tlb_addr - mem->start) & (IO_TLB_SIZE - 1);
instead. That way the slot offset always matches the slot index calculation.
I also made it then take the offset into account for the alloc_size checks.
Does this UNTESTED patch perhaps do the right thing?
Linus
View attachment "patch.diff" of type "text/x-patch" (1130 bytes)
Powered by blists - more mailing lists