All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Olof Johansson <olof@lixom.net>
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org
Subject: Re: [PATCH] powerpc: make ioport_map() handle already mapped ranges
Date: Sun, 13 May 2007 01:55:41 +0200	[thread overview]
Message-ID: <200705130155.42414.arnd@arndb.de> (raw)
In-Reply-To: <20070512223623.GA16045@lixom.net>

On Sunday 13 May 2007, Olof Johansson wrote:
> > We have a bug on cell that would be fixed with this patch, so it
> > might be the same problem, see the patch that I suggested for
> > this at http://patchwork.ozlabs.org/linuxppc/patch?id=10840 .
> 
> Not in this case, but thanks for the pointer. Your case is still based
> on the fact that you only have one io space range, you're just making
> sure you're allocating out of that range. In my case, I have two distinct
> ranges, they're even on different busses...

There is a global io space range for all buses, which is maintained
by the reserve_phb_iospace() call. You should get your I/O ports in there
if you want them to just work. Note that while the reserve_phb_iospace() 
logic works in practice, it does have a few shortcomings that should
eventually be resolved:

* There is no way to free these ranges, so you can't use this mechanism
to allocate space for hotpluggable buses, or you might run out of
space eventually

* there is no locking around the use of reserve_phb_iospace().

* Buses that are already hotplugged get an io port range above the
range maintained by reserve_phb_iospace(), but that may be larger
than 4GB, so that I/O port numbers allocated on thoses buses require
64 bit integers to store them.

* If you have registered primary PCI bus, the whole logic breaks down
and you always need 64 bit integers to store I/O port numbers, at best.

* Worse things happen if you try to use pci_iomap, which checks
PIO_MASK. This mask is currently defined for 30 bit addresses, while
the range managed by reserve_phb_iospace() is already 31 bits, not
to mention ports outside of that range.

* If you call reserve_phb_iospace() for a secondary bus before
 setting pci_io_base to the primary bus, you actually get negative
I/O port numbers, and you crash when using a 32  bit number to store
it.
	Arnd <><

  reply	other threads:[~2007-05-13  0:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-12 14:32 [PATCH] powerpc: make ioport_map() handle already mapped ranges Olof Johansson
2007-05-12 22:18 ` Arnd Bergmann
2007-05-12 22:36   ` Olof Johansson
2007-05-12 23:55     ` Arnd Bergmann [this message]
2007-05-13  1:46       ` Benjamin Herrenschmidt

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=200705130155.42414.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=olof@lixom.net \
    --cc=paulus@samba.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.