Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp30085pxb; Fri, 15 Jan 2021 05:07:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKDSTEeMBEnq3MIzVUQh0zcvc3bQfvP03pOWTMI8lizMTYcmxmzC9qg85LKCbcn4t8xjZi X-Received: by 2002:a50:ed04:: with SMTP id j4mr9753257eds.84.1610716063046; Fri, 15 Jan 2021 05:07:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610716063; cv=none; d=google.com; s=arc-20160816; b=JrXWhAT1GEmQVoMILU6h50k+WY7PPz9H9MqkOO4gkRVcPS13F4WMdhXwVhpn57Eb3C LotAJd4YfhhgECmWKRYbkhjzak7zUjREKe04wbTQqjZZDX3XUoOgOuz2viNlhbs7N9JG mzOSAovmXkylgXEeYr52rQl8S8K+2QeoV7IuVdaV8QJuND8QeUI3HkRnOPtiCiEc6nq4 ELHX8vQP7Pzb/jOQrP49k9rm5rUvF5VG9Wx0lzIDR2v4D1ayGEwMBf+3u0uK9yLPHekL EuCsILNZVKexGD+C8j8oQyiyeIn6JUqG+WnzoRMtzY8z2nflHJj3Xu9QZ00p7S499sFG ObEQ== 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=Ce/3P51Q35yQnR2LuT5v648fsR4eW6xxPKQ6A9X6f8s=; b=HFNRBRM1Sh5RzSPdxQGx/lD/9AxTE62X7Jt0Xg9qnzf8+QixWHQp0jHGvj69+hiHep L8N+3oJqufBbS6dROwiJsJNh21H+SFw4jFzfEVSfycgFekbzGct3kQd7KrWbdfIeSzwa 08apy9lgWyjhrLQLaoEtnHUK7Ky87izqE4tiAv+PC8rRTUj5p/oJfk0+lNVYXa3jCQi4 s8avnqFWw99BCrG1+f+EKbeId+pMhb6N0IXLp63tF8VNpMYnMREoBmSwSYb0itlSju2n PE7qoWvhfTwtKoH5eQ/RHc/E0Oc2g4Noe6z55OsAA+8z4mvLXEUVTxYv/4uFk+6MK1jQ gaUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eg7Qcihw; 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 hs17si3519699ejc.661.2021.01.15.05.07.17; Fri, 15 Jan 2021 05:07:43 -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=Eg7Qcihw; 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 S2387651AbhAONGD (ORCPT + 99 others); Fri, 15 Jan 2021 08:06:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:36244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732608AbhAOMb0 (ORCPT ); Fri, 15 Jan 2021 07:31:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E94A23136; Fri, 15 Jan 2021 12:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713857; bh=1pMyVfnnOHoa+A67Ck+9KWJEzsoqnZJAgAAndxT2vC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eg7QcihwoZTWj9GV4Ph3GNS6XjGMkzoTYLzlYgnT099BsbN4aEqnYdXcmtWlCJWPR 8RljQF0iOaUzVkG/cfU1RUDnl9v9shzXTK4+VrqhgaeZGXBprAvBH4RfOSN3CUqKAi t4Ubk7k1BwVCseSypCuZfR5ouQuRHp6rqKxsg+qU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Desnoyers , Christophe Leroy , Segher Boessenkool , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 01/28] powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at Date: Fri, 15 Jan 2021 13:27:38 +0100 Message-Id: <20210115121956.808660055@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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: Mathieu Desnoyers [ Upstream commit d85be8a49e733dcd23674aa6202870d54bf5600d ] The placeholder for instruction selection should use the second argument's operand, which is %1, not %0. This could generate incorrect assembly code if the memory addressing of operand %0 is a different form from that of operand %1. Also remove the %Un placeholder because having %Un placeholders for two operands which are based on the same local var (ptep) doesn't make much sense. By the way, it doesn't change the current behaviour because "<>" constraint is missing for the associated "=m". [chleroy: revised commit log iaw segher's comments and removed %U0] Fixes: 9bf2b5cdc5fe ("powerpc: Fixes for CONFIG_PTE_64BIT for SMP support") Cc: # v2.6.28+ Signed-off-by: Mathieu Desnoyers Signed-off-by: Christophe Leroy Acked-by: Segher Boessenkool Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/96354bd77977a6a933fe9020da57629007fdb920.1603358942.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++-- arch/powerpc/include/asm/nohash/pgtable.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 016579ef16d3d..ec98abca0df03 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -414,9 +414,9 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, if (pte_val(*ptep) & _PAGE_HASHPTE) flush_hash_entry(mm, ptep, addr); __asm__ __volatile__("\ - stw%U0%X0 %2,%0\n\ + stw%X0 %2,%0\n\ eieio\n\ - stw%U0%X0 %L2,%1" + stw%X1 %L2,%1" : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4)) : "r" (pte) : "memory"); diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h index 5c68f4a59f758..e9171b8242e4b 100644 --- a/arch/powerpc/include/asm/nohash/pgtable.h +++ b/arch/powerpc/include/asm/nohash/pgtable.h @@ -157,9 +157,9 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, flush_hash_entry(mm, ptep, addr); #endif __asm__ __volatile__("\ - stw%U0%X0 %2,%0\n\ + stw%X0 %2,%0\n\ eieio\n\ - stw%U0%X0 %L2,%1" + stw%X1 %L2,%1" : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4)) : "r" (pte) : "memory"); -- 2.27.0