Message ID | 1368198723-24639-5-git-send-email-julien.grall@linaro.org |
---|---|
State | Superseded, archived |
Headers | show |
On Fri, 2013-05-10 at 16:11 +0100, Julien Grall wrote: > Signed-off-by: Julien Grall <julien.grall@linaro.org> > --- > 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); \
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); +} + +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); \
Signed-off-by: Julien Grall <julien.grall@linaro.org> --- xen/include/asm-arm/mm.h | 10 ++++++++++ 1 file changed, 10 insertions(+)