Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4166232ybi; Mon, 3 Jun 2019 06:45:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7WvtQ1bclLH/O2FkqB+N0ku6pvvPE1pl74ATLwi2V1Ys2URQ1oEsPYvo3UvpeenpKwZp7 X-Received: by 2002:a17:90a:216c:: with SMTP id a99mr16021507pje.3.1559569556899; Mon, 03 Jun 2019 06:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559569556; cv=none; d=google.com; s=arc-20160816; b=0HYjwkGG9MU4cHSD4ZSf70o8JpSVJVIDCtCJ4C12UnsOd5wpqm5tMI3bd4kLdpciTi qgM7/73ttVJn1EVogDnlwPxbeiJ+6XGvrrIEJT60f4o+hn5E6KfyqDerjr1sNImbBn3h iGrXDPAD6rrBKErrdiPwDlFeO8NeVH6YGXb7FP6RodNpHshfvR/BMS3ZRa+RnwH4NSMQ RjyovmLABKFej303OPTfnihqnMjSUuXKhnmBb37GQCvBwVE2eR8ugOHPDBWIV4xw1qxn MOzfyR0Mgf1Cv10mV1BkHCGXgRrmAJD9dLylgGzQWPzZmJrIyzXfBsTepQHwwG/TUy7W jdxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=1B3EFEXNw0umT7bq7uVdz46zLj4UUSpc8p0Z55Jy9nE=; b=t+VwiVp6T0/rAgWJ1u/vyBjk8CMlH4LxefRE4O+Bf6fd/M4LO2azzgTCg2FuTcX1YP m54U+LS5xaKqltd+d392tWU18GxdNzZzwlDQSrceHCbqw1HR5VfTkCr+EleyBGxWLnDx LHeZbCVwFICh/IOlHXnwLe8jksNH2Nw0XTDLFBn/B7uQvDMCvXXLXvj9ZLDDIHn/WAcH UUF4waO2j9j2d9lJiZXsvPxnmDY4tdJ1IR4f9R5zaFgp+e7HuvGhOpGm1vBa2/RsZJpe Clj7Pz0GSijJtz3XCmlmvQIfM9aaoHeKSoEVd/c6vOvQZDYrs6D2ndl/MaYc3g2Kbto/ /Ttw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=eQp16pAt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si18417355plq.78.2019.06.03.06.45.39; Mon, 03 Jun 2019 06:45:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=eQp16pAt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728974AbfFCNmt (ORCPT + 99 others); Mon, 3 Jun 2019 09:42:49 -0400 Received: from terminus.zytor.com ([198.137.202.136]:47289 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728876AbfFCNms (ORCPT ); Mon, 3 Jun 2019 09:42:48 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x53DgXqK612230 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 3 Jun 2019 06:42:33 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x53DgXqK612230 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019051801; t=1559569354; bh=1B3EFEXNw0umT7bq7uVdz46zLj4UUSpc8p0Z55Jy9nE=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=eQp16pAtjwJEW54ip5k8WhcZI5I6mLc1OdyvRrhIhnjg+5K394x6+KWT3a6eJtRzd dCFMeKkZovMdfR0uNElg0qyTKo0gtYNzUzMLuJPOBHnkLXhuzWHBnwKSzf1TMCx77+ CoKn9A/006wmB+X1b1XFBRjrUzkrXdNdJgznUvkFnN95StWnk8siaZFcNCXy0unHDs /LIpeYBDJdb8rMKg0XSIRPryJ5ZSFfyia/LLwnhTICSNVjZAJomx7+sRXuUq+ebkOU pGyQYhlyKIzvkRhpQ8svUhJlT5LKxH216hCyahVLVdwnjqVtRH28jlA/+0RJ7oNYvA +j4ZiBhR/mkvQ== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x53DgXSH612223; Mon, 3 Jun 2019 06:42:33 -0700 Date: Mon, 3 Jun 2019 06:42:33 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Mark Rutland Message-ID: Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, hpa@zytor.com, heiko.carstens@de.ibm.com, mark.rutland@arm.com, will.deacon@arm.com, peterz@infradead.org, tglx@linutronix.de Reply-To: torvalds@linux-foundation.org, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, will.deacon@arm.com, peterz@infradead.org, heiko.carstens@de.ibm.com, mark.rutland@arm.com, hpa@zytor.com In-Reply-To: <20190522132250.26499-14-mark.rutland@arm.com> References: <20190522132250.26499-14-mark.rutland@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] locking/atomic, s390: Use s64 for atomic64 Git-Commit-ID: 0ca94800762e8a2f7037c9b02ba74aff8016dd82 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.4 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0ca94800762e8a2f7037c9b02ba74aff8016dd82 Gitweb: https://git.kernel.org/tip/0ca94800762e8a2f7037c9b02ba74aff8016dd82 Author: Mark Rutland AuthorDate: Wed, 22 May 2019 14:22:45 +0100 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 12:32:56 +0200 locking/atomic, s390: Use s64 for atomic64 As a step towards making the atomic64 API use consistent types treewide, let's have the s390 atomic64 implementation use s64 as the underlying type for atomic64_t, rather than long, matching the generated headers. As atomic64_read() depends on the generic defintion of atomic64_t, this still returns long. This will be converted in a subsequent patch. The s390-internal __atomic64_*() ops are also used by the s390 bitops, and expect pointers to long. Since atomic64_t::counter will be converted to s64 in a subsequent patch, pointes to this are explicitly cast to pointers to long when passed to __atomic64_*() ops. Otherwise, there should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Signed-off-by: Peter Zijlstra (Intel) Cc: Heiko Carstens Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Will Deacon Cc: aou@eecs.berkeley.edu Cc: arnd@arndb.de Cc: bp@alien8.de Cc: catalin.marinas@arm.com Cc: davem@davemloft.net Cc: fenghua.yu@intel.com Cc: herbert@gondor.apana.org.au Cc: ink@jurassic.park.msu.ru Cc: jhogan@kernel.org Cc: linux@armlinux.org.uk Cc: mattst88@gmail.com Cc: mpe@ellerman.id.au Cc: palmer@sifive.com Cc: paul.burton@mips.com Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: rth@twiddle.net Cc: tony.luck@intel.com Cc: vgupta@synopsys.com Link: https://lkml.kernel.org/r/20190522132250.26499-14-mark.rutland@arm.com Signed-off-by: Ingo Molnar --- arch/s390/include/asm/atomic.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h index fd20ab5d4cf7..491ad53a0d4e 100644 --- a/arch/s390/include/asm/atomic.h +++ b/arch/s390/include/asm/atomic.h @@ -84,9 +84,9 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new) #define ATOMIC64_INIT(i) { (i) } -static inline long atomic64_read(const atomic64_t *v) +static inline s64 atomic64_read(const atomic64_t *v) { - long c; + s64 c; asm volatile( " lg %0,%1\n" @@ -94,49 +94,49 @@ static inline long atomic64_read(const atomic64_t *v) return c; } -static inline void atomic64_set(atomic64_t *v, long i) +static inline void atomic64_set(atomic64_t *v, s64 i) { asm volatile( " stg %1,%0\n" : "=Q" (v->counter) : "d" (i)); } -static inline long atomic64_add_return(long i, atomic64_t *v) +static inline s64 atomic64_add_return(s64 i, atomic64_t *v) { - return __atomic64_add_barrier(i, &v->counter) + i; + return __atomic64_add_barrier(i, (long *)&v->counter) + i; } -static inline long atomic64_fetch_add(long i, atomic64_t *v) +static inline s64 atomic64_fetch_add(s64 i, atomic64_t *v) { - return __atomic64_add_barrier(i, &v->counter); + return __atomic64_add_barrier(i, (long *)&v->counter); } -static inline void atomic64_add(long i, atomic64_t *v) +static inline void atomic64_add(s64 i, atomic64_t *v) { #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES if (__builtin_constant_p(i) && (i > -129) && (i < 128)) { - __atomic64_add_const(i, &v->counter); + __atomic64_add_const(i, (long *)&v->counter); return; } #endif - __atomic64_add(i, &v->counter); + __atomic64_add(i, (long *)&v->counter); } #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) -static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new) +static inline s64 atomic64_cmpxchg(atomic64_t *v, s64 old, s64 new) { - return __atomic64_cmpxchg(&v->counter, old, new); + return __atomic64_cmpxchg((long *)&v->counter, old, new); } #define ATOMIC64_OPS(op) \ -static inline void atomic64_##op(long i, atomic64_t *v) \ +static inline void atomic64_##op(s64 i, atomic64_t *v) \ { \ - __atomic64_##op(i, &v->counter); \ + __atomic64_##op(i, (long *)&v->counter); \ } \ -static inline long atomic64_fetch_##op(long i, atomic64_t *v) \ +static inline long atomic64_fetch_##op(s64 i, atomic64_t *v) \ { \ - return __atomic64_##op##_barrier(i, &v->counter); \ + return __atomic64_##op##_barrier(i, (long *)&v->counter); \ } ATOMIC64_OPS(and) @@ -145,8 +145,8 @@ ATOMIC64_OPS(xor) #undef ATOMIC64_OPS -#define atomic64_sub_return(_i, _v) atomic64_add_return(-(long)(_i), _v) -#define atomic64_fetch_sub(_i, _v) atomic64_fetch_add(-(long)(_i), _v) -#define atomic64_sub(_i, _v) atomic64_add(-(long)(_i), _v) +#define atomic64_sub_return(_i, _v) atomic64_add_return(-(s64)(_i), _v) +#define atomic64_fetch_sub(_i, _v) atomic64_fetch_add(-(s64)(_i), _v) +#define atomic64_sub(_i, _v) atomic64_add(-(s64)(_i), _v) #endif /* __ARCH_S390_ATOMIC__ */