LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: FSL/NXP P5020: USB problems with the latest Git kernels
From: Scott Wood @ 2018-09-05 18:39 UTC (permalink / raw)
  To: Laurentiu Tudor, Christian Zigotzky,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <AM6PR0402MB38644F9691306961BBD68C0DEC020@AM6PR0402MB3864.eurprd04.prod.outlook.com>

On Wed, 2018-09-05 at 14:08 +0000, Laurentiu Tudor wrote:
> Hi Scott,
> 
> > -----Original Message----- 
> > On Mon, 2018-08-27 at 20:15 +0200, Christian Zigotzky wrote:
> > > Hello,
> > > 
> > > Our users tested the RC1 of kernel 4.19 on their P5020 boards today.
> > > Unfortunately the USB bug still exists. With mem values bigger than
> > 
> > 4096M,
> > > the USB mouse and keyboard doesn’t work. With the bootarg mem=4096M, the
> > 
> > USB
> > > devices work without any problems. Please compile the RC1 and test it on
> > > your P5020 board. There is a problem with the memory management since
> > > 22/08/18.
> > 
> > I just tested 4.19-rc1 on a T4240 and got a similar problem with MMC.  MMC
> > and
> > USB on these chips both have a 32-bit DMA limitation.  I'll look into it.
> 
> I encountered similar issues on LS104xA chips. This is the workaround for
> MMC:
> https://patchwork.kernel.org/patch/10506627/

That's not a workaround; it's the proper way to handle DMA addressing limits.

> On the USB side I didn't find a proper place in the usb subsystem code for a
> workaround but instead
> found an undocumented kernel arg (*) that limits the dma mask to 32 bits:
> xhci-hcd.quirks=0x800000.
> 
> (*) https://patchwork.kernel.org/patch/10509159/

The mask should already be getting set to 32 bits.  The problem is a recent
patch that changed initcall order, which lead to swiotlb not being used.  We
need to rework the swiotlb notifier so it doesn't depend on initcall ordering.

-Scott

^ permalink raw reply

* Re: [PATCH 0/3] tty: hvc: latency break regression fixes
From: Jason Gunthorpe @ 2018-09-05 18:50 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: Greg Kroah-Hartman, Jiri Slaby, Michael Ellerman, Matteo Croce,
	Leon Romanovsky, linuxppc-dev, op
In-Reply-To: <20180905121439.23809-1-npiggin@gmail.com>

On Wed, Sep 05, 2018 at 10:14:36PM +1000, Nicholas Piggin wrote:
> Hi Greg,
> 
> Here are fixes for a few regressions that came in with my
> carelessness with the irq latency work for the hvc subsystem.
> These were independently reported in 2 configurations, and I
> confirmed with another.
> 
> I think those went upstream via Michael's tree, but he's away
> at the moment so if you would be able to consider them for
> the tty tree that would be appreciated.

Series works for me too, thanks.

Tested-by: Jason Gunthorpe <jgg@mellanox.com>

Jason

^ permalink raw reply

* [PATCH 00/21] DT cpu node iterator
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: Frank Rowand, Russell King, Albert Ou, Aurelien Jacquiot,
	Bartlomiej Zolnierkiewicz, Benjamin Herrenschmidt,
	Borislav Petkov, Catalin Marinas, dri-devel, H. Peter Anvin,
	Ingo Molnar, iommu, Joerg Roedel, Jonas Bonn, Ley Foon Tan,
	Magnus Damm, Mark Salter, Mauro Carvalho Chehab, Michael Ellerman,
	Michal Simek, nios2-dev, openrisc, Palmer Dabbelt, Rich Felker,
	Simon Horman, Stafford Horne, Stefan Kristiansson, Stephen Boyd,
	Thomas Gleixner, Vitaly Bordug, Will Deacon, Yoshinori Sato,
	linux-arm-kernel, linux-c6x-dev, linux-clk, linux-edac,
	linux-fbdev, linuxppc-dev, linux-renesas-soc, linux-riscv,
	linux-sh

This series adds an iterator for cpu nodes and converts users over to use
it or of_get_cpu_node in some cases. This allows us to remove the
dependency on device_type property for cpu nodes though removing that
from DTS files will have to wait for some time. In some cases, this makes
the DT search more strict by only looking in /cpus child nodes rather
than any node with the device_type == cpu. The iterator also honors the
status property which is often forgotten.

I've only tested on ARM under QEMU and compiled powerpc.

Rob

Rob Herring (21):
  of: Add cpu node iterator for_each_of_cpu_node()
  of: Support matching cpu nodes with no 'reg' property
  ARM: use for_each_of_cpu_node iterator
  ARM: topology: remove unneeded check for /cpus node
  ARM: shmobile: use for_each_of_cpu_node iterator
  arm64: use for_each_of_cpu_node iterator
  c6x: use for_each_of_cpu_node iterator
  microblaze: get cpu node with of_get_cpu_node
  nios2: get cpu node with of_get_cpu_node
  openrisc: use for_each_of_cpu_node iterator
  powerpc: use for_each_of_cpu_node iterator
  powerpc: 4xx: get cpu node with of_get_cpu_node
  powerpc: 8xx: get cpu node with of_get_cpu_node
  riscv: use for_each_of_cpu_node iterator
  SH: use for_each_of_cpu_node iterator
  x86: DT: use for_each_of_cpu_node iterator
  clk: mvebu: use for_each_of_cpu_node iterator
  edac: cpc925: use for_each_of_cpu_node iterator
  iommu: fsl_pamu: use for_each_of_cpu_node iterator
  of: use for_each_of_cpu_node iterator
  fbdev: fsl-diu: get cpu node with of_get_cpu_node

 arch/arm/kernel/devtree.c                 |  5 +--
 arch/arm/kernel/topology.c                |  6 ---
 arch/arm/mach-shmobile/pm-rcar-gen2.c     |  8 +---
 arch/arm/mach-shmobile/pm-rmobile.c       |  2 +-
 arch/arm/mach-shmobile/timer.c            | 10 +----
 arch/arm64/kernel/smp.c                   |  2 +-
 arch/c6x/kernel/setup.c                   | 11 ++---
 arch/microblaze/kernel/cpu/cpuinfo.c      |  4 +-
 arch/nios2/kernel/cpuinfo.c               |  4 +-
 arch/openrisc/kernel/setup.c              |  3 +-
 arch/powerpc/platforms/4xx/soc.c          |  2 +-
 arch/powerpc/platforms/8xx/m8xx_setup.c   |  5 ++-
 arch/powerpc/platforms/powermac/feature.c | 51 ++++++++---------------
 arch/powerpc/platforms/powermac/setup.c   | 15 +++----
 arch/riscv/kernel/smpboot.c               |  2 +-
 arch/sh/boards/of-generic.c               |  2 +-
 arch/x86/kernel/devicetree.c              |  2 +-
 drivers/clk/mvebu/clk-cpu.c               |  4 +-
 drivers/edac/cpc925_edac.c                | 20 +--------
 drivers/iommu/fsl_pamu.c                  |  2 +-
 drivers/of/base.c                         | 43 ++++++++++++++++++-
 drivers/of/of_numa.c                      | 15 +------
 drivers/video/fbdev/fsl-diu-fb.c          |  2 +-
 include/linux/of.h                        | 11 +++++
 24 files changed, 111 insertions(+), 120 deletions(-)

--
2.17.1

^ permalink raw reply

* [PATCH 11/21] powerpc: use for_each_of_cpu_node iterator
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linuxppc-dev
In-Reply-To: <20180905193738.19325-1-robh@kernel.org>

Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
has the side effect of defaulting to iterating using "cpu" node names in
preference to the deprecated (for FDT) device_type == "cpu".

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>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 arch/powerpc/platforms/powermac/feature.c | 51 ++++++++---------------
 arch/powerpc/platforms/powermac/setup.c   | 15 +++----
 2 files changed, 26 insertions(+), 40 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 4eb8cb38fc69..ed2f54b3f173 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1049,7 +1049,6 @@ core99_reset_cpu(struct device_node *node, long param, long value)
 	unsigned long flags;
 	struct macio_chip *macio;
 	struct device_node *np;
-	struct device_node *cpus;
 	const int dflt_reset_lines[] = {	KL_GPIO_RESET_CPU0,
 						KL_GPIO_RESET_CPU1,
 						KL_GPIO_RESET_CPU2,
@@ -1059,10 +1058,7 @@ core99_reset_cpu(struct device_node *node, long param, long value)
 	if (macio->type != macio_keylargo)
 		return -ENODEV;

-	cpus = of_find_node_by_path("/cpus");
-	if (cpus == NULL)
-		return -ENODEV;
-	for (np = cpus->child; np != NULL; np = np->sibling) {
+	for_each_of_cpu_node(np) {
 		const u32 *num = of_get_property(np, "reg", NULL);
 		const u32 *rst = of_get_property(np, "soft-reset", NULL);
 		if (num == NULL || rst == NULL)
@@ -1072,7 +1068,6 @@ core99_reset_cpu(struct device_node *node, long param, long value)
 			break;
 		}
 	}
-	of_node_put(cpus);
 	if (np == NULL || reset_io == 0)
 		reset_io = dflt_reset_lines[param];

@@ -1504,16 +1499,12 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
 	unsigned long flags;
 	struct macio_chip *macio;
 	struct device_node *np;
-	struct device_node *cpus;

 	macio = &macio_chips[0];
 	if (macio->type != macio_keylargo2 && macio->type != macio_shasta)
 		return -ENODEV;

-	cpus = of_find_node_by_path("/cpus");
-	if (cpus == NULL)
-		return -ENODEV;
-	for (np = cpus->child; np != NULL; np = np->sibling) {
+	for_each_of_cpu_node(np) {
 		const u32 *num = of_get_property(np, "reg", NULL);
 		const u32 *rst = of_get_property(np, "soft-reset", NULL);
 		if (num == NULL || rst == NULL)
@@ -1523,7 +1514,6 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
 			break;
 		}
 	}
-	of_node_put(cpus);
 	if (np == NULL || reset_io == 0)
 		return -ENODEV;

@@ -2515,31 +2505,26 @@ static int __init probe_motherboard(void)
 	 * supposed to be set when not supported, but I'm not very confident
 	 * that all Apple OF revs did it properly, I do it the paranoid way.
 	 */
-	while (uninorth_base && uninorth_rev > 3) {
-		struct device_node *cpus = of_find_node_by_path("/cpus");
+	if (uninorth_base && uninorth_rev > 3) {
 		struct device_node *np;

-		if (!cpus || !cpus->child) {
-			printk(KERN_WARNING "Can't find CPU(s) in device tree !\n");
-			of_node_put(cpus);
-			break;
-		}
-		np = cpus->child;
-		/* Nap mode not supported on SMP */
-		if (np->sibling) {
-			of_node_put(cpus);
-			break;
-		}
-		/* Nap mode not supported if flush-on-lock property is present */
-		if (of_get_property(np, "flush-on-lock", NULL)) {
-			of_node_put(cpus);
-			break;
+		for_each_of_cpu_node(np) {
+			int cpu_count = 1;
+
+			/* Nap mode not supported on SMP */
+			if (of_get_property(np, "flush-on-lock", NULL) ||
+			    (cpu_count > 1)) {
+				powersave_nap = 0;
+				of_node_put(np);
+				break;
+			}
+
+			cpu_count++;
+			powersave_nap = 1;
 		}
-		of_node_put(cpus);
-		powersave_nap = 1;
-		printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n");
-		break;
 	}
+	if (powersave_nap)
+		printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n");

 	/* On CPUs that support it (750FX), lowspeed by default during
 	 * NAP mode
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 3a529fcdae97..2f00e3daafb0 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -243,10 +243,9 @@ static void __init l2cr_init(void)
 {
 	/* Checks "l2cr-value" property in the registry */
 	if (cpu_has_feature(CPU_FTR_L2CR)) {
-		struct device_node *np = of_find_node_by_name(NULL, "cpus");
-		if (!np)
-			np = of_find_node_by_type(NULL, "cpu");
-		if (np) {
+		struct device_node *np;
+
+		for_each_of_cpu_node(np) {
 			const unsigned int *l2cr =
 				of_get_property(np, "l2cr-value", NULL);
 			if (l2cr) {
@@ -256,6 +255,7 @@ static void __init l2cr_init(void)
 				_set_L2CR(ppc_override_l2cr_value);
 			}
 			of_node_put(np);
+			break;
 		}
 	}

@@ -279,8 +279,8 @@ static void __init pmac_setup_arch(void)
 	/* Set loops_per_jiffy to a half-way reasonable value,
 	   for use until calibrate_delay gets called. */
 	loops_per_jiffy = 50000000 / HZ;
-	cpu = of_find_node_by_type(NULL, "cpu");
-	if (cpu != NULL) {
+
+	for_each_of_cpu_node(cpu) {
 		fp = of_get_property(cpu, "clock-frequency", NULL);
 		if (fp != NULL) {
 			if (pvr >= 0x30 && pvr < 0x80)
@@ -292,8 +292,9 @@ static void __init pmac_setup_arch(void)
 			else
 				/* 601, 603, etc. */
 				loops_per_jiffy = *fp / (2 * HZ);
+			of_node_put(cpu);
+			break;
 		}
-		of_node_put(cpu);
 	}

 	/* See if newworld or oldworld */
--
2.17.1

^ permalink raw reply related

* [PATCH 12/21] powerpc: 4xx: get cpu node with of_get_cpu_node
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linuxppc-dev
In-Reply-To: <20180905193738.19325-1-robh@kernel.org>

"device_type" use is deprecated for FDT though it has continued to be used
for nodes like cpu nodes. Use of_get_cpu_node() instead which works using
node names by default. This will allow the eventually removal of cpu
device_type properties.

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>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 arch/powerpc/platforms/4xx/soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/4xx/soc.c b/arch/powerpc/platforms/4xx/soc.c
index 5e36508b2a70..1844bf502fcf 100644
--- a/arch/powerpc/platforms/4xx/soc.c
+++ b/arch/powerpc/platforms/4xx/soc.c
@@ -200,7 +200,7 @@ void ppc4xx_reset_system(char *cmd)
 	u32 reset_type = DBCR0_RST_SYSTEM;
 	const u32 *prop;

-	np = of_find_node_by_type(NULL, "cpu");
+	np = of_get_cpu_node(0, NULL);
 	if (np) {
 		prop = of_get_property(np, "reset-type", NULL);

--
2.17.1

^ permalink raw reply related

* [PATCH 13/21] powerpc: 8xx: get cpu node with of_get_cpu_node
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: Vitaly Bordug, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, linuxppc-dev
In-Reply-To: <20180905193738.19325-1-robh@kernel.org>

"device_type" use is deprecated for FDT though it has continued to be used
for nodes like cpu nodes. Use of_get_cpu_node() instead which works using
node names by default. This will allow the eventually removal of cpu
device_type properties.

Also, fix a leaked reference and add a missing of_node_put.

Cc: Vitaly Bordug <vitb@kernel.crashing.org>
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>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 arch/powerpc/platforms/8xx/m8xx_setup.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c
index 027c42d8966c..f1c805c8adbc 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -66,7 +66,7 @@ static int __init get_freq(char *name, unsigned long *val)
 	int found = 0;

 	/* The cpu node should have timebase and clock frequency properties */
-	cpu = of_find_node_by_type(NULL, "cpu");
+	cpu = of_get_cpu_node(0, NULL);

 	if (cpu) {
 		fp = of_get_property(cpu, name, NULL);
@@ -147,8 +147,9 @@ void __init mpc8xx_calibrate_decr(void)
 	 * we have to enable the timebase).  The decrementer interrupt
 	 * is wired into the vector table, nothing to do here for that.
 	 */
-	cpu = of_find_node_by_type(NULL, "cpu");
+	cpu = of_get_cpu_node(0, NULL);
 	virq= irq_of_parse_and_map(cpu, 0);
+	of_node_put(cpu);
 	irq = virq_to_hw(virq);

 	sys_tmr2 = immr_map(im_sit);
--
2.17.1

^ permalink raw reply related

* Re: [PATCH 3/3] mm: optimise pte dirty/accessed bit setting by demand based pte insertion
From: Nicholas Piggin @ 2018-09-05 22:18 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-mm, linux-arch, linux-kernel, linuxppc-dev, Andrew Morton,
	Linus Torvalds, Ley Foon Tan, nios2-dev
In-Reply-To: <20180905142951.GA15680@roeck-us.net>

On Wed, 5 Sep 2018 07:29:51 -0700
Guenter Roeck <linux@roeck-us.net> wrote:

> Hi,
>=20
> On Tue, Aug 28, 2018 at 09:20:34PM +1000, Nicholas Piggin wrote:
> > Similarly to the previous patch, this tries to optimise dirty/accessed
> > bits in ptes to avoid access costs of hardware setting them.
> >  =20
>=20
> This patch results in silent nios2 boot failures, silent meaning that
> the boot stalls.
>=20
> ...
> Unpacking initramfs...
> Freeing initrd memory: 2168K
> workingset: timestamp_bits=3D30 max_order=3D15 bucket_order=3D0
> jffs2: version 2.2. (NAND) =C2=A9 2001-2006 Red Hat, Inc.
> random: fast init done
> random: crng init done
>=20
> [no further activity until the qemu session is aborted]
>=20
> Reverting the patch fixes the problem. Bisect log is attached.

Thanks for bisecting it, I'll try to reproduce. Just qemu with no
obscure options? Interesting that it's hit nios2 but apparently not
other archs (yet).

Thanks,
Nick

^ permalink raw reply

* [PATCH v2 0/9] Devicetree build consolidation
From: Rob Herring @ 2018-09-05 23:53 UTC (permalink / raw)
  To: devicetree, linux-kernel, Masahiro Yamada
  Cc: Frank Rowand, Michal Marek, Vineet Gupta, Russell King,
	Catalin Marinas, Will Deacon, Yoshinori Sato, Michal Simek,
	Ralf Baechle, Paul Burton, James Hogan, Ley Foon Tan,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Chris Zankel, Max Filippov, linux-kbuild, linux-snps-arc,
	linux-arm-kernel, uclinux-h8-devel, linux-mips, nios2-dev,
	linuxppc-dev, linux-xtensa

This series addresses a couple of issues I have with building dts files.

First, the ability to build all the dts files in the tree. This has been
supported on most arches for some time with powerpc being the main
exception. The reason powerpc wasn't supported was it needed a change
in the location built dtb files are put.

Secondly, it's a pain to acquire all the cross-compilers needed to build
dtbs for each arch. There's no reason to build with the cross compiler and
the host compiler is perfectly fine as we only need the pre-processor.

I started addressing just those 2 problems, but kept finding small
differences such as target dependencies and dtbs_install support across
architectures. Instead of trying to align all these, I've consolidated the
build targets moving them out of the arch makefiles.

I'd like to take the series via the DT tree.

Rob

v2:
 - Fix $arch/boot/dts path check for out of tree builds
 - Fix dtc dependency for building built-in dtbs
 - Fix microblaze built-in dtb building
 - Add dtbs target for microblaze

Rob Herring (9):
  powerpc: build .dtb files in dts directory
  nios2: build .dtb files in dts directory
  nios2: use common rules to build built-in dtb
  nios2: fix building all dtbs
  c6x: use common built-in dtb support
  kbuild: consolidate Devicetree dtb build rules
  powerpc: enable building all dtbs
  c6x: enable building all dtbs
  microblaze: enable building all dtbs

 Makefile                           | 32 +++++++++++++++++++
 arch/arc/Makefile                  |  6 ----
 arch/arm/Makefile                  | 20 +-----------
 arch/arm64/Makefile                | 17 +----------
 arch/c6x/Makefile                  |  2 --
 arch/c6x/boot/dts/Makefile         | 17 +++++------
 arch/c6x/boot/dts/linked_dtb.S     |  2 --
 arch/c6x/include/asm/sections.h    |  1 -
 arch/c6x/kernel/setup.c            |  4 +--
 arch/c6x/kernel/vmlinux.lds.S      | 10 ------
 arch/h8300/Makefile                | 11 +------
 arch/microblaze/Makefile           |  4 +--
 arch/microblaze/boot/dts/Makefile  |  4 +++
 arch/mips/Makefile                 | 15 +--------
 arch/nds32/Makefile                |  2 +-
 arch/nios2/Makefile                | 11 +------
 arch/nios2/boot/Makefile           | 22 --------------
 arch/nios2/boot/dts/Makefile       |  6 ++++
 arch/nios2/boot/linked_dtb.S       | 19 ------------
 arch/powerpc/Makefile              |  3 --
 arch/powerpc/boot/Makefile         | 49 ++++++++++++++----------------
 arch/powerpc/boot/dts/Makefile     |  6 ++++
 arch/powerpc/boot/dts/fsl/Makefile |  4 +++
 arch/xtensa/Makefile               | 12 +-------
 scripts/Makefile.lib               |  2 +-
 25 files changed, 93 insertions(+), 188 deletions(-)
 delete mode 100644 arch/c6x/boot/dts/linked_dtb.S
 create mode 100644 arch/nios2/boot/dts/Makefile
 delete mode 100644 arch/nios2/boot/linked_dtb.S
 create mode 100644 arch/powerpc/boot/dts/Makefile
 create mode 100644 arch/powerpc/boot/dts/fsl/Makefile

--
2.17.1

^ permalink raw reply

* [PATCH v2 1/9] powerpc: build .dtb files in dts directory
From: Rob Herring @ 2018-09-05 23:53 UTC (permalink / raw)
  To: devicetree, linux-kernel, Masahiro Yamada
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linuxppc-dev
In-Reply-To: <20180905235327.5996-1-robh@kernel.org>

Align powerpc with other architectures which build the dtb files in the
same directory as the dts files. This is also in line with most other
build targets which are located in the same directory as the source.
This move will help enable the 'dtbs' target which builds all the dtbs
regardless of kernel config.

This transition could break some scripts if they expect dtb files in the
old location.

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>
---
Please ack so I can take the whole series via the DT tree.


 arch/powerpc/Makefile          |  2 +-
 arch/powerpc/boot/Makefile     | 49 ++++++++++++++++------------------
 arch/powerpc/boot/dts/Makefile |  1 +
 3 files changed, 25 insertions(+), 27 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/Makefile

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 11a1acba164a..53ea887eb34e 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -294,7 +294,7 @@ bootwrapper_install:
 	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)

 %.dtb: scripts
-	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
+	$(Q)$(MAKE) $(build)=$(boot)/dts $(patsubst %,$(boot)/dts/%,$@)

 # Used to create 'merged defconfigs'
 # To use it $(call) it with the first argument as the base defconfig
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 0fb96c26136f..b201d93e1725 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -381,11 +381,11 @@ $(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperb
 	$(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))

 # dtbImage% - a dtbImage is a zImage with an embedded device tree blob
-$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE
-	$(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
+$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
+	$(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)

-$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE
-	$(call if_changed,wrap,$*,,$(obj)/$*.dtb)
+$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
+	$(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb)

 # This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
 # prefix
@@ -395,36 +395,33 @@ $(obj)/vmlinux.strip: vmlinux
 $(obj)/uImage: vmlinux $(wrapperbits) FORCE
 	$(call if_changed,wrap,uboot)

-$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
+$(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)

-$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
+$(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb)

-$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
+$(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)

-$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
+$(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb)

-$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
+$(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)

-$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb)
+$(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb)

-$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
+$(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)

-$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
-	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
+$(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
+	$(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb)

-# Rule to build device tree blobs
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call if_changed_dep,dtc)
-
-$(obj)/%.dtb: $(src)/dts/fsl/%.dts FORCE
-	$(call if_changed_dep,dtc)
+# Needed for the above targets to work with dts/fsl/ files
+$(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb
+	@cp $< $@

 # If there isn't a platform selected then just strip the vmlinux.
 ifeq (,$(image-y))
diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
new file mode 100644
index 000000000000..f66554cd5c45
--- /dev/null
+++ b/arch/powerpc/boot/dts/Makefile
@@ -0,0 +1 @@
+# SPDX-License-Identifier: GPL-2.0
--
2.17.1

^ permalink raw reply related

* [PATCH v2 6/9] kbuild: consolidate Devicetree dtb build rules
From: Rob Herring @ 2018-09-05 23:53 UTC (permalink / raw)
  To: devicetree, linux-kernel, Masahiro Yamada
  Cc: Michal Marek, Vineet Gupta, Russell King, Catalin Marinas,
	Will Deacon, Yoshinori Sato, Michal Simek, Ralf Baechle,
	Paul Burton, James Hogan, Ley Foon Tan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Chris Zankel, Max Filippov,
	linux-kbuild, linux-snps-arc, linux-arm-kernel, uclinux-h8-devel,
	linux-mips, nios2-dev, linuxppc-dev, linux-xtensa
In-Reply-To: <20180905235327.5996-1-robh@kernel.org>

There is nothing arch specific about building dtb files other than their
location under /arch/*/boot/dts/. Keeping each arch aligned is a pain.
The dependencies and supported targets are all slightly different.
Also, a cross-compiler for each arch is needed, but really the host
compiler preprocessor is perfectly fine for building dtbs. Move the
build rules to a common location and remove the arch specific ones. This
is done in a single step to avoid warnings about overriding rules.

The build dependencies had been a mixture of 'scripts' and/or 'prepare'.
These pull in several dependencies some of which need a target compiler
(specifically devicetable-offsets.h) and aren't needed to build dtbs.
All that is really needed is dtc, so adjust the dependencies to only be
dtc.

This change enables support 'dtbs_install' on some arches which were
missing the target.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: uclinux-h8-devel@lists.sourceforge.jp
Cc: linux-mips@linux-mips.org
Cc: nios2-dev@lists.rocketboards.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-xtensa@linux-xtensa.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
Please ack so I can take the whole series via the DT tree.

v2:
 - Fix $arch/boot/dts path check for out of tree builds
 - Fix dtc dependency for building built-in dtbs
 - Fix microblaze built-in dtb building

 Makefile                          | 32 +++++++++++++++++++++++++++++++
 arch/arc/Makefile                 |  6 ------
 arch/arm/Makefile                 | 20 +------------------
 arch/arm64/Makefile               | 17 +---------------
 arch/c6x/Makefile                 |  2 --
 arch/h8300/Makefile               | 11 +----------
 arch/microblaze/Makefile          |  4 +---
 arch/microblaze/boot/dts/Makefile |  2 ++
 arch/mips/Makefile                | 15 +--------------
 arch/nds32/Makefile               |  2 +-
 arch/nios2/Makefile               |  7 -------
 arch/nios2/boot/Makefile          |  4 ----
 arch/powerpc/Makefile             |  3 ---
 arch/xtensa/Makefile              | 12 +-----------
 scripts/Makefile.lib              |  2 +-
 15 files changed, 42 insertions(+), 97 deletions(-)

diff --git a/Makefile b/Makefile
index 2b458801ba74..bc18dbbc16c5 100644
--- a/Makefile
+++ b/Makefile
@@ -1212,6 +1212,32 @@ kselftest-merge:
 		$(srctree)/tools/testing/selftests/*/config
 	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig

+# ---------------------------------------------------------------------------
+# Devicetree files
+
+ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),)
+dtstree := arch/$(SRCARCH)/boot/dts
+endif
+
+ifdef CONFIG_OF_EARLY_FLATTREE
+
+%.dtb %.dtb.S %.dtb.o: | dtc
+	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+
+PHONY += dtbs
+dtbs: | dtc
+	$(Q)$(MAKE) $(build)=$(dtstree)
+
+dtbs_install: dtbs
+	$(Q)$(MAKE) $(dtbinst)=$(dtstree)
+
+all: dtbs
+
+dtc:
+	$(Q)$(MAKE) $(build)=scripts/dtc
+
+endif
+
 # ---------------------------------------------------------------------------
 # Modules

@@ -1421,6 +1447,12 @@ help:
 	@echo  '  kselftest-merge - Merge all the config dependencies of kselftest to existing'
 	@echo  '                    .config.'
 	@echo  ''
+	@$(if $(dtstree), \
+		echo 'Devicetree:'; \
+		echo '* dtbs            - Build device tree blobs for enabled boards'; \
+		echo '  dtbs_install    - Install dtbs to $(INSTALL_DTBS_PATH)'; \
+		echo '')
+
 	@echo 'Userspace tools targets:'
 	@echo '  use "make tools/help"'
 	@echo '  or  "cd tools; make help"'
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index fb026196aaab..5c7bc6d62f43 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -132,11 +132,5 @@ boot_targets += uImage uImage.bin uImage.gz
 $(boot_targets): vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

-%.dtb %.dtb.S %.dtb.o: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
-
-dtbs: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts
-
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d1516f85f25d..161c2df6567e 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -307,12 +307,7 @@ else
 KBUILD_IMAGE := $(boot)/zImage
 endif

-# Build the DT binary blobs if we have OF configured
-ifeq ($(CONFIG_USE_OF),y)
-KBUILD_DTBS := dtbs
-endif
-
-all:	$(notdir $(KBUILD_IMAGE)) $(KBUILD_DTBS)
+all:	$(notdir $(KBUILD_IMAGE))


 archheaders:
@@ -339,17 +334,6 @@ $(BOOT_TARGETS): vmlinux
 $(INSTALL_TARGETS):
 	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@

-%.dtb: | scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
-
-PHONY += dtbs dtbs_install
-
-dtbs: prepare scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts
-
-dtbs_install:
-	$(Q)$(MAKE) $(dtbinst)=$(boot)/dts
-
 PHONY += vdso_install
 vdso_install:
 ifeq ($(CONFIG_VDSO),y)
@@ -371,8 +355,6 @@ define archhelp
   echo  '  uImage        - U-Boot wrapped zImage'
   echo  '  bootpImage    - Combined zImage and initial RAM disk'
   echo  '                  (supply initrd image via make variable INITRD=<path>)'
-  echo  '* dtbs          - Build device tree blobs for enabled boards'
-  echo  '  dtbs_install  - Install dtbs to $(INSTALL_DTBS_PATH)'
   echo  '  install       - Install uncompressed kernel'
   echo  '  zinstall      - Install compressed kernel'
   echo  '  uinstall      - Install U-Boot wrapped compressed kernel'
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 106039d25e2f..b4e994cd3a42 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -113,9 +113,8 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
 # Default target when executing plain make
 boot		:= arch/arm64/boot
 KBUILD_IMAGE	:= $(boot)/Image.gz
-KBUILD_DTBS	:= dtbs

-all:	Image.gz $(KBUILD_DTBS)
+all:	Image.gz


 Image: vmlinux
@@ -127,17 +126,6 @@ Image.%: Image
 zinstall install:
 	$(Q)$(MAKE) $(build)=$(boot) $@

-%.dtb: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
-
-PHONY += dtbs dtbs_install
-
-dtbs: prepare scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts
-
-dtbs_install:
-	$(Q)$(MAKE) $(dtbinst)=$(boot)/dts
-
 PHONY += vdso_install
 vdso_install:
 	$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
@@ -145,7 +133,6 @@ vdso_install:
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
-	$(Q)$(MAKE) $(clean)=$(boot)/dts

 # We need to generate vdso-offsets.h before compiling certain files in kernel/.
 # In order to do that, we should use the archprepare target, but we can't since
@@ -160,8 +147,6 @@ vdso_prepare: prepare0
 define archhelp
   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
-  echo  '* dtbs          - Build device tree blobs for enabled boards'
-  echo  '  dtbs_install  - Install dtbs to $(INSTALL_DTBS_PATH)'
   echo  '  install       - Install uncompressed kernel'
   echo  '  zinstall      - Install compressed kernel'
   echo  '                  Install using (your) ~/bin/installkernel or'
diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index 3fe8a948e94c..b7aa854f7008 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -40,9 +40,7 @@ boot := arch/$(ARCH)/boot
 DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS)))
 export DTB

-ifneq ($(DTB),)
 core-y	+= $(boot)/dts/
-endif

 # With make 3.82 we cannot mix normal and wildcard targets

diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index 58634e6bae92..4003ddc616e1 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -31,21 +31,12 @@ CROSS_COMPILE := h8300-unknown-linux-
 endif

 core-y	+= arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
-ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""'
-core-y += arch/h8300/boot/dts/
-endif
+core-y	+= arch/$(ARCH)/boot/dts/

 libs-y	+= arch/$(ARCH)/lib/

 boot := arch/h8300/boot

-%.dtb %.dtb.S %.dtb.o: | scripts
-	$(Q)$(MAKE) $(build)=arch/h8300/boot/dts arch/h8300/boot/dts/$@
-
-PHONY += dtbs
-dtbs: scripts
-	$(Q)$(MAKE) $(build)=arch/h8300/boot/dts
-
 archmrproper:

 archclean:
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 4f3ab5707265..0823d291fbeb 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -65,9 +65,7 @@ boot := arch/microblaze/boot
 # Are we making a simpleImage.<boardname> target? If so, crack out the boardname
 DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))

-ifneq ($(DTB),)
-	core-y	+= $(boot)/dts/
-endif
+core-y	+= $(boot)/dts/

 # defines filename extension depending memory management type
 ifeq ($(CONFIG_MMU),)
diff --git a/arch/microblaze/boot/dts/Makefile b/arch/microblaze/boot/dts/Makefile
index 1f77913d404d..fe9af267f598 100644
--- a/arch/microblaze/boot/dts/Makefile
+++ b/arch/microblaze/boot/dts/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 #

+ifneq ($(DTB),)
 obj-y += linked_dtb.o

 # Ensure system.dtb exists
@@ -11,6 +12,7 @@ ifneq ($(DTB),system)
 $(obj)/system.dtb: $(obj)/$(DTB).dtb
 	$(call if_changed,cp)
 endif
+endif

 quiet_cmd_cp = CP      $< $@$2
 	cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d74b3742fa5d..d43eeaa6d75b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -407,18 +407,7 @@ endif
 CLEAN_FILES += vmlinux.32 vmlinux.64

 # device-trees
-core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
-
-%.dtb %.dtb.S %.dtb.o: | scripts
-	$(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
-
-PHONY += dtbs
-dtbs: scripts
-	$(Q)$(MAKE) $(build)=arch/mips/boot/dts
-
-PHONY += dtbs_install
-dtbs_install:
-	$(Q)$(MAKE) $(dtbinst)=arch/mips/boot/dts
+core-y += arch/mips/boot/dts/

 archprepare:
 ifdef CONFIG_MIPS32_N32
@@ -461,8 +450,6 @@ define archhelp
 	echo '  uImage.lzma          - U-Boot image (lzma)'
 	echo '  uImage.lzo           - U-Boot image (lzo)'
 	echo '  uzImage.bin          - U-Boot image (self-extracting)'
-	echo '  dtbs                 - Device-tree blobs for enabled boards'
-	echo '  dtbs_install         - Install dtbs to $(INSTALL_DTBS_PATH)'
 	echo
 	echo '  These will be default as appropriate for a configured platform.'
 	echo
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
index 63f4f173e5f4..adcac830d051 100644
--- a/arch/nds32/Makefile
+++ b/arch/nds32/Makefile
@@ -43,7 +43,7 @@ CHECKFLAGS      += -D__NDS32_EB__
 endif

 boot := arch/nds32/boot
-core-$(BUILTIN_DTB) += $(boot)/dts/
+core-y += $(boot)/dts/

 .PHONY: FORCE

diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
index db2e78fe65c7..52c03e60b114 100644
--- a/arch/nios2/Makefile
+++ b/arch/nios2/Makefile
@@ -56,12 +56,6 @@ all: vmImage
 archclean:
 	$(Q)$(MAKE) $(clean)=$(nios2-boot)

-%.dtb %.dtb.S %.dtb.o: | scripts
-	$(Q)$(MAKE) $(build)=$(nios2-boot)/dts $(nios2-boot)/dts/$@
-
-dtbs:
-	$(Q)$(MAKE) $(build)=$(nios2-boot)/dts
-
 $(BOOT_TARGETS): vmlinux
 	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@

@@ -74,5 +68,4 @@ define archhelp
   echo  '                     (your) ~/bin/$(INSTALLKERNEL) or'
   echo  '                     (distribution) /sbin/$(INSTALLKERNEL) or'
   echo  '                     install to $$(INSTALL_PATH)'
-  echo  '  dtbs            - Build device tree blobs for enabled boards'
 endef
diff --git a/arch/nios2/boot/Makefile b/arch/nios2/boot/Makefile
index 0b48f1bf086d..37dfc7e584bc 100644
--- a/arch/nios2/boot/Makefile
+++ b/arch/nios2/boot/Makefile
@@ -31,9 +31,5 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
 $(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE
 	$(Q)$(MAKE) $(build)=$(obj)/compressed $@

-targets += $(dtb-y)
-
-$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
-
 install:
 	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 53ea887eb34e..42f225f6ec93 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -293,9 +293,6 @@ $(BOOT_TARGETS2): vmlinux
 bootwrapper_install:
 	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)

-%.dtb: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts $(patsubst %,$(boot)/dts/%,$@)
-
 # Used to create 'merged defconfigs'
 # To use it $(call) it with the first argument as the base defconfig
 # and the second argument as a space separated list of .config files to merge,
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 295c120ed099..13fd3301c517 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -84,28 +84,18 @@ LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 head-y		:= arch/xtensa/kernel/head.o
 core-y		+= arch/xtensa/kernel/ arch/xtensa/mm/
 core-y		+= $(buildvar) $(buildplf)
+core-y 		+= arch/xtensa/boot/dts/

 libs-y		+= arch/xtensa/lib/ $(LIBGCC)
 drivers-$(CONFIG_OPROFILE)	+= arch/xtensa/oprofile/

-ifneq ($(CONFIG_BUILTIN_DTB),"")
-core-$(CONFIG_OF) += arch/xtensa/boot/dts/
-endif
-
 boot		:= arch/xtensa/boot

 all Image zImage uImage: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) $@

-%.dtb:
-	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
-
-dtbs: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts
-
 define archhelp
   @echo '* Image       - Kernel ELF image with reset vector'
   @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
   @echo '* uImage      - U-Boot wrapped image'
-  @echo '  dtbs        - Build device tree blobs for enabled boards'
 endef
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 61e596650ed3..8fe4468f9bda 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -283,7 +283,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE

 quiet_cmd_dtc = DTC     $@
 cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
-	$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+	$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
 	$(DTC) -O dtb -o $@ -b 0 \
 		$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
 		-d $(depfile).dtc.tmp $(dtc-tmp) ; \
--
2.17.1

^ permalink raw reply related

* [PATCH v2 7/9] powerpc: enable building all dtbs
From: Rob Herring @ 2018-09-05 23:53 UTC (permalink / raw)
  To: devicetree, linux-kernel, Masahiro Yamada
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linuxppc-dev
In-Reply-To: <20180905235327.5996-1-robh@kernel.org>

Enable the 'dtbs' target for powerpc. This allows building all the dts
files in arch/powerpc/boot/dts/ when COMPILE_TEST and OF_ALL_DTBS are
enabled.

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>
---
Please ack so I can take the whole series via the DT tree.

 arch/powerpc/boot/dts/Makefile     | 5 +++++
 arch/powerpc/boot/dts/fsl/Makefile | 4 ++++
 2 files changed, 9 insertions(+)
 create mode 100644 arch/powerpc/boot/dts/fsl/Makefile

diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
index f66554cd5c45..fb335d05aae8 100644
--- a/arch/powerpc/boot/dts/Makefile
+++ b/arch/powerpc/boot/dts/Makefile
@@ -1 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
+
+subdir-y += fsl
+
+dtstree		:= $(srctree)/$(src)
+dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
diff --git a/arch/powerpc/boot/dts/fsl/Makefile b/arch/powerpc/boot/dts/fsl/Makefile
new file mode 100644
index 000000000000..3bae982641e9
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+
+dtstree		:= $(srctree)/$(src)
+dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
--
2.17.1

^ permalink raw reply related

* Re: [PATCH 3/3] mm: optimise pte dirty/accessed bit setting by demand based pte insertion
From: Guenter Roeck @ 2018-09-06  0:36 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: linux-mm, linux-arch, linux-kernel, linuxppc-dev, Andrew Morton,
	Linus Torvalds, Ley Foon Tan, nios2-dev
In-Reply-To: <20180906081802.210984d7@roar.ozlabs.ibm.com>

On 09/05/2018 03:18 PM, Nicholas Piggin wrote:
> On Wed, 5 Sep 2018 07:29:51 -0700
> Guenter Roeck <linux@roeck-us.net> wrote:
> 
>> Hi,
>>
>> On Tue, Aug 28, 2018 at 09:20:34PM +1000, Nicholas Piggin wrote:
>>> Similarly to the previous patch, this tries to optimise dirty/accessed
>>> bits in ptes to avoid access costs of hardware setting them.
>>>    
>>
>> This patch results in silent nios2 boot failures, silent meaning that
>> the boot stalls.
>>
>> ...
>> Unpacking initramfs...
>> Freeing initrd memory: 2168K
>> workingset: timestamp_bits=30 max_order=15 bucket_order=0
>> jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
>> random: fast init done
>> random: crng init done
>>
>> [no further activity until the qemu session is aborted]
>>
>> Reverting the patch fixes the problem. Bisect log is attached.
> 
> Thanks for bisecting it, I'll try to reproduce. Just qemu with no
> obscure options? Interesting that it's hit nios2 but apparently not
> other archs (yet).
> 

Nothing special. See https://github.com/groeck/linux-build-test/tree/master/rootfs/nios2/.

Guenter

^ permalink raw reply

* Re: [RFC PATCH 00/29] mm: remove bootmem allocator
From: Greentime Hu @ 2018-09-06  2:33 UTC (permalink / raw)
  To: rppt
  Cc: linux-mm, Andrew Morton, David Miller, gregkh, mingo, mpe, mhocko,
	paul.burton, Thomas Gleixner, tony.luck, linux-ia64, linux-mips,
	linuxppc-dev, sparclinux, Linux Kernel Mailing List
In-Reply-To: <1536163184-26356-1-git-send-email-rppt@linux.vnet.ibm.com>

Mike Rapoport <rppt@linux.vnet.ibm.com> =E6=96=BC 2018=E5=B9=B49=E6=9C=886=
=E6=97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8A=E5=8D=8812:04=E5=AF=AB=E9=81=93=EF=
=BC=9A
>
> Hi,
>
> These patches switch early memory managment to use memblock directly
> without any bootmem compatibility wrappers. As the result both bootmem an=
d
> nobootmem are removed.
>
> There are still a couple of things to sort out, the most important is the
> removal of bootmem usage in MIPS.
>
> Still, IMHO, the series is in sufficient state to post and get the early
> feedback.
>
> The patches are build-tested with defconfig for most architectures (I
> couldn't find a compiler for nds32 and unicore32) and boot-tested on x86
> VM.
>
Hi Mike,

There are nds32 toolchains.
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.1.0/=
x86_64-gcc-8.1.0-nolibc-nds32le-linux.tar.gz
https://github.com/vincentzwc/prebuilt-nds32-toolchain/releases/download/20=
180521/nds32le-linux-glibc-v3-upstream.tar.gz

Sorry, we have no qemu yet.

^ permalink raw reply

* [RFC PATCH V2 1/4] mm: Export alloc_migrate_huge_page
From: Aneesh Kumar K.V @ 2018-09-06  5:43 UTC (permalink / raw)
  To: akpm, Alexey Kardashevskiy, mpe
  Cc: linux-mm, linux-kernel, linuxppc-dev, Aneesh Kumar K.V

We want to use this to support customized huge page migration.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 include/linux/hugetlb.h | 2 ++
 mm/hugetlb.c            | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index c39d9170a8a0..98c9c6dc308c 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -357,6 +357,8 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid,
 				nodemask_t *nmask);
 struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
 				unsigned long address);
+struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask,
+				     int nid, nodemask_t *nmask);
 int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
 			pgoff_t idx);
 
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 47566bb0b4b1..88881b3f8628 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1586,8 +1586,8 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask,
 	return page;
 }
 
