Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1995325iob; Thu, 5 May 2022 12:47:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2uebng1Qg0ZOwFuAZ+oQ4dErvgqEjZlQBiJZ6z2lUT5OgjLUKN4n6E9HporraKSKHQXak X-Received: by 2002:a63:2c55:0:b0:3aa:b620:a81 with SMTP id s82-20020a632c55000000b003aab6200a81mr23969902pgs.625.1651780054648; Thu, 05 May 2022 12:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651780054; cv=none; d=google.com; s=arc-20160816; b=PROwCFoyLeFZIP4rodVYpWzsDIny7Feq9BnABttCJFs8UzNZxH182dolfLlkc6mDhd tLWcgKPgjdr3HMX76QuIfIg+J4iGX/K5F2XZ6V/FE87+O9ZHTtrsckm2nDG7vH+q5IM7 Jn0iCYOpi4db9oKhA/g8RDObMo1ISJaufucldEFH8M//4Vl/Uz5twruA0PzKPzv3bjn+ g0v0K1OW5BicUdR+8Vj99tiJCp7qj5ObgPfa1R2ZuByk4DImKOPNzp6WU7fl+QORJ2pS eja195j0LRHjIHSFrX7mt8tfMdSRoRMDtfROaoy5+qbXbqjLQynhJSV98k/hx96cbfp2 qq6A== 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=nZoa94160530Nb3AnJJ02/uz84GIC6P/3whWRcg/EV4=; b=FXo6nvonCqkpoQ6gJrp0vgU0dvxV/MI7LZrf22HzyAxfNOjVr40LMUMBv+s4lVo8Rj qJ4f0FUrWTpcCsYbXwKLEA/T+ettZkPQ9uIUfgqRt5hBpUxbU6yDgm7mwPXOjPy282ng j8z1oTw9BnoGkdraTEXwz4ruUkL41eJVdh+3B/P99MaOKdBlWn80+nbuh2NifPCncgMa n+llCYYfYctj2KE8EENcEazhuRP6WQdTRe4cixFGu9dFTp8QwWxFE8IkVahMuT+samNQ uUdX+cV95IdvyZ+Mg0LEn8XjnVB2ex2QRYPFojRof3NuZUSP31xFYBmJK49DPD3iKujU oLGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jjkpXAHd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b003ab7e64a1f0si2410814pgd.194.2022.05.05.12.47.17; Thu, 05 May 2022 12:47:34 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jjkpXAHd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382816AbiEERoT (ORCPT + 99 others); Thu, 5 May 2022 13:44:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382758AbiEERnw (ORCPT ); Thu, 5 May 2022 13:43:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDDEB5BD2C; Thu, 5 May 2022 10:40:03 -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 ams.source.kernel.org (Postfix) with ESMTPS id 70DA7B82E13; Thu, 5 May 2022 17:40:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA1EC385C1; Thu, 5 May 2022 17:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651772401; bh=2IoE4BfEuAg77WmuhMuImyNDvTFHhyYDFxiBCowXMW0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jjkpXAHdVdaGYPRA/+3MWK8YySttWTFzcYC1keAu8erj/0Qv22sl3zrDQYguGunS5 EYa5oM+lHkIE7YTdldWLi0OWY/DsNHWma+k3zqfE22SXyjFuALh5riYHbPe1kbAc44 9KAWXnmbdCqw/9NbiY+BaqDNCtIn7quRedBG1XfiA99nj6AB8gym8fHYhho7MeeQF1 l9XXlvvZnqwjxE3vlzhp6PnrE7j4IrFhVl0Qex8zon67fDEF5nEZv2gZ3ktfM3q+fs 7pbwFrQBZZkl4jB1bUVpER7HBPy1pVzyBaA4EK56UQiDwNHTAidoXgBZp7AUZ4Ox2c dWIFDXtyn6eAA== Received: by mail-wm1-f47.google.com with SMTP id l62-20020a1c2541000000b0038e4570af2fso3057496wml.5; Thu, 05 May 2022 10:40:00 -0700 (PDT) X-Gm-Message-State: AOAM530yTQ0JfV7UcZJ2sGdAUtPmpZUHjzeVwfywFlcrhtcN+zBTpQ3E I54ikdPAfAKxu/CEiGl5fe/z60RnqY9ehyeeKhM= X-Received: by 2002:a7b:cc93:0:b0:394:2622:fcd9 with SMTP id p19-20020a7bcc93000000b003942622fcd9mr6321312wma.20.1651772399229; Thu, 05 May 2022 10:39:59 -0700 (PDT) MIME-Version: 1.0 References: <20220505161028.GA492600@bhelgaas> In-Reply-To: <20220505161028.GA492600@bhelgaas> From: Arnd Bergmann Date: Thu, 5 May 2022 19:39:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC v2 01/39] Kconfig: introduce HAS_IOPORT option and select it as necessary To: Bjorn Helgaas 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)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 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. powerpc kernels generally map the I/O space into a section of the physical address space, where it gets mapped into a fixed virtual address and accessed through pointer dereference. This works on any powerpc CPU as long as it is implemented in the PCI host bridge in the usual way. The only difference between powerpc and arm here is that there are fewer implementations, so one can make assumptions about which PCI host bridge is used based on a CPU core. Arnd