From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034477AbcIWP4I (ORCPT ); Fri, 23 Sep 2016 11:56:08 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:54995 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030323AbcIWP4F (ORCPT ); Fri, 23 Sep 2016 11:56:05 -0400 From: Arnd Bergmann To: Gabriele Paoloni Cc: "zhichang.yuan" , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "lorenzo.pieralisi@arm.com" , "minyard@acm.org" , "linux-pci@vger.kernel.org" , "gregkh@linuxfoundation.org" , John Garry , "will.deacon@arm.com" , "linux-kernel@vger.kernel.org" , Yuanzhichang , Linuxarm , "xuwei (O)" , "linux-serial@vger.kernel.org" , "benh@kernel.crashing.org" , "zourongrong@gmail.com" , "liviu.dudau@arm.com" , "kantyzc@163.com" Subject: Re: [PATCH V3 2/4] ARM64 LPC: LPC driver implementation on Hip06 Date: Fri, 23 Sep 2016 17:55:10 +0200 Message-ID: <1849232.KJrfRPHGN6@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <1473855354-150093-1-git-send-email-yuanzhichang@hisilicon.com> <10705430.q2aqv5uYO3@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:5/BaoljACjg8VoUO3Yk3Jte0UDjAGLgRm7F63OfsAa4hndC5P1/ kS4SViDBH+qjpcRS7upDFt+9GnG9K1TSuAqRlgMCiFYXlMViguCBpwDPhu3Azk/lVoJ8tVT EPFIw2qFx8M3/qjNLQGgCuQJGeNjtOHaCau+yZiRZFKJrd9TI4cwxxOflnTPhnw07i0qg+K f30Nv58yRkHoAgpt5r5jQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:UG3Ss15g2bI=:bmtESDi6/R/L2qFEzpeUSr aRR8E+bVVCt08icCf2T91ZUwVRjVs9NvbeZpDc63BcLxYc1pam3QjvEyUT8XSpdgF1GVd8UOx jgSTne5Yioe38osdcFMkKNNV2dGUTtJ8hUMNBAJcpw+iYpHl7PCqeCGxateYtAZ1je8X6BU8x Nn5gK1PW/y264joC2+forhB1jfO2xRjDmQJAiBUDFrY/opdSNLNxw1YQ6yHWL3bFoMfNolPJf CVwJKk9gi+qacPx00HhccrhQt2h9OeC44Pln/YzlgTEn0y4XFfb6xFBLc9uDUkqHgVv6HSQqc cgVc7gW6EI+nCKurlXKKNt16+8seJ8NiSfQpxszXoNTiWYszzANGsBvEOfaJRbutXsb6zW3c0 Nj8FrXg0+nqFfqPUztQpLhnO+c+NMfBe0AjOVDzVtknJ+JsFsMVWawS0ZjGxq78JE8ovEL6Ms q6pqXvrLxBsGY+h52HVyxcbvIUsUunlqE10IAsyaYWuYTzYPeMj4rRaKcR9DRqAMrw8jtSeuS Z9siOOKdrZucTEStoDf+TQmsLco7FeKC70AqX3XzVl/9a6fTEMbSNtqbnAEkiCa2CFvxxhCfL 8pl9QDGvTv3DZxKxcbt3rO4B9nYDajWbQHZEUAG60oa1CVJzQrboF0XAohLsB5aceTmv6wvY0 arflzs1snLv+wf8XNI5ETuhFh/Za5BXW2UHGHA2xeWfn1fQ+Oc++Azz5KBWvyP+xWIICjRc4s Z6GvRveXZXGo0PDn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, September 23, 2016 2:59:55 PM CEST Gabriele Paoloni wrote: > > > > From the perspective of the indirect IO function the input parameter > > > is an unsigned long addr that (now) can be either: > > > 1) an IO token coming from a legacy pci device > > > 2) a phys address that lives on the LPC bus > > > > > > These are conceptually two separate address spaces (and actually they > > > both start from 0). > > > > Why? Any IORESOURCE_IO address always refers to the logical I/O port > > range in Linux, not the physical address that is used on a bus. > > If I read the code correctly when you get an I/O token you just add it > to PCI_IOBASE. > This is enough since pci_remap_iospace set the virtual address to > PCI_IOBASE + the I/O token offset; so we can read/write to > vaddr = PCI_IOBASE + token as pci_remap_iospace has mapped it correctly > to the respective PCI cpu address (that is set in the I/O range property > of the host controller) > > In the patchset accessors LPC operates directly on the cpu addresses > and the input parameter of the accessors can be either an IO token or > a cpu address > > +static inline void outb(u8 value, unsigned long addr) > +{ > +#ifdef CONFIG_ARM64_INDIRECT_PIO > + if (arm64_extio_ops && arm64_extio_ops->start <= addr && > + addr <= arm64_extio_ops->end) > > Here below we operate on cpu address > > + extio_outb(value, addr); > + else > +#endif I missed this bug earlier, this obviously needs to be arm64_extio_ops->outb(value, addr - arm64_extio_ops->start); or possibly arm64_extio_ops->outb(arm64_extio_ops, value, addr); as the outb function won't know what the offset is, but that needed to be fixed regardless. Arnd