[PATCHv2 net-next] net: use pdev instead of OF funcs
np here is the node coming from platform_device. No children are used. I changed irq_of_parse_and_map to platform_get_irq to pass it directly. I changed of_address_to_resource to platform_get_resource for the same reason. It ends up being the same. Signed-off-by: Rosen Penev --- v2: fixed compilation errors. Also removed non devm transformations. Those will be handled separately. Also reworded description. drivers/net/can/grcan.c | 2 +- drivers/net/can/mscan/mpc5xxx_can.c | 2 +- drivers/net/dsa/bcm_sf2.c| 4 ++-- drivers/net/ethernet/allwinner/sun4i-emac.c | 2 +- drivers/net/ethernet/freescale/fec_mpc52xx.c | 6 +++--- drivers/net/ethernet/freescale/fs_enet/mac-fcc.c | 2 +- drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 2 +- drivers/net/ethernet/freescale/fs_enet/mac-scc.c | 2 +- drivers/net/ethernet/freescale/ucc_geth.c| 12 ++-- drivers/net/ethernet/marvell/mvneta.c| 2 +- drivers/net/ethernet/moxa/moxart_ether.c | 5 ++--- .../net/ethernet/samsung/sxgbe/sxgbe_platform.c | 8 drivers/net/ethernet/via/via-rhine.c | 2 +- drivers/net/ethernet/via/via-velocity.c | 2 +- drivers/net/ethernet/xilinx/ll_temac_mdio.c | 6 +++--- drivers/net/mdio/mdio-mux-mmioreg.c | 16 +--- drivers/net/wan/fsl_ucc_hdlc.c | 10 +- 17 files changed, 43 insertions(+), 42 deletions(-) diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c index cdf0ec9fa7f3..0a2cc0ba219f 100644 --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c @@ -1673,7 +1673,7 @@ static int grcan_probe(struct platform_device *ofdev) goto exit_error; } - irq = irq_of_parse_and_map(np, GRCAN_IRQIX_IRQ); + irq = platform_get_irq(ofdev, GRCAN_IRQIX_IRQ); if (!irq) { dev_err(&ofdev->dev, "no irq found\n"); err = -ENODEV; diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index 0080c39ee182..252ad40bdb97 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -300,7 +300,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) if (!base) return dev_err_probe(&ofdev->dev, err, "couldn't ioremap\n"); - irq = irq_of_parse_and_map(np, 0); + irq = platform_get_irq(ofdev, 0); if (!irq) { dev_err(&ofdev->dev, "no irq found\n"); err = -ENODEV; diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 43bde1f583ff..9229582efd05 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -1443,8 +1443,8 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) of_node_put(ports); } - priv->irq0 = irq_of_parse_and_map(dn, 0); - priv->irq1 = irq_of_parse_and_map(dn, 1); + priv->irq0 = platform_get_irq(pdev, 0); + priv->irq1 = platform_get_irq(pdev, 1); base = &priv->core; for (i = 0; i < BCM_SF2_REGS_NUM; i++) { diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 2f516b950f4e..18df8d1d93fd 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -995,7 +995,7 @@ static int emac_probe(struct platform_device *pdev) /* fill in parameters for net-dev structure */ ndev->base_addr = (unsigned long)db->membase; - ndev->irq = irq_of_parse_and_map(np, 0); + ndev->irq = platform_get_irq(pdev, 0); if (ndev->irq == -ENXIO) { netdev_err(ndev, "No irq resource\n"); ret = ndev->irq; diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c index 6b47a2196a46..67e65a63a36f 100644 --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c @@ -839,7 +839,7 @@ static int mpc52xx_fec_probe(struct platform_device *op) ndev->netdev_ops= &mpc52xx_fec_netdev_ops; ndev->ethtool_ops = &mpc52xx_fec_ethtool_ops; ndev->watchdog_timeo= FEC_WATCHDOG_TIMEOUT; - ndev->base_addr = mem.start; + ndev->base_addr = mem->start; SET_NETDEV_DEV(ndev, &op->dev); spin_lock_init(&priv->lock); @@ -859,9 +859,9 @@ static int mpc52xx_fec_probe(struct platform_device *op) /* Get the IRQ we need one by one */ /* Control */ - ndev->irq = irq_of_parse_and_map(np, 0); + ndev->irq = platform_get_irq(op, 0); - /* RX */ + /* RX */ priv->r_irq = bcom_get_task_irq(priv->rx_dmatsk); /* TX */ diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c index be63293511d9..8be
Re: [PATCH v5 0/7] mm/mprotect: Fix dax puds
On Mon, Aug 12, 2024 at 8:12 PM Peter Xu wrote: > Dax supports pud pages for a while, but mprotect on puds was missing since > the start. This series tries to fix that by providing pud handling in > mprotect(). The goal is to add more types of pud mappings like hugetlb or > pfnmaps. This series paves way for it by fixing known pud entries. Do people actually use hardware where they can use PUD THP mappings for DAX? I thought that was just some esoteric feature that isn't actually usable on almost any system. Was I wrong about that? I think another example that probably doesn't play entirely nice with PUD THP mappings is mremap()'s move_page_tables(). If dax_get_unmapped_area() allows creating a VMA at an unaligned start address (which I think it does?), move_page_tables() can probably end up copying from an aligned address mapped with a huge PUD entry to an unaligned address that needs to be mapped at the PTE level, and I think that will probably cause it to call into get_old_pmd() while a huge PUD entry is still present, which will probably get us a pud_bad() error or such?
Re: [PATCH] pmu_battery: Set power supply type to BATTERY
On Fri, 18 Oct 2024 07:07:30 +0100, Ed Robbins wrote: > If the power supply type is not set it defaults to "Unknown" and upower > does not recognise it. In turn battery monitor applications do not see a > battery. Setting to POWER_SUPPLY_TYPE_BATTERY fixes this. > > Applied, thanks! [1/1] pmu_battery: Set power supply type to BATTERY commit: 3287673c1d26f94845ef958090c583c46054b70d Best regards, -- Sebastian Reichel
Re: [PATCH net-next] net: use pdev instead of OF funcs
On Mon, Nov 11, 2024 at 8:21 AM Rob Herring wrote: > > On Sat, Nov 9, 2024 at 5:40 PM Rosen Penev wrote: > > > > np here is ofdev->dev.of_node. Better to use the proper functions as > > there's no use of children or anything else. > > Your commit message needs some work. > > > Signed-off-by: Rosen Penev > > --- > > drivers/net/can/grcan.c | 2 +- > > drivers/net/can/mscan/mpc5xxx_can.c | 2 +- > > drivers/net/dsa/bcm_sf2.c | 4 ++-- > > drivers/net/ethernet/allwinner/sun4i-emac.c | 2 +- > > drivers/net/ethernet/freescale/fec_mpc52xx.c | 23 ++- > > .../net/ethernet/freescale/fec_mpc52xx_phy.c | 12 ++ > > .../net/ethernet/freescale/fs_enet/mac-fcc.c | 2 +- > > .../net/ethernet/freescale/fs_enet/mac-fec.c | 2 +- > > .../net/ethernet/freescale/fs_enet/mac-scc.c | 2 +- > > .../net/ethernet/freescale/fs_enet/mii-fec.c | 12 ++ > > drivers/net/ethernet/freescale/ucc_geth.c | 12 +- > > drivers/net/ethernet/marvell/mvneta.c | 2 +- > > drivers/net/ethernet/moxa/moxart_ether.c | 4 ++-- > > .../ethernet/samsung/sxgbe/sxgbe_platform.c | 8 +++ > > drivers/net/ethernet/via/via-rhine.c | 2 +- > > drivers/net/ethernet/via/via-velocity.c | 2 +- > > drivers/net/ethernet/xilinx/ll_temac_mdio.c | 6 ++--- > > drivers/net/mdio/mdio-mux-mmioreg.c | 16 +++-- > > drivers/net/wan/fsl_ucc_hdlc.c| 10 > > 19 files changed, 66 insertions(+), 59 deletions(-) > > > > diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c > > index cdf0ec9fa7f3..0a2cc0ba219f 100644 > > --- a/drivers/net/can/grcan.c > > +++ b/drivers/net/can/grcan.c > > @@ -1673,7 +1673,7 @@ static int grcan_probe(struct platform_device *ofdev) > > goto exit_error; > > } > > > > - irq = irq_of_parse_and_map(np, GRCAN_IRQIX_IRQ); > > + irq = platform_get_irq(ofdev, GRCAN_IRQIX_IRQ); > > if (!irq) { > > dev_err(&ofdev->dev, "no irq found\n"); > > err = -ENODEV; > > diff --git a/drivers/net/can/mscan/mpc5xxx_can.c > > b/drivers/net/can/mscan/mpc5xxx_can.c > > index 0080c39ee182..252ad40bdb97 100644 > > --- a/drivers/net/can/mscan/mpc5xxx_can.c > > +++ b/drivers/net/can/mscan/mpc5xxx_can.c > > @@ -300,7 +300,7 @@ static int mpc5xxx_can_probe(struct platform_device > > *ofdev) > > if (!base) > > return dev_err_probe(&ofdev->dev, err, "couldn't > > ioremap\n"); > > > > - irq = irq_of_parse_and_map(np, 0); > > + irq = platform_get_irq(ofdev, 0); > > if (!irq) { > > dev_err(&ofdev->dev, "no irq found\n"); > > err = -ENODEV; > > diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c > > index 43bde1f583ff..9229582efd05 100644 > > --- a/drivers/net/dsa/bcm_sf2.c > > +++ b/drivers/net/dsa/bcm_sf2.c > > @@ -1443,8 +1443,8 @@ static int bcm_sf2_sw_probe(struct platform_device > > *pdev) > > of_node_put(ports); > > } > > > > - priv->irq0 = irq_of_parse_and_map(dn, 0); > > - priv->irq1 = irq_of_parse_and_map(dn, 1); > > + priv->irq0 = platform_get_irq(pdev, 0); > > + priv->irq1 = platform_get_irq(pdev, 1); > > > > base = &priv->core; > > for (i = 0; i < BCM_SF2_REGS_NUM; i++) { > > diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c > > b/drivers/net/ethernet/allwinner/sun4i-emac.c > > index 2f516b950f4e..18df8d1d93fd 100644 > > --- a/drivers/net/ethernet/allwinner/sun4i-emac.c > > +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c > > @@ -995,7 +995,7 @@ static int emac_probe(struct platform_device *pdev) > > > > /* fill in parameters for net-dev structure */ > > ndev->base_addr = (unsigned long)db->membase; > > - ndev->irq = irq_of_parse_and_map(np, 0); > > + ndev->irq = platform_get_irq(pdev, 0); > > if (ndev->irq == -ENXIO) { > > netdev_err(ndev, "No irq resource\n"); > > ret = ndev->irq; > > diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c > > b/drivers/net/ethernet/freescale/fec_mpc52xx.c > > index 2bfaf14f65c8..553d33a98c99 100644 > > --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c > > +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c > > @@ -811,7 +811,7 @@ static int mpc52xx_fec_probe(struct platform_device *op) > > int rv; > > struct net_device *ndev; > > struct mpc52xx_fec_priv *priv = NULL; > > - struct resource mem; > > + struct resource *mem; > > const u32 *prop; > > int prop_size; > > struct device_node *np = op->dev.of_node; > > @@ -828,20 +828,21 @@ static int mpc52xx_fec_probe(struct platform_device > > *op) > > priv->ndev = ndev; > > > > /* Reserve FEC control zone */ > > - rv = of_address_to_resource(np, 0, &mem); > > - if (rv) { > > + mem = pl
[bug report from fstests] WARNING: CPU: 1 PID: 0 at arch/powerpc/mm/mmu_context.c:106 switch_mm_irqs_off+0x220/0x270
Hi, Recently fstests generic/650 hit a kernel warning on ppc64le [1] with xfs (default mkfs option). My latest test on mainline linux v6.12-rc6+ with HEAD=da4373fbcf006deda90e5e6a87c499e0ff747572 . Thanks, Zorro [1] FSTYP -- xfs (debug) PLATFORM -- Linux/ppc64le rdma-cert-03-lp10 6.12.0-rc6+ #1 SMP Sat Nov 9 13:18:41 EST 2024 MKFS_OPTIONS -- -f -m crc=1,finobt=1,rmapbt=1,reflink=1,inobtcount=1,bigtime=1 /dev/sda3 MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda3 /mnt/xfstests/scratch generic/650 _check_dmesg: something found in dmesg (see /var/lib/xfstests/results//generic/650.dmesg) HINT: You _MAY_ be missing kernel fix: ecd49f7a36fb xfs: fix per-cpu CIL structure aggregation racing with dying cpus Ran: generic/650 Failures: generic/650 Failed 1 of 1 tests # cat /var/lib/xfstests/results//generic/650.dmesg [16630.359077] run fstests generic/650 at 2024-11-09 18:03:21 [16631.058519] [ cut here ] [16631.058531] WARNING: CPU: 1 PID: 0 at arch/powerpc/mm/mmu_context.c:106 switch_mm_irqs_off+0x220/0x270 [16631.058542] Modules linked in: overlay dm_zero dm_log_writes dm_thin_pool dm_persistent_data dm_bio_prison dm_snapshot dm_bufio ext4 mbcache jbd2 dm_flakey bonding tls rfkill sunrpc ibmveth pseries_rng vmx_crypto sg dm_mod fuse loop nfnetlink xfs sd_mod nvme nvme_core ibmvscsi scsi_transport_srp nvme_auth [last unloaded: scsi_debug] [16631.058617] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Kdump: loaded Tainted: G W 6.12.0-rc6+ #1 [16631.058623] Tainted: [W]=WARN [16631.058625] Hardware name: IBM,9009-22G POWER9 (architected) 0x4e0203 0xf05 of:IBM,FW950.11 (VL950_075) hv:phyp pSeries [16631.058629] NIP: c00b02c0 LR: c00b0220 CTR: c0152a20 [16631.058633] REGS: c8bd7ad0 TRAP: 0700 Tainted: GW (6.12.0-rc6+) [16631.058637] MSR: 82823033 CR: 2800440a XER: 2004 [16631.058660] CFAR: c00b0230 IRQMASK: 3 GPR00: c00b027c c8bd7d70 c2616800 c0016131a900 GPR04: 000a GPR08: 0001 GPR12: c0152a20 cffcf300 1ef31820 GPR16: GPR20: 0001 GPR24: 0001 c89acb00 c4fafcb0 GPR28: c4f24880 c0016131a900 0001 c4f25180 [16631.058740] NIP [c00b02c0] switch_mm_irqs_off+0x220/0x270 [16631.058746] LR [c00b0220] switch_mm_irqs_off+0x180/0x270 [16631.058751] Call Trace: [16631.058754] [c8bd7d70] [c00b027c] switch_mm_irqs_off+0x1dc/0x270 (unreliable) [16631.058763] [c8bd7de0] [c02572f8] idle_task_exit+0x118/0x1b0 [16631.058771] [c8bd7e40] [c0152a70] pseries_cpu_offline_self+0x50/0x150 [16631.058780] [c8bd7eb0] [c0078678] arch_cpu_idle_dead+0x68/0x7c [16631.058787] [c8bd7ee0] [c029f504] do_idle+0x1c4/0x290 [16631.058793] [c8bd7f40] [c029fa90] cpu_startup_entry+0x60/0x70 [16631.058800] [c8bd7f70] [c007825c] start_secondary+0x44c/0x480 [16631.058807] [c8bd7fe0] [c000e258] start_secondary_prolog+0x10/0x14 [16631.058815] Code: 3884 387c00f8 487f7a51 6000 813c00f8 7129000a 4182ff40 2c3d 4182ff38 7c0004ac 4bb8 4b30 <0fe0> 4b70 6000 6000 [16631.058848] irq event stamp: 15169028 [16631.058850] hardirqs last enabled at (15169027): [] tick_nohz_idle_exit+0x1c0/0x3b0 [16631.058858] hardirqs last disabled at (15169028): [] __schedule+0x5ac/0xc30 [16631.058865] softirqs last enabled at (15169016): [] handle_softirqs+0x578/0x620 [16631.058871] softirqs last disabled at (15168957): [] do_softirq_own_stack+0x6c/0x90 [16631.058878] ---[ end trace ]--- [16631.814920] NOHZ tick-stop error: local softirq work is pending, handler #40!!! [16635.633774] XFS (sda5): Unmounting Filesystem 3e7de15a-300a-41f2-8745-5be808cc3f7b [16635.752583] XFS (sda5): Mounting V5 Filesystem 3e7de15a-300a-41f2-8745-5be808cc3f7b [16635.764402] XFS (sda5): Ending clean mount [16637.842353] clockevent: decrementer mult[83126f] shift[24] cpu[6] [16640.956776] XFS (sda5): Unmounting Filesystem 3e7de15a-300a-41f2-8745-5be808cc3f7b [16641.078711] XFS (sda5): Mounting V5 Filesystem 3e7de15a-300a-41f2-8745-5be808cc3f7b [16641.090273] XFS (sda5): Ending clean mount [16646.729241] XFS (sda5): Unmounting Filesystem 3e7de15a-300a-41f2-8745-5be808cc3f7b [16646.850952] XFS (sda5): Mounting V5 Filesystem 3e7de15a-300a-41f2-8745-5be808cc3f7b [16646.863752] XFS (sda5): Ending clean mou
Re: [PATCH net-next] net: use pdev instead of OF funcs
On Sat, Nov 9, 2024 at 5:40 PM Rosen Penev wrote: > > np here is ofdev->dev.of_node. Better to use the proper functions as > there's no use of children or anything else. Your commit message needs some work. > Signed-off-by: Rosen Penev > --- > drivers/net/can/grcan.c | 2 +- > drivers/net/can/mscan/mpc5xxx_can.c | 2 +- > drivers/net/dsa/bcm_sf2.c | 4 ++-- > drivers/net/ethernet/allwinner/sun4i-emac.c | 2 +- > drivers/net/ethernet/freescale/fec_mpc52xx.c | 23 ++- > .../net/ethernet/freescale/fec_mpc52xx_phy.c | 12 ++ > .../net/ethernet/freescale/fs_enet/mac-fcc.c | 2 +- > .../net/ethernet/freescale/fs_enet/mac-fec.c | 2 +- > .../net/ethernet/freescale/fs_enet/mac-scc.c | 2 +- > .../net/ethernet/freescale/fs_enet/mii-fec.c | 12 ++ > drivers/net/ethernet/freescale/ucc_geth.c | 12 +- > drivers/net/ethernet/marvell/mvneta.c | 2 +- > drivers/net/ethernet/moxa/moxart_ether.c | 4 ++-- > .../ethernet/samsung/sxgbe/sxgbe_platform.c | 8 +++ > drivers/net/ethernet/via/via-rhine.c | 2 +- > drivers/net/ethernet/via/via-velocity.c | 2 +- > drivers/net/ethernet/xilinx/ll_temac_mdio.c | 6 ++--- > drivers/net/mdio/mdio-mux-mmioreg.c | 16 +++-- > drivers/net/wan/fsl_ucc_hdlc.c| 10 > 19 files changed, 66 insertions(+), 59 deletions(-) > > diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c > index cdf0ec9fa7f3..0a2cc0ba219f 100644 > --- a/drivers/net/can/grcan.c > +++ b/drivers/net/can/grcan.c > @@ -1673,7 +1673,7 @@ static int grcan_probe(struct platform_device *ofdev) > goto exit_error; > } > > - irq = irq_of_parse_and_map(np, GRCAN_IRQIX_IRQ); > + irq = platform_get_irq(ofdev, GRCAN_IRQIX_IRQ); > if (!irq) { > dev_err(&ofdev->dev, "no irq found\n"); > err = -ENODEV; > diff --git a/drivers/net/can/mscan/mpc5xxx_can.c > b/drivers/net/can/mscan/mpc5xxx_can.c > index 0080c39ee182..252ad40bdb97 100644 > --- a/drivers/net/can/mscan/mpc5xxx_can.c > +++ b/drivers/net/can/mscan/mpc5xxx_can.c > @@ -300,7 +300,7 @@ static int mpc5xxx_can_probe(struct platform_device > *ofdev) > if (!base) > return dev_err_probe(&ofdev->dev, err, "couldn't ioremap\n"); > > - irq = irq_of_parse_and_map(np, 0); > + irq = platform_get_irq(ofdev, 0); > if (!irq) { > dev_err(&ofdev->dev, "no irq found\n"); > err = -ENODEV; > diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c > index 43bde1f583ff..9229582efd05 100644 > --- a/drivers/net/dsa/bcm_sf2.c > +++ b/drivers/net/dsa/bcm_sf2.c > @@ -1443,8 +1443,8 @@ static int bcm_sf2_sw_probe(struct platform_device > *pdev) > of_node_put(ports); > } > > - priv->irq0 = irq_of_parse_and_map(dn, 0); > - priv->irq1 = irq_of_parse_and_map(dn, 1); > + priv->irq0 = platform_get_irq(pdev, 0); > + priv->irq1 = platform_get_irq(pdev, 1); > > base = &priv->core; > for (i = 0; i < BCM_SF2_REGS_NUM; i++) { > diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c > b/drivers/net/ethernet/allwinner/sun4i-emac.c > index 2f516b950f4e..18df8d1d93fd 100644 > --- a/drivers/net/ethernet/allwinner/sun4i-emac.c > +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c > @@ -995,7 +995,7 @@ static int emac_probe(struct platform_device *pdev) > > /* fill in parameters for net-dev structure */ > ndev->base_addr = (unsigned long)db->membase; > - ndev->irq = irq_of_parse_and_map(np, 0); > + ndev->irq = platform_get_irq(pdev, 0); > if (ndev->irq == -ENXIO) { > netdev_err(ndev, "No irq resource\n"); > ret = ndev->irq; > diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c > b/drivers/net/ethernet/freescale/fec_mpc52xx.c > index 2bfaf14f65c8..553d33a98c99 100644 > --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c > +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c > @@ -811,7 +811,7 @@ static int mpc52xx_fec_probe(struct platform_device *op) > int rv; > struct net_device *ndev; > struct mpc52xx_fec_priv *priv = NULL; > - struct resource mem; > + struct resource *mem; > const u32 *prop; > int prop_size; > struct device_node *np = op->dev.of_node; > @@ -828,20 +828,21 @@ static int mpc52xx_fec_probe(struct platform_device *op) > priv->ndev = ndev; > > /* Reserve FEC control zone */ > - rv = of_address_to_resource(np, 0, &mem); > - if (rv) { > + mem = platform_get_resource(op, 0, IORESOURCE_MEM); > + if (!mem) { > pr_err("Error while parsing device node resource\n"); > + rv = -ENODEV; > goto err_netdev; > } > - if (resource_size(&mem) < sizeof(struct mpc52xx_fec))
Re: [PATCH v2 1/2] powerpc/fadump: allocate memory for additional parameters early
Sourabh Jain writes: > From: Hari Bathini > > Memory for passing additional parameters to fadump capture kernel > is allocated during subsys_initcall level, using memblock. But > as slab is already available by this time, allocation happens via > the buddy allocator. This may work for radix MMU but is likely to > fail in most cases for hash MMU as hash MMU needs this memory in > the first memory block for it to be accessible in real mode in the > capture kernel (second boot). So, allocate memory for additional > parameters area as soon as MMU mode is obvious. But looks like this was only caught due to the WARN_ON_ONCE emitted from mm/memblock.c which detected accidental use of memblock APIs when slab is available. That begs a question on why didn't we see the issue on Hash? Are we not using the "param_area_supported" feature that often is it? > > Fixes: 683eab94da75 ("powerpc/fadump: setup additional parameters for dump > capture kernel") > Reported-by: Venkat Rao Bagalkote > Closes: > https://lore.kernel.org/lkml/a70e4064-a040-447b-8556-1fd02f193...@linux.vnet.ibm.com/T/#u > Cc: Mahesh Salgaonkar > Cc: Michael Ellerman > Signed-off-by: Hari Bathini > Signed-off-by: Sourabh Jain > --- > > Changelog: > > Since v1: > https://lore.kernel.org/all/20241104083528.99520-1-sourabhj...@linux.ibm.com/ > - Drop extern keyword from fadump_setup_param_area function declaration > - Don't use __va() while resetting param memory area > > --- > arch/powerpc/include/asm/fadump.h | 2 ++ > arch/powerpc/kernel/fadump.c | 15 ++- > arch/powerpc/kernel/prom.c| 3 +++ > 3 files changed, 15 insertions(+), 5 deletions(-) > > diff --git a/arch/powerpc/include/asm/fadump.h > b/arch/powerpc/include/asm/fadump.h > index ef40c9b6972a..7b3473e05273 100644 > --- a/arch/powerpc/include/asm/fadump.h > +++ b/arch/powerpc/include/asm/fadump.h > @@ -19,6 +19,7 @@ extern int is_fadump_active(void); > extern int should_fadump_crash(void); > extern void crash_fadump(struct pt_regs *, const char *); > extern void fadump_cleanup(void); > +void fadump_setup_param_area(void); > extern void fadump_append_bootargs(void); > > #else/* CONFIG_FA_DUMP */ > @@ -26,6 +27,7 @@ static inline int is_fadump_active(void) { return 0; } > static inline int should_fadump_crash(void) { return 0; } > static inline void crash_fadump(struct pt_regs *regs, const char *str) { } > static inline void fadump_cleanup(void) { } > +static inline void fadump_setup_param_area(void) { } > static inline void fadump_append_bootargs(void) { } > #endif /* !CONFIG_FA_DUMP */ > > diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c > index a612e7513a4f..3a2863307863 100644 > --- a/arch/powerpc/kernel/fadump.c > +++ b/arch/powerpc/kernel/fadump.c > @@ -1586,6 +1586,12 @@ static void __init fadump_init_files(void) > return; > } > > + if (fw_dump.param_area) { > + rc = sysfs_create_file(fadump_kobj, &bootargs_append_attr.attr); > + if (rc) > + pr_err("unable to create bootargs_append sysfs file > (%d)\n", rc); > + } > + > debugfs_create_file("fadump_region", 0444, arch_debugfs_dir, NULL, > &fadump_region_fops); > > @@ -1740,7 +1746,7 @@ static void __init fadump_process(void) > * Reserve memory to store additional parameters to be passed > * for fadump/capture kernel. > */ > -static void __init fadump_setup_param_area(void) > +void __init fadump_setup_param_area(void) > { > phys_addr_t range_start, range_end; > > @@ -1748,7 +1754,7 @@ static void __init fadump_setup_param_area(void) > return; > > /* This memory can't be used by PFW or bootloader as it is shared > across kernels */ > - if (radix_enabled()) { > + if (early_radix_enabled()) { > /* >* Anywhere in the upper half should be good enough as all > memory >* is accessible in real mode. > @@ -1776,12 +1782,12 @@ static void __init fadump_setup_param_area(void) > COMMAND_LINE_SIZE, > range_start, > range_end); > - if (!fw_dump.param_area || sysfs_create_file(fadump_kobj, > &bootargs_append_attr.attr)) { > + if (!fw_dump.param_area) { > pr_warn("WARNING: Could not setup area to pass additional > parameters!\n"); > return; > } > > - memset(phys_to_virt(fw_dump.param_area), 0, COMMAND_LINE_SIZE); > + memset((void *)fw_dump.param_area, 0, COMMAND_LINE_SIZE); > } > > /* > @@ -1807,7 +1813,6 @@ int __init setup_fadump(void) > } > /* Initialize the kernel dump memory structure and register with f/w */ > else if (fw_dump.reserve_dump_area_size) { > - fadump_setup_param_area(); > fw_dump.ops->fadump_in
Re: [PATCH v2 2/2] fadump: reserve param area if below boot_mem_top
Sourabh Jain writes: > The param area is a memory region where the kernel places additional > command-line arguments for fadump kernel. Currently, the param memory > area is reserved in fadump kernel if it is above boot_mem_top. However, > it should be reserved if it is below boot_mem_top because the fadump > kernel already reserves memory from boot_mem_top to the end of DRAM. did you mean s/reserves/preserves ? > > Currently, there is no impact from not reserving param memory if it is > below boot_mem_top, as it is not used after the early boot phase of the > fadump kernel. However, if this changes in the future, it could lead to > issues in the fadump kernel. This will only affect Hash and not radix correct? Because for radix your param_area is somewhere within [memblock_end_of_DRAM() / 2, memblock_end_of_DRAM()] which is anyway above boot_mem_top so it is anyway preserved as is... ... On second thoughts since param_area during normal kernel boot anyway comes from memblock now. And irrespective of where it falls (above or below boot_mem_top), we anyway append the bootargs to that. So we don't really preserve the original contents :) right? So why not just always call for memblock_reserve() on param_area during capture kernel run? Thoughts? > > Fixes: 3416c9daa6b1 ("powerpc/fadump: pass additional parameters when fadump > is active") > Cc: Mahesh Salgaonkar > Cc: Michael Ellerman > Acked-by: Hari Bathini > Signed-off-by: Sourabh Jain > --- > > Changelog: > > Since v1: > https://lore.kernel.org/all/20241104083528.99520-1-sourabhj...@linux.ibm.com/ > - Include Fixes and Acked-by tag in the commit message > - No functional changes > > --- > arch/powerpc/kernel/fadump.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c > index 3a2863307863..3f3674060164 100644 > --- a/arch/powerpc/kernel/fadump.c > +++ b/arch/powerpc/kernel/fadump.c > @@ -143,7 +143,7 @@ void __init fadump_append_bootargs(void) > if (!fw_dump.dump_active || !fw_dump.param_area_supported || > !fw_dump.param_area) > return; > > - if (fw_dump.param_area >= fw_dump.boot_mem_top) { > + if (fw_dump.param_area < fw_dump.boot_mem_top) { > if (memblock_reserve(fw_dump.param_area, COMMAND_LINE_SIZE)) { > pr_warn("WARNING: Can't use additional parameters > area!\n"); > fw_dump.param_area = 0; > -- > 2.46.2
Re: [PATCHv2 net-next] net: use pdev instead of OF funcs
On Mon, 11 Nov 2024 13:03:16 -0800 Rosen Penev wrote: > --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c > +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c > @@ -111,7 +111,7 @@ static int sxgbe_platform_probe(struct platform_device > *pdev) > } > > /* Get the SXGBE common INT information */ > - priv->irq = irq_of_parse_and_map(node, 0); > + priv->irq = platform_get_irq(pdev, 0); > if (priv->irq <= 0) { > dev_err(dev, "sxgbe common irq parsing failed\n"); > goto err_drv_remove; > @@ -122,7 +122,7 @@ static int sxgbe_platform_probe(struct platform_device > *pdev) > > /* Get the TX/RX IRQ numbers */ > for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) { > - priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++); > + priv->txq[i]->irq_no = platform_get_irq(pdev, chan++); > if (priv->txq[i]->irq_no <= 0) { > dev_err(dev, "sxgbe tx irq parsing failed\n"); > goto err_tx_irq_unmap; > @@ -130,14 +130,14 @@ static int sxgbe_platform_probe(struct platform_device > *pdev) > } > > for (i = 0; i < SXGBE_RX_QUEUES; i++) { > - priv->rxq[i]->irq_no = irq_of_parse_and_map(node, chan++); > + priv->rxq[i]->irq_no = platform_get_irq(pdev, chan++); > if (priv->rxq[i]->irq_no <= 0) { > dev_err(dev, "sxgbe rx irq parsing failed\n"); > goto err_rx_irq_unmap; > } > } > > - priv->lpi_irq = irq_of_parse_and_map(node, chan); > + priv->lpi_irq = platform_get_irq(pdev, chan); > if (priv->lpi_irq <= 0) { > dev_err(dev, "sxgbe lpi irq parsing failed\n"); > goto err_rx_irq_unmap; Coccicheck wants you to drop the errors: drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:116:2-9: line 116 is redundant because platform_get_irq() already prints an error drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:127:3-10: line 127 is redundant because platform_get_irq() already prints an error drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:135:3-10: line 135 is redundant because platform_get_irq() already prints an error drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:142:2-9: line 142 is redundant because platform_get_irq() already prints an error You can make it a separate patch in a series, for clarity. -- pw-bot: cr
Re: [PATCHv2 net-next] net: use pdev instead of OF funcs
On Mon, Nov 11, 2024 at 7:32 PM Jakub Kicinski wrote: > > On Mon, 11 Nov 2024 13:03:16 -0800 Rosen Penev wrote: > > --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c > > +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c > > @@ -111,7 +111,7 @@ static int sxgbe_platform_probe(struct platform_device > > *pdev) > > } > > > > /* Get the SXGBE common INT information */ > > - priv->irq = irq_of_parse_and_map(node, 0); > > + priv->irq = platform_get_irq(pdev, 0); > > if (priv->irq <= 0) { > > dev_err(dev, "sxgbe common irq parsing failed\n"); > > goto err_drv_remove; > > @@ -122,7 +122,7 @@ static int sxgbe_platform_probe(struct platform_device > > *pdev) > > > > /* Get the TX/RX IRQ numbers */ > > for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) { > > - priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++); > > + priv->txq[i]->irq_no = platform_get_irq(pdev, chan++); > > if (priv->txq[i]->irq_no <= 0) { > > dev_err(dev, "sxgbe tx irq parsing failed\n"); > > goto err_tx_irq_unmap; > > @@ -130,14 +130,14 @@ static int sxgbe_platform_probe(struct > > platform_device *pdev) > > } > > > > for (i = 0; i < SXGBE_RX_QUEUES; i++) { > > - priv->rxq[i]->irq_no = irq_of_parse_and_map(node, chan++); > > + priv->rxq[i]->irq_no = platform_get_irq(pdev, chan++); > > if (priv->rxq[i]->irq_no <= 0) { > > dev_err(dev, "sxgbe rx irq parsing failed\n"); > > goto err_rx_irq_unmap; > > } > > } > > > > - priv->lpi_irq = irq_of_parse_and_map(node, chan); > > + priv->lpi_irq = platform_get_irq(pdev, chan); > > if (priv->lpi_irq <= 0) { > > dev_err(dev, "sxgbe lpi irq parsing failed\n"); > > goto err_rx_irq_unmap; > > Coccicheck wants you to drop the errors: > > drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:116:2-9: line 116 is > redundant because platform_get_irq() already prints an error > drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:127:3-10: line 127 is > redundant because platform_get_irq() already prints an error > drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:135:3-10: line 135 is > redundant because platform_get_irq() already prints an error > drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c:142:2-9: line 142 is > redundant because platform_get_irq() already prints an error I looked at the output. The error checks need changing too. > > You can make it a separate patch in a series, for clarity. I don't think it's enough to warrant its own commit. > -- > pw-bot: cr