Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2350592pxy; Tue, 3 Aug 2021 04:27:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxm/RMKcFHDaaf6ck2BYSAJ+HjheG+lK0WegTBTm5BpHn8WqE3SZjyyiQwXMmqjUBuGMu8 X-Received: by 2002:a17:907:75cd:: with SMTP id jl13mr19521681ejc.327.1627990041090; Tue, 03 Aug 2021 04:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627990041; cv=none; d=google.com; s=arc-20160816; b=i2Rjcio0D6F8uXanIL4SIgSgXQVoBSGWL3I1fpb/qAJC6dR9DWy9DS10L6OVTTLjjI mbU2HwZoNh7ETRVBn1DYbbf/Qswb3Zq5o/5nA/F9NCVxSDC/WEfrvZ7dkay/za5PV+bY u/mCynSQcIlLl0DvvEFPtFk1NASeAFrDaPNAmvQp2/eWjlk/GtJWzrsKWbuFczZ7nw5a JMX8JFPEE7RWWu31enq4SVd+kM1SzyiwVTgZHH+7cjv/zlxIJp1ywLsFh1h/5T4XIxHM UyT6H17FjJ7slDy5N4Y1Mf22jwJNFcx15FTMVAK1vnBEcdUIBfvOssISwKdNXRunMElN hFBA== 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=Cngxtkt9y6eaYCsC+cZEzO7JuSBfhckVZXpmMkWIShM=; b=hhMKcHma/hRS5Wbf1u0kKMWMxRZLrkOL4KKH2U8MTC9cH46NzMPpQmmEcjElnRfZj4 iu3Aft3i8AYpKk+aomuuQzjZkBvrPwL6rXh0sNuFXFjsPzbvwwQH5a18SlFWrI67dunq Rd9H05dFqVaNGZxrKaMfVBO6n+sU8zNfJiwHEDCDPhbCkvF8mYp+sCSN4dQnNOQOz+ht BFw7q7kq9PWkR/67VF14TtB7UOUIceXqNor9B+26gjHTOLjhEtURKIggb9151gHVIRoR orfZUwXW1AhsM8nC901HZySE5lbZWWvWNxO928ulYDnc1PlrsL+MBsHygjb1KWWu7PUh sPzQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x23si1662259ejv.167.2021.08.03.04.26.56; Tue, 03 Aug 2021 04:27:21 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235472AbhHCLYe (ORCPT + 99 others); Tue, 3 Aug 2021 07:24:34 -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