Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2307212pxy; Tue, 3 Aug 2021 03:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjdUG0jUjiVZP3h7ptWzcuLXFmhXeR9zqJ2AARk/LzDAZ9jP6euX59HjGQeUxZonl4qx5q X-Received: by 2002:a05:6402:11c6:: with SMTP id j6mr9420655edw.349.1627985470040; Tue, 03 Aug 2021 03:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627985470; cv=none; d=google.com; s=arc-20160816; b=Y7kL3hvPvTGEwyWhmKBeDV2+ZPXTGrqcBBFO9aLiKo58NjFkODVFkiI9/2qvx7WK8P 9xw+xHlAGdOt6etBfelblv28kXTsb9+Bs4Qwt67P8gv5ISBzAkWoxPhxLvbMc4dTTLUH dpzmO0nhnWYTatPMPtKrJrZd6CR38kyVOuHzDgqJoA1viR96RrdXBi0j4uxNjnTpwal6 2hug1eN2d90oLIxmhvv7Bd0O4EuKdrolSkw0OiFUBBS1QtMFwLHLya0e4mrw4lwWTOT1 jd+gZVTbl+WP27RcNNzGxgwy7mag2Hh8Eln1EmRuKt1InthNfZimZENO9agvB9EDQZnl ckNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3RVVdcTDZy9ykB6X7c3z/czaU0R9zxhsVoAC7io15V8=; b=wjy70SLntF0iB+xnxE/PQMw3d6VwNvH7AlEvoIzn6xUbJIuytAHf66R+NoYSEfpPpE IOf+tjNwIAh3l+AKeTM/rSN2crdzT2zY0XNCPxhhGXG9q5Id99wzES39NzXKF6LbujgD gPQBh7q6HR5HXG0z6MB06q2eTe3l8moJXNcYDWxbzTym9LDizxjMMBwLJZRnUsjs08r6 j7SE9B8oWMZDWGMMXYCGnlvFO6kscpO7Dgn+9yZgU8k1ziRKrSHeilcdbVJBzK6GjKcO +lllg1ZQMopHWhVLJqJl/zGnbBJ2ftF4/wU/GvjpS2FJcdDIl3pCyfGjdORyjUlv2pZr YwJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XjEoXzfx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss12si5651161ejb.133.2021.08.03.03.10.46; Tue, 03 Aug 2021 03:11:10 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XjEoXzfx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235327AbhHCKHL (ORCPT + 99 others); Tue, 3 Aug 2021 06:07:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:49430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235311AbhHCKGl (ORCPT ); Tue, 3 Aug 2021 06:06:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0FEB161037; Tue, 3 Aug 2021 10:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627985190; bh=amKFWwxpJKw04QvdgzwXcqsqQ+F/NFHyOuqZIXDbk1c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XjEoXzfxmIrUj6YEyI/1nn/bFs2XN+/1xIOKmEHh0ZliMJ5miWSi+KFFZIRV3i7G2 FBrJg3xGZEemgh0lmKXUutXASdMU7DRx9DckTewzZjBLWp8lRLMRMUSKGKuqcCKO+l ywlbG/UOew23gdqMNVJAxev4x7DpcgrR/mzQCI5/+dKHpgKqkUE+Na3I3u+kLYkjtX i7/fC/yZfwtjd0GzE8BnThUGq2RudTGu5crO5cEWqVvtHEJtMfwwbOno3XDsozhmOW KL5VuuEoYMgqxbSYgNBVZlbXHbiix9eK5dS/jUIJeg3C+Rwmm3iFECfc3wGbsjWa+I jwqXueqQa3flg== Received: by mail-wr1-f44.google.com with SMTP id h14so24656967wrx.10; Tue, 03 Aug 2021 03:06:29 -0700 (PDT) X-Gm-Message-State: AOAM531A7mScJe+/xPVmNxqueEODpJTRthL+CSgYUTN+tombAV3UEeDh 3I1G4HQ9haAkq3D/ZZwCdieaWY7b7spDR1L2NkY= X-Received: by 2002:adf:e107:: with SMTP id t7mr22121083wrz.165.1627985188658; Tue, 03 Aug 2021 03:06:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Tue, 3 Aug 2021 12:06:12 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL 1/2] asm-generic: rework PCI I/O space access To: John Garry Cc: Linus Torvalds , linux-arch , linux-pci , Linux Kernel Mailing List , Niklas Schnelle Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 3, 2021 at 11:46 AM John Garry wrote: > On 05/07/2021 11:06, Arnd Bergmann wrote: > > > > Linus, if you like this approach, then I can work on splitting it up into > > meaningful patches and submit it for a future release. I think the > > CONFIG_LEGACY_PCI option has value on its own, but the others > > do introduce some churn. > > > > Full patch (120KB): https://pastebin.com/yaFSmAuY > > > > Hi Arnd, > > I am not sure if anything is happening here. No, I'm not currently working on this, though I have it applied to my randconfig tree. > 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. > 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, 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. 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. Arnd