a87df2f
From patchwork Tue May 21 13:13:24 2019
a87df2f
Content-Type: text/plain; charset="utf-8"
a87df2f
MIME-Version: 1.0
a87df2f
Content-Transfer-Encoding: 7bit
a87df2f
X-Patchwork-Submitter: Masahiro Yamada <yamada.masahiro@socionext.com>
a87df2f
X-Patchwork-Id: 1076877
a87df2f
Return-Path: <SRS0=9PYC=TV=vger.kernel.org=linux-kernel-owner@kernel.org>
a87df2f
Received: from mail.kernel.org (mail.kernel.org [198.145.29.99])
a87df2f
	by smtp.lore.kernel.org (Postfix) with ESMTP id B6B6BC04AAF
a87df2f
	for <linux-kernel@archiver.kernel.org>; Tue, 21 May 2019 13:15:35 +0000 (UTC)
a87df2f
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
a87df2f
	by mail.kernel.org (Postfix) with ESMTP id 5C77920856
a87df2f
	for <linux-kernel@archiver.kernel.org>; Tue, 21 May 2019 13:15:35 +0000 (UTC)
a87df2f
Authentication-Results: mail.kernel.org;
a87df2f
	dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com
a87df2f
 header.b="byDN3URg"
a87df2f
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
a87df2f
        id S1728192AbfEUNPe (ORCPT
a87df2f
        <rfc822;linux-kernel@archiver.kernel.org>);
a87df2f
        Tue, 21 May 2019 09:15:34 -0400
