From: Florian Fainelli <f.fainelli@gmail.com>
To: Kevin Cernekee <cernekee@gmail.com>,
Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: mina86@mina86.com,
Linux MIPS Mailing List <linux-mips@linux-mips.org>,
Zubair.Kakakhel@imgtec.com, Ralf Baechle <ralf@linux-mips.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] MIPS: Flush cache after DMA_FROM_DEVICE for agressively speculative CPUs
Date: Thu, 14 May 2015 15:42:42 -0700 [thread overview]
Message-ID: <555524E2.6080700@gmail.com> (raw)
In-Reply-To: <CAJiQ=7CU+MyaypO-9Np8aChVpVX_Vobdtoytt0q4Vz7LY9qHsA@mail.gmail.com>
On 13/05/15 19:49, Kevin Cernekee wrote:
> On Wed, May 13, 2015 at 6:49 PM, Leonid Yegoshin
> <Leonid.Yegoshin@imgtec.com> wrote:
>> Some MIPS CPUs have an aggressive speculative load and may erroneuosly load
>> some cache line in the middle of DMA transaction. CPU discards result but cache
>> doesn't. If DMA happens from device then additional cache invalidation is needed
>> on that CPU's after DMA.
>>
>> Found in test.
>>
>> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
>> ---
>> arch/mips/mm/dma-default.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
>> index 609d1241b0c4..ccf49ecfbf8c 100644
>> --- a/arch/mips/mm/dma-default.c
>> +++ b/arch/mips/mm/dma-default.c
>> @@ -67,11 +67,13 @@ static inline struct page *dma_addr_to_page(struct device *dev,
>> * systems and only the R10000 and R12000 are used in such systems, the
>> * SGI IP28 Indigo² rsp. SGI IP32 aka O2.
>> */
>> -static inline int cpu_needs_post_dma_flush(struct device *dev)
>> +static inline int cpu_needs_post_dma_flush(struct device *dev,
>> + enum dma_data_direction direction)
>> {
>> return !plat_device_is_coherent(dev) &&
>> (boot_cpu_type() == CPU_R10000 ||
>> boot_cpu_type() == CPU_R12000 ||
>> + (cpu_has_maar && (direction != DMA_TO_DEVICE)) ||
>> boot_cpu_type() == CPU_BMIPS5000);
>
> Can all of these CPUs safely skip the post_dma_flush on DMA_TO_DEVICE
> (not just maar)?
Agreed that would seem like the logical thing to do. You could then just
skip the call to cpu_needs_post_dma_flush() and move the direction test
in arch/mips/mm/dma-default.c for instance?
--
Florian
prev parent reply other threads:[~2015-05-14 22:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-14 1:49 [PATCH] MIPS: Flush cache after DMA_FROM_DEVICE for agressively speculative CPUs Leonid Yegoshin
2015-05-14 2:49 ` Kevin Cernekee
2015-05-14 22:42 ` Florian Fainelli [this message]
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=555524E2.6080700@gmail.com \
--to=f.fainelli@gmail.com \
--cc=Leonid.Yegoshin@imgtec.com \
--cc=Zubair.Kakakhel@imgtec.com \
--cc=cernekee@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mina86@mina86.com \
--cc=ralf@linux-mips.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox