Skip to contentSkip to conversation

Support for sparse physical address space on ARM

PATCH Superseded Ian Campbell 3 participants 8 messages Sep 12, 2014 – Sep 16, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support for sparse physical address space on ARM

This series refactors the x86 "pdx" stuff (phys address space compression) into common code and makes use of it on ARM.

Since last time I've implemented support for arm32 and fixed a bunch of bug, hence no longer RFC. Since this is needed to run on grub and/or UEFI systems (which tend to have sparser address maps) I'm targeting this at 4.5.

The code is also available from
git://xenbits.xen.org/people/ianc/xen.git pdx-v2

Ian.

#1 lore raw

PATCH v2 1/2 xen: refactor physical address space compression support into common code

The "pdx compression" functionality will be useful on ARM as well.

Move the code to common code+header and introduce HAS_PDX to control when it is built. L2_PAGETABLE_SHIFT is x86 specific, so introduce PDX_GROUP_SHIFT to abstract it out.

ARM has no need for superpage compression (yet?) and lacks SUPERPAGE_SHIFT so those functions (spage_to_mfn et al) are not moved.

No affect on x86 and no change for ARM (yet).

---
v2:
- Correct closing guard comment in pdx.h

---
 xen/Rules.mk                      |    1 +
 xen/arch/x86/Rules.mk             |    1 +
 xen/arch/x86/mm.c                 |    3 --
 xen/arch/x86/setup.c              |   10 ----
 xen/arch/x86/x86_64/mm.c          |   53 --------------------
 xen/common/Makefile               |    1 +
 xen/common/pdx.c                  |   99 +++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/mm.h          |    4 +-
 xen/include/asm-x86/page.h        |    2 -
 xen/include/asm-x86/x86_64/page.h |   25 +---------
 xen/include/xen/pdx.h             |   47 ++++++++++++++++++
 11 files changed, 152 insertions(+), 94 deletions(-)
 create mode 100644 xen/common/pdx.c
 create mode 100644 xen/include/xen/pdx.h
xen/Rules.mk +1 -0
index b49f3c8..e2f9e36 100644
@@ -59,6 +59,7 @@ CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(HAS_DEVICE_TREE) += -DHAS_DEVICE_TREE
 CFLAGS-$(HAS_PCI)       += -DHAS_PCI
 CFLAGS-$(HAS_IOPORTS)   += -DHAS_IOPORTS
+CFLAGS-$(HAS_PDX)       += -DHAS_PDX
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/x86/Rules.mk +1 -0
index 576985e..6775cb5 100644
@@ -12,6 +12,7 @@ HAS_NS16550 := y
 HAS_EHCI := y
 HAS_KEXEC := y
 HAS_GDBSX := y
+HAS_PDX := y
 xenoprof := y
 
 #
xen/arch/x86/mm.c +0 -3
index d23cb3f..5b3f06f 100644
@@ -147,9 +147,6 @@ struct domain *dom_xen, *dom_io, *dom_cow;
 unsigned long max_page;
 unsigned long total_pages;
 
-unsigned long __read_mostly pdx_group_valid[BITS_TO_LONGS(
-    (FRAMETABLE_NR + PDX_GROUP_COUNT - 1) / PDX_GROUP_COUNT)] = { [0] = 1 };
-
 bool_t __read_mostly machine_to_phys_mapping_valid = 0;
 
 struct rangeset *__read_mostly mmio_ro_ranges;
xen/arch/x86/setup.c +0 -10
index 6a814cd..8c8b91f 100644
@@ -392,16 +392,6 @@ static void __init setup_max_pdx(unsigned long top_page)
     max_page = pdx_to_pfn(max_pdx - 1) + 1;
 }
 
-void set_pdx_range(unsigned long smfn, unsigned long emfn)
-{
-    unsigned long idx, eidx;
-
-    idx = pfn_to_pdx(smfn) / PDX_GROUP_COUNT;
-    eidx = (pfn_to_pdx(emfn - 1) + PDX_GROUP_COUNT) / PDX_GROUP_COUNT;
-    for ( ; idx < eidx; ++idx )
-        __set_bit(idx, pdx_group_valid);
-}
-
 /* A temporary copy of the e820 map that we can mess with during bootstrap. */
 static struct e820map __initdata boot_e820;
 
