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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4094FC433EF for ; Fri, 31 Dec 2021 11:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229821AbhLaL3x (ORCPT ); Fri, 31 Dec 2021 06:29:53 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55760 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbhLaL3v (ORCPT ); Fri, 31 Dec 2021 06:29:51 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BV6teKp016507; Fri, 31 Dec 2021 11:28:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=pzUt4LgyPXDJP5o63yyZnj398P6Tb55t1EAvGioG3k8=; b=g160z1MzL7ZaBJP0PCFl8WM+/oaNldyPX5T/b2OeqniIg6zpoJJ47PVZUowg0MtVBM+b 75D8w5J5YM6d+KsITNJ6SyAPHmjNd4qzLkRKe2Aa5iqaRILDTl8nTunlrD/V/PWQopyi ffu+DrDe3G3FsNW8naQ0Vs9Jme2ccq8/xhb9T75Om2b3Ho14lej524nWlJSXlp9TAAz1 NyTMooQ1KiqpJr+uzRKwIcFVyCGx228US4hJSEC5MwRoddDO03iAEPHtx6Mul7n9ZuAB j9Zbs6TrzO/vN/WHJf/odeWes281S8+pAqE18r2f1uyR1y9UGT7YCQUk3l3U7i4EttAT XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:34 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BVBRr2I030593; Fri, 31 Dec 2021 11:28:33 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:33 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BVBO64f003482; Fri, 31 Dec 2021 11:28:30 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 3d5txa0f1e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:30 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1BVBSRO447514016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Dec 2021 11:28:27 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7DF04203F; Fri, 31 Dec 2021 11:28:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2638942047; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Received: from sig-9-145-181-202.de.ibm.com (unknown [9.145.181.202]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Message-ID: <072b9080be4a408052bf2c2cc1a9be0089cce5cc.camel@linux.ibm.com> Subject: Re: [RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary From: Niklas Schnelle To: Michael Schmitz , Arnd Bergmann Cc: Geert Uytterhoeven , Bjorn Helgaas , John Garry , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Dinh Nguyen , Chris Zankel , Karol Gugala , Jeff Dike , Yoshinori Sato , Brian Cain , Heiko Carstens , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Michal Simek , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Rich Felker , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, linux-s390@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Greg Ungerer Date: Fri, 31 Dec 2021 12:28:23 +0100 In-Reply-To: <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-3-schnelle@linux.ibm.com> <1f90f145-219e-1cad-6162-9959d43a27ad@gmail.com> <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: d7GAvK0BVAwkfUmW9z0Tnb-kHBnvpkJi X-Proofpoint-ORIG-GUID: nVApRVBnj1QdMi6qsc--MaC8MDeDduB8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-31_04,2021-12-30_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 clxscore=1011 priorityscore=1501 mlxscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112310050 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2021-12-30 at 16:44 +1300, Michael Schmitz wrote: > Hi Arnd, > > Am 30.12.2021 um 14:48 schrieb Arnd Bergmann: > > On Tue, Dec 28, 2021 at 11:15 PM Michael Schmitz wrote: > > > Am 29.12.2021 um 16:41 schrieb Arnd Bergmann: > > > > On Tue, Dec 28, 2021 at 8:20 PM Michael Schmitz wrote: ---8<--- > > > What some other architectures do is to rely on inb()/outb() to have a > > zero-based offset, and use an io_offset in PCI buses to ensure that a > > low port number on the bus gets translated into a pointer value for the > > virtual mapping in the kernel, which is then represented as an unsigned > > int. > > M54xx does just that for Coldfire: > > arch/m68k/include/asm/io_no.h: > #define PCI_IO_PA 0xf8000000 /* Host physical address */ > > (used to set PCI BAR mappings, so matches your definition above). > > All other (MMU) m68k users of inb()/outb() apply an io_offset in the > platform specific address translation: > > ---8<--- > So as long as support for any of the m68k PCI or ISA bridges is selected > in the kernel config, the appropriate IO space mapping is applied. If no > support for PCI or ISA bridges is selected, we already fall back to zero > offset mapping (but as far as I can tell, it shouldn't be possible to > build a kernel without bridge support but drivers that require it). > > > As this is indistinguishable from architectures that just don't have > > a base address for I/O ports (we unfortunately picked 0 as the default > > PCI_IOBASE value), my suggestion was to start marking architectures > > that may have this problem as using HAS_IOPORT in order to keep > > the existing behavior unchanged. If m68k does not suffer from this, > > making HAS_IOPORT conditional on those config options that actually > > need it would of course be best. > > Following your description, HAS_IOPORT would be required for neither of > PCI, ISA or ATARI_ROM_ISA ?? > No, HAS_IOPORT being set just means that inb() etc. exist and are functional be it as special instructions like on x86 or via an I/O address offset. As I understand it if you do have PCI, ISA or ATARI_ROM_ISA they are functional. If none of them are set and your zero offset mapping means these accessors can't actually be used you could make the declerations ifdeffed on CONFIG_HAS_IOPORT to detect the cases where somone managed to build drivers that require them and that would result in a compile time error instead of silently, or with a NULL pointer warning, compiling code that won't work. 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 18745C433F5 for ; Fri, 31 Dec 2021 11:29:25 +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:Mime-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RWtYLKuqOn205Et4lkVpm41iRqigYdfq2oNr+7Nvt4w=; b=0SU4OvdNKlBfN/ 7p2SvsGUG6ZJg6PdKE39TCihfX+7wnH73eO5ruXb9MflOKHeZwQBRBPMrwAXp/qUHzGDS2PXSkOpI Cag/FPq8n9k9AxD0qSjYsb2VVBflKpaI/q+ALROEJUGsGr1U4E44v1E6tKB+20NhNrOrzTfwArHmc grFmcV+vkSg07SuDn36gBhdIfR6lMv80EipjZ9mlBUHk4o/WmeZcw1nwnizcpYlzFYVzu7LEKQJWt 2fdYWQZz7FrZ471FQe/syMPXOrNl/oWepjZV4WHq4AZJ7VZmV/yFGQzZjJH3NyV6K15TKT+Hql57T NLQnEWAL+TrbMKH7WS+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n3G66-005zZz-9r; Fri, 31 Dec 2021 11:29:22 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n3G60-005zZ4-Gr; Fri, 31 Dec 2021 11:29:18 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BV6teKp016507; Fri, 31 Dec 2021 11:28:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=pzUt4LgyPXDJP5o63yyZnj398P6Tb55t1EAvGioG3k8=; b=g160z1MzL7ZaBJP0PCFl8WM+/oaNldyPX5T/b2OeqniIg6zpoJJ47PVZUowg0MtVBM+b 75D8w5J5YM6d+KsITNJ6SyAPHmjNd4qzLkRKe2Aa5iqaRILDTl8nTunlrD/V/PWQopyi ffu+DrDe3G3FsNW8naQ0Vs9Jme2ccq8/xhb9T75Om2b3Ho14lej524nWlJSXlp9TAAz1 NyTMooQ1KiqpJr+uzRKwIcFVyCGx228US4hJSEC5MwRoddDO03iAEPHtx6Mul7n9ZuAB j9Zbs6TrzO/vN/WHJf/odeWes281S8+pAqE18r2f1uyR1y9UGT7YCQUk3l3U7i4EttAT XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:34 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BVBRr2I030593; Fri, 31 Dec 2021 11:28:33 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:33 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BVBO64f003482; Fri, 31 Dec 2021 11:28:30 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 3d5txa0f1e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:30 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1BVBSRO447514016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Dec 2021 11:28:27 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7DF04203F; Fri, 31 Dec 2021 11:28:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2638942047; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Received: from sig-9-145-181-202.de.ibm.com (unknown [9.145.181.202]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Message-ID: <072b9080be4a408052bf2c2cc1a9be0089cce5cc.camel@linux.ibm.com> Subject: Re: [RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary From: Niklas Schnelle To: Michael Schmitz , Arnd Bergmann Cc: Geert Uytterhoeven , Bjorn Helgaas , John Garry , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Dinh Nguyen , Chris Zankel , Karol Gugala , Jeff Dike , Yoshinori Sato , Brian Cain , Heiko Carstens , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Michal Simek , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Rich Felker , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, linux-s390@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Greg Ungerer Date: Fri, 31 Dec 2021 12:28:23 +0100 In-Reply-To: <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-3-schnelle@linux.ibm.com> <1f90f145-219e-1cad-6162-9959d43a27ad@gmail.com> <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: d7GAvK0BVAwkfUmW9z0Tnb-kHBnvpkJi X-Proofpoint-ORIG-GUID: nVApRVBnj1QdMi6qsc--MaC8MDeDduB8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-31_04,2021-12-30_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 clxscore=1011 priorityscore=1501 mlxscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112310050 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211231_032916_576104_8FEA83EC X-CRM114-Status: GOOD ( 35.16 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org On Thu, 2021-12-30 at 16:44 +1300, Michael Schmitz wrote: > Hi Arnd, > > Am 30.12.2021 um 14:48 schrieb Arnd Bergmann: > > On Tue, Dec 28, 2021 at 11:15 PM Michael Schmitz wrote: > > > Am 29.12.2021 um 16:41 schrieb Arnd Bergmann: > > > > On Tue, Dec 28, 2021 at 8:20 PM Michael Schmitz wrote: ---8<--- > > > What some other architectures do is to rely on inb()/outb() to have a > > zero-based offset, and use an io_offset in PCI buses to ensure that a > > low port number on the bus gets translated into a pointer value for the > > virtual mapping in the kernel, which is then represented as an unsigned > > int. > > M54xx does just that for Coldfire: > > arch/m68k/include/asm/io_no.h: > #define PCI_IO_PA 0xf8000000 /* Host physical address */ > > (used to set PCI BAR mappings, so matches your definition above). > > All other (MMU) m68k users of inb()/outb() apply an io_offset in the > platform specific address translation: > > ---8<--- > So as long as support for any of the m68k PCI or ISA bridges is selected > in the kernel config, the appropriate IO space mapping is applied. If no > support for PCI or ISA bridges is selected, we already fall back to zero > offset mapping (but as far as I can tell, it shouldn't be possible to > build a kernel without bridge support but drivers that require it). > > > As this is indistinguishable from architectures that just don't have > > a base address for I/O ports (we unfortunately picked 0 as the default > > PCI_IOBASE value), my suggestion was to start marking architectures > > that may have this problem as using HAS_IOPORT in order to keep > > the existing behavior unchanged. If m68k does not suffer from this, > > making HAS_IOPORT conditional on those config options that actually > > need it would of course be best. > > Following your description, HAS_IOPORT would be required for neither of > PCI, ISA or ATARI_ROM_ISA ?? > No, HAS_IOPORT being set just means that inb() etc. exist and are functional be it as special instructions like on x86 or via an I/O address offset. As I understand it if you do have PCI, ISA or ATARI_ROM_ISA they are functional. If none of them are set and your zero offset mapping means these accessors can't actually be used you could make the declerations ifdeffed on CONFIG_HAS_IOPORT to detect the cases where somone managed to build drivers that require them and that would result in a compile time error instead of silently, or with a NULL pointer warning, compiling code that won't work. _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc 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 C4CF3C433F5 for ; Fri, 31 Dec 2021 11:29:30 +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:Mime-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9aQ/lto+pt7cMHDRbDYha/pmtVXFKuyfXL4l/6NPiiw=; b=sKcPBURfYYBm44 owr8mGk8QXQk7tqeyOa7HVu3XeqjD/lIEZXectp8owLeLe4NnrzhtuePoULTFBOjQ8eIit236MS7F +XYFnLp15/+rig+3wApvOi+g8Y0mkAcEIGemsY7jVGQZRQreY3xwlumIyuCu6UzpVkeV0kL+TTT5V ksysesHH9sbBj/V00vEwn6aP+u8dvyhsbCsi/kO3i1MBNUfAVwZr9x5uNi0Ais3DRWjdpH294zw7I wP7ficjkdDtssx/JzfuQL2L6x3fOkLl6bk94rN/FOn8+Mj5MBHnsTFp39irPaYwQiFaQ3iguuNf+f iBy08Nci0puy/ovPkcGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n3G64-005zZg-KF; Fri, 31 Dec 2021 11:29:20 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n3G60-005zZ4-Gr; Fri, 31 Dec 2021 11:29:18 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BV6teKp016507; Fri, 31 Dec 2021 11:28:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=pzUt4LgyPXDJP5o63yyZnj398P6Tb55t1EAvGioG3k8=; b=g160z1MzL7ZaBJP0PCFl8WM+/oaNldyPX5T/b2OeqniIg6zpoJJ47PVZUowg0MtVBM+b 75D8w5J5YM6d+KsITNJ6SyAPHmjNd4qzLkRKe2Aa5iqaRILDTl8nTunlrD/V/PWQopyi ffu+DrDe3G3FsNW8naQ0Vs9Jme2ccq8/xhb9T75Om2b3Ho14lej524nWlJSXlp9TAAz1 NyTMooQ1KiqpJr+uzRKwIcFVyCGx228US4hJSEC5MwRoddDO03iAEPHtx6Mul7n9ZuAB j9Zbs6TrzO/vN/WHJf/odeWes281S8+pAqE18r2f1uyR1y9UGT7YCQUk3l3U7i4EttAT XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:34 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BVBRr2I030593; Fri, 31 Dec 2021 11:28:33 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:33 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BVBO64f003482; Fri, 31 Dec 2021 11:28:30 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 3d5txa0f1e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:30 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1BVBSRO447514016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Dec 2021 11:28:27 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7DF04203F; Fri, 31 Dec 2021 11:28:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2638942047; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Received: from sig-9-145-181-202.de.ibm.com (unknown [9.145.181.202]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Message-ID: <072b9080be4a408052bf2c2cc1a9be0089cce5cc.camel@linux.ibm.com> Subject: Re: [RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary From: Niklas Schnelle To: Michael Schmitz , Arnd Bergmann Cc: Geert Uytterhoeven , Bjorn Helgaas , John Garry , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Dinh Nguyen , Chris Zankel , Karol Gugala , Jeff Dike , Yoshinori Sato , Brian Cain , Heiko Carstens , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Michal Simek , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Rich Felker , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, linux-s390@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Greg Ungerer Date: Fri, 31 Dec 2021 12:28:23 +0100 In-Reply-To: <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-3-schnelle@linux.ibm.com> <1f90f145-219e-1cad-6162-9959d43a27ad@gmail.com> <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: d7GAvK0BVAwkfUmW9z0Tnb-kHBnvpkJi X-Proofpoint-ORIG-GUID: nVApRVBnj1QdMi6qsc--MaC8MDeDduB8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-31_04,2021-12-30_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 clxscore=1011 priorityscore=1501 mlxscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112310050 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211231_032916_576104_8FEA83EC X-CRM114-Status: GOOD ( 35.16 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, 2021-12-30 at 16:44 +1300, Michael Schmitz wrote: > Hi Arnd, > > Am 30.12.2021 um 14:48 schrieb Arnd Bergmann: > > On Tue, Dec 28, 2021 at 11:15 PM Michael Schmitz wrote: > > > Am 29.12.2021 um 16:41 schrieb Arnd Bergmann: > > > > On Tue, Dec 28, 2021 at 8:20 PM Michael Schmitz wrote: ---8<--- > > > What some other architectures do is to rely on inb()/outb() to have a > > zero-based offset, and use an io_offset in PCI buses to ensure that a > > low port number on the bus gets translated into a pointer value for the > > virtual mapping in the kernel, which is then represented as an unsigned > > int. > > M54xx does just that for Coldfire: > > arch/m68k/include/asm/io_no.h: > #define PCI_IO_PA 0xf8000000 /* Host physical address */ > > (used to set PCI BAR mappings, so matches your definition above). > > All other (MMU) m68k users of inb()/outb() apply an io_offset in the > platform specific address translation: > > ---8<--- > So as long as support for any of the m68k PCI or ISA bridges is selected > in the kernel config, the appropriate IO space mapping is applied. If no > support for PCI or ISA bridges is selected, we already fall back to zero > offset mapping (but as far as I can tell, it shouldn't be possible to > build a kernel without bridge support but drivers that require it). > > > As this is indistinguishable from architectures that just don't have > > a base address for I/O ports (we unfortunately picked 0 as the default > > PCI_IOBASE value), my suggestion was to start marking architectures > > that may have this problem as using HAS_IOPORT in order to keep > > the existing behavior unchanged. If m68k does not suffer from this, > > making HAS_IOPORT conditional on those config options that actually > > need it would of course be best. > > Following your description, HAS_IOPORT would be required for neither of > PCI, ISA or ATARI_ROM_ISA ?? > No, HAS_IOPORT being set just means that inb() etc. exist and are functional be it as special instructions like on x86 or via an I/O address offset. As I understand it if you do have PCI, ISA or ATARI_ROM_ISA they are functional. If none of them are set and your zero offset mapping means these accessors can't actually be used you could make the declerations ifdeffed on CONFIG_HAS_IOPORT to detect the cases where somone managed to build drivers that require them and that would result in a compile time error instead of silently, or with a NULL pointer warning, compiling code that won't work. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 E2D6BC433EF for ; Fri, 31 Dec 2021 21:01:38 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JQcy91GC1z3bhh for ; Sat, 1 Jan 2022 08:01:37 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=g160z1Mz; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=schnelle@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=g160z1Mz; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JQNFv6rQhz2xg3 for ; Fri, 31 Dec 2021 22:29:23 +1100 (AEDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BV6teKp016507; Fri, 31 Dec 2021 11:28:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=pzUt4LgyPXDJP5o63yyZnj398P6Tb55t1EAvGioG3k8=; b=g160z1MzL7ZaBJP0PCFl8WM+/oaNldyPX5T/b2OeqniIg6zpoJJ47PVZUowg0MtVBM+b 75D8w5J5YM6d+KsITNJ6SyAPHmjNd4qzLkRKe2Aa5iqaRILDTl8nTunlrD/V/PWQopyi ffu+DrDe3G3FsNW8naQ0Vs9Jme2ccq8/xhb9T75Om2b3Ho14lej524nWlJSXlp9TAAz1 NyTMooQ1KiqpJr+uzRKwIcFVyCGx228US4hJSEC5MwRoddDO03iAEPHtx6Mul7n9ZuAB j9Zbs6TrzO/vN/WHJf/odeWes281S8+pAqE18r2f1uyR1y9UGT7YCQUk3l3U7i4EttAT XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:34 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BVBRr2I030593; Fri, 31 Dec 2021 11:28:33 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d9qyvfxms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:33 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BVBO64f003482; Fri, 31 Dec 2021 11:28:30 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 3d5txa0f1e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Dec 2021 11:28:30 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1BVBSRO447514016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Dec 2021 11:28:27 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7DF04203F; Fri, 31 Dec 2021 11:28:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2638942047; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Received: from sig-9-145-181-202.de.ibm.com (unknown [9.145.181.202]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 31 Dec 2021 11:28:24 +0000 (GMT) Message-ID: <072b9080be4a408052bf2c2cc1a9be0089cce5cc.camel@linux.ibm.com> Subject: Re: [RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary From: Niklas Schnelle To: Michael Schmitz , Arnd Bergmann Date: Fri, 31 Dec 2021 12:28:23 +0100 In-Reply-To: <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-3-schnelle@linux.ibm.com> <1f90f145-219e-1cad-6162-9959d43a27ad@gmail.com> <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: d7GAvK0BVAwkfUmW9z0Tnb-kHBnvpkJi X-Proofpoint-ORIG-GUID: nVApRVBnj1QdMi6qsc--MaC8MDeDduB8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-31_04,2021-12-30_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 clxscore=1011 priorityscore=1501 mlxscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112310050 X-Mailman-Approved-At: Sat, 01 Jan 2022 08:00:56 +1100 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , linux-sh@vger.kernel.org, Catalin Marinas , Dave Hansen , linux-pci@vger.kernel.org, linux-mips@vger.kernel.org, "James E.J. Bottomley" , sparclinux@vger.kernel.org, Guo Ren , "H. Peter Anvin" , Borislav Petkov , linux-ia64@vger.kernel.org, linux-riscv@lists.infradead.org, Vincent Chen , Will Deacon , Greg Ungerer , Karol Gugala , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Yoshinori Sato , Helge Deller , x86@kernel.org, Russell King , linux-csky@vger.kernel.org, Ingo Molnar , Geert Uytterhoeven , linux-parisc@vger.kernel.org, Vineet Gupta , Matt Turner , linux-snps-arc@lists.infradead.org, Heiko Carstens , linux-xtensa@linux-xtensa.org, Albert Ou , Jeff Dike , John Garry , linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Ivan Kokshaysky , Greentime Hu , Paul Walmsley , Bjorn Helgaas , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Richard Henderson , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Brian Cain , Nick Hu , linux-kernel@vger.kernel.org, Dinh Nguyen , Palmer Dabbelt , linux-alpha@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, 2021-12-30 at 16:44 +1300, Michael Schmitz wrote: > Hi Arnd, > > Am 30.12.2021 um 14:48 schrieb Arnd Bergmann: > > On Tue, Dec 28, 2021 at 11:15 PM Michael Schmitz wrote: > > > Am 29.12.2021 um 16:41 schrieb Arnd Bergmann: > > > > On Tue, Dec 28, 2021 at 8:20 PM Michael Schmitz wrote: ---8<--- > > > What some other architectures do is to rely on inb()/outb() to have a > > zero-based offset, and use an io_offset in PCI buses to ensure that a > > low port number on the bus gets translated into a pointer value for the > > virtual mapping in the kernel, which is then represented as an unsigned > > int. > > M54xx does just that for Coldfire: > > arch/m68k/include/asm/io_no.h: > #define PCI_IO_PA 0xf8000000 /* Host physical address */ > > (used to set PCI BAR mappings, so matches your definition above). > > All other (MMU) m68k users of inb()/outb() apply an io_offset in the > platform specific address translation: > > ---8<--- > So as long as support for any of the m68k PCI or ISA bridges is selected > in the kernel config, the appropriate IO space mapping is applied. If no > support for PCI or ISA bridges is selected, we already fall back to zero > offset mapping (but as far as I can tell, it shouldn't be possible to > build a kernel without bridge support but drivers that require it). > > > As this is indistinguishable from architectures that just don't have > > a base address for I/O ports (we unfortunately picked 0 as the default > > PCI_IOBASE value), my suggestion was to start marking architectures > > that may have this problem as using HAS_IOPORT in order to keep > > the existing behavior unchanged. If m68k does not suffer from this, > > making HAS_IOPORT conditional on those config options that actually > > need it would of course be best. > > Following your description, HAS_IOPORT would be required for neither of > PCI, ISA or ATARI_ROM_ISA ?? > No, HAS_IOPORT being set just means that inb() etc. exist and are functional be it as special instructions like on x86 or via an I/O address offset. As I understand it if you do have PCI, ISA or ATARI_ROM_ISA they are functional. If none of them are set and your zero offset mapping means these accessors can't actually be used you could make the declerations ifdeffed on CONFIG_HAS_IOPORT to detect the cases where somone managed to build drivers that require them and that would result in a compile time error instead of silently, or with a NULL pointer warning, compiling code that won't work. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niklas Schnelle Date: Fri, 31 Dec 2021 12:28:23 +0100 Subject: [OpenRISC] [RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary In-Reply-To: <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-3-schnelle@linux.ibm.com> <1f90f145-219e-1cad-6162-9959d43a27ad@gmail.com> <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> Message-ID: <072b9080be4a408052bf2c2cc1a9be0089cce5cc.camel@linux.ibm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.org On Thu, 2021-12-30 at 16:44 +1300, Michael Schmitz wrote: > Hi Arnd, > > Am 30.12.2021 um 14:48 schrieb Arnd Bergmann: > > On Tue, Dec 28, 2021 at 11:15 PM Michael Schmitz wrote: > > > Am 29.12.2021 um 16:41 schrieb Arnd Bergmann: > > > > On Tue, Dec 28, 2021 at 8:20 PM Michael Schmitz wrote: ---8<--- > > > What some other architectures do is to rely on inb()/outb() to have a > > zero-based offset, and use an io_offset in PCI buses to ensure that a > > low port number on the bus gets translated into a pointer value for the > > virtual mapping in the kernel, which is then represented as an unsigned > > int. > > M54xx does just that for Coldfire: > > arch/m68k/include/asm/io_no.h: > #define PCI_IO_PA 0xf8000000 /* Host physical address */ > > (used to set PCI BAR mappings, so matches your definition above). > > All other (MMU) m68k users of inb()/outb() apply an io_offset in the > platform specific address translation: > > ---8<--- > So as long as support for any of the m68k PCI or ISA bridges is selected > in the kernel config, the appropriate IO space mapping is applied. If no > support for PCI or ISA bridges is selected, we already fall back to zero > offset mapping (but as far as I can tell, it shouldn't be possible to > build a kernel without bridge support but drivers that require it). > > > As this is indistinguishable from architectures that just don't have > > a base address for I/O ports (we unfortunately picked 0 as the default > > PCI_IOBASE value), my suggestion was to start marking architectures > > that may have this problem as using HAS_IOPORT in order to keep > > the existing behavior unchanged. If m68k does not suffer from this, > > making HAS_IOPORT conditional on those config options that actually > > need it would of course be best. > > Following your description, HAS_IOPORT would be required for neither of > PCI, ISA or ATARI_ROM_ISA ?? > No, HAS_IOPORT being set just means that inb() etc. exist and are functional be it as special instructions like on x86 or via an I/O address offset. As I understand it if you do have PCI, ISA or ATARI_ROM_ISA they are functional. If none of them are set and your zero offset mapping means these accessors can't actually be used you could make the declerations ifdeffed on CONFIG_HAS_IOPORT to detect the cases where somone managed to build drivers that require them and that would result in a compile time error instead of silently, or with a NULL pointer warning, compiling code that won't work. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niklas Schnelle Date: Fri, 31 Dec 2021 11:28:23 +0000 Subject: Re: [RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary Message-Id: <072b9080be4a408052bf2c2cc1a9be0089cce5cc.camel@linux.ibm.com> List-Id: References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-3-schnelle@linux.ibm.com> <1f90f145-219e-1cad-6162-9959d43a27ad@gmail.com> <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> In-Reply-To: <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Michael Schmitz , Arnd Bergmann Cc: Geert Uytterhoeven , Bjorn Helgaas , John Garry , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Dinh Nguyen , Chris Zankel , Karol Gugala , Jeff Dike , Yoshinori Sato , Brian Cain , Heiko Carstens , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Michal Simek , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Rich Felker , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, linux-s390@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Greg Ungerer On Thu, 2021-12-30 at 16:44 +1300, Michael Schmitz wrote: > Hi Arnd, > > Am 30.12.2021 um 14:48 schrieb Arnd Bergmann: > > On Tue, Dec 28, 2021 at 11:15 PM Michael Schmitz wrote: > > > Am 29.12.2021 um 16:41 schrieb Arnd Bergmann: > > > > On Tue, Dec 28, 2021 at 8:20 PM Michael Schmitz wrote: ---8<--- > > > What some other architectures do is to rely on inb()/outb() to have a > > zero-based offset, and use an io_offset in PCI buses to ensure that a > > low port number on the bus gets translated into a pointer value for the > > virtual mapping in the kernel, which is then represented as an unsigned > > int. > > M54xx does just that for Coldfire: > > arch/m68k/include/asm/io_no.h: > #define PCI_IO_PA 0xf8000000 /* Host physical address */ > > (used to set PCI BAR mappings, so matches your definition above). > > All other (MMU) m68k users of inb()/outb() apply an io_offset in the > platform specific address translation: > > ---8<--- > So as long as support for any of the m68k PCI or ISA bridges is selected > in the kernel config, the appropriate IO space mapping is applied. If no > support for PCI or ISA bridges is selected, we already fall back to zero > offset mapping (but as far as I can tell, it shouldn't be possible to > build a kernel without bridge support but drivers that require it). > > > As this is indistinguishable from architectures that just don't have > > a base address for I/O ports (we unfortunately picked 0 as the default > > PCI_IOBASE value), my suggestion was to start marking architectures > > that may have this problem as using HAS_IOPORT in order to keep > > the existing behavior unchanged. If m68k does not suffer from this, > > making HAS_IOPORT conditional on those config options that actually > > need it would of course be best. > > Following your description, HAS_IOPORT would be required for neither of > PCI, ISA or ATARI_ROM_ISA ?? > No, HAS_IOPORT being set just means that inb() etc. exist and are functional be it as special instructions like on x86 or via an I/O address offset. As I understand it if you do have PCI, ISA or ATARI_ROM_ISA they are functional. If none of them are set and your zero offset mapping means these accessors can't actually be used you could make the declerations ifdeffed on CONFIG_HAS_IOPORT to detect the cases where somone managed to build drivers that require them and that would result in a compile time error instead of silently, or with a NULL pointer warning, compiling code that won't work. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niklas Schnelle Subject: Re: [RFC 02/32] Kconfig: introduce HAS_IOPORT option and select it as necessary Date: Fri, 31 Dec 2021 12:28:23 +0100 Message-ID: <072b9080be4a408052bf2c2cc1a9be0089cce5cc.camel@linux.ibm.com> References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-3-schnelle@linux.ibm.com> <1f90f145-219e-1cad-6162-9959d43a27ad@gmail.com> <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=pzUt4LgyPXDJP5o63yyZnj398P6Tb55t1EAvGioG3k8=; b=g160z1MzL7ZaBJP0PCFl8WM+/oaNldyPX5T/b2OeqniIg6zpoJJ47PVZUowg0MtVBM+b 75D8w5J5YM6d+KsITNJ6SyAPHmjNd4qzLkRKe2Aa5iqaRILDTl8nTunlrD/V/PWQopyi ffu+DrDe3G3FsNW8naQ0Vs9Jme2ccq8/xhb9T75Om2b3Ho14lej524nWlJSXlp9TAAz1 NyTMooQ1KiqpJr+uzRKwIcFVyCGx228US4hJSEC5MwRoddDO03iAEPHtx6Mul7n9ZuAB j9Zbs6TrzO/vN/WHJf/odeWes281S8+pAqE18r2f1uyR1y9UGT7YCQUk3l3U7i4EttAT XQ== In-Reply-To: <0211719b-8402-9865-8e5d-5c0a35715816@gmail.com> List-ID: Content-Type: text/plain; charset="us-ascii" To: Michael Schmitz , Arnd Bergmann Cc: Geert Uytterhoeven , Bjorn Helgaas , John Garry , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Dinh Nguyen , Chris Zankel , Karol Gugala , Jeff Dike , Yoshinori Sato , Brian Cain , Heiko Carstens , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta On Thu, 2021-12-30 at 16:44 +1300, Michael Schmitz wrote: > Hi Arnd, > > Am 30.12.2021 um 14:48 schrieb Arnd Bergmann: > > On Tue, Dec 28, 2021 at 11:15 PM Michael Schmitz wrote: > > > Am 29.12.2021 um 16:41 schrieb Arnd Bergmann: > > > > On Tue, Dec 28, 2021 at 8:20 PM Michael Schmitz wrote: ---8<--- > > > What some other architectures do is to rely on inb()/outb() to have a > > zero-based offset, and use an io_offset in PCI buses to ensure that a > > low port number on the bus gets translated into a pointer value for the > > virtual mapping in the kernel, which is then represented as an unsigned > > int. > > M54xx does just that for Coldfire: > > arch/m68k/include/asm/io_no.h: > #define PCI_IO_PA 0xf8000000 /* Host physical address */ > > (used to set PCI BAR mappings, so matches your definition above). > > All other (MMU) m68k users of inb()/outb() apply an io_offset in the > platform specific address translation: > > ---8<--- > So as long as support for any of the m68k PCI or ISA bridges is selected > in the kernel config, the appropriate IO space mapping is applied. If no > support for PCI or ISA bridges is selected, we already fall back to zero > offset mapping (but as far as I can tell, it shouldn't be possible to > build a kernel without bridge support but drivers that require it). > > > As this is indistinguishable from architectures that just don't have > > a base address for I/O ports (we unfortunately picked 0 as the default > > PCI_IOBASE value), my suggestion was to start marking architectures > > that may have this problem as using HAS_IOPORT in order to keep > > the existing behavior unchanged. If m68k does not suffer from this, > > making HAS_IOPORT conditional on those config options that actually > > need it would of course be best. > > Following your description, HAS_IOPORT would be required for neither of > PCI, ISA or ATARI_ROM_ISA ?? > No, HAS_IOPORT being set just means that inb() etc. exist and are functional be it as special instructions like on x86 or via an I/O address offset. As I understand it if you do have PCI, ISA or ATARI_ROM_ISA they are functional. If none of them are set and your zero offset mapping means these accessors can't actually be used you could make the declerations ifdeffed on CONFIG_HAS_IOPORT to detect the cases where somone managed to build drivers that require them and that would result in a compile time error instead of silently, or with a NULL pointer warning, compiling code that won't work.