Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp190597ybc; Mon, 11 Nov 2019 23:16:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyF0ijULCzpZfBh4KFYIWeNv8/LG6IOz/O7Hi/OjL/T5HSC4gX2pE5AfL5bXBBU207w+M1G X-Received: by 2002:a05:6402:645:: with SMTP id u5mr1386055edx.201.1573542978901; Mon, 11 Nov 2019 23:16:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573542978; cv=none; d=google.com; s=arc-20160816; b=mwPTGdv6miF8jKnFlADPIhGGR6p/1wykuoJI4wLKluxwPTZm2YbLA6APy7RTxuDlVm FNX114433Q3SlMB81h2hdEIjAUQaCpSc2t36Aryzpzn0HrGe7a0UYGPEOv9fpmRoa6gx 2U0BwX8ws2i4lRB6LyC63KPnVlxvaQoEFoiIMGGfMFv3CDCJdeF9naQ1m5xasb9btDiF SRWTPS2QraFOMfo+Orkeay3M6uxWdjW1lflcnrTGw/x/MQsfEC2d0rPGdfTj7siWFt/9 uvFt/Trz8X+uKQ69iZnzCvgLKyYH/Zh4+M7qI67ooEsod0WxN7hv19iWtPrd0ToLIvNx bTKA== 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=moBLNgsFkEFILNTGmzFVRskFLWF0bywiqBaR+demKl0=; b=xNwc63Jt3GcSLaZKGInJRmA+BhHE1c8D7qp8tK8iqs4QWyFW365fsI62ZVeXRubK0O wmYefth3smFTh9D5cytmEIypwPS8z5YiArAwA7nkA0UCG8Mzbv8UoFydfSVWXwRr6dPu TfnEpY3LjfjUOniCogdkvDB4+7kpMtajjPbu9u3V7bPgzgX+16RcQ9f570WnN8gQOEkJ 2ipHkc66iUAYZY3FMtGZfO4kILwmV//e16T0Z6P836VRwjVUkCy5fcRjLHOMvhmSqfg+ XyANH9UUU0qW2IjyORg2771UAtc7UNeHZLL+cww7Qj8jF/w6cW2SkHXtLQmLOwOp7xC+ 7tjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=WMGkKeOZ; 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 x14si13815816edl.128.2019.11.11.23.15.54; Mon, 11 Nov 2019 23:16:18 -0800 (PST) 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=@rasmusvillemoes.dk header.s=google header.b=WMGkKeOZ; 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 S1727025AbfKLHOY (ORCPT + 99 others); Tue, 12 Nov 2019 02:14:24 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36091 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbfKLHOY (ORCPT ); Tue, 12 Nov 2019 02:14:24 -0500 Received: by mail-lj1-f193.google.com with SMTP id k15so16557633lja.3 for ; Mon, 11 Nov 2019 23:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=moBLNgsFkEFILNTGmzFVRskFLWF0bywiqBaR+demKl0=; b=WMGkKeOZSZv4nK3kYqjUDbJgm6OIX8/Pp5ul5RcMLv8HRndoSur1Gj5yp8uTwr6viK 8pIe3W5+rvA5uDSH0I+6oPAWY7C94jtjF9Ot+31Ik/dH+uPG7MB8lgizP93vIMt3xMc5 N+J/WomRl5rVfra1rtwsIIzgkQZcJ0HySeqwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=moBLNgsFkEFILNTGmzFVRskFLWF0bywiqBaR+demKl0=; b=U1zDpb92FhzME7oiFEt5kOSPOVkBVra+u2/kYvEGerLCVh+UWEsu6EhV1vwSdF2H9r it9qXIoCN6vpSImqpefnAI0lkezZQmxs0gYoTs+CyUHudwmqS52aDh6KBa/zfDHpLkyh 8urjw21Dh/nYX9NyHvXfJh0JnarGthUdRpzypLL/kbEp2EcpUC7xhjFOv6LbH9LKwF1j Vi8Bv1rTFOxi4V6nLAmnyoBN8EKAs/F6mFoNEvNgglw4sIs2u7AsCw4OjwWCbbPcavXE q9wpv1qKjpnxXpLAo54PI6VcsAq8EWp8fWRnj9P7HHI5cEBe0GRpK/fBQSq1nQ83/Htj n5lA== X-Gm-Message-State: APjAAAWL04IlIIdhYyIQSE58VmmzGYcJtX3he1FYj8+25ExOYatYHJ3q HPMukrMp1j46mxg38v74JcTeLA== X-Received: by 2002:a2e:8544:: with SMTP id u4mr2947819ljj.25.1573542862167; Mon, 11 Nov 2019 23:14:22 -0800 (PST) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id p193sm12765748lfa.18.2019.11.11.23.14.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Nov 2019 23:14:21 -0800 (PST) Subject: Re: [PATCH v4 04/47] soc: fsl: qe: introduce qe_io{read,write}* wrappers To: Timur Tabi Cc: Qiang Zhao , Li Yang , Christophe Leroy , Scott Wood , linuxppc-dev@lists.ozlabs.org, lkml , linux-arm-kernel References: <20191108130123.6839-1-linux@rasmusvillemoes.dk> <20191108130123.6839-5-linux@rasmusvillemoes.dk> From: Rasmus Villemoes Message-ID: Date: Tue, 12 Nov 2019 08:14:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/11/2019 06.17, Timur Tabi wrote: > On Fri, Nov 8, 2019 at 7:03 AM Rasmus Villemoes > wrote: >> >> 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. > > Isn't it also true that iowrite32be() assumes a little-endian platform > and always does a byte swap? > No. You're probably thinking of the implementation in lib/iomap.c where one has #define mmio_read32be(addr) swab32(readl(addr)) unsigned int ioread32be(void __iomem *addr) { IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr)); return 0xffffffff; } #define mmio_write32be(val,port) writel(swab32(val),port) void iowrite32be(u32 val, void __iomem *addr) { IO_COND(addr, pio_write32be(val,port), mmio_write32be(val, addr)); } but that's because readl and writel by definition work on little-endian registers. I.e., on a BE platform, the readl and writel implementation must themselves contain a swab, so the above would end up doing two swabs on a BE platform. (On PPC, there's a separate definition of mmio_read32be, namely writel_be, which in turn does a out_be32, so on PPC that doesn't actually end up doing two swabs). So ioread32be etc. have well-defined semantics: access a big-endian register and return the result in native endianness.