Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp633178ybv; Wed, 19 Feb 2020 06:16:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxj6Q9VvhNwwOfoc605dxpbeWGSJTAse1+uXePwhUqTlrfn1VRbl+tSDlruc0AU2rW2dspa X-Received: by 2002:aca:44c1:: with SMTP id r184mr4497063oia.151.1582121763929; Wed, 19 Feb 2020 06:16:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582121763; cv=none; d=google.com; s=arc-20160816; b=MlKKWurQNrg7u+y6+CmYEUGuQZ2FP9xAhZYMow2SUhLupGR6aP0RVeQukf8gq41Knz 8NGFgalTzyaSqDtmlwX9tzcomcu7TegUGIUJg9+QugKn2AvuNXY/oyJ2pXCpvJW1fr4x SVN6jpy9KVlw4tuBCa+qnukvqUagV0pe2DS7FUOavcQQ0cEfkwiNwQzS8LSBxWns28TG AGWE9XFYUPgilv8tzul78AhtUXcP5pvCIqxIka0sLcGd9gAU2vPv8CHCgnaH4yjR8JgO hArBv2omXuZIXva6KvJq7xv10ufr223SWvr089Znz0rahpYNF+gBHMVrHFGe08nK5fpe Ug9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-transfer-encoding :mime-version:subject:in-reply-to:message-id:cc:to:from:date :dkim-signature; bh=N2QbMOWOsgHlIL0+1XeUQl6yeERWT5IeVW5cvxRhqk4=; b=Z11/u22J59xukZ0yYn6DmmzojrylAwMemcYPCNiahjuEhXonzAirxPFP6yCxAW4gYW EXX4JmR5yo8TOR5RPzMIdTfYHW9ZQYpYkvP/ng/qbEyU4PcSaquhsFyWz4WPp164ORvO QTeRADFJ1kWp5bxdOzAcA+XXTrqF08ANQm18e2pHZYjPlN4+Qwo5pTKUcXw1dPb1cAby 7Lwk/w8Z5Ar+6UlQ/sqWPHvSewyuiGnhaKmXcDA46qj+WnVnpQgAs+Tfn1ymSLN6oas8 Lvp6EMWA1dBJjOjxJbqxwUBN+LXs4LNGMdExufKWglOrZYToqvVLEedi8N9FKizCP9B7 dl+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=Ao4P6aa+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si1130171otr.320.2020.02.19.06.15.50; Wed, 19 Feb 2020 06:16:03 -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; dkim=pass header.i=@flygoat.com header.s=mail header.b=Ao4P6aa+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727843AbgBSOPQ (ORCPT + 99 others); Wed, 19 Feb 2020 09:15:16 -0500 Received: from sender3-op-o12.zoho.com.cn ([124.251.121.243]:17853 "EHLO sender3-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727280AbgBSOPP (ORCPT ); Wed, 19 Feb 2020 09:15:15 -0500 X-Greylist: delayed 939 seconds by postgrey-1.27 at vger.kernel.org; Wed, 19 Feb 2020 09:15:06 EST DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1582120725; s=mail; d=flygoat.com; i=jiaxun.yang@flygoat.com; h=Date:From:To:Cc:Message-ID:In-Reply-To:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=N2QbMOWOsgHlIL0+1XeUQl6yeERWT5IeVW5cvxRhqk4=; b=Ao4P6aa+d+a5roISEio/aq8swJ2pMb1l3dNcrChYVajpKRXGgp68M8U/lEPdkeYM SOFGE3h6C3QHuNrHvSPdS86V4/fwJ8W+9qWcOoe3KId85fyOTI0GvytdwHwdRpO3IL+ 0FG0v6NodBHXd7wGgmLrewgYG7xEf20VC1A6FMgE= Received: from mail.baihui.com by mx.zoho.com.cn with SMTP id 1582120723154112.79243865540991; Wed, 19 Feb 2020 21:58:43 +0800 (CST) Date: Wed, 19 Feb 2020 21:58:43 +0800 From: Jiaxun Yang To: "yuanzhichang" , "johngarry" , "xuwei5" , "gabrielepaoloni" , "bhelgaas" , "andyshevchenko" Cc: "linux-kernel" Message-ID: <1705dbe62ce.10ae800394772.9222265269135747883@flygoat.com> In-Reply-To: Subject: Questions about logic_pio MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Priority: Medium User-Agent: ZohoCN Mail X-Mailer: ZohoCN Mail Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Jiaxun Yang