• Russell King's avatar
    [ARM] Fix SMP booting with non-zero PHYS_OFFSET · 058ddee5
    Russell King authored
    The existing code tries to get the pmd for the temporary page table
    by doing:
    
            pgd = pgd_alloc(&init_mm);
            pmd = pmd_offset(pgd, PHYS_OFFSET);
    
    Since we have a two level page table, pmd_offset() is a no-op, so
    this just has a casting effect from a pgd to a pmd - the address
    argument is unused.  So this can't work.
    
    Normally, we'd do:
    
    	pgd = pgd_offset(&init_mm, PHYS_OFFSET);
    	...
    	pmd = pmd_offset(pgd, PHYS_OFFSET);
    
    to get the pmd you want.  However, pgd_offset() takes the mm_struct,
    not the (unattached) pgd we just allocated.  So, instead use:
    
            pgd = pgd_alloc(&init_mm);
            pmd = pmd_offset(pgd + pgd_index(PHYS_OFFSET), PHYS_OFFSET);
    Reported-by: default avatarAntti P Miettinen <ananaza@iki.fi>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    058ddee5
smp.c 13.1 KB