From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rxMHr4F5dzDqV6 for ; Sat, 23 Jul 2016 19:13:12 +1000 (AEST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6N9Aqql039428 for ; Sat, 23 Jul 2016 05:13:10 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0b-001b2d01.pphosted.com with ESMTP id 24c1h0wdb3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 23 Jul 2016 05:13:09 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 23 Jul 2016 03:13:09 -0600 From: "Aneesh Kumar K.V" To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Cc: linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" Subject: [PATCH for-4.8 V2 03/10] powerpc/mm/radix: Add radix_set_pte to use in early init Date: Sat, 23 Jul 2016 14:42:36 +0530 In-Reply-To: <1469265163-1491-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1469265163-1491-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Message-Id: <1469265163-1491-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , We want to use the static key based feature check in set_pte_at. Since we call radix__map_kernel_page early in boot before jump label is initialized we can't call set_pte_at there. Add radix__set_pte for the same. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/pgtable-radix.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c index 003ff48a11b6..6d2eb76b508e 100644 --- a/arch/powerpc/mm/pgtable-radix.c +++ b/arch/powerpc/mm/pgtable-radix.c @@ -39,6 +39,27 @@ static __ref void *early_alloc_pgtable(unsigned long size) return pt; } +/* + * set_pte stores a linux PTE into the linux page table. + */ +static void radix__set_pte(struct mm_struct *mm, unsigned long addr, pte_t *ptep, + pte_t pte) +{ + /* + * When handling numa faults, we already have the pte marked + * _PAGE_PRESENT, but we can be sure that it is not in hpte. + * Hence we can use set_pte_at for them. + */ + VM_WARN_ON(pte_present(*ptep) && !pte_protnone(*ptep)); + + /* + * Add the pte bit when tryint set a pte + */ + pte = __pte(pte_val(pte) | _PAGE_PTE); + + /* Perform the setting of the PTE */ + radix__set_pte_at(mm, addr, ptep, pte, 0); +} int radix__map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t flags, @@ -102,7 +123,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa, } set_the_pte: - set_pte_at(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT, flags)); + radix__set_pte(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT, flags)); smp_wmb(); return 0; } -- 2.7.4