linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 11/21] memblock: make memblock_find_in_range_node() and choose_memblock_flags() static
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

These functions are not used outside memblock. Make them static.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 include/linux/memblock.h | 4 ----
 mm/memblock.c            | 4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index cf4cd9c..f5a83a1 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -111,9 +111,6 @@ void memblock_discard(void);
 #define memblock_dbg(fmt, ...) \
 	if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 
-phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align,
-					phys_addr_t start, phys_addr_t end,
-					int nid, enum memblock_flags flags);
 phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
 				   phys_addr_t size, phys_addr_t align);
 void memblock_allow_resize(void);
@@ -130,7 +127,6 @@ int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
 int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
 int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
 int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
-enum memblock_flags choose_memblock_flags(void);
 
 unsigned long memblock_free_all(void);
 void reset_node_managed_pages(pg_data_t *pgdat);
diff --git a/mm/memblock.c b/mm/memblock.c
index 739f769..03b3929 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -125,7 +125,7 @@ static int memblock_can_resize __initdata_memblock;
 static int memblock_memory_in_slab __initdata_memblock = 0;
 static int memblock_reserved_in_slab __initdata_memblock = 0;
 
-enum memblock_flags __init_memblock choose_memblock_flags(void)
+static enum memblock_flags __init_memblock choose_memblock_flags(void)
 {
 	return system_has_some_mirror ? MEMBLOCK_MIRROR : MEMBLOCK_NONE;
 }
@@ -254,7 +254,7 @@ __memblock_find_range_top_down(phys_addr_t start, phys_addr_t end,
  * Return:
  * Found address on success, 0 on failure.
  */
-phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size,
+static phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size,
 					phys_addr_t align, phys_addr_t start,
 					phys_addr_t end, int nid,
 					enum memblock_flags flags)
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 10/21] memblock: refactor internal allocation functions
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

Currently, memblock has several internal functions with overlapping
functionality. They all call memblock_find_in_range_node() to find free
memory and then reserve the allocated range and mark it with kmemleak.
However, there is difference in the allocation constraints and in fallback
strategies.

The allocations returning physical address first attempt to find free
memory on the specified node within mirrored memory regions, then retry on
the same node without the requirement for memory mirroring and finally fall
back to all available memory.

The allocations returning virtual address start with clamping the allowed
range to memblock.current_limit, attempt to allocate from the specified
node from regions with mirroring and with user defined minimal address. If
such allocation fails, next attempt is done with node restriction lifted.
Next, the allocation is retried with minimal address reset to zero and at
last without the requirement for mirrored regions.

Let's consolidate various fallbacks handling and make them more consistent
for physical and virtual variants. Most of the fallback handling is moved
to memblock_alloc_range_nid() and it now handles node and mirror fallbacks.

The memblock_alloc_internal() uses memblock_alloc_range_nid() to get a
physical address of the allocated range and converts it to virtual address.

The fallback for allocation below the specified minimal address remains in
memblock_alloc_internal() because memblock_alloc_range_nid() is used by CMA
with exact requirement for lower bounds.

The memblock_phys_alloc_nid() function is completely dropped as it is not
used anywhere outside memblock and its only usage can be replaced by a call
to memblock_alloc_range_nid().

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 include/linux/memblock.h |   1 -
 mm/memblock.c            | 173 +++++++++++++++++++++--------------------------
 2 files changed, 78 insertions(+), 96 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 6874fdc..cf4cd9c 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -371,7 +371,6 @@ static inline int memblock_get_region_node(const struct memblock_region *r)
 
 phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align,
 				      phys_addr_t start, phys_addr_t end);
-phys_addr_t memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
 phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
 
 static inline phys_addr_t memblock_phys_alloc(phys_addr_t size,
diff --git a/mm/memblock.c b/mm/memblock.c
index 531fa77..739f769 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1312,30 +1312,84 @@ __next_mem_pfn_range_in_zone(u64 *idx, struct zone *zone,
 
 #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */
 
+/**
+ * memblock_alloc_range_nid - allocate boot memory block
+ * @size: size of memory block to be allocated in bytes
+ * @align: alignment of the region and block's size
+ * @start: the lower bound of the memory region to allocate (phys address)
+ * @end: the upper bound of the memory region to allocate (phys address)
+ * @nid: nid of the free area to find, %NUMA_NO_NODE for any node
+ *
+ * The allocation is performed from memory region limited by
+ * memblock.current_limit if @max_addr == %MEMBLOCK_ALLOC_ACCESSIBLE.
+ *
+ * If the specified node can not hold the requested memory the
+ * allocation falls back to any node in the system
+ *
+ * For systems with memory mirroring, the allocation is attempted first
+ * from the regions with mirroring enabled and then retried from any
+ * memory region.
+ *
+ * In addition, function sets the min_count to 0 using kmemleak_alloc_phys for
+ * allocated boot memory block, so that it is never reported as leaks.
+ *
+ * Return:
+ * Physical address of allocated memory block on success, %0 on failure.
+ */
 static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
 					phys_addr_t align, phys_addr_t start,
-					phys_addr_t end, int nid,
-					enum memblock_flags flags)
+					phys_addr_t end, int nid)
 {
+	enum memblock_flags flags = choose_memblock_flags();
 	phys_addr_t found;
 
+	if (WARN_ONCE(nid == MAX_NUMNODES, "Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead\n"))
+		nid = NUMA_NO_NODE;
+
 	if (!align) {
 		/* Can't use WARNs this early in boot on powerpc */
 		dump_stack();
 		align = SMP_CACHE_BYTES;
 	}
 
+	if (end > memblock.current_limit)
+		end = memblock.current_limit;
+
+again:
 	found = memblock_find_in_range_node(size, align, start, end, nid,
 					    flags);
-	if (found && !memblock_reserve(found, size)) {
+	if (found && !memblock_reserve(found, size))
+		goto done;
+
+	if (nid != NUMA_NO_NODE) {
+		found = memblock_find_in_range_node(size, align, start,
+						    end, NUMA_NO_NODE,
+						    flags);
+		if (found && !memblock_reserve(found, size))
+			goto done;
+	}
+
+	if (flags & MEMBLOCK_MIRROR) {
+		flags &= ~MEMBLOCK_MIRROR;
+		pr_warn("Could not allocate %pap bytes of mirrored memory\n",
+			&size);
+		goto again;
+	}
+
+	return 0;
+
+done:
+	/* Skip kmemleak for kasan_init() due to high volume. */
+	if (end != MEMBLOCK_ALLOC_KASAN)
 		/*
-		 * The min_count is set to 0 so that memblock allocations are
-		 * never reported as leaks.
+		 * The min_count is set to 0 so that memblock allocated
+		 * blocks are never reported as leaks. This is because many
+		 * of these blocks are only referred via the physical
+		 * address which is not looked up by kmemleak.
 		 */
 		kmemleak_alloc_phys(found, size, 0, 0);
-		return found;
-	}
-	return 0;
+
+	return found;
 }
 
 phys_addr_t __init memblock_phys_alloc_range(phys_addr_t size,
@@ -1343,35 +1397,13 @@ phys_addr_t __init memblock_phys_alloc_range(phys_addr_t size,
 					     phys_addr_t start,
 					     phys_addr_t end)
 {
-	return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE,
-					MEMBLOCK_NONE);
-}
-
-phys_addr_t __init memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
-{
-	enum memblock_flags flags = choose_memblock_flags();
-	phys_addr_t ret;
-
-again:
-	ret = memblock_alloc_range_nid(size, align, 0,
-				       MEMBLOCK_ALLOC_ACCESSIBLE, nid, flags);
-
-	if (!ret && (flags & MEMBLOCK_MIRROR)) {
-		flags &= ~MEMBLOCK_MIRROR;
-		goto again;
-	}
-	return ret;
+	return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE);
 }
 
 phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
 {
-	phys_addr_t res = memblock_phys_alloc_nid(size, align, nid);
-
-	if (res)
-		return res;
-	return memblock_alloc_range_nid(size, align, 0,
-					MEMBLOCK_ALLOC_ACCESSIBLE,
-					NUMA_NO_NODE, MEMBLOCK_NONE);
+	return memblock_alloc_range_nid(size, align, 0, nid,
+					MEMBLOCK_ALLOC_ACCESSIBLE);
 }
 
 /**
@@ -1382,19 +1414,13 @@ phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t ali
  * @max_addr: the upper bound of the memory region to allocate (phys address)
  * @nid: nid of the free area to find, %NUMA_NO_NODE for any node
  *
- * The @min_addr limit is dropped if it can not be satisfied and the allocation
- * will fall back to memory below @min_addr. Also, allocation may fall back
- * to any node in the system if the specified node can not
- * hold the requested memory.
- *
- * The allocation is performed from memory region limited by
- * memblock.current_limit if @max_addr == %MEMBLOCK_ALLOC_ACCESSIBLE.
- *
- * The phys address of allocated boot memory block is converted to virtual and
- * allocated memory is reset to 0.
+ * Allocates memory block using memblock_alloc_range_nid() and
+ * converts the returned physical address to virtual.
  *
- * In addition, function sets the min_count to 0 using kmemleak_alloc for
- * allocated boot memory block, so that it is never reported as leaks.
+ * The @min_addr limit is dropped if it can not be satisfied and the allocation
+ * will fall back to memory below @min_addr. Other constraints, such
+ * as node and mirrored memory will be handled again in
+ * memblock_alloc_range_nid().
  *
  * Return:
  * Virtual address of allocated memory block on success, NULL on failure.
@@ -1405,11 +1431,6 @@ static void * __init memblock_alloc_internal(
 				int nid)
 {
 	phys_addr_t alloc;
-	void *ptr;
-	enum memblock_flags flags = choose_memblock_flags();
-
-	if (WARN_ONCE(nid == MAX_NUMNODES, "Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead\n"))
-		nid = NUMA_NO_NODE;
 
 	/*
 	 * Detect any accidental use of these APIs after slab is ready, as at
@@ -1419,54 +1440,16 @@ static void * __init memblock_alloc_internal(
 	if (WARN_ON_ONCE(slab_is_available()))
 		return kzalloc_node(size, GFP_NOWAIT, nid);
 
-	if (!align) {
-		dump_stack();
-		align = SMP_CACHE_BYTES;
-	}
-
-	if (max_addr > memblock.current_limit)
-		max_addr = memblock.current_limit;
-again:
-	alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
-					    nid, flags);
-	if (alloc && !memblock_reserve(alloc, size))
-		goto done;
-
-	if (nid != NUMA_NO_NODE) {
-		alloc = memblock_find_in_range_node(size, align, min_addr,
-						    max_addr, NUMA_NO_NODE,
-						    flags);
-		if (alloc && !memblock_reserve(alloc, size))
-			goto done;
-	}
-
-	if (min_addr) {
-		min_addr = 0;
-		goto again;
-	}
-
-	if (flags & MEMBLOCK_MIRROR) {
-		flags &= ~MEMBLOCK_MIRROR;
-		pr_warn("Could not allocate %pap bytes of mirrored memory\n",
-			&size);
-		goto again;
-	}
+	alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid);
 
-	return NULL;
-done:
-	ptr = phys_to_virt(alloc);
+	/* retry allocation without lower limit */
+	if (!alloc && min_addr)
+		alloc = memblock_alloc_range_nid(size, align, 0, max_addr, nid);
 
-	/* Skip kmemleak for kasan_init() due to high volume. */
-	if (max_addr != MEMBLOCK_ALLOC_KASAN)
-		/*
-		 * The min_count is set to 0 so that bootmem allocated
-		 * blocks are never reported as leaks. This is because many
-		 * of these blocks are only referred via the physical
-		 * address which is not looked up by kmemleak.
-		 */
-		kmemleak_alloc(ptr, size, 0, 0);
+	if (!alloc)
+		return NULL;
 
-	return ptr;
+	return phys_to_virt(alloc);
 }
 
 /**
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 09/21] memblock: drop memblock_alloc_base()
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

The memblock_alloc_base() function tries to allocate a memory up to the
limit specified by its max_addr parameter and panics if the allocation
fails. Replace its usage with memblock_phys_alloc_range() and make the
callers check the return value and panic in case of error.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/powerpc/kernel/rtas.c      |  6 +++++-
 arch/powerpc/mm/hash_utils_64.c |  8 ++++++--
 arch/s390/kernel/smp.c          |  6 +++++-
 drivers/macintosh/smu.c         |  2 +-
 include/linux/memblock.h        |  2 --
 mm/memblock.c                   | 14 --------------
 6 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index de35bd8f..fbc6761 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1187,7 +1187,11 @@ void __init rtas_initialize(void)
 		ibm_suspend_me_token = rtas_token("ibm,suspend-me");
 	}
 #endif
-	rtas_rmo_buf = memblock_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
+	rtas_rmo_buf = memblock_phys_alloc_range(RTAS_RMOBUF_MAX, PAGE_SIZE,
+						 0, rtas_region);
+	if (!rtas_rmo_buf)
+		panic("ERROR: RTAS: Failed to allocate %lx bytes below %pa\n",
+		      PAGE_SIZE, &rtas_region);
 
 #ifdef CONFIG_RTAS_ERROR_LOGGING
 	rtas_last_error_token = rtas_token("rtas-last-error");
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index bc6be44..c7d5f48 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -882,8 +882,12 @@ static void __init htab_initialize(void)
 		}
 #endif /* CONFIG_PPC_CELL */
 
-		table = memblock_alloc_base(htab_size_bytes, htab_size_bytes,
-					    limit);
+		table = memblock_phys_alloc_range(htab_size_bytes,
+						  htab_size_bytes,
+						  0, limit);
+		if (!table)
+			panic("ERROR: Failed to allocate %pa bytes below %pa\n",
+			      &htab_size_bytes, &limit);
 
 		DBG("Hash table allocated at %lx, size: %lx\n", table,
 		    htab_size_bytes);
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index f82b3d3..9061597 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -651,7 +651,11 @@ void __init smp_save_dump_cpus(void)
 		/* No previous system present, normal boot. */
 		return;
 	/* Allocate a page as dumping area for the store status sigps */
-	page = memblock_alloc_base(PAGE_SIZE, PAGE_SIZE, 1UL << 31);
+	page = memblock_phys_alloc_range(PAGE_SIZE, PAGE_SIZE, 0, 1UL << 31);
+	if (!page)
+		panic("ERROR: Failed to allocate %x bytes below %lx\n",
+		      PAGE_SIZE, 1UL << 31);
+
 	/* Set multi-threading state to the previous system. */
 	pcpu_set_smt(sclp.mtid_prev);
 	boot_cpu_addr = stap();
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 0a0b8e1..42cf68d 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -485,7 +485,7 @@ int __init smu_init (void)
 	 * SMU based G5s need some memory below 2Gb. Thankfully this is
 	 * called at a time where memblock is still available.
 	 */
-	smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
+	smu_cmdbuf_abs = memblock_phys_alloc_range(4096, 4096, 0, 0x80000000UL);
 	if (smu_cmdbuf_abs == 0) {
 		printk(KERN_ERR "SMU: Command buffer allocation failed !\n");
 		ret = -EINVAL;
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 768e2b4..6874fdc 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -494,8 +494,6 @@ static inline bool memblock_bottom_up(void)
 	return memblock.bottom_up;
 }
 
-phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
-				phys_addr_t max_addr);
 phys_addr_t memblock_phys_mem_size(void);
 phys_addr_t memblock_reserved_size(void);
 phys_addr_t memblock_mem_size(unsigned long limit_pfn);
diff --git a/mm/memblock.c b/mm/memblock.c
index e5ffdcd..531fa77 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1363,20 +1363,6 @@ phys_addr_t __init memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align,
 	return ret;
 }
 
-phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
-{
-	phys_addr_t alloc;
-
-	alloc = memblock_alloc_range_nid(size, align, 0, max_addr, NUMA_NO_NODE,
-					MEMBLOCK_NONE);
-
-	if (alloc == 0)
-		panic("ERROR: Failed to allocate %pa bytes below %pa.\n",
-		      &size, &max_addr);
-
-	return alloc;
-}
-
 phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
 {
 	phys_addr_t res = memblock_phys_alloc_nid(size, align, nid);
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 08/21] memblock: drop __memblock_alloc_base()
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

The __memblock_alloc_base() function tries to allocate a memory up to the
limit specified by its max_addr parameter. Depending on the value of this
parameter, the __memblock_alloc_base() can is replaced with the appropriate
memblock_phys_alloc*() variant.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 arch/sh/kernel/machine_kexec.c |  3 ++-
 arch/x86/kernel/e820.c         |  2 +-
 arch/x86/mm/numa.c             | 12 ++++--------
 drivers/of/of_reserved_mem.c   |  7 ++-----
 include/linux/memblock.h       |  2 --
 mm/memblock.c                  |  9 ++-------
 6 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index b9f9f1a..63d63a3 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -168,7 +168,8 @@ void __init reserve_crashkernel(void)
 	crash_size = PAGE_ALIGN(resource_size(&crashk_res));
 	if (!crashk_res.start) {
 		unsigned long max = memblock_end_of_DRAM() - memory_limit;
-		crashk_res.start = __memblock_alloc_base(crash_size, PAGE_SIZE, max);
+		crashk_res.start = memblock_phys_alloc_range(crash_size,
+							     PAGE_SIZE, 0, max);
 		if (!crashk_res.start) {
 			pr_err("crashkernel allocation failed\n");
 			goto disable;
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 50895c2..9c0eb54 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -778,7 +778,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align)
 {
 	u64 addr;
 
-	addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE);
+	addr = memblock_phys_alloc(size, align);
 	if (addr) {
 		e820__range_update_kexec(addr, size, E820_TYPE_RAM, E820_TYPE_RESERVED);
 		pr_info("update e820_table_kexec for e820__memblock_alloc_reserved()\n");
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 1308f54..f85ae42 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -195,15 +195,11 @@ static void __init alloc_node_data(int nid)
 	 * Allocate node data.  Try node-local memory and then any node.
 	 * Never allocate in DMA zone.
 	 */
-	nd_pa = memblock_phys_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
+	nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
 	if (!nd_pa) {
-		nd_pa = __memblock_alloc_base(nd_size, SMP_CACHE_BYTES,
-					      MEMBLOCK_ALLOC_ACCESSIBLE);
-		if (!nd_pa) {
-			pr_err("Cannot find %zu bytes in any node (initial node: %d)\n",
-			       nd_size, nid);
-			return;
-		}
+		pr_err("Cannot find %zu bytes in any node (initial node: %d)\n",
+		       nd_size, nid);
+		return;
 	}
 	nd = __va(nd_pa);
 
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 1977ee0..499f16d 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -31,13 +31,10 @@ int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
 	phys_addr_t *res_base)
 {
 	phys_addr_t base;
-	/*
-	 * We use __memblock_alloc_base() because memblock_alloc_base()
-	 * panic()s on allocation failure.
-	 */
+
 	end = !end ? MEMBLOCK_ALLOC_ANYWHERE : end;
 	align = !align ? SMP_CACHE_BYTES : align;
-	base = __memblock_alloc_base(size, align, end);
+	base = memblock_phys_alloc_range(size, align, 0, end);
 	if (!base)
 		return -ENOMEM;
 
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 7883c74..768e2b4 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -496,8 +496,6 @@ static inline bool memblock_bottom_up(void)
 
 phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
 				phys_addr_t max_addr);
-phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
-				  phys_addr_t max_addr);
 phys_addr_t memblock_phys_mem_size(void);
 phys_addr_t memblock_reserved_size(void);
 phys_addr_t memblock_mem_size(unsigned long limit_pfn);
diff --git a/mm/memblock.c b/mm/memblock.c
index 461e40a3..e5ffdcd 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1363,17 +1363,12 @@ phys_addr_t __init memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align,
 	return ret;
 }
 
-phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
-{
-	return memblock_alloc_range_nid(size, align, 0, max_addr, NUMA_NO_NODE,
-					MEMBLOCK_NONE);
-}
-
 phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
 {
 	phys_addr_t alloc;
 
-	alloc = __memblock_alloc_base(size, align, max_addr);
+	alloc = memblock_alloc_range_nid(size, align, 0, max_addr, NUMA_NO_NODE,
+					MEMBLOCK_NONE);
 
 	if (alloc == 0)
 		panic("ERROR: Failed to allocate %pa bytes below %pa.\n",
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 07/21] memblock: memblock_phys_alloc(): don't panic
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

Make the memblock_phys_alloc() function an inline wrapper for
memblock_phys_alloc_range() and update the memblock_phys_alloc() callers to
check the returned value and panic in case of error.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/arm/mm/init.c                   | 4 ++++
 arch/arm64/mm/mmu.c                  | 2 ++
 arch/powerpc/sysdev/dart_iommu.c     | 3 +++
 arch/s390/kernel/crash_dump.c        | 3 +++
 arch/s390/kernel/setup.c             | 3 +++
 arch/sh/boards/mach-ap325rxa/setup.c | 3 +++
 arch/sh/boards/mach-ecovec24/setup.c | 6 ++++++
 arch/sh/boards/mach-kfr2r09/setup.c  | 3 +++
 arch/sh/boards/mach-migor/setup.c    | 3 +++
 arch/sh/boards/mach-se/7724/setup.c  | 6 ++++++
 arch/xtensa/mm/kasan_init.c          | 3 +++
 include/linux/memblock.h             | 7 ++++++-
 mm/memblock.c                        | 5 -----
 13 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index b76b90e..15dddfe 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -206,6 +206,10 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 	BUG_ON(!arm_memblock_steal_permitted);
 
 	phys = memblock_phys_alloc(size, align);
+	if (!phys)
+		panic("Failed to steal %pa bytes at %pS\n",
+		      &size, (void *)_RET_IP_);
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index b6f5aa5..a74e4be 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -104,6 +104,8 @@ static phys_addr_t __init early_pgtable_alloc(void)
 	void *ptr;
 
 	phys = memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate page table page\n");
 
 	/*
 	 * The FIX_{PGD,PUD,PMD} slots may be in active use, but the FIX_PTE
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 25bc25f..b82c9ff 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -265,6 +265,9 @@ static void allocate_dart(void)
 	 * prefetching into invalid pages and corrupting data
 	 */
 	tmp = memblock_phys_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
+	if (!tmp)
+		panic("DART: table allocation failed\n");
+
 	dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) &
 					 DARTMAP_RPNMASK);
 
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 97eae38..f96a585 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -61,6 +61,9 @@ struct save_area * __init save_area_alloc(bool is_boot_cpu)
 	struct save_area *sa;
 
 	sa = (void *) memblock_phys_alloc(sizeof(*sa), 8);
+	if (!sa)
+		panic("Failed to allocate save area\n");
+
 	if (is_boot_cpu)
 		list_add(&sa->list, &dump_save_areas);
 	else
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 72dd23e..da48397 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -968,6 +968,9 @@ static void __init setup_randomness(void)
 
 	vmms = (struct sysinfo_3_2_2 *) memblock_phys_alloc(PAGE_SIZE,
 							    PAGE_SIZE);
+	if (!vmms)
+		panic("Failed to allocate memory for sysinfo structure\n");
+
 	if (stsi(vmms, 3, 2, 2) == 0 && vmms->count)
 		add_device_randomness(&vmms->vm, sizeof(vmms->vm[0]) * vmms->count);
 	memblock_free((unsigned long) vmms, PAGE_SIZE);
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index d7ceab6..08a0cc9 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -558,6 +558,9 @@ static void __init ap325rxa_mv_mem_reserve(void)
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
 	phys = memblock_phys_alloc(size, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate CEU memory\n");
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index a3901806..fd264a6 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -1481,11 +1481,17 @@ static void __init ecovec_mv_mem_reserve(void)
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
 	phys = memblock_phys_alloc(size, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate CEU0 memory\n");
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu0_dma_membase = phys;
 
 	phys = memblock_phys_alloc(size, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate CEU1 memory\n");
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu1_dma_membase = phys;
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 55bdf4a..ebe90d06 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -632,6 +632,9 @@ static void __init kfr2r09_mv_mem_reserve(void)
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
 	phys = memblock_phys_alloc(size, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate CEU memory\n");
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index ba7eee6..1adff09 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -631,6 +631,9 @@ static void __init migor_mv_mem_reserve(void)
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
 	phys = memblock_phys_alloc(size, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate CEU memory\n");
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 4696e10..201631a 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -966,11 +966,17 @@ static void __init ms7724se_mv_mem_reserve(void)
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
 	phys = memblock_phys_alloc(size, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate CEU0 memory\n");
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu0_dma_membase = phys;
 
 	phys = memblock_phys_alloc(size, PAGE_SIZE);
+	if (!phys)
+		panic("Failed to allocate CEU1 memory\n");
+
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu1_dma_membase = phys;
diff --git a/arch/xtensa/mm/kasan_init.c b/arch/xtensa/mm/kasan_init.c
index 48dbb03..4852848 100644
--- a/arch/xtensa/mm/kasan_init.c
+++ b/arch/xtensa/mm/kasan_init.c
@@ -54,6 +54,9 @@ static void __init populate(void *start, void *end)
 			phys_addr_t phys =
 				memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
 
+			if (!phys)
+				panic("Failed to allocate page table page\n");
+
 			set_pte(pte + j, pfn_pte(PHYS_PFN(phys), PAGE_KERNEL));
 		}
 	}
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 66dfdb3..7883c74 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -374,7 +374,12 @@ phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align,
 phys_addr_t memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
 phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
 
-phys_addr_t memblock_phys_alloc(phys_addr_t size, phys_addr_t align);
+static inline phys_addr_t memblock_phys_alloc(phys_addr_t size,
+					      phys_addr_t align)
+{
+	return memblock_phys_alloc_range(size, align, 0,
+					 MEMBLOCK_ALLOC_ACCESSIBLE);
+}
 
 void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align,
 				 phys_addr_t min_addr, phys_addr_t max_addr,
diff --git a/mm/memblock.c b/mm/memblock.c
index 8aabb1b..461e40a3 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1382,11 +1382,6 @@ phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys
 	return alloc;
 }
 
-phys_addr_t __init memblock_phys_alloc(phys_addr_t size, phys_addr_t align)
-{
-	return memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE);
-}
-
 phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
 {
 	phys_addr_t res = memblock_phys_alloc_nid(size, align, nid);
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 06/21] memblock: memblock_phys_alloc_try_nid(): don't panic
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

The memblock_phys_alloc_try_nid() function tries to allocate memory from
the requested node and then falls back to allocation from any node in the
system. The memblock_alloc_base() fallback used by this function panics if
the allocation fails.

Replace the memblock_alloc_base() fallback with the direct call to
memblock_alloc_range_nid() and update the memblock_phys_alloc_try_nid()
callers to check the returned value and panic in case of error.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/arm64/mm/numa.c   | 4 ++++
 arch/powerpc/mm/numa.c | 4 ++++
 mm/memblock.c          | 4 +++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index ae34e3a..2c61ea4 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -237,6 +237,10 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 		pr_info("Initmem setup node %d [<memory-less node>]\n", nid);
 
 	nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
+	if (!nd_pa)
+		panic("Cannot allocate %zu bytes for node %d data\n",
+		      nd_size, nid);
+
 	nd = __va(nd_pa);
 
 	/* report and initialize */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 270cefb..8f2bbe1 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -788,6 +788,10 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 	int tnid;
 
 	nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
+	if (!nd_pa)
+		panic("Cannot allocate %zu bytes for node %d data\n",
+		      nd_size, nid);
+
 	nd = __va(nd_pa);
 
 	/* report and initialize */
diff --git a/mm/memblock.c b/mm/memblock.c
index f019aee..8aabb1b 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1393,7 +1393,9 @@ phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t ali
 
 	if (res)
 		return res;
-	return memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE);
+	return memblock_alloc_range_nid(size, align, 0,
+					MEMBLOCK_ALLOC_ACCESSIBLE,
+					NUMA_NO_NODE, MEMBLOCK_NONE);
 }
 
 /**
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 04/21] memblock: drop memblock_alloc_base_nid()
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

The memblock_alloc_base_nid() is a oneliner wrapper for
memblock_alloc_range_nid() without any side effect.
Replace it's usage by the direct calls to memblock_alloc_range_nid().

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 include/linux/memblock.h |  3 ---
 mm/memblock.c            | 15 ++++-----------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 60e100f..f7ef313 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -490,9 +490,6 @@ static inline bool memblock_bottom_up(void)
 phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
 					phys_addr_t start, phys_addr_t end,
 					enum memblock_flags flags);
-phys_addr_t memblock_alloc_base_nid(phys_addr_t size,
-					phys_addr_t align, phys_addr_t max_addr,
-					int nid, enum memblock_flags flags);
 phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
 				phys_addr_t max_addr);
 phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
diff --git a/mm/memblock.c b/mm/memblock.c
index a32db30..c80029e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1346,21 +1346,14 @@ phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
 					flags);
 }
 
-phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
-					phys_addr_t align, phys_addr_t max_addr,
-					int nid, enum memblock_flags flags)
-{
-	return memblock_alloc_range_nid(size, align, 0, max_addr, nid, flags);
-}
-
 phys_addr_t __init memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
 {
 	enum memblock_flags flags = choose_memblock_flags();
 	phys_addr_t ret;
 
 again:
-	ret = memblock_alloc_base_nid(size, align, MEMBLOCK_ALLOC_ACCESSIBLE,
-				      nid, flags);
+	ret = memblock_alloc_range_nid(size, align, 0,
+				       MEMBLOCK_ALLOC_ACCESSIBLE, nid, flags);
 
 	if (!ret && (flags & MEMBLOCK_MIRROR)) {
 		flags &= ~MEMBLOCK_MIRROR;
@@ -1371,8 +1364,8 @@ phys_addr_t __init memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align,
 
 phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
 {
-	return memblock_alloc_base_nid(size, align, max_addr, NUMA_NO_NODE,
-				       MEMBLOCK_NONE);
+	return memblock_alloc_range_nid(size, align, 0, max_addr, NUMA_NO_NODE,
+					MEMBLOCK_NONE);
 }
 
 phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 05/21] memblock: emphasize that memblock_alloc_range() returns a physical address
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

Rename memblock_alloc_range() to memblock_phys_alloc_range() to emphasize
that it returns a physical address.
While on it, remove the 'enum memblock_flags' parameter from this function
as its only user anyway sets it to MEMBLOCK_NONE, which is the default for
the most of memblock allocations.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 include/linux/memblock.h |  5 ++---
 mm/cma.c                 | 10 ++++------
 mm/memblock.c            |  9 +++++----
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index f7ef313..66dfdb3 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -369,6 +369,8 @@ static inline int memblock_get_region_node(const struct memblock_region *r)
 #define ARCH_LOW_ADDRESS_LIMIT  0xffffffffUL
 #endif
 
+phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align,
+				      phys_addr_t start, phys_addr_t end);
 phys_addr_t memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
 phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
 
@@ -487,9 +489,6 @@ static inline bool memblock_bottom_up(void)
 	return memblock.bottom_up;
 }
 
-phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
-					phys_addr_t start, phys_addr_t end,
-					enum memblock_flags flags);
 phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
 				phys_addr_t max_addr);
 phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
diff --git a/mm/cma.c b/mm/cma.c
index c7b39dd..e4530ae 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -327,16 +327,14 @@ int __init cma_declare_contiguous(phys_addr_t base,
 		 * memory in case of failure.
 		 */
 		if (base < highmem_start && limit > highmem_start) {
-			addr = memblock_alloc_range(size, alignment,
-						    highmem_start, limit,
-						    MEMBLOCK_NONE);
+			addr = memblock_phys_alloc_range(size, alignment,
+							 highmem_start, limit);
 			limit = highmem_start;
 		}
 
 		if (!addr) {
-			addr = memblock_alloc_range(size, alignment, base,
-						    limit,
-						    MEMBLOCK_NONE);
+			addr = memblock_phys_alloc_range(size, alignment, base,
+							 limit);
 			if (!addr) {
 				ret = -ENOMEM;
 				goto err;
diff --git a/mm/memblock.c b/mm/memblock.c
index c80029e..f019aee 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1338,12 +1338,13 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
 	return 0;
 }
 
-phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
-					phys_addr_t start, phys_addr_t end,
-					enum memblock_flags flags)
+phys_addr_t __init memblock_phys_alloc_range(phys_addr_t size,
+					     phys_addr_t align,
+					     phys_addr_t start,
+					     phys_addr_t end)
 {
 	return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE,
-					flags);
+					MEMBLOCK_NONE);
 }
 
 phys_addr_t __init memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 03/21] memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

The calls to memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE) and
memblock_phys_alloc(size, align) are equivalent as both try to allocate
'size' bytes with 'align' alignment anywhere in the memory and panic if hte
allocation fails.

The conversion is done using the following semantic patch:

@@
expression size, align;
@@
- memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
+ memblock_phys_alloc(size, align)

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/arm/mm/init.c                   | 2 +-
 arch/sh/boards/mach-ap325rxa/setup.c | 2 +-
 arch/sh/boards/mach-ecovec24/setup.c | 4 ++--
 arch/sh/boards/mach-kfr2r09/setup.c  | 2 +-
 arch/sh/boards/mach-migor/setup.c    | 2 +-
 arch/sh/boards/mach-se/7724/setup.c  | 4 ++--
 arch/xtensa/mm/kasan_init.c          | 3 +--
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 478ea8b..b76b90e 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -205,7 +205,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 
 	BUG_ON(!arm_memblock_steal_permitted);
 
-	phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, align);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 8f234d04..d7ceab6 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -557,7 +557,7 @@ static void __init ap325rxa_mv_mem_reserve(void)
 	phys_addr_t phys;
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-	phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, PAGE_SIZE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 22b4106..a3901806 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -1480,12 +1480,12 @@ static void __init ecovec_mv_mem_reserve(void)
 	phys_addr_t phys;
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-	phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, PAGE_SIZE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu0_dma_membase = phys;
 
-	phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, PAGE_SIZE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu1_dma_membase = phys;
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 203d249..55bdf4a 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -631,7 +631,7 @@ static void __init kfr2r09_mv_mem_reserve(void)
 	phys_addr_t phys;
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-	phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, PAGE_SIZE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index f4ad33c..ba7eee6 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -630,7 +630,7 @@ static void __init migor_mv_mem_reserve(void)
 	phys_addr_t phys;
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-	phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, PAGE_SIZE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index fdbec22a..4696e10 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -965,12 +965,12 @@ static void __init ms7724se_mv_mem_reserve(void)
 	phys_addr_t phys;
 	phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
 
-	phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, PAGE_SIZE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu0_dma_membase = phys;
 
-	phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
+	phys = memblock_phys_alloc(size, PAGE_SIZE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 	ceu1_dma_membase = phys;
diff --git a/arch/xtensa/mm/kasan_init.c b/arch/xtensa/mm/kasan_init.c
index 1734cda..48dbb03 100644
--- a/arch/xtensa/mm/kasan_init.c
+++ b/arch/xtensa/mm/kasan_init.c
@@ -52,8 +52,7 @@ static void __init populate(void *start, void *end)
 
 		for (k = 0; k < PTRS_PER_PTE; ++k, ++j) {
 			phys_addr_t phys =
-				memblock_alloc_base(PAGE_SIZE, PAGE_SIZE,
-						    MEMBLOCK_ALLOC_ANYWHERE);
+				memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
 
 			set_pte(pte + j, pfn_pte(PHYS_PFN(phys), PAGE_KERNEL));
 		}
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 02/21] powerpc: use memblock functions returning virtual address
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

From: Christophe Leroy <christophe.leroy@c-s.fr>

Since only the virtual address of allocated blocks is used,
lets use functions returning directly virtual address.

Those functions have the advantage of also zeroing the block.

[ MR:
 - updated error message in alloc_stack() to be more verbose
 - convereted several additional call sites ]

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/powerpc/kernel/dt_cpu_ftrs.c |  3 +--
 arch/powerpc/kernel/irq.c         |  5 -----
 arch/powerpc/kernel/paca.c        |  6 +++++-
 arch/powerpc/kernel/prom.c        |  5 ++++-
 arch/powerpc/kernel/setup_32.c    | 26 ++++++++++++++++----------
 5 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 8be3721..2554824 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -813,7 +813,6 @@ static int __init process_cpufeatures_node(unsigned long node,
 	int len;
 
 	f = &dt_cpu_features[i];
-	memset(f, 0, sizeof(struct dt_cpu_feature));
 
 	f->node = node;
 
@@ -1008,7 +1007,7 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char
 	/* Count and allocate space for cpu features */
 	of_scan_flat_dt_subnodes(node, count_cpufeatures_subnodes,
 						&nr_dt_cpu_features);
-	dt_cpu_features = __va(memblock_phys_alloc(sizeof(struct dt_cpu_feature) * nr_dt_cpu_features, PAGE_SIZE));
+	dt_cpu_features = memblock_alloc(sizeof(struct dt_cpu_feature) * nr_dt_cpu_features, PAGE_SIZE);
 
 	cpufeatures_setup_start(isa);
 
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 916ddc4..4a44bc3 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -725,18 +725,15 @@ void exc_lvl_ctx_init(void)
 #endif
 #endif
 
-		memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE);
 		tp = critirq_ctx[cpu_nr];
 		tp->cpu = cpu_nr;
 		tp->preempt_count = 0;
 
 #ifdef CONFIG_BOOKE
-		memset((void *)dbgirq_ctx[cpu_nr], 0, THREAD_SIZE);
 		tp = dbgirq_ctx[cpu_nr];
 		tp->cpu = cpu_nr;
 		tp->preempt_count = 0;
 
-		memset((void *)mcheckirq_ctx[cpu_nr], 0, THREAD_SIZE);
 		tp = mcheckirq_ctx[cpu_nr];
 		tp->cpu = cpu_nr;
 		tp->preempt_count = HARDIRQ_OFFSET;
@@ -754,12 +751,10 @@ void irq_ctx_init(void)
 	int i;
 
 	for_each_possible_cpu(i) {
-		memset((void *)softirq_ctx[i], 0, THREAD_SIZE);
 		tp = softirq_ctx[i];
 		tp->cpu = i;
 		klp_init_thread_info(tp);
 
-		memset((void *)hardirq_ctx[i], 0, THREAD_SIZE);
 		tp = hardirq_ctx[i];
 		tp->cpu = i;
 		klp_init_thread_info(tp);
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 8c890c6..e7382ab 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -196,7 +196,11 @@ void __init allocate_paca_ptrs(void)
 	paca_nr_cpu_ids = nr_cpu_ids;
 
 	paca_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
-	paca_ptrs = __va(memblock_phys_alloc(paca_ptrs_size, SMP_CACHE_BYTES));
+	paca_ptrs = memblock_alloc_raw(paca_ptrs_size, SMP_CACHE_BYTES);
+	if (!paca_ptrs)
+		panic("Failed to allocate %d bytes for paca pointers\n",
+		      paca_ptrs_size);
+
 	memset(paca_ptrs, 0x88, paca_ptrs_size);
 }
 
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index e97aaf2..c0ed4fa 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -127,7 +127,10 @@ static void __init move_device_tree(void)
 	if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) ||
 	    !memblock_is_memory(start + size - 1) ||
 	    overlaps_crashkernel(start, size) || overlaps_initrd(start, size)) {
-		p = __va(memblock_phys_alloc(size, PAGE_SIZE));
+		p = memblock_alloc_raw(size, PAGE_SIZE);
+		if (!p)
+			panic("Failed to allocate %lu bytes to move device tree\n",
+			      size);
 		memcpy(p, initial_boot_params, size);
 		initial_boot_params = p;
 		DBG("Moved device tree to 0x%px\n", p);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 947f904..1f0b762 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -196,6 +196,17 @@ static int __init ppc_init(void)
 }
 arch_initcall(ppc_init);
 
+static void *__init alloc_stack(void)
+{
+	void *ptr = memblock_alloc(THREAD_SIZE, THREAD_SIZE);
+
+	if (!ptr)
+		panic("cannot allocate %d bytes for stack at %pS\n",
+		      THREAD_SIZE, (void *)_RET_IP_);
+
+	return ptr;
+}
+
 void __init irqstack_early_init(void)
 {
 	unsigned int i;
@@ -203,10 +214,8 @@ void __init irqstack_early_init(void)
 	/* interrupt stacks must be in lowmem, we get that for free on ppc32
 	 * as the memblock is limited to lowmem by default */
 	for_each_possible_cpu(i) {
-		softirq_ctx[i] = (struct thread_info *)
-			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
-		hardirq_ctx[i] = (struct thread_info *)
-			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
+		softirq_ctx[i] = alloc_stack();
+		hardirq_ctx[i] = alloc_stack();
 	}
 }
 
@@ -224,13 +233,10 @@ void __init exc_lvl_early_init(void)
 		hw_cpu = 0;
 #endif
 
-		critirq_ctx[hw_cpu] = (struct thread_info *)
-			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
+		critirq_ctx[hw_cpu] = alloc_stack();
 #ifdef CONFIG_BOOKE
-		dbgirq_ctx[hw_cpu] = (struct thread_info *)
-			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
-		mcheckirq_ctx[hw_cpu] = (struct thread_info *)
-			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
+		dbgirq_ctx[hw_cpu] = alloc_stack();
+		mcheckirq_ctx[hw_cpu] = alloc_stack();
 #endif
 	}
 }
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 01/21] openrisc: prefer memblock APIs returning virtual address
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc
In-Reply-To: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>

The allocation of the page tables memory in openrics uses
memblock_phys_alloc() and then converts the returned physical address to
virtual one. Use memblock_alloc_raw() and add a panic() if the allocation
fails.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/openrisc/mm/init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index d157310..caeb418 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -105,7 +105,10 @@ static void __init map_ram(void)
 			}
 
 			/* Alloc one page for holding PTE's... */
-			pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
+			pte = memblock_alloc_raw(PAGE_SIZE, PAGE_SIZE);
+			if (!pte)
+				panic("%s: Failed to allocate page for PTEs\n",
+				      __func__);
 			set_pmd(pme, __pmd(_KERNPG_TABLE + __pa(pte)));
 
 			/* Fill the newly allocated page with PTE'S */
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 00/21] Refine memblock API
From: Mike Rapoport @ 2019-01-21  8:03 UTC (permalink / raw)
  To: linux-mm
  Cc: Rich Felker, linux-ia64, devicetree, Catalin Marinas,
	Heiko Carstens, x86, linux-mips, Max Filippov, Guo Ren,
	sparclinux, Christoph Hellwig, linux-s390, linux-c6x-dev,
	Yoshinori Sato, Richard Weinberger, linux-sh, Russell King,
	kasan-dev, Mike Rapoport, Geert Uytterhoeven, Mark Salter,
	Dennis Zhou, Matt Turner, linux-snps-arc, uclinux-h8-devel,
	Petr Mladek, linux-xtensa, linux-alpha, linux-um, linux-m68k,
	Rob Herring, Greentime Hu, xen-devel, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Greg Kroah-Hartman,
	linux-usb, linux-kernel, Paul Burton, Vineet Gupta, Andrew Morton,
	linuxppc-dev, David S. Miller, openrisc

Hi,

Current memblock API is quite extensive and, which is more annoying,
duplicated. Except the low-level functions that allow searching for a free
memory region and marking it as reserved, memblock provides three (well,
two and a half) sets of functions to allocate memory. There are several
overlapping functions that return a physical address and there are
functions that return virtual address. Those that return the virtual
address may also clear the allocated memory. And, on top of all that, some
allocators panic and some return NULL in case of error.

This set tries to reduce the mess, and trim down the amount of memblock
allocation methods.

Patches 1-10 consolidate the functions that return physical address of
the allocated memory

Patches 11-13 are some trivial cleanups

Patches 14-19 add checks for the return value of memblock_alloc*() and
panics in case of errors. The patches 14-18 include some minor refactoring
to have better readability of the resulting code and patch 19 is a
mechanical addition of

	if (!ptr)
		panic();

after memblock_alloc*() calls.

And, finally, patches 20 and 21 remove panic() calls memblock and _nopanic
variants from memblock.

v2 changes:
* replace some more %lu with %zu
* remove panics where they are not needed in s390 and in printk
* collect Acked-by and Reviewed-by.


Christophe Leroy (1):
  powerpc: use memblock functions returning virtual address

Mike Rapoport (20):
  openrisc: prefer memblock APIs returning virtual address
  memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc
  memblock: drop memblock_alloc_base_nid()
  memblock: emphasize that memblock_alloc_range() returns a physical address
  memblock: memblock_phys_alloc_try_nid(): don't panic
  memblock: memblock_phys_alloc(): don't panic
  memblock: drop __memblock_alloc_base()
  memblock: drop memblock_alloc_base()
  memblock: refactor internal allocation functions
  memblock: make memblock_find_in_range_node() and choose_memblock_flags() static
  arch: use memblock_alloc() instead of memblock_alloc_from(size, align, 0)
  arch: don't memset(0) memory returned by memblock_alloc()
  ia64: add checks for the return value of memblock_alloc*()
  sparc: add checks for the return value of memblock_alloc*()
  mm/percpu: add checks for the return value of memblock_alloc*()
  init/main: add checks for the return value of memblock_alloc*()
  swiotlb: add checks for the return value of memblock_alloc*()
  treewide: add checks for the return value of memblock_alloc*()
  memblock: memblock_alloc_try_nid: don't panic
  memblock: drop memblock_alloc_*_nopanic() variants

 arch/alpha/kernel/core_cia.c              |   5 +-
 arch/alpha/kernel/core_marvel.c           |   6 +
 arch/alpha/kernel/pci-noop.c              |  13 +-
 arch/alpha/kernel/pci.c                   |  11 +-
 arch/alpha/kernel/pci_iommu.c             |  16 +-
 arch/alpha/kernel/setup.c                 |   2 +-
 arch/arc/kernel/unwind.c                  |   3 +-
 arch/arc/mm/highmem.c                     |   4 +
 arch/arm/kernel/setup.c                   |   6 +
 arch/arm/mm/init.c                        |   6 +-
 arch/arm/mm/mmu.c                         |  14 +-
 arch/arm64/kernel/setup.c                 |   8 +-
 arch/arm64/mm/kasan_init.c                |  10 ++
 arch/arm64/mm/mmu.c                       |   2 +
 arch/arm64/mm/numa.c                      |   4 +
 arch/c6x/mm/dma-coherent.c                |   4 +
 arch/c6x/mm/init.c                        |   4 +-
 arch/csky/mm/highmem.c                    |   5 +
 arch/h8300/mm/init.c                      |   4 +-
 arch/ia64/kernel/mca.c                    |  25 +--
 arch/ia64/mm/contig.c                     |   8 +-
 arch/ia64/mm/discontig.c                  |   4 +
 arch/ia64/mm/init.c                       |  38 ++++-
 arch/ia64/mm/tlb.c                        |   6 +
 arch/ia64/sn/kernel/io_common.c           |   3 +
 arch/ia64/sn/kernel/setup.c               |  12 +-
 arch/m68k/atari/stram.c                   |   4 +
 arch/m68k/mm/init.c                       |   3 +
 arch/m68k/mm/mcfmmu.c                     |   7 +-
 arch/m68k/mm/motorola.c                   |   9 ++
 arch/m68k/mm/sun3mmu.c                    |   6 +
 arch/m68k/sun3/sun3dvma.c                 |   3 +
 arch/microblaze/mm/init.c                 |  10 +-
 arch/mips/cavium-octeon/dma-octeon.c      |   3 +
 arch/mips/kernel/setup.c                  |   3 +
 arch/mips/kernel/traps.c                  |   5 +-
 arch/mips/mm/init.c                       |   5 +
 arch/nds32/mm/init.c                      |  12 ++
 arch/openrisc/mm/init.c                   |   5 +-
 arch/openrisc/mm/ioremap.c                |   8 +-
 arch/powerpc/kernel/dt_cpu_ftrs.c         |   8 +-
 arch/powerpc/kernel/irq.c                 |   5 -
 arch/powerpc/kernel/paca.c                |   6 +-
 arch/powerpc/kernel/pci_32.c              |   3 +
 arch/powerpc/kernel/prom.c                |   5 +-
 arch/powerpc/kernel/rtas.c                |   6 +-
 arch/powerpc/kernel/setup-common.c        |   3 +
 arch/powerpc/kernel/setup_32.c            |  26 ++--
 arch/powerpc/kernel/setup_64.c            |   4 +
 arch/powerpc/lib/alloc.c                  |   3 +
 arch/powerpc/mm/hash_utils_64.c           |  11 +-
 arch/powerpc/mm/mmu_context_nohash.c      |   9 ++
 arch/powerpc/mm/numa.c                    |   4 +
 arch/powerpc/mm/pgtable-book3e.c          |  12 +-
 arch/powerpc/mm/pgtable-book3s64.c        |   3 +
 arch/powerpc/mm/pgtable-radix.c           |   9 +-
 arch/powerpc/mm/ppc_mmu_32.c              |   3 +
 arch/powerpc/platforms/pasemi/iommu.c     |   3 +
 arch/powerpc/platforms/powermac/nvram.c   |   3 +
 arch/powerpc/platforms/powernv/opal.c     |   3 +
 arch/powerpc/platforms/powernv/pci-ioda.c |   8 +
 arch/powerpc/platforms/ps3/setup.c        |   3 +
 arch/powerpc/sysdev/dart_iommu.c          |   3 +
 arch/powerpc/sysdev/msi_bitmap.c          |   3 +
 arch/s390/kernel/crash_dump.c             |   3 +
 arch/s390/kernel/setup.c                  |  16 ++
 arch/s390/kernel/smp.c                    |   9 +-
 arch/s390/kernel/topology.c               |   6 +
 arch/s390/numa/mode_emu.c                 |   3 +
 arch/s390/numa/numa.c                     |   6 +-
 arch/sh/boards/mach-ap325rxa/setup.c      |   5 +-
 arch/sh/boards/mach-ecovec24/setup.c      |  10 +-
 arch/sh/boards/mach-kfr2r09/setup.c       |   5 +-
 arch/sh/boards/mach-migor/setup.c         |   5 +-
 arch/sh/boards/mach-se/7724/setup.c       |  10 +-
 arch/sh/kernel/machine_kexec.c            |   3 +-
 arch/sh/mm/init.c                         |   8 +-
 arch/sh/mm/numa.c                         |   4 +
 arch/sparc/kernel/prom_32.c               |   6 +-
 arch/sparc/kernel/setup_64.c              |   6 +
 arch/sparc/kernel/smp_64.c                |  12 ++
 arch/sparc/mm/init_32.c                   |   2 +-
 arch/sparc/mm/init_64.c                   |  11 ++
 arch/sparc/mm/srmmu.c                     |  18 ++-
 arch/um/drivers/net_kern.c                |   3 +
 arch/um/drivers/vector_kern.c             |   3 +
 arch/um/kernel/initrd.c                   |   2 +
 arch/um/kernel/mem.c                      |  16 ++
 arch/unicore32/kernel/setup.c             |   4 +
 arch/unicore32/mm/mmu.c                   |  15 +-
 arch/x86/kernel/acpi/boot.c               |   3 +
 arch/x86/kernel/apic/io_apic.c            |   5 +
 arch/x86/kernel/e820.c                    |   5 +-
 arch/x86/kernel/setup_percpu.c            |  10 +-
 arch/x86/mm/kasan_init_64.c               |  14 +-
 arch/x86/mm/numa.c                        |  12 +-
 arch/x86/platform/olpc/olpc_dt.c          |   3 +
 arch/x86/xen/p2m.c                        |  11 +-
 arch/xtensa/mm/kasan_init.c               |  10 +-
 arch/xtensa/mm/mmu.c                      |   3 +
 drivers/clk/ti/clk.c                      |   3 +
 drivers/firmware/memmap.c                 |   2 +-
 drivers/macintosh/smu.c                   |   5 +-
 drivers/of/fdt.c                          |   8 +-
 drivers/of/of_reserved_mem.c              |   7 +-
 drivers/of/unittest.c                     |   8 +-
 drivers/usb/early/xhci-dbc.c              |   2 +-
 drivers/xen/swiotlb-xen.c                 |   7 +-
 include/linux/memblock.h                  |  59 +------
 init/main.c                               |  26 +++-
 kernel/dma/swiotlb.c                      |  21 ++-
 kernel/power/snapshot.c                   |   3 +
 kernel/printk/printk.c                    |   9 +-
 lib/cpumask.c                             |   3 +
 mm/cma.c                                  |  10 +-
 mm/kasan/init.c                           |  10 +-
 mm/memblock.c                             | 249 ++++++++++--------------------
 mm/page_alloc.c                           |  10 +-
 mm/page_ext.c                             |   2 +-
 mm/percpu.c                               |  84 +++++++---
 mm/sparse.c                               |  25 ++-
 121 files changed, 860 insertions(+), 412 deletions(-)

-- 
2.7.4


^ permalink raw reply

* Re: [PATCH v3 3/3] powerpc/32: Add KASAN support
From: Christophe Leroy @ 2019-01-21  7:17 UTC (permalink / raw)
  To: Andrey Ryabinin, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Nicholas Piggin, Aneesh Kumar K.V,
	Alexander Potapenko, Dmitry Vyukov
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <e4b343fa-702b-294f-7741-bb85ed877cdf@virtuozzo.com>



Le 15/01/2019 à 18:23, Andrey Ryabinin a écrit :
> 
> 
> On 1/12/19 2:16 PM, Christophe Leroy wrote:
> 
>> +KASAN_SANITIZE_early_32.o := n
>> +KASAN_SANITIZE_cputable.o := n
>> +KASAN_SANITIZE_prom_init.o := n
>> +
> 
> Usually it's also good idea to disable branch profiling - define DISABLE_BRANCH_PROFILING
> either in top of these files or via Makefile. Branch profiling redefines if() statement and calls
> instrumented ftrace_likely_update in every if().
> 
> 
> 
>> diff --git a/arch/powerpc/mm/kasan_init.c b/arch/powerpc/mm/kasan_init.c
>> new file mode 100644
>> index 000000000000..3edc9c2d2f3e
> 
>> +void __init kasan_init(void)
>> +{
>> +	struct memblock_region *reg;
>> +
>> +	for_each_memblock(memory, reg)
>> +		kasan_init_region(reg);
>> +
>> +	pr_info("KASAN init done\n");
> 
> Without "init_task.kasan_depth = 0;" kasan will not repot bugs.
> 
> There is test_kasan module. Make sure that it produce reports.
> 

Thanks for the review.

Now I get the following very early in boot, what does that mean ?

[    0.000000] KASAN init done
[    0.000000] 
==================================================================
[    0.000000] BUG: KASAN: unknown-crash in memblock_alloc_try_nid+0xd8/0xf0
[    0.000000] Write of size 68 at addr c7ff5a90 by task swapper/0
[    0.000000]
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 
5.0.0-rc2-s3k-dev-00559-g88aa407c4bce #772
[    0.000000] Call Trace:
[    0.000000] [c094ded0] [c016c7e4] 
print_address_description+0x1a0/0x2b8 (unreliable)
[    0.000000] [c094df00] [c016caa0] kasan_report+0xe4/0x168
[    0.000000] [c094df40] [c016b464] memset+0x2c/0x4c
[    0.000000] [c094df60] [c08731f0] memblock_alloc_try_nid+0xd8/0xf0
[    0.000000] [c094df90] [c0861f20] mmu_context_init+0x58/0xa0
[    0.000000] [c094dfb0] [c085ca70] start_kernel+0x54/0x400
[    0.000000] [c094dff0] [c0002258] start_here+0x44/0x9c
[    0.000000]
[    0.000000]
[    0.000000] Memory state around the buggy address:
[    0.000000]  c7ff5980: e2 a1 87 81 bd d4 a5 b5 f8 8d 89 e7 72 bc 20 24
[    0.000000]  c7ff5a00: e7 b9 c1 c7 17 e9 b4 bd a4 d0 e7 a0 11 15 a5 b5
[    0.000000] >c7ff5a80: b5 e1 83 a5 2d 65 31 3f f3 e5 a7 ef 34 b5 69 b5
[    0.000000]                  ^
[    0.000000]  c7ff5b00: 21 a5 c1 c1 b4 bf 2d e5 e5 c3 f5 91 e3 b8 a1 34
[    0.000000]  c7ff5b80: ad ef 23 87 3d a6 ad b5 c3 c3 80 b7 ac b1 1f 37
[    0.000000] 
==================================================================
[    0.000000] Disabling lock debugging due to kernel taint
[    0.000000] MMU: Allocated 76 bytes of context maps for 16 contexts
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8176
[    0.000000] Kernel command line: console=ttyCPM0,115200N8 
ip=192.168.2.7:192.168.2.2::255.0.0.0:vgoip:eth0:off kgdboc=ttyCPM0
[    0.000000] Dentry cache hash table entries: 16384 (order: 2, 65536 
bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 1, 32768 bytes)
[    0.000000] Memory: 99904K/131072K available (7376K kernel code, 528K 
rwdata, 1168K rodata, 576K init, 4623K bss, 31168K reserved, 0K 
cma-reserved)
[    0.000000] Kernel virtual memory layout:
[    0.000000]   * 0xffefc000..0xffffc000  : fixmap
[    0.000000]   * 0xf7c00000..0xffc00000  : kasan shadow mem
[    0.000000]   * 0xf7a00000..0xf7c00000  : consistent mem
[    0.000000]   * 0xf7a00000..0xf7a00000  : early ioremap
[    0.000000]   * 0xc9000000..0xf7a00000  : vmalloc & ioremap


Christophe

^ permalink raw reply

* Re: [PATCH] hugetlb: allow to free gigantic pages regardless of the configuration
From: Will Deacon @ 2019-01-19 23:57 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: Heiko Carstens, linux-mm, Paul Mackerras, H . Peter Anvin,
	linux-riscv, linux-s390, Alexandre Ghiti, x86, hch, Ingo Molnar,
	Catalin Marinas, Martin Schwidefsky, Borislav Petkov,
	Alexander Viro, Thomas Gleixner, linux-arm-kernel, linux-kernel,
	linux-fsdevel, linuxppc-dev, Mike Kravetz
In-Reply-To: <20190117183953.5990-1-aghiti@upmem.com>

On Thu, Jan 17, 2019 at 06:39:53PM +0000, Alexandre Ghiti wrote:
> From: Alexandre Ghiti <alex@ghiti.fr>
> 
> On systems without CMA or (MEMORY_ISOLATION && COMPACTION) activated but
> that support gigantic pages, boottime reserved gigantic pages can not be
> freed at all. This patchs simply enables the possibility to hand back
> those pages to memory allocator.
> 
> This commit then renames gigantic_page_supported and
> ARCH_HAS_GIGANTIC_PAGE to make them more accurate. Indeed, those values
> being false does not mean that the system cannot use gigantic pages: it
> just means that runtime allocation of gigantic pages is not supported,
> one can still allocate boottime gigantic pages if the architecture supports
> it.
> 
> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> ---
> 
> - Compiled on all architectures
> - Tested on riscv architecture
> 
>  arch/arm64/Kconfig                           |  2 +-
>  arch/arm64/include/asm/hugetlb.h             |  7 +++--

The arm64 bits look straightforward enough to me...

Acked-by: Will Deacon <will.deacon@arm.com>

Will

^ permalink raw reply

* Re: [PATCH v13 00/10] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK
From: LEROY Christophe @ 2019-01-19 17:21 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linux-kernel, Nicholas Piggin, Mike Rapoport, Paul Mackerras,
	linuxppc-dev
In-Reply-To: <87zhrx2bf1.fsf@concordia.ellerman.id.au>

Michael Ellerman <mpe@ellerman.id.au> a écrit :

> Christophe Leroy <christophe.leroy@c-s.fr> writes:
>
>> The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which
>> moves the thread_info into task_struct.
>>
>> Moving thread_info into task_struct has the following advantages:
>> - It protects thread_info from corruption in the case of stack
>> overflows.
>> - Its address is harder to determine if stack addresses are
>> leaked, making a number of attacks more difficult.
>>
>> Changes since v12:
>>  - Patch 1: Taken comment from Mike (re-introduced the 'panic' in  
>> case memblock allocation fails in setup_64.c
>>  - Patch 1: Added alloc_stack() function in setup_32.c to also  
>> panic in case of allocation failure.
>
> Hi Christophe,
>
> I can't get this series to boot on qemu mac99. I'm getting eg:

Problem new with version 13 or it is the first time you test ?

>
> [    0.981514] NFS: Registering the id_resolver key type
> [    0.981752] Key type id_resolver registered
> [    0.981868] Key type id_legacy registered
> [    0.995711] Unrecoverable exception 0 at 0 (msr=0)
> [    0.996091] Oops: Unrecoverable exception, sig: 6 [#1]
> [    0.996314] BE PAGE_SIZE=4K MMU=Hash PowerMac
> [    0.996617] Modules linked in:
> [    0.996869] CPU: 0 PID: 416 Comm: modprobe Not tainted  
> 5.0.0-rc2-gcc-7.3.0-00043-g53f2de798792 #342

Comm:modprobe  ==> Something wrong with modules ? I never tested with  
CONFIG_MODULES.

Christophe

> [    0.997138] NIP:  00000000 LR: 00000000 CTR: 00000000
> [    0.997309] REGS: ef237f50 TRAP: 0000   Not tainted   
> (5.0.0-rc2-gcc-7.3.0-00043-g53f2de798792)
> [    0.997508] MSR:  00000000 <>  CR: 00000000  XER: 00000000
> [    0.997712]
> [    0.997712] GPR00: 00000000 ef238000 00000000 00000000 00000000  
> 00000000 00000000 00000000
> [    0.997712] GPR08: 00000000 00000000 00000000 00000000 00000000  
> 00000000 c006477c ef13d8c0
> [    0.997712] GPR16: 00000000 00000000 00000000 00000000 00000000  
> 00000000 00000000 00000000
> [    0.997712] GPR24: 00000000 00000000 00000000 00000000 00000000  
> 00000000 00000000 00000000
> [    0.998671] NIP [00000000]   (null)
> [    0.998774] LR [00000000]   (null)
> [    0.998895] Call Trace:
> [    0.999030] Instruction dump:
> [    0.999320] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX  
> XXXXXXXX XXXXXXXX
> [    0.999546] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX 60000000 XXXXXXXX  
> XXXXXXXX XXXXXXXX
> [    1.000023] ---[ end trace 925ea3419844fe68 ]---
>
> I haven't had time to dig any further.
>
> cheers



^ permalink raw reply

* Re: [PATCH v2] powerpc: chrp: Use device_type helpers to access the node type
From: Rob Herring @ 2019-01-19 16:30 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel@vger.kernel.org
In-Reply-To: <1547914725-12125-1-git-send-email-linux@roeck-us.net>

On Sat, Jan 19, 2019 at 10:18 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> The node type can no longer be accessed directly, resulting in the
> following build error. Use accessor function instead.
>
> arch/powerpc/platforms/chrp/setup.c: In function ‘chrp_init_IRQ’:
> arch/powerpc/platforms/chrp/setup.c:541:33: error:
>         ‘struct device_node’ has no member named ‘type’
>
> Fixes: 8ce5f8415753 ("of: Remove struct device_node.type pointer")
> Cc: Rob Herring <robh@kernel.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: of_node_is_type() checks if the node pointer is NULL, so there is
>     no need to check it before calling the function.
>
>  arch/powerpc/platforms/chrp/setup.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Already have the same patch acked by Michael and am sending to Linus shortly.

Rob

^ permalink raw reply

* [PATCH v2] powerpc: chrp: Use device_type helpers to access the node type
From: Guenter Roeck @ 2019-01-19 16:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Rob Herring, linux-kernel, Paul Mackerras, linuxppc-dev,
	Guenter Roeck

The node type can no longer be accessed directly, resulting in the
following build error. Use accessor function instead.

arch/powerpc/platforms/chrp/setup.c: In function ‘chrp_init_IRQ’:
arch/powerpc/platforms/chrp/setup.c:541:33: error:
	‘struct device_node’ has no member named ‘type’

Fixes: 8ce5f8415753 ("of: Remove struct device_node.type pointer")
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: of_node_is_type() checks if the node pointer is NULL, so there is
    no need to check it before calling the function.

 arch/powerpc/platforms/chrp/setup.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index e66644e0fb40..9438fa0fc355 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -538,8 +538,7 @@ static void __init chrp_init_IRQ(void)
 	/* see if there is a keyboard in the device tree
 	   with a parent of type "adb" */
 	for_each_node_by_name(kbd, "keyboard")
-		if (kbd->parent && kbd->parent->type
-		    && strcmp(kbd->parent->type, "adb") == 0)
+		if (of_node_is_type(kbd->parent, "adb"))
 			break;
 	of_node_put(kbd);
 	if (kbd)
-- 
2.7.4


^ permalink raw reply related

* [PATCH] powerpc: chrp: Use device_type helpers to access the node type
From: Guenter Roeck @ 2019-01-19 15:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Rob Herring, linux-kernel, Paul Mackerras, linuxppc-dev,
	Guenter Roeck

The node type can no longer be accessed directly, resulting in the
following build error. Use accessor function instead.

arch/powerpc/platforms/chrp/setup.c: In function ‘chrp_init_IRQ’:
arch/powerpc/platforms/chrp/setup.c:541:33: error:
	‘struct device_node’ has no member named ‘type’

Fixes: 8ce5f8415753 ("of: Remove struct device_node.type pointer")
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 arch/powerpc/platforms/chrp/setup.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index e66644e0fb40..c79f626502bf 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -538,8 +538,7 @@ static void __init chrp_init_IRQ(void)
 	/* see if there is a keyboard in the device tree
 	   with a parent of type "adb" */
 	for_each_node_by_name(kbd, "keyboard")
-		if (kbd->parent && kbd->parent->type
-		    && strcmp(kbd->parent->type, "adb") == 0)
+		if (kbd->parent && of_node_is_type(kbd->parent, "adb"))
 			break;
 	of_node_put(kbd);
 	if (kbd)
-- 
2.7.4


^ permalink raw reply related

* Re: [PATCH v2 29/29] y2038: add 64-bit time_t syscalls to all 32-bit architectures
From: Russell King - ARM Linux admin @ 2019-01-19 14:28 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Rich Felker, linux-ia64, Linux-sh list, Will Deacon, linux-mips,
	Max Filippov, Network Development, Deepa Dinamani, H. Peter Anvin,
	sparclinux, linux-arch, linux-s390, y2038 Mailman List,
	Helge Deller, X86 ML, Ingo Molnar, Geert Uytterhoeven,
	Catalin Marinas, Firoz Khan, Matt Turner, Fenghua Yu,
	Arnd Bergmann, Heiko Carstens, Linux FS Devel, linux-m68k,
	Thomas Gleixner, linux-arm-kernel, Michal Simek, Tony Luck,
	Parisc List, Linux API, LKML, Paul Burton, Eric W. Biederman,
	alpha, Martin Schwidefsky, Andrew Morton, linuxppc-dev,
	David S. Miller
In-Reply-To: <CALCETrWPj6dHEyo=AELoVjXGsiwuSpRp17x3CEWBHvp7i3cy+Q@mail.gmail.com>

On Fri, Jan 18, 2019 at 11:53:25AM -0800, Andy Lutomirski wrote:
> On Fri, Jan 18, 2019 at 11:33 AM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > On Fri, Jan 18, 2019 at 7:50 PM Andy Lutomirski <luto@kernel.org> wrote:
> > > On Fri, Jan 18, 2019 at 8:25 AM Arnd Bergmann <arnd@arndb.de> wrote:
> > > > - Once we get to 512, we clash with the x32 numbers (unless
> > > >   we remove x32 support first), and probably have to skip
> > > >   a few more. I also considered using the 512..547 space
> > > >   for 32-bit-only calls (which never clash with x32), but
> > > >   that also seems to add a bit of complexity.
> > >
> > > I have a patch that I'll send soon to make x32 use its own table.  As
> > > far as I'm concerned, 547 is *it*.  548 is just a normal number and is
> > > not special.  But let's please not reuse 512..547 for other purposes
> > > on x86 variants -- that way lies even more confusion, IMO.
> >
> > Fair enough, the space for those numbers is cheap enough here.
> > I take it you mean we also should not reuse that number space if
> > we were to decide to remove x32 soon, but you are not worried
> > about clashing with arch/alpha when everything else uses consistent
> > numbers?
> >
> 
> I think we have two issues if we reuse those numbers for new syscalls.
> First, I'd really like to see new syscalls be numbered consistently
> everywhere, or at least on all x86 variants, and we can't on x32
> because they mean something else.  Perhaps more importantly, due to
> what is arguably a rather severe bug, issuing a native x86_64 syscall
> (x32 bit clear) with nr in the range 512..547 does *not* return
> -ENOSYS on a kernel with x32 enabled.  Instead it does something that
> is somewhat arbitrary.  With my patch applied, it will return -ENOSYS,
> but old kernels will still exist, and this will break syscall probing.
> 
> Can we perhaps just start the consistent numbers above 547 or maybe
> block out 512..547 in the new regime?

I don't think you gain much with that kind of scheme - it won't take
very long before an architecture misses having a syscall added, and
then someone else adds their own.  Been there with ARM - I was keeping
the syscall table in the same order as x86 for new syscalls, but now
that others have been adding syscalls to the table since I converted
ARM to the tabular form, that's now gone out the window.

So, I think it's completely pointless to do what you're suggesting.
We'll just end up with a big hole in the middle of the syscall table
and then revert back to random numbering of syscalls thereafter again.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

^ permalink raw reply

* Re: use generic DMA mapping code in powerpc V4
From: Christoph Hellwig @ 2019-01-19 14:04 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: linux-arch, Darren Stevens, linux-kernel, Julian Margetson,
	linux-mm, iommu, Paul Mackerras, Olof Johansson, linuxppc-dev,
	Christoph Hellwig
In-Reply-To: <20190119130222.GA24346@lst.de>

On Sat, Jan 19, 2019 at 02:02:22PM +0100, Christoph Hellwig wrote:
> Interesting.  This suggest it is related to the use of ZONE_DMA by
> the FSL SOCs that your board uses.  Let me investigate this a bit more.

As a hack to check that theory I've pushed a new commit to the
powerpc-dma.6-debug branch to use old powerpc GFP_DMA selection
with the new dma direct code:

http://git.infradead.org/users/hch/misc.git/commitdiff/5c532d07c2f3c3972104de505d06b8d85f403f06

And another one that drops the addressability checks that powerpc
never had:

http://git.infradead.org/users/hch/misc.git/commitdiff/18e7629b38465ca98f8e7eed639123a13ac3b669

Can you first test with both patches, and then just with the first
in case that worked?


^ permalink raw reply

* Re: use generic DMA mapping code in powerpc V4
From: Christoph Hellwig @ 2019-01-19 13:02 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: linux-arch, Darren Stevens, linux-kernel, Julian Margetson,
	linux-mm, iommu, Paul Mackerras, Olof Johansson, linuxppc-dev,
	Christoph Hellwig
In-Reply-To: <b9e5e081-a3cc-2625-4e08-2d55c2ba224b@xenosoft.de>

On Sat, Jan 19, 2019 at 12:52:52PM +0100, Christian Zigotzky wrote:
> Hi Christoph,
>
> I have found a small workaround. If I add 'mem=3500M' to the boot arguments 
> then it detects the SATA hard disk and boots without any problems.
>
> X5000> setenv bootargs root=/dev/sda2 console=ttyS0,115200 mem=3500M

Interesting.  This suggest it is related to the use of ZONE_DMA by
the FSL SOCs that your board uses.  Let me investigate this a bit more.

^ permalink raw reply

* Re: [PATCH] dmaengine: fsldma: Add 64-bit I/O accessors for powerpc64
From: Vinod Koul @ 2019-01-19 12:58 UTC (permalink / raw)
  To: Peng Ma
  Cc: Wen He, Leo Li, Scott Wood, Zhang Wei, dmaengine@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <VI1PR04MB4431C33B5155312CF7035584EDBB0@VI1PR04MB4431.eurprd04.prod.outlook.com>

On 24-12-18, 05:29, Peng Ma wrote:
> Hi Scott,
> 
> Oh, I did not see the in_XX64/out_XX64 supported only __powerpc64__ just now.
> Thanks for your reminder.

Can you send the formal patch for this...

FWIW, fsl patches were not merged last cycle because of reported
regression...

> 
> #ifdef __powerpc64__
> 
> #ifdef __BIG_ENDIAN__
> DEF_MMIO_OUT_D(out_be64, 64, std);
> DEF_MMIO_IN_D(in_be64, 64, ld);
> 
> /* There is no asm instructions for 64 bits reverse loads and stores */
> static inline u64 in_le64(const volatile u64 __iomem *addr)
> {
>         return swab64(in_be64(addr));
> }
> 
> static inline void out_le64(volatile u64 __iomem *addr, u64 val)
> {
>         out_be64(addr, swab64(val));
> }
> #else
> DEF_MMIO_OUT_D(out_le64, 64, std);
> DEF_MMIO_IN_D(in_le64, 64, ld);
> 
> /* There is no asm instructions for 64 bits reverse loads and stores */
> static inline u64 in_be64(const volatile u64 __iomem *addr)
> {
>         return swab64(in_le64(addr));
> }
> 
> static inline void out_be64(volatile u64 __iomem *addr, u64 val)
> {
>         out_le64(addr, swab64(val));
> }
> 
> #endif
> #endif /* __powerpc64__ */
> 
> Best Regards,
> Peng
> >-----Original Message-----
> >From: Scott Wood <oss@buserror.net>
> >Sent: 2018年12月24日 12:46
> >To: Peng Ma <peng.ma@nxp.com>; Leo Li <leoyang.li@nxp.com>; Zhang Wei
> ><zw@zh-kernel.org>
> >Cc: linuxppc-dev@lists.ozlabs.org; dmaengine@vger.kernel.org; Wen He
> ><wen.he_1@nxp.com>
> >Subject: Re: [PATCH] dmaengine: fsldma: Add 64-bit I/O accessors for
> >powerpc64
> >
> >On Mon, 2018-12-24 at 03:42 +0000, Peng Ma wrote:
> >> Hi Scott,
> >>
> >> You are right, we should support powerpc64, so could I changed it as
> >> fallows:
> >>
> >> diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index
> >> 88db939..057babf 100644
> >> --- a/drivers/dma/fsldma.h
> >> +++ b/drivers/dma/fsldma.h
> >> @@ -202,35 +202,10 @@ struct fsldma_chan {
> >>  #define fsl_iowrite32(v, p)    out_le32(p, v)
> >>  #define fsl_iowrite32be(v, p)  out_be32(p, v)
> >>
> >> -#ifndef __powerpc64__
> >> -static u64 fsl_ioread64(const u64 __iomem *addr) -{
> >> -       u32 fsl_addr = lower_32_bits(addr);
> >> -       u64 fsl_addr_hi = (u64)in_le32((u32 *)(fsl_addr + 1)) << 32;
> >> -
> >> -       return fsl_addr_hi | in_le32((u32 *)fsl_addr);
> >> -}
> >> -
> >> -static void fsl_iowrite64(u64 val, u64 __iomem *addr) -{
> >> -       out_le32((u32 __iomem *)addr + 1, val >> 32);
> >> -       out_le32((u32 __iomem *)addr, (u32)val);
> >> -}
> >> -
> >> -static u64 fsl_ioread64be(const u64 __iomem *addr) -{
> >> -       u32 fsl_addr = lower_32_bits(addr);
> >> -       u64 fsl_addr_hi = (u64)in_be32((u32 *)fsl_addr) << 32;
> >> -
> >> -       return fsl_addr_hi | in_be32((u32 *)(fsl_addr + 1));
> >> -}
> >> -
> >> -static void fsl_iowrite64be(u64 val, u64 __iomem *addr) -{
> >> -       out_be32((u32 __iomem *)addr, val >> 32);
> >> -       out_be32((u32 __iomem *)addr + 1, (u32)val);
> >> -}
> >> -#endif
> >> +#define fsl_ioread64(p)                in_le64(p)
> >> +#define fsl_ioread64be(p)      in_be64(p)
> >> +#define fsl_iowrite64(v, p)    out_le64(p, v)
> >> +#define fsl_iowrite64be(v, p)  out_be64(p, v)
> >>  #endif
> >
> >Then you'll break 32-bit, assuming those fake-it-with-two-32-bit-accesses
> >were actually needed.
> >
> >-Scott
> >
> 

-- 
~Vinod

^ permalink raw reply

* Re: use generic DMA mapping code in powerpc V4
From: Christian Zigotzky @ 2019-01-19 11:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Darren Stevens, linux-kernel, Julian Margetson,
	linux-mm, iommu, Paul Mackerras, Olof Johansson, linuxppc-dev
In-Reply-To: <f39d4fc6-7e4e-9132-c03f-59f1b52260e0@xenosoft.de>

Hi Christoph,

I have found a small workaround. If I add 'mem=3500M' to the boot 
arguments then it detects the SATA hard disk and boots without any problems.

X5000> setenv bootargs root=/dev/sda2 console=ttyS0,115200 mem=3500M

Cheers,
Christian


On 19 January 2019 at 12:40PM, Christian Zigotzky wrote:
> Hi Christoph,
>
> I bought a USB null modem RS-232 serial cable today so I was able to 
> get some SATA error messages.
>
> Error messages:
>
> [   13.468538] fsl-sata ffe220000.sata: Sata FSL Platform/CSB Driver init
> [   13.475106] fsl-sata ffe220000.sata: failed to start port 0 
> (errno=-12)
> [   13.481736] fsl-sata ffe221000.sata: Sata FSL Platform/CSB Driver init
> [   13.488267] fsl-sata ffe221000.sata: failed to start port 0 
> (errno=-12)
>
> ---
>
> errno=-12 = Out of memory
>
> Please find attached the complete serial log.
>
> Cheers,
> Christian
>
>
> On 18 January 2019 at 4:06PM, Christian Zigotzky wrote:
>> Hello Christoph,
>>
>> I was able to compile 257002094bc5935dd63207a380d9698ab81f0775 from 
>> your Git powerpc-dma.6-debug today.
>>
>> Unfortunately I don't see any error messages (kernel ring buffer) and 
>> I don't have a RS232 serial null modem cable to get them.
>>
>> Cheers,
>> Christian
>>
>>
>


^ permalink raw reply

* Re: use generic DMA mapping code in powerpc V4
From: Christian Zigotzky @ 2019-01-19 11:40 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Darren Stevens, linux-kernel, Julian Margetson,
	linux-mm, iommu, Paul Mackerras, Olof Johansson, linuxppc-dev
In-Reply-To: <e11e61b1-6468-122e-fc2b-3b3f857186bb@xenosoft.de>

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

Hi Christoph,

I bought a USB null modem RS-232 serial cable today so I was able to get 
some SATA error messages.

Error messages:

[   13.468538] fsl-sata ffe220000.sata: Sata FSL Platform/CSB Driver init
[   13.475106] fsl-sata ffe220000.sata: failed to start port 0 (errno=-12)
[   13.481736] fsl-sata ffe221000.sata: Sata FSL Platform/CSB Driver init
[   13.488267] fsl-sata ffe221000.sata: failed to start port 0 (errno=-12)

---

errno=-12 = Out of memory

Please find attached the complete serial log.

Cheers,
Christian


On 18 January 2019 at 4:06PM, Christian Zigotzky wrote:
> Hello Christoph,
>
> I was able to compile 257002094bc5935dd63207a380d9698ab81f0775 from 
> your Git powerpc-dma.6-debug today.
>
> Unfortunately I don't see any error messages (kernel ring buffer) and 
> I don't have a RS232 serial null modem cable to get them.
>
> Cheers,
> Christian
>
>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: PuTTY_serial.log --]
[-- Type: text/x-log; name="PuTTY_serial.log", Size: 35113 bytes --]

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2019.01.19 12:21:05 =~=~=~=~=~=~=~=~=~=~=~=


U-Boot 2014.04 (Oct 17 2016 - 08:22:22)

CPU0:  P5020, Version: 2.0, (0x82200020)
Core:  e5500, Version: 1.2, (0x80240012)
Clock Configuration:
       CPU0:1995 MHz, CPU1:1995 MHz, 
       CCB:798  MHz,
       DDR:665  MHz (1330 MT/s data rate) (Asynchronous), LBC:49.875 MHz
       FMAN1: 498.750 MHz
       QMAN:  399 MHz
       PME:   399 MHz
L1:    D-cache 32 KiB enabled
       I-cache 32 KiB enabled
Reset Configuration Word (RCW):
       00000000: 0c540000 00000000 1e1e0000 00000000
       00000010: 44808c00 ff002000 68000000 45000000
       00000020: 00000000 00000000 00000000 0003000f
       00000030: a0000000 00000000 00000000 00000000
Board: CYRUS
36-bit Addressing
I2C:   ready
SPI:   ready
DRAM:  Initializing....using SPD
Detected UDIMM KHX1600C10D3/4G   
Detected UDIMM KHX1600C10D3/4G   
Not enough bank(chip-select) for CS0+CS1 on controller 0, interleaving disabled!
Not enough bank(chip-select) for CS0+CS1 on controller 1, interleaving disabled!
6 GiB left unmapped
8 GiB (DDR3, 64-bit, CL=9, ECC off)
       DDR Controller Interleaving Mode: cache line

Local Bus Controller Registers
BR0	0xE0001001	OR0	0xFFF00010
BR1	0xE1001001	OR1	0xFFF00010
BR2	0x00000000	OR2	0x00000000
BR3	0x00000000	OR3	0x00000000
BR4	0x00000000	OR4	0x00000000
BR5	0x00000000	OR5	0x00000000
BR6	0x00000000	OR6	0x00000000
BR7	0x00000000	OR7	0x00000000
LBCR	0x40000000	LCRR	0x80010004
L2:    512 KiB enabled
Corenet Platform Cache: 2 MiB enabled
SERDES: bank 2 disabled
MMC:  FSL_SDHC: 0
EEPROM: NXID v0
PCIe1: Root Complex, x4 gen2, regs @ 0xfe200000
  01:00.0     - 1002:9440 - Display controller
PCIe1: Bus 00 - 01
PCIe2: Root Complex, x4 gen2, regs @ 0xfe201000
  03:00.0     - 111d:8092 - Bridge device
   04:01.0    - 111d:8092 - Bridge device
    05:00.0   - 12d8:e111 - Bridge device
     06:04.0  - 10ec:8139 - Network controller
     06:05.0  - 109e:036e - Multimedia device
     06:05.1  - 109e:0878 - Multimedia device
   04:02.0    - 111d:8092 - Bridge device
   04:03.0    - 111d:8092 - Bridge device
   04:08.0    - 111d:8092 - Bridge device
   04:10.0    - 111d:8092 - Bridge device
PCIe2: Bus 02 - 0a
PCIe3: disabled
PCIe4: disabled
Looking for VGA
PINS: 0xfc000808
videoboot: Booting PCI video card bus 1, function 0, device 0
Begin BIOS POST
End BIOS POST
Setting VESA Mode
Found required VESA mode
About to set mode 279
About to get mode
Got mode 49431 (0xc117)
OK
XSize = 1024 YSize = 768 Base =0xe0000000
mmio_base = 0x80000000
bgx = 0xad55ad55 fgx = 0x0
In:    serial
Out:   serial
Err:   serial
ID: NXID v0
SN: 116330018
UID: 442943100191005198d3a080a0800000
Errata: ÿÿÿÿÿ\x15	"\x108
Build date: 2015/09/22 10:38:00 
CRC: d4925668
SCSI:  scanning bus for devices...
Found 0 device(s).
Net:   Initializing Fman

MMC read: dev # 0, block # 1130, count 128 ...
Fman1: Uploading microcode version 106.1.0
Tuning PHY @ 3
Tuning PHY @ 7
FM1@DTSEC4 [PRIME], FM1@DTSEC5

MMC read: dev # 0, block # 1280, count 512 ... 512 blocks read: OK

MMC read: dev # 0, block # 65536, count 131072 ... 131072 blocks read: OK
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 5 USB Device(s) found
USB1:   USB EHCI 1.00
scanning bus 1 for devices... ERROR: Invalid USB EP length (9)
ERROR: Invalid USB EP length (9)
ERROR: Invalid USB EP length (9)
4 USB Device(s) found
Timeout poll on interrupt endpoint
Failed to get keyboard state from device 0c45:5303
SATA0 (3 Gbps)
\r       SATA1 (No RDY)
\rscanning bus for devices...
Found 0 device(s).
X5000> setenv bootargs root=/dev/sda2 console=ttyS0,115200
X5000> load sata 0:1 1000000 uImage-5.0
reading uImage-5.0
10687255 bytes read in 75 ms (135.9 MiB/s)
X5000> iminfo

## Checking Image at 01000000 ...
   Legacy image found
   Image Name:   Linux-5.0.0-rc2-2_A-EON_A1-X5000
   Created:      2019-01-18  14:47:06 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    10687191 Bytes = 10.2 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
X5000> load sata 0:1 2000000 cyrus.dtb
reading cyrus.dtb
29244 bytes read in 27 ms (1 MiB/s)
X5000> bootm 1000000 - 2000000
WARNING: adjusting available memory to 30000000
## Booting kernel from Legacy Image at 01000000 ...
   Image Name:   Linux-5.0.0-rc2-2_A-EON_A1-X5000
   Created:      2019-01-18  14:47:06 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    10687191 Bytes = 10.2 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02000000
   Booting using the fdt blob at 0x2000000
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 03fe5000, end 03fff23b ... OK
[    0.000000] OF: reserved mem: initialized node qman-fqd, compatible id fsl,qman-fqd
[    0.000000] OF: reserved mem: initialized node qman-pfdr, compatible id fsl,qman-pfdr
[    0.000000] OF: reserved mem: initialized node bman-fbpr, compatible id fsl,bman-fbpr
[    0.000000] MMU: Supported page sizes
[    0.000000]          4 KB as direct
[    0.000000]       4096 KB as direct
[    0.000000]      16384 KB as direct
[    0.000000]      65536 KB as direct
[    0.000000]     262144 KB as direct
[    0.000000]    1048576 KB as direct
[    0.000000] MMU: Book3E HW tablewalk not supported
[    0.000000] Linux version 5.0.0-rc2-2_A-EON_A1-X5000-54574-g2570020-dirty (christian@christian-virtual-machine) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)) #1 SMP Fri Jan 18 15:36:47 CET 2019
[    0.000000] Using CoreNet Generic machine description
[    0.000000] CPU maps initialized for 1 thread per core
[    0.000000] -----------------------------------------------------
[    0.000000] phys_mem_size     = 0x200000000
[    0.000000] dcache_bsize      = 0x40
[    0.000000] icache_bsize      = 0x40
[    0.000000] cpu_features      = 0x00000003008003b4
[    0.000000]   possible        = 0x00000003009003b4
[    0.000000]   always          = 0x00000003008003b4
[    0.000000] cpu_user_features = 0xcc008000 0x08000000
[    0.000000] mmu_features      = 0x000a0010
[    0.000000] firmware_features = 0x0000000000000000
[    0.000000] -----------------------------------------------------
[    0.000000] CoreNet Generic board
[    0.000000] barrier-nospec: using isync; sync as speculation barrier
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x000000007fffefff]
[    0.000000]   Normal   [mem 0x000000007ffff000-0x00000001ffffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x00000001ffffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000001ffffffff]
[    0.000000] MMU: Allocated 2112 bytes of context maps for 255 contexts
[    0.000000] percpu: Embedded 21 pages/cpu @(____ptrval____) s48464 r0 d37552 u524288
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2068479
[    0.000000] Kernel command line: root=/dev/sda2 console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
[    0.000000] Memory: 8117692K/8388608K available (12580K kernel code, 2112K rwdata, 8316K rodata, 420K init, 747K bss, 270916K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 100 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 512, nr_irqs: 512, preallocated irqs: 16
[    0.000000] mpic: Setting up MPIC " OpenPIC  " version 1.2 at ffe040000, max 2 CPUs
[    0.000000] mpic: ISU size: 512, shift: 9, mask: 1ff
[    0.000000] mpic: Initializing for 512 sources
[    0.000003] clocksource: timebase: mask: 0xffffffffffffffff max_cycles: 0x5c0589001, max_idle_ns: 440795202458 ns
[    0.000007] clocksource: timebase mult[2819aa06] shift[24] registered
[    0.001397] Console: colour dummy device 80x25
[    0.001411] pid_max: default: 32768 minimum: 301
[    0.001498] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.001532] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.002112] e500 family performance monitor hardware support registered
[    0.002155] rcu: Hierarchical SRCU implementation.
[    0.002336] smp: Bringing up secondary CPUs ...
[    0.002742] smp: Brought up 1 node, 2 CPUs
[    0.002745] Using standard scheduler topology
[    0.003251] devtmpfs: initialized
[    0.005271] random: get_random_u32 called from .bucket_table_alloc+0x170/0x1b8 with crng_init=0
[    0.005472] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.005479] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.005541] xor: measuring software checksum speed
[    0.015415]    8regs     :  4124.000 MB/sec
[    0.025436]    8regs_prefetch:  3828.000 MB/sec
[    0.035455]    32regs    :  4384.000 MB/sec
[    0.045477]    32regs_prefetch:  3820.000 MB/sec
[    0.045479] xor: using function: 32regs (4384.000 MB/sec)
[    0.045757] NET: Registered protocol family 16
[    0.046508] cpuidle: using governor ladder
[    0.046543] cpuidle: using governor menu
[    0.051679] Machine: varisys,CYRUS
[    0.051683] SoC family: QorIQ
[    0.051685] SoC ID: svr:0x82200020, Revision: 2.0
[    0.053835] Found FSL PCI host bridge at 0x0000000ffe200000. Firmware bus number: 0->1
[    0.053839] PCI host bridge /pcie@ffe200000  ranges:
[    0.053846]  MEM 0x0000000c00000000..0x0000000c1fffffff -> 0x00000000e0000000 
[    0.053850]   IO 0x0000000ff8000000..0x0000000ff800ffff -> 0x0000000000000000
[    0.053874] /pcie@ffe200000: PCICSRBAR @ 0xdf000000
[    0.053877] setup_pci_atmu: end of DRAM 200000000
[    0.053884] /pcie@ffe200000: Setup 64-bit PCI DMA window
[    0.053886] /pcie@ffe200000: DMA window size is 0xdf000000
[    0.054103] Found FSL PCI host bridge at 0x0000000ffe201000. Firmware bus number: 0->8
[    0.054106] PCI host bridge /pcie@ffe201000  ranges:
[    0.054112]  MEM 0x0000000c20000000..0x0000000c3fffffff -> 0x00000000e0000000 
[    0.054116]   IO 0x0000000ff8010000..0x0000000ff801ffff -> 0x0000000000000000
[    0.054128] /pcie@ffe201000: PCICSRBAR @ 0xdf000000
[    0.054131] setup_pci_atmu: end of DRAM 200000000
[    0.054137] /pcie@ffe201000: Setup 64-bit PCI DMA window
[    0.054140] /pcie@ffe201000: DMA window size is 0xdf000000
[    0.055304] software IO TLB: mapped [mem 0xfbfff000-0xfffff000] (64MB)
[    0.055308] PCI: Probing PCI hardware
[    0.055374] fsl-pci ffe200000.pcie: PCI host bridge to bus 0000:00
[    0.055382] pci_bus 0000:00: root bus resource [io  0x8000080000010000-0x800008000001ffff] (bus address [0x0000-0xffff])
[    0.055387] pci_bus 0000:00: root bus resource [mem 0xc00000000-0xc1fffffff] (bus address [0xe0000000-0xffffffff])
[    0.055391] pci_bus 0000:00: root bus resource [bus 00-01]
[    0.057103] pci 0000:01:00.0: enabling Extended Tags
[    0.057163] pci 0000:01:00.0: 16.000 Gb/s available PCIe bandwidth, limited by 5 GT/s x4 link at 0000:00:00.0 (capable of 64.000 Gb/s with 5 GT/s x16 link)
[    0.061114] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    0.061232] fsl-pci ffe201000.pcie: PCI host bridge to bus 1000:00
[    0.061237] pci_bus 1000:00: root bus resource [io  0x8000080000021000-0x8000080000030fff] (bus address [0x0000-0xffff])
[    0.061242] pci_bus 1000:00: root bus resource [mem 0xc20000000-0xc3fffffff] (bus address [0xe0000000-0xffffffff])
[    0.061249] pci_bus 1000:00: root bus resource [bus 00-08]
[    0.062895] pci 1000:01:00.0: enabling Extended Tags
[    0.067165] pci 1000:00:00.0: PCI bridge to [bus 01-ff]
[    0.067402] pci 1000:02:01.0: enabling Extended Tags
[    0.067744] pci 1000:02:02.0: enabling Extended Tags
[    0.068092] pci 1000:02:03.0: enabling Extended Tags
[    0.068607] pci 1000:02:08.0: enabling Extended Tags
[    0.069241] pci 1000:02:10.0: enabling Extended Tags
[    0.070106] pci 1000:01:00.0: PCI bridge to [bus 02-ff]
[    0.070355] pci 1000:03:00.0: enabling Extended Tags
[    0.075248] pci 1000:02:01.0: PCI bridge to [bus 03-ff]
[    0.075355] pci_bus 1000:04: extended config space not accessible
[    0.077511] pci 1000:03:00.0: PCI bridge to [bus 04-ff]
[    0.078976] pci 1000:02:02.0: PCI bridge to [bus 05-ff]
[    0.080397] pci 1000:02:03.0: PCI bridge to [bus 06-ff]
[    0.081817] pci 1000:02:08.0: PCI bridge to [bus 07-ff]
[    0.083233] pci 1000:02:10.0: PCI bridge to [bus 08-ff]
[    0.083290] PCI: Cannot allocate resource region 0 of device 0000:00:00.0, will remap
[    0.083297] PCI: Cannot allocate resource region 0 of device 1000:00:00.0, will remap
[    0.083374] pci 0000:00:00.0: BAR 0: no space for [mem size 0x01000000]
[    0.083378] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x01000000]
[    0.083384] pci 0000:01:00.0: BAR 6: assigned [mem 0xc10020000-0xc1003ffff pref]
[    0.083388] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.083393] pci 0000:00:00.0:   bridge window [io  0x8000080000010000-0x800008000001ffff]
[    0.083398] pci 0000:00:00.0:   bridge window [mem 0xc00000000-0xc1fffffff]
[    0.083404] pci_bus 0000:00: Some PCI device resources are unassigned, try booting with pci=realloc
[    0.083498] pci 1000:00:00.0: BAR 0: no space for [mem size 0x01000000]
[    0.083502] pci 1000:00:00.0: BAR 0: failed to assign [mem size 0x01000000]
[    0.083508] pci 1000:03:00.0: PCI bridge to [bus 04]
[    0.083514] pci 1000:03:00.0:   bridge window [io  0x8000080000022000-0x8000080000022fff]
[    0.083518] pci 1000:03:00.0:   bridge window [mem 0xc20000000-0xc200fffff]
[    0.083525] pci 1000:02:01.0: PCI bridge to [bus 03-04]
[    0.083531] pci 1000:02:01.0:   bridge window [io  0x8000080000022000-0x8000080000022fff]
[    0.083536] pci 1000:02:01.0:   bridge window [mem 0xc20000000-0xc200fffff]
[    0.083545] pci 1000:02:02.0: PCI bridge to [bus 05]
[    0.083561] pci 1000:02:03.0: PCI bridge to [bus 06]
[    0.083576] pci 1000:02:08.0: PCI bridge to [bus 07]
[    0.083592] pci 1000:02:10.0: PCI bridge to [bus 08]
[    0.083607] pci 1000:01:00.0: PCI bridge to [bus 02-08]
[    0.083614] pci 1000:01:00.0:   bridge window [io  0x8000080000022000-0x8000080000022fff]
[    0.083619] pci 1000:01:00.0:   bridge window [mem 0xc20000000-0xc200fffff]
[    0.083629] pci 1000:00:00.0: PCI bridge to [bus 01-08]
[    0.083635] pci 1000:00:00.0:   bridge window [io  0x8000080000021000-0x8000080000030fff]
[    0.083639] pci 1000:00:00.0:   bridge window [mem 0xc20000000-0xc3fffffff]
[    0.083644] pci_bus 1000:00: Some PCI device resources are unassigned, try booting with pci=realloc
[    0.084879] Setting up RapidIO peer-to-peer network /rapidio@ffe0c0000
[    0.084887] fsl-of-rio ffe0c0000.rapidio: Of-device full name /rapidio@ffe0c0000
[    0.084891] fsl-of-rio ffe0c0000.rapidio: Regs: [mem 0xffe0c0000-0xffe0d0fff]
[    0.084898] fsl-of-rio ffe0c0000.rapidio: No valid fsl,srio-rmu-handle property
[    0.084910] fsl-of-rio: probe of ffe0c0000.rapidio failed with error -2
[    0.118800] raid6: int64x1  gen()   695 MB/s
[    0.135848] raid6: int64x1  xor()   693 MB/s
[    0.152878] raid6: int64x2  gen()  1132 MB/s
[    0.169899] raid6: int64x2  xor()   908 MB/s
[    0.186912] raid6: int64x4  gen()  1351 MB/s
[    0.203956] raid6: int64x4  xor()   964 MB/s
[    0.220982] raid6: int64x8  gen()  1183 MB/s
[    0.238011] raid6: int64x8  xor()   833 MB/s
[    0.238014] raid6: using algorithm int64x4 gen() 1351 MB/s
[    0.238016] raid6: .... xor() 964 MB/s, rmw enabled
[    0.238018] raid6: using intx1 recovery algorithm
[    0.238087] Freescale Elo series DMA driver
[    0.238311] fsl-elo-dma ffe100300.dma: #0 (fsl,eloplus-dma-channel), irq 28
[    0.238350] fsl-elo-dma ffe100300.dma: #1 (fsl,eloplus-dma-channel), irq 29
[    0.238388] fsl-elo-dma ffe100300.dma: #2 (fsl,eloplus-dma-channel), irq 30
[    0.238428] fsl-elo-dma ffe100300.dma: #3 (fsl,eloplus-dma-channel), irq 31
[    0.238655] fsl-elo-dma ffe101300.dma: #0 (fsl,eloplus-dma-channel), irq 32
[    0.238693] fsl-elo-dma ffe101300.dma: #1 (fsl,eloplus-dma-channel), irq 33
[    0.238733] fsl-elo-dma ffe101300.dma: #2 (fsl,eloplus-dma-channel), irq 34
[    0.238772] fsl-elo-dma ffe101300.dma: #3 (fsl,eloplus-dma-channel), irq 35
[    0.239287] pci 0000:01:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
[    0.239304] pci 0000:01:00.0: vgaarb: bridge control possible
[    0.239309] pci 0000:01:00.0: vgaarb: setting as boot device (VGA legacy resources not available)
[    0.239311] vgaarb: loaded
[    0.239466] SCSI subsystem initialized
[    0.239685] usbcore: registered new interface driver usbfs
[    0.239709] usbcore: registered new interface driver hub
[    0.239731] usbcore: registered new device driver usb
[    0.239826] pps_core: LinuxPPS API ver. 1 registered
[    0.239829] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.239839] PTP clock support registered
[    0.240048] EDAC MC: Ver: 3.0.0
[    0.240675] Advanced Linux Sound Architecture Driver Initialized.
[    0.240920] NET: Registered protocol family 8
[    0.240923] NET: Registered protocol family 20
[    0.241198] clocksource: Switched to clocksource timebase
[    0.241287] FS-Cache: Loaded
[    0.241345] CacheFiles: Loaded
[    0.245992] NET: Registered protocol family 2
[    0.246271] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes)
[    0.246324] TCP established hash table entries: 65536 (order: 7, 524288 bytes)
[    0.246634] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
[    0.247286] TCP: Hash tables configured (established 65536 bind 65536)
[    0.247374] UDP hash table entries: 4096 (order: 5, 131072 bytes)
[    0.247463] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes)
[    0.247630] NET: Registered protocol family 1
[    0.247844] RPC: Registered named UNIX socket transport module.
[    0.247848] RPC: Registered udp transport module.
[    0.247850] RPC: Registered tcp transport module.
[    0.247852] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.248831] Initialise system trusted keyrings
[    0.248977] workingset: timestamp_bits=62 max_order=21 bucket_order=0
[    0.252387] zbud: loaded
[    0.253120] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.253934] ntfs: driver 2.1.32 [Flags: R/W].
[    0.254057] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.254302] fuse init (API version 7.28)
[    0.260983] NET: Registered protocol family 38
[    0.261008] async_tx: api initialized (async)
[    0.261013] Key type asymmetric registered
[    0.261016] Asymmetric key parser 'x509' registered
[    0.261047] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[    0.261051] io scheduler mq-deadline registered
[    0.261054] io scheduler kyber registered
[    0.262144] crc32: CRC_LE_BITS = 64, CRC_BE BITS = 64
[    0.262147] crc32: self tests passed, processed 225944 bytes in 509795 nsec
[    0.262685] crc32c: CRC_LE_BITS = 64
[    0.262688] crc32c: self tests passed, processed 225944 bytes in 258927 nsec
[    0.297559] crc32_combine: 8373 self tests passed
[    0.333092] crc32c_combine: 8373 self tests passed
[    0.333564] pcieport 0000:00:00.0: Signaling PME with IRQ 482
[    0.333674] aer 0000:00:00.0:pcie002: AER enabled with IRQ 482
[    0.333791] pcieport 1000:00:00.0: Signaling PME with IRQ 481
[    0.333924] aer 1000:00:00.0:pcie002: AER enabled with IRQ 481
[    0.339947] bman_portal ff4000000.bman-portal: Portal initialised, cpu 0
[    0.339998] bman_portal ff4004000.bman-portal: Portal initialised, cpu 1
[    0.340437] qman_portal ff4200000.qman-portal: Portal initialised, cpu 0
[    0.340557] qman_portal ff4204000.qman-portal: Portal initialised, cpu 1
[    0.362499] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.363201] printk: console [ttyS0] disabled
[    0.363228] serial8250.0: ttyS0 at MMIO 0xffe11c500 (irq = 36, base_baud = 24937500) is a 16550A
[    1.740554] printk: console [ttyS0] enabled
[    1.744996] serial8250.0: ttyS1 at MMIO 0xffe11c600 (irq = 36, base_baud = 24937500) is a 16550A
[    1.754002] serial8250.0: ttyS2 at MMIO 0xffe11d500 (irq = 37, base_baud = 24937500) is a 16550A
[    1.763023] serial8250.0: ttyS3 at MMIO 0xffe11d600 (irq = 37, base_baud = 24937500) is a 16550A
[    1.771981] ePAPR hypervisor byte channel driver
[    1.776864] [drm] radeon kernel modesetting enabled.
[    1.782082] [drm] initializing kernel modesetting (RV770 0x1002:0x9440 0x106B:0x00B2 0x00).
[    2.103187] ATOM BIOS: Wekiva
[    2.106196] radeon 0000:01:00.0: VRAM: 512M 0x0000000000000000 - 0x000000001FFFFFFF (512M used)
[    2.114870] radeon 0000:01:00.0: GTT: 1024M 0x0000000020000000 - 0x000000005FFFFFFF
[    2.122501] [drm] Detected VRAM RAM=512M, BAR=256M
[    2.127274] [drm] RAM width 256bits DDR
[    2.131178] [TTM] Zone  kernel: Available graphics memory: 4058846 kiB
[    2.137689] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[    2.144196] [TTM] Initializing pool allocator
[    2.148545] [TTM] Initializing DMA pool allocator
[    2.153261] [drm] radeon: 512M of VRAM memory ready
[    2.158125] [drm] radeon: 1024M of GTT memory ready.
[    2.163085] [drm] Loading RV770 Microcode
[    2.167108] [drm] Internal thermal controller with fan control
[    2.172974] [drm] radeon: power management initialized
[    2.178139] [drm] GART: num cpu pages 262144, num gpu pages 262144
[    2.186388] [drm] enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0
[    2.222626] [drm] PCIE GART of 1024M enabled (table at 0x0000000000146000).
[    2.229633] radeon 0000:01:00.0: WB enabled
[    2.233812] radeon 0000:01:00.0: fence driver on ring 0 use gpu addr 0x0000000020000c00 and cpu addr 0x(____ptrval____)
[    2.244564] radeon 0000:01:00.0: fence driver on ring 3 use gpu addr 0x0000000020000c0c and cpu addr 0x(____ptrval____)
[    2.257215] radeon 0000:01:00.0: fence driver on ring 5 use gpu addr 0x0000000000056230 and cpu addr 0x(____ptrval____)
[    2.267966] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    2.274558] [drm] Driver supports precise vblank timestamp query.
[    2.280630] radeon 0000:01:00.0: radeon: MSI limited to 32-bit
[    2.286513] radeon 0000:01:00.0: radeon: using MSI.
[    2.291400] [drm] radeon: irq initialized.
[    2.340331] [drm] ring test on 0 succeeded in 1 usecs
[    2.345369] [drm] ring test on 3 succeeded in 2 usecs
[    3.482323] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[    4.472193] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[    5.462066] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[    6.451940] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[    7.441817] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[    8.431691] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[    9.421565] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[   10.411442] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[   11.401316] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[   12.391193] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, trying to reset the VCPU!!!
[   12.418597] [drm:.uvd_v1_0_start] *ERROR* UVD not responding, giving up!!!
[   12.425453] radeon 0000:01:00.0: failed initializing UVD (-1).
[   12.431467] [drm] ib test on ring 0 succeeded in 0 usecs
[   12.436782] [drm] ib test on ring 3 succeeded in 0 usecs
[   12.442523] [drm] Radeon Display Connectors
[   12.446692] [drm] Connector 0:
[   12.449732] [drm]   DVI-I-1
[   12.452512] [drm]   HPD1
[   12.455033] [drm]   DDC: 0x7e20 0x7e20 0x7e24 0x7e24 0x7e28 0x7e28 0x7e2c 0x7e2c
[   12.462404] [drm]   Encoders:
[   12.465358] [drm]     CRT2: INTERNAL_KLDSCP_DAC2
[   12.469958] [drm]     DFP2: INTERNAL_KLDSCP_LVTMA
[   12.474644] [drm] Connector 1:
[   12.477684] [drm]   DP-1
[   12.480203] [drm]   HPD2
[   12.482724] [drm]   DDC: 0x7e60 0x7e60 0x7e64 0x7e64 0x7e68 0x7e68 0x7e6c 0x7e6c
[   12.490095] [drm]   Encoders:
[   12.493048] [drm]     DFP1: INTERNAL_UNIPHY
[   12.574505] [drm] fb mappable at 0xC00347000
[   12.578759] [drm] vram apper at 0xC00000000
[   12.582924] [drm] size 7680000
[   12.585963] [drm] fb depth is 24
[   12.589176] [drm]    pitch is 6400
[   12.625425] Console: switching to colour frame buffer device 200x75
[   12.654426] radeon 0000:01:00.0: fb0: radeondrmfb frame buffer device
[   12.660886] [drm] Initialized radeon 2.50.0 20080528 for 0000:01:00.0 on minor 0
[   12.671750] brd: module loaded
[   12.677664] loop: module loaded
[   12.681010] zram: Added device: zram0
[   13.468538] fsl-sata ffe220000.sata: Sata FSL Platform/CSB Driver init
[   13.475106] fsl-sata ffe220000.sata: failed to start port 0 (errno=-12)
[   13.481736] fsl-sata ffe221000.sata: Sata FSL Platform/CSB Driver init
[   13.488267] fsl-sata ffe221000.sata: failed to start port 0 (errno=-12)
[   13.495807] fsl_espi ffe110000.spi: at 0x(____ptrval____) (irq = 53)
[   13.502870] libphy: Fixed MDIO Bus: probed
[   13.508871] libphy: Freescale PowerQUICC MII Bus: probed
[   13.514858] libphy: Freescale PowerQUICC MII Bus: probed
[   13.520705] libphy: Freescale PowerQUICC MII Bus: probed
[   13.526537] libphy: Freescale PowerQUICC MII Bus: probed
[   13.532494] libphy: Freescale PowerQUICC MII Bus: probed
[   13.538479] libphy: Freescale XGMAC MDIO Bus: probed
[   13.548415] fsl_dpaa_mac ffe4e0000.ethernet: of_get_mac_address(/soc@ffe000000/fman@400000/ethernet@e0000) failed
[   13.558659] fsl_dpaa_mac: probe of ffe4e0000.ethernet failed with error -22
[   13.565637] fsl_dpaa_mac ffe4e2000.ethernet: of_get_mac_address(/soc@ffe000000/fman@400000/ethernet@e2000) failed
[   13.575874] fsl_dpaa_mac: probe of ffe4e2000.ethernet failed with error -22
[   13.582851] fsl_dpaa_mac ffe4e4000.ethernet: of_get_mac_address(/soc@ffe000000/fman@400000/ethernet@e4000) failed
[   13.593088] fsl_dpaa_mac: probe of ffe4e4000.ethernet failed with error -22
[   13.600066] fsl_dpaa_mac ffe4e6000.ethernet: of_get_mac_address(/soc@ffe000000/fman@400000/ethernet@e6000) failed
[   13.610303] fsl_dpaa_mac: probe of ffe4e6000.ethernet failed with error -22
[   13.617281] fsl_dpaa_mac ffe4e8000.ethernet: of_get_mac_address(/soc@ffe000000/fman@400000/ethernet@e8000) failed
[   13.627518] fsl_dpaa_mac: probe of ffe4e8000.ethernet failed with error -22
[   13.634495] fsl_dpaa_mac ffe4f0000.ethernet: of_get_mac_address(/soc@ffe000000/fman@400000/ethernet@f0000) failed
[   13.644732] fsl_dpaa_mac: probe of ffe4f0000.ethernet failed with error -22
[   13.651729] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[   13.658755] e1000: Copyright (c) 1999-2006 Intel Corporation.
[   13.664517] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[   13.670330] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[   13.676275] 8139cp: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)
[   13.683130] 8139cp 1000:04:04.0: This (id 10ec:8139 rev 10) is not an 8139C+ compatible chip, use 8139too
[   13.692704] 8139too: 8139too Fast Ethernet driver 0.9.28
[   13.699026] 8139too 1000:04:04.0 eth0: RealTek RTL8139 at 0x(____ptrval____), 00:50:fc:cb:51:81, IRQ 17
[   13.708462] PPP generic driver version 2.4.2
[   13.712804] PPP BSD Compression module registered
[   13.717495] PPP Deflate Compression module registered
[   13.722541] PPP MPPE Compression module registered
[   13.727315] NET: Registered protocol family 24
[   13.731846] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   13.738470] ehci-pci: EHCI PCI platform driver
[   13.742927] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   13.749246] ohci-pci: OHCI PCI platform driver
[   13.754299] ehci-fsl: Freescale EHCI Host controller driver
[   13.759902] fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
[   13.766558] fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
[   13.773772] fsl-ehci fsl-ehci.0: can't setup: -12
[   13.778463] fsl-ehci fsl-ehci.0: USB bus 1 deregistered
[   13.783749] fsl-ehci fsl-ehci.0: init fsl-ehci.0 fail, -12
[   13.789225] fsl-ehci: probe of fsl-ehci.0 failed with error -12
[   13.795137] fsl-ehci fsl-ehci.1: Freescale On-Chip EHCI Host Controller
[   13.801781] fsl-ehci fsl-ehci.1: new USB bus registered, assigned bus number 1
[   13.808989] fsl-ehci fsl-ehci.1: can't setup: -12
[   13.813680] fsl-ehci fsl-ehci.1: USB bus 1 deregistered
[   13.818945] fsl-ehci fsl-ehci.1: init fsl-ehci.1 fail, -12
[   13.824419] fsl-ehci: probe of fsl-ehci.1 failed with error -12
[   13.830353] usbcore: registered new interface driver usblp
[   13.835841] usbcore: registered new interface driver usb-storage
[   13.841865] usbcore: registered new interface driver usbserial_generic
[   13.848385] usbserial: USB Serial support registered for generic
[   13.854386] usbcore: registered new interface driver ftdi_sio
[   13.860126] usbserial: USB Serial support registered for FTDI USB Serial Device
[   13.867799] mousedev: PS/2 mouse device common for all mice
[   13.873460] i2c /dev entries driver
[   13.877394] mpc-i2c ffe118100.i2c: timeout 1000000 us
[   13.882575] mpc-i2c ffe119100.i2c: timeout 1000000 us
[   13.889730] rtc-ds1307 7-006f: registered as rtc0
[   13.894571] mpc-i2c ffe118000.i2c: timeout 1000000 us
[   13.899732] mpc-i2c ffe119000.i2c: timeout 1000000 us
[   13.905228] ptp_qoriq: device tree node missing required elements, try automatic configuration
[   13.913814] ptp_qoriq: error reference clock value, or lower than 100MHz
[   13.920497] ptp_qoriq: probe of ffe4fe000.ptp-timer failed with error -22
[   13.927991] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
[   13.936617] sdhci: Secure Digital Host Controller Interface driver
[   13.942777] sdhci: Copyright(c) Pierre Ossman
[   13.947165] sdhci-pltfm: SDHCI platform and OF driver helper
[   13.953024] mmc0: Unable to allocate ADMA buffers - falling back to standard DMA
[   13.960506] mmc0 bounce up to 128 segments into one, max segment size 65536 bytes
[   13.993152] mmc0: SDHCI controller on ffe114000.sdhc [ffe114000.sdhc] using DMA
[   14.000635] ledtrig-cpu: registered to indicate activity on CPUs
[   14.006688] hidraw: raw HID events driver (C) Jiri Kosina
[   14.012449] usbcore: registered new interface driver usbhid
[   14.018004] usbhid: USB HID core driver
[   14.021935] Freescale hypervisor management driver
[   14.026714] fsl-hv: no hypervisor found
[   14.032306] usbcore: registered new interface driver snd-usb-audio
[   14.038493] usbcore: registered new interface driver snd-ua101
[   14.044329] usbcore: registered new interface driver snd-usb-usx2y
[   14.050595] ipip: IPv4 and MPLS over IPv4 tunneling driver
[   14.056280] IPv4 over IPsec tunneling driver
[   14.060705] Initializing XFRM netlink socket
[   14.065244] NET: Registered protocol family 10
[   14.070224] Segment Routing with IPv6
[   14.073922] mip6: Mobile IPv6
[   14.077131] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[   14.083448] NET: Registered protocol family 17
[   14.087884] NET: Registered protocol family 15
[   14.092342] lec:lane_module_init: lec.c: initialized
[   14.097297] mpoa:atm_mpoa_init: mpc.c: initialized
[   14.102082] l2tp_core: L2TP core driver, V2.0
[   14.118179] DCCP: Activated CCID 2 (TCP-like)
[   14.122560] DCCP: Activated CCID 3 (TCP-Friendly Rate Control)
[   14.128650] sctp: Hash tables configured (bind 256/256)
[   14.134142] NET: Registered protocol family 21
[   14.138655] Registered RDS/tcp transport
[   14.142568] tipc: Activated (version 2.0.0)
[   14.146767] NET: Registered protocol family 30
[   14.151245] tipc: Started in single node mode
[   14.155991] Key type dns_resolver registered
[   14.160413] batman_adv: B.A.T.M.A.N. advanced 2019.0 (compatibility version 15) loaded
[   14.168458] drmem: No dynamic reconfiguration memory found
[   14.174152] Loading compiled-in X.509 certificates
[   14.178999] zswap: loaded using pool lzo/zbud
[   14.183926] Btrfs loaded, crc32c=crc32c-generic
[   14.188802] Key type encrypted registered
[   14.194270] rtc-ds1307 7-006f: setting system clock to 2019-01-19 11:24:12 UTC (1547897052)
[   14.202820] ALSA device list:
[   14.205784]   #0: Virtual MIDI Card 1
[   14.209774] md: Waiting for all devices to be available before autodetect
[   14.216553] md: If you don't use raid, use raid=noautodetect
[   14.222451] md: Autodetecting RAID arrays.
[   14.226539] md: autorun ...
[   14.229321] md: ... autorun DONE.
[   14.232751] VFS: Cannot open root device "sda2" or unknown-block(0,0): error -6
[   14.240048] Please append a correct "root=" boot option; here are the available partitions:
[   14.248379] 0100          131072 ram0 
[   14.248380]  (driver?)
[   14.254460] 0101          131072 ram1 
[   14.254461]  (driver?)
[   14.260541] 0102          131072 ram2 
[   14.260542]  (driver?)
[   14.266620] 0103          131072 ram3 
[   14.266621]  (driver?)
[   14.272700] 0104          131072 ram4 
[   14.272701]  (driver?)
[   14.278780] 0105          131072 ram5 
[   14.278781]  (driver?)
[   14.284859] 0106          131072 ram6 
[   14.284860]  (driver?)
[   14.290939] 0107          131072 ram7 
[   14.290940]  (driver?)
[   14.297018] 0108          131072 ram8 
[   14.297019]  (driver?)
[   14.303099] 0109          131072 ram9 
[   14.303100]  (driver?)
[   14.309178] 010a          131072 ram10 
[   14.309179]  (driver?)
[   14.315344] 010b          131072 ram11 
[   14.315345]  (driver?)
[   14.321510] 010c          131072 ram12 
[   14.321510]  (driver?)
[   14.327676] 010d          131072 ram13 
[   14.327676]  (driver?)
[   14.333841] 010e          131072 ram14 
[   14.333842]  (driver?)
[   14.340007] 010f          131072 ram15 
[   14.340008]  (driver?)
[   14.346176] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[   14.354419] Rebooting in 180 seconds..

^ permalink raw reply

* Re: [PATCH] powerpc: chrp: Use of_node_is_type to access device_type
From: Michael Ellerman @ 2019-01-19 10:41 UTC (permalink / raw)
  To: Rob Herring; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel, kbuild test robot
In-Reply-To: <20190118143529.13347-1-robh@kernel.org>

Rob Herring <robh@kernel.org> writes:
> Commit 8ce5f8415753 ("of: Remove struct device_node.type pointer")
> removed struct device_node.type pointer, but the conversion to use
> of_node_is_type() accessor was missed in chrp_init_IRQ().
>
> Fixes: 8ce5f8415753 ("of: Remove struct device_node.type pointer")
> Reported-by: kbuild test robot <lkp@intel.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Michael, I see you just sent a PR of fixes. I can send this to Linus if 
> you prefer.

Yeah if you're happy to, thanks.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

^ permalink raw reply


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