All of lore.kernel.org
 help / color / mirror / Atom feed
From: vladimir.murzin@arm.com (Vladimir Murzin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: nommu: fix PMSAv7 setup
Date: Fri, 22 Apr 2016 12:43:34 +0100	[thread overview]
Message-ID: <1461325416-29570-2-git-send-email-vladimir.murzin@arm.com> (raw)
In-Reply-To: <1461325416-29570-1-git-send-email-vladimir.murzin@arm.com>

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

  reply	other threads:[~2016-04-22 11:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 11:43 [PATCH 0/3] ARM: nommu: R-class fixes Vladimir Murzin
2016-04-22 11:43 ` Vladimir Murzin [this message]
2016-04-22 11:43 ` [PATCH 2/3] ARM: nommu: change memory reserve for the vectors Vladimir Murzin
2016-04-22 11:43 ` [PATCH 3/3] ARM: domain: move {set,get}_domain under config guard Vladimir Murzin
2016-04-27 10:49   ` [PATCH 3/3] ARM: domain: move {set, get}_domain " Russell King - ARM Linux
2016-04-27 12:16     ` Vladimir Murzin
2016-04-28 13:50       ` Russell King - ARM Linux
2016-04-28 14:44         ` Vladimir Murzin
2016-04-28 14:59           ` Russell King - ARM Linux
2016-04-28 15:06             ` Vladimir Murzin
2016-04-23  6:54 ` [PATCH 0/3] ARM: nommu: R-class fixes Afzal Mohammed
2016-04-25  7:55   ` Vladimir Murzin
2016-04-25 12:59     ` Arnd Bergmann
2016-04-25 13:30       ` Afzal Mohammed
2016-04-26  8:17         ` Vladimir Murzin
2016-04-26  8:17       ` Vladimir Murzin
2016-04-26  9:10         ` Arnd Bergmann
2016-04-26 10:57           ` Vladimir Murzin
2016-04-26 11:59             ` Arnd Bergmann
2016-04-26 12:24               ` Vladimir Murzin
2016-04-26 18:12                 ` Arnd Bergmann
2016-04-27  9:10                   ` Vladimir Murzin
2016-04-27  9:50                     ` Arnd Bergmann
2016-04-27 10:55                       ` Vladimir Murzin
2016-04-27 11:18                         ` Arnd Bergmann
2016-04-26 15:23               ` Afzal Mohammed
2016-04-28  9:41                 ` Maxime Coquelin

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1461325416-29570-2-git-send-email-vladimir.murzin@arm.com \
    --to=vladimir.murzin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

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

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