From patchwork Wed Feb 23 13:58:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 545573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECF0FC433F5 for ; Wed, 23 Feb 2022 13:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236595AbiBWN7N (ORCPT ); Wed, 23 Feb 2022 08:59:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiBWN7N (ORCPT ); Wed, 23 Feb 2022 08:59:13 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC0E999ED9 for ; Wed, 23 Feb 2022 05:58:45 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id bn33so24758328ljb.6 for ; Wed, 23 Feb 2022 05:58:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TtmeV9bgxOIabhJpHOR897CD9xgb87UemODU6yGgV2U=; b=GymnIA83ywZadcnbrH4WXAA1AYMSMwQQFG+f6+MJGcGzXs93QyC+I3pkZAYZUY1t7n BB4H1PhCoHA3ERxhhsMdBWyONDAMvWvgnq8s1XgGDFMk/XFgO6POiisIUkVULMiiR28d L457MenKKJCMf59k6BkSgvmwgqFqc27/fA+obvrgeubI2hNPDP5drUQvxWtD3a2FINm1 aX5NL8q3McFgAd3fuku73JiC0o/muPvfaOzg852LwuWz6Qn1TjH3hwkO70YTCYzGhj0H 7a4g8JAUsH993rQyM3gjS5Slv40OhdGEud634eHKE81XX0ZC+Tq+m1r67d/6B0KrJaou AAuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TtmeV9bgxOIabhJpHOR897CD9xgb87UemODU6yGgV2U=; b=NiNUfGygzefLY/rwoCczCEatOdaHKrZ3Qn6n0Ms9F71dQYuveDYJvacK1P6SIts9y2 wyjbmzqyO0Mt+0tOF1RGHJ/zWaiiFtdxOIS0tpr/JE4PCe8W9h0NY0JpUnNvh0ezXeHG EKPlOEstV0miyoDkh2wr0+LQqN+lzqMfHnLWnkxSCVa4W88c42Uv3p0hGs1mE+jQPtct gVTlOtLCyzIV8fGbyvhle4YC8t9yufHzlWqRzq5l02bK4o7cQWwL3jlqwKEggyDronN3 EyNr27E61cfR7bN88RMUi8RE6N0W/IWMmh74lv+mSwNqXriYU6X8HuSGaZ8Qj3XyhoT4 zhyg== X-Gm-Message-State: AOAM5321tRQWFdFYEjDG1LzPC9MFcPfJGIW1SJL/jxTiyppsa0LXYRZf xPOs+t/42piY/nzMhA92htVAZw== X-Google-Smtp-Source: ABdhPJxdhGGNcfhWILNWBQG+bDluWfBg0UF4vCKHIstcbc31RJ6jCLB737+rgRuExlH3ou4RVu/I5w== X-Received: by 2002:a05:651c:1597:b0:246:6331:c697 with SMTP id h23-20020a05651c159700b002466331c697mr696830ljq.265.1645624724041; Wed, 23 Feb 2022 05:58:44 -0800 (PST) Received: from localhost (c-9b28e555.07-21-73746f28.bbcust.telenor.se. [85.229.40.155]) by smtp.gmail.com with ESMTPSA id w10sm1649505lfu.200.2022.02.23.05.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 05:58:43 -0800 (PST) From: Anders Roxell To: mpe@ellerman.id.au Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Anders Roxell , stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 1/3] powerpc: lib: sstep: fix 'sthcx' instruction Date: Wed, 23 Feb 2022 14:58:18 +0100 Message-Id: <20220223135820.2252470-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Looks like there been a copy paste mistake when added the instruction 'stbcx' twice and one was probably meant to be 'sthcx'. Changing to 'sthcx' from 'stbcx'. Cc: # v4.13+ Fixes: 350779a29f11 ("powerpc: Handle most loads and stores in instruction emulation code") Reported-by: Arnd Bergmann Signed-off-by: Anders Roxell Reviewed-by: Nicholas Piggin --- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index bd3734d5be89..d2d29243fa6d 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -3389,7 +3389,7 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op) __put_user_asmx(op->val, ea, err, "stbcx.", cr); break; case 2: - __put_user_asmx(op->val, ea, err, "stbcx.", cr); + __put_user_asmx(op->val, ea, err, "sthcx.", cr); break; #endif case 4: From patchwork Wed Feb 23 13:58:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 545572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1D76C433EF for ; Wed, 23 Feb 2022 13:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241276AbiBWN7S (ORCPT ); Wed, 23 Feb 2022 08:59:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241271AbiBWN7P (ORCPT ); Wed, 23 Feb 2022 08:59:15 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E871B0A50 for ; Wed, 23 Feb 2022 05:58:47 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id e8so16863944ljj.2 for ; Wed, 23 Feb 2022 05:58:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aHyzMFtQe0EUOGyo5aNMOVUBLvuCyxjF47uhkzb6m4c=; b=kErSueoTeHbWeWky89XlisWfN7RXR5Bflcws8Duv1Byb1Kjh6SF4QfOqyyH08ANsvr YCBvyKZjsm46rLQCoeD5JVy+tQiKQRI+WhZ4MZP6JubaTFlr24WPJHfFvjKfMFiv7n64 /J+uOha29mNmckK7Skdqrj9iZ9ShzeHKZ+TEdPTJykePyCGNzgsCqXHq36TLn6MlMCmz pEogmT6UzYgfoCF1MgWeFvfNElXy0hAnBm+zOZ+C4sZ79i1L6ukdUe5xmf2b+0/OCBnr XXur+Bz41evUrrlQ8GLP01gv320vzdqUu3DMs6qv+PHpFSasxuk1NYXaot5vBdBdtShd 1jdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aHyzMFtQe0EUOGyo5aNMOVUBLvuCyxjF47uhkzb6m4c=; b=7cmHmkyTvlJnHQGWXRakpCH/ySS5u9fBzw6PSH75N3JB21Um3LkD4t6tnKbkS9s8E+ CqBFzgw2sRIMJH413Z42WdMqXHBjrDoFylyiPV16dNchdmyPbrCSjPIc2MmB0zdBy/3q ZNVBp2llQdvsUC1JlUerTsfCBnitvwFGO+5NtvwSuHPtN0JDCL95ZRqYTW/POzlu6hZS 4o6UkuYblT+FHCP0gKLqccxBIb8uUpYKwVfr3gLpHdRl1UV+lw4pxLruqYMGmcMfJjq+ hsuSYW9JfXfkEeb3Mj9+70Qb/xhksMgSQxC3pUKmVlyWyIe2J4W9b7XEY+lzEiYsZw9n NIcg== X-Gm-Message-State: AOAM532e246f9tA7PBnKNPM8jaOT6RkmiMPyEFrD5aXXTJlUh7Y1QjZW eRMB5RCNSRlBXkqQd+bdc+dwFA== X-Google-Smtp-Source: ABdhPJy+EUB1iUZR6g+rNGOcfuP/RW3CsnyJ4DsE44Il+ubBCSVjVoKE42htrM/ebNo+fSdbSc3ufQ== X-Received: by 2002:a05:651c:307:b0:244:dc4c:c2f2 with SMTP id a7-20020a05651c030700b00244dc4cc2f2mr20026151ljp.531.1645624725984; Wed, 23 Feb 2022 05:58:45 -0800 (PST) Received: from localhost (c-9b28e555.07-21-73746f28.bbcust.telenor.se. [85.229.40.155]) by smtp.gmail.com with ESMTPSA id v29sm2099448ljv.72.2022.02.23.05.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 05:58:45 -0800 (PST) From: Anders Roxell To: mpe@ellerman.id.au Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Anders Roxell , stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 3/3] powerpc: lib: sstep: fix build errors Date: Wed, 23 Feb 2022 14:58:20 +0100 Message-Id: <20220223135820.2252470-3-anders.roxell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223135820.2252470-1-anders.roxell@linaro.org> References: <20220223135820.2252470-1-anders.roxell@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up: {standard input}: Assembler messages: {standard input}:10576: Error: unrecognized opcode: `stbcx.' {standard input}:10680: Error: unrecognized opcode: `lharx' {standard input}:10694: Error: unrecognized opcode: `lbarx' Rework to add assembler directives [1] around the instruction. The problem with this might be that we can trick a power6 into single-stepping through an stbcx. for instance, and it will execute that in kernel mode. [1] https://sourceware.org/binutils/docs/as/PowerPC_002dPseudo.html#PowerPC_002dPseudo Cc: Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Anders Roxell --- arch/powerpc/lib/sstep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index d2d29243fa6d..b9f43bbdd55a 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -1097,7 +1097,10 @@ NOKPROBE_SYMBOL(emulate_dcbz); #define __put_user_asmx(x, addr, err, op, cr) \ __asm__ __volatile__( \ + ".machine \"push\"\n" \ + ".machine \"power8\"\n" \ "1: " op " %2,0,%3\n" \ + ".machine \"pop\"\n" \ " mfcr %1\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ @@ -1110,7 +1113,10 @@ NOKPROBE_SYMBOL(emulate_dcbz); #define __get_user_asmx(x, addr, err, op) \ __asm__ __volatile__( \ + ".machine \"push\"\n" \ + ".machine \"power8\"\n" \ "1: "op" %1,0,%2\n" \ + ".machine \"pop\"\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ "3: li %0,%3\n" \