public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Liviu Dudau <liviu@dudau.co.uk>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>, Liviu Dudau <Liviu.Dudau@arm.com>,
	linux-pci <linux-pci@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Will Deacon <Will.Deacon@arm.com>,
	linaro-kernel <linaro-kernel@lists.linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Tanmay Inamdar <tinamdar@apm.com>,
	LAKML <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v6 1/3] Fix ioport_map() for !CONFIG_GENERIC_IOMAP cases.
Date: Fri, 7 Mar 2014 01:44:52 +0000	[thread overview]
Message-ID: <20140307014452.GI13582@bart.dudau.co.uk> (raw)
In-Reply-To: <20140307010950.GE21483@n2100.arm.linux.org.uk>

On Fri, Mar 07, 2014 at 01:09:50AM +0000, Russell King - ARM Linux wrote:
> On Fri, Mar 07, 2014 at 01:37:38AM +0100, Arnd Bergmann wrote:
> > On Thursday 06 March 2014, Russell King - ARM Linux wrote:
> > > On Wed, Mar 05, 2014 at 11:49:08AM +0000, Liviu Dudau wrote:
> > > > The inline version of ioport_map() that gets used when !CONFIG_GENERIC_IOMAP
> > > > is wrong. It returns a mapped (i.e. virtual) address that can start from
> > > > zero and completely ignores the PCI_IOBASE and IO_SPACE_LIMIT that most
> > > > architectures that use !CONFIG_GENERIC_MAP define.
> > > 
> > > What value does PCI_IOBASE and IO_SPACE_LIMIT have on other architectures
> > > who make use of asm-generic/io.h ?
> > > 
> > > $ git grep asm-generic/io.h arch/
> > > arch/arc/include/asm/io.h:#include <asm-generic/io.h>
> > 
> > PCI support hasn't been upstreamed.
> > 
> > > arch/blackfin/include/asm/io.h:#include <asm-generic/io.h>
> > > arch/metag/include/asm/io.h:#include <asm-generic/io.h>
> > 
> > No PCI support
> > 
> > > arch/microblaze/include/asm/io.h:/* from asm-generic/io.h */
> > 
> > PCI_IOBASE=0, IO_SPACE_LIMIT=0xffffffff, so no change.
> 
> Seems to define _IO_BASE not PCI_IOBASE.
> 
> > > arch/openrisc/include/asm/io.h:#include <asm-generic/io.h>
> > 
> > No PCI support
> > 
> > > arch/s390/include/asm/io.h:#include <asm-generic/io.h>
> > 
> > s390 supports PCI but no I/O space
> > 
> > > arch/score/include/asm/io.h:#include <asm-generic/io.h>
> > 
> > No PCI support
> > 
> > > arch/unicore32/include/asm/io.h:#include <asm-generic/io.h>
> > 
> > unicore32 is broken currently, the patch fixes it.
> > 
> > > arch/xtensa/include/asm/io.h:#include <asm-generic/io.h>
> > 
> > PCI_IOBASE=0, IO_SPACE_LIMIT=0xffffffff, so no change.
> 
> Doesn't appear to define PCI_IOBASE.
> 
> Maybe there's other patches required for these?
> 
> > For most of these, I assume we actually want to remove support
> > for inb/outb as they don't support I/O space accesses. The other
> > ones look correct to me.
> 
> Right, so:
> 
> #ifdef CONFIG_HAS_IOPORT
> #ifndef CONFIG_GENERIC_IOMAP
> static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
> {
>         return (void __iomem *) port;
> }
> 
> changing that to include PCI_IOBASE in there will result in a build
> failure if the C compiler sees that.  In other words, when HAS_IOPORT=y
> and GENERIC_IOMAP=n.
> 
> HAS_IOPORT is set when HAS_IOMEM is also set and NO_IOPORT unset.
> 
> It looks to me like blackfin doesn't set NO_IOPORT nor NO_IOMEM, so
> this would have HAS_IOPORT set, and from what I can see doesn't set
> GENERIC_IOMAP.  So, this change probably breaks blackfin.
> 
> I haven't looked deeply at the others.

Maybe I'm missing something obvious, but line 118 in include/asm-generic/io.h has:

#ifndef PCI_IOBASE
#define PCI_IOBASE ((void __iomem *)0)
#endif

That doesn't seem to be guarded by any other #ifdef (other than the overall
__ASM_GENERIC_IO_H), so PCI_IOBASE is defined regardless of CONFIG_HAS_IOPORT and 
CONFIG_GENERIC_IOMAP values.

Best regards,
Liviu

> 
> -- 
> FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
> improving, and getting towards what was expected from it.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
-------------------
   .oooO
   (   )
    \ (  Oooo.
     \_) (   )
          ) /
         (_/

 One small step
   for me ...


  reply	other threads:[~2014-03-07  1:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 11:49 [PATCH v6 0/3] [RFC] Add support for PCI in AArch64 Liviu Dudau
2014-03-05 11:49 ` [PATCH v6 1/3] Fix ioport_map() for !CONFIG_GENERIC_IOMAP cases Liviu Dudau
2014-03-05 23:31   ` Russell King - ARM Linux
2014-03-06 10:36     ` Liviu Dudau
2014-03-07  0:37     ` Arnd Bergmann
2014-03-07  1:09       ` Russell King - ARM Linux
2014-03-07  1:44         ` Liviu Dudau [this message]
2014-03-14 11:54         ` Arnd Bergmann
2014-03-05 11:49 ` [PATCH v6 2/3] arm64: Extend the PCI I/O space to 16MB Liviu Dudau
2014-03-05 11:49 ` [PATCH v6 3/3] arm64: Add architecture support for PCI Liviu Dudau
2014-03-12  8:41   ` Jingoo Han
2014-03-13  0:11     ` Liviu Dudau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140307014452.GI13582@bart.dudau.co.uk \
    --to=liviu@dudau.co.uk \
    --cc=Catalin.Marinas@arm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=tinamdar@apm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox