Skip to contentSkip to conversation

ARM: NOMMU: MPU updates

PATCH Superseded Vladimir Murzin 4 participants 24 messages Sep 25, 2017 – Oct 17, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

v3 cover ARM: NOMMU: MPU updates

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

Vladimir Murzin (8):
ARM: NOMMU: Move out MPU setup in separate module
ARM: NOMMU: Update MPU accessors to use cp15 helpers
ARM: NOMMU: Rework MPU to be mostly done in C
ARM: NOMMU: Disallow MPU for XIP
ARM: Kconfig: Kill CONFIG_VECTORS_BASE
ARM: V7M: Add support for MPU to M-class
ARM: NOMMU: Use more MPU regions to cover memory
ARM: NOMMU: Support MPU in XIP configuration

 arch/arm/Kconfig                  |   9 -
 arch/arm/Kconfig-nommu            |   4 +-
 arch/arm/include/asm/cputype.h    |  10 +
 arch/arm/include/asm/mpu.h        |  26 +-
 arch/arm/include/asm/smp.h        |   2 +-
 arch/arm/include/asm/v7m.h        |  10 +
 arch/arm/kernel/asm-offsets.c     |  11 +
 arch/arm/kernel/head-nommu.S      | 148 +++++++++---
 arch/arm/kernel/smp.c             |   2 +-
 arch/arm/kernel/vmlinux-xip.lds.S |  23 ++
 arch/arm/mm/Makefile              |   1 +
 arch/arm/mm/nommu.c               | 254 +-------------------
 arch/arm/mm/pmsa-v7.c             | 484 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 682 insertions(+), 302 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/8 ARM: NOMMU: Move out MPU setup in separate module

Having MPU handling code in dedicated module makes it easier to enhance/maintain it.

---
 arch/arm/include/asm/mpu.h |  16 ++-
 arch/arm/mm/Makefile       |   1 +
 arch/arm/mm/nommu.c        | 254 +------------------------------------------
 arch/arm/mm/pmsa-v7.c      | 262 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 276 insertions(+), 257 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c
arch/arm/include/asm/mpu.h +12 -4
index c3247cc..edec5cf 100644
@@ -1,8 +1,6 @@
 #ifndef __ARM_MPU_H
 #define __ARM_MPU_H
 
-#ifdef CONFIG_ARM_MPU
-
 /* MPUIR layout */
 #define MPUIR_nU		1
 #define MPUIR_DREGION		8
@@ -69,8 +67,18 @@ struct mpu_rgn_info {
 };
 extern struct mpu_rgn_info mpu_rgn_info;
 
-#endif /* __ASSEMBLY__ */
+#ifdef CONFIG_ARM_MPU
+
+extern void __init adjust_lowmem_bounds_mpu(void);
+extern void __init mpu_setup(void);
 
-#endif /* CONFIG_ARM_MPU */
+#else
+
+static inline void adjust_lowmem_bounds_mpu(void) {}
+static inline void mpu_setup(void) {}
+
+#endif /* !CONFIG_ARM_MPU */
+
+#endif /* __ASSEMBLY__ */
 
 #endif
arch/arm/mm/Makefile +1 -0
index 950d19b..bdb2ec1 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_MMU)		+= fault-armv.o flush.o idmap.o ioremap.o \
 
 ifneq ($(CONFIG_MMU),y)
 obj-y				+= nommu.o
+obj-$(CONFIG_ARM_MPU)		+= pmsa-v7.o
 endif
 
 obj-$(CONFIG_ARM_PTDUMP)	+= dump.o
arch/arm/mm/nommu.c +1 -253

260 lines not on this page · raw message

arch/arm/mm/pmsa-v7.c new file +262 -0

262 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/8 ARM: NOMMU: Move out MPU setup in separate module

arch/arm/mm/pmsa-v7.c line 4

Quoted 10 lines · Vladimir Murzin
arch/arm/mm/pmsa-v7.c new file +4 -0
new file mode 100644
index 0000000..ee3cf51
@@ -0,0 +1,262 @@
+/*
+ *  linux/arch/arm/mm/nommu.c
+ *
+ * ARM uCLinux supporting functions.

If this is for "a different MPU model" wouldn't it be better to say here? uCLinux itself doesn't require a MPU (think pre-Cortex MMU-less systems.)

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
#3 lore raw

PATCH v3 1/8 ARM: NOMMU: Move out MPU setup in separate module

Quoted 15 lines · Russell King - ARM Linux

arch/arm/mm/pmsa-v7.c line 4

Quoted 10 lines · Vladimir Murzin
arch/arm/mm/pmsa-v7.c new file +4 -0
new file mode 100644
index 0000000..ee3cf51
@@ -0,0 +1,262 @@
+/*
+ *  linux/arch/arm/mm/nommu.c
+ *
+ * ARM uCLinux supporting functions.

If this is for "a different MPU model" wouldn't it be better to say here? uCLinux itself doesn't require a MPU (think pre-Cortex MMU-less systems.)

Agree, content of this file it not related to uCLinux. I'll update a comment.

Thanks
Vladimir

#4 lore raw

PATCH v3 2/8 ARM: NOMMU: Update MPU accessors to use cp15 helpers

In reply to Vladimir Murzin

Currently, inline assembly for accessing to MPU's cp15 lacks volatile keyword which opens possibility to compiler to optimise such accesses as soon as we start using them more intensively. Rather than fixing inline asm, lets move MPU accessors to use cp15 helpers which do the right thing.

---
 arch/arm/mm/pmsa-v7.c | 48 ++++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)
arch/arm/mm/pmsa-v7.c +26 -22
index ee3cf51..5b55f8f 100644
@@ -12,63 +12,67 @@
 
 #include "mm.h"
 
+#define DRBAR	__ACCESS_CP15(c6, 0, c1, 0)
+#define IRBAR	__ACCESS_CP15(c6, 0, c1, 1)
+#define DRSR	__ACCESS_CP15(c6, 0, c1, 2)
+#define IRSR	__ACCESS_CP15(c6, 0, c1, 3)
+#define DRACR	__ACCESS_CP15(c6, 0, c1, 4)
+#define IRACR	__ACCESS_CP15(c6, 0, c1, 5)
+#define RNGNR	__ACCESS_CP15(c6, 0, c2, 0)
+
 /* Region number */
-static void rgnr_write(u32 v)
+static inline void rgnr_write(u32 v)
 {
-	asm("mcr        p15, 0, %0, c6, c2, 0" : : "r" (v));
+	write_sysreg(v, RNGNR);
 }
 
 /* Data-side / unified region attributes */
 
 /* Region access control register */
-static void dracr_write(u32 v)
+static inline void dracr_write(u32 v)
 {
-	asm("mcr        p15, 0, %0, c6, c1, 4" : : "r" (v));
+	write_sysreg(v, DRACR);
 }
 
 /* Region size register */
-static void drsr_write(u32 v)
+static inline void drsr_write(u32 v)
 {
-	asm("mcr        p15, 0, %0, c6, c1, 2" : : "r" (v));
+	write_sysreg(v, DRSR);
 }
 
 /* Region base address register */
-static void drbar_write(u32 v)
+static inline void drbar_write(u32 v)
 {
-	asm("mcr        p15, 0, %0, c6, c1, 0" : : "r" (v));
+	write_sysreg(v, DRBAR);
 }
 
-static u32 drbar_read(void)
+static inline u32 drbar_read(void)
 {
-	u32 v;
-	asm("mrc        p15, 0, %0, c6, c1, 0" : "=r" (v));
-	return v;
+	return read_sysreg(DRBAR);
 }
 /* Optional instruction-side region attributes */
 
 /* I-side Region access control register */
-static void iracr_write(u32 v)
+static inline void iracr_write(u32 v)
 {
-	asm("mcr        p15, 0, %0, c6, c1, 5" : : "r" (v));
+	write_sysreg(v, IRACR);
 }
 
 /* I-side Region size register */
-static void irsr_write(u32 v)
+static inline void irsr_write(u32 v)
 {
-	asm("mcr        p15, 0, %0, c6, c1, 3" : : "r" (v));
+	write_sysreg(v, IRSR);
 }
 
 /* I-side Region base address register */
-static void irbar_write(u32 v)
+static inline void irbar_write(u32 v)
 {
-	asm("mcr        p15, 0, %0, c6, c1, 1" : : "r" (v));
+	write_sysreg(v, IRBAR);
 }
 
-static unsigned long irbar_read(void)
+static inline u32 irbar_read(void)
 {
-	unsigned long v;
-	asm("mrc        p15, 0, %0, c6, c1, 1" : "=r" (v));
-	return v;
+	return read_sysreg(IRBAR);
 }
 
 /* MPU initialisation functions */
Signature · 1 line
1.9.1
#5 lore raw

PATCH v3 3/8 ARM: NOMMU: Rework MPU to be mostly done in C

In reply to Vladimir Murzin

Currently, there are several issues with how MPU is setup:

