Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9097091pxu; Mon, 28 Dec 2020 06:34:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0ha7X6ra3lJNowZIl77beEHZPG7Tiz2yv9n5WIHgWAE93SGis196mu2vMID4i3726UMI0 X-Received: by 2002:a17:906:73d8:: with SMTP id n24mr41246368ejl.14.1609166045499; Mon, 28 Dec 2020 06:34:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166045; cv=none; d=google.com; s=arc-20160816; b=gYmwcsNfp7AAfV2PI8AeTYHJbsxaGPlp7oe2DPtSAbfWxadNXcNZ+usV4JrfMA0fCf 2f0tU6bcF//PrKyzRG5vqYgNn/EQgJ2VQoO23zj6aLUMj+XWXBtQeU6UB7GISieZRDA6 20ZRDLe03SfM/szrc9DP6OF8UYBDLN8h4RuYDHLF+9bgjSTnQbMSmPengarde4EUUOxV aQeCtRXGdrSIUkPg/m0oKl4TD+6+MUcVb72YhioC35aw9n5cRHaMoyYc0i7N3ovGJZ1W XvsYNEyVRfFazLtQYMLW6pqvXsoS6ezRaIpIF+I+fO4PsSRejHZOSrz9pN/kQH7b7ynj ZOHw== 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=ie1AB2kjRJHNMt0Xg3NKyH/VffMeRehAVQKCIB3zf/8=; b=cx45mNpObN9k0POQcVEB0lYgL8Wun+BzD9mf8ZPXQLk9bTfz9UVfofaBrpL75laMRA rWaHHz55fzCFvOJXnauVnmzjmLdBzMkuuS7HalkXyvBqeFxPyFIxZF31SqStjM8AwiyH YqL7hBkl6P5CW3U68oY1bOY1+pLiBhYX+g+ZkytaKKSVPuKWQxqtL+Cei/yiiOd/gUIS v+5N5yppAr/hVE+KXfL1E4F4wlLcnrumw07xHW2+9PHPWpWYzM+jmMuDvbOVU/BZhAhw /47A138pVwuooyFOfZB8JnFSUugvLdZ5pL9wg5sgNB7fhEm8Y0ytLFTWApAwuFScWLPN qncA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z6rBvGL3; 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 l6si18826077ejp.140.2020.12.28.06.33.42; Mon, 28 Dec 2020 06:34:05 -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=Z6rBvGL3; 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 S2503602AbgL1OaL (ORCPT + 99 others); Mon, 28 Dec 2020 09:30:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:38194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503596AbgL1OaL (ORCPT ); Mon, 28 Dec 2020 09:30:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF0E0206D4; Mon, 28 Dec 2020 14:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165770; bh=nJ8OkkptHKXpXmXLhKcCk1US9mbqar6Gka9Jv9LTp1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6rBvGL3x244s8k7OvrbV1rIHkA3phv0QmKWKkjnOeCbZQajD73Q438y9EudF6JqG bkA3N18TYc7+pUNxEsG6nM4/x+cA8/9us5S4UFXkaUHW87NEIS1AkIjyaWozPpVuEK zlNaHwrXZ7gHbQX8Z7eoON8M+rQMG5MFYVhyUcDU= 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 Subject: [PATCH 5.10 608/717] powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at Date: Mon, 28 Dec 2020 13:50:06 +0100 Message-Id: <20201228125050.045165745@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Mathieu Desnoyers commit d85be8a49e733dcd23674aa6202870d54bf5600d upstream. 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: Greg Kroah-Hartman --- arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++-- arch/powerpc/include/asm/nohash/pgtable.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -524,9 +524,9 @@ static inline void __set_pte_at(struct m 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"); --- a/arch/powerpc/include/asm/nohash/pgtable.h +++ b/arch/powerpc/include/asm/nohash/pgtable.h @@ -192,9 +192,9 @@ static inline void __set_pte_at(struct m */ if (IS_ENABLED(CONFIG_PPC32) && IS_ENABLED(CONFIG_PTE_64BIT) && !percpu) { __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"); return;