• Chris Smart's avatar
    powerpc: Add support for userspace P9 copy paste · 8a649045
    Chris Smart authored
    The copy paste facility introduced in POWER9 provides an optimised
    mechanism for a userspace application to copy a cacheline. This is
    provided by a pair of instructions, copy and paste, while a third,
    cp_abort (copy paste abort), provides a clean up of the state in case of
    a failure.
    
    The copy instruction will read a 128 byte cacheline and store it in an
    internal buffer. The subsequent paste instruction will store this
    internal buffer to memory and set a CR field if the paste succeeds.
    
    Since the state of the copy paste buffer is internal (and not
    architecturally visible), in the unlikely event of a context switch, the
    state cannot be stored and the paste should therefore fail.
    
    The cp_abort instruction exists to fail and clean up any such
    interrupted copy paste sequence and is to be called by the kernel as
    part of the context switch. Doing so prevents data from a preceding copy
    in one process leaking into the paste of another.
    
    This code enables use of the cp_abort instruction if a supported
    processor is detected.
    
    NOTE: this is for userspace only, not in kernel, and does not deal
    with KVM guests.
    
    Patch created with much assistance from Michael Neuling
    <mikey@neuling.org>
    Signed-off-by: default avatarChris Smart <chris@distroguy.com>
    Reviewed-by: default avatarCyril Bur <cyrilbur@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    8a649045
ppc-opcode.h 13.6 KB