From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4383C432BE for ; Tue, 3 Aug 2021 11:24:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 842B560F56 for ; Tue, 3 Aug 2021 11:24:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235493AbhHCLYf (ORCPT ); Tue, 3 Aug 2021 07:24:35 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3569 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235254AbhHCLYd (ORCPT ); Tue, 3 Aug 2021 07:24:33 -0400 Received: from fraeml735-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GfCF55N1Kz6F7wr; Tue, 3 Aug 2021 19:24:09 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml735-chm.china.huawei.com (10.206.15.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 3 Aug 2021 13:24:21 +0200 Received: from [10.47.27.165] (10.47.27.165) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 3 Aug 2021 12:24:20 +0100 Subject: Re: [GIT PULL 1/2] asm-generic: rework PCI I/O space access To: Arnd Bergmann CC: Linus Torvalds , linux-arch , linux-pci , "Linux Kernel Mailing List" , Niklas Schnelle References: From: John Garry Message-ID: Date: Tue, 3 Aug 2021 12:23:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.27.165] X-ClientProxiedBy: lhreml737-chm.china.huawei.com (10.201.108.187) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> Anyway, one thing I mentioned earlier was that we could solve the >> problem of drivers accessing unmapped IO ports and crashing systems on >> archs which define PCI_IOBASE by building them under some "native port >> IO support" flag. > Right, that was part of the goal here. Great > >> One example of such a driver was F71805F sensor. You put that under >> HAS_IOPORT, which would be available for all archs, I think. But I could >> not see where config LEGACY_PCI is introduced. Could we further refine >> that config to not build for such archs as arm64? >> >> BTW, I think that the PPC dependency was added there to stop building >> for power for that same reason, so hopefully we get rid of that. > Good point. It seems that I actually never added the LEGACY_PCI option > to my patch, ok, it would be nice to see that. > so I'm just not building those drivers any more, and not > defining the inb()/outb() helpers either, causing a build failure when I'm > missing an option. > > However it sounds like you are interested in a third option here, which > brings us to: > > LEGACY_PCI: any PCI driver that uses inb()/outb() or is only available > on old-style PCI but not PCIe hardware without a bridge. > To be disabled for most architectures and possibly distros but can > be enabled for kernels that want to use those devices, as long as > CONFIG_HAS_IOPORT is set by the architecture. > > HAS_IOPORT: not a legacy PCI device, but can only be built on > architectures that define inb()/outb(). To be disabled for s390 > and any other machine that has no useful definition of those > functions. That seems reasonable. And asm-generic io.h should be ifdef'ed by HAS_IOPORT. In your patch you had it under CONFIG_IOPORT - was that intentional? On another point, I noticed SCSI driver AHA152x depends on ISA, but is not an isa driver - however it does use port IO. Would such dependencies need to be changed to depend on HAS_IOPORT? I did notice that arm32 support CONFIG_ISA - not sure why. > > HARDCODED_IOPORT: (or another name you might think of,) Used by > drivers that unconditionally do inb()/outb() without checking the > validity of the address using firmware or other methods first. > depends on HAS_IOPORT and possibly architecture specific > settings. Yeah, that sounds the same as what I was thinking. Maybe IOPORT_NATIVE could work as a name. I would think that only x86/ia64 would define it. A concern though is that someone could argue that is a functional dependency, rather than just a build dependency. Thanks, John