[PATCH 10/16] sparc64: use the generic get_user_pages_fast code
Hillf Danton
hdanton at sina.com
Sun Jun 2 17:39:48 AEST 2019
Hi Christoph
On Sat, 1 Jun 2019 09:49:53 +0200 Christoph Hellwig wrote:
>
> diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
> index a93eca29e85a..2301ab5250e4 100644
> --- a/arch/sparc/include/asm/pgtable_64.h
> +++ b/arch/sparc/include/asm/pgtable_64.h
> @@ -1098,6 +1098,24 @@ static inline unsigned long untagged_addr(unsigned long start)
> }
> #define untagged_addr untagged_addr
>
> +static inline bool pte_access_permitted(pte_t pte, bool write)
> +{
> + u64 prot;
> +
> + if (tlb_type == hypervisor) {
> + prot = _PAGE_PRESENT_4V | _PAGE_P_4V;
> + if (prot)
Feel free to correct me if I misread or miss anything.
It looks like a typo: s/prot/write/, as checking _PAGE_PRESENT_4V and
_PAGE_P_4V makes prot always have _PAGE_WRITE_4V set, regardless of write.
> + prot |= _PAGE_WRITE_4V;
> + } else {
> + prot = _PAGE_PRESENT_4U | _PAGE_P_4U;
> + if (write)
> + prot |= _PAGE_WRITE_4U;
> + }
> +
> + return (pte_val(pte) & (prot | _PAGE_SPECIAL)) == prot;
> +}
> +#define pte_access_permitted pte_access_permitted
> +
> #include <asm/tlbflush.h>
> #include <asm-generic/pgtable.h>
BR
Hillf
More information about the Linuxppc-dev
mailing list