Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276AbdFQQjs (ORCPT ); Sat, 17 Jun 2017 12:39:48 -0400 Received: from ale.deltatee.com ([207.54.116.67]:37089 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbdFQQjr (ORCPT ); Sat, 17 Jun 2017 12:39:47 -0400 To: Greg Kroah-Hartman References: <20170615203729.9009-1-logang@deltatee.com> <20170615203729.9009-7-logang@deltatee.com> <20170617051658.GG6040@kroah.com> Cc: linux-ntb@googlegroups.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Jon Mason , Dave Jiang , Allen Hubbe , Bjorn Helgaas , Kurt Schwemmer , Stephen Bates From: Logan Gunthorpe Message-ID: <5294be8f-5547-0cd8-2e1d-a9bbfe06dc6f@deltatee.com> Date: Sat, 17 Jun 2017 10:39:35 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170617051658.GG6040@kroah.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 68.147.191.165 X-SA-Exim-Rcpt-To: sbates@raithlin.com, kurt.schwemmer@microsemi.com, bhelgaas@google.com, Allen.Hubbe@emc.com, dave.jiang@intel.com, jdmason@kudzu.us, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-ntb@googlegroups.com, gregkh@linuxfoundation.org X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [RFC PATCH 06/13] switchtec_ntb: initialize hardware for memory windows X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1509 Lines: 46 On 16/06/17 11:16 PM, Greg Kroah-Hartman wrote: >> +#ifndef ioread64 >> +#ifdef readq >> +#define ioread64 readq >> +#else >> +#define ioread64 _ioread64 >> +static inline u64 _ioread64(void __iomem *mmio) >> +{ >> + u64 low, high; >> + >> + low = ioread32(mmio); >> + high = ioread32(mmio + sizeof(u32)); >> + return low | (high << 32); >> +} >> +#endif >> +#endif > > Really? Don't we have ioread64 in generic code for all arches? If not, > that should be fixed, don't hide this in a random driver please. Or > just restrict your driver to only building on those arches that does > provide this api. Yes, I know these are _very_ ugly. Unfortunately, the other ntb drivers each have the exact same thing. ioread64 is not provided universally at this time and I did spend a bit of time digging and things are a bit messy so I wasn't at all sure of the correct solution. For starters, ioread64 is only defined on 64 bit machines. They are surrounded by ifdef CONFIG_64BIT and it's not clear to me if the above wrapper (around two ioread32s) would be acceptable universally. Second, the x86_64 version doesn't even compile. This is because the arch doesn't provide any ioread64 implementation anywhere and the macro in io.h isn't used because CONFIG_GENERIC_IOMAP is defined. The only arch where I _think_ ioread64 would work is powerpc or any that define CONFIG_64BIT and not CONFIG_GENERIC_IOMAP. If you have any guidance on this I'd be happy to try and make a patch or two for it. Thanks, Logan