1. We won't boot if MPU is missing
2. We won't boot if use XIP
3. Further extension of MPU setup requires asm skills

The 1st point can be relaxed, so we can continue with boot CPU even if MPU is missed and fail boot for secondaries only. To address the 2nd point we could create region covering CONFIG_XIP_PHYS_ADDR - _end and that might work for the first stage of MPU enable, but due to MPU's alignment requirement we could cover too much, IOW we need more flexibility in how we're partitioning memory regions... and it'd be hardly possible to archive because of the 3rd point.

This patch is trying to address 1st and 3rd issues and paves the path for 2nd and further improvements.

The most visible change introduced with this patch is that we start using mpu_rgn_info array (as it was supposed?), so change in MPU setup done by boot CPU is recorded there and feed to secondaries. It allows us to keep minimal region setup for boot CPU and do the rest in C. Since we start programming MPU regions in C evaluation of MPU constrains (number of regions supported and minimal region order) can be done once, which in turn open possibility to free-up "probe" region early.

---
 arch/arm/include/asm/mpu.h    |  2 +-
 arch/arm/include/asm/smp.h    |  2 +-
 arch/arm/kernel/asm-offsets.c | 11 ++++++
 arch/arm/kernel/head-nommu.S  | 80 +++++++++++++++++++++++++++++++++----------
 arch/arm/kernel/smp.c         |  2 +-
 arch/arm/mm/pmsa-v7.c         | 70 +++++++++++++++++++++++++++----------
 6 files changed, 127 insertions(+), 40 deletions(-)
arch/arm/include/asm/mpu.h +1 -1
index edec5cf..403462e 100644
@@ -62,7 +62,7 @@ struct mpu_rgn {
 };
 
 struct mpu_rgn_info {
-	u32 mpuir;
+	unsigned int used;
 	struct mpu_rgn rgns[MPU_MAX_REGIONS];
 };
 extern struct mpu_rgn_info mpu_rgn_info;
arch/arm/include/asm/smp.h +1 -1
index 3d6dc8b..709a559 100644
@@ -60,7 +60,7 @@
  */
 struct secondary_data {
 	union {
-		unsigned long mpu_rgn_szr;
+		struct mpu_rgn_info *mpu_rgn_info;
 		u64 pgdir;
 	};
 	unsigned long swapper_pg_dir;
arch/arm/kernel/asm-offsets.c +11 -0
index 6080082..0098d3c4 100644
@@ -23,6 +23,7 @@
 #include <asm/mach/arch.h>
 #include <asm/thread_info.h>
 #include <asm/memory.h>
+#include <asm/mpu.h>
 #include <asm/procinfo.h>
 #include <asm/suspend.h>
 #include <asm/vdso_datapage.h>
@@ -183,5 +184,15 @@ int main(void)
 #ifdef CONFIG_VDSO
   DEFINE(VDSO_DATA_SIZE,	sizeof(union vdso_data_store));
 #endif
+  BLANK();
+#ifdef CONFIG_ARM_MPU
+  DEFINE(MPU_RNG_INFO_RNGS,	offsetof(struct mpu_rgn_info, rgns));
+  DEFINE(MPU_RNG_INFO_USED,	offsetof(struct mpu_rgn_info, used));
+
+  DEFINE(MPU_RNG_SIZE,		sizeof(struct mpu_rgn));
+  DEFINE(MPU_RGN_DRBAR,		offsetof(struct mpu_rgn, drbar));
+  DEFINE(MPU_RGN_DRSR,		offsetof(struct mpu_rgn, drsr));
+  DEFINE(MPU_RGN_DRACR,		offsetof(struct mpu_rgn, dracr));
+#endif
   return 0; 
 }
arch/arm/kernel/head-nommu.S +62 -18

116 lines not on this page · raw message

arch/arm/kernel/smp.c +1 -1
index c9a0a52..b4fbf00 100644
@@ -114,7 +114,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
 	 */
 	secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
 #ifdef CONFIG_ARM_MPU
-	secondary_data.mpu_rgn_szr = mpu_rgn_info.rgns[MPU_RAM_REGION].drsr;
+	secondary_data.mpu_rgn_info = &mpu_rgn_info;
 #endif
 
 #ifdef CONFIG_MMU
arch/arm/mm/pmsa-v7.c +51 -19

149 lines not on this page · raw message

Signature · 1 line
1.9.1
#6 lore raw

PATCH v3 4/8 ARM: NOMMU: Disallow MPU for XIP

In reply to Vladimir Murzin

It seems that MPU never worked with XIP, so we just disallow such combination.

---
 arch/arm/Kconfig-nommu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig-nommu +1 -1
index b757634..6d18395 100644
@@ -52,7 +52,7 @@ config REMAP_VECTORS_TO_RAM
 
 config ARM_MPU
        bool 'Use the ARM v7 PMSA Compliant MPU'
-       depends on CPU_V7
+       depends on !XIP_KERNEL && CPU_V7
        default y
        help
          Some ARM systems without an MMU have instead a Memory Protection
Signature · 1 line
1.9.1
#7 lore raw

PATCH v3 5/8 ARM: Kconfig: Kill CONFIG_VECTORS_BASE

In reply to Vladimir Murzin

The last user of CONFIG_VECTORS_BASE has gone, so kill it.

---
 arch/arm/Kconfig | 9 ---------
 1 file changed, 9 deletions(-)
arch/arm/Kconfig +0 -9
index 7888c98..550b5ab 100644
@@ -239,15 +239,6 @@ config NEED_RET_TO_USER
 config ARCH_MTD_XIP
 	bool
 
-config VECTORS_BASE
-	hex
-	default 0xffff0000 if MMU || CPU_HIGH_VECTOR
-	default DRAM_BASE if REMAP_VECTORS_TO_RAM
-	default 0x00000000
-	help
-	  The base address of exception vectors.  This must be two pages
-	  in size.
-
 config ARM_PATCH_PHYS_VIRT
 	bool "Patch physical to virtual translations at runtime" if EMBEDDED
 	default y
Signature · 1 line
1.9.1
#8 lore raw

PATCH v3 6/8 ARM: V7M: Add support for MPU to M-class

In reply to Vladimir Murzin

This patch makes it possible to use MPU with v7M cores.

---
 arch/arm/Kconfig-nommu         |  4 +--
 arch/arm/include/asm/cputype.h | 10 ++++++++
 arch/arm/include/asm/v7m.h     | 10 ++++++++
 arch/arm/kernel/head-nommu.S   | 56 ++++++++++++++++++++++++++++++------------
 arch/arm/mm/pmsa-v7.c          | 53 +++++++++++++++++++++++++++++++++++++--
 5 files changed, 113 insertions(+), 20 deletions(-)
arch/arm/Kconfig-nommu +2 -2
index 6d18395..930e000 100644
@@ -52,8 +52,8 @@ config REMAP_VECTORS_TO_RAM
 
 config ARM_MPU
        bool 'Use the ARM v7 PMSA Compliant MPU'
-       depends on !XIP_KERNEL && CPU_V7
-       default y
+       depends on !XIP_KERNEL && (CPU_V7 || CPU_V7M)
+       default y if CPU_V7
        help
          Some ARM systems without an MMU have instead a Memory Protection
          Unit (MPU) that defines the type and permissions for regions of
arch/arm/include/asm/cputype.h +10 -0
index b62eaeb..abaac5e 100644
@@ -173,6 +173,11 @@ static inline unsigned int __attribute_const__ read_cpuid_cachetype(void)
 	return read_cpuid(CPUID_CACHETYPE);
 }
 
+static inline unsigned int __attribute_const__ read_cpuid_mputype(void)
+{
+	return read_cpuid(CPUID_MPUIR);
+}
+
 #elif defined(CONFIG_CPU_V7M)
 
 static inline unsigned int __attribute_const__ read_cpuid_id(void)
@@ -185,6 +190,11 @@ static inline unsigned int __attribute_const__ read_cpuid_cachetype(void)
 	return readl(BASEADDR_V7M_SCB + V7M_SCB_CTR);
 }
 
+static inline unsigned int __attribute_const__ read_cpuid_mputype(void)
+{
+	return readl(BASEADDR_V7M_SCB + MPU_TYPE);
+}
+
 #else /* ifdef CONFIG_CPU_CP15 / elif defined(CONFIG_CPU_V7M) */
 
 static inline unsigned int __attribute_const__ read_cpuid_id(void)
arch/arm/include/asm/v7m.h +10 -0
index 1fd775c..5de776c 100644
@@ -57,6 +57,16 @@
 #define	V7M_SCB_CCSIDR		0x80	/* Cache size ID register */
 #define	V7M_SCB_CSSELR		0x84	/* Cache size selection register */
 
+/* Memory-mapped MPU registers for M-class */
+#define MPU_TYPE		0x90
+#define MPU_CTRL		0x94
+#define MPU_CTRL_ENABLE		1
+#define MPU_CTRL_PRIVDEFENA	(1 << 2)
+
+#define MPU_RNR			0x98
+#define MPU_RBAR		0x9c
+#define MPU_RASR		0xa0
+
 /* Cache opeartions */
 #define	V7M_SCB_ICIALLU		0x250	/* I-cache invalidate all to PoU */
 #define	V7M_SCB_ICIMVAU		0x258	/* I-cache invalidate by MVA to PoU */
arch/arm/kernel/head-nommu.S +40 -16

107 lines not on this page · raw message

arch/arm/mm/pmsa-v7.c +51 -2

86 lines not on this page · raw message

Signature · 1 line
1.9.1
#9 lore raw

PATCH v3 7/8 ARM: NOMMU: Use more MPU regions to cover memory

In reply to Vladimir Murzin

PMSAv7 defines curious alignment requirements to the regions:
- size must be power of 2, and
- region start must be aligned to the region size

Because of that we currently adjust lowmem bounds plus we assign only one MPU region to cover memory all these lead to significant amount of memory could be wasted. As an example, consider 64Mb of memory at 0x70000000 - it fits alignment requirements nicely; now, imagine that 2Mb of memory is reserved for coherent DMA allocation, so now Linux is expected to see 62Mb of memory... and here annoying thing happens - memory gets truncated to 32Mb (we've lost 30Mb!), i.e. MPU layout looks like:

0: base 0x70000000, size 0x2000000

This patch tries to allocate as much as possible MPU slots to minimise amount of truncated memory. Moreover, with this patch MPU subregions starting to get used. MPU subregions allow us reduce the number of MPU slots used. For example given above, MPU layout looks like:

0: base 0x70000000, size 0x2000000
1: base 0x72000000, size 0x1000000
2: base 0x73000000, size 0x1000000, disable subreg 7 (0x73e00000 - 0x73ffffff)

Where without subregions we'd get:

0: base 0x70000000, size 0x2000000
1: base 0x72000000, size 0x1000000
2: base 0x73000000, size 0x800000
3: base 0x73800000, size 0x400000
4: base 0x73c00000, size 0x200000

To achieve better layout we fist try to cover specified memory as is (maybe with help of subregions) and if we failed, we truncate memory to fit alignment requirements (so it occupies one MPU slot) and perform one more attempt with the reminder, and so on till we either cover all memory or run out of MPU slots.

---
 arch/arm/include/asm/mpu.h |   5 ++
 arch/arm/mm/pmsa-v7.c      | 190 ++++++++++++++++++++++++++++++++++-----------
 2 files changed, 149 insertions(+), 46 deletions(-)
arch/arm/include/asm/mpu.h +5 -0
index 403462e..5db37a6 100644
@@ -15,6 +15,11 @@
 /* MPU D/I Size Register fields */
 #define MPU_RSR_SZ		1
 #define MPU_RSR_EN		0
+#define MPU_RSR_SD		8
+
+/* Number of subregions (SD) */
+#define MPU_NR_SUBREGS		8
+#define MPU_MIN_SUBREG_SIZE	256
 
 /* The D/I RSR value for an enabled region spanning the whole of memory */
 #define MPU_RSR_ALL_MEM		63
arch/arm/mm/pmsa-v7.c +144 -46

264 lines not on this page · raw message

Signature · 1 line
1.9.1
#10 lore raw

PATCH v3 8/8 ARM: NOMMU: Support MPU in XIP configuration

In reply to Vladimir Murzin

Currently, there is assumption in early MPU setup code that kernel image is located in RAM, which is obviously not true for XIP. To run code from ROM we need to make sure that it is covered by MPU. However, due to we allocate regions (semi-)dynamically we can run into issue of trimming region we are running from in case ROM spawns several MPU regions. To help deal with that we enforce minimum alignments for start end end of XIP address space as 1MB and 128Kb correspondingly.

---
 arch/arm/Kconfig-nommu            |  2 +-
 arch/arm/include/asm/mpu.h        |  3 ++-
 arch/arm/kernel/head-nommu.S      | 20 ++++++++++++++++
 arch/arm/kernel/vmlinux-xip.lds.S | 23 ++++++++++++++++++
 arch/arm/mm/pmsa-v7.c             | 49 +++++++++++++++++++++++++++++++++++----
 5 files changed, 90 insertions(+), 7 deletions(-)
arch/arm/Kconfig-nommu +1 -1
index 930e000..0fad7d9 100644
@@ -52,7 +52,7 @@ config REMAP_VECTORS_TO_RAM
 
 config ARM_MPU
        bool 'Use the ARM v7 PMSA Compliant MPU'
-       depends on !XIP_KERNEL && (CPU_V7 || CPU_V7M)
+       depends on CPU_V7 || CPU_V7M
        default y if CPU_V7
        help
          Some ARM systems without an MMU have instead a Memory Protection
arch/arm/include/asm/mpu.h +2 -1
index 5db37a6..56ec026 100644
@@ -41,6 +41,7 @@
 #endif
 
 /* Access permission bits of ACR (only define those that we use)*/
+#define MPU_AP_PL1RO_PL0NA	(0x5 << 8)
 #define MPU_AP_PL1RW_PL0RW	(0x3 << 8)
 #define MPU_AP_PL1RW_PL0R0	(0x2 << 8)
 #define MPU_AP_PL1RW_PL0NA	(0x1 << 8)
@@ -49,7 +50,7 @@
 #define MPU_PROBE_REGION	0
 #define MPU_BG_REGION		1
 #define MPU_RAM_REGION		2
-#define MPU_VECTORS_REGION	3
+#define MPU_ROM_REGION		3
 
 /* Maximum number of regions Linux is interested in */
 #define MPU_MAX_REGIONS		16
arch/arm/kernel/head-nommu.S +20 -0
index 8a0718f..2ce4455 100644
@@ -279,6 +279,26 @@ M_CLASS(ldr    r0, [r12, #MPU_TYPE])
 	setup_region r0, r5, r6, MPU_INSTR_SIDE r12	@ 0x0, BG region, enabled
 2:	isb
 
+#ifdef CONFIG_XIP_KERNEL
+	set_region_nr r0, #MPU_ROM_REGION, r12
+	isb
+
+	ldr	r5,=(MPU_AP_PL1RO_PL0NA | MPU_RGN_NORMAL)
+
+	ldr	r0, =CONFIG_XIP_PHYS_ADDR		@ ROM start
+	ldr     r6, =(_exiprom)				@ ROM end
+	sub	r6, r6, r0				@ Minimum size of region to map
+	clz	r6, r6					@ Region size must be 2^N...
+	rsb	r6, r6, #31				@ ...so round up region size
+	lsl	r6, r6, #MPU_RSR_SZ			@ Put size in right field
+	orr	r6, r6, #(1 << MPU_RSR_EN)		@ Set region enabled bit
+
+	setup_region r0, r5, r6, MPU_DATA_SIDE, r12	@ XIP_PHYS_ADDR, shared, enabled
+	beq	3f					@ Memory-map not unified
+	setup_region r0, r5, r6, MPU_INSTR_SIDE, r12	@ XIP_PHYS_ADDR, shared, enabled
+3:	isb
+#endif
+
 	/* Enable the MPU */
 AR_CLASS(mrc	p15, 0, r0, c1, c0, 0)		@ Read SCTLR
 AR_CLASS(bic	r0, r0, #CR_BR)			@ Disable the 'default mem-map'
arch/arm/kernel/vmlinux-xip.lds.S +23 -0
index 8265b11..c6f7056 100644
@@ -6,6 +6,8 @@
 /* No __ro_after_init data in the .rodata section - which will always be ro */
 #define RO_AFTER_INIT_DATA
 
+#include <linux/sizes.h>
+
 #include <asm-generic/vmlinux.lds.h>
 #include <asm/cache.h>
 #include <asm/thread_info.h>
@@ -205,6 +207,9 @@ SECTIONS
 	PERCPU_SECTION(L1_CACHE_BYTES)
 #endif
 
+#ifdef CONFIG_ARM_MPU
+	. = ALIGN(SZ_128K);
+#endif
 	_exiprom = .;			/* End of XIP ROM area */
 	__data_loc = ALIGN(4);		/* location in binary */
 	. = PAGE_OFFSET + TEXT_OFFSET;
@@ -322,3 +327,21 @@ ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
  */
 ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & PAGE_MASK) <= PAGE_SIZE,
 	"HYP init code too big or misaligned")
+
+#ifdef CONFIG_ARM_MPU
+/*
+ * Due to PMSAv7 restriction on base address and size we have to
+ * enforce minimal alignment restrictions. It was seen that weaker
+ * alignment restriction on _xiprom will likely force XIP address
+ * space spawns multiple MPU regions thus it is likely we run in
+ * situation when we are reprogramming MPU region we run on with
+ * something which doesn't cover reprogramming code itself, so as soon
+ * as we update MPU settings we'd immediately try to execute straight
+ * from background region which is XN.
+ * It seem that alignment in 1M should suit most users.
+ * _exiprom is aligned as 1/8 of 1M so can be covered by subregion
+ * disable
+ */
+ASSERT(!(_xiprom & (SZ_1M - 1)), "XIP start address may cause MPU programming issues")
+ASSERT(!(_exiprom & (SZ_128K - 1)), "XIP end address may cause MPU programming issues")
+#endif
arch/arm/mm/pmsa-v7.c +44 -5

108 lines not on this page · raw message

Signature · 1 line
1.9.1
#11 lore raw

PATCH v3 8/8 ARM: NOMMU: Support MPU in XIP configuration

Hi Vlad,

Quoted 9 lines · Vladimir Murzin

Currently, there is assumption in early MPU setup code that kernel image is located in RAM, which is obviously not true for XIP. To run code from ROM we need to make sure that it is covered by MPU. However, due to we allocate regions (semi-)dynamically we can run into issue of trimming region we are running from in case ROM spawns several MPU regions. To help deal with that we enforce minimum alignments for start end end of XIP address space as 1MB and 128Kb correspondingly.

Thanks for the XIP fix.

regards
Alex

Quoted 239 lines
---
  arch/arm/Kconfig-nommu            |  2 +-
  arch/arm/include/asm/mpu.h        |  3 ++-
  arch/arm/kernel/head-nommu.S      | 20 ++++++++++++++++
  arch/arm/kernel/vmlinux-xip.lds.S | 23 ++++++++++++++++++
  arch/arm/mm/pmsa-v7.c             | 49 +++++++++++++++++++++++++++++++++++----
  5 files changed, 90 insertions(+), 7 deletions(-)
arch/arm/Kconfig-nommu +1 -1
index 930e000..0fad7d9 100644
@@ -52,7 +52,7 @@ config REMAP_VECTORS_TO_RAM
 
  config ARM_MPU
         bool 'Use the ARM v7 PMSA Compliant MPU'
-       depends on !XIP_KERNEL && (CPU_V7 || CPU_V7M)
+       depends on CPU_V7 || CPU_V7M
         default y if CPU_V7
         help
           Some ARM systems without an MMU have instead a Memory Protection
arch/arm/include/asm/mpu.h +2 -1
index 5db37a6..56ec026 100644
@@ -41,6 +41,7 @@
  #endif
 
  /* Access permission bits of ACR (only define those that we use)*/
+#define MPU_AP_PL1RO_PL0NA	(0x5 << 8)
  #define MPU_AP_PL1RW_PL0RW	(0x3 << 8)
  #define MPU_AP_PL1RW_PL0R0	(0x2 << 8)
  #define MPU_AP_PL1RW_PL0NA	(0x1 << 8)
@@ -49,7 +50,7 @@
  #define MPU_PROBE_REGION	0
  #define MPU_BG_REGION		1
  #define MPU_RAM_REGION		2
-#define MPU_VECTORS_REGION	3
+#define MPU_ROM_REGION		3
 
  /* Maximum number of regions Linux is interested in */
  #define MPU_MAX_REGIONS		16
arch/arm/kernel/head-nommu.S +20 -0
index 8a0718f..2ce4455 100644
@@ -279,6 +279,26 @@ M_CLASS(ldr    r0, [r12, #MPU_TYPE])
  	setup_region r0, r5, r6, MPU_INSTR_SIDE r12	@ 0x0, BG region, enabled
  2:	isb
 
+#ifdef CONFIG_XIP_KERNEL
+	set_region_nr r0, #MPU_ROM_REGION, r12
+	isb
+
+	ldr	r5,=(MPU_AP_PL1RO_PL0NA | MPU_RGN_NORMAL)
+
+	ldr	r0, =CONFIG_XIP_PHYS_ADDR		@ ROM start
+	ldr     r6, =(_exiprom)				@ ROM end
+	sub	r6, r6, r0				@ Minimum size of region to map
+	clz	r6, r6					@ Region size must be 2^N...
+	rsb	r6, r6, #31				@ ...so round up region size
+	lsl	r6, r6, #MPU_RSR_SZ			@ Put size in right field
+	orr	r6, r6, #(1 << MPU_RSR_EN)		@ Set region enabled bit
+
+	setup_region r0, r5, r6, MPU_DATA_SIDE, r12	@ XIP_PHYS_ADDR, shared, enabled
+	beq	3f					@ Memory-map not unified
+	setup_region r0, r5, r6, MPU_INSTR_SIDE, r12	@ XIP_PHYS_ADDR, shared, enabled
+3:	isb
+#endif
+
  	/* Enable the MPU */
  AR_CLASS(mrc	p15, 0, r0, c1, c0, 0)		@ Read SCTLR
  AR_CLASS(bic	r0, r0, #CR_BR)			@ Disable the 'default mem-map'
arch/arm/kernel/vmlinux-xip.lds.S +23 -0
index 8265b11..c6f7056 100644
@@ -6,6 +6,8 @@
  /* No __ro_after_init data in the .rodata section - which will always be ro */
  #define RO_AFTER_INIT_DATA
 
+#include <linux/sizes.h>
+
  #include <asm-generic/vmlinux.lds.h>
  #include <asm/cache.h>
  #include <asm/thread_info.h>
@@ -205,6 +207,9 @@ SECTIONS
  	PERCPU_SECTION(L1_CACHE_BYTES)
  #endif
 
+#ifdef CONFIG_ARM_MPU
+	. = ALIGN(SZ_128K);
+#endif
  	_exiprom = .;			/* End of XIP ROM area */
  	__data_loc = ALIGN(4);		/* location in binary */
  	. = PAGE_OFFSET + TEXT_OFFSET;
@@ -322,3 +327,21 @@ ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
   */
  ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & PAGE_MASK) <= PAGE_SIZE,
  	"HYP init code too big or misaligned")
+
+#ifdef CONFIG_ARM_MPU
+/*
+ * Due to PMSAv7 restriction on base address and size we have to
+ * enforce minimal alignment restrictions. It was seen that weaker
+ * alignment restriction on _xiprom will likely force XIP address
+ * space spawns multiple MPU regions thus it is likely we run in
+ * situation when we are reprogramming MPU region we run on with
+ * something which doesn't cover reprogramming code itself, so as soon
+ * as we update MPU settings we'd immediately try to execute straight
+ * from background region which is XN.
+ * It seem that alignment in 1M should suit most users.
+ * _exiprom is aligned as 1/8 of 1M so can be covered by subregion
+ * disable
+ */
+ASSERT(!(_xiprom & (SZ_1M - 1)), "XIP start address may cause MPU programming issues")
+ASSERT(!(_exiprom & (SZ_128K - 1)), "XIP end address may cause MPU programming issues")
+#endif
arch/arm/mm/pmsa-v7.c +44 -5
index c1f1fc7..27434d7 100644
@@ -7,9 +7,11 @@
  #include <linux/bitops.h>
  #include <linux/memblock.h>
 
+#include <asm/cacheflush.h>
  #include <asm/cp15.h>
  #include <asm/cputype.h>
  #include <asm/mpu.h>
+#include <asm/sections.h>
 
  #include "mm.h"
 
@@ -20,6 +22,9 @@ struct region {
  };
 
  static struct region __initdata mem[MPU_MAX_REGIONS];
+#ifdef CONFIG_XIP_KERNEL
+static struct region __initdata xip[MPU_MAX_REGIONS];
+#endif
 
  static unsigned int __initdata mpu_min_region_order;
  static unsigned int __initdata mpu_max_regions;
@@ -229,7 +234,6 @@ static int __init allocate_region(phys_addr_t base, phys_addr_t size,
  /* MPU initialisation functions */
  void __init adjust_lowmem_bounds_mpu(void)
  {
-	phys_addr_t phys_offset = PHYS_OFFSET;
  	phys_addr_t  specified_mem_size, total_mem_size = 0;
  	struct memblock_region *reg;
  	bool first = true;
@@ -256,8 +260,19 @@ void __init adjust_lowmem_bounds_mpu(void)
  	/* ... and one for vectors */
  	mem_max_regions--;
  #endif
+
+#ifdef CONFIG_XIP_KERNEL
+	/* plus some regions to cover XIP ROM */
+	num = allocate_region(CONFIG_XIP_PHYS_ADDR, __pa(_exiprom) - CONFIG_XIP_PHYS_ADDR,
+			      mem_max_regions, xip);
+
+	mem_max_regions -= num;
+#endif
+
  	for_each_memblock(memory, reg) {
  		if (first) {
+			phys_addr_t phys_offset = PHYS_OFFSET;
+
  			/*
  			 * Initially only use memory continuous from
  			 * PHYS_OFFSET */
@@ -355,7 +370,7 @@ static int __init __mpu_min_region_order(void)
 
  static int __init mpu_setup_region(unsigned int number, phys_addr_t start,
  				   unsigned int size_order, unsigned int properties,
-				   unsigned int subregions)
+				   unsigned int subregions, bool need_flush)
  {
  	u32 size_data;
 
@@ -374,6 +389,9 @@ static int __init mpu_setup_region(unsigned int number, phys_addr_t start,
  	size_data = ((size_order - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN;
  	size_data |= subregions << MPU_RSR_SD;
 
+	if (need_flush)
+		flush_cache_all();
+
  	dsb(); /* Ensure all previous data accesses occur with old mappings */
  	rgnr_write(number);
  	isb();
@@ -416,7 +434,28 @@ void __init mpu_setup(void)
  	/* Background */
  	err |= mpu_setup_region(region++, 0, 32,
  				MPU_ACR_XN | MPU_RGN_STRONGLY_ORDERED | MPU_AP_PL1RW_PL0NA,
-				0);
+				0, false);
+
+#ifdef CONFIG_XIP_KERNEL
+	/* ROM */
+	for (i = 0; i < ARRAY_SIZE(xip); i++) {
+		/*
+                 * In case we overwrite RAM region we set earlier in
+                 * head-nommu.S (which is cachable) all subsequent
+                 * data access till we setup RAM bellow would be done
+                 * with BG region (which is uncachable), thus we need
+                 * to clean and invalidate cache.
+		 */
+		bool need_flush = region == MPU_RAM_REGION;
+
+		if (!xip[i].size)
+			continue;
+
+		err |= mpu_setup_region(region++, xip[i].base, ilog2(xip[i].size),
+					MPU_AP_PL1RO_PL0NA | MPU_RGN_NORMAL,
+					xip[i].subreg, need_flush);
+	}
+#endif
 
  	/* RAM */
  	for (i = 0; i < ARRAY_SIZE(mem); i++) {
@@ -425,14 +464,14 @@ void __init mpu_setup(void)
 
  		err |= mpu_setup_region(region++, mem[i].base, ilog2(mem[i].size),
  					MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL,
-					mem[i].subreg);
+					mem[i].subreg, false);
  	}
 
  	/* Vectors */
  #ifndef CONFIG_CPU_V7M
  	err |= mpu_setup_region(region++, vectors_base, ilog2(2 * PAGE_SIZE),
  				MPU_AP_PL1RW_PL0NA | MPU_RGN_NORMAL,
-				0);
+				0, false);
  #endif
  	if (err) {
  		panic("MPU region initialization failure! %d", err);
#12 lore raw

PATCH v3 8/8 ARM: NOMMU: Support MPU in XIP configuration

Hi Alex,

Quoted 11 lines · Alexandre Torgue

Hi Vlad,

Quoted 8 lines · Vladimir Murzin

Currently, there is assumption in early MPU setup code that kernel image is located in RAM, which is obviously not true for XIP. To run code from ROM we need to make sure that it is covered by MPU. However, due to we allocate regions (semi-)dynamically we can run into issue of trimming region we are running from in case ROM spawns several MPU regions. To help deal with that we enforce minimum alignments for start end end of XIP address space as 1MB and 128Kb correspondingly.

Quoted 6 lines
Quoted 1 line

Thanks for the XIP fix.

Much appreciated!

Vladimir

Quoted 228 lines

regards
Alex

Quoted 222 lines
---
  arch/arm/Kconfig-nommu            |  2 +-
  arch/arm/include/asm/mpu.h        |  3 ++-
  arch/arm/kernel/head-nommu.S      | 20 ++++++++++++++++
  arch/arm/kernel/vmlinux-xip.lds.S | 23 ++++++++++++++++++
  arch/arm/mm/pmsa-v7.c             | 49 +++++++++++++++++++++++++++++++++++----
  5 files changed, 90 insertions(+), 7 deletions(-)
arch/arm/Kconfig-nommu +1 -1
index 930e000..0fad7d9 100644
@@ -52,7 +52,7 @@ config REMAP_VECTORS_TO_RAM
    config ARM_MPU
         bool 'Use the ARM v7 PMSA Compliant MPU'
-       depends on !XIP_KERNEL && (CPU_V7 || CPU_V7M)
+       depends on CPU_V7 || CPU_V7M
         default y if CPU_V7
         help
           Some ARM systems without an MMU have instead a Memory Protection
arch/arm/include/asm/mpu.h +2 -1
index 5db37a6..56ec026 100644
@@ -41,6 +41,7 @@
  #endif
    /* Access permission bits of ACR (only define those that we use)*/
+#define MPU_AP_PL1RO_PL0NA    (0x5 << 8)
  #define MPU_AP_PL1RW_PL0RW    (0x3 << 8)
  #define MPU_AP_PL1RW_PL0R0    (0x2 << 8)
  #define MPU_AP_PL1RW_PL0NA    (0x1 << 8)
@@ -49,7 +50,7 @@
  #define MPU_PROBE_REGION    0
  #define MPU_BG_REGION        1
  #define MPU_RAM_REGION        2
-#define MPU_VECTORS_REGION    3
+#define MPU_ROM_REGION        3
    /* Maximum number of regions Linux is interested in */
  #define MPU_MAX_REGIONS        16
arch/arm/kernel/head-nommu.S +19 -0
index 8a0718f..2ce4455 100644
@@ -279,6 +279,26 @@ M_CLASS(ldr    r0, [r12, #MPU_TYPE])
      setup_region r0, r5, r6, MPU_INSTR_SIDE r12    @ 0x0, BG region, enabled
  2:    isb
  +#ifdef CONFIG_XIP_KERNEL
+    set_region_nr r0, #MPU_ROM_REGION, r12
+    isb
+
+    ldr    r5,=(MPU_AP_PL1RO_PL0NA | MPU_RGN_NORMAL)
+
+    ldr    r0, =CONFIG_XIP_PHYS_ADDR        @ ROM start
+    ldr     r6, =(_exiprom)                @ ROM end
+    sub    r6, r6, r0                @ Minimum size of region to map
+    clz    r6, r6                    @ Region size must be 2^N...
+    rsb    r6, r6, #31                @ ...so round up region size
+    lsl    r6, r6, #MPU_RSR_SZ            @ Put size in right field
+    orr    r6, r6, #(1 << MPU_RSR_EN)        @ Set region enabled bit
+
+    setup_region r0, r5, r6, MPU_DATA_SIDE, r12    @ XIP_PHYS_ADDR, shared, enabled
+    beq    3f                    @ Memory-map not unified
+    setup_region r0, r5, r6, MPU_INSTR_SIDE, r12    @ XIP_PHYS_ADDR, shared, enabled
+3:    isb
+#endif
+
      /* Enable the MPU */
  AR_CLASS(mrc    p15, 0, r0, c1, c0, 0)        @ Read SCTLR
  AR_CLASS(bic    r0, r0, #CR_BR)            @ Disable the 'default mem-map'
arch/arm/kernel/vmlinux-xip.lds.S +21 -0
index 8265b11..c6f7056 100644
@@ -6,6 +6,8 @@
  /* No __ro_after_init data in the .rodata section - which will always be ro */
  #define RO_AFTER_INIT_DATA
  +#include <linux/sizes.h>
+
  #include <asm-generic/vmlinux.lds.h>
  #include <asm/cache.h>
  #include <asm/thread_info.h>
@@ -205,6 +207,9 @@ SECTIONS
      PERCPU_SECTION(L1_CACHE_BYTES)
  #endif
  +#ifdef CONFIG_ARM_MPU
+    . = ALIGN(SZ_128K);
+#endif
      _exiprom = .;            /* End of XIP ROM area */
      __data_loc = ALIGN(4);        /* location in binary */
      . = PAGE_OFFSET + TEXT_OFFSET;
@@ -322,3 +327,21 @@ ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
   */
  ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & PAGE_MASK) <= PAGE_SIZE,
      "HYP init code too big or misaligned")
+
+#ifdef CONFIG_ARM_MPU
+/*
+ * Due to PMSAv7 restriction on base address and size we have to
+ * enforce minimal alignment restrictions. It was seen that weaker
+ * alignment restriction on _xiprom will likely force XIP address
+ * space spawns multiple MPU regions thus it is likely we run in
+ * situation when we are reprogramming MPU region we run on with
+ * something which doesn't cover reprogramming code itself, so as soon
+ * as we update MPU settings we'd immediately try to execute straight
+ * from background region which is XN.
+ * It seem that alignment in 1M should suit most users.
+ * _exiprom is aligned as 1/8 of 1M so can be covered by subregion
+ * disable
+ */
+ASSERT(!(_xiprom & (SZ_1M - 1)), "XIP start address may cause MPU programming issues")
+ASSERT(!(_exiprom & (SZ_128K - 1)), "XIP end address may cause MPU programming issues")
+#endif
arch/arm/mm/pmsa-v7.c +16 -2
index c1f1fc7..27434d7 100644
@@ -7,9 +7,11 @@
  #include <linux/bitops.h>
  #include <linux/memblock.h>
  +#include <asm/cacheflush.h>
  #include <asm/cp15.h>
  #include <asm/cputype.h>
  #include <asm/mpu.h>
+#include <asm/sections.h>
    #include "mm.h"
  @@ -20,6 +22,9 @@ struct region {
  };
    static struct region __initdata mem[MPU_MAX_REGIONS];
+#ifdef CONFIG_XIP_KERNEL
+static struct region __initdata xip[MPU_MAX_REGIONS];
+#endif
    static unsigned int __initdata mpu_min_region_order;
  static unsigned int __initdata mpu_max_regions;
@@ -229,7 +234,6 @@ static int __init allocate_region(phys_addr_t base, phys_addr_t size,
  /* MPU initialisation functions */
  void __init adjust_lowmem_bounds_mpu(void)
  {
-    phys_addr_t phys_offset = PHYS_OFFSET;
      phys_addr_t  specified_mem_size, total_mem_size = 0;
      struct memblock_region *reg;
      bool first = true;
@@ -256,8 +260,19 @@ void __init adjust_lowmem_bounds_mpu(void)
      /* ... and one for vectors */
      mem_max_regions--;
  #endif
+
+#ifdef CONFIG_XIP_KERNEL
+    /* plus some regions to cover XIP ROM */
+    num = allocate_region(CONFIG_XIP_PHYS_ADDR, __pa(_exiprom) - CONFIG_XIP_PHYS_ADDR,
+                  mem_max_regions, xip);
+
+    mem_max_regions -= num;
+#endif
+
      for_each_memblock(memory, reg) {
          if (first) {
+            phys_addr_t phys_offset = PHYS_OFFSET;
+
              /*
               * Initially only use memory continuous from
               * PHYS_OFFSET */
@@ -355,7 +370,7 @@ static int __init __mpu_min_region_order(void)
    static int __init mpu_setup_region(unsigned int number, phys_addr_t start,
                     unsigned int size_order, unsigned int properties,
-                   unsigned int subregions)
+                   unsigned int subregions, bool need_flush)
  {
      u32 size_data;
  @@ -374,6 +389,9 @@ static int __init mpu_setup_region(unsigned int number, phys_addr_t start,
      size_data = ((size_order - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN;
      size_data |= subregions << MPU_RSR_SD;

+ if (need_flush)

arch/arm/mm/pmsa-v7.c +26 -3
+        flush_cache_all();
+
      dsb(); /* Ensure all previous data accesses occur with old mappings */
      rgnr_write(number);
      isb();
@@ -416,7 +434,28 @@ void __init mpu_setup(void)
      /* Background */
      err |= mpu_setup_region(region++, 0, 32,
                  MPU_ACR_XN | MPU_RGN_STRONGLY_ORDERED | MPU_AP_PL1RW_PL0NA,
-                0);
+                0, false);
+
+#ifdef CONFIG_XIP_KERNEL
+    /* ROM */
+    for (i = 0; i < ARRAY_SIZE(xip); i++) {
+        /*
+                 * In case we overwrite RAM region we set earlier in
+                 * head-nommu.S (which is cachable) all subsequent
+                 * data access till we setup RAM bellow would be done
+                 * with BG region (which is uncachable), thus we need
+                 * to clean and invalidate cache.
+         */
+        bool need_flush = region == MPU_RAM_REGION;
+
+        if (!xip[i].size)
+            continue;
+
+        err |= mpu_setup_region(region++, xip[i].base, ilog2(xip[i].size),
+                    MPU_AP_PL1RO_PL0NA | MPU_RGN_NORMAL,
+                    xip[i].subreg, need_flush);
+    }
+#endif
        /* RAM */
      for (i = 0; i < ARRAY_SIZE(mem); i++) {
@@ -425,14 +464,14 @@ void __init mpu_setup(void)
            err |= mpu_setup_region(region++, mem[i].base, ilog2(mem[i].size),
                      MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL,
-                    mem[i].subreg);
+                    mem[i].subreg, false);
      }
        /* Vectors */
  #ifndef CONFIG_CPU_V7M
      err |= mpu_setup_region(region++, vectors_base, ilog2(2 * PAGE_SIZE),
                  MPU_AP_PL1RW_PL0NA | MPU_RGN_NORMAL,
-                0);
+                0, false);
  #endif
      if (err) {
          panic("MPU region initialization failure! %d", err);
 
#13 lore raw

v3 cover ARM: NOMMU: MPU updates

In reply to Vladimir Murzin

Russell, do you have concerns on this series?

Thanks
Vladimir

Quoted 60 lines · Vladimir Murzin

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

Vladimir Murzin (8):
ARM: NOMMU: Move out MPU setup in separate module
ARM: NOMMU: Update MPU accessors to use cp15 helpers
ARM: NOMMU: Rework MPU to be mostly done in C
ARM: NOMMU: Disallow MPU for XIP
ARM: Kconfig: Kill CONFIG_VECTORS_BASE
ARM: V7M: Add support for MPU to M-class
ARM: NOMMU: Use more MPU regions to cover memory
ARM: NOMMU: Support MPU in XIP configuration

 arch/arm/Kconfig                  |   9 -
 arch/arm/Kconfig-nommu            |   4 +-
 arch/arm/include/asm/cputype.h    |  10 +
 arch/arm/include/asm/mpu.h        |  26 +-
 arch/arm/include/asm/smp.h        |   2 +-
 arch/arm/include/asm/v7m.h        |  10 +
 arch/arm/kernel/asm-offsets.c     |  11 +
 arch/arm/kernel/head-nommu.S      | 148 +++++++++---
 arch/arm/kernel/smp.c             |   2 +-
 arch/arm/kernel/vmlinux-xip.lds.S |  23 ++
 arch/arm/mm/Makefile              |   1 +
 arch/arm/mm/nommu.c               | 254 +-------------------
 arch/arm/mm/pmsa-v7.c             | 484 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 682 insertions(+), 302 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c
#14 lore raw

v3 cover ARM: NOMMU: MPU updates

Gentle ping...

Quoted 73 lines · Vladimir Murzin

Russell, do you have concerns on this series?

Thanks
Vladimir

Quoted 44 lines · Vladimir Murzin

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

Vladimir Murzin (8):
ARM: NOMMU: Move out MPU setup in separate module
ARM: NOMMU: Update MPU accessors to use cp15 helpers
ARM: NOMMU: Rework MPU to be mostly done in C
ARM: NOMMU: Disallow MPU for XIP
ARM: Kconfig: Kill CONFIG_VECTORS_BASE
ARM: V7M: Add support for MPU to M-class
ARM: NOMMU: Use more MPU regions to cover memory
ARM: NOMMU: Support MPU in XIP configuration

Quoted 16 lines
 arch/arm/Kconfig                  |   9 -
 arch/arm/Kconfig-nommu            |   4 +-
 arch/arm/include/asm/cputype.h    |  10 +
 arch/arm/include/asm/mpu.h        |  26 +-
 arch/arm/include/asm/smp.h        |   2 +-
 arch/arm/include/asm/v7m.h        |  10 +
 arch/arm/kernel/asm-offsets.c     |  11 +
 arch/arm/kernel/head-nommu.S      | 148 +++++++++---
 arch/arm/kernel/smp.c             |   2 +-
 arch/arm/kernel/vmlinux-xip.lds.S |  23 ++
 arch/arm/mm/Makefile              |   1 +
 arch/arm/mm/nommu.c               | 254 +-------------------
 arch/arm/mm/pmsa-v7.c             | 484 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 682 insertions(+), 302 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#15 lore raw

v3 cover ARM: NOMMU: MPU updates

Sorry, but I have no working MPS3 platform since it killed its uSD card with all the FPGA bitstreams on. I'm waiting (since end of September) for a replacement from ARM Ltd but there hasn't yet been any progress.

Sure, I can replace the uSD card myself, but the problem is the contents of the card.

Quoted 77 lines · Vladimir Murzin

Gentle ping...

Quoted 73 lines · Vladimir Murzin

Russell, do you have concerns on this series?

Thanks
Vladimir

Quoted 44 lines · Vladimir Murzin

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

Vladimir Murzin (8):
ARM: NOMMU: Move out MPU setup in separate module
ARM: NOMMU: Update MPU accessors to use cp15 helpers
ARM: NOMMU: Rework MPU to be mostly done in C
ARM: NOMMU: Disallow MPU for XIP
ARM: Kconfig: Kill CONFIG_VECTORS_BASE
ARM: V7M: Add support for MPU to M-class
ARM: NOMMU: Use more MPU regions to cover memory
ARM: NOMMU: Support MPU in XIP configuration

Quoted 16 lines
 arch/arm/Kconfig                  |   9 -
 arch/arm/Kconfig-nommu            |   4 +-
 arch/arm/include/asm/cputype.h    |  10 +
 arch/arm/include/asm/mpu.h        |  26 +-
 arch/arm/include/asm/smp.h        |   2 +-
 arch/arm/include/asm/v7m.h        |  10 +
 arch/arm/kernel/asm-offsets.c     |  11 +
 arch/arm/kernel/head-nommu.S      | 148 +++++++++---
 arch/arm/kernel/smp.c             |   2 +-
 arch/arm/kernel/vmlinux-xip.lds.S |  23 ++
 arch/arm/mm/Makefile              |   1 +
 arch/arm/mm/nommu.c               | 254 +-------------------
 arch/arm/mm/pmsa-v7.c             | 484 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 682 insertions(+), 302 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
#16 lore raw

v3 cover ARM: NOMMU: MPU updates

Quoted 6 lines · Russell King - ARM Linux

Sorry, but I have no working MPS3 platform since it killed its uSD card with all the FPGA bitstreams on. I'm waiting (since end of September) for a replacement from ARM Ltd but there hasn't yet been any progress.

Sure, I can replace the uSD card myself, but the problem is the contents of the card.

Thanks for prompt reply!

I should say that board won't help you with testing this series since it implements different MPU model (I have patches for that too but they are on top of this series).

I've been working closely with Alex and Andr?s (since they needed this for their Cortex-M7 platform) to make sure it works as expected. It was also tested with R-class FastModels.

I intentionally kept CONFIG_ARM_MPU disabled by default for M-class (PATCH 6/8), so it won't interfere with existing bootloaders.

I'd be glad if you can review the series and give it a chance to sit in linux-next (I can provide a branch on top of yours for-next).

Cheers
Vladimir

Quoted 80 lines · Vladimir Murzin
Quoted 77 lines

Gentle ping...

Quoted 73 lines · Vladimir Murzin

Russell, do you have concerns on this series?

Thanks
Vladimir

Quoted 44 lines · Vladimir Murzin

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

Vladimir Murzin (8):
ARM: NOMMU: Move out MPU setup in separate module
ARM: NOMMU: Update MPU accessors to use cp15 helpers
ARM: NOMMU: Rework MPU to be mostly done in C
ARM: NOMMU: Disallow MPU for XIP
ARM: Kconfig: Kill CONFIG_VECTORS_BASE
ARM: V7M: Add support for MPU to M-class
ARM: NOMMU: Use more MPU regions to cover memory
ARM: NOMMU: Support MPU in XIP configuration

Quoted 16 lines
 arch/arm/Kconfig                  |   9 -
 arch/arm/Kconfig-nommu            |   4 +-
 arch/arm/include/asm/cputype.h    |  10 +
 arch/arm/include/asm/mpu.h        |  26 +-
 arch/arm/include/asm/smp.h        |   2 +-
 arch/arm/include/asm/v7m.h        |  10 +
 arch/arm/kernel/asm-offsets.c     |  11 +
 arch/arm/kernel/head-nommu.S      | 148 +++++++++---
 arch/arm/kernel/smp.c             |   2 +-
 arch/arm/kernel/vmlinux-xip.lds.S |  23 ++
 arch/arm/mm/Makefile              |   1 +
 arch/arm/mm/nommu.c               | 254 +-------------------
 arch/arm/mm/pmsa-v7.c             | 484 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 682 insertions(+), 302 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#17 lore raw

v3 cover ARM: NOMMU: MPU updates

Quoted 5 lines · Vladimir Murzin
Quoted 4 lines · Russell King - ARM Linux

Sorry, but I have no working MPS3 platform since it killed its uSD card with all the FPGA bitstreams on. I'm waiting (since end of September) for a replacement from ARM Ltd but there hasn't yet been any progress.

Quoted 8 lines
Quoted 2 lines

Sure, I can replace the uSD card myself, but the problem is the contents of the card.

Thanks for prompt reply!

I should say that board won't help you with testing this series since it implements different MPU model (I have patches for that too but they are on top of this series).

It assists as far as making sure the changes don't cause a regression for the platform.

Quoted 6 lines

I've been working closely with Alex and Andr?s (since they needed this for their Cortex-M7 platform) to make sure it works as expected. It was also tested with R-class FastModels.

I intentionally kept CONFIG_ARM_MPU disabled by default for M-class (PATCH 6/8), so it won't interfere with existing bootloaders.

It looks like patch 6 will allow me to select ARM_MPU for the MPS3 config (by way of CPU_V7M being enabled). As I'm unable to test what effect that has here, and I don't know when I'll be able to do so, please check if not already done so.

Quoted 2 lines

I'd be glad if you can review the series and give it a chance to sit in linux-next (I can provide a branch on top of yours for-next).

Please never provide a branch on top of my for-next, it's an "unstable" commit in that it's regenerated from several sub-branches (fixes, misc, devel-stable, and whatever other work I want to include in linux-next.)

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
#18 lore raw

v3 cover ARM: NOMMU: MPU updates

Quoted 22 lines · Russell King - ARM Linux
Quoted 5 lines · Vladimir Murzin
Quoted 4 lines · Russell King - ARM Linux

Sorry, but I have no working MPS3 platform since it killed its uSD card with all the FPGA bitstreams on. I'm waiting (since end of September) for a replacement from ARM Ltd but there hasn't yet been any progress.

Quoted 8 lines
Quoted 2 lines

Sure, I can replace the uSD card myself, but the problem is the contents of the card.

Thanks for prompt reply!

I should say that board won't help you with testing this series since it implements different MPU model (I have patches for that too but they are on top of this series).

It assists as far as making sure the changes don't cause a regression for the platform.

Quoted 4 lines

I've been working closely with Alex and Andr?s (since they needed this for their Cortex-M7 platform) to make sure it works as expected. It was also tested with R-class FastModels.

Quoted 7 lines
Quoted 2 lines

I intentionally kept CONFIG_ARM_MPU disabled by default for M-class (PATCH 6/8), so it won't interfere with existing bootloaders.

It looks like patch 6 will allow me to select ARM_MPU for the MPS3 config (by way of CPU_V7M being enabled). As I'm unable to test what effect that has here, and I don't know when I'll be able to do so, please check if not already done so.

It was done. To ensure that there is a change in PATCH 3/8

@@ -204,13 +205,13 @@ ENTRY(__setup_mpu)

        mrc     p15, 0, r0, c0, c1, 4           @ Read ID_MMFR0
        and     r0, r0, #(MMFR0_PMSA)           @ PMSA field
        teq     r0, #(MMFR0_PMSAv7)             @ PMSA v7
-       bne     __error_p                       @ Fail: ARM_MPU on NOT v7 PMSA
+       bxne    lr

the C side already had a check in mpu_setup()

if (!mpu_present())
return;

Quoted 8 lines
Quoted 3 lines

I'd be glad if you can review the series and give it a chance to sit in linux-next (I can provide a branch on top of yours for-next).

Please never provide a branch on top of my for-next, it's an "unstable" commit in that it's regenerated from several sub-branches (fixes, misc, devel-stable, and whatever other work I want to include in linux-next.)

Ok, got it! It seems the right branch is devel-stable. Unless you have comments, I'd like to submit patches in your patch system.

Thanks
Vladimir

#19 lore raw

v3 cover ARM: NOMMU: MPU updates

In reply to Vladimir Murzin

2017-09-25 11:05 GMT+02:00 Vladimir Murzin <[email protected]>:

Quoted 29 lines

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

Quoted 4 lines

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

for the whole serie on stm32f4 and stm32f7:

Quoted 35 lines

Vladimir Murzin (8):
ARM: NOMMU: Move out MPU setup in separate module
ARM: NOMMU: Update MPU accessors to use cp15 helpers
ARM: NOMMU: Rework MPU to be mostly done in C
ARM: NOMMU: Disallow MPU for XIP
ARM: Kconfig: Kill CONFIG_VECTORS_BASE
ARM: V7M: Add support for MPU to M-class
ARM: NOMMU: Use more MPU regions to cover memory
ARM: NOMMU: Support MPU in XIP configuration

 arch/arm/Kconfig                  |   9 -
 arch/arm/Kconfig-nommu            |   4 +-
 arch/arm/include/asm/cputype.h    |  10 +
 arch/arm/include/asm/mpu.h        |  26 +-
 arch/arm/include/asm/smp.h        |   2 +-
 arch/arm/include/asm/v7m.h        |  10 +
 arch/arm/kernel/asm-offsets.c     |  11 +
 arch/arm/kernel/head-nommu.S      | 148 +++++++++---
 arch/arm/kernel/smp.c             |   2 +-
 arch/arm/kernel/vmlinux-xip.lds.S |  23 ++
 arch/arm/mm/Makefile              |   1 +
 arch/arm/mm/nommu.c               | 254 +-------------------
 arch/arm/mm/pmsa-v7.c             | 484 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 682 insertions(+), 302 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c

--
1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 7 lines
Benjamin Gaignard

Graphic Study Group

Linaro.org ? Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
#20 lore raw

v3 cover ARM: NOMMU: MPU updates

Quoted 30 lines · Benjamin Gaignard

2017-09-25 11:05 GMT+02:00 Vladimir Murzin <[email protected]>:

Quoted 29 lines

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

Quoted 8 lines
Quoted 4 lines

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

for the whole serie on stm32f4 and stm32f7:

Thanks for giving it a try!

The series is already in Russell's patch system, so I dunno how to add your Tested-by, maybe Russell can made an update when he pull patches in his tree...

Cheers
Vladimir

Quoted 39 lines
Quoted 36 lines

Vladimir Murzin (8):
ARM: NOMMU: Move out MPU setup in separate module
ARM: NOMMU: Update MPU accessors to use cp15 helpers
ARM: NOMMU: Rework MPU to be mostly done in C
ARM: NOMMU: Disallow MPU for XIP
ARM: Kconfig: Kill CONFIG_VECTORS_BASE
ARM: V7M: Add support for MPU to M-class
ARM: NOMMU: Use more MPU regions to cover memory
ARM: NOMMU: Support MPU in XIP configuration

 arch/arm/Kconfig                  |   9 -
 arch/arm/Kconfig-nommu            |   4 +-
 arch/arm/include/asm/cputype.h    |  10 +
 arch/arm/include/asm/mpu.h        |  26 +-
 arch/arm/include/asm/smp.h        |   2 +-
 arch/arm/include/asm/v7m.h        |  10 +
 arch/arm/kernel/asm-offsets.c     |  11 +
 arch/arm/kernel/head-nommu.S      | 148 +++++++++---
 arch/arm/kernel/smp.c             |   2 +-
 arch/arm/kernel/vmlinux-xip.lds.S |  23 ++
 arch/arm/mm/Makefile              |   1 +
 arch/arm/mm/nommu.c               | 254 +-------------------
 arch/arm/mm/pmsa-v7.c             | 484 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 682 insertions(+), 302 deletions(-)
 create mode 100644 arch/arm/mm/pmsa-v7.c

--
1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#21 lore raw

v3 cover ARM: NOMMU: MPU updates

Quoted 38 lines · Vladimir Murzin
Quoted 37 lines · Benjamin Gaignard

2017-09-25 11:05 GMT+02:00 Vladimir Murzin <[email protected]>:

Quoted 29 lines

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

Quoted 4 lines

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

for the whole serie on stm32f4 and stm32f7:

Quoted 7 lines
Quoted 1 line

Thanks for giving it a try!

The series is already in Russell's patch system, so I dunno how to add your Tested-by, maybe Russell can made an update when he pull patches in his tree...

Applied, along with the tested-by, and with the fixup patch folded.

However, I notice that with "Szemz? Andr?s" name, the ? character has been replaced by a "?" somewhere along the lines (and my VT console can't even display it, so (a) I've no idea what character it's supposed to be, and (b) I can't cut'n'paste it either - as illustrated by my pasting above making it come out as a rectangular block.)

The problem I have is that if I push these patches out, as soon as I do, I can't fix this up, because it's the "devel-stable" branch - and the promise I make to everyone is that branch is never rebased (which is why it has the -stable suffix.) Once commits are published in that branch, they're set in stone.

Quoted 1 line

From what I can tell, the patches were emailed to the patch system,

which means it would've gone through perl's Unicode::Map8 - internally the patch system uses UTF-8 to store the summary and description, while preserving the patch as a byte stream. Your emails to the list claim to be UTF-8, so it should've been a no-op. So, don't know what has happened, and I can't fix it at the moment, not even in the actual commits.

So, I won't be pushing this out, nor will I be marking the patches as applied in the patch system until I have some kind of solution.

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
#22 lore raw

v3 cover ARM: NOMMU: MPU updates

Quoted 69 lines · Russell King - ARM Linux
Quoted 38 lines · Vladimir Murzin
Quoted 37 lines · Benjamin Gaignard

2017-09-25 11:05 GMT+02:00 Vladimir Murzin <[email protected]>:

Quoted 29 lines

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

Quoted 4 lines

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

for the whole serie on stm32f4 and stm32f7:

Quoted 7 lines
Quoted 1 line

Thanks for giving it a try!

The series is already in Russell's patch system, so I dunno how to add your Tested-by, maybe Russell can made an update when he pull patches in his tree...

Applied, along with the tested-by, and with the fixup patch folded.

However, I notice that with "Szemz? Andr?s" name, the ? character has been replaced by a "?" somewhere along the lines (and my VT console can't even display it, so (a) I've no idea what character it's supposed to be, and (b) I can't cut'n'paste it either - as illustrated by my pasting above making it come out as a rectangular block.)

The problem I have is that if I push these patches out, as soon as I do, I can't fix this up, because it's the "devel-stable" branch - and the promise I make to everyone is that branch is never rebased (which is why it has the -stable suffix.) Once commits are published in that branch, they're set in stone.

From what I can tell, the patches were emailed to the patch system, which means it would've gone through perl's Unicode::Map8 - internally the patch system uses UTF-8 to store the summary and description, while preserving the patch as a byte stream. Your emails to the list claim to be UTF-8, so it should've been a no-op. So, don't know what has happened, and I can't fix it at the moment, not even in the actual commits.

Quoted 2 lines

So, I won't be pushing this out, nor will I be marking the patches as applied in the patch system until I have some kind of solution.

Okay, seems not to be the patch system's email parsing - saving one of your messages from the list and feeding that into the mail parser gives correct results - utf-8 bytes of 0xc5 0x91, which would've been placed into mysql over a connection using utf-8 encoding.

What I know is that reading it out of mysql over a utf-8 encoding gives a '?' (0x3f) for that character. What I don't know is whether it's mysql having this behaviour, or whether your message was received with the character already converted to a '?'.

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
#23 lore raw

v3 cover ARM: NOMMU: MPU updates

Quoted 78 lines · Russell King - ARM Linux
Quoted 69 lines · Russell King - ARM Linux
Quoted 38 lines · Vladimir Murzin
Quoted 37 lines · Benjamin Gaignard

2017-09-25 11:05 GMT+02:00 Vladimir Murzin <[email protected]>:

Quoted 29 lines

Hi,

This is an update of the existent MPU code which consist set of clean-ups and enhancements. The most significant changes are in the way how MPU settings sync-up for secondaries (PATCH 3/8), more flexible layout for memory (PATCH 7/8) and support for XIP (PATCH 8/8). Since there is no in-tree user of MPU, support for M-class has been added (PATCH 6/8).

There is also practical benefit of patch set:

"These MPU patches introduce a nice feature that it simplifies the
bootloader: do not need to setup the MPU, for example for coherent DMA region, which is described in device-tree too." Andr?s Szemz?

Changelog:
v2 -> v3
- fixed support for XIP (PATCH 8/8)
- rebased on 4.14-rc2

v1 -> v2
- support for XIP (PATCH 8/8)
- rebased on 4.13-rc1

RFC v2 -> v1
- dropped RFC tag
- Tested-by from Andr?s
- rebased on 4.12-rc5

Quoted 4 lines

RFC -> RFC v2
- fixed MPU enable for v7m (PATCH 6/7)

Thanks!

for the whole serie on stm32f4 and stm32f7:

Quoted 7 lines
Quoted 1 line

Thanks for giving it a try!

The series is already in Russell's patch system, so I dunno how to add your Tested-by, maybe Russell can made an update when he pull patches in his tree...

Applied, along with the tested-by, and with the fixup patch folded.

However, I notice that with "Szemz? Andr?s" name, the ? character has been replaced by a "?" somewhere along the lines (and my VT console can't even display it, so (a) I've no idea what character it's supposed to be, and (b) I can't cut'n'paste it either - as illustrated by my pasting above making it come out as a rectangular block.)

The problem I have is that if I push these patches out, as soon as I do, I can't fix this up, because it's the "devel-stable" branch - and the promise I make to everyone is that branch is never rebased (which is why it has the -stable suffix.) Once commits are published in that branch, they're set in stone.

From what I can tell, the patches were emailed to the patch system, which means it would've gone through perl's Unicode::Map8 - internally the patch system uses UTF-8 to store the summary and description, while preserving the patch as a byte stream. Your emails to the list claim to be UTF-8, so it should've been a no-op. So, don't know what has happened, and I can't fix it at the moment, not even in the actual commits.

Quoted 2 lines

So, I won't be pushing this out, nor will I be marking the patches as applied in the patch system until I have some kind of solution.

Okay, seems not to be the patch system's email parsing - saving one of your messages from the list and feeding that into the mail parser gives correct results - utf-8 bytes of 0xc5 0x91, which would've been placed into mysql over a connection using utf-8 encoding.

Quoted 5 lines

What I know is that reading it out of mysql over a utf-8 encoding gives a '?' (0x3f) for that character. What I don't know is whether it's mysql having this behaviour, or whether your message was received with the character already converted to a '?'.

Patches where send one by one with (smtp related options are omitted)

git send-email --suppress-cc=all --no-thread --to patches at armlinux.org.uk

If you want I can send a patch to you directly, so you can see if it arrives converted or not.

Cheers
Vladimir