From: Andrew Morton <akpm@linux-foundation.org>
To: Hitoshi Mitake <h.mitake@gmail.com>
Cc: Hitoshi Mitake <mitake@clustcom.com>,
Doug Thompson <norsk5@yahoo.com>,
dougthompson@xmission.com, linux-kernel@vger.kernel.org,
ktaka@clustcom.com, linux-arch@vger.kernel.org
Subject: Re: [PATCH 1/1] edac x38: new MC driver module
Date: Sun, 9 Nov 2008 11:26:46 -0800 [thread overview]
Message-ID: <20081109112646.97c594b5.akpm@linux-foundation.org> (raw)
In-Reply-To: <a6b9f31a0811090710y17e956bawf20675d6678b145e@mail.gmail.com>
(cc linux-arch)
On Mon, 10 Nov 2008 00:10:34 +0900 "Hitoshi Mitake" <h.mitake@gmail.com> wrote:
> ...
>
> >> -static u64 x38_readq(const void __iomem *addr)
> >> +#ifndef CONFIG_X86_64
> >> +static u64 readq(const void __iomem *addr)
> >
> > hm, it'd be nice if there was some more general way of determining
> > whether the architecture provides readq/writeq.
> >
>
>
> I found this code in include/asm-x86/io.h
>
> #ifdef CONFIG_X86_64
>
> ...
>
> /* Let people know we have them */
> #define readq readq
> #define writeq writeq
> #endif
>
> x86 programmers are able to know existence of readq/writeq by using
> this definition.
>
> And I grepped,
>
> % grep readq `find include/asm-* -name "*.h"`
> include/asm-mips/io.h: ".set mips3" "\t\t# __readq" "\n\t" \
> include/asm-mips/io.h:#define readq_relaxed readq
> include/asm-mips/io.h:#define readq readq
> include/asm-mips/txx9/tx4927.h: ((__u32)__raw_readq(&tx4927_ccfgptr->crir)
> >> 16)
> include/asm-mips/txx9/tx4927.h:#define
> TX4927_SDRAMC_CR(ch) __raw_readq(&tx4927_sdramcptr->cr[(ch)])
> include/asm-mips/txx9/tx4927.h:#define
> TX4927_EBUSC_CR(ch) __raw_readq(&tx4927_ebuscptr->cr[(ch)])
> include/asm-mips/txx9/tx4927.h: ____raw_writeq(____raw_readq(adr) & ~bits, adr);
> include/asm-mips/txx9/tx4927.h: ____raw_writeq(____raw_readq(adr) | bits, adr);
> include/asm-mips/txx9/tx4927.h: ____raw_writeq(____raw_readq(&tx4927_ccfgptr->ccfg)
> include/asm-mips/txx9/tx4927.h: ____raw_writeq((____raw_readq(&tx4927_ccfgptr->ccfg)
> include/asm-mips/txx9/tx4927.h: ____raw_writeq((____raw_readq(&tx4927_ccfgptr->ccfg)
> include/asm-mips/txx9/tx4938.h: ((__u32)__raw_readq(&tx4938_ccfgptr->crir)
> >> 16)
> include/asm-parisc/io.h:static inline unsigned long long
> gsc_readq(unsigned long addr)
> include/asm-parisc/io.h:static inline unsigned long long
> __raw_readq(const volatile void __iomem *addr)
> include/asm-parisc/io.h:#define readq(addr) __fswab64(__raw_readq(addr))
> include/asm-parisc/io.h:#define readq_relaxed(addr) readq(addr)
> include/asm-x86/io.h:build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
> include/asm-x86/io.h:build_mmio_read(__readq, "q", unsigned long, "=r", )
> include/asm-x86/io.h:#define readq_relaxed(a) __readq(a)
> include/asm-x86/io.h:#define __raw_readq __readq
> include/asm-x86/io.h:#define readq readq
>
> It seems that architectures that provide readq/writeq are
> mips, parisc and x86 (and x86_64).
>
> mips and x86 provides this line
> #define readq readq
> to let user know existence of readq (and writeq),
> and parisc doesn't provide.
> But there is,
> #define readq(addr) __fswab64(__raw_readq(addr))
> in parisc.
>
> There is a difference between mips and x86's readq/writeq and
> parisc's readq/writeq. mips and x86's definition is only token,
> but parisc's definition is macro function.
>
> But these defines can be used to determine existence of readq/writeq
> by common preprocessor like this,
> #ifndef readq
> /* programmer can define private version of readq (or writeq) */
> #endif
>
> Is this way enough general for our requirement?
> (If we use this as general way to determine existence of readq/writeq,
> I want other architecture's developer (whose architecture provides
> readq/writeq in the future)
> to support same way.)
Yes, I'd say that
#ifdef readq
Is a suitable way of determining whether the architecture implements
readq and writeq. It isn't pretty, but it will suffice.
A problem with it is that drivers will then do
#ifndef readq
<provide a local implementation here>
#endif
which rather sucks - we don't want lots of little private readq/writeq
implementations all over the tree.
Perhaps it would be better to have a CONFIG_ARCH_HAS_READQ and to then
disable these drivers on the architectures which don't provide
readq/writeq support.
Also, I'm not sure that we have sufficiently defined the semantics of
these operations, and whether all the architectures which do purport to
implement them actually implement them with the same semantics.
next prev parent reply other threads:[~2008-11-09 19:26 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-17 21:39 [PATCH 1/1] edac x38: new MC driver module dougthompson
2008-10-20 23:32 ` Andrew Morton
2008-11-05 22:29 ` Hitoshi Mitake
2008-11-05 16:26 ` Doug Thompson
2008-11-07 0:46 ` Andrew Morton
2008-11-07 15:28 ` Hitoshi Mitake
2008-11-07 6:31 ` Andrew Morton
2008-11-07 15:38 ` Hitoshi Mitake
2008-11-07 7:11 ` Andrew Morton
2008-11-09 15:10 ` Hitoshi Mitake
2008-11-09 19:26 ` Andrew Morton [this message]
2008-11-11 6:11 ` Paul Mundt
2008-11-13 15:15 ` Hitoshi Mitake
2008-11-18 12:16 ` Ralf Baechle
2008-11-18 12:32 ` Russell King
2008-11-20 16:19 ` Hitoshi Mitake
2008-11-23 23:52 ` H. Peter Anvin
2008-11-24 17:18 ` Luck, Tony
2008-11-24 17:18 ` Luck, Tony
2008-11-24 18:02 ` H. Peter Anvin
2008-11-25 2:55 ` Hitoshi Mitake
2008-11-25 5:13 ` H. Peter Anvin
2008-11-25 15:30 ` Hitoshi Mitake
2008-11-25 15:46 ` Geert Uytterhoeven
2008-11-25 16:10 ` Hitoshi Mitake
2008-11-29 0:11 ` Hitoshi Mitake
-- strict thread matches above, loose matches on Subject: below --
2008-11-29 0:56 H. Peter Anvin
2008-11-29 0:56 ` H. Peter Anvin
2008-11-29 7:47 ` Hitoshi Mitake
2008-11-29 7:47 ` Hitoshi Mitake
2008-11-29 9:38 ` Ingo Molnar
2008-11-29 10:26 ` Hitoshi Mitake
2008-11-29 10:52 ` Sam Ravnborg
2008-11-29 13:24 ` Hitoshi Mitake
2008-11-29 18:01 ` Sam Ravnborg
2008-11-30 8:16 ` Hitoshi Mitake
2008-11-30 8:37 ` Ingo Molnar
2008-11-30 8:37 ` Ingo Molnar
2008-11-30 9:24 ` Ingo Molnar
2008-11-30 9:24 ` Ingo Molnar
2008-11-30 15:20 ` Hitoshi Mitake
2008-11-30 16:15 ` Ingo Molnar
2008-12-01 13:51 ` Hitoshi Mitake
2008-12-01 13:59 ` Ingo Molnar
2008-12-01 23:58 ` Hitoshi Mitake
2008-12-04 15:58 ` Hitoshi Mitake
2009-01-16 1:24 ` Hitoshi Mitake
2009-02-21 10:11 ` Hitoshi Mitake
2009-02-21 10:39 ` Russell King
2009-02-21 13:09 ` Sam Ravnborg
2009-02-22 14:15 ` Hitoshi Mitake
2009-02-22 14:16 ` Hitoshi Mitake
2009-02-22 14:16 ` Hitoshi Mitake
2009-02-22 14:16 ` Hitoshi Mitake
2009-02-22 14:18 ` Hitoshi Mitake
2009-02-22 14:18 ` Hitoshi Mitake
2009-02-22 14:18 ` Hitoshi Mitake
2009-02-22 14:19 ` Hitoshi Mitake
2009-02-22 14:20 ` Hitoshi Mitake
2009-02-22 14:21 ` Hitoshi Mitake
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=20081109112646.97c594b5.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dougthompson@xmission.com \
--cc=h.mitake@gmail.com \
--cc=ktaka@clustcom.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mitake@clustcom.com \
--cc=norsk5@yahoo.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 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.