Subject: Re: [RFC PATCH v2 net-next 0/9] Convert xpcs to phylink_pcs_ops

From: Wong Vee Khee <[email-masked]>
Date: Tue, 1 Jun 2021 16:20:09 +0800

On Tue, Jun 01, 2021 at 03:33:16AM +0300, Vladimir Oltean wrote:
> From: Vladimir Oltean <[email-masked]>
> 
> This patch series is partially tested (some code paths have been covered
> on the NXP SJA1105) but since I don't have stmmac hardware, it would
> still be appreciated if people from Intel could give this another run.
> 
> Background: the sja1105 DSA driver currently drives a Designware XPCS
> for SGMII and 2500base-X, and it would be nice to reuse some code with
> the xpcs module. This would also help consolidate the phylink_pcs_ops,
> since the only other dedicated PCS driver, currently, is the lynx_pcs.
> 
> Therefore, this series makes the xpcs expose the same kind of API that
> the lynx_pcs module does. The main changes are getting rid of struct
> mdio_xpcs_ops, being compatible with struct phylink_pcs_ops and being
> less reliant on the phy_interface_t passed to xpcs_probe (now renamed to
> xpcs_create).
> 
> Vladimir Oltean (9):
>   net: pcs: xpcs: delete shim definition for mdio_xpcs_get_ops()
>   net: pcs: xpcs: there is only one PHY ID
>   net: pcs: xpcs: make the checks related to the PHY interface mode
>     stateless
>   net: pcs: xpcs: export xpcs_validate
>   net: pcs: xpcs: export xpcs_config_eee
>   net: pcs: xpcs: export xpcs_probe
>   net: pcs: xpcs: use mdiobus_c45_addr in xpcs_{read,write}
>   net: pcs: xpcs: convert to mdio_device
>   net: pcs: xpcs: convert to phylink_pcs_ops
> 
>  drivers/net/ethernet/stmicro/stmmac/common.h  |   3 +-
>  drivers/net/ethernet/stmicro/stmmac/hwif.h    |  14 -
>  .../ethernet/stmicro/stmmac/stmmac_ethtool.c  |  12 +-
>  .../net/ethernet/stmicro/stmmac/stmmac_main.c |  44 +--
>  .../net/ethernet/stmicro/stmmac/stmmac_mdio.c |  47 ++-
>  drivers/net/pcs/pcs-xpcs.c                    | 371 ++++++++++++------
>  include/linux/pcs/pcs-xpcs.h                  |  40 +-
>  7 files changed, 306 insertions(+), 225 deletions(-)

I am seeing kernel panic after applying this patch series on my Intel
Tigerlake board:

[   12.770067] intel-eth-pci 0000:00:1e.4 enp0s30f4: FPE workqueue start
[   12.776481] intel-eth-pci 0000:00:1e.4 enp0s30f4: configuring for inband/sgmii link mode
[   12.784527] BUG: kernel NULL pointer dereference, address: 0000000000000000
[   12.791454] #PF: supervisor instruction fetch in kernel mode
[   12.797083] #PF: error_code(0x0010) - not-present page
[   12.802203] PGD 0 P4D 0
[   12.804739] Oops: 0010 [#1] PREEMPT SMP NOPTI
[   12.809080] CPU: 2 PID: 2023 Comm: connmand Tainted: G     U            5.13.0-rc3-intel-lts #73
[   12.817813] Hardware name: Intel Corporation Tiger Lake Client Platform/TigerLake U DDR4 SODIMM RVP, BIOS TGLIFUI1.R00.3373.AF0.2009230546 09/23/2020
[   12.831105] RIP: 0010:0x0
[   12.833732] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[   12.840566] RSP: 0018:ffff9f404052bb78 EFLAGS: 00010246
[   12.845771] RAX: 0000000000000000 RBX: ffff93e489bdda00 RCX: 0000000000000000
[   12.852867] RDX: ffff9f404052bba0 RSI: 0000000000000002 RDI: ffff93e4891244d8
[   12.859963] RBP: ffff9f404052bba0 R08: 0000000000000000 R09: ffff9f404052b888
[   12.867054] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000001
[   12.874145] R13: ffff93e4891208c0 R14: 0000000000000006 R15: 0000000000000001
[   12.881242] FS:  00007fd656ece7c0(0000) GS:ffff93e617f00000(0000) knlGS:0000000000000000
[   12.889286] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   12.895000] CR2: ffffffffffffffd6 CR3: 000000010e674004 CR4: 0000000000770ee0
[   12.902094] PKRU: 55555554
[   12.904796] Call Trace:
[   12.907245]  phylink_major_config+0x5e/0x1a0 [phylink]
[   12.912368]  phylink_start+0x204/0x2c0 [phylink]
[   12.916971]  stmmac_open+0x3d0/0x9f0 [stmmac]
[   12.921317]  __dev_open+0xe7/0x180
[   12.924710]  __dev_change_flags+0x174/0x1d0
[   12.928882]  ? __thaw_task+0x40/0x40
[   12.932453]  ? arch_stack_walk+0x9e/0xf0
[   12.936363]  dev_change_flags+0x21/0x60
[   12.940188]  devinet_ioctl+0x5e8/0x750
[   12.943925]  ? common_interrupt+0xc0/0xe0
[   12.947927]  inet_ioctl+0x190/0x1c0
[   12.951408]  ? dev_ioctl+0x26d/0x4c0
[   12.954972]  sock_do_ioctl+0x44/0x140
[   12.958627]  ? alloc_empty_file+0x61/0xb0
[   12.962628]  sock_ioctl+0x22c/0x320
[   12.966111]  __x64_sys_ioctl+0x80/0xb0
[   12.969852]  do_syscall_64+0x42/0x80
[   12.973418]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[   12.978446] RIP: 0033:0x7fd65741b4bb
[   12.982015] Code: 0f 1e fa 48 8b 05 c5 69 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 95 69 0c 00 f7 d8 64 89 01 48
[   13.000645] RSP: 002b:00007ffda8ca3288 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[   13.008170] RAX: ffffffffffffffda RBX: 00005576e8ee2100 RCX: 00007fd65741b4bb
[   13.015262] RDX: 00007ffda8ca3290 RSI: 0000000000008914 RDI: 0000000000000010
[   13.022355] RBP: 0000000000000010 R08: 00005576e8ee2100 R09: 0000000000000000
[   13.029447] R10: 00005576e8e8f010 R11: 0000000000000246 R12: 0000000000000000
[   13.036539] R13: 00007ffda8ca3290 R14: 0000000000000001 R15: 00007ffda8ca39d0
[   13.043633] Modules linked in: bluetooth ecryptfs hid_sensor_gyro_3d hid_sensor_incl_3d hid_sensor_magn_3d hid_sensor_accel_3d hid_sensor_als hid_sensor_trigger hid_sensor_iio_common hid_sensor_custom hid_sensor_hub intel_ishtp_loader intel_ishtp_hid intel_gpy ax88179_178a usbnet dwmac_intel mii x86_pkg_temp_thermal stmmac dwc3 kvm_intel pcs_xpcs mei_wdt mei_hdcp atkbd udc_core libps2 phylink kvm libphy i915 spi_pxa2xx_platform irqbypass intel_rapl_msr mei_me wdat_wdt i2c_i801 pcspkr dw_dmac dw_dmac_core intel_ish_ipc i2c_smbus mei intel_ishtp dwc3_pci tpm_crb thermal parport_pc i8042 tpm_tis parport tpm_tis_core tpm intel_pmc_core sch_fq_codel uhid fuse configfs snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec snd_hda_core snd_pcm snd_timer snd soundcore
[   13.111247] CR2: 0000000000000000
[   13.114556] ---[ end trace aef3fc6d992073a6 ]---