Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp99779pxj; Thu, 3 Jun 2021 01:45:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAvybHIY6w+Ob1iVp0q4RocGE/vM/K9ge3CEqf3MEzFkSsfZslDy3wzwbewLkmNdGIE9V3 X-Received: by 2002:a17:906:fa93:: with SMTP id lt19mr30848330ejb.54.1622709938560; Thu, 03 Jun 2021 01:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622709938; cv=none; d=google.com; s=arc-20160816; b=Vu6peNTu/hUtA4aoYxQNFafJbITTZac9ZZLvc2ttoJ+fCP+SZMVKoMbLT6UU6+j7+c GVSy1YlbTlfyGnZiTMaHzsgSVVewdTnx5Gz0AEQfNbIA0SpMOfp/uxPybL3QgRSiUqi2 3QbKKSyDeYk31MgDJWzoeJD7n0AoF8ela4CfzB8KzVSgzfqTinJWUvJH/9iwD+4ZjpUC HLi8odf3fWhUtHR6TOaeDKJi5ndIjaZy4HgGqhm2rCJ5ac0j0p8DBQWXg8iB4czqb0hn ckhVVnIb4fq62qUQExh1eJ3L5ELZ9LTX1S3DW1WamSccpt6Kib05NhBWaL3ompnw3FMg xWyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=dmDFAXLRfzjVVxxCZwI6znd3cT+r2hZN9wKs+DLbGQc=; b=iTaAoYBhyl3labhm/PGO58PdAy2ZoePRwGggOnM3K+H26Ygqqb/Us4kswf8uWd3eXQ F8QGiItI4aBNyZfT38AEflKCH8rygrKv3H4HEqVYq0IMSltsl/Ja2KRrexZxzzLP46cb OY7NKalUcZNq/Vh4M5eNf76T6Ay6rlEQqPxTv5Fg7DfJLZ/bOZNdpEBt5H+kJcXauCdh B6BM+Pfs4pO5i6ImWSvoHMgwVlG7/bjXgVhEs81t14/i5aVO/BTMD9t6853vujcRJR7n Aymb0LUXahaua+abJ+WTGkJ6D4bbMI//+mAgzJ6nc/6DRDr76KcN6jAP3p0AFlTEjjCS dfzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb13si1719167ejc.145.2021.06.03.01.45.15; Thu, 03 Jun 2021 01:45:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbhFCIn2 (ORCPT + 99 others); Thu, 3 Jun 2021 04:43:28 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:7043 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbhFCIn2 (ORCPT ); Thu, 3 Jun 2021 04:43:28 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4FwfWl4bShzBC5p; Thu, 3 Jun 2021 10:41:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6Xy-rWGip_2A; Thu, 3 Jun 2021 10:41:39 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4FwfWl3hkBzBC5Z; Thu, 3 Jun 2021 10:41:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3365B8B767; Thu, 3 Jun 2021 10:41:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id gGZ2aGWSxbBp; Thu, 3 Jun 2021 10:41:39 +0200 (CEST) Received: from po15610vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E4F508B84A; Thu, 3 Jun 2021 10:41:38 +0200 (CEST) Received: by po15610vm.idsi0.si.c-s.fr (Postfix, from userid 0) id BF6BF64BD2; Thu, 3 Jun 2021 08:41:38 +0000 (UTC) Message-Id: <26b36ef2939234a04b37baf6ffe50cba81f5d1b7.1622708530.git.christophe.leroy@csgroup.eu> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 03/12] powerpc/32s: move CTX_TO_VSID() into mmu-hash.h To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 3 Jun 2021 08:41:38 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy In order to reuse it in switch_mmu_context(), this patch moves CTX_TO_VSID() macro into asm/book3s/32/mmu-hash.h Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/mmu-hash.h | 10 ++++++++++ arch/powerpc/kvm/book3s_32_mmu_host.c | 3 --- arch/powerpc/mm/book3s32/mmu_context.c | 13 ------------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/32/mmu-hash.h b/arch/powerpc/include/asm/book3s/32/mmu-hash.h index cc0284bbac86..583388399b1b 100644 --- a/arch/powerpc/include/asm/book3s/32/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/32/mmu-hash.h @@ -66,6 +66,16 @@ struct ppc_bat { #ifndef __ASSEMBLY__ +/* + * This macro defines the mapping from contexts to VSIDs (virtual + * segment IDs). We use a skew on both the context and the high 4 bits + * of the 32-bit virtual address (the "effective segment ID") in order + * to spread out the entries in the MMU hash table. Note, if this + * function is changed then hash functions will have to be + * changed to correspond. + */ +#define CTX_TO_VSID(c, id) ((((c) * (897 * 16)) + (id * 0x111)) & 0xffffff) + /* * Hardware Page Table Entry * Note that the xpn and x bitfields are used only by processors that diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c index e8e7b2c530d1..4b3a8d80cfa3 100644 --- a/arch/powerpc/kvm/book3s_32_mmu_host.c +++ b/arch/powerpc/kvm/book3s_32_mmu_host.c @@ -353,9 +353,6 @@ void kvmppc_mmu_destroy_pr(struct kvm_vcpu *vcpu) preempt_enable(); } -/* From mm/mmu_context_hash32.c */ -#define CTX_TO_VSID(c, id) ((((c) * (897 * 16)) + (id * 0x111)) & 0xffffff) - int kvmppc_mmu_init_pr(struct kvm_vcpu *vcpu) { struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu); diff --git a/arch/powerpc/mm/book3s32/mmu_context.c b/arch/powerpc/mm/book3s32/mmu_context.c index 218996e40a8e..c949363f315f 100644 --- a/arch/powerpc/mm/book3s32/mmu_context.c +++ b/arch/powerpc/mm/book3s32/mmu_context.c @@ -39,19 +39,6 @@ #define LAST_CONTEXT 32767 #define FIRST_CONTEXT 1 -/* - * This function defines the mapping from contexts to VSIDs (virtual - * segment IDs). We use a skew on both the context and the high 4 bits - * of the 32-bit virtual address (the "effective segment ID") in order - * to spread out the entries in the MMU hash table. Note, if this - * function is changed then arch/ppc/mm/hashtable.S will have to be - * changed to correspond. - * - * - * CTX_TO_VSID(ctx, va) (((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \ - * & 0xffffff) - */ - static unsigned long next_mmu_context; static unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1]; -- 2.25.0