On May 8, 2020, at 10:39 AM, Qian Cai <cai@xxxxxx> wrote:
Booting POWER9 PowerNV has this message,
"ioremap() called early from pnv_pci_init_ioda_phb+0x420/0xdfc. Use early_ioremap() insteadâ
but use the patch below will result in leaks because it will never call early_iounmap() anywhere. However, it looks me it was by design that phb->regs mapping would be there forever where it would be used in pnv_ioda_get_inval_reg(), so is just that check_early_ioremap_leak() initcall too strong?
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -36,6 +36,7 @@
#include <asm/firmware.h>
#include <asm/pnv-pci.h>
#include <asm/mmzone.h>
+#include <asm/early_ioremap.h>
#include <misc/cxl-base.h>
@@ -3827,7 +3828,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
/* Get registers */
if (!of_address_to_resource(np, 0, &r)) {
phb->regs_phys = r.start;
- phb->regs = ioremap(r.start, resource_size(&r));
+ phb->regs = early_ioremap(r.start, resource_size(&r));
if (phb->regs == NULL)
pr_err(" Failed to map registers !\nâ);
This will also trigger a panic with debugfs reads, so isnât that this commit bogus at least for powerpc64?
d538aadc2718 (âpowerpc/ioremap: warn on early use of ioremap()")