Message ID | 20171009132341.1678-7-julien.grall@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 9 Oct 2017, Julien Grall wrote: > At the moment, PAGE_HYPERVISOR_* and MT_* have exactly the same value. > In a follow-up patch the former will be extended to carry more > information. > > It looks like the caller of set_fixmap are mixing the both. Stay > consistent and only use PAGE_HYPERVISOR_*. This is also match the > behavior of create_xen_entries and would potentially allow to share some > part in the future. > > Also rename the parameter 'attributes' to 'flags' so it is clearer what > is the interface. > > Signed-off-by: Julien Grall <julien.grall@arm.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> > --- > Changes in v4: > - Patch added. > --- > xen/arch/arm/kernel.c | 2 +- > xen/arch/arm/mm.c | 4 ++-- > xen/arch/arm/platforms/vexpress.c | 3 ++- > xen/drivers/video/arm_hdlcd.c | 2 +- > 4 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c > index a12baa86e7..c2755a9ab9 100644 > --- a/xen/arch/arm/kernel.c > +++ b/xen/arch/arm/kernel.c > @@ -54,7 +54,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) > s = paddr & (PAGE_SIZE-1); > l = min(PAGE_SIZE - s, len); > > - set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_NORMAL_NC); > + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), PAGE_HYPERVISOR_WC); > 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 39bade63f5..70a03015ec 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -329,9 +329,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, mfn_t mfn, unsigned attributes) > +void set_fixmap(unsigned map, mfn_t mfn, unsigned int flags) > { > - lpae_t pte = mfn_to_xen_entry(mfn, attributes); > + lpae_t pte = mfn_to_xen_entry(mfn, flags); > 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 df2c4b5bec..39b6bcc70e 100644 > --- a/xen/arch/arm/platforms/vexpress.c > +++ b/xen/arch/arm/platforms/vexpress.c > @@ -65,7 +65,8 @@ 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, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEVICE_nGnRE); > + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), > + PAGE_HYPERVISOR_NOCACHE); > > 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 1175399dbc..e1174b223f 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, maddr_to_mfn(hdlcd_start), MT_DEVICE_nGnRE); > + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), PAGE_HYPERVISOR_NOCACHE); > HDLCD[HDLCD_COMMAND] = 0; > > HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel; > -- > 2.11.0 >
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index a12baa86e7..c2755a9ab9 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -54,7 +54,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) s = paddr & (PAGE_SIZE-1); l = min(PAGE_SIZE - s, len); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_NORMAL_NC); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), PAGE_HYPERVISOR_WC); 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 39bade63f5..70a03015ec 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -329,9 +329,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, mfn_t mfn, unsigned attributes) +void set_fixmap(unsigned map, mfn_t mfn, unsigned int flags) { - lpae_t pte = mfn_to_xen_entry(mfn, attributes); + lpae_t pte = mfn_to_xen_entry(mfn, flags); 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 df2c4b5bec..39b6bcc70e 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -65,7 +65,8 @@ 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, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEVICE_nGnRE); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), + PAGE_HYPERVISOR_NOCACHE); 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 1175399dbc..e1174b223f 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, maddr_to_mfn(hdlcd_start), MT_DEVICE_nGnRE); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), PAGE_HYPERVISOR_NOCACHE); HDLCD[HDLCD_COMMAND] = 0; HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel;
At the moment, PAGE_HYPERVISOR_* and MT_* have exactly the same value. In a follow-up patch the former will be extended to carry more information. It looks like the caller of set_fixmap are mixing the both. Stay consistent and only use PAGE_HYPERVISOR_*. This is also match the behavior of create_xen_entries and would potentially allow to share some part in the future. Also rename the parameter 'attributes' to 'flags' so it is clearer what is the interface. Signed-off-by: Julien Grall <julien.grall@arm.com> --- Changes in v4: - Patch added. --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mm.c | 4 ++-- xen/arch/arm/platforms/vexpress.c | 3 ++- xen/drivers/video/arm_hdlcd.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-)