From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 774EFC433EF for ; Thu, 2 Sep 2021 22:22:35 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E1C261041 for ; Thu, 2 Sep 2021 22:22:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9E1C261041 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4H0wQv0FGWz2yxW for ; Fri, 3 Sep 2021 08:22:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=permerror (SPF Permanent Error: Unknown mechanism found: ip:192.40.192.88/32) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lists.ozlabs.org (Postfix) with ESMTP id 4H0wQR5PGlz2xqx for ; Fri, 3 Sep 2021 08:22:07 +1000 (AEST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 182MK3Ll023453; Thu, 2 Sep 2021 17:20:03 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 182MK2IW023450; Thu, 2 Sep 2021 17:20:02 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 2 Sep 2021 17:20:02 -0500 From: Segher Boessenkool To: Nicholas Piggin Subject: Re: [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state Message-ID: <20210902222002.GN1583@gate.crashing.org> References: <20210901165418.1412891-1-npiggin@gmail.com> <65ed1ac8-f4af-742a-1d2a-e5db7e71a920@csgroup.eu> <1630553233.5hjr91skvz.astroid@bobo.none> <20210902215203.GM1583@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210902215203.GM1583@gate.crashing.org> User-Agent: Mutt/1.4.2.3i X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eirik Fuller , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Sep 02, 2021 at 04:52:03PM -0500, Segher Boessenkool wrote: > On Thu, Sep 02, 2021 at 01:33:10PM +1000, Nicholas Piggin wrote: > > Excerpts from Christophe Leroy's message of September 2, 2021 3:21 am: > > >> - /* Firstly we need to enable TM in the kernel */ > > >> + /* We need to enable TM in the kernel, and disable EE (for scv) */ > > >> mfmsr r10 > > >> li r9, 1 > > >> rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG > > >> + LOAD_REG_IMMEDIATE(r9, MSR_EE) > > >> + andc r10, r10, r9 > > > > > > Why not use 'rlwinm' to mask out MSR_EE ? > > > > > > Something like > > > > > > rlwinm r10, r10, 0, ~MSR_EE > > > > Mainly because I'm bad at powerpc assembly. Why do you think I'm trying > > to change as much as possible to C? > > The actual bit (bit 31, i.e. with value 1UL << 32) cannot be cleared > with rlwinm (only the low 32 bits can). There are many ways to do it > using two insns of course. Wow I misread that, you want to clear MSR[EE] really, not MSR[TM]. You cannot use rlwinm and keep the high 32 bits of the target register intact. You either clear all to 0 or set them to a copy of the rotated value in the low 32 bits. Segher