Re: [RFC/PATCH] powerpc: rework 4xx PTE access and TLB miss
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2008-06-11 02:43:26
quoted
#define _PAGE_PRESENT 0x00000001 /* S: PTE valid */ -#define _PAGE_RW 0x00000002 /* S: Write permission */ +#define _PAGE_RW 0x00000002 /* S: Write permission */ #define _PAGE_FILE 0x00000004 /* S: nonlinear file mapping */ +#define _PAGE_HWEXEC 0x00000004 /* H: Execute permission */I'm sure this is ok, but why can we overlay _PAGE_HWEXEC and _PAGE_FILE?
_PAGE_FILE is only meaningful for non present PTEs.
quoted
#define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */ -#define _PAGE_HWWRITE 0x00000010 /* H: Dirty & RW */ -#define _PAGE_HWEXEC 0x00000020 /* H: Execute permission */ -#define _PAGE_USER 0x00000040 /* S: User page */ -#define _PAGE_ENDIAN 0x00000080 /* H: E bit */ -#define _PAGE_GUARDED 0x00000100 /* H: G bit */ -#define _PAGE_DIRTY 0x00000200 /* S: Page dirty */ -#define _PAGE_NO_CACHE 0x00000400 /* H: I bit */ -#define _PAGE_WRITETHRU 0x00000800 /* H: W bit */ +#define _PAGE_DIRTY 0x00000010 /* S: Page dirty */why the gap?
There are tricks to simplify the TLB miss handlers here. WIMGE are in the natural position of the final tlbwe, _PAGE_PRESENT is in SR position, _PAGE_RW in SW and _PAGE_HWEXEC in SX. I then conditionally copy them down to the "U" bits when _PAGE_USER is set. This trick isn't as useful on FSL though as your MAS layout mixes up the protection bits in a less useful way. As to why _PAGE_USER is appended to WIMGE rather than _PAGE_DIRTY, well, it was one or the other, either way there would be a gap, which we can later use for _PAGE_EXEC. I'm also thinking about finding a bit for _PAGE_SPECIAL for fast_gup. Cheers, Ben.