xen/arch/x86/x86_64/mm.c +0 -53

71 lines not on this page · raw message

xen/common/Makefile +1 -0
index 3683ae3..f7d10f0 100644
@@ -51,6 +51,7 @@ obj-y += tmem_xen.o
 obj-y += radix-tree.o
 obj-y += rbtree.o
 obj-y += lzo.o
+obj-$(HAS_PDX) += pdx.o
 
 obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma unlzo unlz4 earlycpio,$(n).init.o)
 
xen/common/pdx.c new file +99 -0

99 lines not on this page · raw message

xen/include/asm-x86/mm.h +1 -3
index 7b85865..746bcf1 100644
@@ -280,9 +280,7 @@ extern unsigned long max_page;
 extern unsigned long total_pages;
 void init_frametable(void);
 
-#define PDX_GROUP_COUNT ((1 << L2_PAGETABLE_SHIFT) / \
-                         (sizeof(*frame_table) & -sizeof(*frame_table)))
-extern unsigned long pdx_group_valid[];
+#define PDX_GROUP_SHIFT L2_PAGETABLE_SHIFT
 
 /* Convert between Xen-heap virtual addresses and page-info structures. */
 static inline struct page_info *__virt_to_page(const void *v)
xen/include/asm-x86/page.h +0 -2
index ccc268d..9aa780e 100644
@@ -334,8 +334,6 @@ void *alloc_xen_pagetable(void);
 void free_xen_pagetable(void *v);
 l1_pgentry_t *virt_to_xen_l1e(unsigned long v);
 
-extern void set_pdx_range(unsigned long smfn, unsigned long emfn);
-
 /* Convert between PAT/PCD/PWT embedded in PTE flags and 3-bit cacheattr. */
 static inline uint32_t pte_flags_to_cacheattr(uint32_t flags)
 {
xen/include/asm-x86/x86_64/page.h +2 -23
index 3eee5b5..1d54587 100644
@@ -35,17 +35,10 @@
 #include <xen/config.h>
 #include <asm/types.h>
 
-extern unsigned long xen_virt_end;
+#include <xen/pdx.h>
 
-extern unsigned long max_pdx;
-extern unsigned long pfn_pdx_bottom_mask, ma_va_bottom_mask;
-extern unsigned int pfn_pdx_hole_shift;
-extern unsigned long pfn_hole_mask;
-extern unsigned long pfn_top_mask, ma_top_mask;
-extern void pfn_pdx_hole_setup(unsigned long);
+extern unsigned long xen_virt_end;
 
-#define page_to_pdx(pg)  ((pg) - frame_table)
-#define pdx_to_page(pdx) (frame_table + (pdx))
 #define spage_to_pdx(spg) (((spg) - spage_table)<<(SUPERPAGE_SHIFT-PAGE_SHIFT))
 #define pdx_to_spage(pdx) (spage_table + ((pdx)>>(SUPERPAGE_SHIFT-PAGE_SHIFT)))
 /*
@@ -57,20 +50,6 @@ extern void pfn_pdx_hole_setup(unsigned long);
 #define pdx_to_virt(pdx) ((void *)(DIRECTMAP_VIRT_START + \
                                    ((unsigned long)(pdx) << PAGE_SHIFT)))
 
-extern int __mfn_valid(unsigned long mfn);
-
-static inline unsigned long pfn_to_pdx(unsigned long pfn)
-{
-    return (pfn & pfn_pdx_bottom_mask) |
-           ((pfn & pfn_top_mask) >> pfn_pdx_hole_shift);
-}
-
-static inline unsigned long pdx_to_pfn(unsigned long pdx)
-{
-    return (pdx & pfn_pdx_bottom_mask) |
-           ((pdx << pfn_pdx_hole_shift) & pfn_top_mask);
-}
-
 static inline unsigned long pfn_to_sdx(unsigned long pfn)
 {
     return pfn_to_pdx(pfn) >> (SUPERPAGE_SHIFT-PAGE_SHIFT);
xen/include/xen/pdx.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH for-4.5 v2 1/2] xen: refactor physical address space compression support into common code

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 12.09.14 at 17:15, <[email protected]> wrote:

The "pdx compression" functionality will be useful on ARM as well.

Move the code to common code+header and introduce HAS_PDX to control when it is
built. L2_PAGETABLE_SHIFT is x86 specific, so introduce PDX_GROUP_SHIFT to abstract it out.

ARM has no need for superpage compression (yet?) and lacks SUPERPAGE_SHIFT so
those functions (spage_to_mfn et al) are not moved.

Quoted 7 lines

No affect on x86 and no change for ARM (yet).

---
v2:
- Correct closing guard comment in pdx.h

Hmm, looking at it ...

xen/include/xen/pdx.h line 4

Quoted 7 lines
xen/include/xen/pdx.h new file +4 -0
@@ -0,0 +1,47 @@
+#ifndef __XEN_PDX_H__
+#define __XEN_PDX_H__
+
+#ifdef HAS_PDX

... is it HAS_PDX ...

xen/include/xen/pdx.h line 37

Quoted 1 line
xen/include/xen/pdx.h new file +1 -0
+#endif /* HAVE_PDX */

... or HAVE_PDX?

Jan

Quoted 10 lines
xen/include/xen/pdx.h new file +10 -0
+#endif /* __XEN_PDX_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
#3 lore raw

Re: [PATCH for-4.5 v2 1/2] xen: refactor physical address space compression support into common code

Quoted 32 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 12.09.14 at 17:15, <[email protected]> wrote:

The "pdx compression" functionality will be useful on ARM as well.

Move the code to common code+header and introduce HAS_PDX to control when it is
built. L2_PAGETABLE_SHIFT is x86 specific, so introduce PDX_GROUP_SHIFT to abstract it out.

ARM has no need for superpage compression (yet?) and lacks SUPERPAGE_SHIFT so
those functions (spage_to_mfn et al) are not moved.

Quoted 7 lines

No affect on x86 and no change for ARM (yet).

---
v2:
- Correct closing guard comment in pdx.h

Hmm, looking at it ...

xen/include/xen/pdx.h line 4

Quoted 7 lines
xen/include/xen/pdx.h new file +4 -0
@@ -0,0 +1,47 @@
+#ifndef __XEN_PDX_H__
+#define __XEN_PDX_H__
+
+#ifdef HAS_PDX

... is it HAS_PDX ...

Quoted 3 lines

xen/include/xen/pdx.h line 37

Quoted 1 line
xen/include/xen/pdx.h new file +1 -0
+#endif /* HAVE_PDX */

... or HAVE_PDX?

HAS_PDX :-(

I've fixed this locally.

Ian.

#4 lore raw

PATCH v2 2/2 xen: arm: Enable physical address space compression (PDX) on arm32

In reply to Ian Campbell

This allows us to support sparse physical address maps which we previously could not because the frametable would end up taking up an enourmous fraction of RAM.

On a fast model which has RAM at 0x80000000-0x100000000 and 0x880000000-0x900000000 this reduces the size of the frametable from 478M to 84M.

---
v2:
- Implement support for arm32 (tested on models).
- Simplify the arm64 stuff a bit
- Fixedsome bugs

---
 xen/arch/arm/Rules.mk        |    1 +
 xen/arch/arm/mm.c            |   18 +++---
 xen/arch/arm/setup.c         |  136 +++++++++++++++++++-----------------------
 xen/include/asm-arm/config.h |   11 +++-
 xen/include/asm-arm/mm.h     |   37 ++++++------
 xen/include/asm-arm/numa.h   |    2 +-
 6 files changed, 101 insertions(+), 104 deletions(-)
xen/arch/arm/Rules.mk +1 -0
index 8658176..26fafa2 100644
@@ -10,6 +10,7 @@ HAS_DEVICE_TREE := y
 HAS_VIDEO := y
 HAS_ARM_HDLCD := y
 HAS_PASSTHROUGH := y
+HAS_PDX := y
 
 CFLAGS += -I$(BASEDIR)/include
 
xen/arch/arm/mm.c +10 -8
index 0a243b0..7a04cc4 100644
@@ -138,7 +138,7 @@ unsigned long xenheap_mfn_start __read_mostly = ~0UL;
 unsigned long xenheap_mfn_end __read_mostly;
 unsigned long xenheap_virt_end __read_mostly;
 
-unsigned long frametable_base_mfn __read_mostly;
+unsigned long frametable_base_pdx __read_mostly;
 unsigned long frametable_virt_end __read_mostly;
 
 unsigned long max_page;
@@ -665,7 +665,7 @@ void __init setup_xenheap_mappings(unsigned long base_mfn,
     /* Align to previous 1GB boundary */
     base_mfn &= ~((FIRST_SIZE>>PAGE_SHIFT)-1);
 
-    offset = base_mfn - xenheap_mfn_start;
+    offset = pfn_to_pdx(base_mfn - xenheap_mfn_start);
     vaddr = DIRECTMAP_VIRT_START + offset*PAGE_SIZE;
 
     while ( base_mfn < end_mfn )
@@ -716,7 +716,8 @@ void __init setup_xenheap_mappings(unsigned long base_mfn,
 void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
 {
     unsigned long nr_pages = (pe - ps) >> PAGE_SHIFT;
-    unsigned long frametable_size = nr_pages * sizeof(struct page_info);
+    unsigned long nr_pdxs = pfn_to_pdx(nr_pages);
+    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
     unsigned long base_mfn;
 #ifdef CONFIG_ARM_64
     lpae_t *second, pte;
@@ -724,7 +725,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
     int i;
 #endif
 
-    frametable_base_mfn = ps >> PAGE_SHIFT;
+    frametable_base_pdx = pfn_to_pdx(ps >> PAGE_SHIFT);
 
     /* Round up to 32M boundary */
     frametable_size = (frametable_size + 0x1ffffff) & ~0x1ffffff;
@@ -745,11 +746,12 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
     create_32mb_mappings(xen_second, FRAMETABLE_VIRT_START, base_mfn, frametable_size >> PAGE_SHIFT);
 #endif
 
-    memset(&frame_table[0], 0, nr_pages * sizeof(struct page_info));
-    memset(&frame_table[nr_pages], -1,
-           frametable_size - (nr_pages * sizeof(struct page_info)));
+    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
+    memset(&frame_table[nr_pdxs], -1,
+           frametable_size - (nr_pdxs * sizeof(struct page_info)));
+
+    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pdxs * sizeof(struct page_info));
 
-    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info));
 }
 
 void *__init arch_vmap_virt_end(void)
xen/arch/arm/setup.c +61 -75

177 lines not on this page · raw message

xen/include/asm-arm/config.h +9 -2
index 1c3abcf..59b2887 100644
@@ -126,7 +126,12 @@
 #define CONFIG_SEPARATE_XENHEAP 1
 
 #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
-#define VMAP_VIRT_START  _AT(vaddr_t,0x10000000)
+#define FRAMETABLE_SIZE        MB(128-32)
+#define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
+#define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + FRAMETABLE_SIZE - 1)
+
+#define VMAP_VIRT_START        _AT(vaddr_t,0x10000000)
+
 #define XENHEAP_VIRT_START     _AT(vaddr_t,0x40000000)
 #define XENHEAP_VIRT_END       _AT(vaddr_t,0x7fffffff)
 #define DOMHEAP_VIRT_START     _AT(vaddr_t,0x80000000)
@@ -149,7 +154,9 @@
 #define VMAP_VIRT_END    (VMAP_VIRT_START + GB(1) - 1)
 
 #define FRAMETABLE_VIRT_START  GB(32)
-#define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + GB(32) - 1)
+#define FRAMETABLE_SIZE        GB(32)
+#define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
+#define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + FRAMETABLE_SIZE - 1)
 
 #define DIRECTMAP_VIRT_START   SLOT0(256)
 #define DIRECTMAP_SIZE         (SLOT0_ENTRY_SIZE * (265-256))
xen/include/asm-arm/mm.h +19 -18
index 9fa80a4..120500f 100644
@@ -6,6 +6,7 @@
 #include <asm/page.h>
 #include <public/xen.h>
 #include <xen/domain_page.h>
+#include <xen/pdx.h>
 
 /* Align Xen to a 2 MiB boundary. */
 #define XEN_PADDR_ALIGN (1 << 21)
@@ -140,12 +141,14 @@ extern void share_xen_page_with_privileged_guests(
     struct page_info *page, int readonly);
 
 #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
-/* MFN of the first page in the frame table. */
-extern unsigned long frametable_base_mfn;
+/* PDX of the first page in the frame table. */
+extern unsigned long frametable_base_pdx;
 
 extern unsigned long max_page;
 extern unsigned long total_pages;
 
+#define PDX_GROUP_SHIFT SECOND_SHIFT
+
 /* Boot-time pagetable setup */
 extern void setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr);
 /* Remove early mappings */
