From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8316CC433F5 for ; Fri, 6 May 2022 13:16:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=okaTxopvcrXjnSaPBWOpUiS5wvF3OHr1Hka6zBmlPgk=; b=elYCebvVOt/E50 zWLM5RyWeGC3vY4mmbOidlJ8dCNnkutz2QtpwZ98qiDass98OdxRiUAEXZGKvDcEZoNqhr35UIwTT Mr/PdPO3VFHgCsyOsgiUwJ6zVSbTbIt8f2dmKc28/jj7xHdvGAltrk2M4snDYBRgsw+xHOrkf12Zi rWnUvt/wZIP74QFsHd9qtfzoYW1/2FggWTEJN3IThY49WTZDYFJhuHvW0ncpvz+1LnkPFST6gho19 Jvp8t/s58j7qDEUDddWoVs0YaDJeekAfni1IfSZotW5CQ1xp3laOkocs1UwOUXbwRjHrpC3nD/bVU SfEVO5PctEsjXEL1Slqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmxni-003Mp1-HK; Fri, 06 May 2022 13:15:18 +0000 Received: from mail-qt1-f176.google.com ([209.85.160.176]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmxnZ-003Mkr-Bp; Fri, 06 May 2022 13:15:10 +0000 Received: by mail-qt1-f176.google.com with SMTP id x9so5923420qts.6; Fri, 06 May 2022 06:15:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G2s+AM5Z/cEWfKtZbdmffBUO5M791JT3EdrRSPC+WgI=; b=MtezCPxYDntcaxxZm67GFxY0p2KB24Dj/ngyXeG+FCQxYJRiL8gH4gujWkaQdirneN 8/FWtGV7xoPBhgsVHvzVIEOqIcmlgHYV1V80wB6xUVIqhqnC99ulWQsCE3TjB2wPyVci vgGrCvDKS+a5Xu+8RgAwAHicl4ebB6CwjpuykYPjjP/FTrdSYDmc9jW7nOWeRHR5cLxD 6Z9IVFE9xrscLAyaEWMucVWEiKHQFAKqiL4k1zt9UzbILlEWUapbOAtk2ZJ8GOqVWZOa F31tDuFNIZzvTsMGW7sPQiqhvuRRsnLwmlEVsotgyB9xm2i817kH4lhdrl4GN9oZ77Mv Gdeg== X-Gm-Message-State: AOAM531YK+9597n1UHq7lgfEgcHeM2uQTNQiZ4kyL/kmcVSK1NSdV4d8 LOuFdNt7NuMIAiwGgd54nq2haYJoLth2jg== X-Google-Smtp-Source: ABdhPJzf1aOyHdkxpsrHhv9KowkiW59mtaBKuLXxf3/+eKfxdOA7tKVfp1EvAVaEVY+fmHbMToARtA== X-Received: by 2002:a05:622a:1998:b0:2f3:ba11:d768 with SMTP id u24-20020a05622a199800b002f3ba11d768mr2579884qtc.672.1651842903159; Fri, 06 May 2022 06:15:03 -0700 (PDT) Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com. [209.85.219.169]) by smtp.gmail.com with ESMTPSA id l15-20020ac848cf000000b002f39b99f6c3sm2444924qtr.93.2022.05.06.06.15.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 May 2022 06:15:03 -0700 (PDT) Received: by mail-yb1-f169.google.com with SMTP id w17so12774711ybh.9; Fri, 06 May 2022 06:15:02 -0700 (PDT) X-Received: by 2002:a25:4506:0:b0:648:cfc2:301d with SMTP id s6-20020a254506000000b00648cfc2301dmr2250498yba.380.1651842538339; Fri, 06 May 2022 06:08:58 -0700 (PDT) MIME-Version: 1.0 References: <20220505161028.GA492600@bhelgaas> <5239892986c94239a122ab2f7a18a7a5@AcuMS.aculab.com> In-Reply-To: <5239892986c94239a122ab2f7a18a7a5@AcuMS.aculab.com> From: Geert Uytterhoeven Date: Fri, 6 May 2022 15:08:46 +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: David Laight Cc: "Maciej W. Rozycki" , Arnd Bergmann , Rich Felker , "open list:IA64 (Itanium) PLATFORM" , "open list:SUPERH" , Catalin Marinas , Dave Hansen , "open list:MIPS" , "James E.J. Bottomley" , "open list:SPARC + UltraSPARC (sparc/sparc64)" , "open list:RISC-V ARCHITECTURE" , Will Deacon , linux-arch , Yoshinori Sato , Helge Deller , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Russell King , Ingo Molnar , linux-pci , Bjorn Helgaas , Matt Turner , Albert Ou , Arnd Bergmann , Niklas Schnelle , "open list:M68K ARCHITECTURE" , Ivan Kokshaysky , Paul Walmsley , Thomas Gleixner , "moderated list:ARM PORT" , Richard Henderson , Michal Simek , Thomas Bogendoerfer , "open list:PARISC ARCHITECTURE" , Greg Kroah-Hartman , Linux Kernel Mailing List , Palmer Dabbelt , "open list:ALPHA PORT" , Borislav Petkov , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , "David S. Miller" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220506_061509_434777_7893D6A8 X-CRM114-Status: GOOD ( 45.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 6, 2022 at 2:56 PM David Laight wrote: > From: Maciej W. Rozycki > > Sent: 06 May 2022 13:27 > > On Fri, 6 May 2022, Arnd Bergmann wrote: > > > > If this is PCI/PCIe indeed, then an I/O access is just a different bit > > > > pattern put on the bus/in the TLP in the address phase. So what is there > > > > inherent to the s390 architecture that prevents that different bit pattern > > > > from being used? > > > > > > The hardware design for PCI on s390 is very different from any other > > > architecture, and more abstract. Rather than implementing MMIO register > > > access as pointer dereference, this is a separate CPU instruction that > > > takes a device/bar plus offset as arguments rather than a pointer, and > > > Linux encodes this back into a fake __iomem token. > > > > OK, that seems to me like a reasonable and quite a clean design (on the > > hardware side). > > > > So what happens if the instruction is given an I/O rather than memory BAR > > as the relevant argument? Is the address space indicator bit (bit #0) > > simply ignored or what? > > You don't understand something... > > For a memory BAR pci_ioremap() returns a token that can be used with readl(). > On most architectures readl() is just a memory access. > This all fails on an I/O BAR. > > For an I/O BAR you want a similar pair of functions. > On x86 the access function would need to use the 'in/out' instructions but > there is no requirement for the token to be the native io port number. > On many non-x86 architectures the access function would be a simple memory > access - but a specific system (eg many ppc) may never actually allow > such mappings to succeed. > > You might also want a third PCI mapping function that can map a memory > BAR or an I/O BAR - with a suitable access function. > On x86 this would need something like ioread8() for accesses. > Except that function uses small integers for io port numbers > (which is inherently dangerous). > > Nothing except the architecture specific implementation of the function > to access an io BAR would ever go near a function called inb(). > > The same is really true for other bus type - including ISA and EISA. > (Ignoring the horrid of probing ISI bus devices - hopefully they > are in the ACPI tables??_ > If a driver is probed on a ISA bus there ought to be functions > equivalent to pci_ioremap() (for both memory and IO addresses) > that return tokens appropriate for the specific bus. > > That is all a different load of churn. A loooong time ago, it was suggested to add register accessor functions to struct device, so e.g. readl(dev, offset) would call into these accessors, which would implement the bus-specific behavior. No more worries about readl(), __raw_readl(), ioread32b(), or whatever quirk is needed, at the (small on nowadays' machines) expense of some indirection... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel