From: Ralf Baechle <ralf@linux-mips.org>
To: "Krzysztof Hałasa" <khalasa@piap.pl>
Cc: linux-mips@linux-mips.org, linux-media@vger.kernel.org
Subject: Re: Suspected cache coherency problem on V4L2 and AR7100 CPU
Date: Mon, 7 Oct 2013 16:24:29 +0200 [thread overview]
Message-ID: <20131007142429.GG3098@linux-mips.org> (raw)
In-Reply-To: <m361t9a31i.fsf@t19.piap.pl>
On Mon, Oct 07, 2013 at 10:38:49AM +0200, Krzysztof Hałasa wrote:
> Please forgive me my MIPS TLB ignorance.
May the manual be with you :-)
> It seems there is a TLB entry pointing to the userspace buffer at the
> time the kernel pointer (kseg0) is used. Is is an allowed situation on
> MIPS 24K?
>
> buffer: len 0x1000 (first page),
> userspace pointer 0x77327000,
> kernel pointer 0x867ac000 (physical address = 0x067ac000)
>
> TLB Index: 15 pgmask=4kb va=77326000 asid=be
> [pa=01149000 c=3 d=1 v=1 g=0] [pa=067ac000 c=3 d=1 v=1 g=0]
>
> Should the TLB entry be deleted before using the kernel pointer (which
> points at the same page)?
That's fine. You just need to ensure that there are no virtual aliases.
One way to do so is to increase the page size to 16kB.
Note that there is a variant of the 24K which has a VIPT cache but uses
hardware to resolve cache aliases. That is, from a kernel cache management
perspective it behaves like a PIPT cache.
However as I understand what you're mapping to userspace is actually
device memory, right? You probably want to map that uncached. That's a
long standing issue in these two macros:
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
#define xlate_dev_mem_ptr(p) __va(p)
/*
* Convert a virtual cached pointer to an uncached pointer
*/
#define xlate_dev_kmem_ptr(p) p
which are defined in arch/mips/include/asm/io.h. These should return
a KSEG1 (uncached XKPHYS) address for anything but RAM.
Would that explain your observations?
Ralf
next prev parent reply other threads:[~2013-10-07 14:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 14:00 Suspected cache coherency problem on V4L2 and AR7100 CPU Krzysztof Hałasa
2013-10-04 8:06 ` Krzysztof Hałasa
2013-10-07 8:38 ` Krzysztof Hałasa
2013-10-07 14:24 ` Ralf Baechle [this message]
2013-10-08 8:24 ` Krzysztof Hałasa
2013-10-08 12:07 ` Ralf Baechle
2013-10-09 6:53 ` Krzysztof Hałasa
2013-10-09 8:17 ` Ralf Baechle
2013-10-09 13:05 ` Krzysztof Hałasa
2013-10-08 10:46 ` Krzysztof Hałasa
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=20131007142429.GG3098@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=khalasa@piap.pl \
--cc=linux-media@vger.kernel.org \
--cc=linux-mips@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