From: David Howells <dhowells@redhat.com>
To: Jes Sorensen <jes@sunsite.dk>
Cc: David Woodhouse <dwmw2@infradead.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
dhowells@redhat.com (David Howells),
linux-kernel@vger.kernel.org, arjanv@redhat.com
Subject: Re: [RFC] I/O Access Abstractions
Date: Fri, 29 Jun 2001 09:31:23 +0100 [thread overview]
Message-ID: <3652.993803483@warthog.cambridge.redhat.com> (raw)
In-Reply-To: Your message of "28 Jun 2001 18:02:35 +0200." <d3bsn8bnj8.fsf@lxplus015.cern.ch>
Jes Sorensen <jes@sunsite.dk> wrote:
> >>>>> "David" == David Woodhouse <dwmw2@infradead.org> writes:
>
> David> Having per-resource I/O methods would help us to remove some of
> David> the cruft which is accumulating in various non-x86 code. Note
> David> that the below is the _core_ routines for _one_ board - I'm not
> David> even including the extra indirection through the machine vector
> David> here....
>
> Have you considered the method used by the 8390 Ethernet driver?
> For each device, add a pointer to the registers and a register shift.
And also flags to specify which address space the I/O ports reside in, and
which how to adjust the host-PCI bridge to bring the appropriate bit of the
PCI address space into view through the CPU address space window. Don't laugh
- it happens.
> I really don't like hacing virtual access functions that makes memory
> mapped I/O look the same as I/O operations.
Why not? It makes drivers a simpler and more flexible if they can treat
different types of resource in the same way. serial.c is a really good example
of this:
| static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
| {
| switch (info->io_type) {
| #ifdef CONFIG_HUB6
| case SERIAL_IO_HUB6:
| outb(info->hub6 - 1 + offset, info->port);
| return inb(info->port+1);
| #endif
| case SERIAL_IO_MEM:
| return readb((unsigned long) info->iomem_base +
| (offset<<info->iomem_reg_shift));
| #ifdef CONFIG_SERIAL_GSC
| case SERIAL_IO_GSC:
| return gsc_readb(info->iomem_base + offset);
| #endif
| default:
| return inb(info->port + offset);
| }
| }
The switch has to be performed at runtime - so you get at least one
conditional branch in your code, probably more. My proposal would replace the
conditional branch with a subroutine (which lacks the pipline stall).
Also a number of drivers (eg: ne2k-pci) have to be bound to compile time to
either I/O space or memory space. This would allow you to do it at runtime
without incurring conditional branching.
> For memory mapped I/O you want to be able to smart optimizations to reduce
> the access on the PCI bus (or similar).
I wouldn't have thought you'd want to reduce the number of accesses to the PCI
bus. If, for example, you did to writes to a memory-mapped I/O register, you
don't want the first to be optimised away.
David
next prev parent reply other threads:[~2001-06-29 8:31 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-28 13:13 [RFC] I/O Access Abstractions David Howells
2001-06-28 13:32 ` Alan Cox
2001-06-28 13:55 ` David Woodhouse
2001-06-28 16:02 ` Jes Sorensen
2001-06-29 8:31 ` David Howells [this message]
2001-06-29 21:02 ` Jes Sorensen
2001-07-02 14:22 ` David Woodhouse
2001-07-02 15:57 ` David Howells
2001-07-02 16:17 ` David Woodhouse
2001-07-02 16:20 ` Alan Cox
2001-07-02 16:41 ` David Woodhouse
2001-07-02 16:56 ` Alan Cox
2001-07-02 18:22 ` Russell King
2001-07-02 18:26 ` Jeff Garzik
2001-07-02 20:10 ` Alan Cox
2001-07-02 22:08 ` Benjamin Herrenschmidt
2001-07-02 22:15 ` Alan Cox
2001-07-02 23:54 ` Benjamin Herrenschmidt
2001-07-03 12:02 ` Alan Cox
2001-07-03 14:38 ` Benjamin Herrenschmidt
2001-07-03 2:06 ` Jeff Garzik
2001-07-03 8:38 ` David Howells
2001-07-07 11:27 ` Geert Uytterhoeven
2001-07-03 8:15 ` David Howells
2001-07-03 8:22 ` Jeff Garzik
2001-07-03 8:31 ` Jeff Garzik
2001-07-03 9:00 ` David Howells
2001-07-03 9:29 ` Jeff Garzik
2001-07-02 22:10 ` Benjamin Herrenschmidt
2001-07-03 8:04 ` David Howells
2001-07-03 7:55 ` David Howells
2001-07-03 8:00 ` Jeff Garzik
2001-07-03 8:07 ` David Howells
2001-07-03 11:53 ` Alan Cox
2001-07-07 11:26 ` Geert Uytterhoeven
[not found] <20010702191129.A29246@flint.arm.linux.org.uk>
2001-07-03 8:12 ` David Howells
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=3652.993803483@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjanv@redhat.com \
--cc=dwmw2@infradead.org \
--cc=jes@sunsite.dk \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox