Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1189640pxu; Sat, 12 Dec 2020 05:05:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDaOsdFBApDbMjzMwnSVnV+fm3uE6+D8a69oyna0d2OiZlJOkWE1OMr4KjgukwTsPcqUMU X-Received: by 2002:a17:906:c087:: with SMTP id f7mr15131874ejz.492.1607778317219; Sat, 12 Dec 2020 05:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607778317; cv=none; d=google.com; s=arc-20160816; b=IMqB54tbF49JiHvn9NAVJGsxPigW8zyZq548QyuDJ5QRiC8bLQwrCA6p5euP2cGKEp 3fq0IX/hXFFz6bkU5a21MM2cpMpJm2+/arj/2ha3ZCYBdu0sAQJHKM0hwRqB2NUEyJlb Nb42py7pN4cGnXds6uAuEz7pBUT0F0lF+kt2Sd8YwSmSPPi5dc0+FcKQKqfwCQQ18/4d 75nFWA/z0RkttL4AAfc0a0u+Yp4ZkcK9xmCdouHClxiGhDbuEQmxnKOdfR7y0xmYCxPv GoMckYk6n13sNvVdqavI9I0QLFNFFLejfF6Wl7KAHXrxz7JIoPX4z03DmxP2NFyVigqV wFgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=HBQHLLlOiF1aybBWG07OrQeHIJutU+FOizmYva4gW78=; b=dK7tMFmYGL/NSrFuHwP5GXXC/WzU1L152uf5z2D3DtgqXGjZl9E93wgj0cOZJpO2lJ qO8hMWMB/QlEiU4kePh2+U1Q/hueg4in5kySjJFxITHcUtxS2jabFu6AKN7bmxJ0Ip4q ZN+b+P59qnA/byYFi1KYa5yyjr0fP1/TxhTknZ/JmSdS9W6qCR/1Kk2dtsOyyzDyHWtS 3Amd0w5krqq1j5NyNQzbrY9p8CT3obFVae/pfwnHCi5GS3Q+A6C1ggrmVX/7BKZTeb29 8mF8wb/Pw3rIlnjvQYo90JJwXQ2w5FENTqYA75ibnPTdNS2ezs98FfbpQTeh1D6XQ7H/ vBwg== 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 hp25si6048388ejc.361.2020.12.12.05.04.53; Sat, 12 Dec 2020 05:05:17 -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 S2405635AbgLKNVS (ORCPT + 99 others); Fri, 11 Dec 2020 08:21:18 -0500 Received: from [157.25.102.26] ([157.25.102.26]:43814 "EHLO orcam.me.uk" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2404182AbgLKNVC (ORCPT ); Fri, 11 Dec 2020 08:21:02 -0500 Received: from bugs.linux-mips.org (eddie.linux-mips.org [IPv6:2a01:4f8:201:92aa::3]) by orcam.me.uk (Postfix) with ESMTPS id 3E6062BE0F2; Fri, 11 Dec 2020 13:20:14 +0000 (GMT) Date: Fri, 11 Dec 2020 13:20:09 +0000 (GMT) From: "Maciej W. Rozycki" To: Alan Stern cc: "Enrico Weigelt, metux IT consult" , "linux-kernel@vger.kernel.org" , linux-arch@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: RFC: arch: shall we have generic readl_be()/writel_be()/... or in_be32()/out_be32() ? In-Reply-To: <20201209202024.GA1355417@rowland.harvard.edu> Message-ID: References: <20201209202024.GA1355417@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Dec 2020, Alan Stern wrote: > > I believe we should have generic functions, that all archs implement > > (possibly doing automatic conversion, if necessary), which are used > > by everybody else. > > > > What's your oppionion on that ? > > It certainly seems reasonable. Another possibility, less stringent, is > to require that definitions exist on all architectures that can have > big-endian MMIO (or port-based IO). For example, any architecture > which might select CONFIG_EHCI_BIG_ENDIAN_MMIO, as used in ehci.h. Lane swapping is a complex matter where there is an endianness mismatch between buses. A bus bridge may implement the byte lane match policy or the bit lane match policy, or even both to choose from, perhaps on a case-by-case basis for individual accesses (e.g. with a pair of address windows decoded to the other bus according to a different policy each; I actually have such a system). Consequently not only data transferred may have to be transformed, but so may have the address used. Also the transformation will be different depending on whether data accessed is to be interpreted numerically (where the bit lane match policy is more suitable) such as with CSR access, or as a byte stream (where the byte lane match policy is) such as with PIO data moves. See arch/mips/include/asm/io.h and arch/mips/include/asm/*/mangle-port.h for an example where we take care of different cases. Building infrastructure for doing this all in a generic manner would I think be a good idea, but then a major effort as well, and you'd have to coordinate it with all the arch maintainers. Maciej