Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2751038imw; Sun, 10 Jul 2022 14:27:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZChmoUkv79nt6QUILg457gAa181O9vapkvZIYVU1MGzonJe5dU2hmHOYi/80U+861TvNF X-Received: by 2002:a17:906:3989:b0:70c:2090:b498 with SMTP id h9-20020a170906398900b0070c2090b498mr14980677eje.56.1657488422158; Sun, 10 Jul 2022 14:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657488422; cv=none; d=google.com; s=arc-20160816; b=x3EWMN7rlwTbHKkh+GmjWK1D8eE/je4rLDI2v77y2cKA7GDq10Qdcj+yevRvqLz1eL KUhXcb07/QCi1YLCJPF+Sl/ulCLuHAGOxk3YNZZpNAoIO60mOuoej49dha2ijEh3CSke jbssjGRlO2OJTai78OwdjtIWd5Osg6v5cxW3g4BP2tOcQALLaFKr0Lsm79v00GRrT8Rd gvKLWYga4weadZWdVlKPDfLjGJ6h1c6lPJMc2z7pn+sheHMJwRNZ5UZGgf3ewhlc3IqG w2E5hGUEr6bH8y1BlnXzqMFU8H23xz/wh82rc11/U54x7vfnJmGYJnG8NR1ieGmx5N2o QDtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/3Levsfw6LIMCbRxqktEi2reG0/qjlmvH+w7aAlSmdQ=; b=mX/v4+rQblLZhQD5L9Eb3x11IVoMbboy0btMCQ4L8zqy9SnF7XfGhqxu9/Sc5oUoeG yA5CO5/tUEEN+kSRRYCDsIh4o41HTr96Wfl9r/Gt+5JijcOYyvtRIHQ/2hZMhF3IQxYe tyLdQiAZ5tCdeJ4kY9011b3r0jNKs00wWG7m2WYyL4ka8Nq2ptii6Ei4s0EBwENITlC0 xSqg41NCQG0qlJhtcN6W0J9bQz9WW3TncoCLCtjlgxv/DJvWZyWXyvh6TGpHLCMRh1hZ s5whFvPx9BBBLZ1P+juAY4dn1BDAeZCy9bOCtpmtejej/NFwqjT0PwjzjJcEWkWB8aa3 vEpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oLoJ9m6g; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs24-20020a170906f19800b00711d54647bdsi6700358ejb.479.2022.07.10.14.26.14; Sun, 10 Jul 2022 14:27:02 -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=@gmail.com header.s=20210112 header.b=oLoJ9m6g; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229515AbiGJVWb (ORCPT + 99 others); Sun, 10 Jul 2022 17:22:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbiGJVWa (ORCPT ); Sun, 10 Jul 2022 17:22:30 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76454FD32 for ; Sun, 10 Jul 2022 14:22:28 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id y14-20020a17090a644e00b001ef775f7118so6569662pjm.2 for ; Sun, 10 Jul 2022 14:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/3Levsfw6LIMCbRxqktEi2reG0/qjlmvH+w7aAlSmdQ=; b=oLoJ9m6gLkrWpmwDhevTP4Lanm9YsSml/B7z3qiRlVE833P2ZZ3Y5SiZ9urJqTJTZX ZFS2GcEmPq0bWE1V6Phq1cI0c/qNpYLh3VsR7ANRzlMgH1xQqSL1HWYMZUD1XMF0hLSS pmcFDIlxPDMEylv3u38YXFb6psCs7nX/BOpSD0Ovk9Q/A5R+gpcEyV63u+eOtckuQ37a cYlV+3HhWz7fq12spQqTzH9337RQ5R77Ojq2R54XMsyiagievBsmu/GHyqPkTdtzvbH3 x7hZsuyOz422y6/i083SoEjcPGByEmbTQ3IzfWx0TfqKLYYaUUyUt17z55g50n2I+q2N vJ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/3Levsfw6LIMCbRxqktEi2reG0/qjlmvH+w7aAlSmdQ=; b=vcORSzwwD0QnTeVJmiJBqf+QQ5yfeLYyifKmKFrcS38qUxqy+0/3BEmMDeBlegyQ16 95nbPVs20TN4ecqkz4kcdFSQmQpWWghj2NsdwrXU+5F5QD7wt6UlsSFwyG2v3btmoUqG AfG8QBA08C7K3sAMa4n5ljeEj6d5Fr0rzeYbz6mMpJAxbMf0ExLETUfq43/PMzkQD5xf 9BljqWWo4kQ9PGX4BEJSDAL2IBjYnbI2CXef8pE23J1CCmY8M13ZcPVKtU75lDomgUA2 ExmxFDwoIuD2PgWSbU0gUZ5ldw27mKmU21E1jO6xgEe4k2VIUUpbOJXo2u91X2QZlzdS jk7w== X-Gm-Message-State: AJIora8s7JOgy58+pOSqxNacICF/QIQbZ4LT7muSo6SdknSwJDYxq2fx DKv3aFlAfNiD0jBhtNWU/i8= X-Received: by 2002:a17:90a:f48a:b0:1ed:5ec:f890 with SMTP id bx10-20020a17090af48a00b001ed05ecf890mr13982041pjb.40.1657488147615; Sun, 10 Jul 2022 14:22:27 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id t16-20020a170902e85000b001678dcb4c5asm3145580plg.100.2022.07.10.14.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:22:27 -0700 (PDT) Date: Mon, 11 Jul 2022 06:22:25 +0900 From: Stafford Horne To: Arnd Bergmann Cc: LKML , Openrisc , Jonas Bonn , Stefan Kristiansson , Peter Zijlstra , Palmer Dabbelt Subject: Re: [PATCH 1/2] openrisc: Add pci bus support Message-ID: References: <20220709211549.1163327-1-shorne@gmail.com> <20220709211549.1163327-2-shorne@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Sun, Jul 10, 2022 at 05:54:22PM +0200, Arnd Bergmann wrote: > 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. OK, I see, but I think IO_SPACE_LIMIT needs to be defined as something other than 0. It is used to define kernel/resource.c's ioport_resource. For example on risc-v they set it to 16MB. I will setup a LIMIT smaller than 4GB and add a PCI_IOBASE. > 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. OK, understood, do you think this needs to be documented in a architecture manual? Maybe it's fine for it to be linux specific. -Stafford