All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@arm.com>, sstabellini@kernel.org
Subject: [PATCH for-next 1/9] xen/arm: Use mfn_to_pdx instead of pfn_to_pdx when possible
Date: Mon, 18 Feb 2019 11:35:52 +0000	[thread overview]
Message-ID: <20190218113600.9540-2-julien.grall@arm.com> (raw)
In-Reply-To: <20190218113600.9540-1-julien.grall@arm.com>

mfn_to_pdx adds more safety than pfn_to_pdx. Replace all but on place in
the Arm code to use the former.

No functional changes.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/mm.c        | 2 +-
 xen/include/asm-arm/mm.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 01ae2cccc0..be5338bb4c 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -886,7 +886,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
     int i;
 #endif
 
-    frametable_base_pdx = pfn_to_pdx(ps >> PAGE_SHIFT);
+    frametable_base_pdx = mfn_to_pdx(maddr_to_mfn(ps));
     /* Round up to 2M or 32M boundary, as appropriate. */
     frametable_size = ROUNDUP(frametable_size, mapping_size);
     base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12));
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index eafa26f56e..7b6aaf5e3f 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -225,7 +225,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)
 /* Convert between frame number and address formats.  */
 #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
 #define paddr_to_pfn(pa)  ((unsigned long)((pa) >> PAGE_SHIFT))
-#define paddr_to_pdx(pa)    pfn_to_pdx(paddr_to_pfn(pa))
+#define paddr_to_pdx(pa)    mfn_to_pdx(maddr_to_mfn(pa))
 #define gfn_to_gaddr(gfn)   pfn_to_paddr(gfn_x(gfn))
 #define gaddr_to_gfn(ga)    _gfn(paddr_to_pfn(ga))
 #define mfn_to_maddr(mfn)   pfn_to_paddr(mfn_x(mfn))
@@ -253,7 +253,7 @@ static inline void *maddr_to_virt(paddr_t ma)
 #else
 static inline void *maddr_to_virt(paddr_t ma)
 {
-    ASSERT(pfn_to_pdx(ma >> PAGE_SHIFT) < (DIRECTMAP_SIZE >> PAGE_SHIFT));
+    ASSERT(mfn_to_pdx(maddr_to_mfn(ma)) < (DIRECTMAP_SIZE >> PAGE_SHIFT));
     return (void *)(XENHEAP_VIRT_START -
                     mfn_to_maddr(xenheap_mfn_start) +
                     ((ma & ma_va_bottom_mask) |
@@ -301,7 +301,7 @@ static inline struct page_info *virt_to_page(const void *v)
     ASSERT(va < xenheap_virt_end);
 
     pdx = (va - XENHEAP_VIRT_START) >> PAGE_SHIFT;
-    pdx += pfn_to_pdx(mfn_x(xenheap_mfn_start));
+    pdx += mfn_to_pdx(xenheap_mfn_start);
     return frame_table + pdx - frametable_base_pdx;
 }
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-02-18 11:36 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 11:35 [PATCH for-next 0/9] xen/arm: Properly disable M2P on Arm Julien Grall
2019-02-18 11:35 ` Julien Grall [this message]
2019-04-15 21:55   ` [PATCH for-next 1/9] xen/arm: Use mfn_to_pdx instead of pfn_to_pdx when possible Stefano Stabellini
2019-04-15 21:55     ` [Xen-devel] " Stefano Stabellini
2019-04-15 22:03     ` Julien Grall
2019-04-15 22:03       ` [Xen-devel] " Julien Grall
2019-04-15 22:25       ` Stefano Stabellini
2019-04-15 22:25         ` [Xen-devel] " Stefano Stabellini
2019-04-15 22:42         ` Julien Grall
2019-04-15 22:42           ` [Xen-devel] " Julien Grall
2019-04-17 17:07           ` Julien Grall
2019-04-17 17:07             ` [Xen-devel] " Julien Grall
2019-04-25 11:20             ` Jan Beulich
2019-04-25 11:20               ` [Xen-devel] " Jan Beulich
2019-04-29 16:30               ` Julien Grall
2019-04-29 16:30                 ` [Xen-devel] " Julien Grall
2019-02-18 11:35 ` [PATCH for-next 2/9] xen/x86: Constify the parameter "d" in mfn_to_mfn Julien Grall
2019-03-13 14:40   ` Jan Beulich
2019-02-18 11:35 ` [PATCH for-next 3/9] xen/x86: Use mfn_to_gfn rather than mfn_to_gmfn Julien Grall
2019-03-13 14:45   ` Jan Beulich
2019-03-13 15:13     ` Julien Grall
2019-02-18 11:35 ` [PATCH for-next 4/9] xen/grant-table: Make arch specific macros typesafe Julien Grall
2019-03-13 14:51   ` Jan Beulich
2019-04-15 22:03   ` Stefano Stabellini
2019-04-15 22:03     ` [Xen-devel] " Stefano Stabellini
2019-04-15 22:07     ` Julien Grall
2019-04-15 22:07       ` [Xen-devel] " Julien Grall
2019-02-18 11:35 ` [PATCH for-next 5/9] xen: Convert hotplug page function to use typesafe MFN Julien Grall
2019-03-13 14:57   ` Jan Beulich
2019-03-13 16:26     ` Julien Grall
2019-02-18 11:35 ` [PATCH for-next 6/9] xen: Convert is_xen_fixed_mfn " Julien Grall
2019-03-13 14:58   ` Jan Beulich
2019-04-15 22:05   ` Stefano Stabellini
2019-04-15 22:05     ` [Xen-devel] " Stefano Stabellini
2019-02-18 11:35 ` [PATCH for-next 7/9] xen: Convert is_xen_heap_mfn " Julien Grall
2019-03-13 15:04   ` Jan Beulich
2019-03-13 17:24     ` Julien Grall
2019-03-14  7:52       ` Jan Beulich
2019-03-14 10:12         ` Julien Grall
2019-03-14 10:14           ` Andrew Cooper
2019-03-14 10:19             ` Julien Grall
2019-03-14 11:47             ` Jan Beulich
2019-03-14 12:18               ` Andrew Cooper
2019-04-15 22:08   ` Stefano Stabellini
2019-04-15 22:08     ` [Xen-devel] " Stefano Stabellini
2019-02-18 11:35 ` [PATCH for-next 8/9] xen: Introduce HAS_M2P config and use to protect mfn_to_gmfn call Julien Grall
2019-03-13 15:20   ` Jan Beulich
2019-03-13 17:30     ` Julien Grall
2019-03-14  7:55       ` Jan Beulich
2019-04-17 17:42         ` Julien Grall
2019-04-17 17:42           ` [Xen-devel] " Julien Grall
2019-04-18 11:46           ` Wei Liu
2019-04-18 11:46             ` [Xen-devel] " Wei Liu
2019-04-18 15:09             ` Julien Grall
2019-04-18 15:09               ` [Xen-devel] " Julien Grall
2019-04-24 15:28               ` Julien Grall
2019-04-24 15:28                 ` [Xen-devel] " Julien Grall
2019-04-25 10:03               ` Wei Liu
2019-04-25 10:03                 ` [Xen-devel] " Wei Liu
2019-04-15 22:17     ` Stefano Stabellini
2019-04-15 22:17       ` [Xen-devel] " Stefano Stabellini
2019-04-25 10:06       ` Jan Beulich
2019-04-25 10:06         ` [Xen-devel] " Jan Beulich
2019-02-18 11:36 ` [PATCH for-next 9/9] xen: Remove mfn_to_gmfn macro Julien Grall
2019-03-13 15:22   ` Jan Beulich
2019-03-13 15:24     ` Julien Grall
2019-03-13 15:40       ` Jan Beulich
2019-03-13 15:48         ` Julien Grall
2019-03-13 15:59           ` Jan Beulich
2019-03-13 17:34             ` Andrew Cooper
2019-03-13 17:42               ` Julien Grall
2019-03-13 18:41                 ` Andrew Cooper
2019-03-14  8:05                   ` Jan Beulich
2019-03-14  7:59               ` Jan Beulich
2019-05-07 14:35     ` Julien Grall
2019-05-07 14:35       ` [Xen-devel] " Julien Grall
2019-04-15 22:19   ` Stefano Stabellini
2019-04-15 22:19     ` [Xen-devel] " Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190218113600.9540-2-julien.grall@arm.com \
    --to=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.