[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 17/24] xen/arm: mm: Use typesafe MFN in set_fixmap
On Tue, 13 Jun 2017, Julien Grall wrote: > Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> > --- > xen/arch/arm/acpi/lib.c | 4 ++-- > xen/arch/arm/kernel.c | 4 +--- > xen/arch/arm/mm.c | 4 ++-- > xen/arch/arm/platforms/vexpress.c | 2 +- > xen/drivers/video/arm_hdlcd.c | 2 +- > xen/include/asm-arm/mm.h | 2 +- > 6 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c > index 9bd769cff6..70131b0736 100644 > --- a/xen/arch/arm/acpi/lib.c > +++ b/xen/arch/arm/acpi/lib.c > @@ -31,7 +31,7 @@ char *__acpi_map_table(paddr_t phys, unsigned long size) > > offset = phys & (PAGE_SIZE - 1); > mapped_size = PAGE_SIZE - offset; > - set_fixmap(FIXMAP_ACPI_BEGIN, phys >> PAGE_SHIFT, PAGE_HYPERVISOR); > + set_fixmap(FIXMAP_ACPI_BEGIN, maddr_to_mfn(phys), PAGE_HYPERVISOR); > base = FIXMAP_ADDR(FIXMAP_ACPI_BEGIN); > > /* Most cases can be covered by the below. */ > @@ -41,7 +41,7 @@ char *__acpi_map_table(paddr_t phys, unsigned long size) > if ( ++idx > FIXMAP_ACPI_END ) > return NULL; /* cannot handle this */ > phys += PAGE_SIZE; > - set_fixmap(idx, phys >> PAGE_SHIFT, PAGE_HYPERVISOR); > + set_fixmap(idx, maddr_to_mfn(phys), PAGE_HYPERVISOR); > mapped_size += PAGE_SIZE; > } > > diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c > index 1b32d55284..7403ec0c0e 100644 > --- a/xen/arch/arm/kernel.c > +++ b/xen/arch/arm/kernel.c > @@ -49,14 +49,12 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned > long len) > void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC); > > while (len) { > - paddr_t p; > unsigned long l, s; > > - p = paddr >> PAGE_SHIFT; > s = paddr & (PAGE_SIZE-1); > l = min(PAGE_SIZE - s, len); > > - set_fixmap(FIXMAP_MISC, p, BUFFERABLE); > + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), BUFFERABLE); > memcpy(dst, src + s, l); > clean_dcache_va_range(dst, l); > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index fb01f01879..8573192e3a 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -323,9 +323,9 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned > attr) > } > > /* Map a 4k page in a fixmap entry */ > -void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes) > +void set_fixmap(unsigned map, mfn_t mfn, unsigned attributes) > { > - lpae_t pte = mfn_to_xen_entry(_mfn(mfn), attributes); > + lpae_t pte = mfn_to_xen_entry(mfn, attributes); > pte.pt.table = 1; /* 4k mappings always have this bit set */ > pte.pt.xn = 1; > write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte); > diff --git a/xen/arch/arm/platforms/vexpress.c > b/xen/arch/arm/platforms/vexpress.c > index 8e6a4eaa32..a26ac324ba 100644 > --- a/xen/arch/arm/platforms/vexpress.c > +++ b/xen/arch/arm/platforms/vexpress.c > @@ -65,7 +65,7 @@ int vexpress_syscfg(int write, int function, int device, > uint32_t *data) > uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); > int ret = -1; > > - set_fixmap(FIXMAP_MISC, V2M_SYS_MMIO_BASE >> PAGE_SHIFT, DEV_SHARED); > + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), DEV_SHARED); > > if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START ) > goto out; > diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c > index 8241cae117..3915f731f5 100644 > --- a/xen/drivers/video/arm_hdlcd.c > +++ b/xen/drivers/video/arm_hdlcd.c > @@ -227,7 +227,7 @@ void __init video_init(void) > /* uses FIXMAP_MISC */ > set_pixclock(videomode->pixclock); > > - set_fixmap(FIXMAP_MISC, hdlcd_start >> PAGE_SHIFT, DEV_SHARED); > + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), DEV_SHARED); > HDLCD[HDLCD_COMMAND] = 0; > > HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel; > diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h > index 3dab6dc9a1..b2e7ea7761 100644 > --- a/xen/include/asm-arm/mm.h > +++ b/xen/include/asm-arm/mm.h > @@ -176,7 +176,7 @@ extern void setup_xenheap_mappings(unsigned long > base_mfn, unsigned long nr_mfns > /* Map a frame table to cover physical addresses ps through pe */ > extern void setup_frametable_mappings(paddr_t ps, paddr_t pe); > /* Map a 4k page in a fixmap entry */ > -extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes); > +extern void set_fixmap(unsigned map, mfn_t mfn, unsigned attributes); > /* Remove a mapping from a fixmap entry */ > extern void clear_fixmap(unsigned map); > /* map a physical range in virtual memory */ > -- > 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |