diff mbox

[V4,02/32] xen/mm: Align virtual address on PAGE_SIZE in iounmap

Message ID 1368198723-24639-3-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall May 10, 2013, 3:11 p.m. UTC
ioremap function can unlikely return an unaligned virtual address if
the physical address itself is unaligned on a page size.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
CC: keir@xen.org

Changes in v4:
    - replace vaddr_t by unsigned int
---
 xen/include/xen/vmap.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Julien Grall May 10, 2013, 4:16 p.m. UTC | #1
On 05/10/2013 04:11 PM, Julien Grall wrote:

> ioremap function can unlikely return an unaligned virtual address if
> the physical address itself is unaligned on a page size.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> CC: keir@xen.org
> 
> Changes in v4:
>     - replace vaddr_t by unsigned int
> ---
>  xen/include/xen/vmap.h |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
> index 88e5d99..45e9870 100644
> --- a/xen/include/xen/vmap.h
> +++ b/xen/include/xen/vmap.h
> @@ -15,7 +15,9 @@ void __iomem *ioremap(paddr_t, size_t);
>  
>  static inline void iounmap(void __iomem *va)
>  {
> -    vunmap((void __force *)va);
> +    unsigned int addr = (unsigned int)(void __force *)va;


Hum I used unsigned int instead of unsigned long. I will resend back
this patch.

> +
> +    vunmap((void *)(addr & PAGE_MASK));
>  }
>  
>  void vm_init(void);
diff mbox

Patch

diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
index 88e5d99..45e9870 100644
--- a/xen/include/xen/vmap.h
+++ b/xen/include/xen/vmap.h
@@ -15,7 +15,9 @@  void __iomem *ioremap(paddr_t, size_t);
 
 static inline void iounmap(void __iomem *va)
 {
-    vunmap((void __force *)va);
+    unsigned int addr = (unsigned int)(void __force *)va;
+
+    vunmap((void *)(addr & PAGE_MASK));
 }
 
 void vm_init(void);