Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4734674iob; Sun, 8 May 2022 23:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyTQx7DJRtU2JDitpDlDBBFJS45shFh1dEnxuoRYxpoSlIBZ2J6Zfre7JG6iBZFaYIZ1zd X-Received: by 2002:a17:90b:3015:b0:1dd:343:eebc with SMTP id hg21-20020a17090b301500b001dd0343eebcmr7693760pjb.227.1652078468867; Sun, 08 May 2022 23:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652078468; cv=none; d=google.com; s=arc-20160816; b=W7uLQtUPsJKDSkSx2eGZ0nDgzanf+RrG2vqS5ibozkqn6SsIWd6RmR8t5X0ll4o+zM iqFAX1KX5GAAdeQqzj2cGP+6pvtdja8TYc86r9ijFVc6oN+hAmux7fm2sDjxd3BNeXOe LMwiMzQEWz4exe41T434N8hbScmFrcNX1wsX/WoExris/Zu0jI6mXKSEql7Avu8s5TRz gz/Br5RrScv2qBtFW7xsm8gNUnyZJYXvhmWWDN+JhNKsY5H3PU3vh/8L8iBikgHJfBuA ei1Ie0+aoV87saCUAZZun7yLYQEtgPjVI+xJ5y/9IHMcJzY9e0JwtARvm8PQhYyOYOZH Fjcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=rZ2M+0xQxiVT3QVkY2kCTtvEBctmm5q+lApozBvZ3X4=; b=mMhde6Imdr8nAoOoAn3rQr7G/ZFqAhV3TzDbOCHFulxz+thdfNAjNl5iSWmtrlTdk8 1wHLLfB74Cgf+wisawxtLmVYlm865lNWPaPdg6F/utdbuKFw3knbB94wJrDihndzZvt1 f+xIkaicdiG9pXsObHxqi1tnneL7Hjma6KnylPYIEpARcohGzWDEsnFuwHchm5ivGADE SfMGsn88+8m1qe9497y4GJxJ1BXLL4oL6hAbUWr9MJASTv5CSQLbNsOw24r8nnGa4mbF z3XCkIK2Jq8YseSLEuv21PU/yKpmPAgqWta3wUlTsA+tyyVs29XVeoNMXKNSZavCdnKY zl1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f2fc5oHe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id v1-20020a63b941000000b003c6de02c6bdsi131174pgo.455.2022.05.08.23.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:41:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f2fc5oHe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1A6F618DAE2; Sun, 8 May 2022 23:38:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382915AbiEET5g (ORCPT + 99 others); Thu, 5 May 2022 15:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345160AbiEET53 (ORCPT ); Thu, 5 May 2022 15:57:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F715F246; Thu, 5 May 2022 12:53:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1BBBFCE3070; Thu, 5 May 2022 19:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C68AFC385A4; Thu, 5 May 2022 19:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651780425; bh=fYxm3dr57owbquhz9mi2JlUgAayGWIYeuWXgYwjDgu0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=f2fc5oHeuzoxyJfE63Gjq/EPrO6txRg9hsHH/1s9bcAA7MB9R89IPW2XirzVZc74o JfbdqHGn2i9se2injqakFs9sJs55qbPwsXCW7U2z6292nsC5wpjZYOXUad+0rDxqWU dBktPS+QUeX5KA0qTdRvD/Jeg8g/VinXCSA1zNxox/sHlz0Qu+HDVGZRGj50as/vwO ee4WTtCWIAPTOcKicttAnfNz1to9P/EIAiFFNcHwyePB8PVEBnOd6hroIfxl+9c3Y0 w8Ysllpp8ZwOIQgubSRRm20/01Cu9xOLyCR6eQMh+KyVf58T4+rzmnxImHp1ouw8wP UdmeA6sO/pypA== Date: Thu, 5 May 2022 14:53:42 -0500 From: Bjorn Helgaas To: Arnd Bergmann Cc: Niklas Schnelle , Arnd Bergmann , Greg Kroah-Hartman , Linux Kernel Mailing List , linux-arch , linux-pci , Richard Henderson , Ivan Kokshaysky , Matt Turner , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ALPHA PORT" , "moderated list:ARM PORT" , "open list:IA64 (Itanium) PLATFORM" , "open list:M68K ARCHITECTURE" , "open list:MIPS" , "open list:PARISC ARCHITECTURE" , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , "open list:RISC-V ARCHITECTURE" , "open list:SUPERH" , "open list:SPARC + UltraSPARC (sparc/sparc64)" Subject: Re: [RFC v2 01/39] Kconfig: introduce HAS_IOPORT option and select it as necessary Message-ID: <20220505195342.GA509942@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 05, 2022 at 07:39:42PM +0200, Arnd Bergmann wrote: > On Thu, May 5, 2022 at 6:10 PM Bjorn Helgaas wrote: > > On Wed, May 04, 2022 at 11:31:28PM +0200, Arnd Bergmann wrote: > > > > > > The main goal is to avoid c), which is what happens on s390, but > > > can also happen elsewhere. Catching b) would be nice as well, > > > but is much harder to do from generic code as you'd need an > > > architecture specific inline asm statement to insert a ex_table > > > fixup, or a runtime conditional on each access. > > > > Or s390 could implement its own inb(). > > > > I'm hearing that generic powerpc kernels have to run both on machines > > that have I/O port space and those that don't. That makes me think > > s390 could do something similar. > > No, this is actually the current situation, and it makes absolutely no > sense. s390 has no way of implementing inb()/outb() because there > are no instructions for it and it cannot tunnel them through a virtual > address mapping like on most of the other architectures. (it has special > instructions for accessing memory space, which is not the same as > a pointer dereference here). > > The existing implementation gets flagged as a NULL pointer dereference > by a compiler warning because it effectively is. I think s390 currently uses the inb() in asm-generic/io.h, i.e., "__raw_readb(PCI_IOBASE + addr)". I understand that's a NULL pointer dereference because the default PCI_IOBASE is 0. I mooted a s390 inb() implementation like "return ~0" because that's what happens on most arches when there's no device to respond to the inb(). The HAS_IOPORT dependencies are fairly ugly IMHO, and they clutter drivers that use I/O ports in some cases but not others. But maybe it's the most practical way. Bjorn