• Paul Mackerras's avatar
    powerpc/mm: Speed up computation of base and actual page size for a HPTE · 0eeede0c
    Paul Mackerras authored
    This replaces a 2-D search through an array with a simple 8-bit table
    lookup for determining the actual and/or base page size for a HPT entry.
    
    The encoding in the second doubleword of the HPTE is designed to encode
    the actual and base page sizes without using any more bits than would be
    needed for a 4k page number, by using between 1 and 8 low-order bits of
    the RPN (real page number) field to encode the page sizes.  A single
    "large page" bit in the first doubleword indicates that these low-order
    bits are to be interpreted like this.
    
    We can determine the page sizes by using the low-order 8 bits of the RPN
    to look up a 256-entry table.  For actual page sizes less than 1MB, some
    of the upper bits of these 8 bits are going to be real address bits, but
    we can cope with that by replicating the entries for those smaller page
    sizes.
    
    While we're at it, let's move the hpte_page_size() and hpte_base_page_size()
    functions from a KVM-specific header to a header for 64-bit HPT systems,
    since this computation doesn't have anything specifically to do with KVM.
    Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    0eeede0c
hash_utils_64.c 47.4 KB