• Yuri Nudelman's avatar
    habanalabs: hide memory manager page shift · 4e63ce6a
    Yuri Nudelman authored
    The new unified memory manager uses page offset to pass buffer handle
    during the mmap operation. One problem with this approach is that it
    requires the handle to always be divisible by the page size, else, the
    user would not be able to pass it correctly as an argument to the mmap
    system call.
    
    Previously, this was achieved by shifting the handle left after alloc
    operation, and shifting it right before get operation. This was done in
    the user code. This creates code duplication, and, what's worse,
    requires some knowledge from the user regarding the handle internal
    structure, hurting the encapsulation.
    
    This patch encloses all the page shifts inside memory manager functions.
    This way, the user can take the handle as a black box, and simply use
    it, without any concert about how it actually works.
    Signed-off-by: default avatarYuri Nudelman <ynudelman@habana.ai>
    Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
    Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    4e63ce6a
habanalabs.h 124 KB