From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH/RFC] Hookable IO operations
Date: Sat, 04 Nov 2006 09:32:01 +1100 [thread overview]
Message-ID: <1162593121.10630.132.camel@localhost.localdomain> (raw)
In-Reply-To: <200611032320.34762.arnd@arndb.de>
> I think it would be helpful to not generate the function name itself,
> but pass it down to the macro, so you grep for the definition, either
>
> DEF_MMIO_IN_BE(in_be16, u16, lwz)
>
> or going further, making it look more like a declaration
>
> static inline u16 DEF_MMIO_IN_BE(in_be16, u16, lwz)
>
> which may even do the right thing with ctags (need to check that)
I'll look into it.
> > +/*
> > + * IO stream instructions are defined out of line
> > + */
> > +extern void _insb(volatile u8 __iomem *port, void *buf, long count);
> > +extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
> > +extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
> > +extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
> > +extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
> > +extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
>
> If you leave out the 'extern', it fits into a normal line ;-)
Did I change them from the initial definition ? Anyway, I dislike
prototypes in headers without "extern".
>
> similarly here, you could write these using slightly different macros
> as
>
> DEF_PCI_AC_OUT_MMIO(writeb, u8)
> DEF_PCI_AC_OUT_PIO(outb, u8)
> DEF_PCI_AC_OUT_MMIO(writew, u16)
> DEF_PCI_AC_OUT_PIO(outw, u16)
I'll look at it.
> > +
> > +/* We still use EEH versions for now. Ultimately, we might just get rid of
> > + * EEH in here and use it as a set of __memset_io etc... hooks
> > + */
>
> Yes, I fully agree. The definition of eeh_memset_io and the others
> looks like they really want to be out-of-line.
Yes.
> > +
> > +extern void (*__memset_io)(volatile void __iomem *addr, int c,
> > + unsigned long n);
> > +extern void (*__memcpy_fromio)(void *dest, const volatile void __iomem *src,
> > + unsigned long n);
> > +extern void (*__memcpy_toio)(volatile void __iomem *dest, const void *src,
> > + unsigned long n);
>
> Why are these all separate symbols? Wouldn't it be clearer to group them
> in ppc_md, or a similar structure of function pointers?
Because the IO ones are separate already and I want to keep things
consistent with them.
> This is the point where it gets completely unreadable. I ended up
> running the macros through 'gcc -E' to see what they do ;-)
Come on ... :-) They are almost the same as the ones in the .h, they
just only define the function pointer.
> If you resolve all the macros, you actually get fewer lines, and
> it suddenly becomes readable, as well as parsable with grep and ctags:
>
> u8 (*__ind_readb) (const volatile void __iomem * addr);
> EXPORT_SYMBOL(__ind_readb);
> u8 (*__ind_inb) (unsigned long port);
> EXPORT_SYMBOL(__ind_inb);
> u16 (*__ind_readw) (const volatile void __iomem * addr);
> EXPORT_SYMBOL(__ind_readw);
> u16 (*__ind_inw) (unsigned long port);
> ...
>
> I do the same when I start using macros, it's always hard to know exactly
> when to stop ;-)
I'll look and see what the result looks like.
> > -static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
> > +static u8 iseries_readb(const volatile void __iomem *IoAddress)
>
> Since you're converting iSeries_Read_Byte from SilLycAps, shouldn't
> you change IoAddress to something more sensible at the same time?
No, I'm only changing the prototype & name to better match my hooks,
further cleanups of the content of these functions is something I'll do
in a separate patch.
> > {
> > u64 BarOffset;
> > u64 dsa;
> > @@ -462,7 +411,8 @@ static u8 iSeries_Read_Byte(const volati
> > num_printed = 0;
> > }
> > if (num_printed++ < 10)
> > - printk(KERN_ERR "iSeries_Read_Byte: invalid access at IO address %p\n", IoAddress);
> > + printk(KERN_ERR "iSeries_Read_Byte: invalid access at IO address %p\n",
> > + IoAddress);
> > return 0xff;
>
> And the name in the comment should also be changed.
Ooopsa.
Ben.
next prev parent reply other threads:[~2006-11-03 22:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-03 21:12 [PATCH/RFC] Hookable IO operations Benjamin Herrenschmidt
2006-11-03 22:20 ` Arnd Bergmann
2006-11-03 22:32 ` Benjamin Herrenschmidt [this message]
2006-11-03 22:48 ` Arnd Bergmann
2006-11-03 22:56 ` Benjamin Herrenschmidt
2006-11-04 0:15 ` Arnd Bergmann
2006-11-04 1:06 ` Benjamin Herrenschmidt
2006-11-04 16:28 ` Segher Boessenkool
2006-11-04 22:05 ` Benjamin Herrenschmidt
2006-11-04 22:33 ` Segher Boessenkool
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=1162593121.10630.132.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=arnd@arndb.de \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).