linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] ARM: nommu: R-class fixes
@ 2016-04-28 16:51 Vladimir Murzin
  2016-04-28 16:51 ` [PATCH v2 1/3] ARM: nommu: fix PMSAv7 setup Vladimir Murzin
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Vladimir Murzin @ 2016-04-28 16:51 UTC (permalink / raw)
  To: linux-arm-kernel

Small set of fixes discovered with R-class cores.

Jean-Philippe Brucker (2):
  ARM: nommu: fix PMSAv7 setup
  ARM: nommu: change memory reserve for the vectors

Vladimir Murzin (1):
  ARM: domain: move {set,get}_domain under config guard

 arch/arm/include/asm/domain.h |   11 +++++++++++
 arch/arm/kernel/head-nommu.S  |    2 +-
 arch/arm/mm/nommu.c           |   15 ++++++++-------
 3 files changed, 20 insertions(+), 8 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] ARM: nommu: fix PMSAv7 setup
  2016-04-28 16:51 [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
@ 2016-04-28 16:51 ` Vladimir Murzin
  2016-04-28 16:51 ` [PATCH v2 2/3] ARM: nommu: change memory reserve for the vectors Vladimir Murzin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Vladimir Murzin @ 2016-04-28 16:51 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

Commit 1c2f87c (ARM: 8025/1: Get rid of meminfo) broke the support for
MPU on ARMv7-R. This patch adapts the code inside CONFIG_ARM_MPU to use
memblocks appropriately.

MPU initialisation only uses the first memory region, and removes all
subsequent ones. Because looping over all regions that need removal is
inefficient, and memblock_remove already handles memory ranges, we can
flatten the 'for_each_memblock' part.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/mm/nommu.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 1dd1093..4d113fc 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -87,7 +87,6 @@ static unsigned long irbar_read(void)
 /* MPU initialisation functions */
 void __init sanity_check_meminfo_mpu(void)
 {
-	int i;
 	phys_addr_t phys_offset = PHYS_OFFSET;
 	phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size;
 	struct memblock_region *reg;
@@ -110,11 +109,13 @@ void __init sanity_check_meminfo_mpu(void)
 		} else {
 			/*
 			 * memblock auto merges contiguous blocks, remove
-			 * all blocks afterwards
+			 * all blocks afterwards in one go (we can't remove
+			 * blocks separately while iterating)
 			 */
 			pr_notice("Ignoring RAM after %pa, memory at %pa ignored\n",
-				  &mem_start, &reg->base);
-			memblock_remove(reg->base, reg->size);
+				  &mem_end, &reg->base);
+			memblock_remove(reg->base, 0 - reg->base);
+			break;
 		}
 	}
 
@@ -144,7 +145,7 @@ void __init sanity_check_meminfo_mpu(void)
 		pr_warn("Truncating memory from %pa to %pa (MPU region constraints)",
 				&specified_mem_size, &aligned_region_size);
 		memblock_remove(mem_start + aligned_region_size,
-				specified_mem_size - aligned_round_size);
+				specified_mem_size - aligned_region_size);
 
 		mem_end = mem_start + aligned_region_size;
 	}
@@ -261,7 +262,7 @@ void __init mpu_setup(void)
 		return;
 
 	region_err = mpu_setup_region(MPU_RAM_REGION, PHYS_OFFSET,
-					ilog2(meminfo.bank[0].size),
+					ilog2(memblock.memory.regions[0].size),
 					MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL);
 	if (region_err) {
 		panic("MPU region initialization failure! %d", region_err);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] ARM: nommu: change memory reserve for the vectors
  2016-04-28 16:51 [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
  2016-04-28 16:51 ` [PATCH v2 1/3] ARM: nommu: fix PMSAv7 setup Vladimir Murzin
@ 2016-04-28 16:51 ` Vladimir Murzin
  2016-04-28 16:51 ` [PATCH v2 3/3] ARM: domain: move {set,get}_domain under config guard Vladimir Murzin
  2016-05-03 10:22 ` [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
  3 siblings, 0 replies; 9+ messages in thread
From: Vladimir Murzin @ 2016-04-28 16:51 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

Commit 19accfd3 (ARM: move vector stubs) moved the vector stubs in an
additional page above the base vector one. This change wasn't taken into
account by the nommu memreserve.
This patch ensures that the kernel won't overwrite any vector stub on
nommu.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
[changed the MPU side too]
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/kernel/head-nommu.S |    2 +-
 arch/arm/mm/nommu.c          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 9b8c5a1..fb1a69e 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -236,7 +236,7 @@ ENTRY(__setup_mpu)
 	mov	r0, #CONFIG_VECTORS_BASE	@ Cover from VECTORS_BASE
 	ldr	r5,=(MPU_AP_PL1RW_PL0NA | MPU_RGN_NORMAL)
 	/* Writing N to bits 5:1 (RSR_SZ) --> region size 2^N+1 */
-	mov	r6, #(((PAGE_SHIFT - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN)
+	mov	r6, #(((2 * PAGE_SHIFT - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN)
 
 	setup_region r0, r5, r6, MPU_DATA_SIDE	@ VECTORS_BASE, PL0 NA, enabled
 	beq	3f				@ Memory-map not unified
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 4d113fc..d5805e4 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -286,7 +286,7 @@ void __init arm_mm_memblock_reserve(void)
 	 * some architectures which the DRAM is the exception vector to trap,
 	 * alloc_page breaks with error, although it is not NULL, but "0."
 	 */
-	memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
+	memblock_reserve(CONFIG_VECTORS_BASE, 2 * PAGE_SIZE);
 #else /* ifndef CONFIG_CPU_V7M */
 	/*
 	 * There is no dedicated vector page on V7-M. So nothing needs to be
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] ARM: domain: move {set,get}_domain under config guard
  2016-04-28 16:51 [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
  2016-04-28 16:51 ` [PATCH v2 1/3] ARM: nommu: fix PMSAv7 setup Vladimir Murzin
  2016-04-28 16:51 ` [PATCH v2 2/3] ARM: nommu: change memory reserve for the vectors Vladimir Murzin
@ 2016-04-28 16:51 ` Vladimir Murzin
  2016-05-03 10:22 ` [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
  3 siblings, 0 replies; 9+ messages in thread
From: Vladimir Murzin @ 2016-04-28 16:51 UTC (permalink / raw)
  To: linux-arm-kernel

Recursive undefined instrcution falut is seen with R-class taking an
exception. The reson for that is __show_regs() tries to get domain
information, but domains is not available on !MMU cores, like R/M
class.

Fix it by puting {set,get}_domain functions under CONFIG_CPU_CP15_MMU
guard and providing stubs for the case where domains is not supported.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
Changelog:
    v1 -> v2
       - use CPU_CP15_MMU and don't disable SW PAN (per Russell)

arch/arm/include/asm/domain.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index fc8ba16..99d9f63 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -84,6 +84,7 @@
 
 #ifndef __ASSEMBLY__
 
+#ifdef CONFIG_CPU_CP15_MMU
 static inline unsigned int get_domain(void)
 {
 	unsigned int domain;
@@ -103,6 +104,16 @@ static inline void set_domain(unsigned val)
 	  : : "r" (val) : "memory");
 	isb();
 }
+#else
+static inline unsigned int get_domain(void)
+{
+	return 0;
+}
+
+static inline void set_domain(unsigned val)
+{
+}
+#endif
 
 #ifdef CONFIG_CPU_USE_DOMAINS
 #define modify_domain(dom,type)					\
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 0/3] ARM: nommu: R-class fixes
  2016-04-28 16:51 [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
                   ` (2 preceding siblings ...)
  2016-04-28 16:51 ` [PATCH v2 3/3] ARM: domain: move {set,get}_domain under config guard Vladimir Murzin
@ 2016-05-03 10:22 ` Vladimir Murzin
  2016-05-03 10:32   ` Russell King - ARM Linux
  3 siblings, 1 reply; 9+ messages in thread
From: Vladimir Murzin @ 2016-05-03 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

On 28/04/16 17:51, Vladimir Murzin wrote:
> Small set of fixes discovered with R-class cores.
> 
> Jean-Philippe Brucker (2):
>   ARM: nommu: fix PMSAv7 setup
>   ARM: nommu: change memory reserve for the vectors
> 
> Vladimir Murzin (1):
>   ARM: domain: move {set,get}_domain under config guard
> 
>  arch/arm/include/asm/domain.h |   11 +++++++++++
>  arch/arm/kernel/head-nommu.S  |    2 +-
>  arch/arm/mm/nommu.c           |   15 ++++++++-------
>  3 files changed, 20 insertions(+), 8 deletions(-)
> 

Russell, any objection to get it into patch tracker?

Thanks
Vladimir

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/3] ARM: nommu: R-class fixes
  2016-05-03 10:22 ` [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
@ 2016-05-03 10:32   ` Russell King - ARM Linux
  2016-05-03 10:41     ` Vladimir Murzin
  0 siblings, 1 reply; 9+ messages in thread
From: Russell King - ARM Linux @ 2016-05-03 10:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 03, 2016 at 11:22:17AM +0100, Vladimir Murzin wrote:
> On 28/04/16 17:51, Vladimir Murzin wrote:
> > Small set of fixes discovered with R-class cores.
> > 
> > Jean-Philippe Brucker (2):
> >   ARM: nommu: fix PMSAv7 setup
> >   ARM: nommu: change memory reserve for the vectors
> > 
> > Vladimir Murzin (1):
> >   ARM: domain: move {set,get}_domain under config guard
> > 
> >  arch/arm/include/asm/domain.h |   11 +++++++++++
> >  arch/arm/kernel/head-nommu.S  |    2 +-
> >  arch/arm/mm/nommu.c           |   15 ++++++++-------
> >  3 files changed, 20 insertions(+), 8 deletions(-)
> > 
> 
> Russell, any objection to get it into patch tracker?

I've not had any chance to look at them yet - last weekend, I was away
from Thursday through until late Tuesday, then I spent most of Wednesday
and Thursday catching up.  Friday I was able to look at some stuff, and
then I've spent the bank holiday weekend digging out laurels in the front
garden.  I've only just today got back to looking at some kernel stuff.

So really, I've only had two days in the last week and a half to look at
anything.

Please wait a little while longer.  Thanks.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/3] ARM: nommu: R-class fixes
  2016-05-03 10:32   ` Russell King - ARM Linux
@ 2016-05-03 10:41     ` Vladimir Murzin
  2016-05-03 20:44       ` Russell King - ARM Linux
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Murzin @ 2016-05-03 10:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/05/16 11:32, Russell King - ARM Linux wrote:
> On Tue, May 03, 2016 at 11:22:17AM +0100, Vladimir Murzin wrote:
>> On 28/04/16 17:51, Vladimir Murzin wrote:
>>> Small set of fixes discovered with R-class cores.
>>>
>>> Jean-Philippe Brucker (2):
>>>   ARM: nommu: fix PMSAv7 setup
>>>   ARM: nommu: change memory reserve for the vectors
>>>
>>> Vladimir Murzin (1):
>>>   ARM: domain: move {set,get}_domain under config guard
>>>
>>>  arch/arm/include/asm/domain.h |   11 +++++++++++
>>>  arch/arm/kernel/head-nommu.S  |    2 +-
>>>  arch/arm/mm/nommu.c           |   15 ++++++++-------
>>>  3 files changed, 20 insertions(+), 8 deletions(-)
>>>
>>
>> Russell, any objection to get it into patch tracker?
> 
> I've not had any chance to look at them yet - last weekend, I was away
> from Thursday through until late Tuesday, then I spent most of Wednesday
> and Thursday catching up.  Friday I was able to look at some stuff, and
> then I've spent the bank holiday weekend digging out laurels in the front
> garden.  I've only just today got back to looking at some kernel stuff.
> 
> So really, I've only had two days in the last week and a half to look at
> anything.
> 
> Please wait a little while longer.  Thanks.

Thanks for prompt reply! I wasn't aware you've been off, patches can wait.

Cheers
Vladimir

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/3] ARM: nommu: R-class fixes
  2016-05-03 10:41     ` Vladimir Murzin
@ 2016-05-03 20:44       ` Russell King - ARM Linux
  2016-05-04  9:40         ` Vladimir Murzin
  0 siblings, 1 reply; 9+ messages in thread
From: Russell King - ARM Linux @ 2016-05-03 20:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 03, 2016 at 11:41:51AM +0100, Vladimir Murzin wrote:
> On 03/05/16 11:32, Russell King - ARM Linux wrote:
> > On Tue, May 03, 2016 at 11:22:17AM +0100, Vladimir Murzin wrote:
> >> On 28/04/16 17:51, Vladimir Murzin wrote:
> >>> Small set of fixes discovered with R-class cores.
> >>>
> >>> Jean-Philippe Brucker (2):
> >>>   ARM: nommu: fix PMSAv7 setup
> >>>   ARM: nommu: change memory reserve for the vectors
> >>>
> >>> Vladimir Murzin (1):
> >>>   ARM: domain: move {set,get}_domain under config guard
> >>>
> >>>  arch/arm/include/asm/domain.h |   11 +++++++++++
> >>>  arch/arm/kernel/head-nommu.S  |    2 +-
> >>>  arch/arm/mm/nommu.c           |   15 ++++++++-------
> >>>  3 files changed, 20 insertions(+), 8 deletions(-)
> >>>
> >>
> >> Russell, any objection to get it into patch tracker?
> > 
> > I've not had any chance to look at them yet - last weekend, I was away
> > from Thursday through until late Tuesday, then I spent most of Wednesday
> > and Thursday catching up.  Friday I was able to look at some stuff, and
> > then I've spent the bank holiday weekend digging out laurels in the front
> > garden.  I've only just today got back to looking at some kernel stuff.
> > 
> > So really, I've only had two days in the last week and a half to look at
> > anything.
> > 
> > Please wait a little while longer.  Thanks.
> 
> Thanks for prompt reply! I wasn't aware you've been off, patches can wait.

