From: Ian Campbell Subject: Re: [PATCH V2 23/33] xen/arm: Allow Xen to run on multiple platform without recompilation Date: Wed, 8 May 2013 16:35:06 +0100 Message-ID: <1368027306.17285.36.camel@zakaz.uk.xensource.com> References: <1368027124.17285.34.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1368027124.17285.34.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: "patches@linaro.org" , "xen-devel@lists.xen.org" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 2013-05-08 at 16:32 +0100, Ian Campbell wrote: > > +/* Helper to read/write a register */ > > +static inline uint32_t platform_read_register(uint32_t addr) > > +{ > > + volatile const uint32_t *reg; > > + uint32_t value; > > + > > + set_fixmap(FIXMAP_MISC, addr >> PAGE_SHIFT, DEV_SHARED); > > + reg = (uint32_t *)(FIXMAP_ADDR(FIXMAP_MISC) + (addr & ~PAGE_MASK)); > > + value = *reg; > > + dsb(); isb(); > > + clear_fixmap(FIXMAP_MISC); > > I don't think the fixmap is per-PCPU so you probably want some locking > here. > > FIXMAP_MISC is a bit of an awful thing, but this isn't especially new, > so OK. In fact now I'm wondering if the platform specific code shouldn't establish its own permanent mapping with ioremap and use that. Ian.