All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Josh Zhao <joshsystem@gmail.com>,
	stefano.stabellini@eu.citrix.com, tim@xen.org,
	xen-devel@lists.xen.org
Subject: Re: [PATCH RFC 2/8] xen/arm: implement read[bl] and write[bl]
Date: Tue, 10 Sep 2013 16:12:10 +0100	[thread overview]
Message-ID: <522F36CA.1020903@linaro.org> (raw)
In-Reply-To: <1378825766.10928.19.camel@kazak.uk.xensource.com>

On 09/10/2013 04:09 PM, Ian Campbell wrote:
> On Tue, 2013-09-10 at 16:00 +0100, Julien Grall wrote:
>> On 09/10/2013 03:18 PM, Ian Campbell wrote:
>>> These are used in common driver code (specifically ns16550)
>>
>> Can you implement read[bl] and write[bl] also for arm64?
> 
> Uhm, yesm that's something of a prerequisite actually -- these functiosn
> are in a common location so they need to be moved!

BTW, there is already an implementation for readl/writel but called
ioreadl/iowritel.

You can either rename the functions or add some macros.

> Well spotted.
> 
> I should also have mentioned the Linux heritage of these functions in
> the commit message and/or in a code comment, which was remiss of me.
> 
>>
>>> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>>> ---
>>>  xen/include/asm-arm/io.h |   48 ++++++++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 48 insertions(+)
>>>
>>> diff --git a/xen/include/asm-arm/io.h b/xen/include/asm-arm/io.h
>>> index aea5233..170263f 100644
>>> --- a/xen/include/asm-arm/io.h
>>> +++ b/xen/include/asm-arm/io.h
>>> @@ -1,6 +1,54 @@
>>>  #ifndef _ASM_IO_H
>>>  #define _ASM_IO_H
>>>  
>>> +static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
>>> +{
>>> +        asm volatile("strb %1, %0"
>>> +                     : "+Qo" (*(volatile u8 __force *)addr)
>>> +                     : "r" (val));
>>> +}
>>> +
>>> +static inline void __raw_writel(u32 val, volatile void __iomem *addr)
>>> +{
>>> +        asm volatile("str %1, %0"
>>> +                     : "+Qo" (*(volatile u32 __force *)addr)
>>> +                     : "r" (val));
>>> +}
>>> +
>>> +static inline u8 __raw_readb(const volatile void __iomem *addr)
>>> +{
>>> +        u8 val;
>>> +        asm volatile("ldrb %1, %0"
>>> +                     : "+Qo" (*(volatile u8 __force *)addr),
>>> +                       "=r" (val));
>>> +        return val;
>>> +}
>>> +
>>> +static inline u32 __raw_readl(const volatile void __iomem *addr)
>>> +{
>>> +        u32 val;
>>> +        asm volatile("ldr %1, %0"
>>> +                     : "+Qo" (*(volatile u32 __force *)addr),
>>> +                       "=r" (val));
>>> +        return val;
>>> +}
>>> +
>>> +#define __iormb()               rmb()
>>> +#define __iowmb()               wmb()
>>> +
>>> +#define readb_relaxed(c) ({ u8  __r = __raw_readb(c); __r; })
>>> +#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
>>> +                                        __raw_readl(c)); __r; })
>>> +
>>> +#define writeb_relaxed(v,c)     __raw_writeb(v,c)
>>> +#define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
>>> +
>>> +#define readb(c)                ({ u8  __v = readb_relaxed(c); __iormb(); __v; })
>>> +#define readl(c)                ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
>>> +
>>> +#define writeb(v,c)             ({ __iowmb(); writeb_relaxed(v,c); })
>>> +#define writel(v,c)             ({ __iowmb(); writel_relaxed(v,c); })
>>> +
>>>  #endif
>>>  /*
>>>   * Local variables:
>>>
>>
>>
> 
> 


-- 
Julien Grall

  reply	other threads:[~2013-09-10 15:12 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 14:18 [PATCH RFC 0/8] xen/arm: very initial cubieboard2 support Ian Campbell
2013-09-10 14:18 ` [PATCH RFC 1/8] xen/arm: Implement ioremap Ian Campbell
2013-09-10 15:03   ` Julien Grall
2013-09-10 15:14     ` Ian Campbell
2013-09-10 15:20       ` Julien Grall
2013-09-10 14:18 ` [PATCH RFC 2/8] xen/arm: implement read[bl] and write[bl] Ian Campbell
2013-09-10 15:00   ` Julien Grall
2013-09-10 15:09     ` Ian Campbell
2013-09-10 15:12       ` Julien Grall [this message]
2013-09-10 15:15         ` Ian Campbell
2013-09-10 14:18 ` [PATCH RFC 3/8] ns16550: make usable on ARM Ian Campbell
2013-09-10 14:36   ` Keir Fraser
2013-09-10 14:45     ` Ian Campbell
2013-09-10 15:00   ` Jan Beulich
2013-09-10 15:11     ` Ian Campbell
2013-09-10 15:18       ` Jan Beulich
2013-09-10 15:21         ` Ian Campbell
2013-09-10 14:18 ` [PATCH RFC 4/8] ns16550: support DesignWare 8250 Ian Campbell
2013-09-10 14:36   ` Keir Fraser
2013-09-10 15:02   ` Jan Beulich
2013-09-10 15:12     ` Ian Campbell
2013-09-10 15:19       ` Jan Beulich
2013-09-10 15:21         ` Ian Campbell
2013-09-10 15:28           ` Jan Beulich
2013-09-10 15:30             ` Ian Campbell
2013-09-10 14:18 ` [PATCH RFC 5/8] xen/arm: Support Cortex-A7 GIC Ian Campbell
2013-09-10 14:18 ` [PATCH RFC 6/8] xen/arm: Basic support for sunxi/sun7i platform Ian Campbell
2013-09-10 14:18 ` [PATCH RFC 7/8] xen/arm: Blacklist some sun7i UARTs Ian Campbell
2013-09-10 14:18 ` [PATCH RFC 8/8] xen/arm: Some early trap logging Ian Campbell
2013-09-13 13:26   ` Julien Grall
2013-09-13 13:35     ` Ian Campbell
2013-09-13 13:44       ` Julien Grall
2013-09-11  2:05 ` [PATCH RFC 0/8] xen/arm: very initial cubieboard2 support Josh Zhao
2013-09-11 10:15   ` Ian Campbell

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=522F36CA.1020903@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=joshsystem@gmail.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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.