Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp127409iob; Tue, 3 May 2022 13:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFT8Nj6D12AUom8FFHlwylfoAmuDNHF2/2shtajiwBVAlyubIv8+kjSoIH+YMl7nw78npw X-Received: by 2002:a17:902:d70a:b0:158:7f07:e7c9 with SMTP id w10-20020a170902d70a00b001587f07e7c9mr18304599ply.109.1651608627847; Tue, 03 May 2022 13:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651608627; cv=none; d=google.com; s=arc-20160816; b=V+OoPdrTxsVS1iCbDXJUnToz4A4ndjhwk3YG5IlNgbeODPv/gJxqkC58Kxb0/Pe8RI P11sFFVNxVU560Em6uUGt7yPIncnU5M4R1JQfcwBh2T/qo/jloW27pDjzLwAwXLh39Gf NDfXpVjApJ69rDDDxHtrHvBEXS+0ZsJ89ySauxw6fPr+2dxv2q1ubX+pQyw7s3Zh4r3+ +lrqFE2IR6EcJgqZgjMYoQyG18PxNDv1CrLmWSLmaetWBTVAa/ZgPfwgyGJHueeWRsV3 9Y7ENprWvIGIw3VV/8QFQ2snTDB2krWtoNyZKRm8w00/ocl8ImsOuOAdZlv0ibvqlGlF QcJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:message-id:in-reply-to:subject:cc:to:from :date; bh=apPSZh6JseMYVT/nwgzDX9fRXAIUX6pqNJhhy6aNROY=; b=VewA02mQQNYlmh3I+mS/BbvWGSOirHer3k/SPDS5CyPbmBbK/BSqAytxPhtSwoIXYu SIYC86ha/VAjSludKBwOST67ZbfRQzn5XKbBdw10aR543od8t+oTzVZD1CAKS39DDzGz te3LmEsQoDSadmwHrCt7OnSst8UIOMEjPtwk7w3i/eDA8ACxxsb2VTElvx1wP1sLgZY3 rAhX/mMbCQqKerlBGpLPJg80sAwok3OxYhIlU8V81wNgftLdcEMOTDVlVChxVaGpPCVT diHBNikVDx2AEifht6OMtXg1xuhYJxH4cZBBs+h9SeuClF4x9nnbaUu2BpE3k+D9HGOr Hpdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a635246000000b003aab55c53adsi17405097pgl.674.2022.05.03.13.10.12; Tue, 03 May 2022 13:10:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236196AbiECNj7 (ORCPT + 99 others); Tue, 3 May 2022 09:39:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbiECNj4 (ORCPT ); Tue, 3 May 2022 09:39:56 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1078A24598; Tue, 3 May 2022 06:36:23 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 86FD492009C; Tue, 3 May 2022 15:36:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 8082392009B; Tue, 3 May 2022 14:36:21 +0100 (BST) Date: Tue, 3 May 2022 14:36:21 +0100 (BST) From: "Maciej W. Rozycki" To: Niklas Schnelle cc: Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, Marc Kleine-Budde , Arnd Bergmann , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Michael Grzeschik , Wolfgang Grandegger , Jesse Brandeburg , Tony Nguyen , Ralf Baechle , "open list:NETWORKING DRIVERS" , "open list:CAN NETWORK DRIVERS" , "moderated list:INTEL ETHERNET DRIVERS" , "open list:AX.25 NETWORK LAYER" Subject: Re: [RFC v2 21/39] net: add HAS_IOPORT dependencies In-Reply-To: <867e70df01fc938abf93ffa15a3f1989a8fb136b.camel@linux.ibm.com> Message-ID: References: <20220429135108.2781579-1-schnelle@linux.ibm.com> <20220429135108.2781579-36-schnelle@linux.ibm.com> <867e70df01fc938abf93ffa15a3f1989a8fb136b.camel@linux.ibm.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Tue, 3 May 2022, Niklas Schnelle wrote: > > The driver works just fine with MMIO where available, so if `inb'/`outb' > > do get removed, then only parts that rely on port I/O need to be disabled. > > In fact there's already such provision there in drivers/net/fddi/defxx.c > > for TURBOchannel systems (CONFIG_TC), which have no port I/O space either: > > > > #if defined(CONFIG_EISA) || defined(CONFIG_PCI) > > #define dfx_use_mmio bp->mmio > > #else > > #define dfx_use_mmio true > > #endif > > > > so I guess it's just the conditional that will have to be changed to: > > > > #ifdef CONFIG_HAS_IOPORT > > > > replacing the current explicit bus dependency list. The compiler will > > then optimise away all the port I/O stuff (though I suspect dummy function > > declarations may be required for `inb'/`outb', etc.). [...] > With dfx_use_mmio changed as you propose above things compile on s390 > which previously ran into missing (now __compile_error()) inl() via > dfx_port_read_long() -> dfx_inl() -> inl(). Great, thanks for checking! And I note referring `__compile_error' is roughly equivalent to a dummy declaration, so you've got that part sorted. > Looking at the other uses of dfx_use_mmio I notice however that in > dfx_get_bars(), inb() actually gets called when dfx_use_mmio is true. > This happens if dfx_bus_eisa is also true. Now that variable is just > the cached result of DFX_BUS_EISA(dev) which is defined to 0 if > CONFIG_EISA is unset. I'm not 100% sure if going through a local > variable is still considered trivial enough dead code elimination, at > least it works for me™. I did also check the GCC docs and they > explicitly say that __attribute__(error) is supposed to be used when > dead code elimination gets rid of the error paths. Yeah, dead code elimination is supposed to handle such cases. The local automatic variable is essentially a syntactic feature not to use the same expression inline over and over throughout a function (for clarity the variable should probably be declared `const', but that is not essential) and it is up to the compiler whether to reuse the value previously calculated or to re-evaluate the expression. > I think we also need a "depends on HAS_IOPORT" for "config HAVE_EISA" > just as I'm adding for "config ISA". Oh absolutely! There's the slot-specific port I/O space that is used to identify EISA option cards in device discovery, so no EISA device will ever work without port I/O. Have a look at `decode_eisa_sig' in drivers/eisa/eisa-bus.c for the very obvious code. Note that some ISA cards can be configured to appear as EISA devices as well (I have a 3c509B Ethernet NIC set up that way). Maciej