[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V4 04/32] xen/arm: Add helpers ioreadl/iowritel



On Fri, 2013-05-10 at 16:11 +0100, Julien Grall wrote:
> Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
> ---
>  xen/include/asm-arm/mm.h |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
> index 63e1069..3749f44 100644
> --- a/xen/include/asm-arm/mm.h
> +++ b/xen/include/asm-arm/mm.h
> @@ -171,6 +171,16 @@ static inline void __iomem *ioremap_wc(paddr_t start, 
> size_t len)
>      return ioremap_attr(start, len, PAGE_HYPERVISOR_WC);
>  }
>  
> +static inline uint32_t ioreadl(const volatile void __iomem *addr)
> +{
> +    return (*(volatile uint32_t *)addr);
> +}

Is volatile here sufficient? I'd have thought some barriers ought to be
involved somewhere.

e.g. on Linux the equivalent functionality is:
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 ioread32(p)     ({ unsigned int __v = le32_to_cpu((__force 
__le32)__raw_readl(p)); __iormb(); __v; })

Ian.

> +
> +static inline void iowritel(const volatile void __iomem *addr, uint32_t val)
> +{
> +    *(volatile uint32_t *)addr = val;
> +}
> +
>  #define mfn_valid(mfn)        ({                                             
>  \
>      unsigned long __m_f_n = (mfn);                                           
>  \
>      likely(__m_f_n < max_page);                                              
>  \



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.