[PATCH] Move from kseg0 to xkphys for 64 bit.
Jayachandran C.
c.jayachandran at gmail.com
Wed Aug 18 05:22:41 UTC 2010
On Wed, Aug 18, 2010 at 7:35 AM, Neel Natu <neelnatu at gmail.com> wrote:
> Hi JC,
>
> I have a few comments below.
Thanks for the review!
> Index: sys/mips/include/cpuregs.h
> ===================================================================
>
> +#define MIPS_XKPHYS_LARGEST_PHYS 0x10000000000
> +#define MIPS_XKPHYS_MASK 0x0ffffffffff
>
> Perhaps add a comment that this limit is less than that allowed by the
> architecture because we can only address 40 bits with our 3 levels of
> page tables.
This is the physical address size - XLRs limit is 1TB of physical
address (PABITS = 40), I guess the other processors will have a
similar size limit. I will see if I can get a better name that make
it clear.
> Don't these macros need a 'ULL' type qualifier as well?
This has to be ULL in 32 bit and UL in 64bit, I left it to the
compiler for now (which is probably incorrect, I need to check if
values will be promoted correctly in n32 if needed). But probably
using UINT64_C() from stdint.h is the better option? .
> Index: sys/mips/mips/pmap.c
> ===================================================================
>
> Do you need to maintain 'valid1' in 'local_sysmap' anymore? It seems we
> only check 'valid2' in pmap_lmem_unmap().
>
> static __inline pd_entry_t *
> pmap_pdpe_to_pde(pd_entry_t *pdpe, vm_offset_t va)
> {
> +
> return pdpe;
> }
>
> static __inline
> pd_entry_t *pmap_pde(pmap_t pmap, vm_offset_t va)
> {
> +
> return pmap_segmap(pmap, va);
> }
>
> Parentheses around the return value.
I thought I had got all the style(9) fixes, looks like I missed a
couple :( There are other places in the old code which needs this
too, I think I will fix all the returns in pmap.c.
> @@ -1032,7 +1080,11 @@
> pmap_grow_pte_page_cache()
> {
>
> +#ifdef __mips_n64
> + vm_contig_grow_cache(3, 0, 0xffffffffffUL);
> +#else
> vm_contig_grow_cache(3, 0, MIPS_KSEG0_LARGEST_PHYS);
> +#endif
> }
>
> Why not use MIPS_XPHYS_LARGEST_PHYS in the __mips_n64 case instead of using
> a literal value?
Will make these changes.
> best
> Neel
> On Mon, Aug 16, 2010 at 9:10 AM, Jayachandran C.
> <c.jayachandran at gmail.com> wrote:
>> I've attached the changes to move the 64bit port to use 64bit XKPHYS
>> mapping of the physical memory instead of the current KSEG0. With
>> this changes the 64bit port will use just one freelist, and can
>> allocate page table pages from anywhere in the memory.
>>
>> The changes are mainly to introduce macros like
>> MIPS_PHYS_TO_DIRECT(pa), MIPS_DIRECT_TO_PHYS(), which will use KSEG0
>> in 32 bit compilation and XKPHYS in 64 bit compilation. I also ended
>> up changing the macro based PMAP_LMEM_MAP1(), PMAP_LMEM_MAP2(),
>> PMAP_LMEM_UNMAP() to inline functions.
>>
>> I have also introduced a macro MIPS_DIRECT_MAPPABLE(pa), which will
>> further reduce the cases in which we will need to have a special case
>> for 64 bit compilation.
>>
>> Please let me know your comments.
JC.
More information about the freebsd-mips
mailing list