Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2558033imw; Sun, 10 Jul 2022 09:15:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vGe7I760slBG2xjMlk6c6p6xwgOWxDsorLyHDKtkvK6ifHTz0WUSz38gLAjWY8OhaqvyES X-Received: by 2002:a17:90b:3910:b0:1f0:2e50:6f3f with SMTP id ob16-20020a17090b391000b001f02e506f3fmr4068114pjb.233.1657469739979; Sun, 10 Jul 2022 09:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657469739; cv=none; d=google.com; s=arc-20160816; b=Qsd5p5LmmgPtubUSYvFJYtjWXjiVbaco6Ewi+OzlcgCj93s2zVEi8WbBQCTDb5boRz snMl9Ay7+bqDxAluheSOqXDn89pSKo6IDb9QfwR2UTJIcFS+t+kKkI+vctdko8tC+IWT OHIX2ZZpzM3pD0QeUaIxYBNh5i3PfApZieL7ukgQ7DoBit+G6RRDDZwdiRCrdFmIeLEQ d/4Y809A/VYc5a/bRszaK8oyxRj8bo+vCsYAtezmwHqSh35vJ+o8FNeHMqstPAfJw07C SqvEAdSdddquPpVH5in5o70NTeuc2LjUMBTHEhiT7Z8vSNXeuHefgE4e2GLfkBoxdO2C WZKA== 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; bh=v+02hLMah59k6dmT8qlFb6iljDepQH5wOWMQsnoZaoE=; b=TgE8qV0oCP5pRb98w7vjQ20BQm9tlYYGvlQndL78RkHP/gBZrFI3lfBfBmKCxu3z52 GfJerEd7DKxxfUV8O84O0Y8b0pvNq0S1bQLpWV+oqTdfbVt/1Q5GypkOjtd5aBcZC+Pt jOwQW0myN7Bzw+zHECCEEjTsT1eK7lR/L/R4k/RVuKGAaQNkRbds128vXaXk/OCXk3JF D4ve9mVH0UDZu970a1bhk0oxS+u0SxRaFXwjANiquuOaGxrflHpOzhHjUwXy68LwUCWG +Gn43eegZbFTiK+oqjnXEo9LvfxqAZ7wsOr07E9UPLFJNEXhVU3JFa8/YANj5VvhjQPz fWqA== 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 jg11-20020a17090326cb00b0016bd27ba54csi7116593plb.137.2022.07.10.09.15.27; Sun, 10 Jul 2022 09:15:39 -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 S229544AbiGJPyo (ORCPT + 99 others); Sun, 10 Jul 2022 11:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbiGJPyn (ORCPT ); Sun, 10 Jul 2022 11:54:43 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03A7A65AA for ; Sun, 10 Jul 2022 08:54:41 -0700 (PDT) Received: from mail-yb1-f169.google.com ([209.85.219.169]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MA7Su-1oGabF3iIs-00BbnQ for ; Sun, 10 Jul 2022 17:54:40 +0200 Received: by mail-yb1-f169.google.com with SMTP id 6so5224474ybc.8 for ; Sun, 10 Jul 2022 08:54:39 -0700 (PDT) X-Gm-Message-State: AJIora9igV0xbQ58CKmB/EBYNd09816B+r7UHAoN0svnCo3eNmJms8KH kcJ0hDWq8Dsvv15N4b1qElgUCb0u3aL5KwhzQUI= X-Received: by 2002:a25:7c41:0:b0:66d:766a:4815 with SMTP id x62-20020a257c41000000b0066d766a4815mr13465980ybc.480.1657468478668; Sun, 10 Jul 2022 08:54:38 -0700 (PDT) MIME-Version: 1.0 References: <20220709211549.1163327-1-shorne@gmail.com> <20220709211549.1163327-2-shorne@gmail.com> In-Reply-To: <20220709211549.1163327-2-shorne@gmail.com> From: Arnd Bergmann Date: Sun, 10 Jul 2022 17:54:22 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] openrisc: Add pci bus support To: Stafford Horne Cc: LKML , Openrisc , Jonas Bonn , Stefan Kristiansson , Peter Zijlstra , Palmer Dabbelt , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:nREpe+ULXivFkdtmgefleSYSRPsULSNop+g8fdehJ1HTjFir4iy Xrw8QmmXZuER+40jEqFRGe3FzcE7qolNTPRgr3QeTrMh2cdDJaCT6Z7aORfLm17DH1TMUOJ KGVqCqqMMFPNThCv81dYVshTrjQNOHYb3mKf4tsvbki5ELymQETg2mSVUQNCUJpwjgySW/t +ffrKi/uw2bEarfFeVlMw== X-UI-Out-Filterresults: notjunk:1;V03:K0:40gBQ9MyTeM=:opLzRjLZPL7E+SLY43nOR8 ds4jy6cs0q8HUG0cKnEKkXsRwZLyaorPqx5c23ySekGJT+ps461+oOokgw3Fl93mZjAhjPsZR YOz5FILR6OmJpF5oQ00xDyMEG21kctAsLRy+U96+jON63jnGvyMviCHPJ7DEwSKG5b+avdHqx aIdetyUQI1A2ACaCg5WWA13+DeBDlPQnxv2aJqpq897AuVVHMbxkfCKIAelkHm8/EWLqNp9TW 0VTbqJ816A++cXY1IASDAykMk5rtg3q9HQT7ceEJjbFrBTfANRyckqXVVYbreqW9/poejyLaT E5JLvBDsJhtsKd6k4OvU9lOgwv150uRvcejvD5Npk68+KDs16IpDJxmyJsjgIWy85G/hdTOcG BNVUuW+8exvrZ0OQ3mMW/srsqs9bF8VHnK+nqN4TQ1BepU5I9bREQ72jpzDLj+AchpnJRFmV+ AeK/AvxDmUXeGlsAmlCMnDjEYxJ1MhmsHuE1U63Pt1RUm1EEEdfjElfsrV4CukfP0scaG/ERX GE/xdyP+TA3qt2oPSNmGh3Ju8/ZASHmnAYNAOcQ9nXhdCMbjOwrsM9jzMc6wapbgjdSkZpLXV NG3M1sCMOP7Msxpze1euS5JQ5dJkf9IBu/n9TKtUMlj+kz+VCF4u8nF1ZxItGwtD6gByXELUM Z3lAMN33bIDwYQxFCKUMND26taeMnbFKT8yJm1q7yyA/yU+QovtvjhFtf5xncbaYzy0b0FTRn nGmcQCvUYKeb4A68jLDAJXdD01S9ebk8+b2/Ew== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 Sat, Jul 9, 2022 at 11:15 PM Stafford Horne wrote: > > This patch adds required definitions to allow for PCI buses on OpenRISC. > This is being in the QEMU virt platform. > > OpenRISC does not have IO ports so this defines PCI IO to be allowed in > any range. Keeping PIO_RESERVED defined as 0 allows OpenRISC to use > MMIO for all IO. > > /* > - * PCI: can we really do 0 here if we have no port IO? > + * PCI: All address space can be used for IO > */ > -#define IO_SPACE_LIMIT 0 > +#define IO_SPACE_LIMIT ~(0UL) I think '0' is the correct limit here if you don't support PCI controllers that can map their I/O ports into MMIO space. If you don't define PCI_IOBASE to a meaningful value and set IO_SPACE_LIMIT as you do here, every virtual address is treated as an I/O port, so accessing a low port through /dev/ioport or a PCI driver results in an access to a NULL pointer, which is either a userspace address or low kernel memory, both of which are bad. Most PCI controller are however able to map I/O ports into the physical address space of the CPU, and in that case you can just define an otherwise unused address as PCI_IOBASE and map the ports there from the PCI host bridge driver. Arnd