From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Deegan Subject: Re: [PATCH 1/6] xen/arm: introduce map_phys_range Date: Thu, 6 Dec 2012 12:44:04 +0000 Message-ID: <20121206124404.GN82725@ocelot.phlegethon.org> References: <1354731588-32579-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1354731588-32579-1-git-send-email-stefano.stabellini@eu.citrix.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: Stefano Stabellini Cc: xen-devel@lists.xensource.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org At 18:19 +0000 on 05 Dec (1354731583), Stefano Stabellini wrote: > Introduce a function to map a physical memory into virtual memory. > It is going to be used later to map the videoram. > > Signed-off-by: Stefano Stabellini > --- > xen/arch/arm/mm.c | 23 +++++++++++++++++++++++ > xen/include/asm-arm/mm.h | 3 +++ > 2 files changed, 26 insertions(+), 0 deletions(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index 68ee9da..418a414 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -376,6 +376,29 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) > frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info)); > } > > +/* Map the physical memory range start - end at the virtual address > + * virt_start in 2MB chunks. start and virt_start have to be 2MB > + * aligned. > + */ > +void map_phys_range(paddr_t start, paddr_t end, > + unsigned long virt_start, unsigned attributes) > +{ > + ASSERT(!(start & ((1 << 21) - 1))); > + ASSERT(!(virt_start & ((1 << 21) - 1))); Please use SECOND_SHIFT rather than 21, and maybe even add a SECOND_MASK &c to page.h rather than open-coding the < + while ( start < end ) > + { > + lpae_t e = mfn_to_xen_entry(start >> PAGE_SHIFT); > + e.pt.ai = attributes; > + write_pte(xen_second + second_table_offset(virt_start), e); > + > + start += (1<<21); > + virt_start += (1<<21); Maybe add SECOND_SIZE &c too? > + } > + > + flush_xen_data_tlb(); What's this for? Cheers, Tim. > +} > + > enum mg { mg_clear, mg_ro, mg_rw, mg_rx }; > static void set_pte_flags_on_range(const char *p, unsigned long l, enum mg mg) > { > diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h > index 3549c83..a11f20b 100644 > --- a/xen/include/asm-arm/mm.h > +++ b/xen/include/asm-arm/mm.h > @@ -152,6 +152,9 @@ extern void setup_frametable_mappings(paddr_t ps, paddr_t pe); > extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes); > /* Remove a mapping from a fixmap entry */ > extern void clear_fixmap(unsigned map); > +/* map a 2MB aligned physical range in virtual memory. */ > +extern void map_phys_range(paddr_t start, paddr_t end, > + unsigned long virt_start, unsigned attributes); > > > #define mfn_valid(mfn) ({ \ > -- > 1.7.2.5 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel