* [PATCH] powerpc: Drop zalloc_maybe_bootmem()
@ 2023-08-23 5:54 Michael Ellerman
2023-08-23 6:01 ` Christophe Leroy
2023-08-31 4:02 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-08-23 5:54 UTC (permalink / raw)
To: linuxppc-dev
The only callers of zalloc_maybe_bootmem() are PCI setup routines. These
used to be called early during boot before slab setup, and also during
runtime due to hotplug.
But commit 5537fcb319d0 ("powerpc/pci: Add ppc_md.discover_phbs()")
moved the boot-time calls later, after slab setup, meaning there's no
longer any need for zalloc_maybe_bootmem(), kzalloc() can be used in all
cases.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/setup.h | 1 -
arch/powerpc/kernel/pci-common.c | 2 +-
arch/powerpc/lib/Makefile | 2 +-
arch/powerpc/lib/alloc.c | 23 -----------------------
arch/powerpc/sysdev/fsl_pci.c | 2 +-
5 files changed, 3 insertions(+), 27 deletions(-)
delete mode 100644 arch/powerpc/lib/alloc.c
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index e29e83f8a89c..eed74c1fb832 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -8,7 +8,6 @@
extern void ppc_printk_progress(char *s, unsigned short hex);
extern unsigned long long memory_limit;
-extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
struct device_node;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e88d7c9feeec..040255ddb569 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -125,7 +125,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
{
struct pci_controller *phb;
- phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
+ phb = kzalloc(sizeof(struct pci_controller), GFP_KERNEL);
if (phb == NULL)
return NULL;
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 9aa8286c9687..51ad0397c17a 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -27,7 +27,7 @@ endif
CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
-obj-y += alloc.o code-patching.o feature-fixups.o pmem.o
+obj-y += code-patching.o feature-fixups.o pmem.o
obj-$(CONFIG_CODE_PATCHING_SELFTEST) += test-code-patching.o
diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
deleted file mode 100644
index ce180870bd52..000000000000
--- a/arch/powerpc/lib/alloc.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/memblock.h>
-#include <linux/string.h>
-#include <asm/setup.h>
-
-
-void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
-{
- void *p;
-
- if (slab_is_available())
- p = kzalloc(size, mask);
- else {
- p = memblock_alloc(size, SMP_CACHE_BYTES);
- if (!p)
- panic("%s: Failed to allocate %zu bytes\n", __func__,
- size);
- }
- return p;
-}
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 5f7219df35ef..3868483fbe29 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -767,7 +767,7 @@ static int __init mpc83xx_pcie_setup(struct pci_controller *hose,
u32 cfg_bar;
int ret = -ENOMEM;
- pcie = zalloc_maybe_bootmem(sizeof(*pcie), GFP_KERNEL);
+ pcie = kzalloc(sizeof(*pcie), GFP_KERNEL);
if (!pcie)
return ret;
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Drop zalloc_maybe_bootmem()
2023-08-23 5:54 [PATCH] powerpc: Drop zalloc_maybe_bootmem() Michael Ellerman
@ 2023-08-23 6:01 ` Christophe Leroy
2023-08-31 4:02 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2023-08-23 6:01 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev@lists.ozlabs.org
Le 23/08/2023 à 07:54, Michael Ellerman a écrit :
> The only callers of zalloc_maybe_bootmem() are PCI setup routines. These
> used to be called early during boot before slab setup, and also during
> runtime due to hotplug.
>
> But commit 5537fcb319d0 ("powerpc/pci: Add ppc_md.discover_phbs()")
> moved the boot-time calls later, after slab setup, meaning there's no
> longer any need for zalloc_maybe_bootmem(), kzalloc() can be used in all
> cases.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/include/asm/setup.h | 1 -
> arch/powerpc/kernel/pci-common.c | 2 +-
> arch/powerpc/lib/Makefile | 2 +-
> arch/powerpc/lib/alloc.c | 23 -----------------------
> arch/powerpc/sysdev/fsl_pci.c | 2 +-
> 5 files changed, 3 insertions(+), 27 deletions(-)
> delete mode 100644 arch/powerpc/lib/alloc.c
>
> diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
> index e29e83f8a89c..eed74c1fb832 100644
> --- a/arch/powerpc/include/asm/setup.h
> +++ b/arch/powerpc/include/asm/setup.h
> @@ -8,7 +8,6 @@
> extern void ppc_printk_progress(char *s, unsigned short hex);
>
> extern unsigned long long memory_limit;
> -extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
>
> struct device_node;
>
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index e88d7c9feeec..040255ddb569 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -125,7 +125,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
> {
> struct pci_controller *phb;
>
> - phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
> + phb = kzalloc(sizeof(struct pci_controller), GFP_KERNEL);
> if (phb == NULL)
> return NULL;
>
> diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
> index 9aa8286c9687..51ad0397c17a 100644
> --- a/arch/powerpc/lib/Makefile
> +++ b/arch/powerpc/lib/Makefile
> @@ -27,7 +27,7 @@ endif
> CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
> CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
>
> -obj-y += alloc.o code-patching.o feature-fixups.o pmem.o
> +obj-y += code-patching.o feature-fixups.o pmem.o
>
> obj-$(CONFIG_CODE_PATCHING_SELFTEST) += test-code-patching.o
>
> diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
> deleted file mode 100644
> index ce180870bd52..000000000000
> --- a/arch/powerpc/lib/alloc.c
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -#include <linux/types.h>
> -#include <linux/init.h>
> -#include <linux/slab.h>
> -#include <linux/memblock.h>
> -#include <linux/string.h>
> -#include <asm/setup.h>
> -
> -
> -void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
> -{
> - void *p;
> -
> - if (slab_is_available())
> - p = kzalloc(size, mask);
> - else {
> - p = memblock_alloc(size, SMP_CACHE_BYTES);
> - if (!p)
> - panic("%s: Failed to allocate %zu bytes\n", __func__,
> - size);
> - }
> - return p;
> -}
> diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> index 5f7219df35ef..3868483fbe29 100644
> --- a/arch/powerpc/sysdev/fsl_pci.c
> +++ b/arch/powerpc/sysdev/fsl_pci.c
> @@ -767,7 +767,7 @@ static int __init mpc83xx_pcie_setup(struct pci_controller *hose,
> u32 cfg_bar;
> int ret = -ENOMEM;
>
> - pcie = zalloc_maybe_bootmem(sizeof(*pcie), GFP_KERNEL);
> + pcie = kzalloc(sizeof(*pcie), GFP_KERNEL);
> if (!pcie)
> return ret;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Drop zalloc_maybe_bootmem()
2023-08-23 5:54 [PATCH] powerpc: Drop zalloc_maybe_bootmem() Michael Ellerman
2023-08-23 6:01 ` Christophe Leroy
@ 2023-08-31 4:02 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-08-31 4:02 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman
On Wed, 23 Aug 2023 15:54:30 +1000, Michael Ellerman wrote:
> The only callers of zalloc_maybe_bootmem() are PCI setup routines. These
> used to be called early during boot before slab setup, and also during
> runtime due to hotplug.
>
> But commit 5537fcb319d0 ("powerpc/pci: Add ppc_md.discover_phbs()")
> moved the boot-time calls later, after slab setup, meaning there's no
> longer any need for zalloc_maybe_bootmem(), kzalloc() can be used in all
> cases.
>
> [...]
Applied to powerpc/next.
[1/1] powerpc: Drop zalloc_maybe_bootmem()
https://git.kernel.org/powerpc/c/fabdb27da78afb93b0a83c0579025cb8d05c0d2d
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-31 4:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 5:54 [PATCH] powerpc: Drop zalloc_maybe_bootmem() Michael Ellerman
2023-08-23 6:01 ` Christophe Leroy
2023-08-31 4:02 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).