a87df2f
Received: from conuserg-09.nifty.com ([210.131.2.76]:42776 "EHLO
a87df2f
        conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
a87df2f
        with ESMTP id S1726740AbfEUNPe (ORCPT
a87df2f
        <rfc822;linux-kernel@vger.kernel.org>);
a87df2f
        Tue, 21 May 2019 09:15:34 -0400
a87df2f
Received: from grover.flets-west.jp (softbank126125154139.bbtec.net
a87df2f
 [126.125.154.139]) (authenticated)
a87df2f
        by conuserg-09.nifty.com with ESMTP id x4LDDYAd004855;
a87df2f
        Tue, 21 May 2019 22:13:34 +0900
a87df2f
DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x4LDDYAd004855
a87df2f
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com;
a87df2f
        s=dec2015msa; t=1558444415;
a87df2f
        bh=ahqbC92DL/pM+EvNd4RugG8jQvrt9otxZH6g7EH9AdY=;
a87df2f
        h=From:To:Cc:Subject:Date:From;
a87df2f
        b=byDN3URgP1aFiKBf13O4eB3IcCRmRHdS4w/Vsk71gfIMjCTpQlM9x+pTrWYxKD6xD
a87df2f
         V9VH0X04qL3lZtOUfsrhQBsiJk6csDQXXVUjQ5+uCPagVEG7fWaXK52ua2aETjKK0M
a87df2f
         XJBCDyN1+HfIrqq14MuJoUdVthou2qSoYfOre6SZViNDt8nEYf7GoZg7rNW8Dw2tNh
a87df2f
         YYah8oMxK2FXgGkEVEphUKIna2of4Et7E+xJuLal9Z4afYm3hMxjRQeL9FQlOvFsdX
a87df2f
         svjA5A9a8iW0Z2C/nqYiS0rqRctgK33ezsq1t3T5mDDH55zWryW003qi4NZml1meAb
a87df2f
         PH79Wg2BhesJA==
a87df2f
X-Nifty-SrcIP: [126.125.154.139]
a87df2f
From: Masahiro Yamada <yamada.masahiro@socionext.com>
a87df2f
To: Michael Ellerman <mpe@ellerman.id.au>,
a87df2f
        linuxppc-dev@lists.ozlabs.org
a87df2f
Cc: Christophe Leroy <christophe.leroy@c-s.fr>,
a87df2f
        Masahiro Yamada <yamada.masahiro@socionext.com>,
a87df2f
        Benjamin Herrenschmidt <benh@kernel.crashing.org>,
a87df2f
        Paul Mackerras <paulus@samba.org>,
a87df2f
        "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
a87df2f
        Nicholas Piggin <npiggin@gmail.com>,
a87df2f
        Andrew Morton <akpm@linux-foundation.org>,
a87df2f
        David Gibson <david@gibson.dropbear.id.au>,
a87df2f
        Suraj Jitindar Singh <sjitindarsingh@gmail.com>,
a87df2f
        linux-kernel@vger.kernel.org
a87df2f
Subject: [PATCH v2] powerpc/mm: mark more tlb functions as __always_inline
a87df2f
Date: Tue, 21 May 2019 22:13:24 +0900
a87df2f
Message-Id: <1558444404-12254-1-git-send-email-yamada.masahiro@socionext.com>
a87df2f
X-Mailer: git-send-email 2.7.4
a87df2f
Sender: linux-kernel-owner@vger.kernel.org
a87df2f
Precedence: bulk
a87df2f
List-ID: <linux-kernel.vger.kernel.org>
a87df2f
X-Mailing-List: linux-kernel@vger.kernel.org
a87df2f
a87df2f
With CONFIG_OPTIMIZE_INLINING enabled, Laura Abbott reported error
a87df2f
with gcc 9.1.1:
a87df2f
a87df2f
  arch/powerpc/mm/book3s64/radix_tlb.c: In function '_tlbiel_pid':
a87df2f
  arch/powerpc/mm/book3s64/radix_tlb.c:104:2: warning: asm operand 3 probably doesn't match constraints
a87df2f
    104 |  asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
a87df2f
        |  ^~~
a87df2f
  arch/powerpc/mm/book3s64/radix_tlb.c:104:2: error: impossible constraint in 'asm'
a87df2f
a87df2f
Fixing _tlbiel_pid() is enough to address the warning above, but I
a87df2f
inlined more functions to fix all potential issues.
a87df2f
a87df2f
To meet the "i" (immediate) constraint for the asm operands, functions
a87df2f
propagating "ric" must be always inlined.
a87df2f
a87df2f
Fixes: 9012d011660e ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING")
a87df2f
Reported-by: Laura Abbott <labbott@redhat.com>
a87df2f
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
a87df2f
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
a87df2f
---
a87df2f
a87df2f
Changes in v2:
a87df2f
  - Do not split lines
a87df2f
a87df2f
 arch/powerpc/mm/book3s64/hash_native.c |  2 +-
a87df2f
 arch/powerpc/mm/book3s64/radix_tlb.c   | 32 ++++++++++++++++----------------
a87df2f
 2 files changed, 17 insertions(+), 17 deletions(-)
a87df2f
a87df2f
diff --git a/arch/powerpc/mm/book3s64/hash_native.c b/arch/powerpc/mm/book3s64/hash_native.c
a87df2f
index aaa28fd..c854151 100644
a87df2f
--- a/arch/powerpc/mm/book3s64/hash_native.c
a87df2f
+++ b/arch/powerpc/mm/book3s64/hash_native.c
a87df2f
@@ -60,7 +60,7 @@ static inline void tlbiel_hash_set_isa206(unsigned int set, unsigned int is)
a87df2f
  * tlbiel instruction for hash, set invalidation
a87df2f
  * i.e., r=1 and is=01 or is=10 or is=11
a87df2f
  */
a87df2f
-static inline void tlbiel_hash_set_isa300(unsigned int set, unsigned int is,
a87df2f
+static __always_inline void tlbiel_hash_set_isa300(unsigned int set, unsigned int is,
a87df2f
 					unsigned int pid,
a87df2f
 					unsigned int ric, unsigned int prs)
a87df2f
 {
a87df2f
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
a87df2f
index 4d84136..4d3dc10 100644
a87df2f
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
a87df2f
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
a87df2f
@@ -29,7 +29,7 @@
a87df2f
  * tlbiel instruction for radix, set invalidation
a87df2f
  * i.e., r=1 and is=01 or is=10 or is=11
a87df2f
  */
a87df2f
-static inline void tlbiel_radix_set_isa300(unsigned int set, unsigned int is,
a87df2f
+static __always_inline void tlbiel_radix_set_isa300(unsigned int set, unsigned int is,
a87df2f
 					unsigned int pid,
a87df2f
 					unsigned int ric, unsigned int prs)
a87df2f
 {
a87df2f
@@ -150,8 +150,8 @@ static __always_inline void __tlbie_lpid(unsigned long lpid, unsigned long ric)
a87df2f
 	trace_tlbie(lpid, 0, rb, rs, ric, prs, r);
a87df2f
 }
a87df2f
 
a87df2f
-static inline void __tlbiel_lpid_guest(unsigned long lpid, int set,
a87df2f
-				unsigned long ric)
a87df2f
+static __always_inline void __tlbiel_lpid_guest(unsigned long lpid, int set,
a87df2f
+						unsigned long ric)
a87df2f
 {
a87df2f
 	unsigned long rb,rs,prs,r;
a87df2f
 
a87df2f
@@ -167,8 +167,8 @@ static inline void __tlbiel_lpid_guest(unsigned long lpid, int set,
a87df2f
 }
a87df2f
 
a87df2f
 
a87df2f
-static inline void __tlbiel_va(unsigned long va, unsigned long pid,
a87df2f
-			       unsigned long ap, unsigned long ric)
a87df2f
+static __always_inline void __tlbiel_va(unsigned long va, unsigned long pid,
a87df2f
+					unsigned long ap, unsigned long ric)
a87df2f
 {
a87df2f
 	unsigned long rb,rs,prs,r;
a87df2f
 
a87df2f
@@ -183,8 +183,8 @@ static inline void __tlbiel_va(unsigned long va, unsigned long pid,
a87df2f
 	trace_tlbie(0, 1, rb, rs, ric, prs, r);
a87df2f
 }
a87df2f
 
a87df2f
-static inline void __tlbie_va(unsigned long va, unsigned long pid,
a87df2f
-			      unsigned long ap, unsigned long ric)
a87df2f
+static __always_inline void __tlbie_va(unsigned long va, unsigned long pid,
a87df2f
+				       unsigned long ap, unsigned long ric)
a87df2f
 {
a87df2f
 	unsigned long rb,rs,prs,r;
a87df2f
 
a87df2f
@@ -199,8 +199,8 @@ static inline void __tlbie_va(unsigned long va, unsigned long pid,
a87df2f
 	trace_tlbie(0, 0, rb, rs, ric, prs, r);
a87df2f
 }
a87df2f
 
a87df2f
-static inline void __tlbie_lpid_va(unsigned long va, unsigned long lpid,
a87df2f
-			      unsigned long ap, unsigned long ric)
a87df2f
+static __always_inline void __tlbie_lpid_va(unsigned long va, unsigned long lpid,
a87df2f
+					    unsigned long ap, unsigned long ric)
a87df2f
 {
a87df2f
 	unsigned long rb,rs,prs,r;
a87df2f
 
a87df2f
@@ -239,7 +239,7 @@ static inline void fixup_tlbie_lpid(unsigned long lpid)
a87df2f
 /*
a87df2f
  * We use 128 set in radix mode and 256 set in hpt mode.
a87df2f
  */
a87df2f
-static inline void _tlbiel_pid(unsigned long pid, unsigned long ric)
a87df2f
+static __always_inline void _tlbiel_pid(unsigned long pid, unsigned long ric)
a87df2f
 {
a87df2f
 	int set;
a87df2f
 
a87df2f
@@ -341,7 +341,7 @@ static inline void _tlbie_lpid(unsigned long lpid, unsigned long ric)
a87df2f
 	asm volatile("eieio; tlbsync; ptesync": : :"memory");
a87df2f
 }
a87df2f
 
a87df2f
-static inline void _tlbiel_lpid_guest(unsigned long lpid, unsigned long ric)
a87df2f
+static __always_inline void _tlbiel_lpid_guest(unsigned long lpid, unsigned long ric)
a87df2f
 {
a87df2f
 	int set;
a87df2f
 
a87df2f
@@ -381,8 +381,8 @@ static inline void __tlbiel_va_range(unsigned long start, unsigned long end,
a87df2f
 		__tlbiel_va(addr, pid, ap, RIC_FLUSH_TLB);
a87df2f
 }
a87df2f
 
a87df2f
-static inline void _tlbiel_va(unsigned long va, unsigned long pid,
a87df2f
-			      unsigned long psize, unsigned long ric)
a87df2f
+static __always_inline void _tlbiel_va(unsigned long va, unsigned long pid,
a87df2f
+				       unsigned long psize, unsigned long ric)
a87df2f
 {
a87df2f
 	unsigned long ap = mmu_get_ap(psize);
a87df2f
 
a87df2f
@@ -413,8 +413,8 @@ static inline void __tlbie_va_range(unsigned long start, unsigned long end,
a87df2f
 		__tlbie_va(addr, pid, ap, RIC_FLUSH_TLB);
a87df2f
 }
a87df2f
 
a87df2f
-static inline void _tlbie_va(unsigned long va, unsigned long pid,
a87df2f
-			      unsigned long psize, unsigned long ric)
a87df2f
+static __always_inline void _tlbie_va(unsigned long va, unsigned long pid,
a87df2f
+				      unsigned long psize, unsigned long ric)
a87df2f
 {
a87df2f
 	unsigned long ap = mmu_get_ap(psize);
a87df2f
 
a87df2f
@@ -424,7 +424,7 @@ static inline void _tlbie_va(unsigned long va, unsigned long pid,
a87df2f
 	asm volatile("eieio; tlbsync; ptesync": : :"memory");
a87df2f
 }
a87df2f
 
a87df2f
-static inline void _tlbie_lpid_va(unsigned long va, unsigned long lpid,
a87df2f
+static __always_inline void _tlbie_lpid_va(unsigned long va, unsigned long lpid,
a87df2f
 			      unsigned long psize, unsigned long ric)
a87df2f
 {
a87df2f
 	unsigned long ap = mmu_get_ap(psize);