Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp42988lfe; Fri, 15 Apr 2022 18:33:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyucc9kBLFk2ANalHYgPtoGYx6AbuY+7bXEygUWeQBNoxdsbkj78YIfQTKwJzb9TEaY6Xq1 X-Received: by 2002:a17:90b:380c:b0:1cb:a43d:4c29 with SMTP id mq12-20020a17090b380c00b001cba43d4c29mr6892339pjb.240.1650072786710; Fri, 15 Apr 2022 18:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650072786; cv=none; d=google.com; s=arc-20160816; b=r66rHgA8jMgK+wkcHywbPe5sx/ksyyt9P+7rtsJWc8ycr37WSd9pYOy6NkXNXMeea1 ttacPDq32xXeLEVxveKufAko5DQpyJZm+TDOUfk9QqO37GOkYSV1xY7NfBKEhf63EYM0 kA+r0edTR7mGyahovfAjOALfcRFSu6bzVrL6fZK+1/ZRCPraZatxAnt/Is66Gg2FkKBS N+4+AgHktZQgPhIHCpf6u0qkyTbYiRiL9/TYZwde9YRC/TigY7LtxcKcAfUxzEFIGh7i U8rJo7sNlohV8qvXQcGaRCSfpH2fEiGtbie8i6IqVJ2MVwo4bLESQkKYjalVSvlCSoPs e94g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=ZAmg6aYBtANSUkZOwg5o4qw0qRk+AM5t5AWHmQwLMbw=; b=xcyL7fOHWGT7MxdmalMDku3ONCGCx6dgaDhrwwzXLCTL3WQZgVGPm1dH/OSITMnPET hziwfaD1Sl8ZaNTNeLCnbqaTId9jnWE5sRzZprlc9Gv7kdRjMvQY+FjNLaFe0FRGJliY LjDpkoARoCm6QNpdadvipV1fRNdVJJzIXGJ7M5AxRhs7M1mwNTYwYp5yUCdmCv0GbjRE an2kk333jVsIHB9/cqlyxwbW2PgpOd5MuQLByoEkoZD3S2D3ieZQ1uutErDdwwpACXrf xGHGaYhvdB5KtbTrx+yPXNsCWBcpgIa3j7tBQau7egLk+AJRWKz6fUSQpSuRm/vU8tcF GsMw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b13-20020a17090a488d00b001c69d1881f0si5395443pjh.154.2022.04.15.18.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:33:06 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 987309BB8E; Fri, 15 Apr 2022 18:00:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346259AbiDNUZL (ORCPT + 99 others); Thu, 14 Apr 2022 16:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241246AbiDNUZK (ORCPT ); Thu, 14 Apr 2022 16:25:10 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 96C46CD661; Thu, 14 Apr 2022 13:22:44 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id D86C192009C; Thu, 14 Apr 2022 22:22:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id D2CF492009B; Thu, 14 Apr 2022 21:22:42 +0100 (BST) Date: Thu, 14 Apr 2022 21:22:42 +0100 (BST) From: "Maciej W. Rozycki" To: Bjorn Helgaas , Palmer Dabbelt cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: Avoid handing out address 0 to devices In-Reply-To: <20220414170743.GA753251@bhelgaas> Message-ID: References: <20220414170743.GA753251@bhelgaas> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, 14 Apr 2022, Bjorn Helgaas wrote: > > > > Address 0 is treated specially however in many places, for example in > > > > `pci_iomap_range' and `pci_iomap_wc_range' we require that the start > > > > address is non-zero, and even if we let such an address through, then > > > > individual device drivers could reject a request to handle a device at > > > > such an address, such as in `uart_configure_port'. Consequently given > > > > devices configured as shown above only one is actually usable: > > > > > > pci_iomap_range() tests the resource start, i.e., the CPU address. I > > > guess the implication is that on RISC-V, the CPU-side port address is > > > the same as the PCI bus port address? > > > > Umm, for all systems I came across except x86, which have native port I/O > > access machine instructions, a port I/O resource records PCI bus addresses > > of the device rather than its CPU addresses, which encode the location of > > an MMIO window the PCI port I/O space is accessed through. > > My point is only that it is not necessary for the PCI bus address and > the struct resource address, i.e., the argument to inb(), to be the > same. Sure, but I have yet to see a system where it is the case. Also in principle peer PCI buses could have their own port I/O address spaces each mapped via distinct MMIO windows in the CPU address space, but I haven't heard of such a system. That of course doesn't mean there's no such system in existence. > I tried to find the RISC-V definition of inb(), but it's obfuscated > too much to be easily discoverable. AFAICT the RISC-V port uses definitions from include/asm-generic/io.h. Palmer, did I get this right? Maciej