Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2943105pxb; Tue, 19 Jan 2021 09:37:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJywgEmYMbtChbjPrMr9aZZcnX9xb4oTL2C2ZH3u45o2c4iukfeI/tG05KRu/UbRTzqsNWMX X-Received: by 2002:a17:906:da02:: with SMTP id fi2mr3534240ejb.230.1611077821976; Tue, 19 Jan 2021 09:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611077821; cv=none; d=google.com; s=arc-20160816; b=LwcM+GgbbtFNFTre3DYdOuRWkEDl1gns6GaVfV4XKXPgXXIkbkID5SKjN9xx3aFKyS 0qoERqWERQB74xg7idB39XwhEnvsb8zLoCoEgTPasN/jiW14OCqRctjkmKyN2zNDgkaf FopG3KNm3PJiH8IYFA31huCH2BYnqDmKmIulhYptM0Ya1Unc2cGClG9wAe3RnEPksHUo jfpimT8Ey+2Y6cFd6LOec6hZqN9aCfKdGinLdPkpwfSvZWvx5Ow24i/fv6eO1eYjtTP4 V4HYYFLq10SW0UJCx/wlqmdnKE9LIxKhUrM8UDohr0b87LAT8rWaWrUMKgVbMLcMe6D+ uvCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=OtRmdQ8N6ExupOsvwQVr5oYzNQP6Z+F7Y5UP37atJBY=; b=zTw4p5e0E5ws0ZNs+Jw6zd+VuL6ZG145G17eAzQdqbDb4IH/obzWM9u+TTyV/yDaiD CGJnRQIytwoV5fL2mOHAQPOHj3dEGDLpBFMQckCvuGqtZ+y7L4PS+7h0wM9ivPmvSSd0 ytxYC/PGI1LCvfdcWYzpf9K9Ok7PX0+rQ8WBdH6C186nQgM74OSL1TylUXrP6LFDLI8G vD2RYTqFjBLvjE3V/UadiAHaMeLd9mbjEAAk0ceTqcxcIg+rMTH9PJ6m1wuzS7eUFqeG i8ifQL+2LT5mKvKISy9hKW6W/UYesqLstpO7ZKw7t7JbIh3DZT+ZkpkN1J2bqYuJfUfj LzqA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si9558191edn.257.2021.01.19.09.36.38; Tue, 19 Jan 2021 09:37:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731022AbhASRfN (ORCPT + 99 others); Tue, 19 Jan 2021 12:35:13 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:14738 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391658AbhASReQ (ORCPT ); Tue, 19 Jan 2021 12:34:16 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4DKwjf69LSz9v6K4; Tue, 19 Jan 2021 18:33:26 +0100 (CET) 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 mB7-tkk37xPd; Tue, 19 Jan 2021 18:33:26 +0100 (CET) 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 4DKwjf5H2tz9v6K3; Tue, 19 Jan 2021 18:33:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 654328B7DE; Tue, 19 Jan 2021 18:33:28 +0100 (CET) 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 sag3JxnQsqAg; Tue, 19 Jan 2021 18:33:28 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9DAD18B7C7; Tue, 19 Jan 2021 18:33:27 +0100 (CET) Subject: Re: [PATCH v6 04/49] soc: fsl: qe: introduce qe_io{read,write}* wrappers To: Rasmus Villemoes Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Scott Wood , Timur Tabi , Qiang Zhao , Li Yang References: <20191128145554.1297-1-linux@rasmusvillemoes.dk> <20191128145554.1297-5-linux@rasmusvillemoes.dk> From: Christophe Leroy Message-ID: Date: Tue, 19 Jan 2021 18:33:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20191128145554.1297-5-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rasmus, Le 28/11/2019 à 15:55, Rasmus Villemoes a écrit : > The QUICC engine drivers use the powerpc-specific out_be32() etc. In > order to allow those drivers to build for other architectures, those > must be replaced by iowrite32be(). However, on powerpc, out_be32() is > a simple inline function while iowrite32be() is out-of-line. So in > order not to introduce a performance regression on powerpc when making > the drivers work on other architectures, introduce qe_io* helpers. > > Also define the qe_{clr,set,clrset}bits* helpers in terms of these new > macros. Since commit https://github.com/linuxppc/linux/commit/894fa235eb4ca0bfa692dbe4932c2f940cdc8c1e ioread/iowrite wrappers are also inlined on PPC32, so this commit can now be reverted. Christophe > > Reviewed-by: Timur Tabi > Signed-off-by: Rasmus Villemoes > --- > include/soc/fsl/qe/qe.h | 34 +++++++++++++++++++++++++--------- > 1 file changed, 25 insertions(+), 9 deletions(-) > > diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h > index a1aa4eb28f0c..9cac04c692fd 100644 > --- a/include/soc/fsl/qe/qe.h > +++ b/include/soc/fsl/qe/qe.h > @@ -241,21 +241,37 @@ static inline int qe_alive_during_sleep(void) > #define qe_muram_offset cpm_muram_offset > #define qe_muram_dma cpm_muram_dma > > -#define qe_setbits_be32(_addr, _v) iowrite32be(ioread32be(_addr) | (_v), (_addr)) > -#define qe_clrbits_be32(_addr, _v) iowrite32be(ioread32be(_addr) & ~(_v), (_addr)) > +#ifdef CONFIG_PPC32 > +#define qe_iowrite8(val, addr) out_8(addr, val) > +#define qe_iowrite16be(val, addr) out_be16(addr, val) > +#define qe_iowrite32be(val, addr) out_be32(addr, val) > +#define qe_ioread8(addr) in_8(addr) > +#define qe_ioread16be(addr) in_be16(addr) > +#define qe_ioread32be(addr) in_be32(addr) > +#else > +#define qe_iowrite8(val, addr) iowrite8(val, addr) > +#define qe_iowrite16be(val, addr) iowrite16be(val, addr) > +#define qe_iowrite32be(val, addr) iowrite32be(val, addr) > +#define qe_ioread8(addr) ioread8(addr) > +#define qe_ioread16be(addr) ioread16be(addr) > +#define qe_ioread32be(addr) ioread32be(addr) > +#endif > + > +#define qe_setbits_be32(_addr, _v) qe_iowrite32be(qe_ioread32be(_addr) | (_v), (_addr)) > +#define qe_clrbits_be32(_addr, _v) qe_iowrite32be(qe_ioread32be(_addr) & ~(_v), (_addr)) > > -#define qe_setbits_be16(_addr, _v) iowrite16be(ioread16be(_addr) | (_v), (_addr)) > -#define qe_clrbits_be16(_addr, _v) iowrite16be(ioread16be(_addr) & ~(_v), (_addr)) > +#define qe_setbits_be16(_addr, _v) qe_iowrite16be(qe_ioread16be(_addr) | (_v), (_addr)) > +#define qe_clrbits_be16(_addr, _v) qe_iowrite16be(qe_ioread16be(_addr) & ~(_v), (_addr)) > > -#define qe_setbits_8(_addr, _v) iowrite8(ioread8(_addr) | (_v), (_addr)) > -#define qe_clrbits_8(_addr, _v) iowrite8(ioread8(_addr) & ~(_v), (_addr)) > +#define qe_setbits_8(_addr, _v) qe_iowrite8(qe_ioread8(_addr) | (_v), (_addr)) > +#define qe_clrbits_8(_addr, _v) qe_iowrite8(qe_ioread8(_addr) & ~(_v), (_addr)) > > #define qe_clrsetbits_be32(addr, clear, set) \ > - iowrite32be((ioread32be(addr) & ~(clear)) | (set), (addr)) > + qe_iowrite32be((qe_ioread32be(addr) & ~(clear)) | (set), (addr)) > #define qe_clrsetbits_be16(addr, clear, set) \ > - iowrite16be((ioread16be(addr) & ~(clear)) | (set), (addr)) > + qe_iowrite16be((qe_ioread16be(addr) & ~(clear)) | (set), (addr)) > #define qe_clrsetbits_8(addr, clear, set) \ > - iowrite8((ioread8(addr) & ~(clear)) | (set), (addr)) > + qe_iowrite8((qe_ioread8(addr) & ~(clear)) | (set), (addr)) > > /* Structure that defines QE firmware binary files. > * >