diff mbox series

[BUG/PATCH,v3] net: mvpp2: always set port pcs ops

Message ID 20220214231852.3331430-1-jeremy.linton@arm.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [BUG/PATCH,v3] net: mvpp2: always set port pcs ops | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Jeremy Linton Feb. 14, 2022, 11:18 p.m. UTC
Booting a MACCHIATObin with 5.17, the system OOPs with
a null pointer deref when the network is started. This
is caused by the pcs->ops structure being null in
mcpp2_acpi_start() when it tries to call pcs_config().

Hoisting the code which sets pcs_gmac.ops and pcs_xlg.ops,
assuring they are always set, fixes the problem.

The OOPs looks like:
[   18.687760] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000010
[   18.698561] Mem abort info:
[   18.698564]   ESR = 0x96000004
[   18.698567]   EC = 0x25: DABT (current EL), IL = 32 bits
[   18.709821]   SET = 0, FnV = 0
[   18.714292]   EA = 0, S1PTW = 0
[   18.718833]   FSC = 0x04: level 0 translation fault
[   18.725126] Data abort info:
[   18.729408]   ISV = 0, ISS = 0x00000004
[   18.734655]   CM = 0, WnR = 0
[   18.738933] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000111bbf000
[   18.745409] [0000000000000010] pgd=0000000000000000, p4d=0000000000000000
[   18.752235] Internal error: Oops: 96000004 [#1] SMP
[   18.757134] Modules linked in: rfkill ip_set nf_tables nfnetlink qrtr sunrpc vfat fat omap_rng fuse zram xfs crct10dif_ce mvpp2 ghash_ce sbsa_gwdt phylink xhci_plat_hcd ahci_plam
[   18.773481] CPU: 0 PID: 681 Comm: NetworkManager Not tainted 5.17.0-0.rc3.89.fc36.aarch64 #1
[   18.781954] Hardware name: Marvell                         Armada 7k/8k Family Board      /Armada 7k/8k Family Board      , BIOS EDK II Jun  4 2019
[   18.795222] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   18.802213] pc : mvpp2_start_dev+0x2b0/0x300 [mvpp2]
[   18.807208] lr : mvpp2_start_dev+0x298/0x300 [mvpp2]
[   18.812197] sp : ffff80000b4732c0
[   18.815522] x29: ffff80000b4732c0 x28: 0000000000000000 x27: ffffccab38ae57f8
[   18.822689] x26: ffff6eeb03065a10 x25: ffff80000b473a30 x24: ffff80000b4735b8
[   18.829855] x23: 0000000000000000 x22: 00000000000001e0 x21: ffff6eeb07b6ab68
[   18.837021] x20: ffff6eeb07b6ab30 x19: ffff6eeb07b6a9c0 x18: 0000000000000014
[   18.844187] x17: 00000000f6232bfe x16: ffffccab899b1dc0 x15: 000000006a30f9fa
[   18.851353] x14: 000000003b77bd50 x13: 000006dc896f0e8e x12: 001bbbfccfd0d3a2
[   18.858519] x11: 0000000000001528 x10: 0000000000001548 x9 : ffffccab38ad0fb0
[   18.865685] x8 : ffff80000b473330 x7 : 0000000000000000 x6 : 0000000000000000
[   18.872851] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000b4732f8
[   18.880017] x2 : 000000000000001a x1 : 0000000000000002 x0 : ffff6eeb07b6ab68
[   18.887183] Call trace:
[   18.889637]  mvpp2_start_dev+0x2b0/0x300 [mvpp2]
[   18.894279]  mvpp2_open+0x134/0x2b4 [mvpp2]
[   18.898483]  __dev_open+0x128/0x1e4
[   18.901988]  __dev_change_flags+0x17c/0x1d0
[   18.906187]  dev_change_flags+0x30/0x70
[   18.910038]  do_setlink+0x278/0xa7c
[   18.913540]  __rtnl_newlink+0x44c/0x7d0
[   18.917391]  rtnl_newlink+0x5c/0x8c
[   18.920892]  rtnetlink_rcv_msg+0x254/0x314
[   18.925006]  netlink_rcv_skb+0x48/0x10c
[   18.928858]  rtnetlink_rcv+0x24/0x30
[   18.932449]  netlink_unicast+0x290/0x2f4
[   18.936386]  netlink_sendmsg+0x1d0/0x41c
[   18.940323]  sock_sendmsg+0x60/0x70
[   18.943825]  ____sys_sendmsg+0x248/0x260
[   18.947762]  ___sys_sendmsg+0x74/0xa0
[   18.951438]  __sys_sendmsg+0x64/0xcc
[   18.955027]  __arm64_sys_sendmsg+0x30/0x40
[   18.959140]  invoke_syscall+0x50/0x120
[   18.962906]  el0_svc_common.constprop.0+0x4c/0xf4
[   18.967629]  do_el0_svc+0x30/0x9c
[   18.970958]  el0_svc+0x28/0xb0
[   18.974025]  el0t_64_sync_handler+0x10c/0x140
[   18.978400]  el0t_64_sync+0x1a4/0x1a8
[   18.982078] Code: 52800004 b9416262 aa1503e0 52800041 (f94008a5)
[   18.988196] ---[ end trace 0000000000000000 ]---