@@ -184,20 +187,15 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)
     return ioremap_attr(start, len, PAGE_HYPERVISOR_WC);
 }
 
+/* XXX -- account for base */
 #define mfn_valid(mfn)        ({                                              \
     unsigned long __m_f_n = (mfn);                                            \
-    likely(__m_f_n >= frametable_base_mfn && __m_f_n < max_page);             \
+    likely(pfn_to_pdx(__m_f_n) >= frametable_base_pdx && __mfn_valid(__m_f_n)); \
 })
 
-#define max_pdx                 max_page
-#define pfn_to_pdx(pfn)         (pfn)
-#define pdx_to_pfn(pdx)         (pdx)
-#define virt_to_pdx(va)         virt_to_mfn(va)
-#define pdx_to_virt(pdx)        mfn_to_virt(pdx)
-
 /* Convert between machine frame numbers and page-info structures. */
-#define mfn_to_page(mfn)  (frame_table + (pfn_to_pdx(mfn) - frametable_base_mfn))
-#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_mfn)
+#define mfn_to_page(mfn)  (frame_table + (pfn_to_pdx(mfn) - frametable_base_pdx))
+#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx)
 #define __page_to_mfn(pg)  page_to_mfn(pg)
 #define __mfn_to_page(mfn) mfn_to_page(mfn)
 
