Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1698307 > unrolled thread

Re: [RFC v6 15/62] powerpc: helper functions to initialize AMR, IAMR and UMOR registers

Started byThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
First post2017-07-27 22:50 +0200
Last post2017-07-30 02:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC v6 15/62] powerpc: helper functions to initialize AMR, IAMR and UMOR registers Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-07-27 22:50 +0200
    Re: [RFC v6 15/62] powerpc: helper functions to initialize AMR, IAMR  and UMOR registers Ram Pai <linuxram@us.ibm.com> - 2017-07-30 02:40 +0200

#1698307 — Re: [RFC v6 15/62] powerpc: helper functions to initialize AMR, IAMR and UMOR registers

FromThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Date2017-07-27 22:50 +0200
SubjectRe: [RFC v6 15/62] powerpc: helper functions to initialize AMR, IAMR and UMOR registers
Message-ID<u7XTl-2wS-21@gated-at.bofh.it>
Ram Pai <linuxram@us.ibm.com> writes:

> Introduce helper functions that can initialize the bits in the AMR,
> IAMR and UMOR register; the bits that correspond to the given pkey.
>
> Signed-off-by: Ram Pai <linuxram@us.ibm.com>

s/UMOR/UAMOR/ here and in the subject as well.

> --- a/arch/powerpc/mm/pkeys.c
> +++ b/arch/powerpc/mm/pkeys.c
> @@ -16,3 +16,47 @@
>  #include <linux/pkeys.h>                /* PKEY_*                       */
>
>  bool pkey_inited;
> +#define pkeyshift(pkey) ((arch_max_pkey()-pkey-1) * AMR_BITS_PER_PKEY)
> +
> +static inline void init_amr(int pkey, u8 init_bits)
> +{
> +	u64 new_amr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey));
> +	u64 old_amr = read_amr() & ~((u64)(0x3ul) << pkeyshift(pkey));
> +
> +	write_amr(old_amr | new_amr_bits);
> +}
> +
> +static inline void init_iamr(int pkey, u8 init_bits)
> +{
> +	u64 new_iamr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey));
> +	u64 old_iamr = read_iamr() & ~((u64)(0x3ul) << pkeyshift(pkey));
> +
> +	write_amr(old_iamr | new_iamr_bits);
> +}

init_iamr should call write_iamr, not write_amr.

-- 
Thiago Jung Bauermann
IBM Linux Technology Center

[toc] | [next] | [standalone]


#1699399 — Re: [RFC v6 15/62] powerpc: helper functions to initialize AMR, IAMR and UMOR registers

FromRam Pai <linuxram@us.ibm.com>
Date2017-07-30 02:40 +0200
SubjectRe: [RFC v6 15/62] powerpc: helper functions to initialize AMR, IAMR and UMOR registers
Message-ID<u8Kr0-1nn-5@gated-at.bofh.it>
In reply to#1698307
On Thu, Jul 27, 2017 at 05:40:44PM -0300, Thiago Jung Bauermann wrote:
> 
> Ram Pai <linuxram@us.ibm.com> writes:
> 
> > Introduce helper functions that can initialize the bits in the AMR,
> > IAMR and UMOR register; the bits that correspond to the given pkey.
> >
> > Signed-off-by: Ram Pai <linuxram@us.ibm.com>
> 
> s/UMOR/UAMOR/ here and in the subject as well.

yes. fixed it.

> 
> > --- a/arch/powerpc/mm/pkeys.c
> > +++ b/arch/powerpc/mm/pkeys.c
> > @@ -16,3 +16,47 @@
> >  #include <linux/pkeys.h>                /* PKEY_*                       */
> >
> >  bool pkey_inited;
> > +#define pkeyshift(pkey) ((arch_max_pkey()-pkey-1) * AMR_BITS_PER_PKEY)
> > +
> > +static inline void init_amr(int pkey, u8 init_bits)
> > +{
> > +	u64 new_amr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey));
> > +	u64 old_amr = read_amr() & ~((u64)(0x3ul) << pkeyshift(pkey));
> > +
> > +	write_amr(old_amr | new_amr_bits);
> > +}
> > +
> > +static inline void init_iamr(int pkey, u8 init_bits)
> > +{
> > +	u64 new_iamr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey));
> > +	u64 old_iamr = read_iamr() & ~((u64)(0x3ul) << pkeyshift(pkey));
> > +
> > +	write_amr(old_iamr | new_iamr_bits);
> > +}
> 
> init_iamr should call write_iamr, not write_amr.

excellent catch. thanks.
RP

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web