From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 3yNVkD4XNCzDrbn for ; Fri, 27 Oct 2017 15:09:08 +1100 (AEDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9R492KZ091623 for ; Fri, 27 Oct 2017 00:09:06 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0a-001b2d01.pphosted.com with ESMTP id 2duvcejpmp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 27 Oct 2017 00:09:05 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 22:09:05 -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 03/16] powerpc/pseries: Update hpte find helper to take hash value Date: Fri, 27 Oct 2017 09:38:20 +0530 In-Reply-To: <20171027040833.3644-1-aneesh.kumar@linux.vnet.ibm.com> References: <20171027040833.3644-1-aneesh.kumar@linux.vnet.ibm.com> Message-Id: <20171027040833.3644-4-aneesh.kumar@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , The helper now also does secondary hash search so that we can use this in other functions. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/platforms/pseries/lpar.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 495ba4e7336d..edab68d9f9f3 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -328,15 +328,21 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot, return 0; } -static long __pSeries_lpar_hpte_find(unsigned long want_v, unsigned long hpte_group) +static long __pSeries_lpar_hpte_find(unsigned long hash, unsigned long want_v) { long lpar_rc; unsigned long i, j; + unsigned long hpte_group; + bool secondary_search = false; struct { unsigned long pteh; unsigned long ptel; } ptes[4]; + /* first check primary */ + hpte_group = (hash & htab_hash_mask) * HPTES_PER_GROUP; + +search_again: for (i = 0; i < HPTES_PER_GROUP; i += 4, hpte_group += 4) { lpar_rc = plpar_pte_read_4(0, hpte_group, (void *)ptes); @@ -346,31 +352,31 @@ static long __pSeries_lpar_hpte_find(unsigned long want_v, unsigned long hpte_gr for (j = 0; j < 4; j++) { if (HPTE_V_COMPARE(ptes[j].pteh, want_v) && (ptes[j].pteh & HPTE_V_VALID)) - return i + j; + return hpte_group + j; } } - + if (!secondary_search) { + hpte_group = (~hash & htab_hash_mask) * HPTES_PER_GROUP; + secondary_search = true; + goto search_again; + } return -1; } static long pSeries_lpar_hpte_find(unsigned long vpn, int psize, int ssize) { long slot; - unsigned long hash; - unsigned long want_v; - unsigned long hpte_group; + unsigned long hash, want_v; hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize); want_v = hpte_encode_avpn(vpn, psize, ssize); - - /* Bolted entries are always in the primary group */ - hpte_group = (hash & htab_hash_mask) * HPTES_PER_GROUP; - slot = __pSeries_lpar_hpte_find(want_v, hpte_group); + slot = __pSeries_lpar_hpte_find(hash, want_v); if (slot < 0) return -1; - return hpte_group + slot; + return slot; } + static void pSeries_lpar_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, int psize, int ssize) -- 2.13.6