@@ -230,9 +228,11 @@ static inline void *maddr_to_virt(paddr_t ma)
 #else
 static inline void *maddr_to_virt(paddr_t ma)
 {
-    ASSERT((ma >> PAGE_SHIFT) < (DIRECTMAP_SIZE >> PAGE_SHIFT));
-    ma -= pfn_to_paddr(xenheap_mfn_start);
-    return (void *)(unsigned long) ma + DIRECTMAP_VIRT_START;
+    ASSERT(pfn_to_pdx(ma >> PAGE_SHIFT) < (DIRECTMAP_SIZE >> PAGE_SHIFT));
+    return (void *)(DIRECTMAP_VIRT_START -
+                    pfn_to_paddr(xenheap_mfn_start) +
+                    ((ma & ma_va_bottom_mask) |
+                     ((ma & ma_top_mask) >> pfn_pdx_hole_shift)));
 }
 #endif
 
@@ -258,13 +258,14 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags)
 static inline struct page_info *virt_to_page(const void *v)
 {
     unsigned long va = (unsigned long)v;
+    unsigned long pdx;
+
     ASSERT(va >= XENHEAP_VIRT_START);
     ASSERT(va < xenheap_virt_end);
 
-    return frame_table
-        + ((va - XENHEAP_VIRT_START) >> PAGE_SHIFT)
-        + xenheap_mfn_start
-        - frametable_base_mfn;
+    pdx = (va - XENHEAP_VIRT_START) >> PAGE_SHIFT;
+    pdx += pfn_to_pdx(xenheap_mfn_start);
+    return frame_table + pdx - frametable_base_pdx;
 }
 
 static inline void *page_to_virt(const struct page_info *pg)
xen/include/asm-arm/numa.h +1 -1
index 2c019d7..06a9d5a 100644
@@ -12,7 +12,7 @@ static inline __attribute__((pure)) int phys_to_nid(paddr_t addr)
 
 /* XXX: implement NUMA support */
 #define node_spanned_pages(nid) (total_pages)
-#define node_start_pfn(nid) (frametable_base_mfn)
+#define node_start_pfn(nid) (pdx_to_pfn(frametable_base_pdx))
 #define __node_distance(a, b) (20)
 
 #endif /* __ARCH_ARM_NUMA_H */
Signature · 1 line
1.7.10.4
#5 lore raw

Re: [PATCH for-4.5 v2 2/2] xen: arm: Enable physical address space compression (PDX) on arm32

Hi Ian,

Don't you implement PDX for both arm32 and arm64? If so, you may need to update the commit title.

The patch looks good to me. I have only few comments on it.

Quoted 2 lines · Ian Campbell

This allows us to support sparse physical address maps which we previously could not because the frametable would end up taking up an enourmous fraction

enormous

[..]

