* [PATCH v3 0/9] xen/arm: Memory subsystem clean-up
@ 2017-10-02 17:31 Julien Grall
2017-10-02 17:31 ` [PATCH v3 1/9] xen/arm: page: Use ARMv8 naming to improve readability Julien Grall
` (8 more replies)
0 siblings, 9 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
Hi all,
This patch series contains clean-up for the ARM memory subsystem in preparation
of reworking the page tables handling.
For all changes, see in each patch.
Cheers,
Julien Grall (9):
xen/arm: page: Use ARMv8 naming to improve readability
xen/arm: page: Clean-up the definition of MAIRVAL
xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table
xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator()
xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries
xen/arm: page: Describe the layout of flags used to update page tables
xen/arm: mm: Embed permission in the flags
xen/arm: mm: Handle permission flags when adding a new mapping
xen/arm: mm: Use memory flags for modify_xen_mappings rather than
custom one
xen/arch/arm/kernel.c | 2 +-
xen/arch/arm/livepatch.c | 6 +--
xen/arch/arm/mm.c | 50 +++++++++++-----------
xen/arch/arm/platforms/vexpress.c | 2 +-
xen/arch/arm/setup.c | 8 +++-
xen/drivers/video/arm_hdlcd.c | 2 +-
xen/include/asm-arm/lpae.h | 2 +-
xen/include/asm-arm/page.h | 88 +++++++++++++++++++++++++--------------
8 files changed, 96 insertions(+), 64 deletions(-)
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 1/9] xen/arm: page: Use ARMv8 naming to improve readability
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 2/9] xen/arm: page: Clean-up the definition of MAIRVAL Julien Grall
` (7 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
This is based on the Linux ARMv8 naming scheme (see arch/arm64/mm/proc.S). Each
type will contain "NORMAL" or "DEVICE" to make clear whether each attribute
targets device or normal memory.
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
Changes in v3:
- The ai '000' is named MT_DEVICE_nGnRnE and not
MT_DEVICE_nGnRE. The definition is still valid.
- Expand the comment to point to "Device Memory" section in the
ARM ARM.
Changes in v2:
* Move the patch before "xen/arm: page: Clean-up the definition
of MAIRVAL"
---
xen/arch/arm/kernel.c | 2 +-
xen/arch/arm/mm.c | 28 ++++++++++++++--------------
xen/arch/arm/platforms/vexpress.c | 2 +-
xen/drivers/video/arm_hdlcd.c | 2 +-
xen/include/asm-arm/page.h | 35 +++++++++++++++++++----------------
5 files changed, 36 insertions(+), 33 deletions(-)
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 9c183f96da..a12baa86e7 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_BUFFERABLE);
+ set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_NORMAL_NC);
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 9a37f29ce6..f41c6ce6f1 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -290,7 +290,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr)
switch ( attr )
{
- case MT_BUFFERABLE:
+ case MT_NORMAL_NC:
/*
* ARM ARM: Overlaying the shareability attribute (DDI
* 0406C.b B3-1376 to 1377)
@@ -305,8 +305,8 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr)
*/
e.pt.sh = LPAE_SH_OUTER;
break;
- case MT_UNCACHED:
- case MT_DEV_SHARED:
+ case MT_DEVICE_nGnRnE:
+ case MT_DEVICE_nGnRE:
/*
* Shareability is ignored for non-Normal memory, Outer is as
* good as anything.
@@ -369,7 +369,7 @@ static void __init create_mappings(lpae_t *second,
count = nr_mfns / LPAE_ENTRIES;
p = second + second_linear_offset(virt_offset);
- pte = mfn_to_xen_entry(_mfn(base_mfn), MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(_mfn(base_mfn), MT_NORMAL);
if ( granularity == 16 * LPAE_ENTRIES )
pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */
for ( i = 0; i < count; i++ )
@@ -422,7 +422,7 @@ void *map_domain_page(mfn_t mfn)
else if ( map[slot].pt.avail == 0 )
{
/* Commandeer this 2MB slot */
- pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL);
pte.pt.avail = 1;
write_pte(map + slot, pte);
break;
@@ -543,7 +543,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va)
{
paddr_t ma = va + phys_offset;
- return mfn_to_xen_entry(maddr_to_mfn(ma), MT_WRITEALLOC);
+ return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL);
}
/* Map the FDT in the early boot page table */
@@ -652,7 +652,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
/* Initialise xen second level entries ... */
/* ... Xen's text etc */
- pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_NORMAL);
pte.pt.xn = 0;/* Contains our text mapping! */
xen_second[second_table_offset(XEN_VIRT_START)] = pte;
@@ -669,7 +669,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
/* ... Boot Misc area for xen relocation */
dest_va = BOOT_RELOC_VIRT_START;
- pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_NORMAL);
/* Map the destination in xen_second. */
xen_second[second_table_offset(dest_va)] = pte;
/* Map the destination in boot_second. */
@@ -700,7 +700,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT);
if ( !is_kernel(va) )
break;
- pte = mfn_to_xen_entry(mfn, MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(mfn, MT_NORMAL);
pte.pt.table = 1; /* 4k mappings always have this bit set */
if ( is_kernel_text(va) || is_kernel_inittext(va) )
{
@@ -771,7 +771,7 @@ int init_secondary_pagetables(int cpu)
for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
{
pte = mfn_to_xen_entry(virt_to_mfn(domheap+i*LPAE_ENTRIES),
- MT_WRITEALLOC);
+ MT_NORMAL);
pte.pt.table = 1;
write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte);
}
@@ -869,13 +869,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn,
mfn_t first_mfn = alloc_boot_pages(1, 1);
clear_page(mfn_to_virt(first_mfn));
- pte = mfn_to_xen_entry(first_mfn, MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(first_mfn, MT_NORMAL);
pte.pt.table = 1;
write_pte(p, pte);
first = mfn_to_virt(first_mfn);
}
- pte = mfn_to_xen_entry(_mfn(mfn), MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(_mfn(mfn), MT_NORMAL);
/* TODO: Set pte.pt.contig when appropriate. */
write_pte(&first[first_table_offset(vaddr)], pte);
@@ -915,7 +915,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
for ( i = 0; i < nr_second; i++ )
{
clear_page(mfn_to_virt(mfn_add(second_base, i)));
- pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_NORMAL);
pte.pt.table = 1;
write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte);
}
@@ -969,7 +969,7 @@ static int create_xen_table(lpae_t *entry)
if ( p == NULL )
return -ENOMEM;
clear_page(p);
- pte = mfn_to_xen_entry(virt_to_mfn(p), MT_WRITEALLOC);
+ pte = mfn_to_xen_entry(virt_to_mfn(p), MT_NORMAL);
pte.pt.table = 1;
write_pte(entry, pte);
return 0;
diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c
index 9badbc079d..df2c4b5bec 100644
--- a/xen/arch/arm/platforms/vexpress.c
+++ b/xen/arch/arm/platforms/vexpress.c
@@ -65,7 +65,7 @@ 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_DEV_SHARED);
+ set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEVICE_nGnRE);
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 5fa7f518b1..1175399dbc 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_DEV_SHARED);
+ set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEVICE_nGnRE);
HDLCD[HDLCD_COMMAND] = 0;
HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel;
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 30fcfa0778..3d0bc6db81 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -25,15 +25,18 @@
* LPAE Memory region attributes. Indexed by the AttrIndex bits of a
* LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1.
*
+ * See section "Device memory" B2.7.2 in ARM DDI 0487B.a for more
+ * details about the meaning of *G*R*E.
+ *
* ai encoding
- * MT_UNCACHED 000 0000 0000 -- Strongly Ordered
- * MT_BUFFERABLE 001 0100 0100 -- Non-Cacheable
- * MT_WRITETHROUGH 010 1010 1010 -- Write-through
- * MT_WRITEBACK 011 1110 1110 -- Write-back
- * MT_DEV_SHARED 100 0000 0100 -- Device
+ * MT_DEVICE_nGnRnE 000 0000 0000 -- Strongly Ordered/Device nGnRnE
+ * MT_NORMAL_NC 001 0100 0100 -- Non-Cacheable
+ * MT_NORMAL_WT 010 1010 1010 -- Write-through
+ * MT_NORMAL_WB 011 1110 1110 -- Write-back
+ * MT_DEVICE_nGnRE 100 0000 0100 -- Device nGnRE
* ?? 101
* reserved 110
- * MT_WRITEALLOC 111 1111 1111 -- Write-back write-allocate
+ * MT_NORMAL 111 1111 1111 -- Write-back write-allocate
*/
#define MAIR0VAL 0xeeaa4400
#define MAIR1VAL 0xff000004
@@ -47,16 +50,16 @@
* registers, as defined above.
*
*/
-#define MT_UNCACHED 0x0
-#define MT_BUFFERABLE 0x1
-#define MT_WRITETHROUGH 0x2
-#define MT_WRITEBACK 0x3
-#define MT_DEV_SHARED 0x4
-#define MT_WRITEALLOC 0x7
-
-#define PAGE_HYPERVISOR (MT_WRITEALLOC)
-#define PAGE_HYPERVISOR_NOCACHE (MT_DEV_SHARED)
-#define PAGE_HYPERVISOR_WC (MT_BUFFERABLE)
+#define MT_DEVICE_nGnRnE 0x0
+#define MT_NORMAL_NC 0x1
+#define MT_NORMAL_WT 0x2
+#define MT_NORMAL_WB 0x3
+#define MT_DEVICE_nGnRE 0x4
+#define MT_NORMAL 0x7
+
+#define PAGE_HYPERVISOR (MT_NORMAL)
+#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE)
+#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC)
/*
* Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 2/9] xen/arm: page: Clean-up the definition of MAIRVAL
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
2017-10-02 17:31 ` [PATCH v3 1/9] xen/arm: page: Use ARMv8 naming to improve readability Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 3/9] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table Julien Grall
` (6 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
Currently MAIRVAL is defined in term of MAIR0VAL and MAIR1VAL which are
both hardcoded value. This makes quite difficult to understand the value
written in both registers.
Rework the definition by using value of each attribute shifted by their
associated index.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v3:
- s/above/below/ in the comment
- Add Stefano's reviewed-by
Changes in v2:
- Move this patch after "xen/arm: page: Use ARMv8 naming to
improve readability"
---
xen/include/asm-arm/page.h | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 3d0bc6db81..0ae1a2587b 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -22,6 +22,21 @@
#define LPAE_SH_INNER 0x3
/*
+ * Attribute Indexes.
+ *
+ * These are valid in the AttrIndx[2:0] field of an LPAE stage 1 page
+ * table entry. They are indexes into the bytes of the MAIR*
+ * registers, as defined below.
+ *
+ */
+#define MT_DEVICE_nGnRnE 0x0
+#define MT_NORMAL_NC 0x1
+#define MT_NORMAL_WT 0x2
+#define MT_NORMAL_WB 0x3
+#define MT_DEVICE_nGnRE 0x4
+#define MT_NORMAL 0x7
+
+/*
* LPAE Memory region attributes. Indexed by the AttrIndex bits of a
* LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1.
*
@@ -38,24 +53,17 @@
* reserved 110
* MT_NORMAL 111 1111 1111 -- Write-back write-allocate
*/
-#define MAIR0VAL 0xeeaa4400
-#define MAIR1VAL 0xff000004
-#define MAIRVAL (MAIR0VAL|MAIR1VAL<<32)
+#define MAIR(attr, mt) (_AC(attr, ULL) << ((mt) * 8))
-/*
- * Attribute Indexes.
- *
- * These are valid in the AttrIndx[2:0] field of an LPAE stage 1 page
- * table entry. They are indexes into the bytes of the MAIR*
- * registers, as defined above.
- *
- */
-#define MT_DEVICE_nGnRnE 0x0
-#define MT_NORMAL_NC 0x1
-#define MT_NORMAL_WT 0x2
-#define MT_NORMAL_WB 0x3
-#define MT_DEVICE_nGnRE 0x4
-#define MT_NORMAL 0x7
+#define MAIRVAL (MAIR(0x00, MT_DEVICE_nGnRnE)| \
+ MAIR(0x44, MT_NORMAL_NC) | \
+ MAIR(0xaa, MT_NORMAL_WT) | \
+ MAIR(0xee, MT_NORMAL_WB) | \
+ MAIR(0x04, MT_DEVICE_nGnRE) | \
+ MAIR(0xff, MT_NORMAL))
+
+#define MAIR0VAL (MAIRVAL & 0xffffffff)
+#define MAIR1VAL (MAIRVAL >> 32)
#define PAGE_HYPERVISOR (MT_NORMAL)
#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE)
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 3/9] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
2017-10-02 17:31 ` [PATCH v3 1/9] xen/arm: page: Use ARMv8 naming to improve readability Julien Grall
2017-10-02 17:31 ` [PATCH v3 2/9] xen/arm: page: Clean-up the definition of MAIRVAL Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 4/9] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator() Julien Grall
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
The description of AP[1] in Xen is based on testing rather than the ARM
ARM.
Per the ARM ARM, on EL2 stage-1 page table, AP[1] is RES1 as the
translation regime applies to only one exception level (see D4.4.4 and
G4.6.1 in ARM DDI 0487B.a).
Update the comment and also rename the field to match the description in
the ARM ARM.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v3:
- Add Stefano's acked-by
Changes in v2:
- Add Andre's reviewed-by
---
xen/arch/arm/mm.c | 10 +++++-----
xen/include/asm-arm/lpae.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index f41c6ce6f1..73677902d4 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -273,7 +273,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr)
.table = 0, /* Set to 1 for links and 4k maps */
.ai = attr,
.ns = 1, /* Hyp mode is in the non-secure world */
- .user = 1, /* See below */
+ .up = 1, /* See below */
.ro = 0, /* Assume read-write */
.af = 1, /* No need for access tracking */
.ng = 1, /* Makes TLB flushes easier */
@@ -282,10 +282,10 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr)
.avail = 0, /* Reference count for domheap mapping */
}};
/*
- * Setting the User bit is strange, but the ATS1H[RW] instructions
- * don't seem to work otherwise, and since we never run on Xen
- * pagetables in User mode it's OK. If this changes, remember
- * to update the hard-coded values in head.S too.
+ * For EL2 stage-1 page table, up (aka AP[1]) is RES1 as the translation
+ * regime applies to only one exception level (see D4.4.4 and G4.6.1
+ * in ARM DDI 0487B.a). If this changes, remember to update the
+ * hard-coded values in head.S too.
*/
switch ( attr )
diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h
index 118ee5ae1a..b30853e79d 100644
--- a/xen/include/asm-arm/lpae.h
+++ b/xen/include/asm-arm/lpae.h
@@ -35,7 +35,7 @@ typedef struct __packed {
*/
unsigned long ai:3; /* Attribute Index */
unsigned long ns:1; /* Not-Secure */
- unsigned long user:1; /* User-visible */
+ unsigned long up:1; /* Unpriviledged access */
unsigned long ro:1; /* Read-Only */
unsigned long sh:2; /* Shareability */
unsigned long af:1; /* Access Flag */
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 4/9] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator()
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
` (2 preceding siblings ...)
2017-10-02 17:31 ` [PATCH v3 3/9] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 5/9] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries Julien Grall
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
We should consider the early boot period to end when we stop using the
boot allocator. This is inline with x86 and will be helpful to know
whether we should allocate memory from the boot allocator or xenheap.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v3:
- Add Stefano's reviewed-by
Changes in v2:
- Add Andre's reviewed-by
---
xen/arch/arm/setup.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 3df451ae6f..16a3b1be8e 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -757,6 +757,12 @@ void __init start_xen(unsigned long boot_phys_offset,
end_boot_allocator();
+ /*
+ * The memory subsystem has been initialized, we can now switch from
+ * early_boot -> boot.
+ */
+ system_state = SYS_STATE_boot;
+
vm_init();
if ( acpi_disabled )
@@ -779,8 +785,6 @@ void __init start_xen(unsigned long boot_phys_offset,
console_init_preirq();
console_init_ring();
- system_state = SYS_STATE_boot;
-
processor_id();
smp_init_cpus();
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 5/9] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
` (3 preceding siblings ...)
2017-10-02 17:31 ` [PATCH v3 4/9] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator() Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 6/9] xen/arm: page: Describe the layout of flags used to update page tables Julien Grall
` (3 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
The parameter 'ai' is used either for attribute index or for
permissions. Follow-up patch will rework that parameters to carry more
information. So rename the parameter to 'flags'.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v3:
- Add Stefano's reviewed-by
Changes in v2:
- Add Andre's reviewed-by
---
xen/arch/arm/mm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 73677902d4..39bade63f5 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -986,7 +986,7 @@ static int create_xen_entries(enum xenmap_operation op,
unsigned long virt,
mfn_t mfn,
unsigned long nr_mfns,
- unsigned int ai)
+ unsigned int flags)
{
int rc;
unsigned long addr = virt, addr_end = addr + nr_mfns * PAGE_SIZE;
@@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op,
}
if ( op == RESERVE )
break;
- pte = mfn_to_xen_entry(mfn, ai);
+ pte = mfn_to_xen_entry(mfn, flags);
pte.pt.table = 1;
write_pte(entry, pte);
break;
@@ -1038,8 +1038,8 @@ static int create_xen_entries(enum xenmap_operation op,
else
{
pte = *entry;
- pte.pt.ro = PTE_RO_MASK(ai);
- pte.pt.xn = PTE_NX_MASK(ai);
+ pte.pt.ro = PTE_RO_MASK(flags);
+ pte.pt.xn = PTE_NX_MASK(flags);
if ( !pte.pt.ro && !pte.pt.xn )
{
printk("%s: Incorrect combination for addr=%lx\n",
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 6/9] xen/arm: page: Describe the layout of flags used to update page tables
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
` (4 preceding siblings ...)
2017-10-02 17:31 ` [PATCH v3 5/9] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 7/9] xen/arm: mm: Embed permission in the flags Julien Grall
` (2 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
Currently, the flags used to update page tables (i.e PAGE_HYPERVISOR_*)
only contains the memory attribute index. Follow-up patches will add
more information in it. So document the current layout.
At the same time introduce PAGE_AI_MASK to get the memory attribute
index easily.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v3:
- Add Stefano's reviewed-by
Changes in v2:
- Slightly update the commit message to specify we describe the
current layout.
- Add Andre's reviewed-by
---
xen/arch/arm/mm.c | 2 +-
xen/include/asm-arm/page.h | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 39bade63f5..117f05a1d6 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op,
}
if ( op == RESERVE )
break;
- pte = mfn_to_xen_entry(mfn, flags);
+ pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags));
pte.pt.table = 1;
write_pte(entry, pte);
break;
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 0ae1a2587b..aa3e83f5b4 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -65,6 +65,13 @@
#define MAIR0VAL (MAIRVAL & 0xffffffff)
#define MAIR1VAL (MAIRVAL >> 32)
+/*
+ * Layout of the flags used for updating the hypervisor page tables
+ *
+ * [0:2] Memory Attribute Index
+ */
+#define PAGE_AI_MASK(x) ((x) & 0x7U)
+
#define PAGE_HYPERVISOR (MT_NORMAL)
#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE)
#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC)
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 7/9] xen/arm: mm: Embed permission in the flags
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
` (5 preceding siblings ...)
2017-10-02 17:31 ` [PATCH v3 6/9] xen/arm: page: Describe the layout of flags used to update page tables Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-09 12:34 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 8/9] xen/arm: mm: Handle permission flags when adding a new mapping Julien Grall
2017-10-02 17:31 ` [PATCH v3 9/9] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one Julien Grall
8 siblings, 1 reply; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
Currently, it is not possible to specify the permission of a new
mapping. It would be necessary to use the function modify_xen_mappings
with a different set of flags.
Introduce a couple of new flags for the permissions (Non-eXecutable,
Read-Only) and also provides definition that combine the memory attribute
and permission for common combinations.
PAGE_HYPERVISOR is now an alias to PAGE_HYPERVISOR_RW (read-write,
non-executable mappings). This does not affect the current mapping using
PAGE_HYPERVISOR because Xen is currently forcing all the mapping to be
non-executable by default (see mfn_to_xen_entry).
A follow-up patch will change modify_xen_mappings to use the new flags.
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
Changes in v3:
- Add a comment about _PAGE_DEVICE and _PAGE_NORMAL
Changes in v2:
- Update the commit message
---
xen/include/asm-arm/page.h | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index aa3e83f5b4..e2b3e402d0 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -69,12 +69,31 @@
* Layout of the flags used for updating the hypervisor page tables
*
* [0:2] Memory Attribute Index
+ * [3:4] Permission flags
*/
#define PAGE_AI_MASK(x) ((x) & 0x7U)
-#define PAGE_HYPERVISOR (MT_NORMAL)
-#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE)
-#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC)
+#define _PAGE_XN_BIT 3
+#define _PAGE_RO_BIT 4
+#define _PAGE_XN (1U << _PAGE_XN_BIT)
+#define _PAGE_RO (1U << _PAGE_RO_BIT)
+#define PAGE_XN_MASK(x) (((x) >> _PAGE_XN_BIT) & 0x1U)
+#define PAGE_RO_MASK(x) (((x) >> _PAGE_RO_BIT) & 0x1U)
+
+/*
+ * _PAGE_DEVICE and _PAGE_NORMAL are conveniences defines. They are not
+ * meant to be used outside of the headers.
+ */
+#define _PAGE_DEVICE _PAGE_XN
+#define _PAGE_NORMAL MT_NORMAL
+
+#define PAGE_HYPERVISOR_RO (_PAGE_NORMAL|_PAGE_RO|_PAGE_XN)
+#define PAGE_HYPERVISOR_RX (_PAGE_NORMAL|_PAGE_RO)
+#define PAGE_HYPERVISOR_RW (_PAGE_NORMAL|_PAGE_XN)
+
+#define PAGE_HYPERVISOR PAGE_HYPERVISOR_RW
+#define PAGE_HYPERVISOR_NOCACHE (_PAGE_DEVICE|MT_DEVICE_nGnRE)
+#define PAGE_HYPERVISOR_WC (_PAGE_DEVICE|MT_NORMAL_NC)
/*
* Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 8/9] xen/arm: mm: Handle permission flags when adding a new mapping
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
` (6 preceding siblings ...)
2017-10-02 17:31 ` [PATCH v3 7/9] xen/arm: mm: Embed permission in the flags Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 9/9] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one Julien Grall
8 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, Julien Grall, sstabellini
Currently, all the new mappings will be read-write non-executable. Allow the
caller to use other permissions.
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
Changes in v2:
- Switch the runtime check to a BUG_ON()
---
xen/arch/arm/mm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 117f05a1d6..57afedf0be 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1022,6 +1022,9 @@ static int create_xen_entries(enum xenmap_operation op,
if ( op == RESERVE )
break;
pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags));
+ pte.pt.ro = PAGE_RO_MASK(flags);
+ pte.pt.xn = PAGE_XN_MASK(flags);
+ BUG_ON(!pte.pt.ro && !pte.pt.xn);
pte.pt.table = 1;
write_pte(entry, pte);
break;
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 9/9] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
` (7 preceding siblings ...)
2017-10-02 17:31 ` [PATCH v3 8/9] xen/arm: mm: Handle permission flags when adding a new mapping Julien Grall
@ 2017-10-02 17:31 ` Julien Grall
2017-10-02 18:14 ` Konrad Rzeszutek Wilk
8 siblings, 1 reply; 12+ messages in thread
From: Julien Grall @ 2017-10-02 17:31 UTC (permalink / raw)
To: xen-devel
Cc: andre.przywara, Julien Grall, sstabellini, Ross Lagerwall,
Konrad Rzeszutek Wilk
This will help to consolidate the page-table code and avoid different
path depending on the action to perform.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
arch_livepatch_secure is now the same as on x86. It might be
possible to combine both, but I left that alone for now.
Changes in v3:
- Add Stefano's reviewed-by
Changes in v2:
- Add Andre's reviewed-by
---
xen/arch/arm/livepatch.c | 6 +++---
xen/arch/arm/mm.c | 5 ++---
xen/include/asm-arm/page.h | 11 -----------
3 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index 3e53524365..279d52cc6c 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -146,15 +146,15 @@ int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type type)
switch ( type )
{
case LIVEPATCH_VA_RX:
- flags = PTE_RO; /* R set, NX clear */
+ flags = PAGE_HYPERVISOR_RX;
break;
case LIVEPATCH_VA_RW:
- flags = PTE_NX; /* R clear, NX set */
+ flags = PAGE_HYPERVISOR_RW;
break;
case LIVEPATCH_VA_RO:
- flags = PTE_NX | PTE_RO; /* R set, NX set */
+ flags = PAGE_HYPERVISOR_RO;
break;
default:
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 57afedf0be..705bdd9cce 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1041,8 +1041,8 @@ static int create_xen_entries(enum xenmap_operation op,
else
{
pte = *entry;
- pte.pt.ro = PTE_RO_MASK(flags);
- pte.pt.xn = PTE_NX_MASK(flags);
+ pte.pt.ro = PAGE_RO_MASK(flags);
+ pte.pt.xn = PAGE_XN_MASK(flags);
if ( !pte.pt.ro && !pte.pt.xn )
{
printk("%s: Incorrect combination for addr=%lx\n",
@@ -1085,7 +1085,6 @@ int destroy_xen_mappings(unsigned long v, unsigned long e)
int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags)
{
- ASSERT((flags & (PTE_NX | PTE_RO)) == flags);
return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT,
flags);
}
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index e2b3e402d0..e4be83a7bc 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -96,17 +96,6 @@
#define PAGE_HYPERVISOR_WC (_PAGE_DEVICE|MT_NORMAL_NC)
/*
- * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be
- * used with modify_xen_mappings.
- */
-#define _PTE_NX_BIT 0U
-#define _PTE_RO_BIT 1U
-#define PTE_NX (1U << _PTE_NX_BIT)
-#define PTE_RO (1U << _PTE_RO_BIT)
-#define PTE_NX_MASK(x) (((x) >> _PTE_NX_BIT) & 0x1U)
-#define PTE_RO_MASK(x) (((x) >> _PTE_RO_BIT) & 0x1U)
-
-/*
* Stage 2 Memory Type.
*
* These are valid in the MemAttr[3:0] field of an LPAE stage 2 page
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 9/9] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one
2017-10-02 17:31 ` [PATCH v3 9/9] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one Julien Grall
@ 2017-10-02 18:14 ` Konrad Rzeszutek Wilk
0 siblings, 0 replies; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-10-02 18:14 UTC (permalink / raw)
To: Julien Grall; +Cc: andre.przywara, sstabellini, Ross Lagerwall, xen-devel
On Mon, Oct 02, 2017 at 06:31:50PM +0100, Julien Grall wrote:
> This will help to consolidate the page-table code and avoid different
> path depending on the action to perform.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
>
> ---
>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
>
> arch_livepatch_secure is now the same as on x86. It might be
> possible to combine both, but I left that alone for now.
>
> Changes in v3:
> - Add Stefano's reviewed-by
>
> Changes in v2:
> - Add Andre's reviewed-by
> ---
> xen/arch/arm/livepatch.c | 6 +++---
> xen/arch/arm/mm.c | 5 ++---
> xen/include/asm-arm/page.h | 11 -----------
> 3 files changed, 5 insertions(+), 17 deletions(-)
>
> diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
> index 3e53524365..279d52cc6c 100644
> --- a/xen/arch/arm/livepatch.c
> +++ b/xen/arch/arm/livepatch.c
> @@ -146,15 +146,15 @@ int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type type)
> switch ( type )
> {
> case LIVEPATCH_VA_RX:
> - flags = PTE_RO; /* R set, NX clear */
> + flags = PAGE_HYPERVISOR_RX;
> break;
>
> case LIVEPATCH_VA_RW:
> - flags = PTE_NX; /* R clear, NX set */
> + flags = PAGE_HYPERVISOR_RW;
> break;
>
> case LIVEPATCH_VA_RO:
> - flags = PTE_NX | PTE_RO; /* R set, NX set */
> + flags = PAGE_HYPERVISOR_RO;
> break;
>
> default:
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 57afedf0be..705bdd9cce 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -1041,8 +1041,8 @@ static int create_xen_entries(enum xenmap_operation op,
> else
> {
> pte = *entry;
> - pte.pt.ro = PTE_RO_MASK(flags);
> - pte.pt.xn = PTE_NX_MASK(flags);
> + pte.pt.ro = PAGE_RO_MASK(flags);
> + pte.pt.xn = PAGE_XN_MASK(flags);
> if ( !pte.pt.ro && !pte.pt.xn )
> {
> printk("%s: Incorrect combination for addr=%lx\n",
> @@ -1085,7 +1085,6 @@ int destroy_xen_mappings(unsigned long v, unsigned long e)
>
> int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags)
> {
> - ASSERT((flags & (PTE_NX | PTE_RO)) == flags);
> return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT,
> flags);
> }
> diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
> index e2b3e402d0..e4be83a7bc 100644
> --- a/xen/include/asm-arm/page.h
> +++ b/xen/include/asm-arm/page.h
> @@ -96,17 +96,6 @@
> #define PAGE_HYPERVISOR_WC (_PAGE_DEVICE|MT_NORMAL_NC)
>
> /*
> - * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be
> - * used with modify_xen_mappings.
> - */
> -#define _PTE_NX_BIT 0U
> -#define _PTE_RO_BIT 1U
> -#define PTE_NX (1U << _PTE_NX_BIT)
> -#define PTE_RO (1U << _PTE_RO_BIT)
> -#define PTE_NX_MASK(x) (((x) >> _PTE_NX_BIT) & 0x1U)
> -#define PTE_RO_MASK(x) (((x) >> _PTE_RO_BIT) & 0x1U)
> -
> -/*
> * Stage 2 Memory Type.
> *
> * These are valid in the MemAttr[3:0] field of an LPAE stage 2 page
> --
> 2.11.0
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 7/9] xen/arm: mm: Embed permission in the flags
2017-10-02 17:31 ` [PATCH v3 7/9] xen/arm: mm: Embed permission in the flags Julien Grall
@ 2017-10-09 12:34 ` Julien Grall
0 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2017-10-09 12:34 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, sstabellini
Hi,
On 02/10/17 18:31, Julien Grall wrote:
> Currently, it is not possible to specify the permission of a new
> mapping. It would be necessary to use the function modify_xen_mappings
> with a different set of flags.
>
> Introduce a couple of new flags for the permissions (Non-eXecutable,
> Read-Only) and also provides definition that combine the memory attribute
> and permission for common combinations.
>
> PAGE_HYPERVISOR is now an alias to PAGE_HYPERVISOR_RW (read-write,
> non-executable mappings). This does not affect the current mapping using
> PAGE_HYPERVISOR because Xen is currently forcing all the mapping to be
> non-executable by default (see mfn_to_xen_entry).
>
> A follow-up patch will change modify_xen_mappings to use the new flags.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
During the week-end, I spotted a potential issue with set_fixmap. Indeed
set_fixmap is supposed to take a memory attribute in parameter. However,
some callers seem to mix the use of PAGE_* and direct attributes...
I will resend this series with set_fixmap fixed.
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-10-09 12:34 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 17:31 [PATCH v3 0/9] xen/arm: Memory subsystem clean-up Julien Grall
2017-10-02 17:31 ` [PATCH v3 1/9] xen/arm: page: Use ARMv8 naming to improve readability Julien Grall
2017-10-02 17:31 ` [PATCH v3 2/9] xen/arm: page: Clean-up the definition of MAIRVAL Julien Grall
2017-10-02 17:31 ` [PATCH v3 3/9] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table Julien Grall
2017-10-02 17:31 ` [PATCH v3 4/9] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator() Julien Grall
2017-10-02 17:31 ` [PATCH v3 5/9] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries Julien Grall
2017-10-02 17:31 ` [PATCH v3 6/9] xen/arm: page: Describe the layout of flags used to update page tables Julien Grall
2017-10-02 17:31 ` [PATCH v3 7/9] xen/arm: mm: Embed permission in the flags Julien Grall
2017-10-09 12:34 ` Julien Grall
2017-10-02 17:31 ` [PATCH v3 8/9] xen/arm: mm: Handle permission flags when adding a new mapping Julien Grall
2017-10-02 17:31 ` [PATCH v3 9/9] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one Julien Grall
2017-10-02 18:14 ` Konrad Rzeszutek Wilk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).