Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5921324ybl; Tue, 27 Aug 2019 11:35:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYz72OZYNVc6uZYc3SVaH3TWNwx8fXA4zTxILj31o9ZIa6lJpiTj4AIIFExyTApSjyl9ZZ X-Received: by 2002:a63:66c5:: with SMTP id a188mr22410729pgc.127.1566930947876; Tue, 27 Aug 2019 11:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566930947; cv=none; d=google.com; s=arc-20160816; b=dFMjtX8vsY71q9vDHBX5NtgN2gJ0ozXa0GwBUSihtGdsieEy5GfSo4xqpHq5PJsp4W y9UiOrhnwqbBAaTVwR69m4NHgPO2ALIQuqTzm0o77OwaZAZcaBpemKnBKTtDlUcsXxLZ 0bj1vHT/m6SkQkKsc+kKzZgtb/UGjYA28zEODZrlTY3OX7Ubet7pQpRfR05CJm5pPX47 01QzrSGXnMwu2y9Q1tTANL7Q/10s4UX7Rbasw0/SX1zW4aj93LNznYECu3ZvHV1X3J+N 0RPri2vqu9wNVb7BJfanIwvbuw7zJ2HlGuTOftdOZM4SLCHGjnboMUC+3sKuqd3BdL8k fC0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=S21lhrPpGd6dbYfJ8cqZd9xshNHamMkQCPlDAE1DQLQ=; b=d6qAQflCG0STHqxstJUsiJbYdYcjR87bJVm5raG7k7bdPPztmGk9gWaRmGqM8fGtEK 75TFP+/0KZLsMCGz2aBxWlr4tZOvo+Dc00P71CNBd2vr1y32x4mdUQzgD9FCFNYrLvus SijiMTRDgt21+u3i4uBE0I3pWMCUBcFD3yOqGgFhdpnqNKpiAr9Zl/Axw7dZ9mZW3iVN 6wHVcePHQcN5N6i3RJGATWsZ+XytaRHfmA7UB5kl9OFgrIChsOM4e4gNCWKR6ZIMstfk GSqIUBleqCNsmGCE2LcMmKAEXzMYz+BxVYf2ouCYc/VIq+3izEUrBKcHY4qgq2Bek9w3 JpLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=Se7EgIR6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m63si14539391pfb.182.2019.08.27.11.35.31; Tue, 27 Aug 2019 11:35:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=Se7EgIR6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730573AbfH0Sds (ORCPT + 99 others); Tue, 27 Aug 2019 14:33:48 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:20318 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730393AbfH0Sds (ORCPT ); Tue, 27 Aug 2019 14:33:48 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46HyF60c9Kz9tyVK; Tue, 27 Aug 2019 20:33:46 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=Se7EgIR6; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id J_eUXk7cwSWF; Tue, 27 Aug 2019 20:33:46 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 46HyF56fMVz9tyVG; Tue, 27 Aug 2019 20:33:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1566930825; bh=S21lhrPpGd6dbYfJ8cqZd9xshNHamMkQCPlDAE1DQLQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Se7EgIR6k6yEUFd0XqRUPKvOIkZd2w0BG6cAq1TQGDUZPr4lrsTG39DLpT2B1NarH hLUUSSbklI0KhG+T3Ji9rdL+SOyOrzBrlfmY+I2ffps7TqPox9MYQDMIDkYFmBwl3S Z2nnkpAVernPwu3vTZB2n1DuYDpIhHBkWzhR527U= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E61778B847; Tue, 27 Aug 2019 20:33:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id fvXHAOH7aW9s; Tue, 27 Aug 2019 20:33:45 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6FF4B8B842; Tue, 27 Aug 2019 20:33:45 +0200 (CEST) Subject: Re: [PATCH 2/2] powerpc: cleanup hw_irq.h To: Segher Boessenkool Cc: Nicholas Piggin , Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <0f7e164afb5d1b022441559fe5a999bb6d3c0a23.1566893505.git.christophe.leroy@c-s.fr> <81f39fa06ae582f4a783d26abd2b310204eba8f4.1566893505.git.christophe.leroy@c-s.fr> <1566909844.x4jee1jjda.astroid@bobo.none> <20190827172909.GA31406@gate.crashing.org> <1410046b-e1a3-b892-2add-6c1d353cb781@c-s.fr> <20190827182616.GB31406@gate.crashing.org> From: Christophe Leroy Message-ID: <00cc71bd-35f5-b0d5-e4fa-8368fe4fe78c@c-s.fr> Date: Tue, 27 Aug 2019 20:33:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190827182616.GB31406@gate.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 27/08/2019 à 20:26, Segher Boessenkool a écrit : > On Tue, Aug 27, 2019 at 07:36:35PM +0200, Christophe Leroy wrote: >> Le 27/08/2019 à 19:29, Segher Boessenkool a écrit : >>> On Tue, Aug 27, 2019 at 10:48:24PM +1000, Nicholas Piggin wrote: >>>> Christophe Leroy's on August 27, 2019 6:13 pm: >>>>> +#define wrtee(val) asm volatile("wrtee %0" : : "r" (val) : "memory") >>>>> +#define wrteei(val) asm volatile("wrteei %0" : : "i" (val) : >>>>> "memory") >>>> >>>> Can you implement just one macro that uses __builtin_constant_p to >>>> select between the imm and reg versions? I forgot if there's some >>>> corner cases that prevent that working with inline asm i constraints. >>> >>> static inline void wrtee(long val) >>> { >>> asm volatile("wrtee%I0 %0" : : "n"(val) : "memory"); >>> } >> >> Great, didn't know that possibility. >> >> Can it be used with any insn, for instance with add/addi ? >> Or with mr/li ? > > Any instruction, yes. %I simply outputs an "i" if operand n is a > constant integer, and nothing otherwise. Thinking about it once more, I'm not sure this form is possible, because wrteei expect 0 or 1. If someone calls wrtee(MSR_EE); (or any constant containing MSR_EE) wrteei 1 is expected. And any constant with MSR_EE cleared should result in wrteei 0. > > So > asm("add%I2 %0,%1,%2" : "=r"(dst) : "r"(src1), "ri"(src1)); "ri", not "n" as for wrtee ? Christophe > works well. I don't see how you would use it for li/mr... You can do > asm("add%I1 %0,0,%1" : "=r"(dst) : "ri"(src)); > I suppose, but that is not really an mr. > >>> (This output modifier goes back to the dark ages, some 2.4 or something). >> >> Hope Clang support it ... > > I don't know, sorry. But it is used all over the place, see sfp-machine.h > for example, so maybe? > > > Segher >