xen/arch/arm/mm.c void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) · line 753

Quoted 9 lines
xen/arch/arm/mm.c +5 -3
-    memset(&frame_table[0], 0, nr_pages * sizeof(struct page_info));
-    memset(&frame_table[nr_pages], -1,
-           frametable_size - (nr_pages * sizeof(struct page_info)));
+    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
+    memset(&frame_table[nr_pdxs], -1,
+           frametable_size - (nr_pdxs * sizeof(struct page_info)));
+
+    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pdxs * sizeof(struct page_info));

NIT: I don't think it's necessary to have a blank line before the end of the block. I would drop it.

[..]

xen/arch/arm/setup.c static paddr_t __init get_xen_paddr(void) · line 432

Quoted 7 lines
xen/arch/arm/setup.c +7 -0
+/* Sets all bits from the most-significant 1-bit down to the LSB */
+static u64 __init fill_mask(u64 mask)
+{
+    while (mask & (mask + 1))
+        mask |= mask + 1;
+    return mask;
+}

The function is the same on x86. Shall we create an helper?

[..]

Quoted 1 line
          setup_xenheap_mappings(bank_start>>PAGE_SHIFT, bank_size>>PAGE_SHIFT);

You forgot to drop check if ( bank != bootinfo.mem.nr_banks ) which, I think, is not relevant anymore.

xen/include/asm-arm/config.h line 129

Quoted 10 lines
xen/include/asm-arm/config.h +1 -1
index 1c3abcf..59b2887 100644
@@ -126,7 +126,12 @@
  #define CONFIG_SEPARATE_XENHEAP 1
 
  #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
-#define VMAP_VIRT_START  _AT(vaddr_t,0x10000000)
+#define FRAMETABLE_SIZE        MB(128-32)

I would add a comment about why the frametable size is "MB(128-32)".

Regards,

Signature · 1 line
Julien Grall
#6 lore raw

Re: [PATCH for-4.5 v2 2/2] xen: arm: Enable physical address space compression (PDX) on arm32

Quoted 9 lines · Julien Grall

xen/arch/arm/setup.c static paddr_t __init get_xen_paddr(void) · line 432

Quoted 7 lines
xen/arch/arm/setup.c +7 -0
+/* Sets all bits from the most-significant 1-bit down to the LSB */
+static u64 __init fill_mask(u64 mask)
+{
+    while (mask & (mask + 1))
+        mask |= mask + 1;
+    return mask;
+}

The function is the same on x86. Shall we create an helper?

I'll see what I can do.

Quoted 7 lines
Quoted 7 lines
xen/include/asm-arm/config.h +0 -0
index 1c3abcf..59b2887 100644
@@ -126,7 +126,12 @@
  #define CONFIG_SEPARATE_XENHEAP 1
 
Quoted 5 lines

xen/include/asm-arm/config.h line 129

Quoted 3 lines
xen/include/asm-arm/config.h +1 -1
  #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
-#define VMAP_VIRT_START  _AT(vaddr_t,0x10000000)
+#define FRAMETABLE_SIZE        MB(128-32)

I would add a comment about why the frametable size is "MB(128-32)".

There is a big comment just above here which gives an overview of the virtual address space layout. I don't think it needs repeating here.

Ian.

#7 lore raw

Re: [PATCH for-4.5 v2 2/2] xen: arm: Enable physical address space compression (PDX) on arm32

Hi Ian,

Quoted 8 lines · Ian Campbell
Quoted 7 lines · Julien Grall
Quoted 7 lines
xen/include/asm-arm/config.h +0 -0
index 1c3abcf..59b2887 100644
@@ -126,7 +126,12 @@
   #define CONFIG_SEPARATE_XENHEAP 1
 
Quoted 8 lines
Quoted 5 lines

xen/include/asm-arm/config.h line 129

Quoted 3 lines
xen/include/asm-arm/config.h +1 -1
   #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
-#define VMAP_VIRT_START  _AT(vaddr_t,0x10000000)
+#define FRAMETABLE_SIZE        MB(128-32)

I would add a comment about why the frametable size is "MB(128-32)".

There is a big comment just above here which gives an overview of the virtual address space layout. I don't think it needs repeating here.

Hmm right. I haven't look at include/asm-arm/config.h, sorry.

Regards,

Signature · 1 line
Julien Grall