Subject: Re: [PATCH] 8xx: fix usage of pinned 8Mbyte TLB entries

From: Dan Malek <[email-masked]>
Date: Fri, 6 May 2005 18:49:11 -0400

On May 6, 2005, at 9:38 AM, Marcelo Tosatti wrote:

> 1) avoids the creation of pte tables in the 8Mbyte range, thus 
> preserving
> the pinned TLB entry.

This has nothing to do with "preserving" the pinned TLB entry.
The pinned entries are placed into the reserved portion of the TLB,
and are never evicted.  We never get a fault on these pages, so we
never look up an entry in the page table.  We need to create the
page tables for informational purposes, so software or debugger
lookups will do the right thing.

> 2) restricts bootmem to above 8Mbyte region

Why is this necessary?

> 3) Memory for DMA pages must not be in the pinned region. ie. drivers
> should not allocate memory directly for DMA purposes.

Why not?  It doesn't matter if we cover a VM space with a bunch of 4K
entries or a single 8M entry.   The physical pages are always going to
be multiple mapped, either through the mapin_ram() space or a single 8M
entry, and also through the vmalloc() space.  You just have to ensure,
in any case, that you don't access the pages through both VM spaces.

> Dan, I would really enjoy having access to some of your precious 8xx
> knowledge: share it, along with the correct way to fix this and the
> other pending issues.

The correct fix is rather simple, just make sure you configure the TLB
to reserve entries, and get the pinned entries into those reserved
entries.  I know I had it right once, I don't know what happened :-)

Just hang on and I'll get you some code to test ....

Thanks.

	-- Dan