public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: will.deacon@arm•com (Will Deacon)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCHv3 1/2] arm64: Introduce {set,clear}_pte_bit
Date: Tue, 19 Aug 2014 13:06:42 +0100	[thread overview]
Message-ID: <20140819120642.GB23128@arm.com> (raw)
In-Reply-To: <1407886667-16919-2-git-send-email-lauraa@codeaurora.org>

On Wed, Aug 13, 2014 at 12:37:46AM +0100, Laura Abbott wrote:
> It's useful to be able to change individual bits in ptes at times.
> Introduce functions for this and update existing pte_mk* functions
> to use these primatives.
> 
> Signed-off-by: Laura Abbott <lauraa@codeaurora•org>
> ---
>  arch/arm64/include/asm/pgtable.h | 33 +++++++++++++++++++--------------
>  1 file changed, 19 insertions(+), 14 deletions(-)

Looks fine to me:

  Acked-by: Will Deacon <will.deacon@arm•com>

Will

> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index ffe1ba0..ca41449 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -149,46 +149,51 @@ extern struct page *empty_zero_page;
>  #define pte_valid_not_user(pte) \
>  	((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)
>  
> -static inline pte_t pte_wrprotect(pte_t pte)
> +static pte_t clear_pte_bit(pte_t pte, pgprot_t prot)
>  {
> -	pte_val(pte) &= ~PTE_WRITE;
> +	pte_val(pte) &= ~pgprot_val(prot);
>  	return pte;
>  }
>  
> -static inline pte_t pte_mkwrite(pte_t pte)
> +static pte_t set_pte_bit(pte_t pte, pgprot_t prot)
>  {
> -	pte_val(pte) |= PTE_WRITE;
> +	pte_val(pte) |= pgprot_val(prot);
>  	return pte;
>  }
>  
> +static inline pte_t pte_wrprotect(pte_t pte)
> +{
> +	return clear_pte_bit(pte, __pgprot(PTE_WRITE));
> +}
> +
> +static inline pte_t pte_mkwrite(pte_t pte)
> +{
> +	return set_pte_bit(pte, __pgprot(PTE_WRITE));
> +}
> +
>  static inline pte_t pte_mkclean(pte_t pte)
>  {
> -	pte_val(pte) &= ~PTE_DIRTY;
> -	return pte;
> +	return clear_pte_bit(pte, __pgprot(PTE_DIRTY));
>  }
>  
>  static inline pte_t pte_mkdirty(pte_t pte)
>  {
> -	pte_val(pte) |= PTE_DIRTY;
> -	return pte;
> +	return set_pte_bit(pte, __pgprot(PTE_DIRTY));
>  }
>  
>  static inline pte_t pte_mkold(pte_t pte)
>  {
> -	pte_val(pte) &= ~PTE_AF;
> -	return pte;
> +	return clear_pte_bit(pte, __pgprot(PTE_AF));
>  }
>  
>  static inline pte_t pte_mkyoung(pte_t pte)
>  {
> -	pte_val(pte) |= PTE_AF;
> -	return pte;
> +	return set_pte_bit(pte, __pgprot(PTE_AF));
>  }
>  
>  static inline pte_t pte_mkspecial(pte_t pte)
>  {
> -	pte_val(pte) |= PTE_SPECIAL;
> -	return pte;
> +	return set_pte_bit(pte, __pgprot(PTE_SPECIAL));
>  }
>  
>  static inline void set_pte(pte_t *ptep, pte_t pte)
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by The Linux Foundation
> 
> 

  reply	other threads:[~2014-08-19 12:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 23:37 [PATCHv3 0/2] arm64 CONFIG_DEBUG_SET_MODULE_RONX support Laura Abbott
2014-08-12 23:37 ` [PATCHv3 1/2] arm64: Introduce {set,clear}_pte_bit Laura Abbott
2014-08-19 12:06   ` Will Deacon [this message]
2014-08-12 23:37 ` [PATCHv3 2/2] arm64: Add CONFIG_DEBUG_SET_MODULE_RONX support Laura Abbott
2014-08-19 12:11   ` Will Deacon
2014-08-19 17:21     ` Laura Abbott
2014-08-22 15:45       ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140819120642.GB23128@arm.com \
    --to=will.deacon@arm$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox