Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d86e5f9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc/mm: Fix memory_block_size_bytes() for non-pseries
  mm: Move definition of MIN_MEMORY_BLOCK_SIZE to a header
parents d93a881d 770e1ac5
Loading
Loading
Loading
Loading
+19 −11
Original line number Original line Diff line number Diff line
@@ -12,6 +12,8 @@
#include <linux/of.h>
#include <linux/of.h>
#include <linux/memblock.h>
#include <linux/memblock.h>
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>
#include <linux/memory.h>

#include <asm/firmware.h>
#include <asm/firmware.h>
#include <asm/machdep.h>
#include <asm/machdep.h>
#include <asm/pSeries_reconfig.h>
#include <asm/pSeries_reconfig.h>
@@ -20,24 +22,25 @@
static unsigned long get_memblock_size(void)
static unsigned long get_memblock_size(void)
{
{
	struct device_node *np;
	struct device_node *np;
	unsigned int memblock_size = 0;
	unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE;
	struct resource r;


	np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
	np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
	if (np) {
	if (np) {
		const unsigned long *size;
		const __be64 *size;


		size = of_get_property(np, "ibm,lmb-size", NULL);
		size = of_get_property(np, "ibm,lmb-size", NULL);
		memblock_size = size ? *size : 0;
		if (size)

			memblock_size = be64_to_cpup(size);
		of_node_put(np);
		of_node_put(np);
	} else {
	} else  if (machine_is(pseries)) {
		/* This fallback really only applies to pseries */
		unsigned int memzero_size = 0;
		unsigned int memzero_size = 0;
		const unsigned int *regs;


		np = of_find_node_by_path("/memory@0");
		np = of_find_node_by_path("/memory@0");
		if (np) {
		if (np) {
			regs = of_get_property(np, "reg", NULL);
			if (!of_address_to_resource(np, 0, &r))
			memzero_size = regs ? regs[3] : 0;
				memzero_size = resource_size(&r);
			of_node_put(np);
			of_node_put(np);
		}
		}


@@ -50,16 +53,21 @@ static unsigned long get_memblock_size(void)
			sprintf(buf, "/memory@%x", memzero_size);
			sprintf(buf, "/memory@%x", memzero_size);
			np = of_find_node_by_path(buf);
			np = of_find_node_by_path(buf);
			if (np) {
			if (np) {
				regs = of_get_property(np, "reg", NULL);
				if (!of_address_to_resource(np, 0, &r))
				memblock_size = regs ? regs[3] : 0;
					memblock_size = resource_size(&r);
				of_node_put(np);
				of_node_put(np);
			}
			}
		}
		}
	}
	}

	return memblock_size;
	return memblock_size;
}
}


/* WARNING: This is going to override the generic definition whenever
 * pseries is built-in regardless of what platform is active at boot
 * time. This is fine for now as this is the only "option" and it
 * should work everywhere. If not, we'll have to turn this into a
 * ppc_md. callback
 */
unsigned long memory_block_size_bytes(void)
unsigned long memory_block_size_bytes(void)
{
{
	return get_memblock_size();
	return get_memblock_size();
+1 −2
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/poison.h>
#include <linux/poison.h>
#include <linux/dma-mapping.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/memory.h>
#include <linux/memory_hotplug.h>
#include <linux/memory_hotplug.h>
#include <linux/nmi.h>
#include <linux/nmi.h>
#include <linux/gfp.h>
#include <linux/gfp.h>
@@ -895,8 +896,6 @@ const char *arch_vma_name(struct vm_area_struct *vma)
}
}


#ifdef CONFIG_X86_UV
#ifdef CONFIG_X86_UV
#define MIN_MEMORY_BLOCK_SIZE   (1 << SECTION_SIZE_BITS)

unsigned long memory_block_size_bytes(void)
unsigned long memory_block_size_bytes(void)
{
{
	if (is_uv_system()) {
	if (is_uv_system()) {
+0 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,6 @@
static DEFINE_MUTEX(mem_sysfs_mutex);
static DEFINE_MUTEX(mem_sysfs_mutex);


#define MEMORY_CLASS_NAME	"memory"
#define MEMORY_CLASS_NAME	"memory"
#define MIN_MEMORY_BLOCK_SIZE	(1 << SECTION_SIZE_BITS)


static int sections_per_block;
static int sections_per_block;


+2 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,8 @@
#include <linux/compiler.h>
#include <linux/compiler.h>
#include <linux/mutex.h>
#include <linux/mutex.h>


#define MIN_MEMORY_BLOCK_SIZE     (1 << SECTION_SIZE_BITS)

struct memory_block {
struct memory_block {
	unsigned long start_section_nr;
	unsigned long start_section_nr;
	unsigned long end_section_nr;
	unsigned long end_section_nr;