Re: [linux-yocto][linux-yocto v5.15/standard/base][PATCH 1/1] net: stmmac: Enable mac_managed_pm phylink config
On 5/16/23 11:00, Bruce Ashfield wrote: > In message: [linux-yocto][linux-yocto v5.15/standard/base][PATCH 1/1] net: > stmmac: Enable mac_managed_pm phylink config > on 15/05/2023 Liwei Song wrote: > >> From: Shenwei Wang >> >> commit f151c147b3afcf92dedff53f5f0e965414e4fd2c upstream. >> >> Enable the mac_managed_pm configuration in the phylink_config >> structure to avoid the kernel warning during system resume. >> >> Fixes: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() >> state") >> Signed-off-by: Shenwei Wang >> Acked-by: Florian Fainelli >> Signed-off-by: David S. Miller > > It would be useful to log how we discovered the issue, i.e > something like: > > [: discovered during resume testing on board ] Got it, this is discovered during resume testing on board Stratix 10, Will add these kind of log for future patches. Thanks, Liwei. > > But that's for any future patches, I've merged this as-is. > > Bruce > >> Signed-off-by: Liwei Song >> --- >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> index a3bd5396c2f8..c0771b67bcad 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> @@ -1284,6 +1284,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) >> >> if (!fwnode) >> fwnode = dev_fwnode(priv->device); >> +priv->phylink_config.mac_managed_pm = true; >> >> phylink = phylink_create(>phylink_config, fwnode, >> mode, _phylink_mac_ops); >> -- >> 2.35.5 >> -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12558): https://lists.yoctoproject.org/g/linux-yocto/message/12558 Mute This Topic: https://lists.yoctoproject.org/mt/98898858/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [linux-yocto] Trial merge of v5.15.111 v6.1.28 for linux-yocto
On Mon, May 15, 2023 at 10:50:11PM -0400, Bruce Ashfield wrote: > The BSP resolutions are definitely helpful. I'm still perfecting > the workflow (and my scripts) to reference the changes more easily, Please feel free to let me know if you want me to adjust my workflow or the content of my email. Thanks, Kevin signature.asc Description: PGP signature -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12557): https://lists.yoctoproject.org/g/linux-yocto/message/12557 Mute This Topic: https://lists.yoctoproject.org/mt/98841823/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [linux-yocto][v5.10/standard/intel-sdk-5.10/intel-socfpga][PATCH 00/46] Update BSP intel-socfpga-64 to latest
In message: [linux-yocto][v5.10/standard/intel-sdk-5.10/intel-socfpga][PATCH 00/46] Update BSP intel-socfpga-64 to latest on 15/05/2023 Kang Wenlin wrote: > From: Wenlin Kang > > *** BLURB HERE *** :) No blurb, but these looked ok to me, and I've merged them to the BSP branch. Bruce > > Alexey Gladkov (2): > Add a reference to ucounts for each cred > Use atomic_t for ucounts reference counting > > Ang Tien Sung (3): > HSD #14015618796: crypto: intel_fcs: To support concurrent fcs clients > requests > fpga: altera-cvp: Increase credit timeout > HSD #1509151525: fpga: altera-cvp: Truncated bitstream error support > > Dinh Nguyen (5): > Revert "cgroup: Use open-time credentials for process migraton perm > checks" > i2c: designware: introduce a custom scl recovery for SoCFPGA platforms > dt-bindings: i2c: dw: Add Intel's SoCFPGA I2C controller > arm: dts: socfpga: use the "intel,socfpga-i2c" binding > ARM: dts: add EMAC AXI settings for Cyclone5 > > Eric W. Biederman (1): > ucount: Make get_ucount a safe get_user replacement > > Jason Wang (1): > vdpa: introduce virtio pci driver > > John Harrison (1): > drm/i915/guc: Update to use firmware v49.0.1 > > Juergen Gross (1): > xen/grant-table: add gnttab_try_end_foreign_access() > > Laura Abbott (1): > vdpa: clean up get_config_size ret value handling > > Matthew Gerlach (3): > dt-bindings: soc: add bindings for Intel HPS Copy Engine > dt-bindings: intel: add binding for Intel n6000 > arm64: dts: intel: add device tree for n6000 > > NagarajuDeepakX (1): > HSD #14014656595: drivers: net: phy: add qsfp_phy support > > Niravkumar L Rabara (1): > HSD #18019805663: mtd: spi-nor: issi: Add IS25WP512 device > > Radu Bacrau (1): > HSD #15010832611: firmware: stratix10-rsu: query spt addresses > > Ritesh Harjani (2): > jbd2: refactor wait logic for transaction updates into a common > function > jbd2: fix use-after-free of transaction_t race > > Stefano Garzarella (3): > vdpa_sim: rename vdpasim_config_ops variables > vdpa: add get_config_size callback in vdpa_config_ops > vhost/vdpa: use get_config_size callback in > vhost_vdpa_config_validate() > > Teh Wen Ping (2): > HSD #18019787908 firmware: stratix10-svc: Reduce polling interval for > command status > HSD #18019787908 crypto: intel_fcs: Reduce polling interval for > GET_PROVISION_DATA > > Teh, Wen Ping (6): > HSD #15010087323 firmware: stratix10-svc: AES, SHA2/HMAC and ECDSA > service for large file > HSD #15010087323 crypto: intel_fcs: AES service for large file > HSD #15010087323 crypto: intel_fcs: ECDSA service for large file > HSD #15010087323 crypto: intel_fcs: SHA2/HMAC service for large file > HSD #1509644685 firmware: stratix10-svc: Generic Mailbox Command > HSD #1509644685 crypto: intel_fcs: Generic Mailbox Command > > Tejun Heo (1): > cgroup: Use open-time credentials for process migraton perm checks > > Teoh, Ji Sheng (3): > HSD #14015950233: arm64: configs: enable HW_RANDOM as kernel module > HSD #15010262011-1: arm64: dts: stratix10: change QSE phy-mode to > 10gbase-r > HSD #15010262011-2: net: eth: altera: fix QSE driver broken link speed > configuration > > Tham, Mun Yew (7): > HSD #14014656595: net: ethernet: altera: add main and header file for > Intel FPGA E-tile Ethernet driver > HSD #14014656595: net: ethernet: altera: add ethtool support for Intel > FPGA E-tile Ethernet driver > HSD #14014656595: net: ethernet: altera: add FEC driver for Intel FPGA > E-tile Ethernet driver > HSD #14014656595: net: ethernet: altera: add Intel FPGA E-tile > Ethernet driver Makefile and Kconfig > HSD #14014656595: net: phy: add PHY_INTERFACE_MODE_25GKR > net: ethernet: Fix multiple definitions of alloc_init_skbufs and > free_skbufs > HSD #22012268110: net: ethernet: altera: E-Tile fixed link > implementation > > Wenlin Kang (1): > Revert "intel: fcs: avoid allocating memory repeatedly" > > .../bindings/arm/intel,socfpga.yaml | 27 + > .../bindings/i2c/snps,designware-i2c.yaml |2 + > .../soc/intel/intel,hps-copy-engine.yaml | 51 + > arch/arm/boot/dts/socfpga.dtsi| 16 +- > arch/arm/boot/dts/socfpga_arria10.dtsi| 10 +- > .../boot/dts/altera/socfpga_stratix10.dtsi| 10 +- > .../dts/altera/socfpga_stratix10_qse.dtsi |2 +- > arch/arm64/boot/dts/intel/Makefile|3 +- > arch/arm64/boot/dts/intel/socfpga_agilex.dtsi | 10 +- > .../boot/dts/intel/socfpga_agilex_n6000.dts | 66 + > arch/arm64/configs/defconfig |1 + > drivers/Makefile |1 + > drivers/crypto/intel_fcs.c| 888 -- > drivers/firmware/stratix10-rsu.c | 98 + > drivers/firmware/stratix10-svc.c | 169 +- > drivers/fpga/altera-cvp.c | 26 +- >
Re: [linux-yocto] [yocto-kernel-cache][yocto-6.1][PATCH] bsp: xilinx-zynq: set CONFIG_CC_OPTIMIZE_FOR_SIZE to n
In message: [yocto-kernel-cache][yocto-6.1][PATCH] bsp: xilinx-zynq: set CONFIG_CC_OPTIMIZE_FOR_SIZE to n on 15/05/2023 quanyang.w...@windriver.com wrote: > From: Quanyang Wang > > Disable CONFIG_CC_OPTIMIZE_FOR_SIZE to fix the warning when > do_kernel_configcheck: > > WARNING: linux-yocto-rt-6.1.27+gitAUTOINC+9045c12fb0_e318b47db6-r0 > do_kernel_configcheck: [kernel config]: specified values did not make it into > the kernel's final configuration: > > [NOTE]: 'CONFIG_CC_OPTIMIZE_FOR_SIZE' last val (n) and .config val (y) do > not match > [INFO]: CONFIG_CC_OPTIMIZE_FOR_SIZE : y ## .config: 205 > :configs/v6.1/standard/preempt-rt/arch/arm/arm.cfg (y) > configs/v6.1/standard/preempt-rt/ktypes/preempt-rt/preempt-rt.cfg (n) > [INFO]: raw config text: > > Signed-off-by: Quanyang Wang > --- > Hi Bruce, > Would you please help merge this patch to the branch: > yocto-6.1 merged. Bruce > Thanks, > Quanyang > --- > bsp/xilinx-zynq/xilinx-zynq.cfg | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/bsp/xilinx-zynq/xilinx-zynq.cfg b/bsp/xilinx-zynq/xilinx-zynq.cfg > index a05a3cbf00..7af2562fc2 100644 > --- a/bsp/xilinx-zynq/xilinx-zynq.cfg > +++ b/bsp/xilinx-zynq/xilinx-zynq.cfg > @@ -3,6 +3,7 @@ CONFIG_SMP=y > CONFIG_NR_CPUS=4 > CONFIG_HOTPLUG_CPU=y > CONFIG_VMSPLIT_2G=y > +CONFIG_CC_OPTIMIZE_FOR_SIZE=n > > # > # Xilinx Specific Options > -- > 2.36.1 > -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12555): https://lists.yoctoproject.org/g/linux-yocto/message/12555 Mute This Topic: https://lists.yoctoproject.org/mt/98902451/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [linux-yocto][linux-yocto v5.15/standard/base][PATCH 1/1] net: stmmac: Enable mac_managed_pm phylink config
In message: [linux-yocto][linux-yocto v5.15/standard/base][PATCH 1/1] net: stmmac: Enable mac_managed_pm phylink config on 15/05/2023 Liwei Song wrote: > From: Shenwei Wang > > commit f151c147b3afcf92dedff53f5f0e965414e4fd2c upstream. > > Enable the mac_managed_pm configuration in the phylink_config > structure to avoid the kernel warning during system resume. > > Fixes: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() > state") > Signed-off-by: Shenwei Wang > Acked-by: Florian Fainelli > Signed-off-by: David S. Miller It would be useful to log how we discovered the issue, i.e something like: [: discovered during resume testing on board ] But that's for any future patches, I've merged this as-is. Bruce > Signed-off-by: Liwei Song > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index a3bd5396c2f8..c0771b67bcad 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -1284,6 +1284,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) > > if (!fwnode) > fwnode = dev_fwnode(priv->device); > + priv->phylink_config.mac_managed_pm = true; > > phylink = phylink_create(>phylink_config, fwnode, >mode, _phylink_mac_ops); > -- > 2.35.5 > -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12554): https://lists.yoctoproject.org/g/linux-yocto/message/12554 Mute This Topic: https://lists.yoctoproject.org/mt/98898858/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [linux-yocto][linux-yocto v6.1/standard/nxp-sdk-6.1/nxp-soc & v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc][PATCH 1/3] drm/bridge: adv7511: fix a memory leak when application changeset fails
merged. Bruce In message: [linux-yocto][linux-yocto v6.1/standard/nxp-sdk-6.1/nxp-soc & v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc][PATCH 1/3] drm/bridge: adv7511: fix a memory leak when application changeset fails on 15/05/2023 Xiaolei Wang wrote: > Changeset application failure should be destroyed > > unreferenced object 0x0008f2656480 (size 128): > comm "kworker/2:1", pid 83, jiffies 4294893570 (age 70.724s) > hex dump (first 32 bytes): > c0 b6 db 11 00 80 ff ff c0 b6 db 11 00 80 ff ff > 02 00 00 00 00 00 00 00 28 9e 45 ff 08 00 ff ff (.E. > backtrace: > [<716ba1d6>] kmem_cache_alloc_trace+0x198/0x3a4 > [] of_changeset_action+0x44/0xb4 > [ ] adv7511_probe+0x8c4/0x948 > [<9d4149ff>] i2c_device_probe+0x24c/0x2cc > [ ] really_probe+0xec/0x414 > [<453d11fb>] driver_probe_device+0x60/0xf0 > [ ] __device_attach_driver+0xb0/0x100 > [ ] bus_for_each_drv+0x8c/0xe0 > [ ] __device_attach+0xe0/0x180 > [<2d2d1388>] device_initial_probe+0x28/0x34 > [ ] bus_probe_device+0xa4/0xb0 > [ ] device_add+0x35c/0x670 > [ ] device_register+0x2c/0x40 > [ ] i2c_new_client_device+0x150/0x28c > [<0505c5a6>] i2c_new_device+0x2c/0x40 > [ ] of_i2c_register_devices+0xe8/0x180 > > Signed-off-by: Xiaolei Wang > Signed-off-by: Bruce Ashfield > --- > drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > index 084a2a4c5a6b..8e2a43321d4d 100644 > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > @@ -1465,10 +1465,12 @@ static int adv7511_probe(struct i2c_client *i2c, > const struct i2c_device_id *id) > of_changeset_init(); > of_changeset_detach_node(, endpoint); > ret = of_changeset_apply(); > - if (!ret) > + if (!ret) { > + of_changeset_destroy(); > dev_warn(dev, >"Probe failed. Remote port '%s' disabled\n", >remote_node->full_name); > + } > #endif > > return ret; > -- > 2.25.1 > In message: [linux-yocto][linux-yocto v6.1/standard/nxp-sdk-6.1/nxp-soc & v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc][PATCH 3/3] irqchip: imx-irqsteer: Block the runtime PM on 15/05/2023 Xiaolei Wang wrote: > The irqsteer's runtime PM has to be enabled otherwise the probe of > some devices (such as dpu) will fail because of the failure of > irq_chip_pm_get(). > But we can't allow the irqsteer to really enter the suspend state > because it will break the kdump with a call trace like below. > > Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP > Modules linked in: sch_fq_codel > CPU: 3 PID: 3772 Comm: sh Kdump: loaded Not tainted 5.4.87-yocto-standard #1 > Hardware name: Freescale i.MX8QM MEK (DT) > pstate: 4085 (nZcv daIf -PAN -UAO) > pc : imx_irqsteer_irq_mask+0x50/0x90 > lr : imx_irqsteer_irq_mask+0x40/0x90 > sp : 800014b7b9e0 > x29: 800014b7b9e0 x28: 0008e580 > x27: x26: > x25: 0007 x24: 800011513398 > x23: 800014b7ba88 x22: 0008ef1fadd8 > x21: 0008ef1fac80 x20: 0008eecd8858 > x19: 0001 x18: 0020 > x17: x16: > x15: 0008e5800470 x14: 8085 > x13: 800010192a48 x12: 800011ed8000 > x11: 800011ed8b50 x10: 000c01d2 > x9 : 2769dc82 x8 : 84ab > x7 : 800011ed8b68 x6 : 0001 > x5 : 16f0f41b x4 : 8889 > x3 : 800013677000 x2 : 800013677004 > x1 : 0080 x0 : 0080 > Call trace: >imx_irqsteer_irq_mask+0x50/0x90 >machine_crash_shutdown+0xb4/0x10c >__crash_kexec+0x78/0x12c >panic+0x180/0x370 >sysrq_handle_reboot+0x0/0x3c >__handle_sysrq+0xf0/0x1d0 >write_sysrq_trigger+0xac/0xcc >proc_reg_write+0x8c/0x110 >__vfs_write+0x4c/0x90 >vfs_write+0xe8/0x1d0 >ksys_write+0x7c/0x104 >__arm64_sys_write+0x28/0x3c >el0_svc_common.constprop.0+0x7c/0x1b4 >el0_svc_handler+0x54/0xc0 >el0_svc+0x8/0x204 > Code: f94092a3 531e7662 aa0003e1 8b22c062 (b9400040) > > So enable the runtime PM with pm_runtime_enable(), but block the suspend of > irqsteer with pm_runtime_forbid(). > > Signed-off-by: Xiaolei Wang > Signed-off-by: Bruce Ashfield > --- > drivers/irqchip/irq-imx-irqsteer.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/irqchip/irq-imx-irqsteer.c > b/drivers/irqchip/irq-imx-irqsteer.c > index
Re: [linux-yocto] Trial merge of v5.15.111 v6.1.28 for linux-yocto
In message: Trial merge of v5.15.111 v6.1.28 for linux-yocto on 12/05/2023 Kevin Hao wrote: > Hi Bruce, > > This is a trial merge of the stable kernel v5.15.111 v6.1.28 for the > following branches in the linux-yocto. > 443f96dec14c v5.15/standard/sdkv5.10/axxia > 541ee58e54e0 v5.15/standard/preempt-rt/sdkv5.10/axxia >#Have conflicts > 508a4e703a79 v5.15/standard/base > 168834cde529 v5.15/standard/preempt-rt/base >#Have conflicts > 7f137c507774 v5.15/standard/cn-sdkv5.4/octeon > b491324b85ba v5.15/standard/preempt-rt/cn-sdkv5.4/octeon >#Have conflicts > 2dd232ba6ce7 v5.15/standard/cn-sdkv5.15/octeon > fd6c28f7b390 v5.15/standard/preempt-rt/cn-sdkv5.15/octeon >#Have conflicts > 76ae3a0f2a73 v5.15/standard/ti-sdk-5.10/ti-j72xx >#Have conflicts > 9119f3f87a61 v5.15/standard/preempt-rt/ti-sdk-5.10/ti-j72xx >#Have conflicts > 26cdaccd602c v5.15/standard/nxp-sdk-5.15/nxp-soc > f127c78e0cf0 v5.15/standard/preempt-rt/nxp-sdk-5.15/nxp-soc >#Have conflicts > 7eee2cb35e49 v5.15/standard/bcm-2xxx-rpi > a842cf4e4675 v5.15/standard/preempt-rt/bcm-2xxx-rpi >#Have conflicts > 51149dacd7c4 v5.15/standard/nxp-sdk-5.15/nxp-s32g > f36ddc08df68 v5.15/standard/preempt-rt/nxp-sdk-5.15/nxp-s32g >#Have conflicts > fbb655cba3b2 v5.15/standard/intel-sdk-5.15/intel-socfpga > c421ea83b1ba v5.15/standard/preempt-rt/intel-sdk-5.15/intel-socfpga >#Have conflicts > 8f23e04e29ba v5.15/standard/x86 > 95d135df2110 v5.15/standard/preempt-rt/x86 >#Have conflicts > 5492ac82859e v5.15/standard/sdkv5.15/xlnx-soc >#Have conflicts > 4dd6efc6a43b v5.15/standard/preempt-rt/sdkv5.15/xlnx-soc >#Have conflicts > 3caa8770fbc2 v6.1/standard/base > 8886ff2350fe v6.1/standard/preempt-rt/base > fe915ec2426e v6.1/standard/nxp-sdk-6.1/nxp-soc >#Have conflicts > 79624711ef7d v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc >#Have conflicts > f9964998b8ea v6.1/standard/bcm-2xxx-rpi >#Have conflicts > f6916595380e v6.1/standard/preempt-rt/bcm-2xxx-rpi >#Have conflicts > a536e2acc87b v6.1/standard/nxp-sdk-5.15/nxp-s32g > b0c530beaf73 v6.1/standard/preempt-rt/nxp-sdk-5.15/nxp-s32g > 3caa8770fbc2 v6.1/standard/x86 > 4e11d1d2ffce v6.1/standard/preempt-rt/x86 > 8fbef12438f5 v6.1/standard/sdkv6.1/xlnx-soc >#Have conflicts > 7f80b171fa27 v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc >#Have conflicts > > This is a much bigger stable cycle. There are 372 patches in v5.15.111 and > 611 patches in v6.1.28. > So we got more merge conflicts than usual. There is one merge conflict in > kernel/workqueue.c on > v5.15 rt kernel, all the others are for various drivers. I believe I have > fixed all the mess and > all the merges have passed my build test. I have pushed these branches to: > https://github.com/haokexin/linux > > You can use this as a reference for the linux-yocto stable kernel bump. Thanks Kevin, I did reference the changes in quite a few occasions, and also cross referenced against upstream -rt for the workqueue issue. The BSP resolutions are definitely helpful. I'm still perfecting the workflow (and my scripts) to reference the changes more easily, so hopefully relatively few issues crept into my merges. Bruce > > Thanks, > Kevin -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12552): https://lists.yoctoproject.org/g/linux-yocto/message/12552 Mute This Topic: https://lists.yoctoproject.org/mt/98841823/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [linux-yocto]: [kernel/kernel-rt]: nxp-ls1028: kernel patches to improve graphics
In message: [linux-yocto]: [kernel/kernel-rt]: nxp-ls1028: kernel patches to improve graphics on 11/05/2023 Meng Li wrote: > From: Limeng > > Hi Bruce, > > The 2 patches are used to improve graphics for NXP ls1028 BSP > So, could you please help merge these patches into linux-ycoto kernel, both > below 2 branchs? > v6.1/standard/nxp-sdk-6.1/nxp-soc > v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc merged. Bruce > > diffstat info as below: > > Kconfig|1 + > cdns-mhdp-dp.c | 16 > 2 files changed, 5 insertions(+), 12 deletions(-) > > > thanks, > Limeng -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12551): https://lists.yoctoproject.org/g/linux-yocto/message/12551 Mute This Topic: https://lists.yoctoproject.org/mt/98820971/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [yocto-kernel-cache][yocto-6.1][PATCH] bsp: xilinx-zynq: set CONFIG_CC_OPTIMIZE_FOR_SIZE to n
From: Quanyang Wang Disable CONFIG_CC_OPTIMIZE_FOR_SIZE to fix the warning when do_kernel_configcheck: WARNING: linux-yocto-rt-6.1.27+gitAUTOINC+9045c12fb0_e318b47db6-r0 do_kernel_configcheck: [kernel config]: specified values did not make it into the kernel's final configuration: [NOTE]: 'CONFIG_CC_OPTIMIZE_FOR_SIZE' last val (n) and .config val (y) do not match [INFO]: CONFIG_CC_OPTIMIZE_FOR_SIZE : y ## .config: 205 :configs/v6.1/standard/preempt-rt/arch/arm/arm.cfg (y) configs/v6.1/standard/preempt-rt/ktypes/preempt-rt/preempt-rt.cfg (n) [INFO]: raw config text: Signed-off-by: Quanyang Wang --- Hi Bruce, Would you please help merge this patch to the branch: yocto-6.1 Thanks, Quanyang --- bsp/xilinx-zynq/xilinx-zynq.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/bsp/xilinx-zynq/xilinx-zynq.cfg b/bsp/xilinx-zynq/xilinx-zynq.cfg index a05a3cbf00..7af2562fc2 100644 --- a/bsp/xilinx-zynq/xilinx-zynq.cfg +++ b/bsp/xilinx-zynq/xilinx-zynq.cfg @@ -3,6 +3,7 @@ CONFIG_SMP=y CONFIG_NR_CPUS=4 CONFIG_HOTPLUG_CPU=y CONFIG_VMSPLIT_2G=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=n # # Xilinx Specific Options -- 2.36.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12550): https://lists.yoctoproject.org/g/linux-yocto/message/12550 Mute This Topic: https://lists.yoctoproject.org/mt/98902451/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto][linux-yocto v5.15/standard/base][PATCH 1/1] net: stmmac: Enable mac_managed_pm phylink config
From: Shenwei Wang commit f151c147b3afcf92dedff53f5f0e965414e4fd2c upstream. Enable the mac_managed_pm configuration in the phylink_config structure to avoid the kernel warning during system resume. Fixes: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state") Signed-off-by: Shenwei Wang Acked-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Liwei Song --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a3bd5396c2f8..c0771b67bcad 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1284,6 +1284,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) if (!fwnode) fwnode = dev_fwnode(priv->device); + priv->phylink_config.mac_managed_pm = true; phylink = phylink_create(>phylink_config, fwnode, mode, _phylink_mac_ops); -- 2.35.5 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12549): https://lists.yoctoproject.org/g/linux-yocto/message/12549 Mute This Topic: https://lists.yoctoproject.org/mt/98898858/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 46/46] HSD #18019787908 crypto: intel_fcs: Reduce polling interval for GET_PROVISION_DATA
From: Teh Wen Ping commit 5b5ef0b5e999c1916962baeaf595f33d5de86ee6 from https://github.com/altera-opensource/linux-socfpga.git Reduce GET_PROVISION_DATA delay interval from 500m to 100m to receive response faster. Signed-off-by: Teh Wen Ping Signed-off-by: Wenlin Kang --- drivers/crypto/intel_fcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/intel_fcs.c b/drivers/crypto/intel_fcs.c index d2996d151af1..419c62ff9b69 100644 --- a/drivers/crypto/intel_fcs.c +++ b/drivers/crypto/intel_fcs.c @@ -634,7 +634,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, break; } timeout--; - mdelay(500); + mdelay(100); } } else { data->com_paras.gp_data.addr = NULL; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12548): https://lists.yoctoproject.org/g/linux-yocto/message/12548 Mute This Topic: https://lists.yoctoproject.org/mt/98898789/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 40/46] HSD #15010262011-2: net: eth: altera: fix QSE driver broken link speed configuration
From: "Teoh, Ji Sheng" commit 37ee5829b06caa7fb4e47db5cebff332d6ab04de from https://github.com/altera-opensource/linux-socfpga.git This patch fixes QSE driver broken link speed configuration during mac_config. During mac_config, the link speed is still unknown and will only be set after mac_pcs_get_state is called. Hence, it is more appropriate to check for state interface which is defined in device tree phy-mode instead of link speed during mac_config. The reason for this change is, commit e0f909bc3a24 ('net: switch to using PHY_INTERFACE_MODE_10GBASER rather than 10GKR') that was introduced in v5.10-lts. Fix is applied to update the PHY interface to align with the upstream change. Signed-off-by: Teoh, Ji Sheng Signed-off-by: Wenlin Kang --- drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c b/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c index 97c6a2fbaf1e..3b2d3afc080e 100644 --- a/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c +++ b/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c @@ -1237,7 +1237,7 @@ static void intel_fpga_qse_validate(struct phylink_config *config, __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; if (state->interface != PHY_INTERFACE_MODE_NA && - state->interface != PHY_INTERFACE_MODE_10GKR) { + state->interface != PHY_INTERFACE_MODE_10GBASER) { bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); return; } @@ -1254,7 +1254,7 @@ static void intel_fpga_qse_validate(struct phylink_config *config, switch (state->interface) { case PHY_INTERFACE_MODE_NA: - case PHY_INTERFACE_MODE_10GKR: + case PHY_INTERFACE_MODE_10GBASER: phylink_set(mask, 1baseT_Full); phylink_set(mask, 1baseCR_Full); phylink_set(mask, 1baseSR_Full); @@ -1322,8 +1322,8 @@ static void intel_fpga_qse_mac_config(struct phylink_config *config, phy_csroffs(reconfig_busy), PHY_RECONFIG_BUSY)) { csrwr32(0, priv->phy_reconfig_csr, phy_csroffs(logical_chan_num)); - switch (state->speed) { - case SPEED_1: + switch (state->interface) { + case PHY_INTERFACE_MODE_10GBASER: speed_reconfig |= (PHY_ETH_SPEED_1 | PHY_RECONFIG_START); break; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12545): https://lists.yoctoproject.org/g/linux-yocto/message/12545 Mute This Topic: https://lists.yoctoproject.org/mt/98898786/21656 Mute #15010262011-2:https://lists.yoctoproject.org/g/linux-yocto/mutehashtag/15010262011-2 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 44/46] ARM: dts: add EMAC AXI settings for Cyclone5
From: Dinh Nguyen commit 55982ac91fb3c9e164ffc8d51668df5d9c5d5a24 from https://github.com/altera-opensource/linux-socfpga.git [upstream commit b3cbbb58632fa6f9cebf3f5c3ba210f11a3bdeb8] Add the dts entries needed to support the EMAC AXI bus settings on the Cyclone5. Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- arch/arm/boot/dts/socfpga.dtsi | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi index 42ec73971d39..59c799b1448f 100644 --- a/arch/arm/boot/dts/socfpga.dtsi +++ b/arch/arm/boot/dts/socfpga.dtsi @@ -563,6 +563,12 @@ fpgamgr0: fpgamgr@ff706000 { interrupts = <0 175 4>; }; + socfpga_axi_setup: stmmac-axi-config { + snps,wr_osr_lmt = <0xf>; + snps,rd_osr_lmt = <0xf>; + snps,blen = <0 0 0 0 16 0 0>; + }; + gmac0: ethernet@ff70 { compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac"; altr,sysmgr-syscon = < 0x60 0>; @@ -578,6 +584,7 @@ gmac0: ethernet@ff70 { snps,perfect-filter-entries = <128>; tx-fifo-depth = <4096>; rx-fifo-depth = <4096>; + snps,axi-config = <_axi_setup>; status = "disabled"; }; @@ -596,6 +603,7 @@ gmac1: ethernet@ff702000 { snps,perfect-filter-entries = <128>; tx-fifo-depth = <4096>; rx-fifo-depth = <4096>; + snps,axi-config = <_axi_setup>; status = "disabled"; }; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12546): https://lists.yoctoproject.org/g/linux-yocto/message/12546 Mute This Topic: https://lists.yoctoproject.org/mt/98898787/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 45/46] HSD #18019787908 firmware: stratix10-svc: Reduce polling interval for command status
From: Teh Wen Ping commit 4b1732303c1f0e9b9b3de9fdb43edff5449cfc90 from https://github.com/altera-opensource/linux-socfpga.git Change COMMAND_POLL_SERVICE_STATUS interval into two interval. Poll the status every 20ms for 1sec and if status is still not ready, poll every 500ms for 29sec. Fast response commands will have shorter latency. Signed-off-by: Teh Wen Ping Signed-off-by: Wenlin Kang --- drivers/firmware/stratix10-svc.c | 94 ++-- 1 file changed, 66 insertions(+), 28 deletions(-) diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index 6d375c1e8b53..4c15a861c6ea 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -29,14 +29,25 @@ * from the secure world for FPGA manager to reuse, or to free the buffer(s) * when all bit-stream data had be send. * - * FPGA_CONFIG_STATUS_TIMEOUT_SEC - poll the FPGA configuration status, - * service layer will return error to FPGA manager when timeout occurs, - * timeout is set to 30 seconds (30 * 1000) at Intel Stratix10 SoC. + * FPGA_CONFIG_POLL_INTERVAL_MS_FAST - interval for polling the service status + * at secure world for fast response commands. Interval is set to 20ms. + * + * FPGA_CONFIG_POLL_INTERVAL_MS_SLOW - interval for polling the service status + * at secure world for slow response commands. Interval is set to 500ms. + * + * FPGA_CONFIG_POLL_COUNT_FAST - number of count for polling service status for + * fast response commands. Count is set to 50 (50*20ms=1sec) + * + * FPGA_CONFIG_POLL_COUNT_SLOW - number of count for polling service status for + * slow response commands. Count is set to 58 (58*500ms=29sec) */ #define SVC_NUM_DATA_IN_FIFO 8 #define SVC_NUM_CHANNEL4 #define FPGA_CONFIG_DATA_CLAIM_TIMEOUT_MS 2000 -#define FPGA_CONFIG_STATUS_TIMEOUT_SEC 30 +#define FPGA_CONFIG_POLL_INTERVAL_MS_FAST 20 +#define FPGA_CONFIG_POLL_INTERVAL_MS_SLOW 500 +#define FPGA_CONFIG_POLL_COUNT_FAST50 +#define FPGA_CONFIG_POLL_COUNT_SLOW58 #define BYTE_TO_WORD_SIZE 4 /* stratix10 service layer clients */ @@ -255,6 +266,47 @@ static void svc_thread_cmd_data_claim(struct stratix10_svc_controller *ctrl, wait_for_completion_timeout(>complete_status, timeout)); } +/** + * svc_cmd_poll_status() - poll for status + * @p_data: pointer to service data structure + * @ctrl: pointer to service layer controller + * @res: pointer to store response + * @poll_count: pointer to poll count value + * @poll_interval_in_ms: interval value in miliseconds + * + * Check whether the service at secure world has completed, and then inform the + * response. + */ +static void svc_cmd_poll_status(struct stratix10_svc_data *p_data, + struct stratix10_svc_controller *ctrl, + struct arm_smccc_res *res, + int *poll_count, int poll_interval_in_ms) +{ + unsigned long a0, a1, a2; + + a0 = INTEL_SIP_SMC_FPGA_CONFIG_ISDONE; + a1 = (unsigned long)p_data->paddr; + a2 = (unsigned long)p_data->size; + + if (p_data->command == COMMAND_POLL_SERVICE_STATUS) + a0 = INTEL_SIP_SMC_SERVICE_COMPLETED; + + while (*poll_count) { + ctrl->invoke_fn(a0, a1, a2, 0, 0, 0, 0, 0, res); + if ((res->a0 == INTEL_SIP_SMC_STATUS_OK) || + (res->a0 == INTEL_SIP_SMC_STATUS_ERROR) || + (res->a0 == INTEL_SIP_SMC_STATUS_REJECTED)) + break; + + /* +* request is still in progress, go to sleep then +* poll again +*/ + msleep(poll_interval_in_ms); + (*poll_count)--; + } +} + /** * svc_thread_cmd_config_status() - check configuration status * @ctrl: pointer to service layer controller @@ -269,8 +321,7 @@ static void svc_thread_cmd_config_status(struct stratix10_svc_controller *ctrl, struct stratix10_svc_cb_data *cb_data) { struct arm_smccc_res res; - int count_in_sec; - unsigned long a0, a1, a2; + int poll_count; cb_data->kaddr1 = NULL; cb_data->kaddr2 = NULL; @@ -280,30 +331,17 @@ static void svc_thread_cmd_config_status(struct stratix10_svc_controller *ctrl, /* for debug purpose only */ pr_debug("%s: polling completed status\n", __func__); - a0 = INTEL_SIP_SMC_FPGA_CONFIG_ISDONE; - a1 = (unsigned long)p_data->paddr; - a2 = (unsigned long)p_data->size; - - if (p_data->command == COMMAND_POLL_SERVICE_STATUS) - a0 = INTEL_SIP_SMC_SERVICE_COMPLETED; - - count_in_sec = FPGA_CONFIG_STATUS_TIMEOUT_SEC; - while (count_in_sec) { - ctrl->invoke_fn(a0, a1, a2, 0, 0, 0, 0, 0, ); - if
[linux-yocto] [PATCH 43/46] arm: dts: socfpga: use the "intel,socfpga-i2c" binding
From: Dinh Nguyen commit e590fa8167f46629132bc0cc5576da7b9c0bc9c4 from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 61cc507cd83b10bd561921d11386f524fcea419d] The I2C pins on Intel's SoCFPGA platform are not connected to GPIOs and thus cannot be recovered by the standard GPIO method. The driver has been updated to use the "intel,socfpga-i2c" binding to reset the I2C host for error recovery. Link: https://lore.kernel.org/lkml/20220620230109.986298-1-dingu...@kernel.org/ Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- arch/arm/boot/dts/socfpga.dtsi| 8 arch/arm/boot/dts/socfpga_arria10.dtsi| 10 +- arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 10 +- arch/arm64/boot/dts/intel/socfpga_agilex.dtsi | 10 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi index 3e200b19b630..42ec73971d39 100644 --- a/arch/arm/boot/dts/socfpga.dtsi +++ b/arch/arm/boot/dts/socfpga.dtsi @@ -665,7 +665,7 @@ portc: gpio-controller@0 { i2c0: i2c@ffc04000 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc04000 0x1000>; resets = < I2C0_RESET>; clocks = <_sp_clk>; @@ -676,7 +676,7 @@ i2c0: i2c@ffc04000 { i2c1: i2c@ffc05000 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc05000 0x1000>; resets = < I2C1_RESET>; clocks = <_sp_clk>; @@ -687,7 +687,7 @@ i2c1: i2c@ffc05000 { i2c2: i2c@ffc06000 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc06000 0x1000>; resets = < I2C2_RESET>; clocks = <_sp_clk>; @@ -698,7 +698,7 @@ i2c2: i2c@ffc06000 { i2c3: i2c@ffc07000 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc07000 0x1000>; resets = < I2C3_RESET>; clocks = <_sp_clk>; diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi index a5582e7a6afa..cc71f78175d1 100644 --- a/arch/arm/boot/dts/socfpga_arria10.dtsi +++ b/arch/arm/boot/dts/socfpga_arria10.dtsi @@ -552,7 +552,7 @@ fpga_mgr: fpga-mgr@ffd03000 { i2c0: i2c@ffc02200 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc02200 0x100>; interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>; clocks = <_sp_clk>; @@ -563,7 +563,7 @@ i2c0: i2c@ffc02200 { i2c1: i2c@ffc02300 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc02300 0x100>; interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>; clocks = <_sp_clk>; @@ -574,7 +574,7 @@ i2c1: i2c@ffc02300 { i2c2: i2c@ffc02400 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc02400 0x100>; interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>; clocks = <_sp_clk>; @@ -585,7 +585,7 @@ i2c2: i2c@ffc02400 { i2c3: i2c@ffc02500 { #address-cells = <1>; #size-cells = <0>; - compatible = "snps,designware-i2c"; + compatible = "intel,socfpga-i2c", "snps,designware-i2c"; reg = <0xffc02500 0x100>; interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>; clocks = <_sp_clk>; @@
[linux-yocto] [PATCH 42/46] dt-bindings: i2c: dw: Add Intel's SoCFPGA I2C controller
From: Dinh Nguyen commit ef581f3c543027fce1581a8036ca82e4259c52d2 from https://github.com/altera-opensource/linux-socfpga.git [upstream commit ab37b08d91f5bb180ae6c05091ed2209700939c6] The I2C pins on Intel's SoCFPGA platform are not connected to GPIOs and thus cannot be recovered by the standard GPIO method. Document the "intel,socfpga-i2c" binding. Acked-by: Krzysztof Kozlowski Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml b/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml index 4f746bef2374..30610f6f12f0 100644 --- a/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml +++ b/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml @@ -33,6 +33,8 @@ properties: - const: snps,designware-i2c - description: Baikal-T1 SoC System I2C controller const: baikal,bt1-sys-i2c + - description: Intel's SoCFPGA I2C controller +const: intel,socfpga-i2c reg: minItems: 1 -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12542): https://lists.yoctoproject.org/g/linux-yocto/message/12542 Mute This Topic: https://lists.yoctoproject.org/mt/98898783/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 39/46] HSD #15010262011-1: arm64: dts: stratix10: change QSE phy-mode to 10gbase-r
From: "Teoh, Ji Sheng" commit 2e242c460021e5a87b8caa567a9135b8f4cd764e from https://github.com/altera-opensource/linux-socfpga.git This patch updates the phy-mode of QSE device tree to 10gbase-r. The reason for this change is, commit 7d6cd6c46cb7 ('net: eth: altera: fix QSE driver broken link speed configuration') has updated PHY interface from PHY_INTERFACE_MODE_10GKR to PHY_INTERFACE_MODE_10GBASER. This fix will allow the QSE driver to initialize properly with the correct PHY interface mode. Signed-off-by: Teoh, Ji Sheng Signed-off-by: Wenlin Kang --- arch/arm64/boot/dts/altera/socfpga_stratix10_qse.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10_qse.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10_qse.dtsi index ff4a9c194a82..c2a323832466 100644 --- a/arch/arm64/boot/dts/altera/socfpga_stratix10_qse.dtsi +++ b/arch/arm64/boot/dts/altera/socfpga_stratix10_qse.dtsi @@ -54,7 +54,7 @@ qse_0_qse: ethernet@0x10002 { <0x0001 0x0540 0x0020>, <0x0001 0x00030100 0x0010>; dma-coherent; - phy-mode = "10gbase-kr"; + phy-mode = "10gbase-r"; sfp = <_eth0>; clocks = <_ctrl_10G_clk>; clock-names = "tod_clk"; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12543): https://lists.yoctoproject.org/g/linux-yocto/message/12543 Mute This Topic: https://lists.yoctoproject.org/mt/98898784/21656 Mute #15010262011-1:https://lists.yoctoproject.org/g/linux-yocto/mutehashtag/15010262011-1 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 38/46] Use atomic_t for ucounts reference counting
From: Alexey Gladkov commit 4999f8076579fec0aba45019489b2fe4894a101a from https://github.com/altera-opensource/linux-socfpga.git [upstream commit b6c336528926ef73b0f70260f2636de2c3b94c14] The current implementation of the ucounts reference counter requires the use of spin_lock. We're going to use get_ucounts() in more performance critical areas like a handling of RLIMIT_SIGPENDING. Now we need to use spin_lock only if we want to change the hashtable. v10: * Always try to put ucounts in case we cannot increase ucounts->count. This will allow to cover the case when all consumers will return ucounts at once. v9: * Use a negative value to check that the ucounts->count is close to overflow. Signed-off-by: Alexey Gladkov Link: https://lkml.kernel.org/r/94d1dbecab060a6b116b0a2d1accd8ca1bbb4f5f.1619094428.git.leg...@kernel.org Signed-off-by: Eric W. Biederman Signed-off-by: Wenlin Kang --- include/linux/user_namespace.h | 4 +-- kernel/ucount.c| 55 +- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index e1bd560da1cd..68fcbc7e3d53 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -96,7 +96,7 @@ struct ucounts { struct hlist_node node; struct user_namespace *ns; kuid_t uid; - int count; + atomic_t count; atomic_t ucount[UCOUNT_COUNTS]; }; @@ -108,7 +108,7 @@ void retire_userns_sysctls(struct user_namespace *ns); struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, enum ucount_type type); void dec_ucount(struct ucounts *ucounts, enum ucount_type type); struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid); -struct ucounts *get_ucounts(struct ucounts *ucounts); +struct ucounts * __must_check get_ucounts(struct ucounts *ucounts); void put_ucounts(struct ucounts *ucounts); #ifdef CONFIG_USER_NS diff --git a/kernel/ucount.c b/kernel/ucount.c index 06f278288091..5f8f0dfe5f7c 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -11,7 +11,7 @@ struct ucounts init_ucounts = { .ns= _user_ns, .uid = GLOBAL_ROOT_UID, - .count = 1, + .count = ATOMIC_INIT(1), }; #define UCOUNTS_HASHTABLE_BITS 10 @@ -139,6 +139,15 @@ static void hlist_add_ucounts(struct ucounts *ucounts) spin_unlock_irq(_lock); } +struct ucounts *get_ucounts(struct ucounts *ucounts) +{ + if (ucounts && atomic_add_negative(1, >count)) { + put_ucounts(ucounts); + ucounts = NULL; + } + return ucounts; +} + struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) { struct hlist_head *hashent = ucounts_hashentry(ns, uid); @@ -155,7 +164,7 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) new->ns = ns; new->uid = uid; - new->count = 0; + atomic_set(>count, 1); spin_lock_irq(_lock); ucounts = find_ucounts(ns, uid, hashent); @@ -163,34 +172,13 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) kfree(new); } else { hlist_add_head(>node, hashent); - ucounts = new; get_user_ns(new->ns); + spin_unlock_irq(_lock); + return new; } } - if (ucounts->count == INT_MAX) - ucounts = NULL; - else - ucounts->count += 1; spin_unlock_irq(_lock); - return ucounts; -} - -struct ucounts *get_ucounts(struct ucounts *ucounts) -{ - unsigned long flags; - - if (!ucounts) - return NULL; - - spin_lock_irqsave(_lock, flags); - if (ucounts->count == INT_MAX) { - WARN_ONCE(1, "ucounts: counter has reached its maximum value"); - ucounts = NULL; - } else { - ucounts->count += 1; - } - spin_unlock_irqrestore(_lock, flags); - + ucounts = get_ucounts(ucounts); return ucounts; } @@ -198,16 +186,13 @@ void put_ucounts(struct ucounts *ucounts) { unsigned long flags; - spin_lock_irqsave(_lock, flags); - ucounts->count -= 1; - if (!ucounts->count) + if (atomic_dec_and_test(>count)) { + spin_lock_irqsave(_lock, flags); hlist_del_init(>node); - else - ucounts = NULL; - spin_unlock_irqrestore(_lock, flags); - - kfree(ucounts); - put_user_ns(ucounts->ns); + spin_unlock_irqrestore(_lock, flags); + put_user_ns(ucounts->ns); + kfree(ucounts); + } } static inline bool atomic_inc_below(atomic_t *v, int u) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply
[linux-yocto] [PATCH 41/46] i2c: designware: introduce a custom scl recovery for SoCFPGA platforms
From: Dinh Nguyen commit 73b66146e5a976b1c4b3fe3a14b950b54fb080eb from https://github.com/altera-opensource/linux-socfpga.git [upstream commit b2f670af1feab3325cce5a251128f30711148771] The I2C pins on the SoCFPGA platforms do not go through a GPIO module, thus cannot be recovered by the default method of by doing a GPIO access. Only a reset of the I2C IP block can a recovery be successful, so this change effectively resets the I2C controller, NOT any attached clients. Reviewed-by: Andy Shevchenko Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- drivers/i2c/busses/i2c-designware-core.h| 1 + drivers/i2c/busses/i2c-designware-master.c | 49 ++--- drivers/i2c/busses/i2c-designware-platdrv.c | 1 + 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index eb5ef4d0f463..4758a438b4d5 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -293,6 +293,7 @@ struct dw_i2c_dev { #define MODEL_MSCC_OCELOT 0x0100 #define MODEL_BAIKAL_BT1 0x0200 +#define MODEL_SOCFPGA 0x0400 #define MODEL_MASK 0x0f00 int i2c_dw_init_regmap(struct dw_i2c_dev *dev); diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index 2871cf2ee8b4..f961a1c263fa 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -711,10 +711,26 @@ static void i2c_dw_unprepare_recovery(struct i2c_adapter *adap) i2c_dw_init_master(dev); } -static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) +static int i2c_socfpga_scl_recovery(struct i2c_adapter *adap) +{ + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; + + bri->prepare_recovery(adap); + bri->unprepare_recovery(adap); + + return 0; +} + +static int i2c_dw_init_socfpga_recovery_info(struct dw_i2c_dev *dev, +struct i2c_bus_recovery_info *rinfo) +{ + rinfo->recover_bus = i2c_socfpga_scl_recovery; + return 1; +} + +static int i2c_dw_init_generic_recovery_info(struct dw_i2c_dev *dev, +struct i2c_bus_recovery_info *rinfo) { - struct i2c_bus_recovery_info *rinfo = >rinfo; - struct i2c_adapter *adap = >adapter; struct gpio_desc *gpio; gpio = devm_gpiod_get_optional(dev->dev, "scl", GPIOD_OUT_HIGH); @@ -729,13 +745,34 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) rinfo->sda_gpiod = gpio; rinfo->recover_bus = i2c_generic_scl_recovery; - rinfo->prepare_recovery = i2c_dw_prepare_recovery; - rinfo->unprepare_recovery = i2c_dw_unprepare_recovery; - adap->bus_recovery_info = rinfo; dev_info(dev->dev, "running with gpio recovery mode! scl%s", rinfo->sda_gpiod ? ",sda" : ""); + return 1; +} + +static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) +{ + struct i2c_bus_recovery_info *rinfo = >rinfo; + struct i2c_adapter *adap = >adapter; + int ret; + + switch (dev->flags & MODEL_MASK) { + case MODEL_SOCFPGA: + ret = i2c_dw_init_socfpga_recovery_info(dev, rinfo); + break; + default: + ret = i2c_dw_init_generic_recovery_info(dev, rinfo); + break; + } + if (ret <= 0) + return ret; + + rinfo->prepare_recovery = i2c_dw_prepare_recovery; + rinfo->unprepare_recovery = i2c_dw_unprepare_recovery; + adap->bus_recovery_info = rinfo; + return 0; } diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 474754151725..385ac3f7d465 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -153,6 +153,7 @@ static const struct of_device_id dw_i2c_of_match[] = { { .compatible = "snps,designware-i2c", }, { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT }, { .compatible = "baikal,bt1-sys-i2c", .data = (void *)MODEL_BAIKAL_BT1 }, + { .compatible = "intel,socfpga-i2c", .data = (void *)MODEL_SOCFPGA }, {}, }; MODULE_DEVICE_TABLE(of, dw_i2c_of_match); -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12541): https://lists.yoctoproject.org/g/linux-yocto/message/12541 Mute This Topic: https://lists.yoctoproject.org/mt/98898782/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 37/46] Add a reference to ucounts for each cred
From: Alexey Gladkov commit 5942bed71f9facc2a0e53b92781330107a60d1da from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 905ae01c4ae2ae3df05bb141801b1db4b7d83c61] For RLIMIT_NPROC and some other rlimits the user_struct that holds the global limit is kept alive for the lifetime of a process by keeping it in struct cred. Adding a pointer to ucounts in the struct cred will allow to track RLIMIT_NPROC not only for user in the system, but for user in the user_namespace. Updating ucounts may require memory allocation which may fail. So, we cannot change cred.ucounts in the commit_creds() because this function cannot fail and it should always return 0. For this reason, we modify cred.ucounts before calling the commit_creds(). Changelog v6: * Fix null-ptr-deref in is_ucounts_overlimit() detected by trinity. This error was caused by the fact that cred_alloc_blank() left the ucounts pointer empty. Reported-by: kernel test robot Signed-off-by: Alexey Gladkov Link: https://lkml.kernel.org/r/b37aaef28d8b9b0d757e07ba6dd27281bbe39259.1619094428.git.leg...@kernel.org Signed-off-by: Eric W. Biederman Signed-off-by: Wenlin Kang --- fs/exec.c | 4 include/linux/cred.h | 2 ++ include/linux/user_namespace.h | 4 kernel/cred.c | 40 ++ kernel/fork.c | 6 + kernel/sys.c | 12 ++ kernel/ucount.c| 40 +++--- kernel/user_namespace.c| 3 +++ 8 files changed, 108 insertions(+), 3 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index d1a2467c0532..f5eefcbe72ab 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1357,6 +1357,10 @@ int begin_new_exec(struct linux_binprm * bprm) WRITE_ONCE(me->self_exec_id, me->self_exec_id + 1); flush_signal_handlers(me, 0); + retval = set_cred_ucounts(bprm->cred); + if (retval < 0) + goto out_unlock; + /* * install the new credentials for this executable */ diff --git a/include/linux/cred.h b/include/linux/cred.h index 18639c069263..ad160e5fe5c6 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -144,6 +144,7 @@ struct cred { #endif struct user_struct *user; /* real user ID subscription */ struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ + struct ucounts *ucounts; struct group_info *group_info; /* supplementary groups for euid/fsgid */ /* RCU deletion */ union { @@ -170,6 +171,7 @@ extern int set_security_override_from_ctx(struct cred *, const char *); extern int set_create_files_as(struct cred *, struct inode *); extern int cred_fscmp(const struct cred *, const struct cred *); extern void __init cred_init(void); +extern int set_cred_ucounts(struct cred *); /* * check for validity of credentials diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index 7616c7bf4b24..e1bd560da1cd 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -101,11 +101,15 @@ struct ucounts { }; extern struct user_namespace init_user_ns; +extern struct ucounts init_ucounts; bool setup_userns_sysctls(struct user_namespace *ns); void retire_userns_sysctls(struct user_namespace *ns); struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, enum ucount_type type); void dec_ucount(struct ucounts *ucounts, enum ucount_type type); +struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid); +struct ucounts *get_ucounts(struct ucounts *ucounts); +void put_ucounts(struct ucounts *ucounts); #ifdef CONFIG_USER_NS diff --git a/kernel/cred.c b/kernel/cred.c index 421b1149c651..58a8a9e24347 100644 --- a/kernel/cred.c +++ b/kernel/cred.c @@ -60,6 +60,7 @@ struct cred init_cred = { .user = INIT_USER, .user_ns= _user_ns, .group_info = _groups, + .ucounts= _ucounts, }; static inline void set_cred_subscribers(struct cred *cred, int n) @@ -119,6 +120,8 @@ static void put_cred_rcu(struct rcu_head *rcu) if (cred->group_info) put_group_info(cred->group_info); free_uid(cred->user); + if (cred->ucounts) + put_ucounts(cred->ucounts); put_user_ns(cred->user_ns); kmem_cache_free(cred_jar, cred); } @@ -222,6 +225,7 @@ struct cred *cred_alloc_blank(void) #ifdef CONFIG_DEBUG_CREDENTIALS new->magic = CRED_MAGIC; #endif + new->ucounts = get_ucounts(_ucounts); if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) goto error; @@ -284,6 +288,11 @@ struct cred *prepare_creds(void) if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) goto error; + + new->ucounts = get_ucounts(new->ucounts); + if (!new->ucounts) +
[linux-yocto] [PATCH 35/46] arm64: dts: intel: add device tree for n6000
From: Matthew Gerlach commit 6a288fb74cd186802c3f2e44eab0d318e19a668f from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 22511e665eadc2c49021886d07aaef39db90ca82] Add a device tree for the n6000 instantiation of Agilex Hard Processor System (HPS). Signed-off-by: Matthew Gerlach Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- arch/arm64/boot/dts/intel/Makefile| 3 +- .../boot/dts/intel/socfpga_agilex_n6000.dts | 66 +++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/intel/socfpga_agilex_n6000.dts diff --git a/arch/arm64/boot/dts/intel/Makefile b/arch/arm64/boot/dts/intel/Makefile index 16c0ef45562a..539f3aa8f369 100644 --- a/arch/arm64/boot/dts/intel/Makefile +++ b/arch/arm64/boot/dts/intel/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only -dtb-$(CONFIG_ARCH_AGILEX) += socfpga_agilex_socdk.dtb \ +dtb-$(CONFIG_ARCH_AGILEX) += socfpga_agilex_n6000.dtb \ +socfpga_agilex_socdk.dtb \ socfpga_agilex_socdk_nand.dtb dtb-$(CONFIG_ARCH_KEEMBAY) += keembay-evm.dtb dtb-$(CONFIG_ARCH_N5X) += socfpga_n5x_socdk.dtb diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex_n6000.dts b/arch/arm64/boot/dts/intel/socfpga_agilex_n6000.dts new file mode 100644 index ..6231a69204b1 --- /dev/null +++ b/arch/arm64/boot/dts/intel/socfpga_agilex_n6000.dts @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021-2022, Intel Corporation + */ +#include "socfpga_agilex.dtsi" + +/ { + model = "SoCFPGA Agilex n6000"; + compatible = "intel,socfpga-agilex-n6000", "intel,socfpga-agilex"; + + aliases { + serial0 = + serial1 = + ethernet0 = + ethernet1 = + ethernet2 = + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + /* We expect the bootloader to fill in the reg */ + reg = <0 0 0 0>; + }; + + soc { + bus@8000 { + compatible = "simple-bus"; + reg = <0x8000 0x6000>, + <0xf900 0x0010>; + reg-names = "axi_h2f", "axi_h2f_lw"; + #address-cells = <2>; + #size-cells = <1>; + ranges = <0x 0x 0xf900 0x1000>; + + dma-controller@0 { + compatible = "intel,hps-copy-engine"; + reg = <0x 0x 0x1000>; + #dma-cells = <1>; + }; + }; + }; +}; + + { + clock-frequency = <2500>; +}; + + { + status = "okay"; +}; + + { + status = "okay"; +}; + + { + status = "okay"; +}; + +_mgr { + status = "disabled"; +}; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12537): https://lists.yoctoproject.org/g/linux-yocto/message/12537 Mute This Topic: https://lists.yoctoproject.org/mt/98898778/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 30/46] HSD #14014656595: drivers: net: phy: add qsfp_phy support
From: NagarajuDeepakX commit b9927cdeeb591cacbd31206530d54a98ce08207f from https://github.com/altera-opensource/linux-socfpga.git This patch adds qsfp_phy support to the E-Tile Ethernet controller. Signed-off-by: NagarajuDeepakX Signed-off-by: Wenlin Kang --- drivers/net/phy/Kconfig|8 + drivers/net/phy/Makefile |4 + drivers/net/phy/qsfp.c | 1848 drivers/net/phy/qsfp_bus.c | 782 +++ include/linux/qsfp.h | 400 5 files changed, 3042 insertions(+) create mode 100644 drivers/net/phy/qsfp.c create mode 100644 drivers/net/phy/qsfp_bus.c create mode 100644 include/linux/qsfp.h diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 698bea312adc..4833e817bb98 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -63,6 +63,14 @@ config SFP comment "MII PHY device drivers" +config QSFP + tristate "QSFP cage support" + depends on I2C && PHYLINK + depends on HWMON || HWMON=n + select MDIO_I2C + +comment "MII PHY device drivers" + config AMD_PHY tristate "AMD PHYs" help diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index a13e402074cf..f3dd5cd88451 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -30,6 +30,10 @@ obj-$(CONFIG_SFP)+= sfp.o sfp-obj-$(CONFIG_SFP) += sfp-bus.o obj-y += $(sfp-obj-y) $(sfp-obj-m) +obj-$(CONFIG_QSFP) += qsfp.o +qsfp-obj-$(CONFIG_QSFP)+= qsfp_bus.o +obj-y += $(qsfp-obj-y) $(qsfp-obj-m) + obj-$(CONFIG_ADIN_PHY) += adin.o obj-$(CONFIG_AMD_PHY) += amd.o aquantia-objs += aquantia_main.o diff --git a/drivers/net/phy/qsfp.c b/drivers/net/phy/qsfp.c new file mode 100644 index ..c0f1f8953d6c --- /dev/null +++ b/drivers/net/phy/qsfp.c @@ -0,0 +1,1848 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "swphy.h" + +static u8 previous_state = 1; +static struct qsfp *qsfp; +static void qsfp_sm_event(struct qsfp *qsfp, unsigned int event); +static void get_module_revision(struct qsfp *qsfp); + +#define QSFP_TX_CHANNEL_4 0x4 +#define QSFP_TX_CHANNEL_3 0x3 +#define QSFP_TX_CHANNEL_2 0x2 +#define QSFP_TX_CHANNEL_1 0x1 +#define QSFP_RX_CHANNEL_4 0x4 +#define QSFP_RX_CHANNEL_3 0x3 +#define QSFP_RX_CHANNEL_2 0x2 +#define QSFP_RX_CHANNEL_1 0x1 + +enum { + GPIO_MODULE_PRESENT, + GPIO_MODULE_INTERRUPT, + GPIO_MODULE_INIT_MODE, + GPIO_MODULE_RESET, + GPIO_MODULE_SELECT, + GPIO_MAX, + + QSFP_F_PRESENT = BIT(GPIO_MODULE_PRESENT), + QSFP_INTERRUPT = BIT(GPIO_MODULE_INTERRUPT), + QSFP_INIT = BIT(GPIO_MODULE_INIT_MODE), + QSFP_RESET = BIT(GPIO_MODULE_RESET), + QSFP_SELECT = BIT(GPIO_MODULE_SELECT), + + QSFP_E_INSERT = 0, + QSFP_E_REMOVE, + QSFP_E_DEV_ATTACH, + QSFP_E_DEV_DETACH, + QSFP_E_DEV_DOWN, + QSFP_E_DEV_UP, + QSFP_E_TX_FAULT, + QSFP_E_TX_CLEAR, + QSFP_E_TX_LOS, + QSFP_E_RX_LOS, + QSFP_E_TIMEOUT, + + QSFP_MOD_EMPTY = 0, + QSFP_MOD_ERROR, + QSFP_MOD_PROBE, + QSFP_MOD_WAITDEV, + QSFP_MOD_HPOWER, + QSFP_MOD_WAITPWR, + QSFP_MOD_PRESENT, + + QSFP_DEV_DETACHED = 0, + QSFP_DEV_DOWN, + QSFP_DEV_UP, + + QSFP_S_DOWN = 0, + QSFP_S_FAIL, + QSFP_S_WAIT, + QSFP_S_INIT, + QSFP_S_INIT_PHY, + QSFP_S_INIT_TX_FAULT, + QSFP_S_WAIT_LOS, + QSFP_S_LINK_UP, + QSFP_S_TX_FAULT, + QSFP_S_REINIT, + QSFP_S_TX_DISABLE, +}; + +static const char *const mod_state_strings[] = { + [QSFP_MOD_EMPTY] = "empty", [QSFP_MOD_ERROR] = "error", + [QSFP_MOD_PROBE] = "probe", [QSFP_MOD_WAITDEV] = "waitdev", + [QSFP_MOD_HPOWER] = "hpower", [QSFP_MOD_WAITPWR] = "waitpwr", + [QSFP_MOD_PRESENT] = "present", +}; + +static const char *mod_state_to_str(unsigned short mod_state) +{ + if (mod_state >= ARRAY_SIZE(mod_state_strings)) + return "Unknown module state"; + return mod_state_strings[mod_state]; +} + +static const char *const dev_state_strings[] = { + [QSFP_DEV_DETACHED] = "detached", + [QSFP_DEV_DOWN] = "down", + [QSFP_DEV_UP] = "up", +}; + +static const char *dev_state_to_str(unsigned short dev_state) +{ + if (dev_state >= ARRAY_SIZE(dev_state_strings)) + return "Unknown device state"; + return dev_state_strings[dev_state]; +} + +static const char *const event_strings[] = { + [QSFP_E_INSERT] = "insert", [QSFP_E_REMOVE] = "remove", + [QSFP_E_DEV_ATTACH] = "dev_attach", [QSFP_E_DEV_DETACH] = "dev_detach", +
[linux-yocto] [PATCH 36/46] ucount: Make get_ucount a safe get_user replacement
From: "Eric W. Biederman" commit 61956630e41032f05c1e95e85f715c8f317304b1 from https://github.com/altera-opensource/linux-socfpga.git [upstream commit f9d87929d451d3e649699d0f1d74f71f77ad38f5] When the ucount code was refactored to create get_ucount it was missed that some of the contexts in which a rlimit is kept elevated can be the only reference to the user/ucount in the system. Ordinary ucount references exist in places that also have a reference to the user namspace, but in POSIX message queues, the SysV shm code, and the SIGPENDING code there is no independent user namespace reference. Inspection of the the user_namespace show no instance of circular references between struct ucounts and the user_namespace. So hold a reference from struct ucount to i's user_namespace to resolve this problem. Link: https://lore.kernel.org/lkml/yzv7z+yxbsx9p...@fixkernel.com/ Reported-by: Qian Cai Reported-by: Mathias Krause Tested-by: Mathias Krause Reviewed-by: Mathias Krause Reviewed-by: Alexey Gladkov Fixes: d64696905554 ("Reimplement RLIMIT_SIGPENDING on top of ucounts") Fixes: 6e52a9f0532f ("Reimplement RLIMIT_MSGQUEUE on top of ucounts") Fixes: d7c9e99aee48 ("Reimplement RLIMIT_MEMLOCK on top of ucounts") Cc: sta...@vger.kernel.org Signed-off-by: "Eric W. Biederman" Signed-off-by: Wenlin Kang --- kernel/ucount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/ucount.c b/kernel/ucount.c index 11b1596e2542..e0d095ef8a52 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -150,6 +150,7 @@ static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid) } else { hlist_add_head(>node, hashent); ucounts = new; + get_user_ns(new->ns); } } if (ucounts->count == INT_MAX) @@ -173,6 +174,7 @@ static void put_ucounts(struct ucounts *ucounts) spin_unlock_irqrestore(_lock, flags); kfree(ucounts); + put_user_ns(ucounts->ns); } static inline bool atomic_inc_below(atomic_t *v, int u) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12538): https://lists.yoctoproject.org/g/linux-yocto/message/12538 Mute This Topic: https://lists.yoctoproject.org/mt/98898779/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 32/46] HSD #1509151525: fpga: altera-cvp: Truncated bitstream error support
From: Ang Tien Sung commit 2a87237bcd66d2f79235bcc905c2ca9ce8ff77c1 from https://github.com/altera-opensource/linux-socfpga.git To support the error handling of a truncated bitstream sent. The current AIB CvP firmware is not capable of handling a data stream smaller than 4096bytes. The firmware's limitation causes a hung-up as it's DMA engine waits forever for the completion of the instructed 4096bytes. To resolve this design limitation, both firmware and CvP driver made several changes. At the CvP driver, we just have to ensure that anything lesser than 4096bytes are padded with extra bytes. The CvP will then, initiate the tear-down by clearing the START_XFER and CVP_CONFIG bits. We should also check for CVP_ERROR during the CvP completion. A send_buf which is always 4096bytes is used to copy the data during every transaction. Signed-off-by: Ang Tien Sung Signed-off-by: Wenlin Kang --- drivers/fpga/altera-cvp.c | 24 +++- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c index 311bb6f5e4ac..8977ccd49e4c 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c @@ -81,6 +81,7 @@ struct altera_cvp_conf { u8 numclks; u32 sent_packets; u32 vsec_offset; + u8 *send_buf; const struct cvp_priv *priv; }; @@ -465,7 +466,11 @@ static int altera_cvp_write(struct fpga_manager *mgr, const char *buf, } len = min(conf->priv->block_size, remaining); - altera_cvp_send_block(conf, data, len); + /* Copy the requested host data into the transmit buffer */ + + memcpy(conf->send_buf, data, len); + altera_cvp_send_block(conf, (const u32 *)conf->send_buf, + conf->priv->block_size); data += len / sizeof(u32); done += len; remaining -= len; @@ -504,10 +509,13 @@ static int altera_cvp_write_complete(struct fpga_manager *mgr, if (ret) return ret; - /* STEP 16 - check CVP_CONFIG_ERROR_LATCHED bit */ - altera_read_config_dword(conf, VSE_UNCOR_ERR_STATUS, ); - if (val & VSE_UNCOR_ERR_CVP_CFG_ERR) { - dev_err(>dev, "detected CVP_CONFIG_ERROR_LATCHED!\n"); + /* +* STEP 16 - If bitstream error (truncated/miss-matched), +* we shall exit here. +*/ + ret = altera_read_config_dword(conf, VSE_CVP_STATUS, ); + if (ret || (val & VSE_CVP_STATUS_CFG_ERR)) { + dev_err(>dev, "CVP_CONFIG_ERROR!\n"); return -EPROTO; } @@ -677,6 +685,12 @@ static int altera_cvp_probe(struct pci_dev *pdev, if (ret) goto err_unmap; + /* Allocate the 4096 block size transmit buffer */ + conf->send_buf = devm_kzalloc(>dev, conf->priv->block_size, GFP_KERNEL); + if (!conf->send_buf) { + ret = -ENOMEM; + goto err_unmap; + } return 0; err_unmap: -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12533): https://lists.yoctoproject.org/g/linux-yocto/message/12533 Mute This Topic: https://lists.yoctoproject.org/mt/98898774/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 33/46] dt-bindings: soc: add bindings for Intel HPS Copy Engine
From: Matthew Gerlach commit aa1a83f84f199623e2926e6ca876402d40fde191 from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 79af73b31ab281277cec8f5d102364b9c64588c1] Add device tree bindings documentation for the Intel Hard Processor System (HPS) Copy Engine. Signed-off-by: Matthew Gerlach Reviewed-by: Krzysztof Kozlowski Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- .../soc/intel/intel,hps-copy-engine.yaml | 51 +++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/intel/intel,hps-copy-engine.yaml diff --git a/Documentation/devicetree/bindings/soc/intel/intel,hps-copy-engine.yaml b/Documentation/devicetree/bindings/soc/intel/intel,hps-copy-engine.yaml new file mode 100644 index ..8634865015cd --- /dev/null +++ b/Documentation/devicetree/bindings/soc/intel/intel,hps-copy-engine.yaml @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright (C) 2022, Intel Corporation +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/soc/intel/intel,hps-copy-engine.yaml#; +$schema: "http://devicetree.org/meta-schemas/core.yaml#; + +title: Intel HPS Copy Engine + +maintainers: + - Matthew Gerlach + +description: | + The Intel Hard Processor System (HPS) Copy Engine is an IP block used to copy + a bootable image from host memory to HPS DDR. Additionally, there is a + register the HPS can use to indicate the state of booting the copied image as + well as a keep-a-live indication to the host. + +properties: + compatible: +const: intel,hps-copy-engine + + '#dma-cells': +const: 1 + + reg: +maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | +bus@8000 { +compatible = "simple-bus"; +reg = <0x8000 0x6000>, + <0xf900 0x0010>; +reg-names = "axi_h2f", "axi_h2f_lw"; +#address-cells = <2>; +#size-cells = <1>; +ranges = <0x 0x 0xf900 0x1000>; + +dma-controller@0 { +compatible = "intel,hps-copy-engine"; +reg = <0x 0x 0x1000>; +#dma-cells = <1>; +}; +}; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12534): https://lists.yoctoproject.org/g/linux-yocto/message/12534 Mute This Topic: https://lists.yoctoproject.org/mt/98898775/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 34/46] dt-bindings: intel: add binding for Intel n6000
From: Matthew Gerlach commit d84d4368c18cd7632460e037ee4f72303c59ec8b from https://github.com/altera-opensource/linux-socfpga.git [upstream commit af657d7f40423bac0c898e0d89a3539ea0d1043a] Add the binding string for the Agilex based Intel n6000 board. Signed-off-by: Matthew Gerlach Acked-by: Krzysztof Kozlowski Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- .../bindings/arm/intel,socfpga.yaml | 27 +++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/intel,socfpga.yaml diff --git a/Documentation/devicetree/bindings/arm/intel,socfpga.yaml b/Documentation/devicetree/bindings/arm/intel,socfpga.yaml new file mode 100644 index ..61a454a40e87 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/intel,socfpga.yaml @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/intel,socfpga.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel SoCFPGA platform device tree bindings + +maintainers: + - Dinh Nguyen + +properties: + $nodename: +const: "/" + compatible: +oneOf: + - description: AgileX boards +items: + - enum: + - intel,n5x-socdk + - intel,socfpga-agilex-n6000 + - intel,socfpga-agilex-socdk + - const: intel,socfpga-agilex + +additionalProperties: true + +... -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12535): https://lists.yoctoproject.org/g/linux-yocto/message/12535 Mute This Topic: https://lists.yoctoproject.org/mt/98898776/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 31/46] HSD #18019805663: mtd: spi-nor: issi: Add IS25WP512 device
From: Niravkumar L Rabara commit b54afecbad98ecec0cb0c18f27cbff73c867a66f from https://github.com/altera-opensource/linux-socfpga.git Add is25wp512 info to spi_nor_ids[] table entry. Rename is25lp256_post_bfpt_fixups to is_post_bfpt_fixups as a common function for all is25xx post_bfpt fixups. Signed-off-by: Niravkumar L Rabara Signed-off-by: Wenlin Kang --- drivers/mtd/spi-nor/issi.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c index ffcb60e54a80..9cbb5bf9a1fb 100644 --- a/drivers/mtd/spi-nor/issi.c +++ b/drivers/mtd/spi-nor/issi.c @@ -9,27 +9,31 @@ #include "core.h" static int -is25lp256_post_bfpt_fixups(struct spi_nor *nor, +is25_post_bfpt_fixups(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt, struct spi_nor_flash_parameter *params) { /* -* IS25LP256 supports 4B opcodes, but the BFPT advertises a -* BFPT_DWORD1_ADDRESS_BYTES_3_ONLY address width. +* IS25XX256 & IS25XX512 supports 4B opcodes, +* but the BFPT advertises BFPT_DWORD1_ADDRESS_BYTES_3_ONLY and +* BFPT_DWORD1_ADDRESS_BYTES_3_OR_4 address width repectively. * Overwrite the address width advertised by the BFPT. */ - if ((bfpt->dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) == - BFPT_DWORD1_ADDRESS_BYTES_3_ONLY) + if (((bfpt->dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) == + BFPT_DWORD1_ADDRESS_BYTES_3_ONLY) || + ((bfpt->dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) == + BFPT_DWORD1_ADDRESS_BYTES_3_OR_4)) nor->addr_width = 4; return 0; } -static struct spi_nor_fixups is25lp256_fixups = { - .post_bfpt = is25lp256_post_bfpt_fixups, +static struct spi_nor_fixups is25_fixups = { + .post_bfpt = is25_post_bfpt_fixups, }; + static const struct flash_info issi_parts[] = { /* ISSI */ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, @@ -48,7 +52,7 @@ static const struct flash_info issi_parts[] = { { "is25lp256", INFO(0x9d6019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) - .fixups = _fixups }, + .fixups = _fixups }, { "is25wp032", INFO(0x9d7016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "is25wp064", INFO(0x9d7017, 0, 64 * 1024, 128, @@ -58,7 +62,12 @@ static const struct flash_info issi_parts[] = { { "is25wp256", INFO(0x9d7019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) - .fixups = _fixups }, + .fixups = _fixups }, + { "is25wp512", INFO(0x9d701a, 0, 64 * 1024, 1024, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | + SPI_NOR_4B_OPCODES) + .fixups = _fixups }, + /* PMC */ { "pm25lv512", INFO(0,0, 32 * 1024,2, SECT_4K_PMC) }, -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12532): https://lists.yoctoproject.org/g/linux-yocto/message/12532 Mute This Topic: https://lists.yoctoproject.org/mt/98898773/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 26/46] HSD #15010832611: firmware: stratix10-rsu: query spt addresses
From: Radu Bacrau commit ff347243f1a1c3927ba2ea1d9c30348c3939cd51 from https://github.com/altera-opensource/linux-socfpga.git Extend Intel Remote System Update (RSU) driver to get SPT (Sub-Partition Table) addresses. Signed-off-by: Radu Bacrau Signed-off-by: Wenlin Kang --- drivers/firmware/stratix10-rsu.c | 98 1 file changed, 98 insertions(+) diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c index a338222aac8a..7a031e904dbf 100644 --- a/drivers/firmware/stratix10-rsu.c +++ b/drivers/firmware/stratix10-rsu.c @@ -34,6 +34,10 @@ #define INVALID_RETRY_COUNTER 0xFF #define INVALID_DCMF_VERSION 0xFF #define INVALID_DCMF_STATUS0x +#define INVALID_SPT_ADDRESS0x0 + +#define RSU_GET_SPT_CMD0x5A +#define RSU_GET_SPT_RESP_LEN (4 * sizeof(unsigned int)) typedef void (*rsu_callback)(struct stratix10_svc_client *client, struct stratix10_svc_cb_data *data); @@ -59,6 +63,9 @@ typedef void (*rsu_callback)(struct stratix10_svc_client *client, * @dcmf_status.dcmf3: dcmf3 status * @retry_counter: the current image's retry counter * @max_retry: the preset max retry value + * @spt0_address: address of spt0 + * @spt1_address: address of spt1 + * @get_spt_response_buf: response from sdm for get_spt command */ struct stratix10_rsu_priv { struct stratix10_svc_chan *chan; @@ -90,6 +97,11 @@ struct stratix10_rsu_priv { unsigned int retry_counter; unsigned int max_retry; + + unsigned long spt0_address; + unsigned long spt1_address; + + unsigned int *get_spt_response_buf; }; /** @@ -259,6 +271,36 @@ static void rsu_dcmf_status_callback(struct stratix10_svc_client *client, complete(>completion); } +static void rsu_get_spt_callback(struct stratix10_svc_client *client, +struct stratix10_svc_cb_data *data) +{ + struct stratix10_rsu_priv *priv = client->priv; + unsigned long *mbox_err = (unsigned long *)data->kaddr1; + unsigned long *resp_len = (unsigned long *)data->kaddr2; + + if ((data->status != BIT(SVC_STATUS_OK)) || (*mbox_err) || + (*resp_len != RSU_GET_SPT_RESP_LEN)) + goto error; + + priv->spt0_address = priv->get_spt_response_buf[0]; + priv->spt0_address <<= 32; + priv->spt0_address |= priv->get_spt_response_buf[1]; + + priv->spt1_address = priv->get_spt_response_buf[2]; + priv->spt1_address <<= 32; + priv->spt1_address |= priv->get_spt_response_buf[3]; + + goto complete; + +error: + dev_err(client->dev, "failed to get SPTs\n"); + +complete: + stratix10_svc_free_memory(priv->chan, priv->get_spt_response_buf); + priv->get_spt_response_buf = NULL; + complete(>completion); +} + /** * rsu_send_msg() - send a message to Intel service layer * @priv: pointer to rsu private data @@ -288,6 +330,14 @@ static int rsu_send_msg(struct stratix10_rsu_priv *priv, if (arg) msg.arg[0] = arg; + if (command == COMMAND_MBOX_SEND_CMD) { + msg.arg[1] = 0; + msg.payload = NULL; + msg.payload_length = 0; + msg.payload_output = priv->get_spt_response_buf; + msg.payload_length_output = RSU_GET_SPT_RESP_LEN; + } + ret = stratix10_svc_send(priv->chan, ); if (ret < 0) goto status_done; @@ -571,6 +621,34 @@ static ssize_t notify_store(struct device *dev, return count; } +static ssize_t spt0_address_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct stratix10_rsu_priv *priv = dev_get_drvdata(dev); + + if (!priv) + return -ENODEV; + + if (priv->spt0_address == INVALID_SPT_ADDRESS) + return -EIO; + + return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address); +} + +static ssize_t spt1_address_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct stratix10_rsu_priv *priv = dev_get_drvdata(dev); + + if (!priv) + return -ENODEV; + + if (priv->spt1_address == INVALID_SPT_ADDRESS) + return -EIO; + + return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address); +} + static DEVICE_ATTR_RO(current_image); static DEVICE_ATTR_RO(fail_image); static DEVICE_ATTR_RO(state); @@ -589,6 +667,8 @@ static DEVICE_ATTR_RO(dcmf2_status); static DEVICE_ATTR_RO(dcmf3_status); static DEVICE_ATTR_WO(reboot_image); static DEVICE_ATTR_WO(notify); +static DEVICE_ATTR_RO(spt0_address); +static DEVICE_ATTR_RO(spt1_address); static struct attribute *rsu_attrs[] = { _attr_current_image.attr, @@ -609,6 +689,8 @@ static struct attribute *rsu_attrs[] = { _attr_dcmf3_status.attr,
[linux-yocto] [PATCH 29/46] HSD #22012268110: net: ethernet: altera: E-Tile fixed link implementation
From: "Tham, Mun Yew" commit 932869aa5d80cf9aebb672f1096e1d09a7b8d92e from https://github.com/altera-opensource/linux-socfpga.git This patch implements fixed link device tree binding handling at the E-Tile ethernet MAC driver as the E-Tile ethernet MAC is not connected to a normal MDIO-managed PHY device. Signed-off-by: Tham, Mun Yew Signed-off-by: Wenlin Kang --- .../net/ethernet/altera/intel_fpga_etile.h| 632 -- .../ethernet/altera/intel_fpga_etile_fec.c| 85 ++- .../ethernet/altera/intel_fpga_etile_main.c | 386 +++ 3 files changed, 737 insertions(+), 366 deletions(-) diff --git a/drivers/net/ethernet/altera/intel_fpga_etile.h b/drivers/net/ethernet/altera/intel_fpga_etile.h index cdc22fdc363a..ed1730517336 100644 --- a/drivers/net/ethernet/altera/intel_fpga_etile.h +++ b/drivers/net/ethernet/altera/intel_fpga_etile.h @@ -550,10 +550,14 @@ /* 0x40B: TX MAC EHIP configuration */ #define ETH_TX_MAC_EHIP_CONF_EN_PP BIT(0) #define ETH_TX_MAC_EHIP_CONF_IPG (0x3 << 1) -#define ETH_TX_MAC_EHIP_CONF_AM_WIDTH (0x7 << 3) -#define ETH_TX_MAC_EHIP_CONF_FLOWREG (0x7 << 6) +#define ETH_TX_MAC_EHIP_CONF_AM_WIDTH_25G (0x4 << 3) +#define ETH_TX_MAC_EHIP_CONF_AM_WIDTH_10G (0x1 << 3) +#define ETH_TX_MAC_EHIP_CONF_FLOWREG_25G (0x3 << 6) +#define ETH_TX_MAC_EHIP_CONF_FLOWREG_10G (0x4 << 6) #define ETH_TX_MAC_EHIP_CONF_CRC_ENBIT(9) #define ETH_TX_MAC_EHIP_CONF_AM_PERIOD (0x1FFF << 15) +#define ETH_TX_MAC_EHIP_CONF_AM_25G_FEC (0x13FFF << 15) +#define ETH_TX_MAC_EHIP_CONF_AM_25G(0x13FFC << 15) /* 0x40C: TX MAC source address lower bytes */ #define ETH_TX_MAC_LOW_BYTES 0x @@ -1558,6 +1562,9 @@ #define XCVR_PMA_CTRL_STAT_RCP_LOAD_TIMEOUTBIT(1) #define XCVR_PMA_CTRL_STAT_RCP_LOAD_BUSY BIT(2) +#define INTEL_FPGA_BYTE_ALIGN 8 +#define INTEL_FPGA_WORD_ALIGN 32 + /* Ethernet Reconfiguration Interface Register Base Addresses * Word Offset Register Type * 0x0B0-0x0E8 Auto Negotiation and Link Training registers @@ -1615,7 +1622,8 @@ struct intel_fpga_etile_eth_phy { u32 phy_scratch;//0x301 u32 reserved_302[11]; //0x302-0x30C u32 phy_loopback; //0x30D - u32 reserved_30e[2];//0x30E-0x30F + u32 phy_rx_pcs_align; //0x30E + u32 reserved_30f; //0x30F u32 phy_config; //0x310 u32 reserved_311[16]; //0x311-0x320 u32 phy_cdr_pll_locked; //0x321 @@ -1970,205 +1978,413 @@ struct intel_fpga_etile_eth_1588_ptp { * 0x000-0x2FF TX and RX RS-FEC */ struct intel_fpga_etile_rsfec { - u32 reserved_0[4]; //0x000-0x003 - u32 rsfec_top_clk_cfg; //0x004 - u32 reserved_5[11]; //0x005-0x00F - u32 rsfec_top_tx_cfg; //0x010 - u32 reserved_11[3]; //0x011-0x013 - u32 rsfec_top_rx_cfg; //0x014 - u32 reserved_15[11];//0x015-0x01F - u32 tx_aib_dsk_conf;//0x020 - u32 reserved_21[15];//0x021-0x02F - u32 rsfec_core_cfg; //0x030 - u32 reserved_31[15];//0x031-0x03F - u32 rsfec_lane_cfg_0; //0x040 - u32 reserved_41[3]; //0x041-0x043 - u32 rsfec_lane_cfg_1; //0x044 - u32 reserved_45[3]; //0x45-0x047 - u32 rsfec_lane_cfg_2; //0x048 - u32 reserved_49[3]; //0x049-0x04B - u32 rsfec_lane_cfg_3; //0x04C - u32 reserved_4d[183]; //0x04D-0x103 - u32 tx_aib_dsk_status; //0x104 - u32 reserved_105[3];//0x105-0x107 - u32 rsfec_debug_cfg;//0x108 - u32 reserved_109[23]; //0x109-0x11F - u32 rsfec_lane_tx_stat_0; //0x120 - u32 reserved_121[3];//0x121-0x123 - u32 rsfec_lane_tx_stat_1; //0x124 - u32 reserved_125[3];//0x125-0x127 - u32
[linux-yocto] [PATCH 28/46] jbd2: fix use-after-free of transaction_t race
From: Ritesh Harjani commit 9032f97796fe8d3d98d8f6cc19919458f7cb4aec from https://github.com/altera-opensource/linux-socfpga.git [upstream commit cc16eecae687912238ee6efbff71ad31e2bc414e] jbd2_journal_wait_updates() is called with j_state_lock held. But if there is a commit in progress, then this transaction might get committed and freed via jbd2_journal_commit_transaction() -> jbd2_journal_free_transaction(), when we release j_state_lock. So check for journal->j_running_transaction everytime we release and acquire j_state_lock to avoid use-after-free issue. Link: https://lore.kernel.org/r/948c2fed518ae739db6a8f7f83f1d58b504f87d0.1644497105.git.ritesh.l...@gmail.com Fixes: 4f98186848707f53 ("jbd2: refactor wait logic for transaction updates into a common function") Cc: sta...@kernel.org Reported-and-tested-by: syzbot+afa2ca5171d93e44b...@syzkaller.appspotmail.com Reviewed-by: Jan Kara Signed-off-by: Ritesh Harjani Signed-off-by: Theodore Ts'o Signed-off-by: Wenlin Kang --- fs/jbd2/transaction.c | 41 + 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index a45abacc4cde..cdde08636b0a 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -825,27 +825,38 @@ EXPORT_SYMBOL(jbd2_journal_restart); */ void jbd2_journal_wait_updates(journal_t *journal) { - transaction_t *commit_transaction = journal->j_running_transaction; + DEFINE_WAIT(wait); - if (!commit_transaction) - return; + while (1) { + /* +* Note that the running transaction can get freed under us if +* this transaction is getting committed in +* jbd2_journal_commit_transaction() -> +* jbd2_journal_free_transaction(). This can only happen when we +* release j_state_lock -> schedule() -> acquire j_state_lock. +* Hence we should everytime retrieve new j_running_transaction +* value (after j_state_lock release acquire cycle), else it may +* lead to use-after-free of old freed transaction. +*/ + transaction_t *transaction = journal->j_running_transaction; - spin_lock(_transaction->t_handle_lock); - while (atomic_read(_transaction->t_updates)) { - DEFINE_WAIT(wait); + if (!transaction) + break; + spin_lock(>t_handle_lock); prepare_to_wait(>j_wait_updates, , - TASK_UNINTERRUPTIBLE); - if (atomic_read(_transaction->t_updates)) { - spin_unlock(_transaction->t_handle_lock); - write_unlock(>j_state_lock); - schedule(); - write_lock(>j_state_lock); - spin_lock(_transaction->t_handle_lock); + TASK_UNINTERRUPTIBLE); + if (!atomic_read(>t_updates)) { + spin_unlock(>t_handle_lock); + finish_wait(>j_wait_updates, ); + break; } + spin_unlock(>t_handle_lock); + write_unlock(>j_state_lock); + schedule(); finish_wait(>j_wait_updates, ); + write_lock(>j_state_lock); } - spin_unlock(_transaction->t_handle_lock); } /** @@ -860,8 +871,6 @@ void jbd2_journal_wait_updates(journal_t *journal) */ void jbd2_journal_lock_updates(journal_t *journal) { - DEFINE_WAIT(wait); - jbd2_might_wait_for_commit(journal); write_lock(>j_state_lock); -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12530): https://lists.yoctoproject.org/g/linux-yocto/message/12530 Mute This Topic: https://lists.yoctoproject.org/mt/98898767/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 27/46] jbd2: refactor wait logic for transaction updates into a common function
From: Ritesh Harjani commit 8e9aa9142bfe3820eb60021a403472516e81ed2b from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 4f98186848707f530669238d90e0562d92a78aab] No functionality change as such in this patch. This only refactors the common piece of code which waits for t_updates to finish into a common function named as jbd2_journal_wait_updates(journal_t *) Signed-off-by: Ritesh Harjani Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/8c564f70f4b2591171677a2a74fccb22a7b6c3a4.1642416995.git.rite...@linux.ibm.com Signed-off-by: Theodore Ts'o Signed-off-by: Wenlin Kang --- fs/jbd2/commit.c | 19 +++- fs/jbd2/transaction.c | 53 ++- include/linux/jbd2.h | 7 +- 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index fa24b407a9dc..085b46703d37 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -484,22 +484,9 @@ void jbd2_journal_commit_transaction(journal_t *journal) stats.run.rs_running = jbd2_time_diff(commit_transaction->t_start, stats.run.rs_locked); - spin_lock(_transaction->t_handle_lock); - while (atomic_read(_transaction->t_updates)) { - DEFINE_WAIT(wait); + // waits for any t_updates to finish + jbd2_journal_wait_updates(journal); - prepare_to_wait(>j_wait_updates, , - TASK_UNINTERRUPTIBLE); - if (atomic_read(_transaction->t_updates)) { - spin_unlock(_transaction->t_handle_lock); - write_unlock(>j_state_lock); - schedule(); - write_lock(>j_state_lock); - spin_lock(_transaction->t_handle_lock); - } - finish_wait(>j_wait_updates, ); - } - spin_unlock(_transaction->t_handle_lock); commit_transaction->t_state = T_SWITCH; J_ASSERT (atomic_read(_transaction->t_outstanding_credits) <= @@ -819,7 +806,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) commit_transaction->t_state = T_COMMIT_DFLUSH; write_unlock(>j_state_lock); - /* + /* * If the journal is not located on the file system device, * then we must flush the file system device before we issue * the commit record diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 1923528154b5..a45abacc4cde 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -432,7 +432,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle, } /* OK, account for the buffers that this operation expects to -* use and add the handle to the running transaction. +* use and add the handle to the running transaction. */ update_t_max_wait(transaction, ts); handle->h_transaction = transaction; @@ -819,6 +819,35 @@ int jbd2_journal_restart(handle_t *handle, int nblocks) } EXPORT_SYMBOL(jbd2_journal_restart); +/* + * Waits for any outstanding t_updates to finish. + * This is called with write j_state_lock held. + */ +void jbd2_journal_wait_updates(journal_t *journal) +{ + transaction_t *commit_transaction = journal->j_running_transaction; + + if (!commit_transaction) + return; + + spin_lock(_transaction->t_handle_lock); + while (atomic_read(_transaction->t_updates)) { + DEFINE_WAIT(wait); + + prepare_to_wait(>j_wait_updates, , + TASK_UNINTERRUPTIBLE); + if (atomic_read(_transaction->t_updates)) { + spin_unlock(_transaction->t_handle_lock); + write_unlock(>j_state_lock); + schedule(); + write_lock(>j_state_lock); + spin_lock(_transaction->t_handle_lock); + } + finish_wait(>j_wait_updates, ); + } + spin_unlock(_transaction->t_handle_lock); +} + /** * jbd2_journal_lock_updates () - establish a transaction barrier. * @journal: Journal to establish a barrier on. @@ -846,27 +875,9 @@ void jbd2_journal_lock_updates(journal_t *journal) write_lock(>j_state_lock); } - /* Wait until there are no running updates */ - while (1) { - transaction_t *transaction = journal->j_running_transaction; - - if (!transaction) - break; + /* Wait until there are no running t_updates */ + jbd2_journal_wait_updates(journal); - spin_lock(>t_handle_lock); - prepare_to_wait(>j_wait_updates, , - TASK_UNINTERRUPTIBLE); - if (!atomic_read(>t_updates)) { - spin_unlock(>t_handle_lock); -
[linux-yocto] [PATCH 24/46] Revert "cgroup: Use open-time credentials for process migraton perm checks"
From: Dinh Nguyen commit bcb864df35d751a77abcfa116ae9d801f47a6e5b from https://github.com/altera-opensource/linux-socfpga.git This reverts commit 31f58fc8d843cfc1d458fa01f4c24c4ea37834e5. Due to a mistake in resolving a merge conflict, this patch needs to get reverted. Signed-off-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- kernel/cgroup/cgroup-v1.c | 7 +++ kernel/cgroup/cgroup.c| 8 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 433b9e840b38..4296e0e581cc 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -507,11 +507,10 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, goto out_unlock; /* -* Even if we're attaching all tasks in the thread group, we only need -* to check permissions on one of them. Check permissions using the -* credentials from file open to protect against inherited fd attacks. +* Even if we're attaching all tasks in the thread group, we only +* need to check permissions on one of them. */ - cred = of->file->f_cred; + cred = current_cred(); tcred = get_task_cred(task); if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && !uid_eq(cred->euid, tcred->uid) && diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 684c16849eff..7173e8b5f5a1 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -4856,16 +4856,9 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, src_cgrp = task_cgroup_from_root(task, _dfl_root); spin_unlock_irq(_set_lock); - /* -* Process and thread migrations follow same delegation rule. Check -* permissions using the credentials from file open to protect against -* inherited fd attacks. -*/ - saved_cred = override_creds(of->file->f_cred); ret = cgroup_attach_permissions(src_cgrp, dst_cgrp, of->file->f_path.dentry->d_sb, true, ctx->ns); - revert_creds(saved_cred); if (ret) goto out_finish; @@ -4890,7 +4883,6 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, struct cgroup_file_ctx *ctx = of->priv; struct cgroup *src_cgrp, *dst_cgrp; struct task_struct *task; - const struct cred *saved_cred; ssize_t ret; bool locked; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12526): https://lists.yoctoproject.org/g/linux-yocto/message/12526 Mute This Topic: https://lists.yoctoproject.org/mt/98898761/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 25/46] cgroup: Use open-time credentials for process migraton perm checks
From: Tejun Heo commit addf0d2fbf84fa527e26af8ae670f7d85cc6c375 from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 1756d7994ad85c2479af6ae5a9750b92324685af] cgroup process migration permission checks are performed at write time as whether a given operation is allowed or not is dependent on the content of the write - the PID. This currently uses current's credentials which is a potential security weakness as it may allow scenarios where a less privileged process tricks a more privileged one into writing into a fd that it created. This patch makes both cgroup2 and cgroup1 process migration interfaces to use the credentials saved at the time of open (file->f_cred) instead of current's. Reported-by: "Eric W. Biederman" Suggested-by: Linus Torvalds Fixes: 187fe84067bd ("cgroup: require write perm on common ancestor when moving processes on the default hierarchy") Reviewed-by: Michal Koutný Signed-off-by: Tejun Heo Signed-off-by: Wenlin Kang --- kernel/cgroup/cgroup-v1.c | 7 --- kernel/cgroup/cgroup.c| 8 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 4296e0e581cc..433b9e840b38 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -507,10 +507,11 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, goto out_unlock; /* -* Even if we're attaching all tasks in the thread group, we only -* need to check permissions on one of them. +* Even if we're attaching all tasks in the thread group, we only need +* to check permissions on one of them. Check permissions using the +* credentials from file open to protect against inherited fd attacks. */ - cred = current_cred(); + cred = of->file->f_cred; tcred = get_task_cred(task); if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && !uid_eq(cred->euid, tcred->uid) && diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 7173e8b5f5a1..684c16849eff 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -4856,9 +4856,16 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, src_cgrp = task_cgroup_from_root(task, _dfl_root); spin_unlock_irq(_set_lock); + /* +* Process and thread migrations follow same delegation rule. Check +* permissions using the credentials from file open to protect against +* inherited fd attacks. +*/ + saved_cred = override_creds(of->file->f_cred); ret = cgroup_attach_permissions(src_cgrp, dst_cgrp, of->file->f_path.dentry->d_sb, true, ctx->ns); + revert_creds(saved_cred); if (ret) goto out_finish; @@ -4883,6 +4890,7 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, struct cgroup_file_ctx *ctx = of->priv; struct cgroup *src_cgrp, *dst_cgrp; struct task_struct *task; + const struct cred *saved_cred; ssize_t ret; bool locked; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12527): https://lists.yoctoproject.org/g/linux-yocto/message/12527 Mute This Topic: https://lists.yoctoproject.org/mt/98898764/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 23/46] xen/grant-table: add gnttab_try_end_foreign_access()
From: Juergen Gross commit 72103f08cde854334ec48d30f33d58a642d68344 from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 6b1775f26a2da2b05a6dc8ec2b5d14e9a4701a1a] Add a new grant table function gnttab_try_end_foreign_access(), which will remove and free a grant if it is not in use. Its main use case is to either free a grant if it is no longer in use, or to take some other action if it is still in use. This other action can be an error exit, or (e.g. in the case of blkfront persistent grant feature) some special handling. This is CVE-2022-23036, CVE-2022-23038 / part of XSA-396. Reported-by: Demi Marie Obenour Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Signed-off-by: Wenlin Kang --- include/xen/grant_table.h | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 57b4ae6a4a18..ddaa586ba418 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h @@ -100,12 +100,7 @@ int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly); * Note that the granted page might still be accessed (read or write) by the * other side after gnttab_end_foreign_access() returns, so even if page was * specified as 0 it is not allowed to just reuse the page for other - * purposes immediately. gnttab_end_foreign_access() will take an additional - * reference to the granted page in this case, which is dropped only after - * the grant is no longer in use. - * This requires that multi page allocations for areas subject to - * gnttab_end_foreign_access() are done via alloc_pages_exact() (and freeing - * via free_pages_exact()) in order to avoid high order pages. + * purposes immediately. */ void gnttab_end_foreign_access(grant_ref_t ref, int readonly, unsigned long page); -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12525): https://lists.yoctoproject.org/g/linux-yocto/message/12525 Mute This Topic: https://lists.yoctoproject.org/mt/98898760/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 22/46] vdpa: clean up get_config_size ret value handling
From: Laura Abbott commit 0e1c61723d60074b12c61e69ffacd9137a60dd1d from https://github.com/altera-opensource/linux-socfpga.git [upstream commit 870aaff92e959e29d40f9cfdb5ed06ba2fc2dae0] The return type of get_config_size is size_t so it makes sense to change the type of the variable holding its result. That said, this already got taken care of (differently, and arguably not as well) by commit 3ed21c1451a1 ("vdpa: check that offsets are within bounds"). The added 'c->off > size' test in that commit will be done as an unsigned comparison on 32-bit (safe due to not being signed). On a 64-bit platform, it will be done as a signed comparison, but in that case the comparison will be done in 64-bit, and 'c->off' being an u32 it will be valid thanks to the extended range (ie both values will be positive in 64 bits). So this was a real bug, but it was already addressed and marked for stable. Signed-off-by: Laura Abbott Reported-by: Luo Likang Signed-off-by: Michael S. Tsirkin Signed-off-by: Wenlin Kang --- drivers/vhost/vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index b2d4b1139ab5..73ea4491c8b3 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -192,7 +192,7 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v, struct vhost_vdpa_config *c) { struct vdpa_device *vdpa = v->vdpa; - long size = vdpa->config->get_config_size(vdpa); + size_t size = vdpa->config->get_config_size(vdpa); if (c->len == 0 || c->off > size) return -EINVAL; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12524): https://lists.yoctoproject.org/g/linux-yocto/message/12524 Mute This Topic: https://lists.yoctoproject.org/mt/98898759/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 20/46] vdpa: add get_config_size callback in vdpa_config_ops
From: Stefano Garzarella commit 442706f9f94d28fe3c9f188ae4ebbd6b40addffe from https://github.com/altera-opensource/linux-socfpga.git This new callback is used to get the size of the configuration space of vDPA devices. Signed-off-by: Stefano Garzarella Link: https://lore.kernel.org/r/20210315163450.254396-9-sgarz...@redhat.com Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Wenlin Kang --- drivers/vdpa/ifcvf/ifcvf_main.c | 6 ++ drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 ++ drivers/vdpa/vdpa_sim/vdpa_sim.c | 9 + drivers/vdpa/virtio_pci/vp_vdpa.c | 8 include/linux/vdpa.h | 4 5 files changed, 33 insertions(+) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index 8b4028556cb6..a4e4bf1213e7 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -332,6 +332,11 @@ static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev) return IFCVF_QUEUE_ALIGNMENT; } +static size_t ifcvf_vdpa_get_config_size(struct vdpa_device *vdpa_dev) +{ + return sizeof(struct virtio_net_config); +} + static void ifcvf_vdpa_get_config(struct vdpa_device *vdpa_dev, unsigned int offset, void *buf, unsigned int len) @@ -392,6 +397,7 @@ static const struct vdpa_config_ops ifc_vdpa_ops = { .get_device_id = ifcvf_vdpa_get_device_id, .get_vendor_id = ifcvf_vdpa_get_vendor_id, .get_vq_align = ifcvf_vdpa_get_vq_align, + .get_config_size= ifcvf_vdpa_get_config_size, .get_config = ifcvf_vdpa_get_config, .set_config = ifcvf_vdpa_set_config, .set_config_cb = ifcvf_vdpa_set_config_cb, diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 577ff786f11b..53584a43e311 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1810,6 +1810,11 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) ndev->mvdev.status |= VIRTIO_CONFIG_S_FAILED; } +static size_t mlx5_vdpa_get_config_size(struct vdpa_device *vdev) +{ + return sizeof(struct virtio_net_config); +} + static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset, void *buf, unsigned int len) { @@ -1901,6 +1906,7 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = { .get_vendor_id = mlx5_vdpa_get_vendor_id, .get_status = mlx5_vdpa_get_status, .set_status = mlx5_vdpa_set_status, + .get_config_size = mlx5_vdpa_get_config_size, .get_config = mlx5_vdpa_get_config, .set_config = mlx5_vdpa_set_config, .get_generation = mlx5_vdpa_get_generation, diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index c95e1d4efe2b..9bdc3f4e254f 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -584,6 +584,13 @@ static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status) spin_unlock(>lock); } +static size_t vdpasim_get_config_size(struct vdpa_device *vdpa) +{ + struct vdpasim *vdpasim = vdpa_to_sim(vdpa); + + return vdpasim->dev_attr.config_size; +} + static void vdpasim_get_config(struct vdpa_device *vdpa, unsigned int offset, void *buf, unsigned int len) { @@ -703,6 +710,7 @@ static const struct vdpa_config_ops vdpasim_config_ops = { .get_vendor_id = vdpasim_get_vendor_id, .get_status = vdpasim_get_status, .set_status = vdpasim_set_status, + .get_config_size= vdpasim_get_config_size, .get_config = vdpasim_get_config, .set_config = vdpasim_set_config, .get_generation = vdpasim_get_generation, @@ -730,6 +738,7 @@ static const struct vdpa_config_ops vdpasim_batch_config_ops = { .get_vendor_id = vdpasim_get_vendor_id, .get_status = vdpasim_get_status, .set_status = vdpasim_set_status, + .get_config_size= vdpasim_get_config_size, .get_config = vdpasim_get_config, .set_config = vdpasim_set_config, .get_generation = vdpasim_get_generation, diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c index 1321a2fcd088..dc27ec970884 100644 --- a/drivers/vdpa/virtio_pci/vp_vdpa.c +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c @@ -295,6 +295,13 @@ static u32 vp_vdpa_get_vq_align(struct vdpa_device *vdpa) return PAGE_SIZE; } +static size_t vp_vdpa_get_config_size(struct vdpa_device *vdpa) +{ + struct virtio_pci_modern_device *mdev = vdpa_to_mdev(vdpa); + + return mdev->device_len; +} + static void vp_vdpa_get_config(struct vdpa_device *vdpa, unsigned int offset,
[linux-yocto] [PATCH 21/46] vhost/vdpa: use get_config_size callback in vhost_vdpa_config_validate()
From: Stefano Garzarella commit fde5b51795fa87107c13092eb54f6632b3b2f70b from https://github.com/altera-opensource/linux-socfpga.git [upstream commit d6d8bb92fdde6390037bf9da174ed3ab551c04d7] Let's use the new 'get_config_size()' callback available instead of using the 'virtio_id' to get the size of the device config space. Signed-off-by: Stefano Garzarella Link: https://lore.kernel.org/r/20210315163450.254396-10-sgarz...@redhat.com Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Wenlin Kang --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 04578aa87e4d..b2d4b1139ab5 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -191,13 +191,8 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp) static int vhost_vdpa_config_validate(struct vhost_vdpa *v, struct vhost_vdpa_config *c) { - long size = 0; - - switch (v->virtio_id) { - case VIRTIO_ID_NET: - size = sizeof(struct virtio_net_config); - break; - } + struct vdpa_device *vdpa = v->vdpa; + long size = vdpa->config->get_config_size(vdpa); if (c->len == 0 || c->off > size) return -EINVAL; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12523): https://lists.yoctoproject.org/g/linux-yocto/message/12523 Mute This Topic: https://lists.yoctoproject.org/mt/98898758/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 19/46] vdpa: introduce virtio pci driver
From: Jason Wang commit 64b9f64f80a6f4b7ea51bf0510119cb15e801dc6 from https://github.com/altera-opensource/linux-socfpga.git This patch introduce a vDPA driver for virtio-pci device. It bridges the virtio-pci control command to the vDPA bus. This will be used for features prototyping and testing. Note that get/restore virtqueue state is not supported which needs extension on the virtio specification. Signed-off-by: Jason Wang Link: https://lore.kernel.org/r/20210223061905.422659-4-jasow...@redhat.com Signed-off-by: Michael S. Tsirkin Signed-off-by: Wenlin Kang --- drivers/Makefile | 1 + drivers/vdpa/Kconfig | 7 + drivers/vdpa/Makefile | 1 + drivers/vdpa/virtio_pci/Makefile | 2 + drivers/vdpa/virtio_pci/vp_vdpa.c | 458 ++ 5 files changed, 469 insertions(+) create mode 100644 drivers/vdpa/virtio_pci/Makefile create mode 100644 drivers/vdpa/virtio_pci/vp_vdpa.c diff --git a/drivers/Makefile b/drivers/Makefile index 576228037718..0d420f9acf19 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -42,6 +42,7 @@ obj-$(CONFIG_DMADEVICES) += dma/ obj-y += soc/ obj-$(CONFIG_VIRTIO) += virtio/ +obj-$(CONFIG_VIRTIO_PCI_LIB) += virtio/ obj-$(CONFIG_VDPA) += vdpa/ obj-$(CONFIG_XEN) += xen/ diff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig index 6caf539091e5..05912e6ae5c8 100644 --- a/drivers/vdpa/Kconfig +++ b/drivers/vdpa/Kconfig @@ -49,4 +49,11 @@ config MLX5_VDPA_NET be executed by the hardware. It also supports a variety of stateless offloads depending on the actual device used and firmware version. +config VP_VDPA + tristate "Virtio PCI bridge vDPA driver" + select VIRTIO_PCI_LIB + depends on PCI_MSI + help + This kernel module bridges virtio PCI device to vDPA bus. + endif # VDPA diff --git a/drivers/vdpa/Makefile b/drivers/vdpa/Makefile index d160e9b63a66..67fe7f3d6943 100644 --- a/drivers/vdpa/Makefile +++ b/drivers/vdpa/Makefile @@ -3,3 +3,4 @@ obj-$(CONFIG_VDPA) += vdpa.o obj-$(CONFIG_VDPA_SIM) += vdpa_sim/ obj-$(CONFIG_IFCVF)+= ifcvf/ obj-$(CONFIG_MLX5_VDPA) += mlx5/ +obj-$(CONFIG_VP_VDPA)+= virtio_pci/ diff --git a/drivers/vdpa/virtio_pci/Makefile b/drivers/vdpa/virtio_pci/Makefile new file mode 100644 index ..231088d3af7d --- /dev/null +++ b/drivers/vdpa/virtio_pci/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_VP_VDPA) += vp_vdpa.o diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c new file mode 100644 index ..1321a2fcd088 --- /dev/null +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c @@ -0,0 +1,458 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * vDPA bridge driver for modern virtio-pci device + * + * Copyright (c) 2020, Red Hat Inc. All rights reserved. + * Author: Jason Wang + * + * Based on virtio_pci_modern.c. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define VP_VDPA_QUEUE_MAX 256 +#define VP_VDPA_DRIVER_NAME "vp_vdpa" +#define VP_VDPA_NAME_SIZE 256 + +struct vp_vring { + void __iomem *notify; + char msix_name[VP_VDPA_NAME_SIZE]; + struct vdpa_callback cb; + int irq; +}; + +struct vp_vdpa { + struct vdpa_device vdpa; + struct virtio_pci_modern_device mdev; + struct vp_vring *vring; + struct vdpa_callback config_cb; + char msix_name[VP_VDPA_NAME_SIZE]; + int config_irq; + int queues; + int vectors; +}; + +static struct vp_vdpa *vdpa_to_vp(struct vdpa_device *vdpa) +{ + return container_of(vdpa, struct vp_vdpa, vdpa); +} + +static struct virtio_pci_modern_device *vdpa_to_mdev(struct vdpa_device *vdpa) +{ + struct vp_vdpa *vp_vdpa = vdpa_to_vp(vdpa); + + return _vdpa->mdev; +} + +static u64 vp_vdpa_get_features(struct vdpa_device *vdpa) +{ + struct virtio_pci_modern_device *mdev = vdpa_to_mdev(vdpa); + + return vp_modern_get_features(mdev); +} + +static int vp_vdpa_set_features(struct vdpa_device *vdpa, u64 features) +{ + struct virtio_pci_modern_device *mdev = vdpa_to_mdev(vdpa); + + vp_modern_set_features(mdev, features); + + return 0; +} + +static u8 vp_vdpa_get_status(struct vdpa_device *vdpa) +{ + struct virtio_pci_modern_device *mdev = vdpa_to_mdev(vdpa); + + return vp_modern_get_status(mdev); +} + +static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa) +{ + struct virtio_pci_modern_device *mdev = _vdpa->mdev; + struct pci_dev *pdev = mdev->pci_dev; + int i; + + for (i = 0; i < vp_vdpa->queues; i++) { + if (vp_vdpa->vring[i].irq != VIRTIO_MSI_NO_VECTOR) { + vp_modern_queue_vector(mdev, i, VIRTIO_MSI_NO_VECTOR); + devm_free_irq(>dev, vp_vdpa->vring[i].irq, +
[linux-yocto] [PATCH 18/46] vdpa_sim: rename vdpasim_config_ops variables
From: Stefano Garzarella commit 36a9c30630256629e62a9186793c28735ade3ffc from https://github.com/altera-opensource/linux-socfpga.git These variables store generic callbacks used by the vDPA simulator core, so we can remove the 'net' word in their names. Co-developed-by: Max Gurtovoy Signed-off-by: Max Gurtovoy Acked-by: Jason Wang Signed-off-by: Stefano Garzarella Link: https://lore.kernel.org/r/20201215144256.155342-6-sgarz...@redhat.com Signed-off-by: Michael S. Tsirkin Signed-off-by: Wenlin Kang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index e65c0fa95d31..c95e1d4efe2b 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -354,8 +354,8 @@ static const struct dma_map_ops vdpasim_dma_ops = { .free = vdpasim_free_coherent, }; -static const struct vdpa_config_ops vdpasim_net_config_ops; -static const struct vdpa_config_ops vdpasim_net_batch_config_ops; +static const struct vdpa_config_ops vdpasim_config_ops; +static const struct vdpa_config_ops vdpasim_batch_config_ops; static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr) { @@ -365,9 +365,9 @@ static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr) int i, ret = -ENOMEM; if (batch_mapping) - ops = _net_batch_config_ops; + ops = _batch_config_ops; else - ops = _net_config_ops; + ops = _config_ops; vdpasim = vdpa_alloc_device(struct vdpasim, vdpa, NULL, ops, dev_attr->nvqs); @@ -685,7 +685,7 @@ static void vdpasim_free(struct vdpa_device *vdpa) kfree(vdpasim->config); } -static const struct vdpa_config_ops vdpasim_net_config_ops = { +static const struct vdpa_config_ops vdpasim_config_ops = { .set_vq_address = vdpasim_set_vq_address, .set_vq_num = vdpasim_set_vq_num, .kick_vq= vdpasim_kick_vq, @@ -712,7 +712,7 @@ static const struct vdpa_config_ops vdpasim_net_config_ops = { .free = vdpasim_free, }; -static const struct vdpa_config_ops vdpasim_net_batch_config_ops = { +static const struct vdpa_config_ops vdpasim_batch_config_ops = { .set_vq_address = vdpasim_set_vq_address, .set_vq_num = vdpasim_set_vq_num, .kick_vq= vdpasim_kick_vq, -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12520): https://lists.yoctoproject.org/g/linux-yocto/message/12520 Mute This Topic: https://lists.yoctoproject.org/mt/98898754/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 17/46] fpga: altera-cvp: Increase credit timeout
From: Ang Tien Sung commit ec82dae4b4a85d369d313a9628873ade5095bcf7 from https://github.com/altera-opensource/linux-socfpga.git Increase the timeout for SDM (Secure device manager) data credits from 20ms to 40ms. Internal stress tests running at 500 loops failed with the current timeout of 20ms. At the start of a FPGA configuration, the CVP host driver reads the transmit credits from SDM. It then sends bitstream FPGA data to SDM based on the total credits. Each credit allows the CVP host driver to send 4kBytes of data. There are situations whereby, the SDM did not respond in time during testing. Signed-off-by: Ang Tien Sung Signed-off-by: Wenlin Kang --- drivers/fpga/altera-cvp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c index 2a27199aa41e..311bb6f5e4ac 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c @@ -52,7 +52,7 @@ /* V2 Defines */ #define VSE_CVP_TX_CREDITS 0x49/* 8bit */ -#define V2_CREDIT_TIMEOUT_US 2 +#define V2_CREDIT_TIMEOUT_US 4 #define V2_CHECK_CREDIT_US 10 #define V2_POLL_TIMEOUT_US 100 #define V2_USER_TIMEOUT_US 50 -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12519): https://lists.yoctoproject.org/g/linux-yocto/message/12519 Mute This Topic: https://lists.yoctoproject.org/mt/98898753/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 16/46] HSD #14015950233: arm64: configs: enable HW_RANDOM as kernel module
From: "Teoh, Ji Sheng" commit 457737dcc8fb11818db8b5dae068f0d48c07430f from https://github.com/altera-opensource/linux-socfpga.git Enable hardware random number generator as a loadable module. CONFIG_HW_RANDOM=m This kernel config is only required by Intel's n5x platform. Change it to module so the hardware random number generator will only initialize on demand. When this driver is build-in to other platform eg, Agilex, it will introduce a long start job and cause timeout error while waiting for SMC call during boot up if the SVC firmware is not ready. Fixes: 6153ec6352e4c0 ("HSD #22013011814: crypto: intel_fcs: support HWRNG via /dev/hwrng") Signed-off-by: Teoh, Ji Sheng Signed-off-by: Wenlin Kang --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index a25956c0dbe7..e8dff71a5b77 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -1092,3 +1092,4 @@ CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_PREEMPT is not set # CONFIG_FTRACE is not set CONFIG_MEMTEST=y +CONFIG_HW_RANDOM=m -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12518): https://lists.yoctoproject.org/g/linux-yocto/message/12518 Mute This Topic: https://lists.yoctoproject.org/mt/98898752/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 15/46] drm/i915/guc: Update to use firmware v49.0.1
From: John Harrison commit e3f6a1e82931bb58fb57e0ecdff0494bd5be55ad from https://github.com/altera-opensource/linux-socfpga.git [upstream commit c784e5249e773689e38d2bc1749f08b986621a26] The latest GuC firmware includes a number of interface changes that require driver updates to match. * Starting from Gen11, the ID to be provided to GuC needs to contain the engine class in bits [0..2] and the instance in bits [3..6]. NOTE: this patch breaks pointer dereferences in some existing GuC functions that use the guc_id to dereference arrays but these functions are not used for now as we have GuC submission disabled and we will update these functions in follow up patch which requires new IDs. * The new GuC requires the additional data structure (ADS) and associated 'private_data' pointer to be setup. This is basically a scratch area of memory that the GuC owns. The size is read from the CSS header. * There is now a physical to logical engine mapping table in the ADS which needs to be configured in order for the firmware to load. For now, the table is initialised with a 1 to 1 mapping. * GUC_CTL_CTXINFO has been removed from the initialization params. * reg_state_buffer is maintained internally by the GuC as part of the private data. * The ADS layout has changed significantly. This patch updates the shared structure and also adds better documentation of the layout. * While i915 does not use GuC doorbells, the firmware now requires that some initialisation is done. * The number of engine classes and instances supported in the ADS has been increased. Signed-off-by: John Harrison Signed-off-by: Matthew Brost Signed-off-by: Daniele Ceraolo Spurio Signed-off-by: Oscar Mateo Signed-off-by: Michel Thierry Signed-off-by: Rodrigo Vivi Signed-off-by: Michal Wajdeczko Cc: Michal Winiarski Cc: Tomasz Lis Cc: Joonas Lahtinen Reviewed-by: Daniele Ceraolo Spurio Signed-off-by: Joonas Lahtinen Link: https://patchwork.freedesktop.org/patch/msgid/20201028145826.2949180-2-john.c.harri...@intel.com Signed-off-by: Wenlin Kang --- drivers/gpu/drm/i915/gt/intel_engine_cs.c| 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 18 --- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 131 +++ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 80 +-- drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h | 5 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 27 ++-- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 2 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h | 6 +- 8 files changed, 176 insertions(+), 96 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c index a19537706ed1..c940ac3aae2f 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c @@ -305,8 +305,9 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id) engine->i915 = i915; engine->gt = gt; engine->uncore = gt->uncore; - engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base = __engine_mmio_base(i915, info->mmio_bases); + engine->hw_id = info->hw_id; + engine->guc_id = MAKE_GUC_ID(info->class, info->instance); engine->class = info->class; engine->instance = info->instance; diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc.c index 942c7c187adb..6909da1e1a73 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.c @@ -213,23 +213,6 @@ static u32 guc_ctl_feature_flags(struct intel_guc *guc) return flags; } -static u32 guc_ctl_ctxinfo_flags(struct intel_guc *guc) -{ - u32 flags = 0; - - if (intel_guc_submission_is_used(guc)) { - u32 ctxnum, base; - - base = intel_guc_ggtt_offset(guc, guc->stage_desc_pool); - ctxnum = GUC_MAX_STAGE_DESCRIPTORS / 16; - - base >>= PAGE_SHIFT; - flags |= (base << GUC_CTL_BASE_ADDR_SHIFT) | - (ctxnum << GUC_CTL_CTXNUM_IN16_SHIFT); - } - return flags; -} - static u32 guc_ctl_log_params_flags(struct intel_guc *guc) { u32 offset = intel_guc_ggtt_offset(guc, guc->log.vma) >> PAGE_SHIFT; @@ -291,7 +274,6 @@ static void guc_init_params(struct intel_guc *guc) BUILD_BUG_ON(sizeof(guc->params) != GUC_CTL_MAX_DWORDS * sizeof(u32)); - params[GUC_CTL_CTXINFO] = guc_ctl_ctxinfo_flags(guc); params[GUC_CTL_LOG_PARAMS] = guc_ctl_log_params_flags(guc); params[GUC_CTL_FEATURE] = guc_ctl_feature_flags(guc); params[GUC_CTL_DEBUG] = guc_ctl_debug_flags(guc); diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c index d44061033f23..7950d28beb8c 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c @@ -10,11 +10,52 @@ /* * The
[linux-yocto] [PATCH 14/46] HSD #1509644685 crypto: intel_fcs: Generic Mailbox Command
From: "Teh, Wen Ping" commit d031779b1e0a2ecec3bf7ce8a5602e92a5013b4d from https://github.com/altera-opensource/linux-socfpga.git Add generic mailbox command that can support SDM command. User can use this command to send SDM mailbox command. User have to specified an input file which contain the command data and an output file for SDM response to be copied over. Signed-off-by: Teh, Wen Ping Signed-off-by: Wenlin Kang --- drivers/crypto/intel_fcs.c | 127 +++ include/uapi/linux/intel_fcs-ioctl.h | 26 ++ 2 files changed, 153 insertions(+) diff --git a/drivers/crypto/intel_fcs.c b/drivers/crypto/intel_fcs.c index 4f6aa59d2c42..d2996d151af1 100644 --- a/drivers/crypto/intel_fcs.c +++ b/drivers/crypto/intel_fcs.c @@ -210,6 +210,28 @@ static void fcs_hwrng_callback(struct stratix10_svc_client *client, complete(>completion); } +static void fcs_mbox_send_cmd_callback(struct stratix10_svc_client *client, +struct stratix10_svc_cb_data *data) +{ + struct intel_fcs_priv *priv = client->priv; + + if (data->status == BIT(SVC_STATUS_OK)) { + priv->status = 0; + priv->size = *((unsigned int *)data->kaddr2); + } else if (data->status == BIT(SVC_STATUS_ERROR)) { + priv->status = *((unsigned int *)data->kaddr1); + dev_err(client->dev, "mbox_error=0x%x\n", priv->status); + } else if (data->status == BIT(SVC_STATUS_INVALID_PARAM)) { + priv->status = -EINVAL; + dev_err(client->dev, "request rejected\n"); + } else { + priv->status = -EINVAL; + dev_err(client->dev, "rejected, invalid param\n"); + } + + complete(>completion); +} + static int fcs_request_service(struct intel_fcs_priv *priv, void *msg, unsigned long timeout) { @@ -2733,6 +2755,111 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, break; + case INTEL_FCS_DEV_MBOX_SEND: + if (copy_from_user(data, (void __user *)arg, sizeof(*data))) { + dev_err(dev, "failure on copy_from_user\n"); + mutex_unlock(>lock); + return -EFAULT; + } + + if (data->com_paras.mbox_send_cmd.cmd_data_sz % 4) { + dev_err(dev, "Command data size (%d) is not 4 byte align\n", + data->com_paras.mbox_send_cmd.cmd_data_sz); + mutex_unlock(>lock); + return -EFAULT; + } + + if (data->com_paras.mbox_send_cmd.rsp_data_sz % 4) { + dev_err(dev, "Respond data size (%d) is not 4 byte align\n", + data->com_paras.mbox_send_cmd.rsp_data_sz); + mutex_unlock(>lock); + return -EFAULT; + } + + if (data->com_paras.mbox_send_cmd.cmd_data_sz) { + s_buf = stratix10_svc_allocate_memory(priv->chan, + data->com_paras.mbox_send_cmd.cmd_data_sz); + if (!s_buf) { + dev_err(dev, "failed allocate source CMD buf\n"); + mutex_unlock(>lock); + return -ENOMEM; + } + } else { + s_buf = NULL; + } + + if (data->com_paras.mbox_send_cmd.rsp_data_sz) { + d_buf = stratix10_svc_allocate_memory(priv->chan, + data->com_paras.mbox_send_cmd.rsp_data_sz); + if (!d_buf) { + dev_err(dev, "failed allocate destination RSP buf\n"); + fcs_free_memory(priv, s_buf, NULL, NULL); + mutex_unlock(>lock); + return -ENOMEM; + } + } else { + d_buf = NULL; + } + + if (s_buf != NULL) { + /* Copy user data from user space to kernel space */ + ret = copy_from_user(s_buf, + data->com_paras.mbox_send_cmd.cmd_data, + data->com_paras.mbox_send_cmd.cmd_data_sz); + if (ret) { + dev_err(dev, "failed copy buf ret=%d\n", ret); + fcs_free_memory(priv, s_buf, d_buf, NULL); + mutex_unlock(>lock); + return -EFAULT; + } + } + + msg->command = COMMAND_MBOX_SEND_CMD; + msg->arg[0] = data->com_paras.mbox_send_cmd.mbox_cmd; + msg->arg[1] =
[linux-yocto] [PATCH 13/46] HSD #1509644685 firmware: stratix10-svc: Generic Mailbox Command
From: "Teh, Wen Ping" commit 63f4a2705f7093ec24599eb744260e46e23e48bc from https://github.com/altera-opensource/linux-socfpga.git Add generic mailbox command that can support SDM command. User can use this command to send SDM mailbox command. User have to specified an input file which contain the command data and an output file for SDM response to be copied over. Signed-off-by: Teh, Wen Ping Signed-off-by: Wenlin Kang --- drivers/firmware/stratix10-svc.c | 18 ++ include/linux/firmware/intel/stratix10-smc.h | 18 ++ .../firmware/intel/stratix10-svc-client.h | 6 ++ 3 files changed, 42 insertions(+) diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index f841cc73fead..6d375c1e8b53 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -37,6 +37,7 @@ #define SVC_NUM_CHANNEL4 #define FPGA_CONFIG_DATA_CLAIM_TIMEOUT_MS 2000 #define FPGA_CONFIG_STATUS_TIMEOUT_SEC 30 +#define BYTE_TO_WORD_SIZE 4 /* stratix10 service layer clients */ #define STRATIX10_RSU "stratix10-rsu" @@ -432,6 +433,13 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data, cb_data->status = BIT(SVC_STATUS_OK); cb_data->kaddr2 = break; + case COMMAND_MBOX_SEND_CMD: + cb_data->status = BIT(SVC_STATUS_OK); + cb_data->kaddr1 = + /* SDM return size in u32 word. Convert size to u8 */ + res.a2 = res.a2 * BYTE_TO_WORD_SIZE; + cb_data->kaddr2 = + break; default: pr_warn("it shouldn't happen\n"); break; @@ -931,6 +939,15 @@ static int svc_normal_to_secure_thread(void *data) a1 = (unsigned long)pdata->paddr; a2 = 0; break; + case COMMAND_MBOX_SEND_CMD: + a0 = INTEL_SIP_SMC_MBOX_SEND_CMD; + a1 = pdata->arg[0]; + a2 = (unsigned long)pdata->paddr; + a3 = (unsigned long)pdata->size / BYTE_TO_WORD_SIZE; + a4 = pdata->arg[1]; + a5 = (unsigned long)pdata->paddr_output; + a6 = (unsigned long)pdata->size_output / BYTE_TO_WORD_SIZE; + break; default: pr_warn("it shouldn't happen\n"); break; @@ -1043,6 +1060,7 @@ static int svc_normal_to_secure_thread(void *data) case COMMAND_FCS_CRYPTO_ECDH_REQUEST_FINALIZE: case COMMAND_FCS_RANDOM_NUMBER_GEN_EXT: case COMMAND_FCS_SDOS_DATA_EXT: + case COMMAND_MBOX_SEND_CMD: cbdata->status = BIT(SVC_STATUS_INVALID_PARAM); cbdata->kaddr1 = NULL; cbdata->kaddr2 = NULL; diff --git a/include/linux/firmware/intel/stratix10-smc.h b/include/linux/firmware/intel/stratix10-smc.h index efbf014e963b..2517062690bc 100644 --- a/include/linux/firmware/intel/stratix10-smc.h +++ b/include/linux/firmware/intel/stratix10-smc.h @@ -478,6 +478,24 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) /** * SMC call protocol for Mailbox, starting FUNCID from 60 + * + * Call register usage: + * a0 INTEL_SIP_SMC_MBOX_SEND_CMD + * a1 mailbox command code + * a2 physical address that contain mailbox command data (not include header) + * a3 mailbox command data size in word + * a4 set to 0 for CASUAL, set to 1 for URGENT + * a5 physical address for secure firmware to put response data + *(not include header) + * a6 maximum size in word of physical address to store response data + * a7 not used + * + * Return status + * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_REJECTED or + *INTEL_SIP_SMC_STATUS_ERROR + * a1 mailbox error code + * a2 response data length in word + * a3 not used */ #define INTEL_SIP_SMC_FUNCID_MBOX_SEND_CMD 60 #define INTEL_SIP_SMC_MBOX_SEND_CMD \ diff --git a/include/linux/firmware/intel/stratix10-svc-client.h b/include/linux/firmware/intel/stratix10-svc-client.h index f54dd620b4d8..f45ff97459b8 100644 --- a/include/linux/firmware/intel/stratix10-svc-client.h +++ b/include/linux/firmware/intel/stratix10-svc-client.h @@ -231,6 +231,10 @@ struct stratix10_svc_chan; * * @COMMAND_SMC_SVC_VERSION: Non-mailbox SMC SVC API Version, * return status is SVC_STATUS_OK + * + * @COMMAND_MBOX_SEND_CMD: send generic mailbox command, return status is + * SVC_STATUS_OK or SVC_STATUS_ERROR + * */ enum stratix10_svc_command_code { /* for FPGA */ @@ -302,6 +306,8 @@ enum stratix10_svc_command_code {
[linux-yocto] [PATCH 12/46] HSD #15010087323 crypto: intel_fcs: SHA2/HMAC service for large file
From: "Teh, Wen Ping" commit af8e078c2ba1f02440467ce0c2fae0ffed8c7128 from https://github.com/altera-opensource/linux-socfpga.git Add support for large file size SHA2/HMAC data signing and verify using new 'update' mailbox command. The large file will be splitted into smaller chunk and send using initialize, update and finalize mailbox command. Signed-off-by: Teh, Wen Ping Signed-off-by: Wenlin Kang --- drivers/crypto/intel_fcs.c | 169 ++--- 1 file changed, 118 insertions(+), 51 deletions(-) diff --git a/drivers/crypto/intel_fcs.c b/drivers/crypto/intel_fcs.c index 6a3e7b5abc03..4f6aa59d2c42 100644 --- a/drivers/crypto/intel_fcs.c +++ b/drivers/crypto/intel_fcs.c @@ -1756,6 +1756,9 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, return -EFAULT; } +input_file_pointer = data->com_paras.s_mac_data.src; +remaining_size = data->com_paras.s_mac_data.src_size; + s_buf = stratix10_svc_allocate_memory(priv->chan, AES_CRYPT_CMD_MAX_SZ); if (!s_buf) { @@ -1772,34 +1775,57 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, return -ENOMEM; } -memcpy(s_buf, data->com_paras.s_mac_data.src, - data->com_paras.s_mac_data.src_size); +while (remaining_size > 0) { + if (remaining_size > AES_CRYPT_CMD_MAX_SZ) { + msg->command = COMMAND_FCS_CRYPTO_GET_DIGEST_UPDATE; + data_size = AES_CRYPT_CMD_MAX_SZ; + dev_dbg(dev, "Crypto get digest update. data_size=%d\n", + data_size); + } else { + msg->command = COMMAND_FCS_CRYPTO_GET_DIGEST_FINALIZE; + data_size = remaining_size; + dev_dbg(dev, "Crypto get digest finalize. data_size=%d\n", + data_size); + } -msg->command = COMMAND_FCS_CRYPTO_GET_DIGEST_FINALIZE; -msg->arg[0] = sid; -msg->arg[1] = cid; -msg->payload = s_buf; -msg->payload_length = data->com_paras.s_mac_data.src_size; -msg->payload_output = d_buf; -msg->payload_length_output = AES_CRYPT_CMD_MAX_SZ; -priv->client.receive_cb = fcs_attestation_callback; + memcpy(s_buf, input_file_pointer, data_size); -ret = fcs_request_service(priv, (void *)msg, - 10 * FCS_REQUEST_TIMEOUT); -if (!ret && !priv->status) { -if (priv->size > AES_CRYPT_CMD_MAX_SZ) { -dev_err(dev, "returned size %d is incorrect\n", -priv->size); -fcs_close_services(priv, s_buf, d_buf); -return -EFAULT; -} + msg->arg[0] = sid; + msg->arg[1] = cid; + msg->payload = s_buf; + msg->payload_length = data_size; + msg->payload_output = d_buf; + msg->payload_length_output = AES_CRYPT_CMD_MAX_SZ; + priv->client.receive_cb = fcs_attestation_callback; -memcpy(data->com_paras.s_mac_data.dst, - priv->kbuf, priv->size); -data->com_paras.s_mac_data.dst_size = priv->size; -} else { -data->com_paras.s_mac_data.dst = NULL; -data->com_paras.s_mac_data.dst_size = 0; + ret = fcs_request_service(priv, (void *)msg, + 10 * FCS_REQUEST_TIMEOUT); + if (!ret && !priv->status) { + if (priv->size > AES_CRYPT_CMD_MAX_SZ) { + dev_err(dev, "returned size %d is incorrect\n", + priv->size); + fcs_close_services(priv, s_buf, d_buf); + return -EFAULT; + } + } else { + data->com_paras.s_mac_data.dst = NULL; + data->com_paras.s_mac_data.dst_size = 0; + dev_err(dev, "unregconize response. ret=%d. status=%d\n", + ret, priv->status); + break; +
[linux-yocto] [PATCH 11/46] HSD #15010087323 crypto: intel_fcs: ECDSA service for large file
From: "Teh, Wen Ping" commit b3f94ecca7bd9f147ab32a6aa89daf1e1865ec28 from https://github.com/altera-opensource/linux-socfpga.git Add support for large file size ECDSA data signing and verify using new 'update' mailbox command. The large file will be splitted into smaller chunk and send using initialize, update and finalize mailbox command. Signed-off-by: Teh, Wen Ping Signed-off-by: Wenlin Kang --- drivers/crypto/intel_fcs.c | 183 ++--- 1 file changed, 130 insertions(+), 53 deletions(-) diff --git a/drivers/crypto/intel_fcs.c b/drivers/crypto/intel_fcs.c index 7c1b95ad7c64..6a3e7b5abc03 100644 --- a/drivers/crypto/intel_fcs.c +++ b/drivers/crypto/intel_fcs.c @@ -60,6 +60,9 @@ #define FCS_REQUEST_TIMEOUT (msecs_to_jiffies(SVC_FCS_REQUEST_TIMEOUT_MS)) #define FCS_COMPLETED_TIMEOUT (msecs_to_jiffies(SVC_COMPLETED_TIMEOUT_MS)) +/*SDM required minimun 8 bytes of data for crypto service*/ +#define CRYPTO_SERVICE_MIN_DATA_SIZE 8 + typedef void (*fcs_callback)(struct stratix10_svc_client *client, struct stratix10_svc_cb_data *data); @@ -276,6 +279,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, void *output_file_pointer; unsigned int buf_sz, in_sz, out_sz; uint32_t remaining_size, data_size, total_out_size; + uint32_t sign_size; int ret = 0; int i; int timeout; @@ -2015,7 +2019,12 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, return -EFAULT; } -s_buf = stratix10_svc_allocate_memory(priv->chan, in_sz); +input_file_pointer = data->com_paras.ecdsa_data.src; + +remaining_size = data->com_paras.ecdsa_data.src_size; + +s_buf = stratix10_svc_allocate_memory(priv->chan, + AES_CRYPT_CMD_MAX_SZ); if (!s_buf) { dev_err(dev, "failed allocate source buf\n"); fcs_close_services(priv, NULL, NULL); @@ -2029,34 +2038,59 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, return -ENOMEM; } -memcpy(s_buf, data->com_paras.ecdsa_data.src, - data->com_paras.ecdsa_data.src_size); +while (remaining_size > 0) { + if (remaining_size > AES_CRYPT_CMD_MAX_SZ) { + msg->command = + COMMAND_FCS_CRYPTO_ECDSA_SHA2_DATA_SIGNING_UPDATE; + data_size = AES_CRYPT_CMD_MAX_SZ; + dev_dbg(dev, "ECDSA data sign update stage. data_size=%d\n", + data_size); + } else { + msg->command = + COMMAND_FCS_CRYPTO_ECDSA_SHA2_DATA_SIGNING_FINALIZE; + data_size = remaining_size; + dev_dbg(dev, "ECDSA data sign finalize stage. data_size=%d\n", + data_size); + } -msg->command = COMMAND_FCS_CRYPTO_ECDSA_SHA2_DATA_SIGNING_FINALIZE; -msg->arg[0] = sid; -msg->arg[1] = cid; -msg->payload = s_buf; -msg->payload_length = in_sz; -msg->payload_output = d_buf; -msg->payload_length_output = out_sz; -priv->client.receive_cb = fcs_attestation_callback; + memcpy(s_buf, input_file_pointer, data_size); -ret = fcs_request_service(priv, (void *)msg, - 10 * FCS_REQUEST_TIMEOUT); -if (!ret && !priv->status) { -if (priv->size > out_sz) { -dev_err(dev, "returned size %d is incorrect\n", -priv->size); -fcs_close_services(priv, s_buf, d_buf); -return -EFAULT; -} + msg->arg[0] = sid; + msg->arg[1] = cid; + msg->payload = s_buf; + msg->payload_length = data_size; + msg->payload_output = d_buf; + msg->payload_length_output = out_sz; + priv->client.receive_cb = fcs_attestation_callback; -memcpy(data->com_paras.ecdsa_data.dst, - priv->kbuf, priv->size); -data->com_paras.ecdsa_data.dst_size = priv->size; -} else { -data->com_paras.ecdsa_data.dst = NULL; -
[linux-yocto] [PATCH 10/46] HSD #15010087323 crypto: intel_fcs: AES service for large file
From: "Teh, Wen Ping" commit 8e36efdb548233fb98d422099e9d3e4641f53f3f from https://github.com/altera-opensource/linux-socfpga.git Add support for large file size AES encryption and decryption using new 'update' mailbox command. The large file will be splitted into smaller chunk and send using initialize, update and finalize mailbox command. Signed-off-by: Teh, Wen Ping Signed-off-by: Wenlin Kang --- drivers/crypto/intel_fcs.c | 140 +++-- 1 file changed, 86 insertions(+), 54 deletions(-) diff --git a/drivers/crypto/intel_fcs.c b/drivers/crypto/intel_fcs.c index 99955499c3b8..7c1b95ad7c64 100644 --- a/drivers/crypto/intel_fcs.c +++ b/drivers/crypto/intel_fcs.c @@ -272,7 +272,10 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, void *d_buf; void *ps_buf; void *iv_field_buf; + void *input_file_pointer; + void *output_file_pointer; unsigned int buf_sz, in_sz, out_sz; + uint32_t remaining_size, data_size, total_out_size; int ret = 0; int i; int timeout; @@ -1556,7 +1559,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, case INTEL_FCS_DEV_CRYPTO_AES_CRYPT: if (copy_from_user(data, (void __user *)arg, sizeof(*data))) { -dev_err(dev, "failure on copy_from_user\n"); +dev_err(dev, "failure on copy_from_user data\n"); mutex_unlock(>lock); return -EFAULT; } @@ -1599,8 +1602,14 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, fcs_free_memory(priv, iv_field_buf, NULL, NULL); +input_file_pointer = data->com_paras.a_crypt.src; +output_file_pointer = data->com_paras.a_crypt.dst; + +remaining_size = data->com_paras.a_crypt.src_size; +total_out_size = 0; + s_buf = stratix10_svc_allocate_memory(priv->chan, - data->com_paras.a_crypt.src_size); + AES_CRYPT_CMD_MAX_SZ); if (!s_buf) { dev_err(dev, "failed allocate source buf\n"); fcs_close_services(priv, NULL, NULL); @@ -1608,76 +1617,99 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, } d_buf = stratix10_svc_allocate_memory(priv->chan, - data->com_paras.a_crypt.dst_size); + AES_CRYPT_CMD_MAX_SZ); if (!d_buf) { dev_err(dev, "failed allocate destation buf\n"); fcs_close_services(priv, s_buf, NULL); return -ENOMEM; } -ret = copy_from_user(s_buf, -data->com_paras.a_crypt.src, -data->com_paras.a_crypt.src_size); - -if (ret) { - dev_err(dev, "failure on copy_from_user\n"); - fcs_close_services(priv, s_buf, d_buf); - return -EFAULT; -} - -msg->command = COMMAND_FCS_CRYPTO_AES_CRYPT_FINALIZE; -msg->arg[0] = sid; -msg->arg[1] = cid; -msg->payload = s_buf; -msg->payload_length = data->com_paras.a_crypt.src_size; -msg->payload_output = d_buf; -msg->payload_length_output = data->com_paras.a_crypt.dst_size; -priv->client.receive_cb = fcs_attestation_callback; - ps_buf = stratix10_svc_allocate_memory(priv->chan, PS_BUF_SIZE); if (!ps_buf) { - dev_err(dev, "failed to allocate p-status buf\n"); - fcs_close_services(priv, s_buf, d_buf); - return -ENOMEM; +dev_err(dev, "failed to allocate p-status buf\n"); +fcs_close_services(priv, s_buf, d_buf); +return -ENOMEM; } -ret = fcs_request_service(priv, (void *)msg, - FCS_REQUEST_TIMEOUT); -if (!ret && !priv->status) { - /* to query the complete status */ - msg->payload = ps_buf; - msg->payload_length = PS_BUF_SIZE; - msg->command = COMMAND_POLL_SERVICE_STATUS; - priv->client.receive_cb = fcs_data_callback; +while (remaining_size > 0) { + if (remaining_size > AES_CRYPT_CMD_MAX_SZ) { + msg->command = COMMAND_FCS_CRYPTO_AES_CRYPT_UPDATE; + data_size = AES_CRYPT_CMD_MAX_SZ; + dev_dbg(dev, "AES crypt
[linux-yocto] [PATCH 09/46] HSD #15010087323 firmware: stratix10-svc: AES, SHA2/HMAC and ECDSA service for large file
From: "Teh, Wen Ping" commit 11778ddc08e752b55991f01ac4e5f805f10cad35 from https://github.com/altera-opensource/linux-socfpga.git Add support for large file size AES, SHA2/HMAC data and ECDSA crypto service using new 'update' mailbox command. The large file will be splitted into smaller chunk and send using initialize, update and finalize mailbox command. Signed-off-by: Teh, Wen Ping Reviewed-by: Dinh Nguyen Signed-off-by: Wenlin Kang --- drivers/firmware/stratix10-svc.c | 57 include/linux/firmware/intel/stratix10-smc.h | 124 ++ .../firmware/intel/stratix10-svc-client.h | 5 + 3 files changed, 186 insertions(+) diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index 8e60e352f857..f841cc73fead 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -408,12 +408,17 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data, case COMMAND_FCS_ATTESTATION_CERTIFICATE: case COMMAND_FCS_CRYPTO_EXPORT_KEY: case COMMAND_FCS_CRYPTO_GET_KEY_INFO: + case COMMAND_FCS_CRYPTO_AES_CRYPT_UPDATE: case COMMAND_FCS_CRYPTO_AES_CRYPT_FINALIZE: + case COMMAND_FCS_CRYPTO_GET_DIGEST_UPDATE: case COMMAND_FCS_CRYPTO_GET_DIGEST_FINALIZE: + case COMMAND_FCS_CRYPTO_MAC_VERIFY_UPDATE: case COMMAND_FCS_CRYPTO_MAC_VERIFY_FINALIZE: case COMMAND_FCS_CRYPTO_ECDSA_HASH_SIGNING_FINALIZE: + case COMMAND_FCS_CRYPTO_ECDSA_SHA2_DATA_SIGNING_UPDATE: case COMMAND_FCS_CRYPTO_ECDSA_SHA2_DATA_SIGNING_FINALIZE: case COMMAND_FCS_CRYPTO_ECDSA_HASH_VERIFY_FINALIZE: + case COMMAND_FCS_CRYPTO_ECDSA_SHA2_VERIFY_UPDATE: case COMMAND_FCS_CRYPTO_ECDSA_SHA2_VERIFY_FINALIZE: case COMMAND_FCS_CRYPTO_ECDSA_GET_PUBLIC_KEY_FINALIZE: case COMMAND_FCS_CRYPTO_ECDH_REQUEST_FINALIZE: @@ -695,6 +700,15 @@ static int svc_normal_to_secure_thread(void *data) a4 = (unsigned long)pdata->paddr; a5 = (unsigned long)pdata->size; break; + case COMMAND_FCS_CRYPTO_AES_CRYPT_UPDATE: + a0 = INTEL_SIP_SMC_FCS_AES_CRYPTO_UPDATE; + a1 = pdata->arg[0]; + a2 = pdata->arg[1]; + a3 = (unsigned long)pdata->paddr; + a4 = (unsigned long)pdata->size; + a5 = (unsigned long)pdata->paddr_output; + a6 = (unsigned long)pdata->size_output; + break; case COMMAND_FCS_CRYPTO_AES_CRYPT_FINALIZE: a0 = INTEL_SIP_SMC_FCS_AES_CRYPTO_FINALIZE; a1 = pdata->arg[0]; @@ -712,6 +726,15 @@ static int svc_normal_to_secure_thread(void *data) a4 = pdata->arg[3]; a5 = pdata->arg[4]; break; + case COMMAND_FCS_CRYPTO_GET_DIGEST_UPDATE: + a0 = INTEL_SIP_SMC_FCS_GET_DIGEST_UPDATE; + a1 = pdata->arg[0]; + a2 = pdata->arg[1]; + a3 = (unsigned long)pdata->paddr; + a4 = (unsigned long)pdata->size; + a5 = (unsigned long)pdata->paddr_output; + a6 = (unsigned long)pdata->size_output; + break; case COMMAND_FCS_CRYPTO_GET_DIGEST_FINALIZE: a0 = INTEL_SIP_SMC_FCS_GET_DIGEST_FINALIZE; a1 = pdata->arg[0]; @@ -729,6 +752,16 @@ static int svc_normal_to_secure_thread(void *data) a4 = pdata->arg[3]; a5 = pdata->arg[4]; break; + case COMMAND_FCS_CRYPTO_MAC_VERIFY_UPDATE: + a0 = INTEL_SIP_SMC_FCS_MAC_VERIFY_UPDATE; + a1 = pdata->arg[0]; + a2 = pdata->arg[1]; + a3 = (unsigned long)pdata->paddr; + a4 = (unsigned long)pdata->size; + a5 = (unsigned long)pdata->paddr_output; + a6 = (unsigned long)pdata->size_output; + a7 = pdata->arg[2]; + break; case COMMAND_FCS_CRYPTO_MAC_VERIFY_FINALIZE: a0 = INTEL_SIP_SMC_FCS_MAC_VERIFY_FINALIZE; a1 = pdata->arg[0]; @@ -764,6 +797,15 @@ static int svc_normal_to_secure_thread(void *data) a4 = pdata->arg[3]; a5 = pdata->arg[4]; break; + case COMMAND_FCS_CRYPTO_ECDSA_SHA2_DATA_SIGNING_UPDATE: + a0 = INTEL_SIP_SMC_FCS_ECDSA_SHA2_DATA_SIGNING_UPDATE; + a1 = pdata->arg[0]; + a2 = pdata->arg[1]; + a3 =
[linux-yocto] [PATCH 08/46] net: ethernet: Fix multiple definitions of alloc_init_skbufs and free_skbufs
From: "Tham, Mun Yew" commit 122520a53a4bc247a186a53f37eb2f1f5df21de6 from https://github.com/altera-opensource/linux-socfpga.git Fix the multiple definitions of alloc_init_skbufs and free_skbufs between intel_fpga_qse_ll_main.c and altera_tse_main.c Signed-off-by: Tham, Mun Yew Signed-off-by: Wenlin Kang --- drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c b/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c index 7665cf639db5..97c6a2fbaf1e 100644 --- a/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c +++ b/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c @@ -153,7 +153,7 @@ static void qse_free_tx_buffer(struct intel_fpga_qse_private *priv, } } -int alloc_init_skbufs(struct intel_fpga_qse_private *priv) +int qse_alloc_init_skbufs(struct intel_fpga_qse_private *priv) { unsigned int rx_descs = priv->dma_priv.rx_ring_size; unsigned int tx_descs = priv->dma_priv.tx_ring_size; @@ -205,7 +205,7 @@ int alloc_init_skbufs(struct intel_fpga_qse_private *priv) return ret; } -void free_skbufs(struct net_device *dev) +void qse_free_skbufs(struct net_device *dev) { struct intel_fpga_qse_private *priv = netdev_priv(dev); unsigned int rx_descs = priv->dma_priv.rx_ring_size; @@ -1016,7 +1016,7 @@ static int qse_open(struct net_device *dev) priv->dmaops->reset_dma(>dma_priv); - ret = alloc_init_skbufs(priv); + ret = qse_alloc_init_skbufs(priv); if (ret) { netdev_err(dev, "DMA descriptors initialization failed\n"); goto alloc_skbuf_error; @@ -1072,7 +1072,7 @@ static int qse_open(struct net_device *dev) return 0; init_error: - free_skbufs(dev); + qse_free_skbufs(dev); alloc_skbuf_error: phy_error: return ret; @@ -,7 +,7 @@ static int qse_shutdown(struct net_device *dev) */ if (ret) netdev_dbg(dev, "Cannot reset MAC core (error: %d)\n", ret); - free_skbufs(dev); + qse_free_skbufs(dev); spin_unlock(>tx_lock); spin_unlock(>mac_cfg_lock); -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12510): https://lists.yoctoproject.org/g/linux-yocto/message/12510 Mute This Topic: https://lists.yoctoproject.org/mt/98898744/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 07/46] HSD #14015618796: crypto: intel_fcs: To support concurrent fcs clients requests
From: Ang Tien Sung commit dd05e5a30c70c34866da13536dde41e926e9c622 from https://github.com/altera-opensource/linux-socfpga.git The current driver does not support concurrent clients sending IOCTL commands. The driver must implement a mutex lock at the start of an IOCTL command before allocating any memory from the stack and before initiating any SVC commands to the mailbox. Signed-off-by: Ang Tien Sung Signed-off-by: Wenlin Kang --- drivers/crypto/intel_fcs.c | 261 +++-- 1 file changed, 190 insertions(+), 71 deletions(-) diff --git a/drivers/crypto/intel_fcs.c b/drivers/crypto/intel_fcs.c index ee61668c5094..99955499c3b8 100644 --- a/drivers/crypto/intel_fcs.c +++ b/drivers/crypto/intel_fcs.c @@ -214,7 +214,6 @@ static int fcs_request_service(struct intel_fcs_priv *priv, (struct stratix10_svc_client_msg *)msg; int ret; - mutex_lock(>lock); reinit_completion(>completion); ret = stratix10_svc_send(priv->chan, p_msg); @@ -232,20 +231,28 @@ static int fcs_request_service(struct intel_fcs_priv *priv, } else ret = 0; - mutex_unlock(>lock); return ret; } -static void fcs_close_services(struct intel_fcs_priv *priv, - void *sbuf, void *dbuf) +static void fcs_free_memory(struct intel_fcs_priv *priv, + void *buf1, void *buf2, void *buf3) { - if (sbuf) - stratix10_svc_free_memory(priv->chan, sbuf); + if (buf1) + stratix10_svc_free_memory(priv->chan, buf1); - if (dbuf) - stratix10_svc_free_memory(priv->chan, dbuf); + if (buf2) + stratix10_svc_free_memory(priv->chan, buf2); + if (buf3) + stratix10_svc_free_memory(priv->chan, buf3); +} + +static void fcs_close_services(struct intel_fcs_priv *priv, + void *sbuf, void *dbuf) +{ + fcs_free_memory(priv, sbuf, dbuf, NULL); stratix10_svc_done(priv->chan); + mutex_unlock(>lock); } static long fcs_ioctl(struct file *file, unsigned int cmd, @@ -272,19 +279,24 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, priv = container_of(file->private_data, struct intel_fcs_priv, miscdev); dev = priv->client.dev; - + mutex_lock(>lock); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) + if (!data) { + mutex_unlock(>lock); return -ENOMEM; + } msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL); - if (!msg) + if (!msg) { + mutex_unlock(>lock); return -ENOMEM; + } switch (cmd) { case INTEL_FCS_DEV_VALIDATION_REQUEST: if (copy_from_user(data, (void __user *)arg, sizeof(*data))) { dev_err(dev, "failure on copy_from_user\n"); + mutex_unlock(>lock); return -EFAULT; } @@ -297,6 +309,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, if (ret) { dev_err(dev, "error requesting firmware %s\n", (char *)data->com_paras.s_request.src); + mutex_unlock(>lock); return -EFAULT; } @@ -305,6 +318,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, if (!s_buf) { dev_err(dev, "failed to allocate VAB buffer\n"); release_firmware(fw); + mutex_unlock(>lock); return -ENOMEM; } @@ -346,12 +360,14 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, case INTEL_FCS_DEV_SEND_CERTIFICATE: if (copy_from_user(data, (void __user *)arg, sizeof(*data))) { dev_err(dev, "failure on copy_from_user\n"); + mutex_unlock(>lock); return -EFAULT; } if (data->com_paras.c_request.size == 0 || data->com_paras.c_request.addr == NULL) { dev_err(dev, "Invalid VAB request param\n"); + mutex_unlock(>lock); return -EFAULT; } @@ -367,6 +383,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, s_buf = stratix10_svc_allocate_memory(priv->chan, datasz); if (!s_buf) { dev_err(dev, "failed to allocate VAB buffer\n"); + mutex_unlock(>lock); return -ENOMEM; } @@ -374,6 +391,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, if (!ps_buf) { dev_err(dev, "failed to allocate p-status buf\n");
[linux-yocto] [PATCH 02/46] HSD #14014656595: net: ethernet: altera: add ethtool support for Intel FPGA E-tile Ethernet driver
From: "Tham, Mun Yew" commit 07113cc9137023583c167b9e70c73168a3ba2060 from https://github.com/altera-opensource/linux-socfpga.git This patch adds ethtool support for Intel FPGA E-tile Ethernet driver. Signed-off-by: Tham, Mun Yew Signed-off-by: Wenlin Kang --- .../altera/intel_fpga_etile_ethtool.c | 963 ++ 1 file changed, 963 insertions(+) create mode 100644 drivers/net/ethernet/altera/intel_fpga_etile_ethtool.c diff --git a/drivers/net/ethernet/altera/intel_fpga_etile_ethtool.c b/drivers/net/ethernet/altera/intel_fpga_etile_ethtool.c new file mode 100644 index ..2653a7bac6c5 --- /dev/null +++ b/drivers/net/ethernet/altera/intel_fpga_etile_ethtool.c @@ -0,0 +1,963 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Ethtool support for Intel FPGA E-tile Ethernet MAC driver + * Copyright (C) 2019-2022 Intel Corporation. All rights reserved + * + * Contributors: + * Roman Bulgakov + * Yu Ying Choo + * Dalon Westergreen + * Joyce Ooi + * + * Original driver contributed by GlobalLogic. + */ + +#include +#include +#include +#include +#include +#include + +#include "altera_eth_dma.h" +#include "intel_fpga_etile.h" +#include "altera_utils.h" + +#define ETILE_STATS_LENARRAY_SIZE(stat_gstrings) +#define ETILE_NUM_REGS 294 + +static char const stat_gstrings[][ETH_GSTRING_LEN] = { + "tx_fragments", + "tx_jabbers", + "tx_fcs_errors", + "tx_crc_errors", + "tx_errored_multicast", + "tx_errored_broadcast", + "tx_errored_unicast", + "tx_errored_mulitcast_ctrl_frames", + "tx_errored_broadcast_ctrl_frames", + "tx_errored_unicast_ctrl_frames", + "tx_pause_errors", + "tx_64byte_frames", + "tx_65to127bytes_frames", + "tx_128to255bytes_frames", + "tx_256to511bytes_frames", + "tx_512to1023bytes_frames", + "tx_1024to1518bytes_frames", + "tx_1519tomax_frames", + "tx_oversize_frames", + "tx_multicast_frames", + "tx_broadcast_frames", + "tx_unicast_frames", + "tx_multicast_ctrl_frames", + "tx_broadcast_ctrl_frames", + "tx_unicast_ctrl_frames", + "tx_pause_frames", + "tx_runt_packets", + "tx_frame_starts", + "tx_length_errored_frames", + "tx_prc_errored_frames", + "tx_prc_frames", + "tx_payload_bytes", + "tx_bytes", + "tx_errors", + "tx_dropped", + "tx_bad_length_type_frames", + "rx_fragments", + "rx_jabbers", + "rx_fcs_errors", + "rx_crc_errors", + "rx_errored_multicast", + "rx_errored_broadcast", + "rx_errored_unicast", + "rx_errored_mulitcast_ctrl_frames", + "rx_errored_broadcast_ctrl_frames", + "rx_errored_unicast_ctrl_frames", + "rx_pause_errors", + "rx_64byte_frames", + "rx_65to127bytes_frames", + "rx_128to255bytes_frames", + "rx_256to511bytes_frames", + "rx_512to1023bytes_frames", + "rx_1024to1518bytes_frames", + "rx_1519tomax_frames", + "rx_oversize_frames", + "rx_multicast_frames", + "rx_broadcast_frames", + "rx_unicast_frames", + "rx_multicast_ctrl_frames", + "rx_broadcast_ctrl_frames", + "rx_unicast_ctrl_frames", + "rx_pause_frames", + "rx_runt_packets", + "rx_frame_starts", + "rx_length_errored_frames", + "rx_prc_errored_frames", + "rx_prc_frames", + "rx_payload_bytes", + "rx_bytes" +}; + +static void etile_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strscpy(info->driver, "intel_fpga_etile", ETH_GSTRING_LEN); + strscpy(info->version, "v1.0", ETH_GSTRING_LEN); + strscpy(info->bus_info, "platform", ETH_GSTRING_LEN); +} + +/* Fill in a buffer with the strings which correspond to the + * stats + */ +static void etile_gstrings(struct net_device *dev, u32 stringset, u8 *buf) +{ + memcpy(buf, stat_gstrings, ETILE_STATS_LEN * ETH_GSTRING_LEN); +} + +static void etile_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, +u64 *buf) +{ + struct intel_fpga_etile_eth_private *priv = netdev_priv(dev); + u32 lsb; + u32 msb; + + /* TX Fragments */ + lsb = csrrd32(priv->mac_dev, eth_tx_stats_csroffs(tx_fragments_lsb)); + msb = csrrd32(priv->mac_dev, eth_tx_stats_csroffs(tx_fragments_msb)); + buf[0] = ((u64)msb << 32) | lsb; + + /* TX Jabbers */ + lsb = csrrd32(priv->mac_dev, eth_tx_stats_csroffs(tx_jabbers_lsb)); + msb = csrrd32(priv->mac_dev, eth_tx_stats_csroffs(tx_jabbers_msb)); + buf[1] = ((u64)msb << 32) | lsb; + + /* TX FCS errors */ + lsb = csrrd32(priv->mac_dev, eth_tx_stats_csroffs(tx_fcserr_lsb)); + msb = csrrd32(priv->mac_dev, eth_tx_stats_csroffs(tx_fcserr_msb)); + buf[2] = ((u64)msb << 32) | lsb; + + /* TX CRC errors */ + lsb =
[linux-yocto] [PATCH 06/46] Revert "intel: fcs: avoid allocating memory repeatedly"
From: Wenlin Kang Since this issue already fix by upstream commit dd05e5a3(HSD #14015618796: crypto: intel_fcs: To support concurrent fcs clients requests) This reverts commit 9dfe713b6ff10378972c68893ca9d789dc52c663. --- drivers/crypto/intel_fcs.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/intel_fcs.c b/drivers/crypto/intel_fcs.c index 832c05133eb3..ee61668c5094 100644 --- a/drivers/crypto/intel_fcs.c +++ b/drivers/crypto/intel_fcs.c @@ -252,11 +252,9 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct intel_fcs_dev_ioctl *data; - struct intel_fcs_dev_ioctl data_var; struct intel_fcs_priv *priv; struct device *dev; struct stratix10_svc_client_msg *msg; - struct stratix10_svc_client_msg msg_var; const struct firmware *fw; char filename[FILE_NAME_SIZE]; size_t tsz, rsz, datasz, ud_sz; @@ -274,8 +272,14 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, priv = container_of(file->private_data, struct intel_fcs_priv, miscdev); dev = priv->client.dev; - data = _var; - msg = _var; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL); + if (!msg) + return -ENOMEM; switch (cmd) { case INTEL_FCS_DEV_VALIDATION_REQUEST: @@ -470,6 +474,7 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, dev_err(dev, "failed to allocate RNG buffer\n"); return -ENOMEM; } + msg->command = COMMAND_FCS_RANDOM_NUMBER_GEN; msg->payload = s_buf; msg->payload_length = RANDOM_NUMBER_SIZE; @@ -2461,7 +2466,6 @@ static int fcs_close(struct inode *inode, struct file *file) static int fcs_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) { struct stratix10_svc_client_msg *msg; - struct stratix10_svc_client_msg msg_var; struct intel_fcs_priv *priv; struct device *dev; void *s_buf; @@ -2480,7 +2484,12 @@ static int fcs_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) priv = (struct intel_fcs_priv *)rng->priv; dev = priv->client.dev; - msg = _var; + + msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL); + if (!msg) { + dev_err(dev, "failed to allocate msg buffer\n"); + return -ENOMEM; + } s_buf = stratix10_svc_allocate_memory(priv->chan, RANDOM_NUMBER_SIZE); @@ -2488,6 +2497,7 @@ static int fcs_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) dev_err(dev, "failed to allocate random number buffer\n"); return -ENOMEM; } + msg->command = COMMAND_FCS_RANDOM_NUMBER_GEN; msg->payload = s_buf; msg->payload_length = RANDOM_NUMBER_SIZE; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12508): https://lists.yoctoproject.org/g/linux-yocto/message/12508 Mute This Topic: https://lists.yoctoproject.org/mt/98898742/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 05/46] HSD #14014656595: net: phy: add PHY_INTERFACE_MODE_25GKR
From: "Tham, Mun Yew" commit cb5da536a2f6f4f84ff8b468b026e54974a7d07e from https://github.com/altera-opensource/linux-socfpga.git Add PHY_INTERFACE_MODE_25GKR for 25 Gigabit Ethernet Signed-off-by: Tham, Mun Yew Signed-off-by: Wenlin Kang --- include/linux/phy.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/phy.h b/include/linux/phy.h index 08725a262f32..5d69281bb67d 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -144,6 +144,8 @@ typedef enum { PHY_INTERFACE_MODE_USXGMII, /* 10GBASE-KR - with Clause 73 AN */ PHY_INTERFACE_MODE_10GKR, + /* 25GBASE-KR */ + PHY_INTERFACE_MODE_25GKR, PHY_INTERFACE_MODE_MAX, } phy_interface_t; @@ -217,6 +219,8 @@ static inline const char *phy_modes(phy_interface_t interface) return "usxgmii"; case PHY_INTERFACE_MODE_10GKR: return "10gbase-kr"; + case PHY_INTERFACE_MODE_25GKR: + return "25gbase-kr"; default: return "unknown"; } -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12507): https://lists.yoctoproject.org/g/linux-yocto/message/12507 Mute This Topic: https://lists.yoctoproject.org/mt/98898741/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 04/46] HSD #14014656595: net: ethernet: altera: add Intel FPGA E-tile Ethernet driver Makefile and Kconfig
From: "Tham, Mun Yew" commit 45091e472d3df0e8be7275a9e8d96bc46c6ba700 from https://github.com/altera-opensource/linux-socfpga.git This patch adds Makefile and Kconfig for Intel FPGA E-tile Ethernet driver. Signed-off-by: Tham, Mun Yew Signed-off-by: Wenlin Kang --- drivers/net/ethernet/altera/Kconfig | 10 ++ drivers/net/ethernet/altera/Makefile | 6 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/altera/Kconfig b/drivers/net/ethernet/altera/Kconfig index aa46327fb7a6..8f937f3b46d2 100644 --- a/drivers/net/ethernet/altera/Kconfig +++ b/drivers/net/ethernet/altera/Kconfig @@ -31,5 +31,15 @@ config INTEL_FPGA_QSE_LL To compile this driver as a module, choose M here. The module will be called intel_fpga_qse_ll. +config INTEL_FPGA_ETILE + tristate "Intel FPGA E-tile Ethernet MAC support" + select PTP_1588_CLOCK + select PHYLINK + help + This driver supports the Intel FPGA E-tile Ethernet MAC. + + To compile this driver as a module, choose M here. The module + will be called intel_fpga_etile. + endif diff --git a/drivers/net/ethernet/altera/Makefile b/drivers/net/ethernet/altera/Makefile index 21a9de506e4d..f82fe30fc49a 100644 --- a/drivers/net/ethernet/altera/Makefile +++ b/drivers/net/ethernet/altera/Makefile @@ -15,4 +15,8 @@ ifeq ($(CONFIG_INTEL_FPGA_QSE_LL),y) obj-$(CONFIG_INTEL_FPGA_QSE_LL) += intel_fpga_qse_ll.o intel_fpga_qse_ll-objs := intel_fpga_qse_ll_main.o intel_fpga_qse_ll_ethtool.o endif - +ifeq ($(CONFIG_INTEL_FPGA_ETILE),y) + obj-$(CONFIG_INTEL_FPGA_ETILE) += intel_fpga_etile.o + intel_fpga_etile-objs := intel_fpga_etile_main.o intel_fpga_etile_fec.o \ +intel_fpga_etile_ethtool.o +endif -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12506): https://lists.yoctoproject.org/g/linux-yocto/message/12506 Mute This Topic: https://lists.yoctoproject.org/mt/98898740/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[linux-yocto] [PATCH 03/46] HSD #14014656595: net: ethernet: altera: add FEC driver for Intel FPGA E-tile Ethernet driver
From: "Tham, Mun Yew" commit 9d5cb4437f4e1182f03424b26eac2954687af777 from https://github.com/altera-opensource/linux-socfpga.git This patch adds FEC driver for Intel FPGA E-tile Ethernet driver. Signed-off-by: Tham, Mun Yew Signed-off-by: Wenlin Kang --- .../ethernet/altera/intel_fpga_etile_fec.c| 212 ++ 1 file changed, 212 insertions(+) create mode 100644 drivers/net/ethernet/altera/intel_fpga_etile_fec.c diff --git a/drivers/net/ethernet/altera/intel_fpga_etile_fec.c b/drivers/net/ethernet/altera/intel_fpga_etile_fec.c new file mode 100644 index ..b1ca83a07985 --- /dev/null +++ b/drivers/net/ethernet/altera/intel_fpga_etile_fec.c @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Intel FPGA E-tile Forward Error Correction (FEC) Linux driver + * Copyright (C) 2020-2022 Intel Corporation. All rights reserved. + * + * Contributors: + * Joyce Ooi + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "altera_eth_dma.h" +#include "altera_utils.h" +#include "intel_fpga_etile.h" + +#define MAX_COUNT_OFFSET 64000 + +/* Init FEC */ +int fec_init(struct platform_device *pdev, struct intel_fpga_etile_eth_private *priv) +{ + int ret; + + /* get FEC type from device tree */ + ret = of_property_read_string(pdev->dev.of_node, "fec-type", + >fec_type); + if (ret < 0) { + dev_err(>dev, "cannot obtain fec-type\n"); + return ret; + } + dev_info(>dev, "\tFEC type is %s\n", priv->fec_type); + + /* get FEC channel from device tree */ + if (of_property_read_u32(pdev->dev.of_node, "fec-channel", +>fec_channel)) { + dev_err(>dev, "cannot obtain fec-channel\n"); + return -ENXIO; + } + dev_info(>dev, "\tfec-channel is 0x%x\n", priv->fec_channel); + + return 0; +} + +/* Calculate Unit Interval Adjustments */ +void ui_adjustments(struct timer_list *t) +{ + struct intel_fpga_etile_eth_private *priv = from_timer(priv, t, fec_timer); + u32 tx_tam_l_initial, tx_tam_h_initial, tx_tam_count_initial; + u32 rx_tam_l_initial, rx_tam_h_initial, rx_tam_count_initial; + u32 tx_tam_l_nth, tx_tam_h_nth, tx_tam_count_nth; + u32 rx_tam_l_nth, rx_tam_h_nth, rx_tam_count_nth; + u64 tx_tam_initial, rx_tam_initial, tx_tam_nth, rx_tam_nth; + u32 tx_tam_interval = 0, rx_tam_interval = 0; + u32 tx_tam_count_est, rx_tam_count_est, ui_value, tx_tam_count, rx_tam_count; + u64 tx_tam_delta, rx_tam_delta; + u64 tx_ui, rx_ui; + u64 start_jiffies; + + start_jiffies = get_jiffies_64(); + /* Set tam_snapshot to 1 to take the first snapshot of the Time of +* Alignment marker (TAM) +*/ + tse_set_bit(priv->mac_dev, eth_ptp_csroffs(tam_snapshot), + ETH_TAM_SNAPSHOT); + + /* Read snapshotted initial TX TAM and counter values */ + tx_tam_l_initial = csrrd32(priv->mac_dev, eth_ptp_csroffs(tx_tam_l)); + tx_tam_h_initial = csrrd32(priv->mac_dev, eth_ptp_csroffs(tx_tam_h)); + tx_tam_initial = ((u64)tx_tam_h_initial << 32) | tx_tam_l_initial; + tx_tam_count_initial = csrrd32(priv->mac_dev, eth_ptp_csroffs(tx_count)); + + /* Read snapshotted initial RX TAM and counter values */ + rx_tam_l_initial = csrrd32(priv->mac_dev, eth_ptp_csroffs(rx_tam_l)); + rx_tam_h_initial = csrrd32(priv->mac_dev, eth_ptp_csroffs(rx_tam_h)); + rx_tam_initial = ((u64)rx_tam_h_initial << 32) | rx_tam_l_initial; + rx_tam_count_initial = csrrd32(priv->mac_dev, eth_ptp_csroffs(rx_count)); + + /* Clear snapshot */ + tse_clear_bit(priv->mac_dev, eth_ptp_csroffs(tam_snapshot), + ETH_TAM_SNAPSHOT); + + /* Wait for a few TAM interval */ + udelay(210); + + /* Request snapshot of Nth TX TAM and RX TAM */ + tse_set_bit(priv->mac_dev, eth_ptp_csroffs(tam_snapshot), + ETH_TAM_SNAPSHOT); + + /* Read snapshotted of Nth TX TAM and counter values */ + tx_tam_l_nth = csrrd32(priv->mac_dev, eth_ptp_csroffs(tx_tam_l)); + tx_tam_h_nth = csrrd32(priv->mac_dev, eth_ptp_csroffs(tx_tam_h)); + tx_tam_nth = ((u64)tx_tam_h_nth << 32) | tx_tam_l_nth; + tx_tam_count_nth = csrrd32(priv->mac_dev, eth_ptp_csroffs(tx_count)); + + /* Read snapshotted of Nth RX TAM and counter values */ + rx_tam_l_nth = csrrd32(priv->mac_dev, eth_ptp_csroffs(rx_tam_l)); + rx_tam_h_nth = csrrd32(priv->mac_dev, eth_ptp_csroffs(rx_tam_h)); + rx_tam_nth = ((u64)rx_tam_h_nth << 32) | rx_tam_l_nth; + rx_tam_count_nth = csrrd32(priv->mac_dev, eth_ptp_csroffs(rx_count)); + + /* Clear snapshot */ + tse_clear_bit(priv->mac_dev, eth_ptp_csroffs(tam_snapshot), +
[linux-yocto][v5.10/standard/intel-sdk-5.10/intel-socfpga][PATCH 00/46] Update BSP intel-socfpga-64 to latest
From: Wenlin Kang *** BLURB HERE *** Alexey Gladkov (2): Add a reference to ucounts for each cred Use atomic_t for ucounts reference counting Ang Tien Sung (3): HSD #14015618796: crypto: intel_fcs: To support concurrent fcs clients requests fpga: altera-cvp: Increase credit timeout HSD #1509151525: fpga: altera-cvp: Truncated bitstream error support Dinh Nguyen (5): Revert "cgroup: Use open-time credentials for process migraton perm checks" i2c: designware: introduce a custom scl recovery for SoCFPGA platforms dt-bindings: i2c: dw: Add Intel's SoCFPGA I2C controller arm: dts: socfpga: use the "intel,socfpga-i2c" binding ARM: dts: add EMAC AXI settings for Cyclone5 Eric W. Biederman (1): ucount: Make get_ucount a safe get_user replacement Jason Wang (1): vdpa: introduce virtio pci driver John Harrison (1): drm/i915/guc: Update to use firmware v49.0.1 Juergen Gross (1): xen/grant-table: add gnttab_try_end_foreign_access() Laura Abbott (1): vdpa: clean up get_config_size ret value handling Matthew Gerlach (3): dt-bindings: soc: add bindings for Intel HPS Copy Engine dt-bindings: intel: add binding for Intel n6000 arm64: dts: intel: add device tree for n6000 NagarajuDeepakX (1): HSD #14014656595: drivers: net: phy: add qsfp_phy support Niravkumar L Rabara (1): HSD #18019805663: mtd: spi-nor: issi: Add IS25WP512 device Radu Bacrau (1): HSD #15010832611: firmware: stratix10-rsu: query spt addresses Ritesh Harjani (2): jbd2: refactor wait logic for transaction updates into a common function jbd2: fix use-after-free of transaction_t race Stefano Garzarella (3): vdpa_sim: rename vdpasim_config_ops variables vdpa: add get_config_size callback in vdpa_config_ops vhost/vdpa: use get_config_size callback in vhost_vdpa_config_validate() Teh Wen Ping (2): HSD #18019787908 firmware: stratix10-svc: Reduce polling interval for command status HSD #18019787908 crypto: intel_fcs: Reduce polling interval for GET_PROVISION_DATA Teh, Wen Ping (6): HSD #15010087323 firmware: stratix10-svc: AES, SHA2/HMAC and ECDSA service for large file HSD #15010087323 crypto: intel_fcs: AES service for large file HSD #15010087323 crypto: intel_fcs: ECDSA service for large file HSD #15010087323 crypto: intel_fcs: SHA2/HMAC service for large file HSD #1509644685 firmware: stratix10-svc: Generic Mailbox Command HSD #1509644685 crypto: intel_fcs: Generic Mailbox Command Tejun Heo (1): cgroup: Use open-time credentials for process migraton perm checks Teoh, Ji Sheng (3): HSD #14015950233: arm64: configs: enable HW_RANDOM as kernel module HSD #15010262011-1: arm64: dts: stratix10: change QSE phy-mode to 10gbase-r HSD #15010262011-2: net: eth: altera: fix QSE driver broken link speed configuration Tham, Mun Yew (7): HSD #14014656595: net: ethernet: altera: add main and header file for Intel FPGA E-tile Ethernet driver HSD #14014656595: net: ethernet: altera: add ethtool support for Intel FPGA E-tile Ethernet driver HSD #14014656595: net: ethernet: altera: add FEC driver for Intel FPGA E-tile Ethernet driver HSD #14014656595: net: ethernet: altera: add Intel FPGA E-tile Ethernet driver Makefile and Kconfig HSD #14014656595: net: phy: add PHY_INTERFACE_MODE_25GKR net: ethernet: Fix multiple definitions of alloc_init_skbufs and free_skbufs HSD #22012268110: net: ethernet: altera: E-Tile fixed link implementation Wenlin Kang (1): Revert "intel: fcs: avoid allocating memory repeatedly" .../bindings/arm/intel,socfpga.yaml | 27 + .../bindings/i2c/snps,designware-i2c.yaml |2 + .../soc/intel/intel,hps-copy-engine.yaml | 51 + arch/arm/boot/dts/socfpga.dtsi| 16 +- arch/arm/boot/dts/socfpga_arria10.dtsi| 10 +- .../boot/dts/altera/socfpga_stratix10.dtsi| 10 +- .../dts/altera/socfpga_stratix10_qse.dtsi |2 +- arch/arm64/boot/dts/intel/Makefile|3 +- arch/arm64/boot/dts/intel/socfpga_agilex.dtsi | 10 +- .../boot/dts/intel/socfpga_agilex_n6000.dts | 66 + arch/arm64/configs/defconfig |1 + drivers/Makefile |1 + drivers/crypto/intel_fcs.c| 888 -- drivers/firmware/stratix10-rsu.c | 98 + drivers/firmware/stratix10-svc.c | 169 +- drivers/fpga/altera-cvp.c | 26 +- drivers/gpu/drm/i915/gt/intel_engine_cs.c |3 +- drivers/gpu/drm/i915/gt/uc/intel_guc.c| 18 - drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c| 131 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 80 +- drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h|5 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 27 +- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h |2 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h |6 +- drivers/i2c/busses/i2c-designware-core.h |1 +