From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753392AbbL2Nrh (ORCPT ); Tue, 29 Dec 2015 08:47:37 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:62134 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752868AbbL2Nrd (ORCPT ); Tue, 29 Dec 2015 08:47:33 -0500 From: Arnd Bergmann To: Rongrong Zou Cc: catalin.marinas@arm.com, will.deacon@arm.com, benh@kernel.crashing.org, lijianhua@huawei.com, lixiancai@huawei.com, linuxarm@huawei.com, linux-kernel@vger.kernel.org, minyard@acm.org, gregkh@linuxfoundation.org Subject: Re: [PATCH v1 1/3] ARM64 LPC: indirect ISA PORT IO introduced Date: Tue, 29 Dec 2015 14:47:01 +0100 Message-ID: <3232651.99Svz5pbDW@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1451396032-23708-2-git-send-email-zourongrong@gmail.com> References: <1451396032-23708-1-git-send-email-zourongrong@gmail.com> <1451396032-23708-2-git-send-email-zourongrong@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:EpVfMEeOofqp7riTa3YwBTHhi+h0BrDGRT69WqodQvIq9/vBxcv YE0M0PNc3uTzwiYRWP9ySNjiWpnLzJ58ueA2/9GRld64dwlAOCZgA8QBVOj74/5bnYUSNzl eElsmw4QrgdDQw0qFXGNPsNZox1RIIcqg7rOaHfRdo+a4NFq5Ph2WckG3DAaPwCr4LWakTY lTYwAzbPh9qzgSDnQGmGQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:L5bu7ZCKzNg=:VVidOdDGcaA7n6BT8CeHt/ uj7tsWyBrzEYU5uLudmmZuAhPVmEGVivaeVh/m0QWYU+W6eWRgtXhsKiQPtJcC2eTQflTNC85 3Ec05N//A6K0aMc5h+j1ad6UnaqNiXy0MmJ4xP8jt719lxATsIDnp76cSunEGiDZC8E8NBKrC frRRXbHpsb3xwRRJ6Qv2i7CdXOJHvy7/yX58aT1CURtwsr2VXVu8Xd8ogAk01UkZbY7+/rycC GCRA4fbcmE/IgSiHPmFVs7DNMk4YaulkpoRm/guDmHvDYNRr/jfO0yjv80cJje35mYImdD1Lu PAbme3MIp4239eJ/WeQGs+demnWEPmyxVyEWmoPmmyZ037aeeQ/BBzpdLgmtduCYam7HyCVE8 dFpRl1f8X80TQhCUT3y2quAatNA5JQm3I0hSh+NDPh7P8gEUHKIPeCoadPo1cqvgth+2Xy5tE Gj3usIAA3KSSJjfxjpVtYH6xSq+DyotAqhoByX+Gzl2WvCZTuvkWd9+MTIebhg4ZwDR9vFZan OJvTVJNV2N6vb3B9+62bh6Rfy3kFFFMe/xXIt9n5WGon/8eO0/hLAISdDFPpBcC5sI7fUI0aC pU4ivvVDWv4lFUZ4mCzEDJKv+q4LNkLORUfXpOd9T7CfFc2nrlJG1WOTtzMp0dTKZgGBX25Oo dj72U3uKntuxUDfbkEPtRb7hViZBOCu+k0mvdLy5lKeEcwXp1uq44iQwA/XLvUox82fl5UfL9 IP3nd8UXZ3T+I5wo Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 29 December 2015 21:33:50 Rongrong Zou wrote: > Indirect ISA port I/O accessing introduced, vendors can hook > their own in/out function to general inb/outb. Drivers can access > legacy ISA I/O port by inb/outb as it is done in x86 platform. > > Signed-off-by: Rongrong Zou Looks correct to me, but I have a few style comments > --- > arch/arm64/Kconfig.platforms | 5 ++- > arch/arm64/include/asm/io.h | 78 ++++++++++++++++++++++++++++++++++++++++++++ > arch/arm64/kernel/setup.c | 5 +++ > 3 files changed, 87 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms > index 4043c35..98ae206 100644 > --- a/arch/arm64/Kconfig.platforms > +++ b/arch/arm64/Kconfig.platforms > @@ -127,5 +127,8 @@ config ARCH_ZYNQMP > bool "Xilinx ZynqMP Family" > help > This enables support for Xilinx ZynqMP Family > - > +config ARM64_INDIRECT_PIO > + bool "ARM64 Indirect port I/O" > + help > + This enables support for ARM64 indirect port I/O > endmenu The option should probably go into arch/arm64/Kconfig. Possibly you can make it a silent option that just gets selected whenever a driver is enabled that might set the callbacks. > diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h > index 44be1e0..0041f3b 100644 > --- a/arch/arm64/include/asm/io.h > +++ b/arch/arm64/include/asm/io.h > @@ -193,6 +193,84 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size); > */ > #define xlate_dev_kmem_ptr(p) p > > +#ifdef CONFIG_ARM64_INDIRECT_PIO > +#define DEF_PCI_HOOK_pio(x) x > +#else > +#define DEF_PCI_HOOK_pio(x) NULL > +#endif Maybe just put the entire definition block inside #ifdef and fall back to the default inb/outb definitions otherwise. > +/* > + * This value is equal to PCIBIOS_MIN_IO > + */ > +#define LEGACY_ISA_PORT_MAX 0x1000 I would just use PCIBIOS_MIN_IO instead of defining another macro. > +extern struct arm64_isa_io { > + u8 (*inb)(unsigned long port); > + u16 (*inw)(unsigned long port); > + u32 (*inl)(unsigned long port); > + void (*outb)(u8 value, unsigned long port); > + void (*outw)(u16 value, unsigned long port); > + void (*outl)(u32 value, unsigned long port); > +} arm64_isa_io; Maybe make this a single function pointer like void (*arm64_indirect_pio)(unsigned long port, bool write, int size, void *data); I'm guessing that this would result in smaller object code at the call sites, but you'd have to try. Arnd