-static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask,
-		int nid, nodemask_t *nmask)
+struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask,
+				     int nid, nodemask_t *nmask)
 {
 	struct page *page;
 
-- 
2.17.1

^ permalink raw reply related

* [RFC PATCH V2 2/4] mm: Add get_user_pages_cma_migrate
From: Aneesh Kumar K.V @ 2018-09-06  5:43 UTC (permalink / raw)
  To: akpm, Alexey Kardashevskiy, mpe
  Cc: linux-mm, linux-kernel, linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <20180906054342.25094-1-aneesh.kumar@linux.ibm.com>

This helper does a get_user_pages_fast and if it find pages in the CMA area
it will try to migrate them before taking page reference. This makes sure that
we don't keep non-movable pages (due to page reference count) in the CMA area.
Not able to move pages out of CMA area result in CMA allocation failures.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 include/linux/migrate.h |   3 ++
 mm/migrate.c            | 108 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index f2b4abbca55e..d82b35afd2eb 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -286,6 +286,9 @@ static inline int migrate_vma(const struct migrate_vma_ops *ops,
 }
 #endif /* IS_ENABLED(CONFIG_MIGRATE_VMA_HELPER) */
 
+extern int get_user_pages_cma_migrate(unsigned long start, int nr_pages, int write,
+				      struct page **pages);
+
 #endif /* CONFIG_MIGRATION */
 
 #endif /* _LINUX_MIGRATE_H */
diff --git a/mm/migrate.c b/mm/migrate.c
index c27e97b5b69d..c26288d407ae 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -3008,3 +3008,111 @@ int migrate_vma(const struct migrate_vma_ops *ops,
 }
 EXPORT_SYMBOL(migrate_vma);
 #endif /* defined(MIGRATE_VMA_HELPER) */
+
+static struct page *new_non_cma_page(struct page *page, unsigned long private)
+{
+	/*
+	 * We want to make sure we allocate the new page from the same node
+	 * as the source page.
+	 */
+	int nid = page_to_nid(page);
+	gfp_t gfp_mask = GFP_USER | __GFP_THISNODE;
+
+	if (PageHighMem(page))
+		gfp_mask |= __GFP_HIGHMEM;
+
+	if (PageHuge(page)) {
+
+		struct hstate *h = page_hstate(page);
+		/*
+		 * We don't want to dequeue from the pool because pool pages will
+		 * mostly be from the CMA region.
+		 */
+		return alloc_migrate_huge_page(h, gfp_mask, nid, NULL);
+
+	} else if (PageTransHuge(page)) {
+		struct page *thp;
+		gfp_t thp_gfpmask = GFP_TRANSHUGE | __GFP_THISNODE;
+
+		/*
+		 * Remove the movable mask so that we don't allocate from
+		 * CMA area again.
+		 */
+		thp_gfpmask &= ~__GFP_MOVABLE;
+		thp = __alloc_pages_node(nid, thp_gfpmask, HPAGE_PMD_ORDER);
+		if (!thp)
+			return NULL;
+		prep_transhuge_page(thp);
+		return thp;
+	}
+
+	return __alloc_pages_node(nid, gfp_mask, 0);
+}
+
+int get_user_pages_cma_migrate(unsigned long start, int nr_pages, int write,
+			       struct page **pages)
+{
+	int i, ret;
+	bool drain_allow = true;
+	bool migrate_allow = true;
+	LIST_HEAD(cma_page_list);
+
+get_user_again:
+	ret = get_user_pages_fast(start, nr_pages, write, pages);
+	if (ret <= 0)
+		return ret;
+
+	for (i = 0; i < ret; ++i) {
+		/*
+		 * If we get a page from the CMA zone, since we are going to
+		 * be pinning these entries, we might as well move them out
+		 * of the CMA zone if possible.
+		 */
+		if (is_migrate_cma_page(pages[i]) && migrate_allow) {
+			if (PageHuge(pages[i]))
+				isolate_huge_page(pages[i], &cma_page_list);
+			else {
+				struct page *head = compound_head(pages[i]);
+
+				if (!PageLRU(head) && drain_allow) {
+					lru_add_drain_all();
+					drain_allow = false;
+				}
+
+				if (!isolate_lru_page(head)) {
+					list_add_tail(&head->lru, &cma_page_list);
+					mod_node_page_state(page_pgdat(head),
+							    NR_ISOLATED_ANON +
+							    page_is_file_cache(head),
+							    hpage_nr_pages(head));
+				}
+			}
+		}
+	}
+	if (!list_empty(&cma_page_list)) {
+		/*
+		 * drop the above get_user_pages reference.
+		 */
+		for (i = 0; i < ret; ++i)
+			put_page(pages[i]);
+
+		if (migrate_pages(&cma_page_list, new_non_cma_page,
+				  NULL, 0, MIGRATE_SYNC, MR_CONTIG_RANGE)) {
+			/*
+			 * some of the pages failed migration. Do get_user_pages
+			 * without migration.
+			 */
+			migrate_allow = false;
+
+			if (!list_empty(&cma_page_list))
+				putback_movable_pages(&cma_page_list);
+		}
+		/*
+		 * We did migrate all the pages, Try to get the page references again
+		 * migrating any new CMA pages which we failed to isolate earlier.
+		 */
+		drain_allow = true;
+		goto get_user_again;
+	}
+	return ret;
+}
-- 
2.17.1

^ permalink raw reply related

* [RFC PATCH V2 3/4] powerpc/mm/iommu: Allow large IOMMU page size only for hugetlb backing
From: Aneesh Kumar K.V @ 2018-09-06  5:43 UTC (permalink / raw)
  To: akpm, Alexey Kardashevskiy, mpe
  Cc: linux-mm, linux-kernel, linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <20180906054342.25094-1-aneesh.kumar@linux.ibm.com>

THP pages can get split during different code paths. An incremented reference
count do imply we will not split the compound page. But the pmd entry can be
converted to level 4 pte entries. Keep the code simpler by allowing large
IOMMU page size only if the guest ram is backed by hugetlb pages.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/mm/mmu_context_iommu.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_iommu.c b/arch/powerpc/mm/mmu_context_iommu.c
index c9ee9e23845f..f472965f7638 100644
--- a/arch/powerpc/mm/mmu_context_iommu.c
+++ b/arch/powerpc/mm/mmu_context_iommu.c
@@ -212,21 +212,9 @@ long mm_iommu_get(struct mm_struct *mm, unsigned long ua, unsigned long entries,
 		}
 populate:
 		pageshift = PAGE_SHIFT;
-		if (mem->pageshift > PAGE_SHIFT && PageCompound(page)) {
-			pte_t *pte;
+		if (mem->pageshift > PAGE_SHIFT && PageHuge(page)) {
 			struct page *head = compound_head(page);
-			unsigned int compshift = compound_order(head);
-			unsigned int pteshift;
-
-			local_irq_save(flags); /* disables as well */
-			pte = find_linux_pte(mm->pgd, cur_ua, NULL, &pteshift);
-
-			/* Double check it is still the same pinned page */
-			if (pte && pte_page(*pte) == head &&
-			    pteshift == compshift + PAGE_SHIFT)
-				pageshift = max_t(unsigned int, pteshift,
-						PAGE_SHIFT);
-			local_irq_restore(flags);
+			pageshift = compound_order(head) + PAGE_SHIFT;
 		}
 		mem->pageshift = min(mem->pageshift, pageshift);
 		mem->hpas[i] = page_to_pfn(page) << PAGE_SHIFT;
-- 
2.17.1

^ permalink raw reply related

* [RFC PATCH V2 4/4] powerpc/mm/iommu: Allow migration of cma allocated pages during mm_iommu_get
From: Aneesh Kumar K.V @ 2018-09-06  5:43 UTC (permalink / raw)
  To: akpm, Alexey Kardashevskiy, mpe
  Cc: linux-mm, linux-kernel, linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <20180906054342.25094-1-aneesh.kumar@linux.ibm.com>

Current code doesn't do page migration if the page allocated is a compound page.
With HugeTLB migration support, we can end up allocating hugetlb pages from
CMA region. Also THP pages can be allocated from CMA region. This patch updates
the code to handle compound pages correctly.

This use the new helper get_user_pages_cma_migrate. It does one get_user_pages
with right count, instead of doing one get_user_pages per page. That avoids
reading page table multiple times.

The patch also convert the hpas member of mm_iommu_table_group_mem_t to a union.
We use the same storage location to store pointers to struct page. We cannot
update alll the code path use struct page *, because we access hpas in real mode
and we can't do that struct page * to pfn conversion in real mode.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/mm/mmu_context_iommu.c | 124 +++++++++-------------------
 1 file changed, 37 insertions(+), 87 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_iommu.c b/arch/powerpc/mm/mmu_context_iommu.c
index f472965f7638..607acd03ab06 100644
--- a/arch/powerpc/mm/mmu_context_iommu.c
+++ b/arch/powerpc/mm/mmu_context_iommu.c
@@ -20,6 +20,7 @@
 #include <linux/swap.h>
 #include <asm/mmu_context.h>
 #include <asm/pte-walk.h>
+#include <linux/mm_inline.h>
 
 static DEFINE_MUTEX(mem_list_mutex);
 
@@ -30,8 +31,18 @@ struct mm_iommu_table_group_mem_t {
 	atomic64_t mapped;
 	unsigned int pageshift;
 	u64 ua;			/* userspace address */
-	u64 entries;		/* number of entries in hpas[] */
-	u64 *hpas;		/* vmalloc'ed */
+	u64 entries;		/* number of entries in hpages[] */
+	/*
+	 * in mm_iommu_get we temporarily use this to store
+	 * struct page address.
+	 *
+	 * We need to convert ua to hpa in real mode. Make it
+	 * simpler by storing physicall address.
+	 */
+	union {
+		struct page **hpages;	/* vmalloc'ed */
+		phys_addr_t *hpas;
+	};
 };
 
 static long mm_iommu_adjust_locked_vm(struct mm_struct *mm,
@@ -74,63 +85,12 @@ bool mm_iommu_preregistered(struct mm_struct *mm)
 }
 EXPORT_SYMBOL_GPL(mm_iommu_preregistered);
 
-/*
- * Taken from alloc_migrate_target with changes to remove CMA allocations
- */
-struct page *new_iommu_non_cma_page(struct page *page, unsigned long private)
-{
-	gfp_t gfp_mask = GFP_USER;
-	struct page *new_page;
-
-	if (PageCompound(page))
-		return NULL;
-
-	if (PageHighMem(page))
-		gfp_mask |= __GFP_HIGHMEM;
-
-	/*
-	 * We don't want the allocation to force an OOM if possibe
-	 */
-	new_page = alloc_page(gfp_mask | __GFP_NORETRY | __GFP_NOWARN);
-	return new_page;
-}
-
-static int mm_iommu_move_page_from_cma(struct page *page)
-{
-	int ret = 0;
-	LIST_HEAD(cma_migrate_pages);
-
-	/* Ignore huge pages for now */
-	if (PageCompound(page))
-		return -EBUSY;
-
-	lru_add_drain();
-	ret = isolate_lru_page(page);
-	if (ret)
-		return ret;
-
-	list_add(&page->lru, &cma_migrate_pages);
-	put_page(page); /* Drop the gup reference */
-
-	ret = migrate_pages(&cma_migrate_pages, new_iommu_non_cma_page,
-				NULL, 0, MIGRATE_SYNC, MR_CONTIG_RANGE);
-	if (ret) {
-		if (!list_empty(&cma_migrate_pages))
-			putback_movable_pages(&cma_migrate_pages);
-	}
-
-	return 0;
-}
-
 long mm_iommu_get(struct mm_struct *mm, unsigned long ua, unsigned long entries,
 		struct mm_iommu_table_group_mem_t **pmem)
 {
 	struct mm_iommu_table_group_mem_t *mem;
-	long i, j, ret = 0, locked_entries = 0;
+	long i, ret = 0, locked_entries = 0;
 	unsigned int pageshift;
-	unsigned long flags;
-	unsigned long cur_ua;
-	struct page *page = NULL;
 
 	mutex_lock(&mem_list_mutex);
 
@@ -177,47 +137,37 @@ long mm_iommu_get(struct mm_struct *mm, unsigned long ua, unsigned long entries,
 		goto unlock_exit;
 	}
 
+	ret = get_user_pages_cma_migrate(ua, entries, 1, mem->hpages);
+	if (ret != entries) {
+		/* free the reference taken */
+		for (i = 0; i < ret; i++)
+			put_page(mem->hpages[i]);
+
+		vfree(mem->hpas);
+		kfree(mem);
+		ret = -EFAULT;
+		goto unlock_exit;
+	} else
+		ret = 0;
+
+	pageshift = PAGE_SHIFT;
 	for (i = 0; i < entries; ++i) {
-		cur_ua = ua + (i << PAGE_SHIFT);
-		if (1 != get_user_pages_fast(cur_ua,
-					1/* pages */, 1/* iswrite */, &page)) {
-			ret = -EFAULT;
-			for (j = 0; j < i; ++j)
-				put_page(pfn_to_page(mem->hpas[j] >>
-						PAGE_SHIFT));
-			vfree(mem->hpas);
-			kfree(mem);
-			goto unlock_exit;
-		}
+		struct page *page = mem->hpages[i];
 		/*
-		 * If we get a page from the CMA zone, since we are going to
-		 * be pinning these entries, we might as well move them out
-		 * of the CMA zone if possible. NOTE: faulting in + migration
-		 * can be expensive. Batching can be considered later
+		 * Allow to use larger than 64k IOMMU pages. Only do that
+		 * if we are backed by hugetlb.
 		 */
-		if (is_migrate_cma_page(page)) {
-			if (mm_iommu_move_page_from_cma(page))
-				goto populate;
-			if (1 != get_user_pages_fast(cur_ua,
-						1/* pages */, 1/* iswrite */,
-						&page)) {
-				ret = -EFAULT;
-				for (j = 0; j < i; ++j)
-					put_page(pfn_to_page(mem->hpas[j] >>
-								PAGE_SHIFT));
-				vfree(mem->hpas);
-				kfree(mem);
-				goto unlock_exit;
-			}
-		}
-populate:
-		pageshift = PAGE_SHIFT;
-		if (mem->pageshift > PAGE_SHIFT && PageHuge(page)) {
+		if ((mem->pageshift > PAGE_SHIFT) && PageHuge(page)) {
 			struct page *head = compound_head(page);
 			pageshift = compound_order(head) + PAGE_SHIFT;
 		}
 		mem->pageshift = min(mem->pageshift, pageshift);
+		/*
+		 * We don't need struct page reference any more, switch
+		 * physicall address.
+		 */
 		mem->hpas[i] = page_to_pfn(page) << PAGE_SHIFT;
+
 	}
 
 	atomic64_set(&mem->mapped, 1);
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2] powerpc/Makefiles: Fix clang/llvm build
From: Joel Stanley @ 2018-09-06  7:07 UTC (permalink / raw)
  To: Anton Blanchard, benh, paulus, mpe, npiggin; +Cc: linuxppc-dev

From: Anton Blanchard <anton@samba.org>

Commit 15a3204d24a3 ("powerpc/64s: Set assembler machine type to POWER4")
passes -mpower4 to the assembler. We have more recent instructions in our
assembly files, but gas permits them. The clang/llvm integrated assembler
is more strict, and we get a build failure.

Fix this by calling the assembler with -mcpu=power8 if as supports it,
else fall back to power4.

Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 11a1acba164a..a70639482053 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -238,7 +238,7 @@ cpu-as-$(CONFIG_4xx)		+= -Wa,-m405
 cpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
 cpu-as-$(CONFIG_E200)		+= -Wa,-me200
 cpu-as-$(CONFIG_E500)		+= -Wa,-me500
-cpu-as-$(CONFIG_PPC_BOOK3S_64)	+= -Wa,-mpower4
+cpu-as-$(CONFIG_PPC_BOOK3S_64)	+= $(call as-option,-Wa$(comma)-mpower8,-Wa$(comma)-mpower4)
 cpu-as-$(CONFIG_PPC_E500MC)	+= $(call as-option,-Wa$(comma)-me500mc)
 
 KBUILD_AFLAGS += $(cpu-as-y)
-- 
2.17.1

^ permalink raw reply related

* Re: [RFC PATCH 07/29] memblock: remove _virt from APIs returning virtual address
From: Michal Hocko @ 2018-09-06  7:28 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rob Herring, linux-mm, Andrew Morton, davem, Greg Kroah-Hartman,
	mingo, Michael Ellerman, paul.burton, Thomas Gleixner, tony.luck,
	linux-ia64, linux-mips, linuxppc-dev, sparclinux,
	Linux Kernel Mailing List
In-Reply-To: <20180905172017.GA2203@rapoport-lnx>

On Wed 05-09-18 20:20:18, Mike Rapoport wrote:
> On Wed, Sep 05, 2018 at 12:04:36PM -0500, Rob Herring wrote:
> > On Wed, Sep 5, 2018 at 11:00 AM Mike Rapoport <rppt@linux.vnet.ibm.com> wrote:
> > >
> > > The conversion is done using
> > >
> > > sed -i 's@memblock_virt_alloc@memblock_alloc@g' \
> > >         $(git grep -l memblock_virt_alloc)
> > 
> > What's the reason to do this? It seems like a lot of churn even if a
> > mechanical change.
> 
> I felt that memblock_virt_alloc_ is too long for a prefix, e.g:
> memblock_virt_alloc_node_nopanic, memblock_virt_alloc_low_nopanic.
> 
> And for consistency I've changed the memblock_virt_alloc as well.

I would keep the current API unless the name is terribly misleading or
it can be improved a lot. Neither seems to be the case here. So I would
rather stick with the status quo.
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* Re: [RFC PATCH 04/29] mm: remove bootmem allocator implementation.
From: Michal Hocko @ 2018-09-06  7:30 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-mm, Andrew Morton, David S. Miller, Greg Kroah-Hartman,
	Ingo Molnar, Michael Ellerman, Paul Burton, Thomas Gleixner,
	Tony Luck, linux-ia64, linux-mips, linuxppc-dev, sparclinux,
	linux-kernel
In-Reply-To: <1536163184-26356-5-git-send-email-rppt@linux.vnet.ibm.com>

On Wed 05-09-18 18:59:19, Mike Rapoport wrote:
> All architectures have been converted to use MEMBLOCK + NO_BOOTMEM. The
> bootmem allocator implementation can be removed.

\o/

Is there any reason to keep

ifdef CONFIG_NO_BOOTMEM
	obj-y		+= nobootmem.o
else
	obj-y		+= bootmem.o
endif

behind?

> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  include/linux/bootmem.h |  16 -
>  mm/bootmem.c            | 811 ------------------------------------------------
>  2 files changed, 827 deletions(-)
>  delete mode 100644 mm/bootmem.c
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* Re: [RFC PATCH 06/29] memblock: rename memblock_alloc{_nid, _try_nid} to memblock_phys_alloc*
From: Michal Hocko @ 2018-09-06  7:35 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-mm, Andrew Morton, David S. Miller, Greg Kroah-Hartman,
	Ingo Molnar, Michael Ellerman, Paul Burton, Thomas Gleixner,
	Tony Luck, linux-ia64, linux-mips, linuxppc-dev, sparclinux,
	linux-kernel
In-Reply-To: <1536163184-26356-7-git-send-email-rppt@linux.vnet.ibm.com>

On Wed 05-09-18 18:59:21, Mike Rapoport wrote:
> This will allow using memblock_alloc for memblock allocations returning
> virtual address.

The description confused me at first because it talks about a future
patch rather than this one.

Anyway unlike the other renaming patch I agree with this one. It makes
it explicit that the caller gets a physical address rather than a
virtual one. Just make it explicit in the changelog.

> The conversion is done using the following semantic patch:
> 
> @@
> expression e1, e2, e3;
> @@
> (
> - memblock_alloc(e1, e2)
> + memblock_phys_alloc(e1, e2)
> |
> - memblock_alloc_nid(e1, e2, e3)
> + memblock_phys_alloc_nid(e1, e2, e3)
> |
> - memblock_alloc_try_nid(e1, e2, e3)
> + memblock_phys_alloc_try_nid(e1, e2, e3)
> )
> 
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>

I do trust Coccinelle so I haven't double checked the resulting patch
but the change makes sense to me

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  arch/arm/mm/mmu.c                     |  2 +-
>  arch/arm64/mm/mmu.c                   |  2 +-
>  arch/arm64/mm/numa.c                  |  2 +-
>  arch/c6x/mm/dma-coherent.c            |  4 ++--
>  arch/nds32/mm/init.c                  |  8 ++++----
>  arch/openrisc/mm/init.c               |  2 +-
>  arch/openrisc/mm/ioremap.c            |  2 +-
>  arch/powerpc/kernel/dt_cpu_ftrs.c     |  4 +---
>  arch/powerpc/kernel/paca.c            |  2 +-
>  arch/powerpc/kernel/prom.c            |  2 +-
>  arch/powerpc/kernel/setup-common.c    |  3 +--
>  arch/powerpc/kernel/setup_32.c        | 10 +++++-----
>  arch/powerpc/mm/numa.c                |  2 +-
>  arch/powerpc/mm/pgtable_32.c          |  2 +-
>  arch/powerpc/mm/ppc_mmu_32.c          |  2 +-
>  arch/powerpc/platforms/pasemi/iommu.c |  2 +-
>  arch/powerpc/platforms/powernv/opal.c |  2 +-
>  arch/powerpc/sysdev/dart_iommu.c      |  2 +-
>  arch/s390/kernel/crash_dump.c         |  2 +-
>  arch/s390/kernel/setup.c              |  3 ++-
>  arch/s390/mm/vmem.c                   |  4 ++--
>  arch/s390/numa/numa.c                 |  2 +-
>  arch/sparc/kernel/mdesc.c             |  2 +-
>  arch/sparc/kernel/prom_64.c           |  2 +-
>  arch/sparc/mm/init_64.c               | 11 ++++++-----
>  arch/unicore32/mm/mmu.c               |  2 +-
>  arch/x86/mm/numa.c                    |  2 +-
>  drivers/firmware/efi/memmap.c         |  2 +-
>  include/linux/memblock.h              |  6 +++---
>  mm/memblock.c                         |  8 ++++----
>  30 files changed, 50 insertions(+), 51 deletions(-)
> 
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index e46a6a4..f5cc1cc 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -721,7 +721,7 @@ EXPORT_SYMBOL(phys_mem_access_prot);
>  
>  static void __init *early_alloc_aligned(unsigned long sz, unsigned long align)
>  {
> -	void *ptr = __va(memblock_alloc(sz, align));
> +	void *ptr = __va(memblock_phys_alloc(sz, align));
>  	memset(ptr, 0, sz);
>  	return ptr;
>  }
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 65f8627..33558f4 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -83,7 +83,7 @@ static phys_addr_t __init early_pgtable_alloc(void)
>  	phys_addr_t phys;
>  	void *ptr;
>  
> -	phys = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
> +	phys = memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
>  
>  	/*
>  	 * The FIX_{PGD,PUD,PMD} slots may be in active use, but the FIX_PTE
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index 146c04c..e5aacd6 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -237,7 +237,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
>  	if (start_pfn >= end_pfn)
>  		pr_info("Initmem setup node %d [<memory-less node>]\n", nid);
>  
> -	nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
> +	nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
>  	nd = __va(nd_pa);
>  
>  	/* report and initialize */
> diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
> index d0a8e0c..01305c7 100644
> --- a/arch/c6x/mm/dma-coherent.c
> +++ b/arch/c6x/mm/dma-coherent.c
> @@ -135,8 +135,8 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
>  	if (dma_size & (PAGE_SIZE - 1))
>  		++dma_pages;
>  
> -	bitmap_phys = memblock_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long),
> -				     sizeof(long));
> +	bitmap_phys = memblock_phys_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long),
> +					  sizeof(long));
>  
>  	dma_bitmap = phys_to_virt(bitmap_phys);
>  	memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
> diff --git a/arch/nds32/mm/init.c b/arch/nds32/mm/init.c
> index c713d2a..5af81b8 100644
> --- a/arch/nds32/mm/init.c
> +++ b/arch/nds32/mm/init.c
> @@ -81,7 +81,7 @@ static void __init map_ram(void)
>  		}
>  
>  		/* Alloc one page for holding PTE's... */
> -		pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
> +		pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
>  		memset(pte, 0, PAGE_SIZE);
>  		set_pmd(pme, __pmd(__pa(pte) + _PAGE_KERNEL_TABLE));
>  
> @@ -114,7 +114,7 @@ static void __init fixedrange_init(void)
>  	pgd = swapper_pg_dir + pgd_index(vaddr);
>  	pud = pud_offset(pgd, vaddr);
>  	pmd = pmd_offset(pud, vaddr);
> -	fixmap_pmd_p = (pmd_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
> +	fixmap_pmd_p = (pmd_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
>  	memset(fixmap_pmd_p, 0, PAGE_SIZE);
>  	set_pmd(pmd, __pmd(__pa(fixmap_pmd_p) + _PAGE_KERNEL_TABLE));
>  
> @@ -127,7 +127,7 @@ static void __init fixedrange_init(void)
>  	pgd = swapper_pg_dir + pgd_index(vaddr);
>  	pud = pud_offset(pgd, vaddr);
>  	pmd = pmd_offset(pud, vaddr);
> -	pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
> +	pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
>  	memset(pte, 0, PAGE_SIZE);
>  	set_pmd(pmd, __pmd(__pa(pte) + _PAGE_KERNEL_TABLE));
>  	pkmap_page_table = pte;
> @@ -153,7 +153,7 @@ void __init paging_init(void)
>  	fixedrange_init();
>  
>  	/* allocate space for empty_zero_page */
> -	zero_page = __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
> +	zero_page = __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
>  	memset(zero_page, 0, PAGE_SIZE);
>  	zone_sizes_init();
>  
> diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
> index 6972d5d..b7670de 100644
> --- a/arch/openrisc/mm/init.c
> +++ b/arch/openrisc/mm/init.c
> @@ -106,7 +106,7 @@ static void __init map_ram(void)
>  			}
>  
>  			/* Alloc one page for holding PTE's... */
> -			pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
> +			pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
>  			set_pmd(pme, __pmd(_KERNPG_TABLE + __pa(pte)));
>  
>  			/* Fill the newly allocated page with PTE'S */
> diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
> index 2175e4b..c969752 100644
> --- a/arch/openrisc/mm/ioremap.c
> +++ b/arch/openrisc/mm/ioremap.c
> @@ -126,7 +126,7 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm,
>  	if (likely(mem_init_done)) {
>  		pte = (pte_t *) __get_free_page(GFP_KERNEL);
>  	} else {
> -		pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
> +		pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
>  	}
>  
>  	if (pte)
> diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
> index f432054..8be3721 100644
> --- a/arch/powerpc/kernel/dt_cpu_ftrs.c
> +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
> @@ -1008,9 +1008,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_alloc(sizeof(struct dt_cpu_feature)*
> -				nr_dt_cpu_features, PAGE_SIZE));
> +	dt_cpu_features = __va(memblock_phys_alloc(sizeof(struct dt_cpu_feature) * nr_dt_cpu_features, PAGE_SIZE));
>  
>  	cpufeatures_setup_start(isa);
>  
> diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
> index 0ee3e6d..f331a00 100644
> --- a/arch/powerpc/kernel/paca.c
> +++ b/arch/powerpc/kernel/paca.c
> @@ -198,7 +198,7 @@ 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_alloc(paca_ptrs_size, 0));
> +	paca_ptrs = __va(memblock_phys_alloc(paca_ptrs_size, 0));
>  	memset(paca_ptrs, 0x88, paca_ptrs_size);
>  }
>  
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index c4d7078..fe758ce 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -126,7 +126,7 @@ static void __init move_device_tree(void)
>  	if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) ||
>  			overlaps_crashkernel(start, size) ||
>  			overlaps_initrd(start, size)) {
> -		p = __va(memblock_alloc(size, PAGE_SIZE));
> +		p = __va(memblock_phys_alloc(size, PAGE_SIZE));
>  		memcpy(p, initial_boot_params, size);
>  		initial_boot_params = p;
>  		DBG("Moved device tree to 0x%p\n", p);
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 93fa0c9..710ff98 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -459,8 +459,7 @@ void __init smp_setup_cpu_maps(void)
>  
>  	DBG("smp_setup_cpu_maps()\n");
>  
> -	cpu_to_phys_id = __va(memblock_alloc(nr_cpu_ids * sizeof(u32),
> -							__alignof__(u32)));
> +	cpu_to_phys_id = __va(memblock_phys_alloc(nr_cpu_ids * sizeof(u32), __alignof__(u32)));
>  	memset(cpu_to_phys_id, 0, nr_cpu_ids * sizeof(u32));
>  
>  	for_each_node_by_type(dn, "cpu") {
> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> index 8c507be..8190960 100644
> --- a/arch/powerpc/kernel/setup_32.c
> +++ b/arch/powerpc/kernel/setup_32.c
> @@ -206,9 +206,9 @@ void __init irqstack_early_init(void)
>  	 * as the memblock is limited to lowmem by default */
>  	for_each_possible_cpu(i) {
>  		softirq_ctx[i] = (struct thread_info *)
> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> +			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
>  		hardirq_ctx[i] = (struct thread_info *)
> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> +			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
>  	}
>  }
>  
> @@ -227,12 +227,12 @@ void __init exc_lvl_early_init(void)
>  #endif
>  
>  		critirq_ctx[hw_cpu] = (struct thread_info *)
> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> +			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
>  #ifdef CONFIG_BOOKE
>  		dbgirq_ctx[hw_cpu] = (struct thread_info *)
> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> +			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
>  		mcheckirq_ctx[hw_cpu] = (struct thread_info *)
> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> +			__va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE));
>  #endif
>  	}
>  }
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 35ac542..5fc0587 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -788,7 +788,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
>  	void *nd;
>  	int tnid;
>  
> -	nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
> +	nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
>  	nd = __va(nd_pa);
>  
>  	/* report and initialize */
> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
> index 120a49b..989a1c2 100644
> --- a/arch/powerpc/mm/pgtable_32.c
> +++ b/arch/powerpc/mm/pgtable_32.c
> @@ -50,7 +50,7 @@ __ref pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
>  	if (slab_is_available()) {
>  		pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
>  	} else {
> -		pte = __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
> +		pte = __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
>  		if (pte)
>  			clear_page(pte);
>  	}
> diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
> index bea6c54..9ee0357 100644
> --- a/arch/powerpc/mm/ppc_mmu_32.c
> +++ b/arch/powerpc/mm/ppc_mmu_32.c
> @@ -224,7 +224,7 @@ void __init MMU_init_hw(void)
>  	 * Find some memory for the hash table.
>  	 */
>  	if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322);
> -	Hash = __va(memblock_alloc(Hash_size, Hash_size));
> +	Hash = __va(memblock_phys_alloc(Hash_size, Hash_size));
>  	memset(Hash, 0, Hash_size);
>  	_SDR1 = __pa(Hash) | SDR1_LOW_BITS;
>  
> diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
> index f06c83f..f297152 100644
> --- a/arch/powerpc/platforms/pasemi/iommu.c
> +++ b/arch/powerpc/platforms/pasemi/iommu.c
> @@ -213,7 +213,7 @@ static int __init iob_init(struct device_node *dn)
>  	pr_info("IOBMAP L2 allocated at: %p\n", iob_l2_base);
>  
>  	/* Allocate a spare page to map all invalid IOTLB pages. */
> -	tmp = memblock_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE);
> +	tmp = memblock_phys_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE);
>  	if (!tmp)
>  		panic("IOBMAP: Cannot allocate spare page!");
>  	/* Empty l1 is marked invalid */
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 38fe408..9431921 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -171,7 +171,7 @@ int __init early_init_dt_scan_recoverable_ranges(unsigned long node,
>  	/*
>  	 * Allocate a buffer to hold the MC recoverable ranges.
>  	 */
> -	mc_recoverable_range =__va(memblock_alloc(size, __alignof__(u64)));
> +	mc_recoverable_range =__va(memblock_phys_alloc(size, __alignof__(u64)));
>  	memset(mc_recoverable_range, 0, size);
>  
>  	for (i = 0; i < mc_recoverable_range_len; i++) {
> diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
> index 5ca3e22..a5b40d1 100644
> --- a/arch/powerpc/sysdev/dart_iommu.c
> +++ b/arch/powerpc/sysdev/dart_iommu.c
> @@ -261,7 +261,7 @@ static void allocate_dart(void)
>  	 * that to work around what looks like a problem with the HT bridge
>  	 * prefetching into invalid pages and corrupting data
>  	 */
> -	tmp = memblock_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
> +	tmp = memblock_phys_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
>  	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 376f6b6..d17566a 100644
> --- a/arch/s390/kernel/crash_dump.c
> +++ b/arch/s390/kernel/crash_dump.c
> @@ -61,7 +61,7 @@ struct save_area * __init save_area_alloc(bool is_boot_cpu)
>  {
>  	struct save_area *sa;
>  
> -	sa = (void *) memblock_alloc(sizeof(*sa), 8);
> +	sa = (void *) memblock_phys_alloc(sizeof(*sa), 8);
>  	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 c637c12..2f2ee43 100644
> --- a/arch/s390/kernel/setup.c
> +++ b/arch/s390/kernel/setup.c
> @@ -843,7 +843,8 @@ static void __init setup_randomness(void)
>  {
>  	struct sysinfo_3_2_2 *vmms;
>  
> -	vmms = (struct sysinfo_3_2_2 *) memblock_alloc(PAGE_SIZE, PAGE_SIZE);
> +	vmms = (struct sysinfo_3_2_2 *) memblock_phys_alloc(PAGE_SIZE,
> +							    PAGE_SIZE);
>  	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/s390/mm/vmem.c b/arch/s390/mm/vmem.c
> index db55561..04638b0 100644
> --- a/arch/s390/mm/vmem.c
> +++ b/arch/s390/mm/vmem.c
> @@ -36,7 +36,7 @@ static void __ref *vmem_alloc_pages(unsigned int order)
>  
>  	if (slab_is_available())
>  		return (void *)__get_free_pages(GFP_KERNEL, order);
> -	return (void *) memblock_alloc(size, size);
> +	return (void *) memblock_phys_alloc(size, size);
>  }
>  
>  void *vmem_crst_alloc(unsigned long val)
> @@ -57,7 +57,7 @@ pte_t __ref *vmem_pte_alloc(void)
>  	if (slab_is_available())
>  		pte = (pte_t *) page_table_alloc(&init_mm);
>  	else
> -		pte = (pte_t *) memblock_alloc(size, size);
> +		pte = (pte_t *) memblock_phys_alloc(size, size);
>  	if (!pte)
>  		return NULL;
>  	memset64((u64 *)pte, _PAGE_INVALID, PTRS_PER_PTE);
> diff --git a/arch/s390/numa/numa.c b/arch/s390/numa/numa.c
> index 5bd3744..297f5d8 100644
> --- a/arch/s390/numa/numa.c
> +++ b/arch/s390/numa/numa.c
> @@ -64,7 +64,7 @@ static __init pg_data_t *alloc_node_data(void)
>  {
>  	pg_data_t *res;
>  
> -	res = (pg_data_t *) memblock_alloc(sizeof(pg_data_t), 8);
> +	res = (pg_data_t *) memblock_phys_alloc(sizeof(pg_data_t), 8);
>  	memset(res, 0, sizeof(pg_data_t));
>  	return res;
>  }
> diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
> index 39a2503..59131e7 100644
> --- a/arch/sparc/kernel/mdesc.c
> +++ b/arch/sparc/kernel/mdesc.c
> @@ -170,7 +170,7 @@ static struct mdesc_handle * __init mdesc_memblock_alloc(unsigned int mdesc_size
>  		       mdesc_size);
>  	alloc_size = PAGE_ALIGN(handle_size);
>  
> -	paddr = memblock_alloc(alloc_size, PAGE_SIZE);
> +	paddr = memblock_phys_alloc(alloc_size, PAGE_SIZE);
>  
>  	hp = NULL;
>  	if (paddr) {
> diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
> index baeaeed..c37955d 100644
> --- a/arch/sparc/kernel/prom_64.c
> +++ b/arch/sparc/kernel/prom_64.c
> @@ -34,7 +34,7 @@
>  
>  void * __init prom_early_alloc(unsigned long size)
>  {
> -	unsigned long paddr = memblock_alloc(size, SMP_CACHE_BYTES);
> +	unsigned long paddr = memblock_phys_alloc(size, SMP_CACHE_BYTES);
>  	void *ret;
>  
>  	if (!paddr) {
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index f396048..578ec3d 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -1092,7 +1092,8 @@ static void __init allocate_node_data(int nid)
>  #ifdef CONFIG_NEED_MULTIPLE_NODES
>  	unsigned long paddr;
>  
> -	paddr = memblock_alloc_try_nid(sizeof(struct pglist_data), SMP_CACHE_BYTES, nid);
> +	paddr = memblock_phys_alloc_try_nid(sizeof(struct pglist_data),
> +					    SMP_CACHE_BYTES, nid);
>  	if (!paddr) {
>  		prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid);
>  		prom_halt();
> @@ -1266,8 +1267,8 @@ static int __init grab_mlgroups(struct mdesc_handle *md)
>  	if (!count)
>  		return -ENOENT;
>  
> -	paddr = memblock_alloc(count * sizeof(struct mdesc_mlgroup),
> -			  SMP_CACHE_BYTES);
> +	paddr = memblock_phys_alloc(count * sizeof(struct mdesc_mlgroup),
> +				    SMP_CACHE_BYTES);
>  	if (!paddr)
>  		return -ENOMEM;
>  
> @@ -1307,8 +1308,8 @@ static int __init grab_mblocks(struct mdesc_handle *md)
>  	if (!count)
>  		return -ENOENT;
>  
> -	paddr = memblock_alloc(count * sizeof(struct mdesc_mblock),
> -			  SMP_CACHE_BYTES);
> +	paddr = memblock_phys_alloc(count * sizeof(struct mdesc_mblock),
> +				    SMP_CACHE_BYTES);
>  	if (!paddr)
>  		return -ENOMEM;
>  
> diff --git a/arch/unicore32/mm/mmu.c b/arch/unicore32/mm/mmu.c
> index 0c94b7b..18b355a 100644
> --- a/arch/unicore32/mm/mmu.c
> +++ b/arch/unicore32/mm/mmu.c
> @@ -144,7 +144,7 @@ static void __init build_mem_type_table(void)
>  
>  static void __init *early_alloc(unsigned long sz)
>  {
> -	void *ptr = __va(memblock_alloc(sz, sz));
> +	void *ptr = __va(memblock_phys_alloc(sz, sz));
>  	memset(ptr, 0, sz);
>  	return ptr;
>  }
> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> index fa15085..16e37d7 100644
> --- a/arch/x86/mm/numa.c
> +++ b/arch/x86/mm/numa.c
> @@ -196,7 +196,7 @@ 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_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
> +	nd_pa = memblock_phys_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
>  	if (!nd_pa) {
>  		nd_pa = __memblock_alloc_base(nd_size, SMP_CACHE_BYTES,
>  					      MEMBLOCK_ALLOC_ACCESSIBLE);
> diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c
> index 5fc7052..ef618bc 100644
> --- a/drivers/firmware/efi/memmap.c
> +++ b/drivers/firmware/efi/memmap.c
> @@ -15,7 +15,7 @@
>  
>  static phys_addr_t __init __efi_memmap_alloc_early(unsigned long size)
>  {
> -	return memblock_alloc(size, 0);
> +	return memblock_phys_alloc(size, 0);
>  }
>  
>  static phys_addr_t __init __efi_memmap_alloc_late(unsigned long size)
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index 3c96a16..ab5f11b 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -317,10 +317,10 @@ static inline int memblock_get_region_node(const struct memblock_region *r)
>  }
>  #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>  
> -phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
> -phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
> +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_alloc(phys_addr_t size, phys_addr_t align);
> +phys_addr_t memblock_phys_alloc(phys_addr_t size, phys_addr_t align);
>  
>  /*
>   * Set the allocation direction to bottom-up or top-down.
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 2a5940c..0ab9507 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1344,7 +1344,7 @@ phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
>  	return memblock_alloc_range_nid(size, align, 0, max_addr, nid, flags);
>  }
>  
> -phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
> +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;
> @@ -1379,14 +1379,14 @@ phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys
>  	return alloc;
>  }
>  
> -phys_addr_t __init memblock_alloc(phys_addr_t size, phys_addr_t align)
> +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_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
> +phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
>  {
> -	phys_addr_t res = memblock_alloc_nid(size, align, nid);
> +	phys_addr_t res = memblock_phys_alloc_nid(size, align, nid);
>  
>  	if (res)
>  		return res;
> -- 
> 2.7.4
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* Re: [RFC PATCH 08/29] memblock: replace alloc_bootmem_align with memblock_alloc
From: Michal Hocko @ 2018-09-06  7:39 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-mm, Andrew Morton, David S. Miller, Greg Kroah-Hartman,
	Ingo Molnar, Michael Ellerman, Paul Burton, Thomas Gleixner,
	Tony Luck, linux-ia64, linux-mips, linuxppc-dev, sparclinux,
	linux-kernel
In-Reply-To: <1536163184-26356-9-git-send-email-rppt@linux.vnet.ibm.com>

On Wed 05-09-18 18:59:23, Mike Rapoport wrote:
> The functions are equivalent, just the later does not require nobootmem
> translation layer.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  arch/x86/xen/p2m.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
> index 159a897..68c0f14 100644
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -180,7 +180,7 @@ static void p2m_init_identity(unsigned long *p2m, unsigned long pfn)
>  static void * __ref alloc_p2m_page(void)
>  {
>  	if (unlikely(!slab_is_available()))
> -		return alloc_bootmem_align(PAGE_SIZE, PAGE_SIZE);
> +		return memblock_alloc(PAGE_SIZE, PAGE_SIZE);
>  
>  	return (void *)__get_free_page(GFP_KERNEL);
>  }
> -- 
> 2.7.4

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* Re: [RFC PATCH 09/29] memblock: replace alloc_bootmem_low with memblock_alloc_low
From: Michal Hocko @ 2018-09-06  7:41 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-mm, Andrew Morton, David S. Miller, Greg Kroah-Hartman,
	Ingo Molnar, Michael Ellerman, Paul Burton, Thomas Gleixner,
	Tony Luck, linux-ia64, linux-mips, linuxppc-dev, sparclinux,
	linux-kernel
In-Reply-To: <1536163184-26356-10-git-send-email-rppt@linux.vnet.ibm.com>

On Wed 05-09-18 18:59:24, Mike Rapoport wrote:
> The functions are equivalent, just the later does not require nobootmem
> translation layer.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>

modulo @memblock_alloc_low@@memblock_virt_alloc_low@
Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  arch/x86/kernel/tce_64.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/tce_64.c b/arch/x86/kernel/tce_64.c
> index f386bad..54c9b5a 100644
> --- a/arch/x86/kernel/tce_64.c
> +++ b/arch/x86/kernel/tce_64.c
> @@ -173,7 +173,7 @@ void * __init alloc_tce_table(void)
>  	size = table_size_to_number_of_entries(specified_table_size);
>  	size *= TCE_ENTRY_SIZE;
>  
> -	return __alloc_bootmem_low(size, size, 0);
> +	return memblock_alloc_low(size, size);
>  }
>  
>  void __init free_tce_table(void *tbl)
> -- 
> 2.7.4

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* Re: [RFC PATCH 10/29] memblock: replace __alloc_bootmem_node_nopanic with memblock_alloc_try_nid_nopanic
From: Michal Hocko @ 2018-09-06  7:49 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-mm, Andrew Morton, David S. Miller, Greg Kroah-Hartman,
	Ingo Molnar, Michael Ellerman, Paul Burton, Thomas Gleixner,
	Tony Luck, linux-ia64, linux-mips, linuxppc-dev, sparclinux,
	linux-kernel
In-Reply-To: <1536163184-26356-11-git-send-email-rppt@linux.vnet.ibm.com>

On Wed 05-09-18 18:59:25, Mike Rapoport wrote:
> The __alloc_bootmem_node_nopanic() is used only once, there is no reason to
> add a wrapper for memblock_alloc_try_nid_nopanic for it.

OK, it took me a bit longer to see they are equivalent. Both zero the
memory and fallback to a different node if the given one doesn't have a
proper range. So good. Lack of proper documentation didn't really help.
 
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  arch/x86/kernel/setup_percpu.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
> index ea554f8..67d48e26 100644
> --- a/arch/x86/kernel/setup_percpu.c
> +++ b/arch/x86/kernel/setup_percpu.c
> @@ -112,8 +112,10 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, unsigned long size,
>  		pr_debug("per cpu data for cpu%d %lu bytes at %016lx\n",
>  			 cpu, size, __pa(ptr));
>  	} else {
> -		ptr = __alloc_bootmem_node_nopanic(NODE_DATA(node),
> -						   size, align, goal);
> +		ptr = memblock_alloc_try_nid_nopanic(size, align, goal,
> +						     BOOTMEM_ALLOC_ACCESSIBLE,
> +						     node);
> +
>  		pr_debug("per cpu data for cpu%d %lu bytes on node%d at %016lx\n",
>  			 cpu, size, node, __pa(ptr));
>  	}
> -- 
> 2.7.4

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* Re: [RFC PATCH 11/29] memblock: replace alloc_bootmem_pages_nopanic with memblock_alloc_nopanic
From: Michal Hocko @ 2018-09-06  7:53 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-mm, Andrew Morton, David S. Miller, Greg Kroah-Hartman,
	Ingo Molnar, Michael Ellerman, Paul Burton, Thomas Gleixner,
	Tony Luck, linux-ia64, linux-mips, linuxppc-dev, sparclinux,
	linux-kernel
In-Reply-To: <1536163184-26356-12-git-send-email-rppt@linux.vnet.ibm.com>

On Wed 05-09-18 18:59:26, Mike Rapoport wrote:
> The alloc_bootmem_pages_nopanic(size) is a shortcut for
> __alloc_bootmem_nopanic(x, PAGE_SIZE, BOOTMEM_LOW_LIMIT) and can be
> replaced by memblock_alloc_nopanic(size, PAGE_SIZE)

It is not so straightforward because you really have to go deep down the
callpath to see they are doing the same thing essentially.

> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  drivers/usb/early/xhci-dbc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
> index e15e896..16df968 100644
> --- a/drivers/usb/early/xhci-dbc.c
> +++ b/drivers/usb/early/xhci-dbc.c
> @@ -94,7 +94,7 @@ static void * __init xdbc_get_page(dma_addr_t *dma_addr)
>  {
>  	void *virt;
>  
> -	virt = alloc_bootmem_pages_nopanic(PAGE_SIZE);
> +	virt = memblock_alloc_nopanic(PAGE_SIZE, PAGE_SIZE);
>  	if (!virt)
>  		return NULL;
>  
> -- 
> 2.7.4
> 

-- 
Michal Hocko
SUSE Labs

^ 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