[Xen-devel,for-4.12,v2,1/2] xen/arm: mm: Use pte_xen_addr when creating xen entries

Message ID 20181214114455.5841-2-julien.grall@arm.com
State Accepted
Commit e72745671a42e7f11a9418533763d210d3f0c835
Headers show
Series
  • xen/arm: mm: Boot fixes
Related show

Commit Message

Julien Grall Dec. 14, 2018, 11:44 a.m.
The helper pte_xen_addr computes the MFN based on the virtual
address and generates the PTE. This can be r

At the same time, make va a vaddr_t to make clear it holds virtual address.

Signed-off-by: Julien Grall <julien.grall@arm.com>

---
    Changes in v2:
        - New patch
---
 xen/arch/arm/mm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini Dec. 14, 2018, 9:44 p.m. | #1
On Fri, 14 Dec 2018, Julien Grall wrote:
> The helper pte_xen_addr computes the MFN based on the virtual
> address and generates the PTE. This can be r
> 
> At the same time, make va a vaddr_t to make clear it holds virtual address.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>

> ---
>     Changes in v2:
>         - New patch
> ---
>  xen/arch/arm/mm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 2556e57a99..91f3aef93c 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -652,12 +652,11 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
>      /* Break up the Xen mapping into 4k pages and protect them separately. */
>      for ( i = 0; i < LPAE_ENTRIES; i++ )
>      {
> -        mfn_t mfn = mfn_add(maddr_to_mfn(xen_paddr), i);
> -        unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT);
> +        vaddr_t va = XEN_VIRT_START + (i << PAGE_SHIFT);
>  
>          if ( !is_kernel(va) )
>              break;
> -        pte = mfn_to_xen_entry(mfn, MT_NORMAL);
> +        pte = pte_of_xenaddr(va);
>          pte.pt.table = 1; /* 4k mappings always have this bit set */
>          if ( is_kernel_text(va) || is_kernel_inittext(va) )
>          {
> -- 
> 2.11.0
>

Patch

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 2556e57a99..91f3aef93c 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -652,12 +652,11 @@  void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
     /* Break up the Xen mapping into 4k pages and protect them separately. */
     for ( i = 0; i < LPAE_ENTRIES; i++ )
     {
-        mfn_t mfn = mfn_add(maddr_to_mfn(xen_paddr), i);
-        unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT);
+        vaddr_t va = XEN_VIRT_START + (i << PAGE_SHIFT);
 
         if ( !is_kernel(va) )
             break;
-        pte = mfn_to_xen_entry(mfn, MT_NORMAL);
+        pte = pte_of_xenaddr(va);
         pte.pt.table = 1; /* 4k mappings always have this bit set */
         if ( is_kernel_text(va) || is_kernel_inittext(va) )
         {