Fixes: cff056322372 ("net: mvpp2: use .mac_select_pcs() interface")
Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
v1->v2: Apply Russell's fix
v2->v3: Fix Russell's name

 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Marcin Wojtas Feb. 15, 2022, 8:38 a.m. UTC | #1
Hi Jeremy,


wt., 15 lut 2022 o 00:18 Jeremy Linton <jeremy.linton@arm.com> napisał(a):
>
> Booting a MACCHIATObin with 5.17, the system OOPs with
> a null pointer deref when the network is started. This
> is caused by the pcs->ops structure being null in
> mcpp2_acpi_start() when it tries to call pcs_config().
>
> Hoisting the code which sets pcs_gmac.ops and pcs_xlg.ops,
> assuring they are always set, fixes the problem.
>
> The OOPs looks like:
> [   18.687760] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000010
> [   18.698561] Mem abort info:
> [   18.698564]   ESR = 0x96000004
> [   18.698567]   EC = 0x25: DABT (current EL), IL = 32 bits
> [   18.709821]   SET = 0, FnV = 0
> [   18.714292]   EA = 0, S1PTW = 0
> [   18.718833]   FSC = 0x04: level 0 translation fault
> [   18.725126] Data abort info:
> [   18.729408]   ISV = 0, ISS = 0x00000004
> [   18.734655]   CM = 0, WnR = 0
> [   18.738933] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000111bbf000
> [   18.745409] [0000000000000010] pgd=0000000000000000, p4d=0000000000000000
> [   18.752235] Internal error: Oops: 96000004 [#1] SMP
> [   18.757134] Modules linked in: rfkill ip_set nf_tables nfnetlink qrtr sunrpc vfat fat omap_rng fuse zram xfs crct10dif_ce mvpp2 ghash_ce sbsa_gwdt phylink xhci_plat_hcd ahci_plam
> [   18.773481] CPU: 0 PID: 681 Comm: NetworkManager Not tainted 5.17.0-0.rc3.89.fc36.aarch64 #1
> [   18.781954] Hardware name: Marvell                         Armada 7k/8k Family Board      /Armada 7k/8k Family Board      , BIOS EDK II Jun  4 2019
> [   18.795222] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [   18.802213] pc : mvpp2_start_dev+0x2b0/0x300 [mvpp2]
> [   18.807208] lr : mvpp2_start_dev+0x298/0x300 [mvpp2]
> [   18.812197] sp : ffff80000b4732c0
> [   18.815522] x29: ffff80000b4732c0 x28: 0000000000000000 x27: ffffccab38ae57f8
> [   18.822689] x26: ffff6eeb03065a10 x25: ffff80000b473a30 x24: ffff80000b4735b8
> [   18.829855] x23: 0000000000000000 x22: 00000000000001e0 x21: ffff6eeb07b6ab68
> [   18.837021] x20: ffff6eeb07b6ab30 x19: ffff6eeb07b6a9c0 x18: 0000000000000014
> [   18.844187] x17: 00000000f6232bfe x16: ffffccab899b1dc0 x15: 000000006a30f9fa
> [   18.851353] x14: 000000003b77bd50 x13: 000006dc896f0e8e x12: 001bbbfccfd0d3a2
> [   18.858519] x11: 0000000000001528 x10: 0000000000001548 x9 : ffffccab38ad0fb0
> [   18.865685] x8 : ffff80000b473330 x7 : 0000000000000000 x6 : 0000000000000000
> [   18.872851] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000b4732f8
> [   18.880017] x2 : 000000000000001a x1 : 0000000000000002 x0 : ffff6eeb07b6ab68
> [   18.887183] Call trace:
> [   18.889637]  mvpp2_start_dev+0x2b0/0x300 [mvpp2]
> [   18.894279]  mvpp2_open+0x134/0x2b4 [mvpp2]
> [   18.898483]  __dev_open+0x128/0x1e4
> [   18.901988]  __dev_change_flags+0x17c/0x1d0
> [   18.906187]  dev_change_flags+0x30/0x70
> [   18.910038]  do_setlink+0x278/0xa7c
> [   18.913540]  __rtnl_newlink+0x44c/0x7d0
> [   18.917391]  rtnl_newlink+0x5c/0x8c
> [   18.920892]  rtnetlink_rcv_msg+0x254/0x314
> [   18.925006]  netlink_rcv_skb+0x48/0x10c
> [   18.928858]  rtnetlink_rcv+0x24/0x30
> [   18.932449]  netlink_unicast+0x290/0x2f4
> [   18.936386]  netlink_sendmsg+0x1d0/0x41c
> [   18.940323]  sock_sendmsg+0x60/0x70
> [   18.943825]  ____sys_sendmsg+0x248/0x260
> [   18.947762]  ___sys_sendmsg+0x74/0xa0
> [   18.951438]  __sys_sendmsg+0x64/0xcc
> [   18.955027]  __arm64_sys_sendmsg+0x30/0x40
> [   18.959140]  invoke_syscall+0x50/0x120
> [   18.962906]  el0_svc_common.constprop.0+0x4c/0xf4
> [   18.967629]  do_el0_svc+0x30/0x9c
> [   18.970958]  el0_svc+0x28/0xb0
> [   18.974025]  el0t_64_sync_handler+0x10c/0x140
> [   18.978400]  el0t_64_sync+0x1a4/0x1a8
> [   18.982078] Code: 52800004 b9416262 aa1503e0 52800041 (f94008a5)
> [   18.988196] ---[ end trace 0000000000000000 ]---
>
> Fixes: cff056322372 ("net: mvpp2: use .mac_select_pcs() interface")
> Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
> v1->v2: Apply Russell's fix
> v2->v3: Fix Russell's name
>
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 7cdbf8b8bbf6..1a835b48791b 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -6870,6 +6870,9 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>         dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
>         dev->dev.of_node = port_node;
>
> +       port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
> +       port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
> +
>         if (!mvpp2_use_acpi_compat_mode(port_fwnode)) {
>                 port->phylink_config.dev = &dev->dev;
>                 port->phylink_config.type = PHYLINK_NETDEV;
> @@ -6940,9 +6943,6 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>                                   port->phylink_config.supported_interfaces);
>                 }
>
> -               port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
> -               port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
> -
>                 phylink = phylink_create(&port->phylink_config, port_fwnode,
>                                          phy_mode, &mvpp2_phylink_ops);
>                 if (IS_ERR(phylink)) {
> --
> 2.34.1
>

I'd like to test the patch - what EDK2 version are you using?

Best regards,
Marcin
Jeremy Linton Feb. 15, 2022, 2:36 p.m. UTC | #2
Hi,

On 2/15/22 02:38, Marcin Wojtas wrote:
> Hi Jeremy,
> 
> 
> wt., 15 lut 2022 o 00:18 Jeremy Linton <jeremy.linton@arm.com> napisał(a):
>>
>> Booting a MACCHIATObin with 5.17, the system OOPs with
>> a null pointer deref when the network is started. This
>> is caused by the pcs->ops structure being null in
>> mcpp2_acpi_start() when it tries to call pcs_config().
>>
>> Hoisting the code which sets pcs_gmac.ops and pcs_xlg.ops,
>> assuring they are always set, fixes the problem.
>>
>> The OOPs looks like:
>> [   18.687760] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000010
>> [   18.698561] Mem abort info:
>> [   18.698564]   ESR = 0x96000004
>> [   18.698567]   EC = 0x25: DABT (current EL), IL = 32 bits
>> [   18.709821]   SET = 0, FnV = 0
>> [   18.714292]   EA = 0, S1PTW = 0
>> [   18.718833]   FSC = 0x04: level 0 translation fault
>> [   18.725126] Data abort info:
>> [   18.729408]   ISV = 0, ISS = 0x00000004
>> [   18.734655]   CM = 0, WnR = 0
>> [   18.738933] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000111bbf000
>> [   18.745409] [0000000000000010] pgd=0000000000000000, p4d=0000000000000000
>> [   18.752235] Internal error: Oops: 96000004 [#1] SMP
>> [   18.757134] Modules linked in: rfkill ip_set nf_tables nfnetlink qrtr sunrpc vfat fat omap_rng fuse zram xfs crct10dif_ce mvpp2 ghash_ce sbsa_gwdt phylink xhci_plat_hcd ahci_plam
>> [   18.773481] CPU: 0 PID: 681 Comm: NetworkManager Not tainted 5.17.0-0.rc3.89.fc36.aarch64 #1
>> [   18.781954] Hardware name: Marvell                         Armada 7k/8k Family Board      /Armada 7k/8k Family Board      , BIOS EDK II Jun  4 2019
>> [   18.795222] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>> [   18.802213] pc : mvpp2_start_dev+0x2b0/0x300 [mvpp2]
>> [   18.807208] lr : mvpp2_start_dev+0x298/0x300 [mvpp2]
>> [   18.812197] sp : ffff80000b4732c0
>> [   18.815522] x29: ffff80000b4732c0 x28: 0000000000000000 x27: ffffccab38ae57f8
>> [   18.822689] x26: ffff6eeb03065a10 x25: ffff80000b473a30 x24: ffff80000b4735b8
>> [   18.829855] x23: 0000000000000000 x22: 00000000000001e0 x21: ffff6eeb07b6ab68
>> [   18.837021] x20: ffff6eeb07b6ab30 x19: ffff6eeb07b6a9c0 x18: 0000000000000014
>> [   18.844187] x17: 00000000f6232bfe x16: ffffccab899b1dc0 x15: 000000006a30f9fa
>> [   18.851353] x14: 000000003b77bd50 x13: 000006dc896f0e8e x12: 001bbbfccfd0d3a2
>> [   18.858519] x11: 0000000000001528 x10: 0000000000001548 x9 : ffffccab38ad0fb0
>> [   18.865685] x8 : ffff80000b473330 x7 : 0000000000000000 x6 : 0000000000000000
>> [   18.872851] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000b4732f8
>> [   18.880017] x2 : 000000000000001a x1 : 0000000000000002 x0 : ffff6eeb07b6ab68
>> [   18.887183] Call trace:
>> [   18.889637]  mvpp2_start_dev+0x2b0/0x300 [mvpp2]
>> [   18.894279]  mvpp2_open+0x134/0x2b4 [mvpp2]
>> [   18.898483]  __dev_open+0x128/0x1e4
>> [   18.901988]  __dev_change_flags+0x17c/0x1d0
>> [   18.906187]  dev_change_flags+0x30/0x70
>> [   18.910038]  do_setlink+0x278/0xa7c
>> [   18.913540]  __rtnl_newlink+0x44c/0x7d0
>> [   18.917391]  rtnl_newlink+0x5c/0x8c
>> [   18.920892]  rtnetlink_rcv_msg+0x254/0x314
>> [   18.925006]  netlink_rcv_skb+0x48/0x10c
>> [   18.928858]  rtnetlink_rcv+0x24/0x30
>> [   18.932449]  netlink_unicast+0x290/0x2f4
>> [   18.936386]  netlink_sendmsg+0x1d0/0x41c
>> [   18.940323]  sock_sendmsg+0x60/0x70
>> [   18.943825]  ____sys_sendmsg+0x248/0x260
>> [   18.947762]  ___sys_sendmsg+0x74/0xa0
>> [   18.951438]  __sys_sendmsg+0x64/0xcc
>> [   18.955027]  __arm64_sys_sendmsg+0x30/0x40
>> [   18.959140]  invoke_syscall+0x50/0x120
>> [   18.962906]  el0_svc_common.constprop.0+0x4c/0xf4
>> [   18.967629]  do_el0_svc+0x30/0x9c
>> [   18.970958]  el0_svc+0x28/0xb0
>> [   18.974025]  el0t_64_sync_handler+0x10c/0x140
>> [   18.978400]  el0t_64_sync+0x1a4/0x1a8
>> [   18.982078] Code: 52800004 b9416262 aa1503e0 52800041 (f94008a5)
>> [   18.988196] ---[ end trace 0000000000000000 ]---
>>
>> Fixes: cff056322372 ("net: mvpp2: use .mac_select_pcs() interface")
>> Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>> ---
>> v1->v2: Apply Russell's fix
>> v2->v3: Fix Russell's name
>>
>>   drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
>> index 7cdbf8b8bbf6..1a835b48791b 100644
>> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
>> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
>> @@ -6870,6 +6870,9 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>>          dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
>>          dev->dev.of_node = port_node;
>>
>> +       port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
>> +       port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
>> +
>>          if (!mvpp2_use_acpi_compat_mode(port_fwnode)) {
>>                  port->phylink_config.dev = &dev->dev;
>>                  port->phylink_config.type = PHYLINK_NETDEV;
>> @@ -6940,9 +6943,6 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>>                                    port->phylink_config.supported_interfaces);
>>                  }
>>
>> -               port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
>> -               port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
>> -
>>                  phylink = phylink_create(&port->phylink_config, port_fwnode,
>>                                           phy_mode, &mvpp2_phylink_ops);
>>                  if (IS_ERR(phylink)) {
>> --
>> 2.34.1
>>
> 
> I'd like to test the patch - what EDK2 version are you using?

I don't have access to the machine at the moment (maybe in a couple days 
again) but it was running a build from late 2019 IIRC. So, definitely 
not a bleeding edge version for sure.
Marcin Wojtas Feb. 15, 2022, 4:44 p.m. UTC | #3
Hi,

wt., 15 lut 2022 o 15:37 Jeremy Linton <jeremy.linton@arm.com> napisał(a):
>
> Hi,
>
> On 2/15/22 02:38, Marcin Wojtas wrote:
> > Hi Jeremy,
> >
> >
> > wt., 15 lut 2022 o 00:18 Jeremy Linton <jeremy.linton@arm.com> napisał(a):
> >>
> >> Booting a MACCHIATObin with 5.17, the system OOPs with
> >> a null pointer deref when the network is started. This
> >> is caused by the pcs->ops structure being null in
> >> mcpp2_acpi_start() when it tries to call pcs_config().
> >>
> >> Hoisting the code which sets pcs_gmac.ops and pcs_xlg.ops,
> >> assuring they are always set, fixes the problem.
> >>
> >> The OOPs looks like:
> >> [   18.687760] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000010
> >> [   18.698561] Mem abort info:
> >> [   18.698564]   ESR = 0x96000004
> >> [   18.698567]   EC = 0x25: DABT (current EL), IL = 32 bits
> >> [   18.709821]   SET = 0, FnV = 0
> >> [   18.714292]   EA = 0, S1PTW = 0
> >> [   18.718833]   FSC = 0x04: level 0 translation fault
> >> [   18.725126] Data abort info:
> >> [   18.729408]   ISV = 0, ISS = 0x00000004
> >> [   18.734655]   CM = 0, WnR = 0
> >> [   18.738933] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000111bbf000
> >> [   18.745409] [0000000000000010] pgd=0000000000000000, p4d=0000000000000000
> >> [   18.752235] Internal error: Oops: 96000004 [#1] SMP
> >> [   18.757134] Modules linked in: rfkill ip_set nf_tables nfnetlink qrtr sunrpc vfat fat omap_rng fuse zram xfs crct10dif_ce mvpp2 ghash_ce sbsa_gwdt phylink xhci_plat_hcd ahci_plam
> >> [   18.773481] CPU: 0 PID: 681 Comm: NetworkManager Not tainted 5.17.0-0.rc3.89.fc36.aarch64 #1
> >> [   18.781954] Hardware name: Marvell                         Armada 7k/8k Family Board      /Armada 7k/8k Family Board      , BIOS EDK II Jun  4 2019
> >> [   18.795222] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> >> [   18.802213] pc : mvpp2_start_dev+0x2b0/0x300 [mvpp2]
> >> [   18.807208] lr : mvpp2_start_dev+0x298/0x300 [mvpp2]
> >> [   18.812197] sp : ffff80000b4732c0
> >> [   18.815522] x29: ffff80000b4732c0 x28: 0000000000000000 x27: ffffccab38ae57f8
> >> [   18.822689] x26: ffff6eeb03065a10 x25: ffff80000b473a30 x24: ffff80000b4735b8
> >> [   18.829855] x23: 0000000000000000 x22: 00000000000001e0 x21: ffff6eeb07b6ab68
> >> [   18.837021] x20: ffff6eeb07b6ab30 x19: ffff6eeb07b6a9c0 x18: 0000000000000014
> >> [   18.844187] x17: 00000000f6232bfe x16: ffffccab899b1dc0 x15: 000000006a30f9fa
> >> [   18.851353] x14: 000000003b77bd50 x13: 000006dc896f0e8e x12: 001bbbfccfd0d3a2
> >> [   18.858519] x11: 0000000000001528 x10: 0000000000001548 x9 : ffffccab38ad0fb0
> >> [   18.865685] x8 : ffff80000b473330 x7 : 0000000000000000 x6 : 0000000000000000
> >> [   18.872851] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000b4732f8
> >> [   18.880017] x2 : 000000000000001a x1 : 0000000000000002 x0 : ffff6eeb07b6ab68
> >> [   18.887183] Call trace:
> >> [   18.889637]  mvpp2_start_dev+0x2b0/0x300 [mvpp2]
> >> [   18.894279]  mvpp2_open+0x134/0x2b4 [mvpp2]
> >> [   18.898483]  __dev_open+0x128/0x1e4
> >> [   18.901988]  __dev_change_flags+0x17c/0x1d0
> >> [   18.906187]  dev_change_flags+0x30/0x70
> >> [   18.910038]  do_setlink+0x278/0xa7c
> >> [   18.913540]  __rtnl_newlink+0x44c/0x7d0
> >> [   18.917391]  rtnl_newlink+0x5c/0x8c
> >> [   18.920892]  rtnetlink_rcv_msg+0x254/0x314
> >> [   18.925006]  netlink_rcv_skb+0x48/0x10c
> >> [   18.928858]  rtnetlink_rcv+0x24/0x30
> >> [   18.932449]  netlink_unicast+0x290/0x2f4
> >> [   18.936386]  netlink_sendmsg+0x1d0/0x41c
> >> [   18.940323]  sock_sendmsg+0x60/0x70
> >> [   18.943825]  ____sys_sendmsg+0x248/0x260
> >> [   18.947762]  ___sys_sendmsg+0x74/0xa0
> >> [   18.951438]  __sys_sendmsg+0x64/0xcc
> >> [   18.955027]  __arm64_sys_sendmsg+0x30/0x40
> >> [   18.959140]  invoke_syscall+0x50/0x120
> >> [   18.962906]  el0_svc_common.constprop.0+0x4c/0xf4
> >> [   18.967629]  do_el0_svc+0x30/0x9c
> >> [   18.970958]  el0_svc+0x28/0xb0
> >> [   18.974025]  el0t_64_sync_handler+0x10c/0x140
> >> [   18.978400]  el0t_64_sync+0x1a4/0x1a8
> >> [   18.982078] Code: 52800004 b9416262 aa1503e0 52800041 (f94008a5)
> >> [   18.988196] ---[ end trace 0000000000000000 ]---
> >>
> >> Fixes: cff056322372 ("net: mvpp2: use .mac_select_pcs() interface")
> >> Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> >> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> >> ---
> >> v1->v2: Apply Russell's fix
> >> v2->v3: Fix Russell's name
> >>
> >>   drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +++---
> >>   1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> >> index 7cdbf8b8bbf6..1a835b48791b 100644
> >> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> >> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> >> @@ -6870,6 +6870,9 @@ static int mvpp2_port_probe(struct platform_device *pdev,
> >>          dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
> >>          dev->dev.of_node = port_node;
> >>
> >> +       port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
> >> +       port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
> >> +
> >>          if (!mvpp2_use_acpi_compat_mode(port_fwnode)) {
> >>                  port->phylink_config.dev = &dev->dev;
> >>                  port->phylink_config.type = PHYLINK_NETDEV;
> >> @@ -6940,9 +6943,6 @@ static int mvpp2_port_probe(struct platform_device *pdev,
> >>                                    port->phylink_config.supported_interfaces);
> >>                  }
> >>
> >> -               port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
> >> -               port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
> >> -
> >>                  phylink = phylink_create(&port->phylink_config, port_fwnode,
> >>                                           phy_mode, &mvpp2_phylink_ops);
> >>                  if (IS_ERR(phylink)) {
> >> --
> >> 2.34.1
> >>
> >
> > I'd like to test the patch - what EDK2 version are you using?
>
> I don't have access to the machine at the moment (maybe in a couple days
> again) but it was running a build from late 2019 IIRC. So, definitely
> not a bleeding edge version for sure.
>

2019 is enough indicator that most likely there is no MDIO description
in ACPI. Let me test the patch, thanks.

Best regards,
Marcin
Jakub Kicinski Feb. 17, 2022, 11:57 p.m. UTC | #4
On Tue, 15 Feb 2022 17:44:53 +0100 Marcin Wojtas wrote:
> > I don't have access to the machine at the moment (maybe in a couple days
> > again) but it was running a build from late 2019 IIRC. So, definitely
> > not a bleeding edge version for sure.
> >  
> 
> 2019 is enough indicator that most likely there is no MDIO description
> in ACPI. Let me test the patch, thanks.

Any luck with the testing? I wonder if we should keep the patch in or
drop it for now and ask for repost once tested..
Marcin Wojtas Feb. 18, 2022, 4 p.m. UTC | #5
Hi,

pt., 18 lut 2022 o 00:57 Jakub Kicinski <kuba@kernel.org> napisał(a):
>
> On Tue, 15 Feb 2022 17:44:53 +0100 Marcin Wojtas wrote:
> > > I don't have access to the machine at the moment (maybe in a couple days
> > > again) but it was running a build from late 2019 IIRC. So, definitely
> > > not a bleeding edge version for sure.
> > >
> >
> > 2019 is enough indicator that most likely there is no MDIO description
> > in ACPI. Let me test the patch, thanks.
>
> Any luck with the testing? I wonder if we should keep the patch in or
> drop it for now and ask for repost once tested..

I'll update today, sorry for the delay.

Marcin
Marcin Wojtas Feb. 18, 2022, 11:49 p.m. UTC | #6
wt., 15 lut 2022 o 00:18 Jeremy Linton <jeremy.linton@arm.com> napisał(a):
>
> Booting a MACCHIATObin with 5.17, the system OOPs with
> a null pointer deref when the network is started. This
> is caused by the pcs->ops structure being null in
> mcpp2_acpi_start() when it tries to call pcs_config().
>
> Hoisting the code which sets pcs_gmac.ops and pcs_xlg.ops,
> assuring they are always set, fixes the problem.
>
> The OOPs looks like:
> [   18.687760] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000010
> [   18.698561] Mem abort info:
> [   18.698564]   ESR = 0x96000004
> [   18.698567]   EC = 0x25: DABT (current EL), IL = 32 bits
> [   18.709821]   SET = 0, FnV = 0
> [   18.714292]   EA = 0, S1PTW = 0
> [   18.718833]   FSC = 0x04: level 0 translation fault
> [   18.725126] Data abort info:
> [   18.729408]   ISV = 0, ISS = 0x00000004
> [   18.734655]   CM = 0, WnR = 0
> [   18.738933] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000111bbf000
> [   18.745409] [0000000000000010] pgd=0000000000000000, p4d=0000000000000000
> [   18.752235] Internal error: Oops: 96000004 [#1] SMP
> [   18.757134] Modules linked in: rfkill ip_set nf_tables nfnetlink qrtr sunrpc vfat fat omap_rng fuse zram xfs crct10dif_ce mvpp2 ghash_ce sbsa_gwdt phylink xhci_plat_hcd ahci_plam
> [   18.773481] CPU: 0 PID: 681 Comm: NetworkManager Not tainted 5.17.0-0.rc3.89.fc36.aarch64 #1
> [   18.781954] Hardware name: Marvell                         Armada 7k/8k Family Board      /Armada 7k/8k Family Board      , BIOS EDK II Jun  4 2019
> [   18.795222] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [   18.802213] pc : mvpp2_start_dev+0x2b0/0x300 [mvpp2]
> [   18.807208] lr : mvpp2_start_dev+0x298/0x300 [mvpp2]
> [   18.812197] sp : ffff80000b4732c0
> [   18.815522] x29: ffff80000b4732c0 x28: 0000000000000000 x27: ffffccab38ae57f8
> [   18.822689] x26: ffff6eeb03065a10 x25: ffff80000b473a30 x24: ffff80000b4735b8
> [   18.829855] x23: 0000000000000000 x22: 00000000000001e0 x21: ffff6eeb07b6ab68
> [   18.837021] x20: ffff6eeb07b6ab30 x19: ffff6eeb07b6a9c0 x18: 0000000000000014
> [   18.844187] x17: 00000000f6232bfe x16: ffffccab899b1dc0 x15: 000000006a30f9fa
> [   18.851353] x14: 000000003b77bd50 x13: 000006dc896f0e8e x12: 001bbbfccfd0d3a2
> [   18.858519] x11: 0000000000001528 x10: 0000000000001548 x9 : ffffccab38ad0fb0
> [   18.865685] x8 : ffff80000b473330 x7 : 0000000000000000 x6 : 0000000000000000
> [   18.872851] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000b4732f8
> [   18.880017] x2 : 000000000000001a x1 : 0000000000000002 x0 : ffff6eeb07b6ab68
> [   18.887183] Call trace:
> [   18.889637]  mvpp2_start_dev+0x2b0/0x300 [mvpp2]
> [   18.894279]  mvpp2_open+0x134/0x2b4 [mvpp2]
> [   18.898483]  __dev_open+0x128/0x1e4
> [   18.901988]  __dev_change_flags+0x17c/0x1d0
> [   18.906187]  dev_change_flags+0x30/0x70
> [   18.910038]  do_setlink+0x278/0xa7c
> [   18.913540]  __rtnl_newlink+0x44c/0x7d0
> [   18.917391]  rtnl_newlink+0x5c/0x8c
> [   18.920892]  rtnetlink_rcv_msg+0x254/0x314
> [   18.925006]  netlink_rcv_skb+0x48/0x10c
> [   18.928858]  rtnetlink_rcv+0x24/0x30
> [   18.932449]  netlink_unicast+0x290/0x2f4
> [   18.936386]  netlink_sendmsg+0x1d0/0x41c
> [   18.940323]  sock_sendmsg+0x60/0x70
> [   18.943825]  ____sys_sendmsg+0x248/0x260
> [   18.947762]  ___sys_sendmsg+0x74/0xa0
> [   18.951438]  __sys_sendmsg+0x64/0xcc
> [   18.955027]  __arm64_sys_sendmsg+0x30/0x40
> [   18.959140]  invoke_syscall+0x50/0x120
> [   18.962906]  el0_svc_common.constprop.0+0x4c/0xf4
> [   18.967629]  do_el0_svc+0x30/0x9c
> [   18.970958]  el0_svc+0x28/0xb0
> [   18.974025]  el0t_64_sync_handler+0x10c/0x140
> [   18.978400]  el0t_64_sync+0x1a4/0x1a8
> [   18.982078] Code: 52800004 b9416262 aa1503e0 52800041 (f94008a5)
> [   18.988196] ---[ end trace 0000000000000000 ]---
>
> Fixes: cff056322372 ("net: mvpp2: use .mac_select_pcs() interface")
> Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
> v1->v2: Apply Russell's fix
> v2->v3: Fix Russell's name
>
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 7cdbf8b8bbf6..1a835b48791b 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -6870,6 +6870,9 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>         dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
>         dev->dev.of_node = port_node;
>
> +       port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
> +       port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
> +
>         if (!mvpp2_use_acpi_compat_mode(port_fwnode)) {
>                 port->phylink_config.dev = &dev->dev;
>                 port->phylink_config.type = PHYLINK_NETDEV;
> @@ -6940,9 +6943,6 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>                                   port->phylink_config.supported_interfaces);
>                 }
>
> -               port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
> -               port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
> -
>                 phylink = phylink_create(&port->phylink_config, port_fwnode,
>                                          phy_mode, &mvpp2_phylink_ops);
>                 if (IS_ERR(phylink)) {
>

All works fine in my setup, thanks!

You can add my:
Reviewed-by: Marcin Wojtas <mw@semihalf.com>
Jakub Kicinski Feb. 19, 2022, 4:44 a.m. UTC | #7
On Sat, 19 Feb 2022 00:49:27 +0100 Marcin Wojtas wrote:
> wt., 15 lut 2022 o 00:18 Jeremy Linton <jeremy.linton@arm.com> napisał(a):
> > Booting a MACCHIATObin with 5.17, the system OOPs with
> > a null pointer deref when the network is started. This
> > is caused by the pcs->ops structure being null in
> > mcpp2_acpi_start() when it tries to call pcs_config().
> >
> > Hoisting the code which sets pcs_gmac.ops and pcs_xlg.ops,
> > assuring they are always set, fixes the problem.

> > Fixes: cff056322372 ("net: mvpp2: use .mac_select_pcs() interface")
> > Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>

> You can add my:
> Reviewed-by: Marcin Wojtas <mw@semihalf.com>

Perfect, thanks everyone! 

It's now 5a2aba71cd26 ("net: mvpp2: always set port pcs ops") in net.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 7cdbf8b8bbf6..1a835b48791b 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -6870,6 +6870,9 @@  static int mvpp2_port_probe(struct platform_device *pdev,
 	dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
 	dev->dev.of_node = port_node;
 
+	port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
+	port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
+
 	if (!mvpp2_use_acpi_compat_mode(port_fwnode)) {
 		port->phylink_config.dev = &dev->dev;
 		port->phylink_config.type = PHYLINK_NETDEV;
@@ -6940,9 +6943,6 @@  static int mvpp2_port_probe(struct platform_device *pdev,
 				  port->phylink_config.supported_interfaces);
 		}
 
-		port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
-		port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
-
 		phylink = phylink_create(&port->phylink_config, port_fwnode,
 					 phy_mode, &mvpp2_phylink_ops);
 		if (IS_ERR(phylink)) {