Thanks for waiting, I've now looked through them and they look fine to me.

Please put them in the patch system, thanks.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/3] ARM: nommu: R-class fixes
  2016-05-03 20:44       ` Russell King - ARM Linux
@ 2016-05-04  9:40         ` Vladimir Murzin
  0 siblings, 0 replies; 9+ messages in thread
From: Vladimir Murzin @ 2016-05-04  9:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/05/16 21:44, Russell King - ARM Linux wrote:
> On Tue, May 03, 2016 at 11:41:51AM +0100, Vladimir Murzin wrote:
>> On 03/05/16 11:32, Russell King - ARM Linux wrote:
>>> On Tue, May 03, 2016 at 11:22:17AM +0100, Vladimir Murzin wrote:
>>>> On 28/04/16 17:51, Vladimir Murzin wrote:
>>>>> Small set of fixes discovered with R-class cores.
>>>>>
>>>>> Jean-Philippe Brucker (2):
>>>>>   ARM: nommu: fix PMSAv7 setup
>>>>>   ARM: nommu: change memory reserve for the vectors
>>>>>
>>>>> Vladimir Murzin (1):
>>>>>   ARM: domain: move {set,get}_domain under config guard
>>>>>
>>>>>  arch/arm/include/asm/domain.h |   11 +++++++++++
>>>>>  arch/arm/kernel/head-nommu.S  |    2 +-
>>>>>  arch/arm/mm/nommu.c           |   15 ++++++++-------
>>>>>  3 files changed, 20 insertions(+), 8 deletions(-)
>>>>>
>>>>
>>>> Russell, any objection to get it into patch tracker?
>>>
>>> I've not had any chance to look at them yet - last weekend, I was away
>>> from Thursday through until late Tuesday, then I spent most of Wednesday
>>> and Thursday catching up.  Friday I was able to look at some stuff, and
>>> then I've spent the bank holiday weekend digging out laurels in the front
>>> garden.  I've only just today got back to looking at some kernel stuff.
>>>
>>> So really, I've only had two days in the last week and a half to look at
>>> anything.
>>>
>>> Please wait a little while longer.  Thanks.
>>
>> Thanks for prompt reply! I wasn't aware you've been off, patches can wait.
> 
> Thanks for waiting, I've now looked through them and they look fine to me.
> 
> Please put them in the patch system, thanks.
> 

Thanks for your time! Patches in the patch system now.

Cheers
Vladimir

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-05-04  9:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 16:51 [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
2016-04-28 16:51 ` [PATCH v2 1/3] ARM: nommu: fix PMSAv7 setup Vladimir Murzin
2016-04-28 16:51 ` [PATCH v2 2/3] ARM: nommu: change memory reserve for the vectors Vladimir Murzin
2016-04-28 16:51 ` [PATCH v2 3/3] ARM: domain: move {set,get}_domain under config guard Vladimir Murzin
2016-05-03 10:22 ` [PATCH v2 0/3] ARM: nommu: R-class fixes Vladimir Murzin
2016-05-03 10:32   ` Russell King - ARM Linux
2016-05-03 10:41     ` Vladimir Murzin
2016-05-03 20:44       ` Russell King - ARM Linux
2016-05-04  9:40         ` Vladimir Murzin

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).