lkml.org 
[lkml]   [2017]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v9 05/51] powerpc: helper function to read,write AMR,IAMR,UAMOR registers
    Date
    Implements helper functions to read and write the key related
    registers; AMR, IAMR, UAMOR.

    AMR register tracks the read,write permission of a key
    IAMR register tracks the execute permission of a key
    UAMOR register enables and disables a key

    Acked-by: Balbir Singh <bsingharora@gmail.com>
    Reviewed-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
    Signed-off-by: Ram Pai <linuxram@us.ibm.com>
    ---
    arch/powerpc/mm/pkeys.c | 36 ++++++++++++++++++++++++++++++++++++
    1 files changed, 36 insertions(+), 0 deletions(-)

    diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
    index 512bdf2..b6bdfdf 100644
    --- a/arch/powerpc/mm/pkeys.c
    +++ b/arch/powerpc/mm/pkeys.c
    @@ -61,3 +61,39 @@ void __init pkey_initialize(void)
    for (i = 2; i < (pkeys_total - os_reserved); i++)
    initial_allocation_mask &= ~(0x1 << i);
    }
    +
    +static inline u64 read_amr(void)
    +{
    + return mfspr(SPRN_AMR);
    +}
    +
    +static inline void write_amr(u64 value)
    +{
    + mtspr(SPRN_AMR, value);
    +}
    +
    +static inline u64 read_iamr(void)
    +{
    + if (!likely(pkey_execute_disable_supported))
    + return 0x0UL;
    +
    + return mfspr(SPRN_IAMR);
    +}
    +
    +static inline void write_iamr(u64 value)
    +{
    + if (!likely(pkey_execute_disable_supported))
    + return;
    +
    + mtspr(SPRN_IAMR, value);
    +}
    +
    +static inline u64 read_uamor(void)
    +{
    + return mfspr(SPRN_UAMOR);
    +}
    +
    +static inline void write_uamor(u64 value)
    +{
    + mtspr(SPRN_UAMOR, value);
    +}
    --
    1.7.1
    \
     
     \ /
      Last update: 2017-11-06 10:40    [W:3.825 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site