Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979428pxb; Fri, 5 Mar 2021 04:39:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlA9rE4Xkt0kh70BVsMglAVTLGBlhnxpnQn4ZusxrClpJZv8W6Ql9lX3odbQPthgRX0RWZ X-Received: by 2002:a05:6402:31a7:: with SMTP id dj7mr8960228edb.33.1614947991025; Fri, 05 Mar 2021 04:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947991; cv=none; d=google.com; s=arc-20160816; b=hoGhvaC2FYEPetbAv+mMqY2Sw8DnQk3LTI+kEgQxRmfRnI5NW5V3Xa8a9sqkkaLRHy FvWtMEXOdL+TEMqlHJj7V/X3ymiuJsqQtnCn2mctLEeGn54EqkNMXZ010aIZZo4NVmjP qAF5tl+Vobyju1AKinf4U8KiAHerW5pthh/DHl86cwCbf8kVtsQR704DTtUbcIU1RZvf cd+f0Anp/E9G/vaFZ7eRiXKjkBxC7jW+L51te2TvIUt8tlm7hWv/QPXpz47sVTQS+3KY 7ofXFnmqmUsW1nLiEj7+rfGoOxb6LRl773V8GCDUwnTWZIjDhXSTMda1HJHfASkBrCn/ YXpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=06bgHh7QfsxTVuMtyavHeG+yV3cwH7BPjTY1G0eRD4M=; b=ZitO0puJzylH0Mbk7Nuh8mKjyBcQ5eRmX0dVDhenhOGzXSwddfIp7oTd3Y4n6wdAWg bYryylRAky90qEUrkatDzb5CwiAzZHoRJ6m0m3nRnjPZDKEz1hTSY06TlJM1rJkaK9b2 gdTVYv8b4Sc/nRcQhVK7TqGiiGe4eDiE/QJH8rugSwDWWy5LUEY3qY8HbMvDzO2PtBh5 a95Qe4eUJSMTytDqYfgNKOat5Iy5H+pgNYVyNHmqKlX0OnB4nuZnmAUkt/fgTwya84tP 3emAmeeqB9hXy4PDqDUXHLGydFehLGjKRLZIjirgfE5c7p9Or95BXBLw/DfO6jsjayDe CJfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x9qUe+GZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si1266362ejo.356.2021.03.05.04.39.28; Fri, 05 Mar 2021 04:39:51 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x9qUe+GZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232878AbhCEMiV (ORCPT + 99 others); Fri, 5 Mar 2021 07:38:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:50332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233212AbhCEMhX (ORCPT ); Fri, 5 Mar 2021 07:37:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 87F2D65012; Fri, 5 Mar 2021 12:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947843; bh=tmbZ0ujeLAKfplvADqenZ3g25Ac5KzfRJiS9W3Sutrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9qUe+GZksFwNqluc8HxVrRwhKN90mJN+fMDbRpQuR6wk9eQvJINULBUIVeL8bana +xfz1a9paMIcKmDHCVOLOjpn8cS0e/glp9MV+/E4CCrRX+1zYT299dEqw/jpU6jlsS AVvd4HRmSgAg5Z2w5J83s0E8rp5UidCi4ngRT4Nw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Will Deacon , Ben Hutchings Subject: [PATCH 4.19 07/52] arm64: cmpxchg: Use "K" instead of "L" for ll/sc immediate constraint Date: Fri, 5 Mar 2021 13:21:38 +0100 Message-Id: <20210305120854.016708187@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120853.659441428@linuxfoundation.org> References: <20210305120853.659441428@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon commit 4230509978f2921182da4e9197964dccdbe463c3 upstream. The "L" AArch64 machine constraint, which we use for the "old" value in an LL/SC cmpxchg(), generates an immediate that is suitable for a 64-bit logical instruction. However, for cmpxchg() operations on types smaller than 64 bits, this constraint can result in an invalid instruction which is correctly rejected by GAS, such as EOR W1, W1, #0xffffffff. Whilst we could special-case the constraint based on the cmpxchg size, it's far easier to change the constraint to "K" and put up with using a register for large 64-bit immediates. For out-of-line LL/SC atomics, this is all moot anyway. Reported-by: Robin Murphy Signed-off-by: Will Deacon Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/atomic_ll_sc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/include/asm/atomic_ll_sc.h +++ b/arch/arm64/include/asm/atomic_ll_sc.h @@ -268,7 +268,7 @@ __LL_SC_PREFIX(__cmpxchg_case_##name##sz "2:" \ : [tmp] "=&r" (tmp), [oldval] "=&r" (oldval), \ [v] "+Q" (*(u##sz *)ptr) \ - : [old] "Lr" (old), [new] "r" (new) \ + : [old] "Kr" (old), [new] "r" (new) \ : cl); \ \ return oldval; \