From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752525AbcGLI2c (ORCPT ); Tue, 12 Jul 2016 04:28:32 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:59256 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260AbcGLI23 (ORCPT ); Tue, 12 Jul 2016 04:28:29 -0400 From: Arnd Bergmann To: Bharat Kumar Gogada Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Bjorn Helgaas , "Liviu.Dudau@arm.com" , nofooter , "thomas.petazzoni@free-electrons.com" Subject: Re: Purpose of pci_remap_iospace Date: Tue, 12 Jul 2016 10:31:59 +0200 Message-ID: <3927657.6zNCtCntSU@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-22-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <8520D5D51A55D047800579B094147198258B85DC@XAP-PVEXMBX01.xlnx.xilinx.com> References: <8520D5D51A55D047800579B094147198258B85DC@XAP-PVEXMBX01.xlnx.xilinx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:5TMoMO4X0iVMZoVcbv0fjz1lPWBwPpGEarclzEQbL0UfWDZzMSa 4+Oifq+wDaA6fDaQBHiQLAS/nVHdsic3pkQL2tO3WgZcKSOSluXZdi4Ft+qXu/vCvt34hEw +OuQnzjMde/x6ZbBN6OwfBrV7lM7lwDwbVh0ijQntlfUNzaX7n3pWptA+VPaKv2yWjU4zwD E+aHsdOU7sNHXf+sHLFSQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:kjeVsPGXtfI=:OxUs5BYPGfz0L4kGyAD42c tPpUltpO03c9hJA54hbHni2Ctc4nQ0xB93CgTWLMIYvHEv/v/G2lrTon/J4Hy8dPqFa61efaW DJcAY2PGBBDN/XZxjlM4E5UMMvWDIsnwiBLDoov0+bu3CvL6wbSVBCbLifl89iSNl42mmgstj 1QAn9G+dDmaSMIwXeJZMMq9TOd6gPqyJttgzTH1iFWtpCsB+tdchburzIKXv7hf/8UyD9VRzs YgngGAiikucZqqYvdCpnHpuamPEhatt1Dyq2t0wjf9t+rtZQaMFD8xr9PE6KEx91YP49aez1S Sief9zKxhItmMiMn22W7Wlj+Q3DvCSv917wGw9QIEWZfNqoGupSZ02tHUpDoEUzbGLDDphRJI fR8u8gICtt7F4UgjTUA8drxJkkHVkBgRRj3CKzfx0WUHy6yaEtWyNbUIigqg56uTLbgVIhXWV jDTUXf9MfErgekl2AHAzZuUQpsDHqn8OpoPBfqQgoM/O5QuEkzEVnlRT8HRT4/ADKFGYejqFO /aGNLte3TZToIkZiAVNWcnFrU33nFv3Y49UGGYugNDV1c3rDSlV+8U/y+13gelSFcX3kk5gOE vEt/EkY2yLuQPB2gBWECseaQGBeo7i1TDTtPkybi6aUY/F1VfhvNw01fBed8yDixd2N+1//+S M0IT18he6/voqT21Aqhw3PV4i/Sly3P9ghF/ejTuTANVOQL/K/NVj5KoVRGPce82wbDdwM+S3 iF8EKbl/+nhk6h0u Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, July 12, 2016 6:57:10 AM CEST Bharat Kumar Gogada wrote: > Hi, > > I have a query. > > Can any once explain the purpose of pci_remap_iospace function in root port driver. > > What is its dependency with architecture ? > > Here is my understanding, the above API takes PCIe IO resource and its to be mapped CPU address from > ranges property and remaps into virtual address space. > > So my question is who uses this virtual addresses ? The inb()/outb() functions declared in asm/io.h > When End Point requests for IO BARs doesn't it get > from the above resource range (first parameter of API) and > do ioremap to access this region ? Device drivers generally do not ioremap() the I/O BARs but they use inb()/outb() directly. They can also call pci_iomap() and do ioread8()/iowrite8() on the pointer returned from that function, but generally the call to pci_iomap() then returns a pointer into the virtual address that is already mapped. > But why root complex driver is mapping this address region ? The PCI core does not know that the I/O space is memory mapped. On x86 and a few others, I/O space is not memory mapped but requires the use of special CPU instructions. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de ([212.227.126.131]:59256 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260AbcGLI23 (ORCPT ); Tue, 12 Jul 2016 04:28:29 -0400 From: Arnd Bergmann To: Bharat Kumar Gogada Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Bjorn Helgaas , "Liviu.Dudau@arm.com" , nofooter , "thomas.petazzoni@free-electrons.com" Subject: Re: Purpose of pci_remap_iospace Date: Tue, 12 Jul 2016 10:31:59 +0200 Message-ID: <3927657.6zNCtCntSU@wuerfel> In-Reply-To: <8520D5D51A55D047800579B094147198258B85DC@XAP-PVEXMBX01.xlnx.xilinx.com> References: <8520D5D51A55D047800579B094147198258B85DC@XAP-PVEXMBX01.xlnx.xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: linux-pci-owner@vger.kernel.org List-ID: On Tuesday, July 12, 2016 6:57:10 AM CEST Bharat Kumar Gogada wrote: > Hi, > > I have a query. > > Can any once explain the purpose of pci_remap_iospace function in root port driver. > > What is its dependency with architecture ? > > Here is my understanding, the above API takes PCIe IO resource and its to be mapped CPU address from > ranges property and remaps into virtual address space. > > So my question is who uses this virtual addresses ? The inb()/outb() functions declared in asm/io.h > When End Point requests for IO BARs doesn't it get > from the above resource range (first parameter of API) and > do ioremap to access this region ? Device drivers generally do not ioremap() the I/O BARs but they use inb()/outb() directly. They can also call pci_iomap() and do ioread8()/iowrite8() on the pointer returned from that function, but generally the call to pci_iomap() then returns a pointer into the virtual address that is already mapped. > But why root complex driver is mapping this address region ? The PCI core does not know that the I/O space is memory mapped. On x86 and a few others, I/O space is not memory mapped but requires the use of special CPU instructions. Arnd