From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753420AbbL2N3T (ORCPT ); Tue, 29 Dec 2015 08:29:19 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:60595 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753339AbbL2N3Q (ORCPT ); Tue, 29 Dec 2015 08:29:16 -0500 From: Arnd Bergmann To: Santosh Shukla Cc: "H. Peter Anvin" , josh@joshtriplett.org, Greg Kroah-Hartman , akpm@linux-foundation.org, Linux Kernel Mailing List , linux-api@vger.kernel.org, yuanhan.liu@linux.intel.com Subject: Re: [PATCH] drivers/char/mem.c: Add /dev/ioports, supporting 16-bit and 32-bit ports Date: Tue, 29 Dec 2015 14:28:01 +0100 Message-ID: <5873998.uv0CPtuiff@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <20140509191914.GA7286@jtriplet-mobl1> <201512222256.20580.arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Pr8SUa9O2UwDkdPbnyrlu+Y0HGIGNzESUjKTBoWpaENXlRzfZ2P i+80Z6q28goPRrOb5JNaZquC1ZITrsdbelf2sDKYqlJ0oDJM6P4Fie+kXJTP9Jmv1kk534x YY2oq26bWUSh17Zv2y8/4U2Km+a6oepG7FgOu3ngSrRpiuy6mu0JvLG7Q3GVyuXuMui8c25 IO3q0nPUYMFmU4WkkSXmw== X-UI-Out-Filterresults: notjunk:1;V01:K0:sfz+VceQcec=:l8no+AdcwKoLHtmsvJdO+W yLL5Dge6vnhLfr68EL4HmE/V0JutYiA1Mj5CIKvQmdY8L3NBAOlLynA1IEQp3FepAjuWgcaDU dhjpF+7919Vtu40d82Jciv5h69kXmBRD/RLSH3cGxpYSjGJq9NZSruGdAnGonIE6HSAWza5+R MRZO0E/IQOQahx4gogtzsWt/FW3vLY5Ye5SUFkXMCCTXSh4FLPytz0NyAfaFouGTi0I9/yRIw a1/mR+gE1cOEjx6PqCRywz0VioSSYGWMCbrYeCdqAxS3089sT8lElEtSx3fRNScQoPPqfsI4F jqK4UIaKG9mO8vtEytVTKLralOu+GmRZ3RJVLy7VWi9CWSWBcomE1JTMdua+CqIW34MDaZhlI JzFtmLDGE53vGT7HwKz4zvWqE9bNq0/mqtPSIQOXtZflDWgozMXRGLTgwSUQq5mIGCbaTstPW Lt+TBjgA3XmiouPXUIqfsH6T+pj0eh0DrPX90gMXx8ftonMwy8bc1hcpK5doHSPam8ceJzy+Q P/RznwlkDr3jBko/gm+MM0KPmFx+u396Ee0KqvZOW+QCA+cBv89PL9mDuJczgtZqU9ybAhfu4 eRpQhZaitkbKNS2LnSoHATJyKVG5ik0dlJ9sU06gkgh/yf67zZkoZL1/No9wThZpG//tshyLU cCWBFtDn9SoRGg0IKcqhyC1/QF1yUj6obIiPh2KK5Jr3lddI93Hq8PEmw0OUn+xm3V4ymRzp8 /XjR3fVodqJ3Vvkf Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 23 December 2015 17:04:40 Santosh Shukla wrote: > On 23 December 2015 at 03:26, Arnd Bergmann wrote: > > On Tuesday 22 December 2015, Santosh Shukla wrote: > >> } > >> > >> So I care for /dev/ioport types interface who could do more than byte > >> data copy to/from user-space. I tested this patch with little > >> modification and could able to run pmd driver for arm/arm64 case. > >> > >> Like to know how to address pci_io region mapping problem for > >> arm/arm64, in-case /dev/ioports approach is not acceptable or else I > >> can spent time on restructuring the patch? > >> > > > > For the use case you describe, can't you use the vfio framework to > > access the PCI BARs? > > > > I looked at file: drivers/vfio/pci/vfio_pci.c, func vfio_pci_map() and > it look to me that it only maps ioresource_mem pci region, pasting > code snap: > > if (!(pci_resource_flags(pdev, index) & IORESOURCE_MEM)) > return -EINVAL; > .... > > and I want to map ioresource_io pci region for arm platform in my > use-case. Not sure vfio maps pci_iobar region? Mapping I/O BARs is not portable, notably it doesn't work on x86. You should be able access them using the read/write interface on the vfio device. Arnd