Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp472647ybv; Thu, 20 Feb 2020 01:49:31 -0800 (PST) X-Google-Smtp-Source: APXvYqw6juVia6snchhuxVl9CBMrpavr5a/Ob9ZjPXDqXaZjoCuRXpWZdlu84Fx/pwmMJbWUpkbb X-Received: by 2002:aca:ef54:: with SMTP id n81mr1442681oih.86.1582192171723; Thu, 20 Feb 2020 01:49:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582192171; cv=none; d=google.com; s=arc-20160816; b=seKZs5LRgomdoBRIrLcHE7z2BiFFdrLtfzDWoRJqsv1ko/NJR/EfJOZ1X/5qcpzeLp FInPsKkPDXMgcOJwQR1S85DEtOXVehBOC7WBa4gNgGmWKomtpga62q8A9RJnl2k2RyBa qhoOC7ApTADxhpZ0phgyy4tY1rA4tDx2X/rvcPjOhOqmvTbe9jGRbaYMzMolmvveOL/I 0darcX8s6IM9Lk/Q936FA4xG7rggRKdr8ptK37bxUvxqGcOYBUiQ2DMD4qLGmEpxSrwV VKCskpDvVUtTTZ3h1FMs64rFuaV531P6rnVzettSMqBENgiSfNFAl2Wa8vG3+BUICJLf wBcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=fEhOy8FOQscA9VQfUgsy97oeN6scQMf+XaBHkq4K2Vw=; b=Odz8EklBs4cOtM/Z8CZGRCZc4AeI0drE9+HCM8bezSOsyZ5nSKoUX9F7rg9YIA3/H7 86bGIAtkLwfhAWhjqNrRJQm+j5tw1Ln/uwFziI2qn/yuCE5Y3Rku2YWhwyNoYSYJyoKf OOUKB3GgdQHcjA5uFD5M7DqnkURJORjRnAa5v7DV/YmrpUpnv05STPapsJnxbXRK59eC PyIt5izFChLiw1sNgzDDhseXQWGuRacIZUcNhXoBiPABPxktmnmR0qzO/al/c0iyYFtB 7/UcBczbksNb1YNFQi7qPisLEPE/FJOXoUSXbzzezXPKNCc5bmCMlzIMZ5O5rm2I6QbT 7c9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w207si10188375oie.111.2020.02.20.01.49.19; Thu, 20 Feb 2020 01:49:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbgBTJsw (ORCPT + 99 others); Thu, 20 Feb 2020 04:48:52 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10659 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726637AbgBTJsw (ORCPT ); Thu, 20 Feb 2020 04:48:52 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5400122256452FC430FA; Thu, 20 Feb 2020 17:48:49 +0800 (CST) Received: from [127.0.0.1] (10.57.101.250) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Thu, 20 Feb 2020 17:48:39 +0800 Subject: Re: Questions about logic_pio To: Jiaxun Yang , yuanzhichang , , gabrielepaoloni , bhelgaas , andyshevchenko References: <1705dbe62ce.10ae800394772.9222265269135747883@flygoat.com> CC: linux-kernel From: Wei Xu Message-ID: <5E4E55F7.70800@hisilicon.com> Date: Thu, 20 Feb 2020 17:48:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1705dbe62ce.10ae800394772.9222265269135747883@flygoat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.101.250] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiaxun, On 2020/2/19 21:58, Jiaxun Yang wrote: > Hi there, > > Logic PIO gives us a way to make indirect PIO access, however, > the way it handles direct (MMIO) I/O access confused me. > > I was trying to create a PCI controller Driver and noticed that I/O range parsed > from DeviceTree will be added to the Logic PIO range by logic_pio_register_range. > And than PCI subsystem will use the ioport obtained from `logic_pio_trans_cpuaddr` > to allocate resources for the host bridge. In my case, the range added to the logic pio > was set as hw_start 0x4000, size 0x4000. Later, `logic_pio_trans_cpuaddr` called > by `pci_address_to_pio` gives a ioport of 0x0, which is totally wrong. > > After dig into logic pio logic, I found that logic pio is trying to "allocate" an io_start > for MMIO ranges, the allocation starts from 0x0. And later the io_start is used to calculate > cpu_address. In my opinion, for direct MMIO access, logic_pio address should always > equal to hw address, because there is no way to translate address from logic pio address > to actual hw address in {in,out}{b,sb,w,sb,l,sl} operations. > > How this mechanism intends to work? What is the reason that we are trying to > allocate a io_start for MMIO rather than take their hw_start ioport directly? > > Thanks. Corrected John's mail address. Maybe he can help. Best Regards, Wei > > -- > Jiaxun Yang > > > > . >