Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753822AbbH3Tas (ORCPT ); Sun, 30 Aug 2015 15:30:48 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:64687 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753611AbbH3Tap (ORCPT ); Sun, 30 Aug 2015 15:30:45 -0400 From: Arnd Bergmann To: "Luis R. Rodriguez" Cc: linux-arch@vger.kernel.org, mingo@kernel.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, linux-s390@vger.kernel.org, bp@suse.de, linux@roeck-us.net, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, rostedt@goodmis.org, "Luis R. Rodriguez" Subject: Re: [RFC] asm-generic/pci_iomap.h: make custom PCI BAR requirements explicit Date: Sun, 30 Aug 2015 21:30:26 +0200 Message-ID: <3544271.GfynADMPqZ@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1440807447-584-1-git-send-email-mcgrof@do-not-panic.com> References: <1440807447-584-1-git-send-email-mcgrof@do-not-panic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:t+DmMhG+AFaBC/yCkG6BgN/Uih9NL5+axhC9vGkcoeQxiLheRnR hoJlxJ3I5Kh79gEcX28Q0W4nG1SNnMUb3eA6kITsEiE0BgM41BD+yCp53Al9Z1U70c3u0Wk HqvTjbbjjiWjqSKzdek5HfGajpMPxVbEoBKlQj+5ETIIU4cc8hI4j/uNURRZA9I4e4wdcx0 YWZ3RiMOCW1rcChVXb/dw== X-UI-Out-Filterresults: notjunk:1;V01:K0:KNiDkU8t6Uk=:grXpSw3A8mJ9+kCw2d3DYT 3q8JXukLnPa9hCWG6HOL37IIifh6Tdo8HSTiquaU6p/Vn+ZVfe8uQTIKzRLs5kWTqPLO3ELJ0 bYpV8yYAUsmpWDdVbv6r/fS7CJvy2X8JW0B/ADX5jy2hvqz84Y87Cl7d0xqsG3Eho+C7oaFv+ 2z+SFLFVAS1B2OVxbL0koC65bHBTedsvMRdEYtfOEuhx0epVau1OBl1P/0Zrl+3iOmJh40T+5 bEGZ4YcLfFOgtKtaJaaQr+DdngfQWJmaWElG68Rly2uqUKD3Lb+GtE6vc4Hj2GYeQa5t8Bqi4 MYb6muxWLNP2ro8QkOo8Fvfm+lAQR1zN+2El+SfoYKswTN2nq4o/g/Cqo1NDwgTkkunodCoUf C8M8lPr7wGoh63V2fM1VrMV5ILoVFzeDkbFBWxOCIMM0Pwown4BA0iG51PEcqippheux8y5ti YXhgcAUEjNpg8s5djjNeuVpVxU8iApaMnY9mEcrZwJ3DK09ai53NJBACmIYrEK1qkWwOo3jeK npWS3jWktkGUflmth5q3/YrhOyQCszDMOpF1cIwCPq6zsDjtJTZDXMmlres/qeEHhSOHfcvnR KQy08GvcETiQs1+gEbhCDiERzpS6eojbosnIfl1SM1U+DMh6fP3SYPzQnXBRZxOMzO18l/R4S aw8WjbFb1lakgBkO0HXcUd3NjLC1lEzn3p965Kmeoh6QKgQsib0Ti638xsy8+WhMiygVvSQPi Hj6w93hMiDuP7wmm Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3086 Lines: 68 On Friday 28 August 2015 17:17:27 Luis R. Rodriguez wrote: > From: "Luis R. Rodriguez" > > The S390 architecture requires a custom pci_iomap() implementation > as the asm-generic implementation assumes there are disjunctions > between PCI BARs, and on S390 PCI BAR are not disjunctive, S390 requires > the bar parameter in order to find the corresponding device and create > the mapping cookie. > > This clash with the asm-generic pci_iomap() implementation is implicit, > there are no current semantics to make this incompatability explicit. > Make the S390 PCI BAR non-disjunction incompatibility explicit, and > also pave the way for alternative incompatibilities to be defined. I don't think we really need to spell it out here. s390 PCI is different from everybody else's in a lot of ways, so a simple 'depends on PCI && !S390' for CONFIG_PCI_IOMAP seems simpler and more intuitive. > While at it, as with the ioremap*() variants, since we have no clear > semantics yet well defined provide a solution for them that returns > NULL. This allows architectures to move forward by defining pci_ioremap*() > variants without requiring immediate changes to all architectures. Each > architecture then can implement their own solution as needed and > when they get to it. Which architectures are you thinking about here? > Build tested with allyesconfig on: > > * S390 > * x86_64 > > Signed-off-by: Luis R. Rodriguez It's not really clear to me what the purpose of the patch is, is this meant as a cleanup, or are you trying to avoid some real-life bugs you ran into? > This came up as an idea after noting that S390 has no way to be > explicit about its requirements, this also means we don't have a > quick easy way to ensure that other architectures might have a > conflict as well. This provides an easy way to do that by having > the architectures define their incompatibilities and allowing those > then to negate GENERIC_PCI_IOMAP on lib/Kconfig. PCI_IOMAP seems much simpler than ioport_map here, as a lot of architectures can have overlapping port numbers across PCI host bridges. > I think a next cleanup could be the move of the pci_iounmap() out to > pci_iomap.h to avoid having each arch having to declare it. That's > a separate atomic change though so should go in separately. pci_iounmap() is rather tricky, and I think some architectures currently get it wrong and will actually unmap parts of the I/O port ranges from the PCI host controller mapping. It might be rare enough that it never caused problems (that got reported), but it might be nice to actually provide an implementation that has a chance of working. The version from lib/iomap.c seems correct for uses of CONFIG_GENERIC_IOMAP, but most architectures can do better without that option. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/