├── .artifactignore ├── config.local ├── arm64 │ ├── config.sonic-mellanox │ ├── defines.toml │ ├── config.sonic-secureboot │ ├── config.sonic-pensando │ └── config.sonic ├── armhf │ ├── config.sonic │ ├── defines.toml │ └── config.sonic-marvell-prestera ├── amd64 │ ├── defines.toml │ └── config.sonic-secureboot ├── defines.toml └── featureset-sonic │ └── config ├── .gitignore ├── patch ├── kconfig-force-inclusions ├── kconfig-secure-boot-inclusions ├── kconfig-secure-boot-exclusions └── kconfig-exclusions ├── patches-sonic ├── kconfig-force-inclusions ├── kconfig-secure-boot-inclusions ├── kconfig-secure-boot-exclusions ├── driver-support-sff-8436-read-write-fix.patch ├── 0001-psample-define-the-macro-PSAMPLE_MD_EXTENDED_ATTR.patch ├── driver-support-optoe-update-to-linux-6.1.patch ├── driver-support-optoe-update-to-linux-6.10.patch ├── 0005-dt-bindings-hwmon-Add-tmp75b-to-lm75.txt.patch ├── 0028-Added-current-sensors-in-dtsi.patch ├── 0009-dt-bindings-marvell-Add-ARMADA-7K-properties.patch ├── 0006-device-tree-bindinds-add-NXP-PCT2075-as-compatible-d.patch ├── 0017-Extend-driver-to-support-XMC-XM25QH256C-device.patch ├── 0028-Create-miniaturised-diafgw-partition-for-128MB-flash.patch ├── cisco-mtd-part.patch ├── 0037-platform-mellanox-mlxreg-io-Extend-number-of-hwmon-a.patch ├── 0026-Add-support-for-new-qspi-macronix-flash-mx66u1g45g.patch ├── 8003-mlxsw-minimal-Downstream-Ignore-error-reading-SPAD-r.patch ├── 8005-i2c-mlxcpld-Downstream-WA-to-avoid-error-for-SMBUS-r.patch ├── 8011-hwmon-pmbus-Downstream-Workaround-for-psu-attributes.patch ├── 0020-dt-bindings-trivial-devices-Add-infineon-xdpe1a2g7.patch ├── 8014-platform-mellanox-mlxreg-dpu-Debug-trace-for-dpu-pro.patch ├── driver-hwmon-lm75b-update.patch ├── 8000-mlxsw-Use-weak-reverse-dependencies-for-firmware-fla.patch ├── 0031-platform-mellanox-indicate-deferred-I2C-bus-creation.patch ├── 0001-fix-os-crash-caused-by-optoe-when-class-switch.patch ├── cisco-x86-gpio-config.patch ├── driver-support-optoe-write-max_fix.patch ├── 0019-Extend-driver-to-support-Infineon-Digital-Multi-phas.patch ├── 0011-PCI-AER-Fix-NULL-pointer-access-by-aer_info.patch ├── 0010-fix-aer-ratelimiting-sysfs-output-units.patch ├── 0265-hwmon-mlxreg-fan-Return-zero-speed-for-broken-fan.patch ├── 0007-usb-ehci-Add-support-for-ac5.patch ├── 0006-platform-mellanox-mlxreg-io-use-sysfs_emit-instead-o.patch ├── 0007-usb-ehci-Add-support-for-ac5-with-DMA-mask-64-bit.patch ├── 0005-platform-mellanox-mlxreg-hotplug-use-sysfs_emit-inst.patch ├── 0001-tty-8250-HSUART-DMA-be-deactivated-for-DNV-CPU.patch ├── 0021-leds-mlxreg-Skip-setting-LED-color-during-initializa.patch ├── 0044-platform_data-mlxreg-Add-non-sticky-bit-indication-f.patch ├── kconfig-exclusions ├── 0004-PCI-AER-Simplify-add_error_device.patch ├── driver-at24-fix-odd-length-two-byte-access.patch ├── 0004-dt-bindings-hwmon-Add-missing-documentation-for-lm75.patch ├── 0001-Change-the-system.map-file-permission-only-readable-.patch ├── 0019-mrvl-gicp-clr-irqs-on-probe.patch ├── cisco-ds4424-null-of-node.patch ├── 0202-i2c-mlxbf-prevent-stack-overflow-in-mlxbf_i2c_smbus_.patch ├── rtnetlink-catch-EOPNOTSUPP-errors.patch ├── 0018-drivers-i2c-fix-after-kdump-crash.patch ├── 0018-i2c-mv64xxx-kdump-sonic.patch ├── kernel-sched-core-fix-cgroup-fork-race.patch ├── 8010-mlxsw-minimal-Downstream-Disable-ethtool-interface.patch ├── 0195-platform-x86-MLX_PLATFORM-select-REGMAP-instead-of-d.patch ├── 8007-hwmon-emc2305-Downstream-Allow-fan-speed-setting-gra.patch ├── 0003-arm64-dts-marvell-Add-NAND-flash-controller-to-AC5.patch ├── 0018-leds-mlxreg-Remove-code-for-amber-LED-colour.patch ├── 0029-pcie-if-hotplug-enabled-do-immediate-reset-on-panic.patch ├── cisco-acpi-spi-nor.patch ├── cisco-hwmon-pmbus_core-pec-support-check.patch ├── driver-net-tg3-add-param-short-preamble-and-reset.patch ├── 0001-mlxbf-bootctl-Constify-struct-bin_attribute.patch ├── 0019-irqchip-mvebu-gicp-Clear-pending-interrupts-on-init.patch ├── 0201-i2c-mlxbf-incorrect-base-address-passed-during-io-wr.patch ├── driver-net-tg3-change-dma-mask-for-57766.patch ├── 0004-arm64-traps-Call-platform-handler-for-do_serror.patch ├── 8013-hwmon-pmbus-mp2975-Clear-interrupts-at-probe.patch ├── 0008-mlxbf-bootctl-use-sysfs_emit_at-in-secure_boot_fuse_.patch ├── driver-i2c-bus-intel-ismt-add-delay-param.patch ├── 0045-platform-mellanox-mlxreg-hotplug-Add-handling-of-non.patch ├── 0036-platform-mellanox-mlxreg-dpu-Fix-smatch-warnings.patch ├── 0000-Add-support-for-the-TI-TPS53659.patch ├── 8008-hwmon-mlxsw-Downstream-Allow-fan-speed-setting-granu.patch ├── driver-arista-i2c-designware-shutdown.patch ├── 0001-armhf_secondary_boot_online.patch ├── 0038-platform_data-mlxreg-Add-fields-for-interrupt-storm-.patch ├── 0032-platform_data-mlxreg-Add-capability-bit-and-mask-fie.patch ├── 0017-leds-mlxreg-Add-support-for-new-flavour-of-capabilit.patch ├── 8006-hwmon-mlxreg-fan-Downstream-Allow-fan-speed-setting-.patch ├── 0001-hwmon-emc2305-Fix-unable-to-probe-emc2301-2-3.patch ├── driver-arista-net-tg3-disallow-broadcom-default-mac.patch ├── 0023-arch-arm64-boot-dts-psci-support.patch ├── 0034-platform-mellanox-Cosmetic-changes-to-improve-code-s.patch ├── driver-arista-mmcblk-not-working-on-AMD-platforms.patch ├── driver-arista-net-tg3-access-regs-indirectly.patch ├── driver-arista-net-tg3-dma-mask-4g-sb800.patch ├── driver-hwmon-pmbus-add-dps460-support.patch ├── 8004-leds-leds-mlxreg-Downstream-Send-udev-event-from-led.patch ├── 0004-arm64-dts-ac5-add-mmc-node-and-clock.patch ├── 0047-hwmon-mlxreg-fan-Prevent-fans-from-getting-stuck-at-.patch ├── driver-support-optoe-chunk-offset-fix.patch ├── driver-support-optoe-oneaddr-pageable.patch ├── 0012-PCI-AER-Avoid-NULL-pointer-dereference-in-aer_rateli.patch ├── 0002-PCI-AER-Update-statistics-before-ratelimiting.patch ├── 0055-platform-mellanox-Downstream-Add-support-DGX-flavor-.patch ├── 0003-PCI-AER-Trace-error-event-before-ratelimiting.patch ├── driver-support-optoe-twoaddr-a2h-access.patch ├── 0005-dts-ac5-marvell-Add-switching-watchdog-node.patch ├── cisco-npu-disable-other-bars.patch ├── 0027-platform-mellanox-mlx-platform-Change-register-name.patch ├── cisco-add-support-for-ltc2979-chip.patch ├── 0001-efi-memattr-Ignore-table-if-the-size-is-clearly-bogus.patch ├── cisco-mdio-mux-support-acpi.patch ├── driver-arista-restrict-eMMC-drive-to-50Mhz-from-userland.patch ├── 0004-platform-mellanox-mlxbf-bootctl-use-sysfs_emit-inste.patch └── 0002-arm64-dts-Update-cache-properties-for-marvell.patch ├── CODEOWNERS ├── patches-debian └── disable-secureboot-config-checks.patch ├── manage-config └── azure-pipelines.yml /.artifactignore: -------------------------------------------------------------------------------- 1 | **/* 2 | !*.deb 3 | !kconfig-diff-*.rst 4 | -------------------------------------------------------------------------------- /config.local/arm64/config.sonic-mellanox: -------------------------------------------------------------------------------- 1 | [mellanox-arm64] 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.deb 2 | *.debian.tar.xz 3 | *.dsc 4 | *.orig.tar.xz 5 | linux-[0-9]*.[0-9]*.[0-9]*/ 6 | -------------------------------------------------------------------------------- /patch/kconfig-force-inclusions: -------------------------------------------------------------------------------- 1 | [arm64] 2 | CONFIG_COMPAT_VDSO=y 3 | CONFIG_THUMB2_COMPAT_VDSO=y 4 | -------------------------------------------------------------------------------- /patches-sonic/kconfig-force-inclusions: -------------------------------------------------------------------------------- 1 | [arm64] 2 | CONFIG_COMPAT_VDSO=y 3 | CONFIG_THUMB2_COMPAT_VDSO=y 4 | -------------------------------------------------------------------------------- /config.local/armhf/config.sonic: -------------------------------------------------------------------------------- 1 | CONFIG_EEPROM_SFF_8436=m 2 | CONFIG_EEPROM_OPTOE=m 3 | CONFIG_I2C_MUX_GPIO=m 4 | -------------------------------------------------------------------------------- /config.local/amd64/defines.toml: -------------------------------------------------------------------------------- 1 | [[featureset]] 2 | name = 'sonic' 3 | [[featureset.flavour]] 4 | name = 'amd64' 5 | [featureset.flavour.build] 6 | config = ['amd64/config.sonic'] 7 | -------------------------------------------------------------------------------- /config.local/arm64/defines.toml: -------------------------------------------------------------------------------- 1 | [[featureset]] 2 | name = 'sonic' 3 | [[featureset.flavour]] 4 | name = 'arm64' 5 | [featureset.flavour.build] 6 | config = ['arm64/config.sonic', 'arm64/config.sonic-platform-specific'] 7 | -------------------------------------------------------------------------------- /config.local/armhf/defines.toml: -------------------------------------------------------------------------------- 1 | [[featureset]] 2 | name = 'sonic' 3 | [[featureset.flavour]] 4 | name = 'armmp' 5 | [featureset.flavour.build] 6 | config = ['armhf/config.sonic', 'armhf/config.sonic-platform-specific'] 7 | -------------------------------------------------------------------------------- /config.local/arm64/config.sonic-secureboot: -------------------------------------------------------------------------------- 1 | CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem" 2 | CONFIG_MODULE_SIG_HASH="sha512" 3 | CONFIG_MODULE_SIG_SHA512=y 4 | CONFIG_KEXEC_SIG=y 5 | CONFIG_MODULE_SIG_FORCE=y 6 | 7 | CONFIG_MODULE_SIG_SHA256=n 8 | # For mellanox 9 | CONFIG_SECURITY_LOCKDOWN_LSM=n 10 | CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=n 11 | CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE=n 12 | CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT=n 13 | -------------------------------------------------------------------------------- /config.local/amd64/config.sonic-secureboot: -------------------------------------------------------------------------------- 1 | CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem" 2 | CONFIG_MODULE_SIG_HASH="sha512" 3 | CONFIG_MODULE_SIG_SHA512=y 4 | CONFIG_KEXEC_SIG_FORCE=y 5 | CONFIG_MODULE_SIG_FORCE=y 6 | 7 | CONFIG_MODULE_SIG_SHA256=n 8 | # For mellanox 9 | CONFIG_SECURITY_LOCKDOWN_LSM=n 10 | CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=n 11 | CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE=n 12 | CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT=n 13 | -------------------------------------------------------------------------------- /patch/kconfig-secure-boot-inclusions: -------------------------------------------------------------------------------- 1 | [common] 2 | 3 | [amd64] 4 | CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem" 5 | CONFIG_MODULE_SIG_HASH="sha512" 6 | CONFIG_MODULE_SIG_SHA512=y 7 | CONFIG_KEXEC_SIG_FORCE=y 8 | CONFIG_MODULE_SIG_FORCE=y 9 | 10 | [arm64] 11 | CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem" 12 | CONFIG_MODULE_SIG_HASH="sha512" 13 | CONFIG_MODULE_SIG_SHA512=y 14 | CONFIG_KEXEC_SIG=y 15 | CONFIG_MODULE_SIG_FORCE=y 16 | 17 | [armhf] 18 | 19 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This is a comment. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # rules are explained here 5 | # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 6 | 7 | # These owners will be the default owners for everything in 8 | # the repo. Unless a later match takes precedence, 9 | # @user will be requested for review when someone opens 10 | # a pull request. 11 | * @sonic-net/sonic-linux-kernel-maintainer 12 | -------------------------------------------------------------------------------- /patches-sonic/kconfig-secure-boot-inclusions: -------------------------------------------------------------------------------- 1 | [common] 2 | 3 | [amd64] 4 | CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem" 5 | CONFIG_MODULE_SIG_HASH="sha512" 6 | CONFIG_MODULE_SIG_SHA512=y 7 | CONFIG_KEXEC_SIG_FORCE=y 8 | CONFIG_MODULE_SIG_FORCE=y 9 | 10 | [arm64] 11 | CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem" 12 | CONFIG_MODULE_SIG_HASH="sha512" 13 | CONFIG_MODULE_SIG_SHA512=y 14 | CONFIG_KEXEC_SIG=y 15 | CONFIG_MODULE_SIG_FORCE=y 16 | 17 | [armhf] 18 | 19 | -------------------------------------------------------------------------------- /patch/kconfig-secure-boot-exclusions: -------------------------------------------------------------------------------- 1 | [common] 2 | 3 | [amd64] 4 | CONFIG_MODULE_SIG_SHA256 5 | # For mellanox 6 | CONFIG_SECURITY_LOCKDOWN_LSM 7 | CONFIG_SECURITY_LOCKDOWN_LSM_EARLY 8 | CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE 9 | CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT 10 | 11 | [arm64] 12 | CONFIG_MODULE_SIG_SHA256 13 | # For mellanox 14 | CONFIG_SECURITY_LOCKDOWN_LSM 15 | CONFIG_SECURITY_LOCKDOWN_LSM_EARLY 16 | CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE 17 | CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT 18 | 19 | [armhf] 20 | 21 | -------------------------------------------------------------------------------- /config.local/defines.toml: -------------------------------------------------------------------------------- 1 | [packages] 2 | docs = false 3 | source = false 4 | tools_unversioned = false 5 | 6 | [[featureset]] 7 | name = 'none' 8 | enable = false 9 | 10 | [[featureset]] 11 | name = 'rt' 12 | enable = false 13 | 14 | [[featureset]] 15 | name = 'sonic' 16 | enable = true 17 | [featureset.description] 18 | parts = ['sonic'] 19 | [featureset.description.long] 20 | sonic = 'This kernel includes patches that support SONiC.' 21 | [featureset.description.short] 22 | sonic = 'SONiC Kernel' 23 | -------------------------------------------------------------------------------- /patches-sonic/kconfig-secure-boot-exclusions: -------------------------------------------------------------------------------- 1 | [common] 2 | 3 | [amd64] 4 | CONFIG_MODULE_SIG_SHA256 5 | # For mellanox 6 | CONFIG_SECURITY_LOCKDOWN_LSM 7 | CONFIG_SECURITY_LOCKDOWN_LSM_EARLY 8 | CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE 9 | CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT 10 | 11 | [arm64] 12 | CONFIG_MODULE_SIG_SHA256 13 | # For mellanox 14 | CONFIG_SECURITY_LOCKDOWN_LSM 15 | CONFIG_SECURITY_LOCKDOWN_LSM_EARLY 16 | CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE 17 | CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT 18 | 19 | [armhf] 20 | 21 | -------------------------------------------------------------------------------- /config.local/arm64/config.sonic-pensando: -------------------------------------------------------------------------------- 1 | CONFIG_ARCH_PENSANDO=y 2 | CONFIG_ARCH_PENSANDO_ELBA_SOC=y 3 | CONFIG_PENSANDO_SOC_PENFW=y 4 | CONFIG_EDAC_ELBA=y 5 | CONFIG_IRQ_PENSANDO=y 6 | CONFIG_MFD_PENSANDO_ELBASR=y 7 | CONFIG_RESET_ELBASR=y 8 | CONFIG_UIO_PCIEMAC=m 9 | CONFIG_UIO_PENMSI1=m 10 | CONFIG_UIO_PENGIC=m 11 | CONFIG_UIO_PENMSI=m 12 | CONFIG_ARM64_VA_BITS_39=y 13 | CONFIG_COMMON_CLK_CS2000_CP=y 14 | CONFIG_I2C_RD1173=y 15 | CONFIG_CONTEXT_TRACKING=y 16 | CONFIG_NO_HZ_FULL=y 17 | CONFIG_RCU_NOCB_CPU=y 18 | CONFIG_VIRT_CPU_ACCOUNTING=y 19 | CONFIG_VIRT_CPU_ACCOUNTING_GEN=y 20 | CONFIG_RTC_DRV_ELBA_CPLD=y 21 | -------------------------------------------------------------------------------- /config.local/armhf/config.sonic-marvell-prestera: -------------------------------------------------------------------------------- 1 | CONFIG_MTD_CMDLINE_PARTS=y 2 | CONFIG_MTD_OF_PARTS=y 3 | CONFIG_ARCH_VIRT=n 4 | CONFIG_ARCH_BCM=n 5 | CONFIG_ARCH_EXYNOS=n 6 | CONFIG_ARCH_HIGHBANK=n 7 | CONFIG_ARCH_MXC=n 8 | CONFIG_ARCH_MESON=n 9 | CONFIG_ARCH_OMAP3=n 10 | CONFIG_ARCH_OMAP4=n 11 | CONFIG_ARCH_ROCKCHIP=n 12 | CONFIG_ARCH_SOCFPGA=n 13 | CONFIG_ARCH_SUNXI=n 14 | CONFIG_ARCH_TEGRA=n 15 | CONFIG_ARCH_VEXPRESS=n 16 | CONFIG_ARCH_WM8850=n 17 | CONFIG_SOC_OMAP5=n 18 | CONFIG_SOC_AM33XX=n 19 | CONFIG_SOC_DRA7XX=n 20 | CONFIG_EFI=n 21 | CONFIG_SECONDARY_TRUSTED_KEYRING=n 22 | CONFIG_SYSTEM_BLACKLIST_KEYRING=n 23 | -------------------------------------------------------------------------------- /config.local/featureset-sonic/config: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_BUF_SHIFT=20 2 | CONFIG_RTC_INTF_DEV_UIE_EMUL=y 3 | 4 | # Unset to enable UBIFS on flash 5 | CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=n 6 | ###-> mellanox_common-start 7 | ###-> mellanox_common-end 8 | CONFIG_DRM=n 9 | CONFIG_VIDEO_DEV=n 10 | CONFIG_MEDIA_SUPPORT=n 11 | CONFIG_MEDIA_CONTROLLER=n 12 | CONFIG_DVB_CORE=n 13 | CONFIG_MEDIA_TUNER=n 14 | CONFIG_MEDIA_ATTACH=n 15 | 16 | # Disable module compression, since squashfs will do compression anyways 17 | CONFIG_MODULE_COMPRESS=n 18 | # Disable strict /dev/mem access checks to allow mmap on PCI resource file 19 | CONFIG_IO_STRICT_DEVMEM=n 20 | -------------------------------------------------------------------------------- /patches-debian/disable-secureboot-config-checks.patch: -------------------------------------------------------------------------------- 1 | Index: linux-6.12.41/debian/bin/buildcheck.py 2 | =================================================================== 3 | --- linux-6.12.41.orig/debian/bin/buildcheck.py 4 | +++ linux-6.12.41/debian/bin/buildcheck.py 5 | @@ -23,9 +23,7 @@ class CheckSecureBootConfig: 6 | with (self.dir / '.config').open() as fh: 7 | kconfig.read(fh) 8 | 9 | - for name, value in [('EFI_STUB', True), 10 | - ('LOCK_DOWN_IN_EFI_SECURE_BOOT', True), 11 | - ('SYSTEM_TRUSTED_KEYS', '""')]: 12 | + for name, value in [('EFI_STUB', True),]: 13 | if name not in kconfig: 14 | out.write(f'Secure Boot: CONFIG_{name} is not defined\n') 15 | fail = 1 16 | -------------------------------------------------------------------------------- /patches-sonic/driver-support-sff-8436-read-write-fix.patch: -------------------------------------------------------------------------------- 1 | Fix calculation of page_len in sff_8436_read_write function 2 | 3 | From: yurypm 4 | 5 | 6 | --- 7 | drivers/misc/eeprom/sff_8436_eeprom.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/misc/eeprom/sff_8436_eeprom.c b/drivers/misc/eeprom/sff_8436_eeprom.c 11 | index 4688597eb..10074f03a 100644 12 | --- a/drivers/misc/eeprom/sff_8436_eeprom.c 13 | +++ b/drivers/misc/eeprom/sff_8436_eeprom.c 14 | @@ -689,7 +689,7 @@ static ssize_t sff_8436_read_write(struct sff_8436_data *sff_8436, 15 | if (off + pending_len < page_start_offset + SFF_8436_PAGE_SIZE) { 16 | page_len = pending_len; 17 | } else { 18 | - page_len = SFF_8436_PAGE_SIZE - off; 19 | + page_len = SFF_8436_PAGE_SIZE - (off - page_start_offset); 20 | } 21 | } else { 22 | page_offset = page_start_offset; 23 | -------------------------------------------------------------------------------- /patches-sonic/0001-psample-define-the-macro-PSAMPLE_MD_EXTENDED_ATTR.patch: -------------------------------------------------------------------------------- 1 | From 7dbf2689eb841c51dca4dad51b0941c06aa09e26 Mon Sep 17 00:00:00 2001 2 | From: Vadym Hlushko 3 | Date: Mon, 11 Apr 2022 15:41:46 +0000 4 | Subject: psample: Add Nvidia-specific wrapper function for the psample driver 5 | 6 | Add a variable to notify the psample driver to use a wrapper function, 7 | which does preprocess before sending the sample packet to the userspace application. 8 | 9 | Signed-off-by: Vadym Hlushko 10 | --- 11 | include/net/psample.h | 2 ++ 12 | 1 file changed, 2 insertions(+) 13 | 14 | diff --git a/include/net/psample.h b/include/net/psample.h 15 | index 0509d2d..c66e325 100644 16 | --- a/include/net/psample.h 17 | +++ b/include/net/psample.h 18 | @@ -14,6 +14,8 @@ struct psample_group { 19 | struct rcu_head rcu; 20 | }; 21 | 22 | +#define PSAMPLE_MD_EXTENDED_ATTR 1 23 | + 24 | struct psample_metadata { 25 | u32 trunc_size; 26 | int in_ifindex; 27 | -------------------------------------------------------------------------------- /patches-sonic/driver-support-optoe-update-to-linux-6.1.patch: -------------------------------------------------------------------------------- 1 | Update optoe support for Linux 6.1 2 | 3 | From: Saikrishna Arcot 4 | 5 | 6 | --- 7 | drivers/misc/eeprom/optoe.c | 3 +-- 8 | 1 file changed, 1 insertion(+), 2 deletions(-) 9 | 10 | diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c 11 | index f34bfe88b..394c19944 100644 12 | --- a/drivers/misc/eeprom/optoe.c 13 | +++ b/drivers/misc/eeprom/optoe.c 14 | @@ -802,7 +802,7 @@ static ssize_t optoe_bin_write(struct file *filp, struct kobject *kobj, 15 | return optoe_read_write(optoe, buf, off, count, OPTOE_WRITE_OP); 16 | } 17 | 18 | -static int optoe_remove(struct i2c_client *client) 19 | +static void optoe_remove(struct i2c_client *client) 20 | { 21 | struct optoe_data *optoe; 22 | int i; 23 | @@ -820,7 +820,6 @@ static int optoe_remove(struct i2c_client *client) 24 | 25 | kfree(optoe->writebuf); 26 | kfree(optoe); 27 | - return 0; 28 | } 29 | 30 | static ssize_t show_dev_write_max_size(struct device *dev, 31 | -------------------------------------------------------------------------------- /patches-sonic/driver-support-optoe-update-to-linux-6.10.patch: -------------------------------------------------------------------------------- 1 | Index: source_sonic/drivers/misc/eeprom/optoe.c 2 | =================================================================== 3 | --- source_sonic.orig/drivers/misc/eeprom/optoe.c 4 | +++ source_sonic/drivers/misc/eeprom/optoe.c 5 | @@ -1016,13 +1016,13 @@ static struct attribute_group optoe_attr 6 | .attrs = optoe_attrs, 7 | }; 8 | 9 | -static int optoe_probe(struct i2c_client *client, 10 | - const struct i2c_device_id *id) 11 | +static int optoe_probe(struct i2c_client *client) 12 | { 13 | int err; 14 | int use_smbus = 0; 15 | struct optoe_platform_data chip; 16 | struct optoe_data *optoe; 17 | + const struct i2c_device_id *id; 18 | int num_addresses = 0; 19 | char port_name[MAX_PORT_NAME_LEN]; 20 | 21 | @@ -1045,6 +1045,7 @@ static int optoe_probe(struct i2c_client 22 | "probe, chip provided, flags:0x%x; name: %s\n", 23 | chip.flags, client->name); 24 | } else { 25 | + id = i2c_match_id(optoe_ids, client); 26 | if (!id->driver_data) { 27 | err = -ENODEV; 28 | goto exit; 29 | -------------------------------------------------------------------------------- /patches-sonic/0005-dt-bindings-hwmon-Add-tmp75b-to-lm75.txt.patch: -------------------------------------------------------------------------------- 1 | From de27b34d7fc91ed109c78ed89442f42427ac0c5c Mon Sep 17 00:00:00 2001 2 | 3 | From: Iker Perez del Palomar Sustatxa 4 | 5 | Subject: [PATCH 5/6] dt-bindings: hwmon: Add tmp75b to lm75.txt 6 | 7 | Update the LM75's devicetree definition to allow Texas Instruments 8 | TMP75B be probed. 9 | 10 | Signed-off-by: Iker Perez del Palomar Sustatxa 11 | Signed-off-by: Guenter Roeck 12 | --- 13 | Documentation/devicetree/bindings/hwmon/lm75.txt | 1 + 14 | 1 file changed, 1 insertion(+) 15 | 16 | diff --git a/Documentation/devicetree/bindings/hwmon/lm75.txt b/Documentation/devicetree/bindings/hwmon/lm75.txt 17 | index 12d8cf7cf..586b5ed70 100644 18 | --- a/Documentation/devicetree/bindings/hwmon/lm75.txt 19 | +++ b/Documentation/devicetree/bindings/hwmon/lm75.txt 20 | @@ -25,6 +25,7 @@ Required properties: 21 | "ti,tmp175", 22 | "ti,tmp275", 23 | "ti,tmp75", 24 | + "ti,tmp75b", 25 | "ti,tmp75c", 26 | 27 | - reg: I2C bus address of the device 28 | -------------------------------------------------------------------------------- /patches-sonic/0028-Added-current-sensors-in-dtsi.patch: -------------------------------------------------------------------------------- 1 | From 6953e74c7cf345116ddd148c279ce5e562b78db9 Mon Sep 17 00:00:00 2001 2 | From: Shantanu Shrivastava 3 | Date: Mon, 11 Mar 2024 08:13:31 +0000 4 | Subject: [PATCH] Added current sensors in dtsi 5 | 6 | --- 7 | .../boot/dts/pensando/elba-asic-psci-mtfuji.dts | 15 +++++++++++++++ 8 | 1 file changed, 15 insertions(+) 9 | 10 | diff --git a/arch/arm64/boot/dts/pensando/elba-asic-psci-mtfuji.dts b/arch/arm64/boot/dts/pensando/elba-asic-psci-mtfuji.dts 11 | index 1d2e99d8c..10917168c 100644 12 | --- a/arch/arm64/boot/dts/pensando/elba-asic-psci-mtfuji.dts 13 | +++ b/arch/arm64/boot/dts/pensando/elba-asic-psci-mtfuji.dts 14 | @@ -27,6 +27,21 @@ chosen { 15 | 16 | &i2c0 { 17 | /delete-node/ rtc@51; 18 | + 19 | + ltc3882@44 { 20 | + compatible = "lltc,ltc3882"; 21 | + reg = <0x44>; 22 | + }; 23 | + 24 | + ltc3882@55 { 25 | + compatible = "lltc,ltc3882"; 26 | + reg = <0x55>; 27 | + }; 28 | + 29 | + ltc3882@66 { 30 | + compatible = "lltc,ltc3882"; 31 | + reg = <0x66>; 32 | + }; 33 | }; 34 | 35 | &spi0_cs0 { 36 | -- 37 | 2.25.1 38 | 39 | -------------------------------------------------------------------------------- /patches-sonic/0009-dt-bindings-marvell-Add-ARMADA-7K-properties.patch: -------------------------------------------------------------------------------- 1 | From: Pavan Naregundi 2 | Date: Tue, 14 Mar 2023 05:57:34 +0000 3 | dt-bindings: marvell: Add ARMADA-7K properties 4 | 5 | This patch adds compatible properties for the Marvell Armada7020 6 | Comexpress in documentation. 7 | 8 | Signed-off-by: Eyal Oron 9 | --- 10 | Documentation/devicetree/bindings/arm/marvell/armada-7k-8k.yaml | 1 + 11 | 1 file changed, 1 insertion(+) 12 | 13 | diff --git a/Documentation/devicetree/bindings/arm/marvell/armada-7k-8k.yaml b/Documentation/devicetree/bindings/arm/marvell/armada-7k-8k.yaml 14 | index e9bf30545..26092dc11 100644 15 | --- a/Documentation/devicetree/bindings/arm/marvell/armada-7k-8k.yaml 16 | +++ b/Documentation/devicetree/bindings/arm/marvell/armada-7k-8k.yaml 17 | @@ -20,6 +20,7 @@ properties: 18 | - const: marvell,armada7020 19 | - const: marvell,armada-ap806-dual 20 | - const: marvell,armada-ap806 21 | + - const: marvell,armada7020-comexpress 22 | 23 | - description: Armada 7040 SoC 24 | items: 25 | -- 26 | 2.25.1 27 | 28 | -------------------------------------------------------------------------------- /patches-sonic/0006-device-tree-bindinds-add-NXP-PCT2075-as-compatible-d.patch: -------------------------------------------------------------------------------- 1 | From 248bae1d862533e1e1b6a1a0ba32f8b73bbfe57e Mon Sep 17 00:00:00 2001 2 | 3 | From: Daniel Mack 4 | 5 | Subject: [PATCH 6/6] device-tree: bindinds: add NXP PCT2075 as compatible 6 | device to LM75 7 | 8 | The PCT2075 is compatible to other chips that are already handled by 9 | the LM75 driver. 10 | 11 | Signed-off-by: Daniel Mack 12 | Link: https://lore.kernel.org/r/20190711124504.7580-1-daniel@zonque.org 13 | Signed-off-by: Guenter Roeck 14 | --- 15 | Documentation/devicetree/bindings/hwmon/lm75.txt | 1 + 16 | 1 file changed, 1 insertion(+) 17 | 18 | diff --git a/Documentation/devicetree/bindings/hwmon/lm75.txt b/Documentation/devicetree/bindings/hwmon/lm75.txt 19 | index 586b5ed70..273616702 100644 20 | --- a/Documentation/devicetree/bindings/hwmon/lm75.txt 21 | +++ b/Documentation/devicetree/bindings/hwmon/lm75.txt 22 | @@ -15,6 +15,7 @@ Required properties: 23 | "maxim,max31725", 24 | "maxim,max31726", 25 | "maxim,mcp980x", 26 | + "nxp,pct2075", 27 | "st,stds75", 28 | "st,stlm75", 29 | "microchip,tcn75", 30 | -------------------------------------------------------------------------------- /patches-sonic/0017-Extend-driver-to-support-XMC-XM25QH256C-device.patch: -------------------------------------------------------------------------------- 1 | From b7c35b19dd2e5548534b21404397d53c7d772cfa Mon Sep 17 00:00:00 2001 2 | From: Owen Wu 3 | Date: Tue, 15 Oct 2024 14:02:06 +0800 4 | Subject: [PATCH] Extend driver to support XMC XM25QH256C device. 5 | 6 | Add new component for alternative support 7 | 8 | Signed-off-by: Owen Wu 9 | Signed-off-by: Yan Markman 10 | --- 11 | drivers/mtd/spi-nor/xmc.c | 6 ++++++ 12 | 1 file changed, 6 insertions(+) 13 | 14 | diff --git a/drivers/mtd/spi-nor/xmc.c b/drivers/mtd/spi-nor/xmc.c 15 | index d5a06054b..941016cad 100644 16 | --- a/drivers/mtd/spi-nor/xmc.c 17 | +++ b/drivers/mtd/spi-nor/xmc.c 18 | @@ -19,6 +19,12 @@ static const struct flash_info xmc_nor_parts[] = { 19 | .name = "XM25QH128A", 20 | .size = SZ_16M, 21 | .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 22 | + }, { 23 | + .id = SNOR_ID(0x20, 0x40, 0x19), 24 | + .name = "XM25QH256C", 25 | + .size = SZ_32M, 26 | + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 27 | + .fixup_flags = SPI_NOR_4B_OPCODES, 28 | }, 29 | }; 30 | 31 | -- 32 | 2.34.1 33 | 34 | -------------------------------------------------------------------------------- /patches-sonic/0028-Create-miniaturised-diafgw-partition-for-128MB-flash.patch: -------------------------------------------------------------------------------- 1 | From c7e456919fb30b80d6028128d6016cf0dc7a16e3 Mon Sep 17 00:00:00 2001 2 | From: Shantanu Shrivastava 3 | Date: Mon, 11 Mar 2024 14:06:05 +0000 4 | Subject: [PATCH] Create miniaturised diafgw partition for 128MB flash 5 | 6 | Changes for creating a miniaturised diagfw for installing 7 | minigold 8 | 9 | Signed-off-by: Shantanu Shrivastava 10 | --- 11 | arch/arm64/boot/dts/pensando/elba-flash128-parts.dtsi | 5 +++++ 12 | 1 file changed, 5 insertions(+) 13 | 14 | diff --git a/arch/arm64/boot/dts/pensando/elba-flash128-parts.dtsi b/arch/arm64/boot/dts/pensando/elba-flash128-parts.dtsi 15 | index ddb961b79..7a86eb759 100644 16 | --- a/arch/arm64/boot/dts/pensando/elba-flash128-parts.dtsi 17 | +++ b/arch/arm64/boot/dts/pensando/elba-flash128-parts.dtsi 18 | @@ -85,6 +85,11 @@ partition@5a00000 { 19 | reg = <0x5a00000 0x1000000>; 20 | }; 21 | 22 | + partition@6a00000 { 23 | + label = "diagfw"; 24 | + reg = <0x6a00000 0x15e0000>; 25 | + }; 26 | + 27 | partition@7fe0000 { 28 | label = "ubootenv"; 29 | reg = <0x7fe0000 0x10000>; 30 | -- 31 | 2.25.1 32 | 33 | -------------------------------------------------------------------------------- /patches-sonic/cisco-mtd-part.patch: -------------------------------------------------------------------------------- 1 | From 157c059a2c639ecc69080ecb004a94e652467a4a Mon Sep 17 00:00:00 2001 2 | From: Madhava Reddy Siddareddygari 3 | Date: Tue, 8 Jun 2021 10:19:36 -0700 4 | Subject: [PATCH] mtd: Add support for reading partition data from ACPI 5 | 6 | Current mtd driver supports reading mtd partition information from 7 | command line and dts file, but cannot read partition information 8 | from ACPI files. 9 | 10 | Added code to support new partition type "acpipart" to 11 | default_mtd_part_types structure. This partition type can be used 12 | to configure mtd partition data in ACPI tables. 13 | 14 | Signed-off-by: Madhava Reddy Siddareddygari 15 | --- 16 | drivers/mtd/mtdpart.c | 1 + 17 | 1 file changed, 1 insertion(+) 18 | 19 | diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c 20 | index 10c53364a..1ff24e5d9 100644 21 | --- a/drivers/mtd/mtdpart.c 22 | +++ b/drivers/mtd/mtdpart.c 23 | @@ -822,6 +822,7 @@ EXPORT_SYMBOL_GPL(deregister_mtd_parser); 24 | static const char * const default_mtd_part_types[] = { 25 | "cmdlinepart", 26 | "ofpart", 27 | + "acpipart", 28 | NULL 29 | }; 30 | 31 | -- 32 | 2.26.2 33 | 34 | -------------------------------------------------------------------------------- /config.local/arm64/config.sonic: -------------------------------------------------------------------------------- 1 | # For enabling SDEI 2 | CONFIG_ARM_SDE_INTERFACE=y 3 | # For Marvell 4 | CONFIG_EEPROM_SFF_8436=m 5 | CONFIG_EEPROM_OPTOE=m 6 | CONFIG_I2C_MUX_GPIO=m 7 | CONFIG_MTD_RAW_NAND=m 8 | CONFIG_MTD_NAND_ECC_SW_BCH=y 9 | CONFIG_MTD_NAND_MARVELL=m 10 | CONFIG_SENSORS_EMC2305=m 11 | CONFIG_PHY_MVEBU_CP110_COMPHY=y 12 | CONFIG_SPI_ORION=m 13 | CONFIG_ARM_SMC_WATCHDOG=m 14 | # For pensando 15 | CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y 16 | CONFIG_DEVTMPFS_MOUNT=y 17 | CONFIG_EMBEDDED=y 18 | CONFIG_GENERIC_IRQ_DEBUGFS=y 19 | CONFIG_GPIO_DWAPB=m 20 | CONFIG_IP_PNP=y 21 | CONFIG_IP_PNP_BOOTP=y 22 | CONFIG_IP_PNP_DHCP=y 23 | CONFIG_IRQSOFF_TRACER=y 24 | CONFIG_KALLSYMS_ALL=y 25 | CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y 26 | CONFIG_SCHED_TRACER=y 27 | CONFIG_MEMTEST=y 28 | CONFIG_MMC_DEBUG=y 29 | CONFIG_MMC_SDHCI_CADENCE=m 30 | CONFIG_PMBUS=m 31 | CONFIG_SENSORS_PMBUS=m 32 | CONFIG_SENSORS_LTC2978=m 33 | CONFIG_SENSORS_TPS53679=m 34 | CONFIG_RTC_DRV_PCF85363=m 35 | CONFIG_RTC_CLASS=y 36 | CONFIG_SPI_CADENCE_QUADSPI=m 37 | CONFIG_SPI_DESIGNWARE=m 38 | CONFIG_SPI_DW_MMIO=m 39 | CONFIG_SQUASHFS_DECOMP_MULTI=y 40 | CONFIG_PREEMPTIRQ_TRACEPOINTS=y 41 | CONFIG_RING_BUFFER_ALLOW_SWAP=y 42 | CONFIG_KEXEC_FILE=y 43 | -------------------------------------------------------------------------------- /patches-sonic/0037-platform-mellanox-mlxreg-io-Extend-number-of-hwmon-a.patch: -------------------------------------------------------------------------------- 1 | From bcca6b75be5436c0f99dee143b72ec799a7e7ea0 Mon Sep 17 00:00:00 2001 2 | From: Oleksandr Shamray 3 | Date: Wed, 5 Feb 2025 14:45:21 +0200 4 | Subject: [PATCH 37/78] platform/mellanox: mlxreg-io: Extend number of hwmon 5 | attributes 6 | 7 | Extend maximum number of the attributes, exposed to 'sysfs' to support 8 | new systems having more attributes. 9 | 10 | Signed-off-by: Oleksandr Shamray 11 | Reviewed-by: Vadim Pasternak 12 | 13 | Signed-off-by: Oleksandr Shamray 14 | --- 15 | drivers/platform/mellanox/mlxreg-io.c | 2 +- 16 | 1 file changed, 1 insertion(+), 1 deletion(-) 17 | 18 | diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c 19 | index c502f2b..2f28fa7 100644 20 | --- a/drivers/platform/mellanox/mlxreg-io.c 21 | +++ b/drivers/platform/mellanox/mlxreg-io.c 22 | @@ -17,7 +17,7 @@ 23 | 24 | /* Attribute parameters. */ 25 | #define MLXREG_IO_ATT_SIZE 10 26 | -#define MLXREG_IO_ATT_NUM 96 27 | +#define MLXREG_IO_ATT_NUM 128 28 | 29 | /** 30 | * struct mlxreg_io_priv_data - driver's private data: 31 | -- 32 | 2.8.4 33 | 34 | -------------------------------------------------------------------------------- /patches-sonic/0026-Add-support-for-new-qspi-macronix-flash-mx66u1g45g.patch: -------------------------------------------------------------------------------- 1 | From b0a9046ed50928c3dd41a8b9b6f998d5e74c32ac Mon Sep 17 00:00:00 2001 2 | From: Shantanu Shrivastava 3 | Date: Mon, 5 Feb 2024 15:25:58 +0000 4 | Subject: [PATCH] Add support for new qspi macronix flash - mx66u1g45g 5 | 6 | Changes for supporting new qspi macronix flash mx66u1g45g 7 | 8 | Signed-off-by: Shantanu Shrivastava 9 | --- 10 | drivers/mtd/spi-nor/macronix.c | 3 +++ 11 | 1 file changed, 3 insertions(+) 12 | 13 | diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c 14 | index d81a4cb28..9b7f0d86c 100644 15 | --- a/drivers/mtd/spi-nor/macronix.c 16 | +++ b/drivers/mtd/spi-nor/macronix.c 17 | @@ -100,6 +100,9 @@ static const struct flash_info macronix_nor_parts[] = { 18 | { "mx66u2g45g", INFO(0xc2253c, 0, 64 * 1024, 4096) 19 | NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 20 | FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 21 | + { "mx66u1g45g", INFO(0xc2253b, 0, 64 * 1024, 2048) 22 | + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 23 | + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 24 | }; 25 | 26 | static void macronix_nor_default_init(struct spi_nor *nor) 27 | -- 28 | 2.25.1 29 | 30 | -------------------------------------------------------------------------------- /patches-sonic/8003-mlxsw-minimal-Downstream-Ignore-error-reading-SPAD-r.patch: -------------------------------------------------------------------------------- 1 | From c52801a7e7ac91a3587199a69459d7c6308725a7 Mon Sep 17 00:00:00 2001 2 | From: root 3 | Date: Tue, 5 Apr 2022 21:35:55 +0300 4 | Subject: [PATCH 59/78] mlxsw: minimal: Downstream: Ignore error reading SPAD 5 | register 6 | 7 | SPAD register is not supported for IB systems. 8 | 9 | Signed-off-by: Vadim Pasternak 10 | --- 11 | drivers/net/ethernet/mellanox/mlxsw/minimal.c | 2 ++ 12 | 1 file changed, 2 insertions(+) 13 | 14 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c 15 | index 828c650..6faebeb 100644 16 | --- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c 17 | +++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c 18 | @@ -53,6 +53,7 @@ struct mlxsw_m_port { 19 | 20 | static int mlxsw_m_base_mac_get(struct mlxsw_m *mlxsw_m) 21 | { 22 | +#if 0 23 | char spad_pl[MLXSW_REG_SPAD_LEN] = {0}; 24 | int err; 25 | 26 | @@ -60,6 +61,7 @@ static int mlxsw_m_base_mac_get(struct mlxsw_m *mlxsw_m) 27 | if (err) 28 | return err; 29 | mlxsw_reg_spad_base_mac_memcpy_from(spad_pl, mlxsw_m->base_mac); 30 | +#endif 31 | return 0; 32 | } 33 | 34 | -- 35 | 2.8.4 36 | 37 | -------------------------------------------------------------------------------- /patches-sonic/8005-i2c-mlxcpld-Downstream-WA-to-avoid-error-for-SMBUS-r.patch: -------------------------------------------------------------------------------- 1 | From 9ade5581712d6bcaf7413152829f2dfc3a47ca5f Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Thu, 10 Aug 2023 12:03:31 +0000 4 | Subject: [PATCH 61/78] i2c: mlxcpld: Downstream WA to avoid error for SMBUS 5 | read block command 6 | 7 | Due to hardware bug in I2C controller skip handling SMBUS_READ_BLOCK 8 | command. 9 | Remove this patch after bug in I2C controller is fixed. 10 | 11 | Signed-off-by: Vadim Pasternak 12 | --- 13 | drivers/i2c/busses/i2c-mlxcpld.c | 1 + 14 | 1 file changed, 1 insertion(+) 15 | 16 | diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c 17 | index ecae755..c3b22aa 100644 18 | --- a/drivers/i2c/busses/i2c-mlxcpld.c 19 | +++ b/drivers/i2c/busses/i2c-mlxcpld.c 20 | @@ -398,6 +398,7 @@ static int mlxcpld_i2c_wait_for_tc(struct mlxcpld_i2c_priv *priv) 21 | mlxcpld_i2c_read_comm(priv, MLXCPLD_LPCI2C_NUM_ADDR_REG, &val, 22 | 1); 23 | if (priv->smbus_block && (val & MLXCPLD_I2C_SMBUS_BLK_BIT)) { 24 | + return 0; 25 | mlxcpld_i2c_read_comm(priv, MLXCPLD_LPCI2C_NUM_DAT_REG, 26 | &datalen, 1); 27 | if (unlikely(datalen > I2C_SMBUS_BLOCK_MAX)) { 28 | -- 29 | 2.8.4 30 | 31 | -------------------------------------------------------------------------------- /patches-sonic/8011-hwmon-pmbus-Downstream-Workaround-for-psu-attributes.patch: -------------------------------------------------------------------------------- 1 | From 6108367b56ae9df24d5d5869860943a3156ae2db Mon Sep 17 00:00:00 2001 2 | From: Ciju Rajan K 3 | Date: Thu, 10 Oct 2024 14:13:28 +0300 4 | Subject: [PATCH 67/78] hwmon: pmbus: Downstream: Workaround for psu attributes 5 | 6 | Starting from kernel 5.12.rc-1, pmbus reads are always 7 | forced down to chip and get the values directly. Driver 8 | doesn't cache the values anymore. 9 | 10 | This behviour change has caused problems in Delta-1.1K 11 | PSUs, on which pmbus registers were not written. 12 | 13 | This patch introduces the driver caching. 14 | 15 | Bugs# 3874682 16 | 17 | Signed-off-by: Ciju Rajan K 18 | --- 19 | drivers/hwmon/pmbus/pmbus_core.c | 2 +- 20 | 1 file changed, 1 insertion(+), 1 deletion(-) 21 | 22 | diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c 23 | index a68b0a9..943118e 100644 24 | --- a/drivers/hwmon/pmbus/pmbus_core.c 25 | +++ b/drivers/hwmon/pmbus/pmbus_core.c 26 | @@ -1248,7 +1248,7 @@ static ssize_t pmbus_set_sensor(struct device *dev, 27 | if (ret < 0) 28 | rv = ret; 29 | else 30 | - sensor->data = -ENODATA; 31 | + sensor->data = regval; 32 | mutex_unlock(&data->update_lock); 33 | return rv; 34 | } 35 | -- 36 | 2.8.4 37 | 38 | -------------------------------------------------------------------------------- /patches-sonic/0020-dt-bindings-trivial-devices-Add-infineon-xdpe1a2g7.patch: -------------------------------------------------------------------------------- 1 | From a2f7a59cc93759e1e7cde05831afa049e7413c43 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Mon, 17 Jul 2023 16:24:58 +0000 4 | Subject: [PATCH 20/78] dt-bindings: trivial-devices: Add infineon,xdpe1a2g7 5 | 6 | Add new Infineon Multi-phase Digital VR Controller xdpe1a2g7 7 | 8 | Signed-off-by: Vadim Pasternak 9 | --- 10 | Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 11 | 1 file changed, 2 insertions(+) 12 | 13 | diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml 14 | index 9bf0fb1..a190c56 100644 15 | --- a/Documentation/devicetree/bindings/trivial-devices.yaml 16 | +++ b/Documentation/devicetree/bindings/trivial-devices.yaml 17 | @@ -131,6 +131,8 @@ properties: 18 | - infineon,xdp710 19 | # Infineon Multi-phase Digital VR Controller xdpe11280 20 | - infineon,xdpe11280 21 | + # Infineon Multi-phase Digital VR Controller xdpe1a2g7 22 | + - infineon,xdpe1a2g7 23 | # Infineon Multi-phase Digital VR Controller xdpe12254 24 | - infineon,xdpe12254 25 | # Infineon Multi-phase Digital VR Controller xdpe12284 26 | -- 27 | 2.8.4 28 | 29 | -------------------------------------------------------------------------------- /patches-sonic/8014-platform-mellanox-mlxreg-dpu-Debug-trace-for-dpu-pro.patch: -------------------------------------------------------------------------------- 1 | From e7838edd2acc793f3b43ab04b3693a340273c330 Mon Sep 17 00:00:00 2001 2 | From: Ciju Rajan K 3 | Date: Fri, 19 Sep 2025 09:51:17 +0300 4 | Subject: platform: mellanox: mlxreg-dpu: Debug trace for dpu probing 5 | 6 | Signed-off-by: Ciju Rajan K 7 | --- 8 | drivers/platform/mellanox/mlxreg-dpu.c | 6 +++++- 9 | 1 file changed, 5 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/drivers/platform/mellanox/mlxreg-dpu.c b/drivers/platform/mellanox/mlxreg-dpu.c 12 | index 314385cc1495..3b07c66c87dc 100644 13 | --- a/drivers/platform/mellanox/mlxreg-dpu.c 14 | +++ b/drivers/platform/mellanox/mlxreg-dpu.c 15 | @@ -530,9 +530,13 @@ static int mlxreg_dpu_probe(struct platform_device *pdev) 16 | if (!data || !data->hpdev.brdinfo) 17 | return -EINVAL; 18 | 19 | + dev_info(&pdev->dev, "Probing for adapter %d\n", data->hpdev.nr); 20 | data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr); 21 | - if (!data->hpdev.adapter) 22 | + if (!data->hpdev.adapter) { 23 | + dev_info(&pdev->dev, "Will try a deferred probing for %d\n", 24 | + data->hpdev.nr); 25 | return -EPROBE_DEFER; 26 | + } 27 | 28 | mlxreg_dpu = devm_kzalloc(&pdev->dev, sizeof(*mlxreg_dpu), GFP_KERNEL); 29 | if (!mlxreg_dpu) { 30 | -- 31 | 2.47.2 32 | 33 | -------------------------------------------------------------------------------- /patches-sonic/driver-hwmon-lm75b-update.patch: -------------------------------------------------------------------------------- 1 | From 7e24a7bf79b4ae6c12cd3306f0340883b6b0fd73 Mon Sep 17 00:00:00 2001 2 | From: Abhisit Sangjan 3 | Date: Fri, 30 Jun 2017 10:13:12 +0700 4 | Subject: [PATCH] hwmon: Update to support lm75b 5 | 6 | * Add lm75b 7 | --- 8 | drivers/hwmon/lm75.c | 6 ++++++ 9 | 1 file changed, 6 insertions(+) 10 | 11 | diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c 12 | index 479ffbe..38b6f8f 100644 13 | --- a/drivers/hwmon/lm75.c 14 | +++ b/drivers/hwmon/lm75.c 15 | @@ -44,6 +44,7 @@ enum lm75_type { /* keep sorted in alphabetical order */ 16 | g751, 17 | lm75, 18 | lm75a, 19 | + lm75b, 20 | max6625, 21 | max6626, 22 | mcp980x, 23 | @@ -232,6 +233,10 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) 24 | data->resolution = 9; 25 | data->sample_time = HZ / 2; 26 | break; 27 | + case lm75b: 28 | + data->resolution = 11; 29 | + data->sample_time = HZ / 4; 30 | + break; 31 | case max6625: 32 | data->resolution = 9; 33 | data->sample_time = HZ / 4; 34 | @@ -315,6 +320,7 @@ static const struct i2c_device_id lm75_ids[] = { 35 | { "g751", g751, }, 36 | { "lm75", lm75, }, 37 | { "lm75a", lm75a, }, 38 | + { "lm75b", lm75b, }, 39 | { "max6625", max6625, }, 40 | { "max6626", max6626, }, 41 | { "mcp980x", mcp980x, }, 42 | -- 43 | 1.9.1 44 | 45 | -------------------------------------------------------------------------------- /patches-sonic/8000-mlxsw-Use-weak-reverse-dependencies-for-firmware-fla.patch: -------------------------------------------------------------------------------- 1 | From 807fd2d518ea43c623268edecdc0b58361188af8 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Wed, 20 Oct 2021 09:49:28 +0000 4 | Subject: [PATCH 56/78] mlxsw: Use weak reverse dependencies for firmware 5 | flashing selection 6 | 7 | Replace configuration options "select" by "imply". It allows to set 8 | 'MLXFW' symbol to 'n' from a direct dependency or with a visible 9 | prompt. 10 | 11 | User might wish to disable this option in case only 'mlxsw_minimal' is 12 | configured, since it does not support firmware flashing. 13 | 14 | Signed-off-by: Vadim Pasternak 15 | --- 16 | drivers/net/ethernet/mellanox/mlxsw/Kconfig | 2 +- 17 | 1 file changed, 1 insertion(+), 1 deletion(-) 18 | 19 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/Kconfig b/drivers/net/ethernet/mellanox/mlxsw/Kconfig 20 | index 74f7e27..ae11732 100644 21 | --- a/drivers/net/ethernet/mellanox/mlxsw/Kconfig 22 | +++ b/drivers/net/ethernet/mellanox/mlxsw/Kconfig 23 | @@ -6,7 +6,7 @@ 24 | config MLXSW_CORE 25 | tristate "Mellanox Technologies Switch ASICs support" 26 | select NET_DEVLINK 27 | - select MLXFW 28 | + imply MLXFW 29 | select AUXILIARY_BUS 30 | help 31 | This driver supports Mellanox Technologies Switch ASICs family. 32 | -- 33 | 2.8.4 34 | 35 | -------------------------------------------------------------------------------- /patches-sonic/0031-platform-mellanox-indicate-deferred-I2C-bus-creation.patch: -------------------------------------------------------------------------------- 1 | From 86f67641e8d4052f801b54362abb88c2b9eda242 Mon Sep 17 00:00:00 2001 2 | From: Michael Shych 3 | Date: Wed, 29 Nov 2023 13:12:38 +0000 4 | Subject: [PATCH 31/78] platform: mellanox: indicate deferred I2C bus creation 5 | for a hot-plug driver 6 | 7 | It fixes timing issue when during initialization hot-plug driver 8 | attempts to attach a component to I2C bus, which is still not created. 9 | Setting deferred bus parameter will force hot-plug driver to wait 10 | until the bus is available. 11 | 12 | Signed-off-by: Michael Shych 13 | --- 14 | drivers/platform/mellanox/nvsw-sn2201.c | 1 + 15 | 1 file changed, 1 insertion(+) 16 | 17 | diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c 18 | index db31c8b..924ad48 100644 19 | --- a/drivers/platform/mellanox/nvsw-sn2201.c 20 | +++ b/drivers/platform/mellanox/nvsw-sn2201.c 21 | @@ -526,6 +526,7 @@ struct mlxreg_core_hotplug_platform_data nvsw_sn2201_hotplug = { 22 | .count = ARRAY_SIZE(nvsw_sn2201_items), 23 | .cell = NVSW_SN2201_SYS_INT_STATUS_OFFSET, 24 | .mask = NVSW_SN2201_CPLD_AGGR_MASK_DEF, 25 | + .deferred_nr = NVSW_SN2201_2ND_MUX_CH3_NR, 26 | }; 27 | 28 | static struct mlxreg_core_item nvsw_sn2201_busbar_items[] = { 29 | -- 30 | 2.8.4 31 | 32 | -------------------------------------------------------------------------------- /patches-sonic/0001-fix-os-crash-caused-by-optoe-when-class-switch.patch: -------------------------------------------------------------------------------- 1 | From 846abadb7505c10e85a3450a7343d6a89b5ecd96 Mon Sep 17 00:00:00 2001 2 | From: philo 3 | Date: Fri, 12 Jul 2024 11:12:58 +0800 4 | Subject: [PATCH] fix os crash caused by optoe when class switch 5 | 6 | --- 7 | drivers/misc/eeprom/optoe.c | 8 ++++++-- 8 | 1 file changed, 6 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c 11 | index 9129312a1..63bb8c46a 100644 12 | --- a/drivers/misc/eeprom/optoe.c 13 | +++ b/drivers/misc/eeprom/optoe.c 14 | @@ -941,8 +941,10 @@ static ssize_t set_dev_class(struct device *dev, 15 | } else { 16 | /* one-address (eg QSFP) and CMIS family */ 17 | /* if it exists, remove 0x51 i2c address */ 18 | - if (optoe->client[1]) 19 | + if (optoe->client[1]) { 20 | i2c_unregister_device(optoe->client[1]); 21 | + optoe->client[1] = NULL; 22 | + } 23 | optoe->bin.size = ONE_ADDR_EEPROM_SIZE; 24 | optoe->num_addresses = 1; 25 | } 26 | @@ -1224,8 +1226,10 @@ static int optoe_probe(struct i2c_client *client, 27 | 28 | err_struct: 29 | if (num_addresses == 2) { 30 | - if (optoe->client[1]) 31 | + if (optoe->client[1]) { 32 | i2c_unregister_device(optoe->client[1]); 33 | + optoe->client[1] = NULL; 34 | + } 35 | } 36 | 37 | kfree(optoe->writebuf); 38 | -- 39 | 2.25.1 40 | 41 | -------------------------------------------------------------------------------- /patches-sonic/cisco-x86-gpio-config.patch: -------------------------------------------------------------------------------- 1 | From 7106f3961be1dc0d921efe5c719ada6096307227 Mon Sep 17 00:00:00 2001 2 | From: Madhava Reddy Siddareddygari 3 | Date: Tue, 10 Aug 2021 12:51:47 -0700 4 | Subject: [PATCH] x86/Kconfig: Introduce ARCH_NR_GPIO 5 | 6 | The x86 platform did not allow configuring the maximum number of GPIOs 7 | supported, although the ARM platform did. For cisco-8000 platform, 8 | each FPGA gpio IP block can support 1K pins. Distributed chassis with 9 | Route Processor and Fabric cards can have 10 such IP blocks, along with 10 | additional pins through i2c gpio extenders. 11 | 12 | This patch supports configurable number of GPIO's at kernel config time 13 | similar to ARM platform. 14 | 15 | Signed-off-by: Madhava Reddy Siddareddygari 16 | --- 17 | arch/x86/Kconfig | 9 +++++++++ 18 | 1 file changed, 9 insertions(+) 19 | 20 | diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig 21 | index d2453b251..e894cd71d 100644 22 | --- a/arch/x86/Kconfig 23 | +++ b/arch/x86/Kconfig 24 | @@ -342,6 +342,11 @@ config SCHED_MC_PRIO 25 | 26 | config ARCH_NR_GPIO 27 | int 28 | + prompt "Maximum number of GPIO's" 29 | default 1024 if X86_64 30 | default 512 31 | + help 32 | + Maximum number of GPIOs in the system. 33 | + 34 | + If unsure, leave the default value. 35 | 36 | config ARCH_SUSPEND_POSSIBLE 37 | def_bool y 38 | -- 39 | 2.26.2 40 | 41 | -------------------------------------------------------------------------------- /patches-sonic/driver-support-optoe-write-max_fix.patch: -------------------------------------------------------------------------------- 1 | From f1250392a9dff619b147d8aee0c73c0f6d550713 Mon Sep 17 00:00:00 2001 2 | From: Prince George 3 | Date: Thu, 13 Jun 2024 14:18:22 +0000 4 | Subject: [PATCH] Fix optoe's write_max when using native i2c driver 5 | 6 | Signed-off-by: Prince George 7 | --- 8 | drivers/misc/eeprom/optoe.c | 4 ++-- 9 | 1 file changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c 12 | index 5a2e71be5..1efd18040 100644 13 | --- a/drivers/misc/eeprom/optoe.c 14 | +++ b/drivers/misc/eeprom/optoe.c 15 | @@ -1114,7 +1114,7 @@ static int optoe_probe(struct i2c_client *client, 16 | goto exit; 17 | } 18 | 19 | - dev_dbg(&client->dev, "dev_class: %d\n", optoe->dev_class); 20 | + dev_dbg(&client->dev, "dev_class: %d use_smbus=%d\n", optoe->dev_class, use_smbus); 21 | optoe->use_smbus = use_smbus; 22 | optoe->chip = chip; 23 | optoe->num_addresses = num_addresses; 24 | @@ -1157,7 +1157,7 @@ static int optoe_probe(struct i2c_client *client, 25 | optoe->write_max = write_max; 26 | 27 | /* buffer (data + address at the beginning) */ 28 | - optoe->writebuf = kmalloc(write_max + 2, GFP_KERNEL); 29 | + optoe->writebuf = kmalloc(OPTOE_PAGE_SIZE + 2, GFP_KERNEL); 30 | if (!optoe->writebuf) { 31 | err = -ENOMEM; 32 | goto exit_kfree; 33 | -- 34 | 2.25.1 35 | -------------------------------------------------------------------------------- /patches-sonic/0019-Extend-driver-to-support-Infineon-Digital-Multi-phas.patch: -------------------------------------------------------------------------------- 1 | From 92de6069e75d9981c2f9ab0f7cbd2970236d51e3 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Mon, 17 Jul 2023 15:40:08 +0000 4 | Subject: [PATCH 19/78] Extend driver to support Infineon Digital Multi-phase 5 | XDPE1A2G7 device. 6 | 7 | From telemetry perspective device is almost the same as XDPE15284, but 8 | does not support READ_EIN (86h) and READ_EOUT (87h) commands. 9 | 10 | Signed-off-by: Vadim Pasternak 11 | --- 12 | drivers/hwmon/pmbus/xdpe152c4.c | 2 ++ 13 | 1 file changed, 2 insertions(+) 14 | 15 | diff --git a/drivers/hwmon/pmbus/xdpe152c4.c b/drivers/hwmon/pmbus/xdpe152c4.c 16 | index 7f3b31d..089f268 100644 17 | --- a/drivers/hwmon/pmbus/xdpe152c4.c 18 | +++ b/drivers/hwmon/pmbus/xdpe152c4.c 19 | @@ -44,6 +44,7 @@ static int xdpe152_probe(struct i2c_client *client) 20 | } 21 | 22 | static const struct i2c_device_id xdpe152_id[] = { 23 | + {"xdpe1a2g7"}, 24 | {"xdpe152c4"}, 25 | {"xdpe15284"}, 26 | {} 27 | @@ -52,6 +53,7 @@ static const struct i2c_device_id xdpe152_id[] = { 28 | MODULE_DEVICE_TABLE(i2c, xdpe152_id); 29 | 30 | static const struct of_device_id __maybe_unused xdpe152_of_match[] = { 31 | + {.compatible = "infineon,xdpe1a2g7"}, 32 | {.compatible = "infineon,xdpe152c4"}, 33 | {.compatible = "infineon,xdpe15284"}, 34 | {} 35 | -- 36 | 2.8.4 37 | 38 | -------------------------------------------------------------------------------- /patches-sonic/0011-PCI-AER-Fix-NULL-pointer-access-by-aer_info.patch: -------------------------------------------------------------------------------- 1 | From 3b9b13868b3051851850d17adf1c22ac87ece220 Mon Sep 17 00:00:00 2001 2 | From: Vernon Yang 3 | Date: Fri, 5 Sep 2025 02:25:27 +0800 4 | Subject: [PATCH 11/12] PCI/AER: Fix NULL pointer access by aer_info 5 | 6 | The kzalloc(GFP_KERNEL) may return NULL, so all accesses to aer_info->xxx 7 | will result in kernel panic. Fix it. 8 | 9 | Signed-off-by: Vernon Yang 10 | Signed-off-by: Bjorn Helgaas 11 | Link: https://patch.msgid.link/20250904182527.67371-1-vernon2gm@gmail.com 12 | (cherry picked from commit 0a27bdb14b028fed30a10cec2f945c38cb5ca4fa) 13 | --- 14 | drivers/pci/pcie/aer.c | 6 +++++- 15 | 1 file changed, 5 insertions(+), 1 deletion(-) 16 | 17 | diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c 18 | index 067e305212eb..f1886e60f5a2 100644 19 | --- a/drivers/pci/pcie/aer.c 20 | +++ b/drivers/pci/pcie/aer.c 21 | @@ -377,7 +377,11 @@ void pci_aer_init(struct pci_dev *dev) 22 | if (!dev->aer_cap) 23 | return; 24 | 25 | - dev->aer_stats = kzalloc(sizeof(struct aer_stats), GFP_KERNEL); 26 | + dev->aer_stats = kzalloc(sizeof(*dev->aer_stats), GFP_KERNEL); 27 | + if (!dev->aer_stats) { 28 | + dev->aer_cap = 0; 29 | + return; 30 | + } 31 | 32 | ratelimit_state_init(&dev->aer_stats->correctable_ratelimit, 33 | DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); 34 | -- 35 | 2.47.0 36 | 37 | -------------------------------------------------------------------------------- /manage-config: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # SPDX-License-Identifier: GPL-2.0 5 | # 6 | # Add / Remove options in kernel configuration, 7 | # and Verify the kernel configuration afterwards. 8 | 9 | ARCH=amd64 10 | SECURE_UPGRADE_MODE="no_sign" 11 | SECURE_UPGRADE_KERNEL_CAFILE= 12 | if [ $# -ge 1 ]; then 13 | ARCH=$1 14 | fi 15 | if [ $# -ge 2 ]; then 16 | SECURE_UPGRADE_MODE=$2 17 | fi 18 | if [ $# -ge 3 ]; then 19 | SECURE_UPGRADE_KERNEL_CAFILE=$3 20 | fi 21 | 22 | # Secure Boot support 23 | echo "Secure Boot params: SECURE_UPGRADE_MODE=${SECURE_UPGRADE_MODE}, SECURE_UPGRADE_KERNEL_CAFILE=${SECURE_UPGRADE_KERNEL_CAFILE}" 24 | if [ ${SECURE_UPGRADE_MODE} == "dev" -o ${SECURE_UPGRADE_MODE} == "prod" ]; then 25 | echo "Enable secure boot configs" 26 | 27 | if [ ! -f "${SECURE_UPGRADE_KERNEL_CAFILE}" ]; then 28 | echo "ERROR: SECURE_UPGRADE_KERNEL_CAFILE=${SECURE_UPGRADE_KERNEL_CAFILE} file does not exist" 29 | exit 1 30 | fi 31 | 32 | if [ -f debian/config.local/${ARCH}/config.sonic-secureboot ]; then 33 | cat debian/config.local/${ARCH}/config.sonic-secureboot >> debian/config.local/${ARCH}/config.sonic 34 | fi 35 | 36 | # save the new pub key in kernel 37 | sed -i "s|^CONFIG_SYSTEM_TRUSTED_KEYS=.*|CONFIG_SYSTEM_TRUSTED_KEYS=\"$SECURE_UPGRADE_KERNEL_CAFILE\"|g" debian/config.local/${ARCH}/config.sonic 38 | 39 | echo "Secure Boot kernel configuration done." 40 | else 41 | echo "No Secure Boot Kernel configuration required." 42 | fi 43 | -------------------------------------------------------------------------------- /patches-sonic/0010-fix-aer-ratelimiting-sysfs-output-units.patch: -------------------------------------------------------------------------------- 1 | From f993b05bf9e59ab4a0c41cad1ab956080c5fb027 Mon Sep 17 00:00:00 2001 2 | From: jamessewart 3 | Date: Mon, 10 Nov 2025 13:45:50 +0000 4 | Subject: [PATCH 10/12] fix aer ratelimiting sysfs output units 5 | 6 | aer statistics include an interval value that determines the time period over which 7 | to limit error logging. This is stored in jiffies, but the sysfs file configuring it 8 | is supposed to expose milliseconds, the store function converts the input to jiffies 9 | and this change ensures the show implementation converts back to milliseconds 10 | 11 | Signed-off-by: James Sewart 12 | --- 13 | drivers/pci/pcie/aer.c | 5 +++-- 14 | 1 file changed, 3 insertions(+), 2 deletions(-) 15 | 16 | diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c 17 | index df636016168f..067e305212eb 100644 18 | --- a/drivers/pci/pcie/aer.c 19 | +++ b/drivers/pci/pcie/aer.c 20 | @@ -634,8 +634,9 @@ const struct attribute_group aer_stats_attr_group = { 21 | { \ 22 | struct pci_dev *pdev = to_pci_dev(dev); \ 23 | \ 24 | - return sysfs_emit(buf, "%d\n", \ 25 | - pdev->aer_stats->ratelimit.interval); \ 26 | + int interval = pdev->aer_stats->ratelimit.interval; \ 27 | + interval = jiffies_to_msecs(interval); \ 28 | + return sysfs_emit(buf, "%d\n", interval); \ 29 | } \ 30 | \ 31 | static ssize_t \ 32 | -- 33 | 2.47.0 34 | 35 | -------------------------------------------------------------------------------- /patches-sonic/0265-hwmon-mlxreg-fan-Return-zero-speed-for-broken-fan.patch: -------------------------------------------------------------------------------- 1 | From 0bb5bbc78316970c3bde085f091a70799b39b262 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Sun, 5 Feb 2023 09:34:20 +0200 4 | Subject: [PATCH hwmon backport 5.10 1/1] hwmon: (mlxreg-fan) Return zero speed 5 | for broken fan 6 | 7 | Currently for broken fan driver returns value calculated based on error 8 | code (0xFF) in related fan speed register. 9 | Thus, for such fan user gets fan{n}_fault to 1 and fan{n}_input with 10 | misleading value. 11 | 12 | Add check for fan fault prior return speed value and return zero if 13 | fault is detected. 14 | 15 | Fixes: 65afb4c8e7e4 ("hwmon: (mlxreg-fan) Add support for Mellanox FAN driver") 16 | Signed-off-by: Vadim Pasternak 17 | --- 18 | drivers/hwmon/mlxreg-fan.c | 6 ++++++ 19 | 1 file changed, 6 insertions(+) 20 | 21 | diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c 22 | index acba9d688..b999ca648 100644 23 | --- a/drivers/hwmon/mlxreg-fan.c 24 | +++ b/drivers/hwmon/mlxreg-fan.c 25 | @@ -158,6 +158,12 @@ mlxreg_fan_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, 26 | if (err) 27 | return err; 28 | 29 | + if (MLXREG_FAN_GET_FAULT(regval, tacho->mask)) { 30 | + /* FAN is broken - return zero for FAN speed. */ 31 | + *val = 0; 32 | + return 0; 33 | + } 34 | + 35 | *val = MLXREG_FAN_GET_RPM(regval, fan->divider, 36 | fan->samples); 37 | break; 38 | -- 39 | 2.20.1 40 | 41 | -------------------------------------------------------------------------------- /patches-sonic/0007-usb-ehci-Add-support-for-ac5.patch: -------------------------------------------------------------------------------- 1 | From: Pavan Naregundi 2 | Date: Mon, 13 Mar 2023 10:01:51 +0000 3 | usb: ehci: Add support for ac5 4 | 5 | Add a new compatible string for 98DX25xx SoCs. 6 | Change DMA bit mask to 64-bit addressing. 7 | 8 | Signed-off-by: Yuval Shaia 9 | Tested-by: Raz Adashi 10 | Reviewed-by: Raz Adashi 11 | --- 12 | drivers/usb/host/ehci-orion.c | 3 ++- 13 | 1 file changed, 2 insertions(+), 1 deletion(-) 14 | 15 | diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c 16 | index 3626758b3..488a2ba86 100644 17 | --- a/drivers/usb/host/ehci-orion.c 18 | +++ b/drivers/usb/host/ehci-orion.c 19 | @@ -232,7 +232,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) 20 | * set. Since shared usb code relies on it, set it here for 21 | * now. Once we have dma capability bindings this can go away. 22 | */ 23 | - err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 24 | + err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 25 | if (err) 26 | goto err; 27 | 28 | @@ -341,6 +341,7 @@ static int ehci_orion_drv_remove(struct platform_device *pdev) 29 | static const struct of_device_id ehci_orion_dt_ids[] = { 30 | { .compatible = "marvell,orion-ehci", }, 31 | { .compatible = "marvell,armada-3700-ehci", }, 32 | + { .compatible = "marvell,ac5-ehci", }, 33 | {}, 34 | }; 35 | MODULE_DEVICE_TABLE(of, ehci_orion_dt_ids); 36 | -- 37 | 2.25.1 38 | 39 | -------------------------------------------------------------------------------- /patches-sonic/0006-platform-mellanox-mlxreg-io-use-sysfs_emit-instead-o.patch: -------------------------------------------------------------------------------- 1 | From 2f6b30b57d84721ea1f31a22686b57106037a964 Mon Sep 17 00:00:00 2001 2 | From: Ai Chao 3 | Date: Thu, 16 Jan 2025 16:11:29 +0800 4 | Subject: [PATCH 06/78] platform/mellanox: mlxreg-io: use sysfs_emit() instead 5 | of sprintf() 6 | MIME-Version: 1.0 7 | Content-Type: text/plain; charset=UTF-8 8 | Content-Transfer-Encoding: 8bit 9 | 10 | Follow the advice in Documentation/filesystems/sysfs.rst: 11 | show() should only use sysfs_emit() or sysfs_emit_at() when formatting 12 | the value to be returned to user space. 13 | 14 | Signed-off-by: Ai Chao 15 | Acked-by: Vadim Pasternak 16 | Link: https://lore.kernel.org/r/20250116081129.2902274-1-aichao@kylinos.cn 17 | Reviewed-by: Ilpo Järvinen 18 | Signed-off-by: Ilpo Järvinen 19 | --- 20 | drivers/platform/mellanox/mlxreg-io.c | 2 +- 21 | 1 file changed, 1 insertion(+), 1 deletion(-) 22 | 23 | diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c 24 | index ee7bd62..c502f2b 100644 25 | --- a/drivers/platform/mellanox/mlxreg-io.c 26 | +++ b/drivers/platform/mellanox/mlxreg-io.c 27 | @@ -126,7 +126,7 @@ mlxreg_io_attr_show(struct device *dev, struct device_attribute *attr, 28 | 29 | mutex_unlock(&priv->io_lock); 30 | 31 | - return sprintf(buf, "%u\n", regval); 32 | + return sysfs_emit(buf, "%u\n", regval); 33 | 34 | access_error: 35 | mutex_unlock(&priv->io_lock); 36 | -- 37 | 2.8.4 38 | 39 | -------------------------------------------------------------------------------- /patches-sonic/0007-usb-ehci-Add-support-for-ac5-with-DMA-mask-64-bit.patch: -------------------------------------------------------------------------------- 1 | From ec02d4b124ea5dea90ce76fa3e1030f22c5f9e22 Mon Sep 17 00:00:00 2001 2 | From: Pavan Naregundi 3 | Date: Mon, 13 Mar 2023 10:01:51 +0000 4 | Subject: [PATCH] usb:ehci: Add support for ac5 with DMA mask 64-bit 5 | 6 | Change DMA bit mask to 64-bit addressing like it is done in K-6.1 7 | for "ac5-ehci" 98DX25xx already present and supported by Kernel-6.12 8 | 9 | Signed-off-by: Yuval Shaia 10 | Tested-by: Raz Adashi 11 | Reviewed-by: Raz Adashi 12 | Signed-off-by: Yan Markman 13 | --- 14 | drivers/usb/host/ehci-orion.c | 4 ++-- 15 | 1 file changed, 2 insertions(+), 2 deletions(-) 16 | 17 | diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c 18 | index ad145a54c..03f04a3da 100644 19 | --- a/drivers/usb/host/ehci-orion.c 20 | +++ b/drivers/usb/host/ehci-orion.c 21 | @@ -68,11 +68,11 @@ static struct hc_driver __read_mostly ehci_orion_hc_driver; 22 | /* 23 | * Legacy DMA mask is 32 bit. 24 | * AC5 has the DDR starting at 8GB, hence it requires 25 | - * a larger (34-bit) DMA mask, in order for DMA allocations 26 | + * a larger (34-bit or even 64-bit) DMA mask, in order for DMA allocations 27 | * to succeed: 28 | */ 29 | static const u64 dma_mask_orion = DMA_BIT_MASK(32); 30 | -static const u64 dma_mask_ac5 = DMA_BIT_MASK(34); 31 | +static const u64 dma_mask_ac5 = DMA_BIT_MASK(64); 32 | 33 | /* 34 | * Implement Orion USB controller specification guidelines 35 | -- 36 | 2.34.1 37 | 38 | -------------------------------------------------------------------------------- /patches-sonic/0005-platform-mellanox-mlxreg-hotplug-use-sysfs_emit-inst.patch: -------------------------------------------------------------------------------- 1 | From 9d23974f2c561e438fdf48266b327e1424884ff3 Mon Sep 17 00:00:00 2001 2 | From: Ai Chao 3 | Date: Thu, 16 Jan 2025 16:10:00 +0800 4 | Subject: [PATCH 05/78] platform/mellanox: mlxreg-hotplug: use sysfs_emit() 5 | instead of sprintf() 6 | MIME-Version: 1.0 7 | Content-Type: text/plain; charset=UTF-8 8 | Content-Transfer-Encoding: 8bit 9 | 10 | Follow the advice in Documentation/filesystems/sysfs.rst: 11 | show() should only use sysfs_emit() or sysfs_emit_at() when formatting 12 | the value to be returned to user space. 13 | 14 | Signed-off-by: Ai Chao 15 | Acked-by: Vadim Pasternak 16 | Link: https://lore.kernel.org/r/20250116081000.2900435-1-aichao@kylinos.cn 17 | Reviewed-by: Ilpo Järvinen 18 | Signed-off-by: Ilpo Järvinen 19 | --- 20 | drivers/platform/mellanox/mlxreg-hotplug.c | 2 +- 21 | 1 file changed, 1 insertion(+), 1 deletion(-) 22 | 23 | diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c 24 | index 0ce9fff..40d5b99 100644 25 | --- a/drivers/platform/mellanox/mlxreg-hotplug.c 26 | +++ b/drivers/platform/mellanox/mlxreg-hotplug.c 27 | @@ -232,7 +232,7 @@ static ssize_t mlxreg_hotplug_attr_show(struct device *dev, 28 | regval = !!(regval & data->mask); 29 | } 30 | 31 | - return sprintf(buf, "%u\n", regval); 32 | + return sysfs_emit(buf, "%u\n", regval); 33 | } 34 | 35 | #define PRIV_ATTR(i) priv->mlxreg_hotplug_attr[i] 36 | -- 37 | 2.8.4 38 | 39 | -------------------------------------------------------------------------------- /patches-sonic/0001-tty-8250-HSUART-DMA-be-deactivated-for-DNV-CPU.patch: -------------------------------------------------------------------------------- 1 | From b63977b0e1421c641495940fafab9502a2a6d659 Mon Sep 17 00:00:00 2001 2 | From: Philo Shao 3 | Date: Thu, 17 Apr 2025 02:17:18 -0500 4 | Subject: tty/8250: Deactivate the HSUART DMA for the DNV CPU 5 | 6 | Intel DNV CPU reports an error, indicating that there is a possibility of abnormal serial port functionality and the CPU may hang. 7 | The HSUART DMA will be deactivated for the DNV CPU. 8 | 9 | Signed-off-by: Philo Shao 10 | --- 11 | drivers/tty/serial/8250/8250_mid.c | 18 +++++++++++------- 12 | 1 file changed, 11 insertions(+), 7 deletions(-) 13 | 14 | diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c 15 | index 2cc78a4bf..e4a5d6358 100644 16 | --- a/drivers/tty/serial/8250/8250_mid.c 17 | +++ b/drivers/tty/serial/8250/8250_mid.c 18 | @@ -321,13 +321,17 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) 19 | if (!uart.port.membase) 20 | return -ENOMEM; 21 | 22 | - ret = mid->board->setup(mid, &uart.port); 23 | - if (ret) 24 | - return ret; 25 | - 26 | - ret = mid8250_dma_setup(mid, &uart); 27 | - if (ret) 28 | - goto err; 29 | + if (id->device != PCI_DEVICE_ID_INTEL_DNV_UART) { 30 | + ret = mid->board->setup(mid, &uart.port); 31 | + if (ret) 32 | + return ret; 33 | + 34 | + ret = mid8250_dma_setup(mid, &uart); 35 | + if (ret) 36 | + goto err; 37 | + } else { 38 | + uart.port.handle_irq = dnv_handle_irq; 39 | + } 40 | 41 | ret = serial8250_register_8250_port(&uart); 42 | if (ret < 0) 43 | -- 44 | 2.25.1 45 | 46 | -------------------------------------------------------------------------------- /patches-sonic/0021-leds-mlxreg-Skip-setting-LED-color-during-initializa.patch: -------------------------------------------------------------------------------- 1 | From cbf289ab3a923985e9939ee35814644a3def9f1c Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Wed, 7 Jul 2021 10:18:14 +0000 4 | Subject: [PATCH 21/78] leds: mlxreg: Skip setting LED color during 5 | initialization 6 | 7 | Hardware controls LED through CPLD device and LED control ownership 8 | passes to the software after it performs the first write operation for 9 | any LED on a system. 10 | For example, hardware sets "system" LED "green blink" during boot and 11 | might change it to "red", in case something is went wrong from hardware 12 | point of view. 13 | The motivation for not setting LED during kernel initialization is for 14 | keeping hardware settings visible for user, until user will not decide 15 | to set LEDs according to user OS specific requirements. 16 | 17 | Signed-off-by: Vadim Pasternak 18 | Reviewed-by: Michael Shych 19 | --- 20 | drivers/leds/leds-mlxreg.c | 3 --- 21 | 1 file changed, 3 deletions(-) 22 | 23 | diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c 24 | index a7057b0..26add3e 100644 25 | --- a/drivers/leds/leds-mlxreg.c 26 | +++ b/drivers/leds/leds-mlxreg.c 27 | @@ -244,9 +244,6 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv) 28 | if (err) 29 | return err; 30 | 31 | - if (led_cdev->brightness) 32 | - mlxreg_led_brightness_set(led_cdev, 33 | - led_cdev->brightness); 34 | dev_info(led_cdev->dev, "label: %s, mask: 0x%02x, offset:0x%02x\n", 35 | data->label, data->mask, data->reg); 36 | } 37 | -- 38 | 2.8.4 39 | 40 | -------------------------------------------------------------------------------- /patches-sonic/0044-platform_data-mlxreg-Add-non-sticky-bit-indication-f.patch: -------------------------------------------------------------------------------- 1 | From da53757b0d6a86d772fd6fe6768c9213d0bb2aa4 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Fri, 6 Sep 2024 13:59:03 +0300 4 | Subject: [PATCH 44/78] platform_data/mlxreg: Add non-sticky bit indication 5 | field 6 | 7 | Add non-sticky filed indicating that signal bit is changed to its 8 | previous value after acknowledging. 9 | 10 | Detection of non-sticky signals is to be performed through the reading 11 | event register, while sticky signals are detected through the reading 12 | status register. 13 | 14 | Signed-off-by: Vadim Pasternak 15 | Reviewed-by: Felix Radensky 16 | --- 17 | include/linux/platform_data/mlxreg.h | 2 ++ 18 | 1 file changed, 2 insertions(+) 19 | 20 | diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h 21 | index 84c94b3..fca2d7e43 100644 22 | --- a/include/linux/platform_data/mlxreg.h 23 | +++ b/include/linux/platform_data/mlxreg.h 24 | @@ -184,6 +184,7 @@ struct mlxreg_core_data { 25 | * @inversed: if 0: 0 for signal status is OK, if 1 - 1 is OK; 26 | * @health: true if device has health indication, false in other case; 27 | * @storming_bits: interrupt storming bits mask; 28 | + * @non_sticky: 1 - indicates that signal bit is changed to the previous value after acknowledging; 29 | */ 30 | struct mlxreg_core_item { 31 | struct mlxreg_core_data *data; 32 | @@ -200,6 +201,7 @@ struct mlxreg_core_item { 33 | u8 inversed; 34 | u8 health; 35 | u32 storming_bits; 36 | + u8 non_sticky; 37 | }; 38 | 39 | /** 40 | -- 41 | 2.8.4 42 | 43 | -------------------------------------------------------------------------------- /patch/kconfig-exclusions: -------------------------------------------------------------------------------- 1 | [common] 2 | # Unset STRICT_DEVMEM according to Broadcom's requirement and for CENTEC arm64 arch 3 | CONFIG_STRICT_DEVMEM 4 | # Unset classid and priority network cgroups due to conflict between cgroups v1 and v2 5 | CONFIG_CGROUP_NET_CLASSID 6 | CONFIG_NET_CLS_CGROUP 7 | CONFIG_NETFILTER_XT_MATCH_CGROUP 8 | CONFIG_CGROUP_NET_PRIO 9 | # Unset to enable UBIFS on flash 10 | CONFIG_MTD_SPI_NOR_USE_4K_SECTORS 11 | ###-> mellanox_common-start 12 | ###-> mellanox_common-end 13 | CONFIG_DRM 14 | CONFIG_VIDEO_DEV 15 | CONFIG_MEDIA_SUPPORT 16 | CONFIG_MEDIA_CONTROLLER 17 | CONFIG_DVB_CORE 18 | CONFIG_MEDIA_TUNER 19 | CONFIG_MEDIA_ATTACH 20 | 21 | [amd64] 22 | CONFIG_AMD_MEM_ENCRYPT 23 | # Unset X86_PAT according to Broadcom's requirement 24 | CONFIG_X86_PAT 25 | CONFIG_MLXSW_PCI 26 | ###-> mellanox_amd64-start 27 | ###-> mellanox_amd64-end 28 | 29 | [arm64] 30 | CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU 31 | 32 | [marvell-prestera-arm64] 33 | CONFIG_UBIFS_FS_ZSTD 34 | CONFIG_CRYPTO_DEV_SAFEXCEL 35 | 36 | [pensando] 37 | CONFIG_ARM64_VA_BITS_48 38 | 39 | [armhf] 40 | 41 | [marvell-prestera-armhf] 42 | CONFIG_ARCH_VIRT 43 | CONFIG_ARCH_BCM 44 | CONFIG_ARCH_EXYNOS 45 | CONFIG_ARCH_HIGHBANK 46 | CONFIG_ARCH_MXC 47 | CONFIG_ARCH_MESON 48 | CONFIG_ARCH_OMAP3 49 | CONFIG_ARCH_OMAP4 50 | CONFIG_SOC_OMAP5 51 | CONFIG_SOC_AM33XX 52 | CONFIG_SOC_DRA7XX 53 | CONFIG_ARCH_ROCKCHIP 54 | CONFIG_ARCH_SOCFPGA 55 | CONFIG_ARCH_SUNXI 56 | CONFIG_ARCH_TEGRA 57 | CONFIG_ARCH_VEXPRESS 58 | CONFIG_ARCH_WM8850 59 | CONFIG_FW_CFG_SYSFS 60 | CONFIG_VORTEX 61 | CONFIG_NTP_PPS 62 | CONFIG_SENSORS_MAX6620 63 | CONFIG_SND_LX6464ES 64 | CONFIG_EFI 65 | CONFIG_LOCK_DOWN_KERNEL 66 | CONFIG_SECONDARY_TRUSTED_KEYRING 67 | CONFIG_SYSTEM_BLACKLIST_KEYRING 68 | 69 | [mellanox-arm64] 70 | 71 | -------------------------------------------------------------------------------- /patches-sonic/kconfig-exclusions: -------------------------------------------------------------------------------- 1 | [common] 2 | # Unset STRICT_DEVMEM according to Broadcom's requirement and for CENTEC arm64 arch 3 | CONFIG_STRICT_DEVMEM 4 | # Unset classid and priority network cgroups due to conflict between cgroups v1 and v2 5 | CONFIG_CGROUP_NET_CLASSID 6 | CONFIG_NET_CLS_CGROUP 7 | CONFIG_NETFILTER_XT_MATCH_CGROUP 8 | CONFIG_CGROUP_NET_PRIO 9 | # Unset to enable UBIFS on flash 10 | CONFIG_MTD_SPI_NOR_USE_4K_SECTORS 11 | ###-> mellanox_common-start 12 | ###-> mellanox_common-end 13 | CONFIG_DRM 14 | CONFIG_VIDEO_DEV 15 | CONFIG_MEDIA_SUPPORT 16 | CONFIG_MEDIA_CONTROLLER 17 | CONFIG_DVB_CORE 18 | CONFIG_MEDIA_TUNER 19 | CONFIG_MEDIA_ATTACH 20 | 21 | [amd64] 22 | CONFIG_AMD_MEM_ENCRYPT 23 | # Unset X86_PAT according to Broadcom's requirement 24 | CONFIG_X86_PAT 25 | CONFIG_MLXSW_PCI 26 | ###-> mellanox_amd64-start 27 | ###-> mellanox_amd64-end 28 | 29 | [arm64] 30 | CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU 31 | 32 | [marvell-prestera-arm64] 33 | CONFIG_UBIFS_FS_ZSTD 34 | CONFIG_CRYPTO_DEV_SAFEXCEL 35 | 36 | [pensando] 37 | CONFIG_ARM64_VA_BITS_48 38 | 39 | [armhf] 40 | 41 | [marvell-prestera-armhf] 42 | CONFIG_ARCH_VIRT 43 | CONFIG_ARCH_BCM 44 | CONFIG_ARCH_EXYNOS 45 | CONFIG_ARCH_HIGHBANK 46 | CONFIG_ARCH_MXC 47 | CONFIG_ARCH_MESON 48 | CONFIG_ARCH_OMAP3 49 | CONFIG_ARCH_OMAP4 50 | CONFIG_SOC_OMAP5 51 | CONFIG_SOC_AM33XX 52 | CONFIG_SOC_DRA7XX 53 | CONFIG_ARCH_ROCKCHIP 54 | CONFIG_ARCH_SOCFPGA 55 | CONFIG_ARCH_SUNXI 56 | CONFIG_ARCH_TEGRA 57 | CONFIG_ARCH_VEXPRESS 58 | CONFIG_ARCH_WM8850 59 | CONFIG_FW_CFG_SYSFS 60 | CONFIG_VORTEX 61 | CONFIG_NTP_PPS 62 | CONFIG_SENSORS_MAX6620 63 | CONFIG_SND_LX6464ES 64 | CONFIG_EFI 65 | CONFIG_LOCK_DOWN_KERNEL 66 | CONFIG_SECONDARY_TRUSTED_KEYRING 67 | CONFIG_SYSTEM_BLACKLIST_KEYRING 68 | 69 | [mellanox-arm64] 70 | 71 | -------------------------------------------------------------------------------- /patches-sonic/0004-PCI-AER-Simplify-add_error_device.patch: -------------------------------------------------------------------------------- 1 | From 824b8af8cc8d81ef95d020dcfcd4338249f1f7de Mon Sep 17 00:00:00 2001 2 | From: Bjorn Helgaas 3 | Date: Thu, 22 May 2025 18:21:23 -0500 4 | Subject: [PATCH 04/12] PCI/AER: Simplify add_error_device() 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Return -ENOSPC error early so the usual path through add_error_device() is 10 | the straightline code. 11 | 12 | Signed-off-by: Bjorn Helgaas 13 | Reviewed-by: Ilpo Järvinen 14 | Reviewed-by: Kuppuswamy Sathyanarayanan 15 | Link: https://patch.msgid.link/20250522232339.1525671-18-helgaas@kernel.org 16 | (cherry picked from commit d72bae423004aa7b4d94c34a7fd0b48b64305a08) 17 | --- 18 | drivers/pci/pcie/aer.c | 15 +++++++++------ 19 | 1 file changed, 9 insertions(+), 6 deletions(-) 20 | 21 | diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c 22 | index 6fc993d05647..a10a005ca6e9 100644 23 | --- a/drivers/pci/pcie/aer.c 24 | +++ b/drivers/pci/pcie/aer.c 25 | @@ -811,12 +811,15 @@ EXPORT_SYMBOL_NS_GPL(pci_print_aer, CXL); 26 | */ 27 | static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev) 28 | { 29 | - if (e_info->error_dev_num < AER_MAX_MULTI_ERR_DEVICES) { 30 | - e_info->dev[e_info->error_dev_num] = pci_dev_get(dev); 31 | - e_info->error_dev_num++; 32 | - return 0; 33 | - } 34 | - return -ENOSPC; 35 | + int i = e_info->error_dev_num; 36 | + 37 | + if (i >= AER_MAX_MULTI_ERR_DEVICES) 38 | + return -ENOSPC; 39 | + 40 | + e_info->dev[i] = pci_dev_get(dev); 41 | + e_info->error_dev_num++; 42 | + 43 | + return 0; 44 | } 45 | 46 | /** 47 | -- 48 | 2.47.0 49 | 50 | -------------------------------------------------------------------------------- /patches-sonic/driver-at24-fix-odd-length-two-byte-access.patch: -------------------------------------------------------------------------------- 1 | driver at24 fix odd length two byte access 2 | 3 | From: Cumulus Networks 4 | 5 | For I2C_SMBUS_WORD_DATA read accesses check if the access length is 6 | one or two bytes. For transactions that have an odd length eventualy 7 | we read 1 byte at the end to complete the request. 8 | 9 | The previous code always used a count of 2, which works fine if the 10 | requested total length is even. If the requested length was odd, 11 | however, the code would cause a kernel OOPS. 12 | 13 | The while (count) loop would go forever as count went from 1 to -1, 14 | never becoming zero. Also the return buffer would overrun. 15 | 16 | This patch allows for reading an odd number of bytes in 17 | I2C_SMBUS_WORD_DATA mode. 18 | --- 19 | drivers/misc/eeprom/at24.c | 6 ++++-- 20 | 1 file changed, 4 insertions(+), 2 deletions(-) 21 | 22 | diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c 23 | index d87f77f..9e9256a 100644 24 | --- a/drivers/misc/eeprom/at24.c 25 | +++ b/drivers/misc/eeprom/at24.c 26 | @@ -192,7 +192,8 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, 27 | count = I2C_SMBUS_BLOCK_MAX; 28 | break; 29 | case I2C_SMBUS_WORD_DATA: 30 | - count = 2; 31 | + /* Check for odd length transaction */ 32 | + count = (count == 1) ? 1 : 2; 33 | break; 34 | case I2C_SMBUS_BYTE_DATA: 35 | count = 1; 36 | @@ -237,7 +238,8 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, 37 | status = i2c_smbus_read_word_data(client, offset); 38 | if (status >= 0) { 39 | buf[0] = status & 0xff; 40 | - buf[1] = status >> 8; 41 | + if (count == 2) 42 | + buf[1] = status >> 8; 43 | status = count; 44 | } 45 | break; 46 | -------------------------------------------------------------------------------- /patches-sonic/0004-dt-bindings-hwmon-Add-missing-documentation-for-lm75.patch: -------------------------------------------------------------------------------- 1 | From c3eab8b7b730548ade06b71fad6b1d12fd53f28a Mon Sep 17 00:00:00 2001 2 | 3 | From: Jagan Teki 4 | 5 | Subject: [PATCH 4/6] dt-bindings: hwmon: Add missing documentation for lm75 6 | 7 | Add missing dt-binding documentation for lm75 hwmon sensor. 8 | 9 | Signed-off-by: Jagan Teki 10 | Acked-by: Rob Herring 11 | Signed-off-by: Guenter Roeck 12 | --- 13 | Documentation/devicetree/bindings/hwmon/lm75.txt | 37 ++++++++++++++++++++++ 14 | 1 file changed, 37 insertions(+) 15 | create mode 100644 Documentation/devicetree/bindings/hwmon/lm75.txt 16 | 17 | diff --git a/Documentation/devicetree/bindings/hwmon/lm75.txt b/Documentation/devicetree/bindings/hwmon/lm75.txt 18 | new file mode 100644 19 | index 000000000..12d8cf7cf 20 | --- /dev/null 21 | +++ b/Documentation/devicetree/bindings/hwmon/lm75.txt 22 | @@ -0,0 +1,37 @@ 23 | +*LM75 hwmon sensor. 24 | + 25 | +Required properties: 26 | +- compatible: manufacturer and chip name, one of 27 | + "adi,adt75", 28 | + "dallas,ds1775", 29 | + "dallas,ds75", 30 | + "dallas,ds7505", 31 | + "gmt,g751", 32 | + "national,lm75", 33 | + "national,lm75a", 34 | + "national,lm75b", 35 | + "maxim,max6625", 36 | + "maxim,max6626", 37 | + "maxim,max31725", 38 | + "maxim,max31726", 39 | + "maxim,mcp980x", 40 | + "st,stds75", 41 | + "st,stlm75", 42 | + "microchip,tcn75", 43 | + "ti,tmp100", 44 | + "ti,tmp101", 45 | + "ti,tmp105", 46 | + "ti,tmp112", 47 | + "ti,tmp175", 48 | + "ti,tmp275", 49 | + "ti,tmp75", 50 | + "ti,tmp75c", 51 | + 52 | +- reg: I2C bus address of the device 53 | + 54 | +Example: 55 | + 56 | +sensor@48 { 57 | + compatible = "st,stlm75"; 58 | + reg = <0x48>; 59 | +}; 60 | -------------------------------------------------------------------------------- /patches-sonic/0001-Change-the-system.map-file-permission-only-readable-.patch: -------------------------------------------------------------------------------- 1 | From 0ec2a0c7a1380d55072fa3661abf8a33215b3dd6 Mon Sep 17 00:00:00 2001 2 | From: xumia 3 | Date: Sun, 10 Dec 2023 01:02:27 +0000 4 | Subject: [PATCH] Change the system.map file permission only readable by root 5 | 6 | --- 7 | debian/rules.real | 5 +++-- 8 | 1 file changed, 3 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/debian/rules.real b/debian/rules.real 11 | index 98ee4ac7a..5f1d8a665 100644 12 | --- a/debian/rules.real 13 | +++ b/debian/rules.real 14 | @@ -191,7 +191,7 @@ endif 15 | dh_icons 16 | dh_link 17 | dh_compress 18 | - dh_fixperms 19 | + dh_fixperms -XSystem.map-* 20 | dh_missing 21 | dh_strip $(DH_STRIP_ARGS) -Xvmlinux -Xvmlinuz 22 | dh_makeshlibs -Xvdso -Xvmlinux -Xvmlinuz 23 | @@ -383,6 +383,7 @@ endif 24 | sed '/CONFIG_\(MODULE_SIG_\(ALL\|KEY\)\|SYSTEM_TRUSTED_KEYS\|BUILD_SALT\)[ =]/d' $(DIR)/.config > $(DESTDIR)/boot/config-$(REAL_VERSION) 25 | echo "ffffffffffffffff B The real System.map is in the linux-image--dbg package" \ 26 | > $(DESTDIR)/boot/System.map-$(REAL_VERSION) 27 | + chmod 600 $(DESTDIR)/boot/System.map-$(REAL_VERSION) 28 | rm $(DESTDIR)/lib/firmware -rf 29 | 30 | dh_installdirs usr/share/bug/$(PACKAGE_NAME) 31 | @@ -435,7 +436,7 @@ binary_image-dbg: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 32 | $(dh_binary_pre) 33 | dh_installdirs usr/lib/debug usr/lib/debug/boot usr/share/lintian/overrides/ 34 | install -m644 $(DIR)/vmlinux $(DEBUG_DIR)/boot/vmlinux-$(REAL_VERSION) 35 | - install -m644 $(DIR)/System.map $(DEBUG_DIR)/boot/System.map-$(REAL_VERSION) 36 | + install -m600 $(DIR)/System.map $(DEBUG_DIR)/boot/System.map-$(REAL_VERSION) 37 | 38 | # cmd_sign=: Don't sign modules 39 | # suffix-y=: Don't compress modules 40 | -- 41 | 2.25.1 42 | 43 | -------------------------------------------------------------------------------- /patches-sonic/0019-mrvl-gicp-clr-irqs-on-probe.patch: -------------------------------------------------------------------------------- 1 | From 21c4ec02660984feece49f1863245d48fc9774a7 Mon Sep 17 00:00:00 2001 2 | From: Elad Nachman 3 | Date: Sun, 10 Aug 2025 12:48:23 +0300 4 | Subject: [PATCH v2 1/1] irqchip/mvebu-gicp: clear pending irqs on init 5 | 6 | When a kexec'ed kernel boots up, there might be stale unhandled interrupts 7 | pending in the interrupt controller. These are delivered as spurious 8 | interrupts once the boot CPU enables interrupts. 9 | Clear all pending interrupts when the driver is initialized to prevent 10 | these spurious interrupts from locking the CPU in an endless loop. 11 | 12 | Signed-off-by: Elad Nachman 13 | --- 14 | drivers/irqchip/irq-mvebu-gicp.c | 10 ++++++++++ 15 | 1 file changed, 10 insertions(+) 16 | 17 | diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-gicp.c 18 | index d3232d6d8dce..4b2cad09bc71 100644 19 | --- a/drivers/irqchip/irq-mvebu-gicp.c 20 | +++ b/drivers/irqchip/irq-mvebu-gicp.c 21 | @@ -172,6 +172,7 @@ 22 | struct device_node *irq_parent_dn; 23 | struct mvebu_gicp *gicp; 24 | int ret, i; 25 | + void __iomem *base; 26 | 27 | gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL); 28 | if (!gicp) 29 | @@ -245,6 +246,16 @@ 30 | irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); 31 | inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; 32 | inner_domain->msi_parent_ops = &gicp_msi_parent_ops; 33 | + 34 | + base = ioremap(gicp->res->start, resource_size(gicp->res)); 35 | + if (!base) { 36 | + dev_err(&pdev->dev, "ioremap() failed. Unable to clear pending interrupts.\n"); 37 | + } else { 38 | + for (i = 0; i < 64; i++) 39 | + writel(i, base + GICP_CLRSPI_NSR_OFFSET); 40 | + iounmap(base); 41 | + } 42 | + 43 | return 0; 44 | } 45 | 46 | -- 47 | 2.25.1 48 | 49 | -------------------------------------------------------------------------------- /patches-sonic/cisco-ds4424-null-of-node.patch: -------------------------------------------------------------------------------- 1 | From ec513d48cc5b25b98c15ec2a47658c71b2231f95 Mon Sep 17 00:00:00 2001 2 | From: Madhava Reddy Siddareddygari 3 | Date: Sat, 25 Sep 2021 20:44:20 -0700 4 | Subject: [PATCH] iio: (dac/ds4424) Allow NULL of_node 5 | 6 | Cisco is using ACPI to read device configuration instead of 7 | OF (device-tree) for ds4424 device. 8 | 9 | Kernel is in a transition period in its support for ACPI 10 | (cisco using ACPI for kernel module configuration). The kernel 11 | makes a distinction between device tree (of_node) and ACPI 12 | (fw_node) in the device structure. It is unclear if they can be 13 | used together or not, but I can definitively say that we are only 14 | using ACPI and not device tree. In this particular driver, there 15 | was an explicit check for having a device tree node, even though no 16 | reference to the device tree was made within the driver. This caused 17 | the probe routine to fail with -ENODEV in cisco environment. 18 | 19 | This patch removes the check for of_node. 20 | 21 | Signed-off-by: Madhava Reddy Siddareddygari 22 | --- 23 | drivers/iio/dac/ds4424.c | 6 ------ 24 | 1 file changed, 6 deletions(-) 25 | 26 | diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c 27 | index 714a97f91..ae9be7926 100644 28 | --- a/drivers/iio/dac/ds4424.c 29 | +++ b/drivers/iio/dac/ds4424.c 30 | @@ -236,12 +236,6 @@ static int ds4424_probe(struct i2c_client *client, 31 | indio_dev->dev.of_node = client->dev.of_node; 32 | indio_dev->dev.parent = &client->dev; 33 | 34 | - if (!client->dev.of_node) { 35 | - dev_err(&client->dev, 36 | - "Not found DT.\n"); 37 | - return -ENODEV; 38 | - } 39 | - 40 | data->vcc_reg = devm_regulator_get(&client->dev, "vcc"); 41 | if (IS_ERR(data->vcc_reg)) { 42 | dev_err(&client->dev, 43 | -- 44 | 2.26.2 45 | 46 | -------------------------------------------------------------------------------- /patches-sonic/0202-i2c-mlxbf-prevent-stack-overflow-in-mlxbf_i2c_smbus_.patch: -------------------------------------------------------------------------------- 1 | From cf835e1581883f7e90fa322efe2dd91a510e51df Mon Sep 17 00:00:00 2001 2 | From: Asmaa Mnebhi 3 | Date: Thu, 8 Sep 2022 13:35:39 -0400 4 | Subject: [PATCH backport 5.10 03/63] i2c: mlxbf: prevent stack overflow in 5 | mlxbf_i2c_smbus_start_transaction() 6 | 7 | BugLink: https://bugs.launchpad.net/bugs/1991551 8 | 9 | memcpy() is called in a loop while 'operation->length' upper bound 10 | is not checked and 'data_idx' also increments. 11 | 12 | Fixes: b5b5b32081cd206b ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC") 13 | Reviewed-by: Khalil Blaiech 14 | Signed-off-by: Asmaa Mnebhi 15 | Signed-off-by: Wolfram Sang 16 | (cherry picked from commit de24aceb07d426b6f1c59f33889d6a964770547b) 17 | Signed-off-by: Asmaa Mnebhi 18 | Acked-by: Tim Gardner 19 | Acked-by: Bartlomiej Zolnierkiewicz 20 | Signed-off-by: Bartlomiej Zolnierkiewicz 21 | --- 22 | drivers/i2c/busses/i2c-mlxbf.c | 3 +++ 23 | 1 file changed, 3 insertions(+) 24 | 25 | diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c 26 | index 042c83b90..d78fb24d5 100644 27 | --- a/drivers/i2c/busses/i2c-mlxbf.c 28 | +++ b/drivers/i2c/busses/i2c-mlxbf.c 29 | @@ -744,6 +744,9 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, 30 | if (flags & MLXBF_I2C_F_WRITE) { 31 | write_en = 1; 32 | write_len += operation->length; 33 | + if (data_idx + operation->length > 34 | + MLXBF_I2C_MASTER_DATA_DESC_SIZE) 35 | + return -ENOBUFS; 36 | memcpy(data_desc + data_idx, 37 | operation->buffer, operation->length); 38 | data_idx += operation->length; 39 | -- 40 | 2.20.1 41 | 42 | -------------------------------------------------------------------------------- /patches-sonic/rtnetlink-catch-EOPNOTSUPP-errors.patch: -------------------------------------------------------------------------------- 1 | commit 10c9f8f890dcff762b74fc71aaac6402aa1660c9 2 | Author: Jipan Yang 3 | Date: Tue Jun 13 16:36:16 2017 -0700 4 | 5 | rtnetlink: catch -EOPNOTSUPP errors from ndo_bridge_getlink 6 | https://github.com/torvalds/linux/commit/d64f69b0373a7d0bcec8b5da7712977518a8f42b 7 | 8 | diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c 9 | index e4666af..a7e13b5 100644 10 | --- a/net/core/rtnetlink.c 11 | +++ b/net/core/rtnetlink.c 12 | @@ -2623,6 +2623,7 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) 13 | u32 seq = cb->nlh->nlmsg_seq; 14 | struct nlattr *extfilt; 15 | u32 filter_mask = 0; 16 | + int err; 17 | 18 | extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), 19 | IFLA_EXT_MASK); 20 | @@ -2635,18 +2636,22 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) 21 | struct net_device *br_dev = netdev_master_upper_dev_get(dev); 22 | 23 | if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) { 24 | - if (idx >= cb->args[0] && 25 | - br_dev->netdev_ops->ndo_bridge_getlink( 26 | - skb, portid, seq, dev, filter_mask) < 0) 27 | - break; 28 | + if (idx >= cb->args[0]) { 29 | + err = br_dev->netdev_ops->ndo_bridge_getlink( 30 | + skb, portid, seq, dev, filter_mask); 31 | + if (err < 0 && err != -EOPNOTSUPP) 32 | + break; 33 | + } 34 | idx++; 35 | } 36 | 37 | if (ops->ndo_bridge_getlink) { 38 | - if (idx >= cb->args[0] && 39 | - ops->ndo_bridge_getlink(skb, portid, seq, dev, 40 | - filter_mask) < 0) 41 | - break; 42 | + if (idx >= cb->args[0]) { 43 | + err = ops->ndo_bridge_getlink(skb, portid, seq, dev, 44 | + filter_mask); 45 | + if (err < 0 && err != -EOPNOTSUPP) 46 | + break; 47 | + } 48 | idx++; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /patches-sonic/0018-drivers-i2c-fix-after-kdump-crash.patch: -------------------------------------------------------------------------------- 1 | From da0d305f60d9686048033d0765c20c763ad5a986 Mon Sep 17 00:00:00 2001 2 | From: Elad Nachman 3 | Date: Sun, 18 May 2025 14:02:58 +0000 4 | Subject: [PATCH 1/2] drivers: i2c: fix after kdump crash 5 | 6 | Spurious interrupts left while i2c controller still 7 | at RX or TX state would try to access the RX or TX 8 | buffer pointer, which is NULL. 9 | Add check to verify buffer pointer is not NULL before 10 | reading or writing the buffer for additional TX or RX 11 | operations. 12 | 13 | Signed-off-by: Elad Nachman 14 | --- 15 | drivers/i2c/busses/i2c-mv64xxx.c | 10 +++++++--- 16 | 1 file changed, 7 insertions(+), 3 deletions(-) 17 | 18 | diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c 19 | index 13e9bdeb4..36fdd9b19 100644 20 | --- a/drivers/i2c/busses/i2c-mv64xxx.c 21 | +++ b/drivers/i2c/busses/i2c-mv64xxx.c 22 | @@ -413,14 +413,18 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) 23 | break; 24 | 25 | case MV64XXX_I2C_ACTION_SEND_DATA: 26 | - writel(drv_data->msg->buf[drv_data->byte_posn++], 27 | - drv_data->reg_base + drv_data->reg_offsets.data); 28 | + if (drv_data->msg && drv_data->msg->buf) 29 | + writel(drv_data->msg->buf[drv_data->byte_posn++], 30 | + drv_data->reg_base + drv_data->reg_offsets.data); 31 | writel(drv_data->cntl_bits, 32 | drv_data->reg_base + drv_data->reg_offsets.control); 33 | break; 34 | 35 | case MV64XXX_I2C_ACTION_RCV_DATA: 36 | - drv_data->msg->buf[drv_data->byte_posn++] = 37 | + if (drv_data->msg && drv_data->msg->buf) 38 | + drv_data->msg->buf[drv_data->byte_posn++] = 39 | + readl(drv_data->reg_base + drv_data->reg_offsets.data); 40 | + else 41 | readl(drv_data->reg_base + drv_data->reg_offsets.data); 42 | writel(drv_data->cntl_bits, 43 | drv_data->reg_base + drv_data->reg_offsets.control); 44 | -- 45 | 2.34.1 46 | 47 | -------------------------------------------------------------------------------- /patches-sonic/0018-i2c-mv64xxx-kdump-sonic.patch: -------------------------------------------------------------------------------- 1 | From 3c04dd543d85e6e087e7ad3147b47b3d6d702bdd Mon Sep 17 00:00:00 2001 2 | From: Elad Nachman 3 | Date: Tue, 29 Jul 2025 11:09:46 +0300 4 | Subject: [PATCH v2 1/1] i2c: mv64xxx: prevent illegal pointer access 5 | 6 | Spurious interrupts left while i2c controller still at RX or TX state 7 | would try to access the RX or TX buffer pointer, which is NULL. 8 | Add check to verify buffer pointer is not NULL before reading or writing 9 | the buffer for additional TX or RX operations. 10 | 11 | Signed-off-by: Elad Nachman 12 | --- 13 | drivers/i2c/busses/i2c-mv64xxx.c | 10 +++++++--- 14 | 1 file changed, 7 insertions(+), 3 deletions(-) 15 | 16 | diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c 17 | index 8fc26a511320..e6baa9c520b4 100644 18 | --- a/drivers/i2c/busses/i2c-mv64xxx.c 19 | +++ b/drivers/i2c/busses/i2c-mv64xxx.c 20 | @@ -390,14 +390,18 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) 21 | break; 22 | 23 | case MV64XXX_I2C_ACTION_SEND_DATA: 24 | - writel(drv_data->msg->buf[drv_data->byte_posn++], 25 | - drv_data->reg_base + drv_data->reg_offsets.data); 26 | + if (drv_data->msg && drv_data->msg->buf) 27 | + writel(drv_data->msg->buf[drv_data->byte_posn++], 28 | + drv_data->reg_base + drv_data->reg_offsets.data); 29 | writel(drv_data->cntl_bits, 30 | drv_data->reg_base + drv_data->reg_offsets.control); 31 | break; 32 | 33 | case MV64XXX_I2C_ACTION_RCV_DATA: 34 | - drv_data->msg->buf[drv_data->byte_posn++] = 35 | + if (drv_data->msg && drv_data->msg->buf) 36 | + drv_data->msg->buf[drv_data->byte_posn++] = 37 | + readl(drv_data->reg_base + drv_data->reg_offsets.data); 38 | + else 39 | readl(drv_data->reg_base + drv_data->reg_offsets.data); 40 | writel(drv_data->cntl_bits, 41 | drv_data->reg_base + drv_data->reg_offsets.control); 42 | -- 43 | 2.25.1 44 | 45 | -------------------------------------------------------------------------------- /patches-sonic/kernel-sched-core-fix-cgroup-fork-race.patch: -------------------------------------------------------------------------------- 1 | [PATCH] sched: Fix race between task_group and sched_task_group 2 | 3 | From: Pavel Shirshov 4 | 5 | Patch: http://marc.info/?l=linux-kernel&m=141440511931665 6 | 7 | The race may happen when somebody is changing task_group of a forking task. 8 | Child's cgroup is the same as parent's after dup_task_struct() (there just 9 | memory copying). Also, cfs_rq and rt_rq are the same as parent's. 10 | 11 | But if parent changes its task_group before it's called cgroup_post_fork(), 12 | we do not reflect this situation on child. Child's cfs_rq and rt_rq remain 13 | the same, while child's task_group changes in cgroup_post_fork(). 14 | 15 | To fix this we introduce fork() method, which calls sched_move_task() directly. 16 | This function changes sched_task_group on appropriate (also its logic has 17 | no problem with freshly created tasks, so we shouldn't introduce something 18 | special; we are able just to use it). 19 | --- 20 | kernel/sched/core.c | 6 ++++++ 21 | 1 file changed, 6 insertions(+) 22 | 23 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c 24 | index 8cbf68e..8077b8e 100644 25 | --- a/kernel/sched/core.c 26 | +++ b/kernel/sched/core.c 27 | @@ -7793,6 +7793,11 @@ static void cpu_cgroup_css_offline(struct cgroup_subsys_state *css) 28 | sched_offline_group(tg); 29 | } 30 | 31 | +static void cpu_cgroup_fork(struct task_struct *task) 32 | +{ 33 | + sched_move_task(task); 34 | +} 35 | + 36 | static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, 37 | struct cgroup_taskset *tset) 38 | { 39 | @@ -8159,6 +8164,7 @@ struct cgroup_subsys cpu_cgrp_subsys = { 40 | .css_free = cpu_cgroup_css_free, 41 | .css_online = cpu_cgroup_css_online, 42 | .css_offline = cpu_cgroup_css_offline, 43 | + .fork = cpu_cgroup_fork, 44 | .can_attach = cpu_cgroup_can_attach, 45 | .attach = cpu_cgroup_attach, 46 | .exit = cpu_cgroup_exit, 47 | -------------------------------------------------------------------------------- /patches-sonic/8010-mlxsw-minimal-Downstream-Disable-ethtool-interface.patch: -------------------------------------------------------------------------------- 1 | From 38714ff080a0e0abc22d0ace3c3b12adcb474ae1 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Sun, 14 Jan 2024 16:46:03 +0000 4 | Subject: [PATCH 66/78] mlxsw: minimal: Downstream: Disable ethtool interface 5 | 6 | Disable 'ethtool' interface, since it is un-used and just created 7 | un-necessary 'netdevice' interfaces. 8 | 9 | Signed-off-by: Vadim Pasternak 10 | --- 11 | drivers/net/ethernet/mellanox/mlxsw/core_env.c | 1 + 12 | drivers/net/ethernet/mellanox/mlxsw/minimal.c | 3 +++ 13 | 2 files changed, 4 insertions(+) 14 | 15 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c 16 | index 294e758..21cee901 100644 17 | --- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c 18 | +++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c 19 | @@ -1474,6 +1474,7 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, 20 | if (err) 21 | goto err_linecards_event_ops_register; 22 | 23 | + return 0; 24 | err = mlxsw_env_temp_warn_event_register(mlxsw_core); 25 | if (err) 26 | goto err_temp_warn_event_register; 27 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c 28 | index 6faebeb..b72434f 100644 29 | --- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c 30 | +++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c 31 | @@ -534,6 +534,8 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m) 32 | { 33 | int err; 34 | 35 | + return 0; 36 | + 37 | /* Fill out module to local port mapping array */ 38 | err = mlxsw_m_ports_module_map(mlxsw_m); 39 | if (err) 40 | @@ -555,6 +557,7 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m) 41 | 42 | static void mlxsw_m_ports_remove(struct mlxsw_m *mlxsw_m) 43 | { 44 | + return; 45 | mlxsw_m_linecard_ports_remove(mlxsw_m, 0); 46 | } 47 | 48 | -- 49 | 2.8.4 50 | 51 | -------------------------------------------------------------------------------- /patches-sonic/0195-platform-x86-MLX_PLATFORM-select-REGMAP-instead-of-d.patch: -------------------------------------------------------------------------------- 1 | From 7e7e1541c91615e9950d0b96bcd1806d297e970e Mon Sep 17 00:00:00 2001 2 | From: Randy Dunlap 3 | Date: Sat, 25 Feb 2023 21:39:51 -0800 4 | Subject: [PATCH] platform: x86: MLX_PLATFORM: select REGMAP instead of 5 | depending on it 6 | 7 | REGMAP is a hidden (not user visible) symbol. Users cannot set it 8 | directly thru "make *config", so drivers should select it instead of 9 | depending on it if they need it. 10 | 11 | Consistently using "select" or "depends on" can also help reduce 12 | Kconfig circular dependency issues. 13 | 14 | Therefore, change the use of "depends on REGMAP" to "select REGMAP". 15 | 16 | Fixes: ef0f62264b2a ("platform/x86: mlx-platform: Add physical bus number auto detection") 17 | Signed-off-by: Randy Dunlap 18 | Cc: Vadim Pasternak 19 | Cc: Darren Hart 20 | Cc: Hans de Goede 21 | Cc: Mark Gross 22 | Cc: platform-driver-x86@vger.kernel.org 23 | Link: https://lore.kernel.org/r/20230226053953.4681-7-rdunlap@infradead.org 24 | Signed-off-by: Hans de Goede 25 | Reviewed-by: Hans de Goede 26 | --- 27 | drivers/platform/x86/Kconfig | 3 ++- 28 | 1 file changed, 2 insertions(+), 1 deletion(-) 29 | 30 | diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig 31 | index ec7c2b4e1721..4a01b315e0a9 100644 32 | --- a/drivers/platform/x86/Kconfig 33 | +++ b/drivers/platform/x86/Kconfig 34 | @@ -955,7 +955,8 @@ config SERIAL_MULTI_INSTANTIATE 35 | 36 | config MLX_PLATFORM 37 | tristate "Mellanox Technologies platform support" 38 | - depends on I2C && REGMAP 39 | + depends on I2C 40 | + select REGMAP 41 | help 42 | This option enables system support for the Mellanox Technologies 43 | platform. The Mellanox systems provide data center networking 44 | -- 45 | 2.14.1 46 | 47 | -------------------------------------------------------------------------------- /patches-sonic/8007-hwmon-emc2305-Downstream-Allow-fan-speed-setting-gra.patch: -------------------------------------------------------------------------------- 1 | From c43e12b088a65e3d4431712f3877969854d7057c Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Thu, 2 Nov 2023 12:18:22 +0000 4 | Subject: [PATCH 63/78] hwmon: (emc2305): Downstream: Allow fan speed setting 5 | granularity of 1 PWM 6 | 7 | Currently PWM setting is allowed with 10 percent stepping. 8 | Such configuration is aligned with thermal drivers, which are used to be 9 | bound to "emc2305" driver. 10 | 11 | This binding happens when the cooling instances created by the driver are 12 | bound to some kernel thermal driver. 13 | 14 | In case system is not using kernel thermal control and the cooling 15 | instances created by the driver are not bound to any thermal driver, the 16 | driver still does not allow setting of PWM granularity less than 10 17 | percent. 18 | 19 | Allow setting fan with one percent granularity, thus any user space 20 | thermal application will be able to set PWM to any allowed value in range 21 | from 0 PWM to 255 PWM. 22 | 23 | Note: this is downstream patch, since it can affect functionality for 24 | the Nvidia users running kernel thermal control. So, it is not going to be 25 | submitted to up-stream. 26 | 27 | Signed-off-by: Vadim Pasternak 28 | --- 29 | drivers/hwmon/emc2305.c | 4 ++++ 30 | 1 file changed, 4 insertions(+) 31 | 32 | diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c 33 | index 4d39fbd..0066138 100644 34 | --- a/drivers/hwmon/emc2305.c 35 | +++ b/drivers/hwmon/emc2305.c 36 | @@ -16,7 +16,11 @@ 37 | #define EMC2305_REG_VENDOR 0xfe 38 | #define EMC2305_FAN_MAX 0xff 39 | #define EMC2305_FAN_MIN 0x00 40 | +#ifdef CONFIG_MLXSW_CORE_THERMAL 41 | #define EMC2305_FAN_MAX_STATE 10 42 | +#else 43 | +#define EMC2305_FAN_MAX_STATE 255 44 | +#endif 45 | #define EMC2305_DEVICE 0x34 46 | #define EMC2305_VENDOR 0x5d 47 | #define EMC2305_REG_PRODUCT_ID 0xfd 48 | -- 49 | 2.8.4 50 | 51 | -------------------------------------------------------------------------------- /patches-sonic/0003-arm64-dts-marvell-Add-NAND-flash-controller-to-AC5.patch: -------------------------------------------------------------------------------- 1 | From 58fe732052196777112fdba536fb9db5cdd42ec6 Mon Sep 17 00:00:00 2001 2 | From: Chris Packham 3 | Date: Mon, 3 Jul 2023 15:50:43 +1200 4 | Subject: arm64: dts: marvell: Add NAND flash controller to AC5 5 | 6 | The AC5/AC5X SoC has a NAND flash controller (NFC). Add this to 7 | the base SoC dtsi file as a disabled node. The NFC integration 8 | on the AC5/AC5X only supports SDR timing modes up to 3 so requires a 9 | dedicated compatible property so this limitation can be enforced. 10 | 11 | Signed-off-by: Chris Packham 12 | Signed-off-by: Gregory CLEMENT 13 | --- 14 | arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi | 16 ++++++++++++++++ 15 | 1 file changed, 16 insertions(+) 16 | 17 | diff --git a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 18 | index 67c4688546b8..62d03ffa9485 100644 19 | --- a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 20 | +++ b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 21 | @@ -297,6 +297,16 @@ spi1: spi@805a8000 { 22 | status = "disabled"; 23 | }; 24 | 25 | + nand: nand-controller@805b0000 { 26 | + compatible = "marvell,ac5-nand-controller"; 27 | + reg = <0x0 0x805b0000 0x0 0x00000054>; 28 | + #address-cells = <0x1>; 29 | + #size-cells = <0x0>; 30 | + interrupts = ; 31 | + clocks = <&nand_clock>; 32 | + status = "disabled"; 33 | + }; 34 | + 35 | gic: interrupt-controller@80600000 { 36 | compatible = "arm,gic-v3"; 37 | #interrupt-cells = <3>; 38 | @@ -319,5 +329,11 @@ spi_clock: spi-clock { 39 | #clock-cells = <0>; 40 | clock-frequency = <200000000>; 41 | }; 42 | + 43 | + nand_clock: nand-clock { 44 | + compatible = "fixed-clock"; 45 | + #clock-cells = <0>; 46 | + clock-frequency = <400000000>; 47 | + }; 48 | }; 49 | }; 50 | -- 51 | 2.25.1 52 | 53 | -------------------------------------------------------------------------------- /patches-sonic/0018-leds-mlxreg-Remove-code-for-amber-LED-colour.patch: -------------------------------------------------------------------------------- 1 | From 5feddc9d395ceb20792619e506d93bdbcc9b5cbf Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Thu, 20 Jul 2023 11:17:31 +0000 4 | Subject: [PATCH 18/78] leds: mlxreg: Remove code for amber LED colour 5 | 6 | Remove unused code for amber LED colour. 7 | 8 | In case system LED color is "green", "orange" or "amber" same code is 9 | to be used for colour setting. 10 | 11 | Signed-off-by: Vadim Pasternak 12 | --- 13 | drivers/leds/leds-mlxreg.c | 8 ++------ 14 | 1 file changed, 2 insertions(+), 6 deletions(-) 15 | 16 | diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c 17 | index 5b73cc4..a7057b0 100644 18 | --- a/drivers/leds/leds-mlxreg.c 19 | +++ b/drivers/leds/leds-mlxreg.c 20 | @@ -18,7 +18,6 @@ 21 | #define MLXREG_LED_IS_OFF 0x00 /* Off */ 22 | #define MLXREG_LED_RED_SOLID 0x05 /* Solid red */ 23 | #define MLXREG_LED_GREEN_SOLID 0x0D /* Solid green */ 24 | -#define MLXREG_LED_AMBER_SOLID 0x09 /* Solid amber */ 25 | #define MLXREG_LED_BLINK_3HZ 167 /* ~167 msec off/on - HW support */ 26 | #define MLXREG_LED_BLINK_6HZ 83 /* ~83 msec off/on - HW support */ 27 | #define MLXREG_LED_CAPABILITY_CLEAR GENMASK(31, 8) /* Clear mask */ 28 | @@ -222,13 +221,10 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv) 29 | } 30 | led_cdev = &led_data->led_cdev; 31 | led_data->data_parent = priv; 32 | - if (strstr(data->label, "red") || 33 | - strstr(data->label, "orange")) { 34 | + if (strstr(data->label, "red") || strstr(data->label, "orange") || 35 | + strstr(data->label, "amber")) { 36 | brightness = LED_OFF; 37 | led_data->base_color = MLXREG_LED_RED_SOLID; 38 | - } else if (strstr(data->label, "amber")) { 39 | - brightness = LED_OFF; 40 | - led_data->base_color = MLXREG_LED_AMBER_SOLID; 41 | } else { 42 | brightness = LED_OFF; 43 | led_data->base_color = MLXREG_LED_GREEN_SOLID; 44 | -- 45 | 2.8.4 46 | 47 | -------------------------------------------------------------------------------- /patches-sonic/0029-pcie-if-hotplug-enabled-do-immediate-reset-on-panic.patch: -------------------------------------------------------------------------------- 1 | From 912731499464664bc16519131790610fa31caf1a Mon Sep 17 00:00:00 2001 2 | From: Shantanu Shrivastava 3 | Date: Mon, 11 Mar 2024 14:12:44 +0000 4 | Subject: [PATCH] pcie: if hotplug enabled do immediate reset on panic 5 | 6 | Signed-off-by: Ganesan Ramalingam 7 | Signed-off-by: Shantanu Shrivastava 8 | --- 9 | drivers/soc/pensando/cap_pcie.c | 7 ++++++- 10 | 1 file changed, 6 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/drivers/soc/pensando/cap_pcie.c b/drivers/soc/pensando/cap_pcie.c 13 | index 3c43f56d3..91ecb0b12 100644 14 | --- a/drivers/soc/pensando/cap_pcie.c 15 | +++ b/drivers/soc/pensando/cap_pcie.c 16 | @@ -41,6 +41,7 @@ struct pciedev_info { 17 | int pciep_access_error; 18 | spinlock_t pciep_access_lock; 19 | long (*saved_panic_blink)(int state); 20 | + u32 hotplug_delaylnkup; 21 | }; 22 | 23 | static struct pciedev_info pciedev_info; 24 | @@ -302,6 +303,8 @@ static void cap_reset(void) 25 | * 26 | * If we haven't yet initialized the link (ltssm_en=0) then the 27 | * host side hasn't come up yet. In that case just reset immediately. 28 | + * 29 | + * If hotplug enabled then reset immediately 30 | */ 31 | static long pcie_panic_blink(int state) 32 | { 33 | @@ -312,7 +315,7 @@ static long pcie_panic_blink(int state) 34 | cap_reset(); 35 | 36 | port = pcie_get_ltssm_en(); 37 | - if (port >= 0) { 38 | + if (!pciedev_info.hotplug_delaylnkup && port >= 0) { 39 | pr_info(PFX "port %d enabled\n", port); 40 | pcie_set_crs(0); 41 | while ((port = pcie_poll_for_hostdn()) < 0) 42 | @@ -389,6 +392,8 @@ static int pcie_probe(struct platform_device *pd) 43 | pi->pcie_base = res.start; 44 | pi->pcie_size = resource_size(&res); 45 | 46 | + of_property_read_u32(dn, "hotplug_delaylnkup", &pi->hotplug_delaylnkup); 47 | + 48 | err = misc_register(&pcie_dev); 49 | if (err) { 50 | pr_err(PFX "register pcie_dev failed: %d\n", err); 51 | -- 52 | 2.25.1 53 | 54 | -------------------------------------------------------------------------------- /patches-sonic/cisco-acpi-spi-nor.patch: -------------------------------------------------------------------------------- 1 | From 629588d479e637c6ed7c64fe76b66f1d7f0482fe Mon Sep 17 00:00:00 2001 2 | From: Madhava Reddy Siddareddygari 3 | Date: Fri, 15 Oct 2021 11:57:37 -0700 4 | Subject: [PATCH] mtd: spi nor core driver update to support ACPI table match 5 | 6 | Current spi nor core driver does not support ACPI table match. 7 | Configuration done through ACPI tables is not recognized by driver. 8 | Cisco 8000 platform configures NOR flash partition information 9 | through ACPI table which is not recognized by spi nor. 10 | 11 | Added support in spi nor core to perform ACPI table match. 12 | 13 | Signed-off-by: Madhava Reddy Siddareddygari 14 | --- 15 | drivers/mtd/spi-nor/core.c | 11 +++++++++++ 16 | 1 file changed, 11 insertions(+) 17 | 18 | diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c 19 | index 2b26a875a..82bbd84a2 100644 20 | --- a/drivers/mtd/spi-nor/core.c 21 | +++ b/drivers/mtd/spi-nor/core.c 22 | @@ -21,6 +21,7 @@ 23 | #include 24 | #include 25 | #include 26 | +#include 27 | 28 | #include "core.h" 29 | 30 | @@ -3480,6 +3481,15 @@ static const struct of_device_id spi_nor_of_table[] = { 31 | }; 32 | MODULE_DEVICE_TABLE(of, spi_nor_of_table); 33 | 34 | +#ifdef CONFIG_ACPI 35 | +static const struct acpi_device_id spi_nor_acpi_table[] = { 36 | + { "JEDEC,SPI-NOR", 0 }, 37 | + { "ACPI0000", 0 }, 38 | + {} 39 | +}; 40 | +MODULE_DEVICE_TABLE(acpi, spi_nor_acpi_table); 41 | +#endif 42 | + 43 | /* 44 | * REVISIT: many of these chips have deep power-down modes, which 45 | * should clearly be entered on suspend() to minimize power use. 46 | @@ -3490,6 +3500,7 @@ static struct spi_mem_driver spi_nor_driver = { 47 | .name = "spi-nor", 48 | .of_match_table = spi_nor_of_table, 49 | .dev_groups = spi_nor_sysfs_groups, 50 | + .acpi_match_table = ACPI_PTR(spi_nor_acpi_table), 51 | }, 52 | .id_table = spi_nor_dev_ids, 53 | }, 54 | -- 55 | 2.26.2.dirty 56 | 57 | -------------------------------------------------------------------------------- /patches-sonic/cisco-hwmon-pmbus_core-pec-support-check.patch: -------------------------------------------------------------------------------- 1 | From 8451736f488d2e24da57a6d6d8a3880bd023812b Mon Sep 17 00:00:00 2001 2 | From: Madhava Reddy Siddareddygari 3 | Date: Tue, 9 Nov 2021 10:54:31 -0800 4 | Subject: [PATCH] hwmon: (pmbus_core) Check adapter PEC support 5 | 6 | Currently, for Packet Error Checking (PEC) only the controller 7 | is checked for support. This causes problems on the cisco-8000 8 | platform where a SMBUS transaction errors are observed. This is 9 | because PEC has to be enabled only if both controller and 10 | adapter supports it. 11 | 12 | Added code to check PEC capability for adapter and enable it 13 | only if both controller and adapter supports PEC. 14 | 15 | This patch was applied to Linux 5.14 in commit 16 | 4e5418f787ec56d7fe3c6efee486b8f508c58baf 17 | (hwmon: (pmbus_core) Check adapter PEC support). 18 | 19 | Signed-off-by: Madhava Reddy Siddareddygari 20 | --- 21 | drivers/hwmon/pmbus/pmbus_core.c | 10 ++++++---- 22 | 1 file changed, 6 insertions(+), 4 deletions(-) 23 | 24 | diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c 25 | index 192442b3b..634615324 100644 26 | --- a/drivers/hwmon/pmbus/pmbus_core.c 27 | +++ b/drivers/hwmon/pmbus/pmbus_core.c 28 | @@ -2203,10 +2203,12 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data, 29 | data->has_status_word = true; 30 | } 31 | 32 | - /* Enable PEC if the controller supports it */ 33 | - ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); 34 | - if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) 35 | - client->flags |= I2C_CLIENT_PEC; 36 | + /* Enable PEC if the controller and bus support it */ 37 | + if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_PEC)) { 38 | + ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); 39 | + if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) 40 | + client->flags |= I2C_CLIENT_PEC; 41 | + } 42 | 43 | /* 44 | * Check if the chip is write protected. If it is, we can not clear 45 | -- 46 | 2.25.1 47 | 48 | -------------------------------------------------------------------------------- /patches-sonic/driver-net-tg3-add-param-short-preamble-and-reset.patch: -------------------------------------------------------------------------------- 1 | Subject: [PATCH] Add 2 more parameter for tg3.c. 2 | 3 | From: Roy Lee 4 | 5 | 1. short_preamble: Enable mdio traffic to external PHYs(i.g. BCM54616). 6 | 2. bcm5718s_reset: Enable BCM5718S reset support. 7 | 8 | Signed-off-by: roy_lee 9 | --- 10 | drivers/net/ethernet/broadcom/tg3.c | 18 ++++++++++++++++++ 11 | 1 file changed, 18 insertions(+) 12 | 13 | diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c 14 | index 1d985ebf1..af09bad75 100644 15 | --- a/drivers/net/ethernet/broadcom/tg3.c 16 | +++ b/drivers/net/ethernet/broadcom/tg3.c 17 | @@ -231,6 +231,14 @@ static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */ 18 | module_param(tg3_debug, int, 0); 19 | MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value"); 20 | 21 | +static int short_preamble = 0; 22 | +module_param(short_preamble, int, 0); 23 | +MODULE_PARM_DESC(short_preamble, "Enable short preamble."); 24 | + 25 | +static int bcm5718s_reset = 0; 26 | +module_param(bcm5718s_reset, int, 0); 27 | +MODULE_PARM_DESC(bcm5718s_reset, "Enable BCM5718S reset support."); 28 | + 29 | #define TG3_DRV_DATA_FLAG_10_100_ONLY 0x0001 30 | #define TG3_DRV_DATA_FLAG_5705_10_100 0x0002 31 | 32 | @@ -1508,6 +1516,11 @@ static void tg3_mdio_config_5785(struct tg3 *tp) 33 | static void tg3_mdio_start(struct tg3 *tp) 34 | { 35 | tp->mi_mode &= ~MAC_MI_MODE_AUTO_POLL; 36 | + 37 | + if(short_preamble) { 38 | + tp->mi_mode |= MAC_MI_MODE_SHORT_PREAMBLE; 39 | + } 40 | + 41 | tw32_f(MAC_MI_MODE, tp->mi_mode); 42 | udelay(80); 43 | 44 | @@ -2707,6 +2720,11 @@ static int tg3_phy_reset(struct tg3 *tp) 45 | } 46 | } 47 | 48 | + if (bcm5718s_reset && tp->phy_id == TG3_PHY_ID_BCM5718S) { 49 | + __tg3_writephy(tp, 0x8, 0x10, 0x1d0); /* set internal phy 0x8 to make linkup */ 50 | + __tg3_writephy(tp, 0x1f, 0x4, 0x5e1); /* enable 10/100 cability of external phy */ 51 | + } 52 | + 53 | if (tg3_flag(tp, 5717_PLUS) && 54 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) 55 | return 0; 56 | -------------------------------------------------------------------------------- /patches-sonic/0001-mlxbf-bootctl-Constify-struct-bin_attribute.patch: -------------------------------------------------------------------------------- 1 | From cad481488093e440217f6a93e45fe4fa03a77000 Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= 3 | Date: Sun, 15 Dec 2024 14:25:40 +0100 4 | Subject: [PATCH 01/78] mlxbf-bootctl: Constify 'struct bin_attribute' 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | The sysfs core now allows instances of 'struct bin_attribute' to be 10 | moved into read-only memory. Make use of that to protect them against 11 | accidental or malicious modifications. 12 | 13 | Signed-off-by: Thomas Weißschuh 14 | Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-mellanox-v1-1-b6fe4f68e2ca@weissschuh.net 15 | Reviewed-by: Ilpo Järvinen 16 | Signed-off-by: Ilpo Järvinen 17 | --- 18 | drivers/platform/mellanox/mlxbf-bootctl.c | 6 +++--- 19 | 1 file changed, 3 insertions(+), 3 deletions(-) 20 | 21 | diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c 22 | index dd5f370..7e246dd 100644 23 | --- a/drivers/platform/mellanox/mlxbf-bootctl.c 24 | +++ b/drivers/platform/mellanox/mlxbf-bootctl.c 25 | @@ -939,7 +939,7 @@ MODULE_DEVICE_TABLE(acpi, mlxbf_bootctl_acpi_ids); 26 | 27 | static ssize_t mlxbf_bootctl_bootfifo_read(struct file *filp, 28 | struct kobject *kobj, 29 | - struct bin_attribute *bin_attr, 30 | + const struct bin_attribute *bin_attr, 31 | char *buf, loff_t pos, 32 | size_t count) 33 | { 34 | @@ -971,9 +971,9 @@ static ssize_t mlxbf_bootctl_bootfifo_read(struct file *filp, 35 | return p - buf; 36 | } 37 | 38 | -static struct bin_attribute mlxbf_bootctl_bootfifo_sysfs_attr = { 39 | +static const struct bin_attribute mlxbf_bootctl_bootfifo_sysfs_attr = { 40 | .attr = { .name = "bootfifo", .mode = 0400 }, 41 | - .read = mlxbf_bootctl_bootfifo_read, 42 | + .read_new = mlxbf_bootctl_bootfifo_read, 43 | }; 44 | 45 | static bool mlxbf_bootctl_guid_match(const guid_t *guid, 46 | -- 47 | 2.8.4 48 | 49 | -------------------------------------------------------------------------------- /patches-sonic/0019-irqchip-mvebu-gicp-Clear-pending-interrupts-on-init.patch: -------------------------------------------------------------------------------- 1 | From e7ca85e98fd395437c2633d8ccbf93ee20db93ca Mon Sep 17 00:00:00 2001 2 | From: Elad Nachman 3 | Date: Sun, 3 Aug 2025 13:25:48 +0300 4 | Subject: [PATCH 2/2] irqchip/mvebu-gicp: Clear pending interrupts on init 5 | 6 | When a kexec'ed kernel boots up, there might be stale unhandled interrupts 7 | pending in the interrupt controller. These are delivered as spurious 8 | interrupts once the boot CPU enables interrupts. 9 | 10 | Clear all pending interrupts when the driver is initialized to prevent 11 | these spurious interrupts from locking the CPU in an endless loop. 12 | 13 | Signed-off-by: Elad Nachman 14 | Signed-off-by: Thomas Gleixner 15 | Link: https://lore.kernel.org/all/20250803102548.669682-2-enachman@marvell.com 16 | Signed-off-by: Yan Markman 17 | --- 18 | drivers/irqchip/irq-mvebu-gicp.c | 10 ++++++++++ 19 | 1 file changed, 10 insertions(+) 20 | 21 | diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-gicp.c 22 | index 2b6183919..a582b6a2f 100644 23 | --- a/drivers/irqchip/irq-mvebu-gicp.c 24 | +++ b/drivers/irqchip/irq-mvebu-gicp.c 25 | @@ -173,6 +173,7 @@ static int mvebu_gicp_probe(struct platform_device *pdev) 26 | struct device_node *node = pdev->dev.of_node; 27 | struct device_node *irq_parent_dn; 28 | struct mvebu_gicp *gicp; 29 | + void __iomem *base; 30 | int ret, i; 31 | 32 | gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL); 33 | @@ -229,6 +230,15 @@ static int mvebu_gicp_probe(struct platform_device *pdev) 34 | return -ENODEV; 35 | } 36 | 37 | + base = ioremap(gicp->res->start, gicp->res->end - gicp->res->start); 38 | + if (IS_ERR(base)) { 39 | + dev_err(&pdev->dev, "ioremap() failed. Unable to clear pending interrupts.\n"); 40 | + } else { 41 | + for (i = 0; i < 64; i++) 42 | + writel(i, base + GICP_CLRSPI_NSR_OFFSET); 43 | + iounmap(base); 44 | + } 45 | + 46 | inner_domain = irq_domain_create_hierarchy(parent_domain, 0, 47 | gicp->spi_cnt, 48 | of_node_to_fwnode(node), 49 | -- 50 | 2.34.1 51 | 52 | -------------------------------------------------------------------------------- /patches-sonic/0201-i2c-mlxbf-incorrect-base-address-passed-during-io-wr.patch: -------------------------------------------------------------------------------- 1 | From e38eed5cc30d8025b3990273c965c3142fc4733a Mon Sep 17 00:00:00 2001 2 | From: Asmaa Mnebhi 3 | Date: Thu, 8 Sep 2022 13:35:38 -0400 4 | Subject: [PATCH backport 5.10 02/63] i2c: mlxbf: incorrect base address passed 5 | during io write 6 | 7 | BugLink: https://bugs.launchpad.net/bugs/1991551 8 | 9 | Correct the base address used during io write. 10 | This bug had no impact over the overall functionality of the read and write 11 | transactions. MLXBF_I2C_CAUSE_OR_CLEAR=0x18 so writing to (smbus->io + 0x18) 12 | instead of (mst_cause->ioi + 0x18) actually writes to the sc_low_timeout 13 | register which just sets the timeout value before a read/write aborts. 14 | 15 | Fixes: b5b5b32081cd206b (i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC) 16 | Reviewed-by: Khalil Blaiech 17 | Signed-off-by: Asmaa Mnebhi 18 | Signed-off-by: Wolfram Sang 19 | (cherry picked from commit 2a5be6d1340c0fefcee8a6489cff7fd88a0d5b85) 20 | Signed-off-by: Asmaa Mnebhi 21 | Acked-by: Tim Gardner 22 | Acked-by: Bartlomiej Zolnierkiewicz 23 | Signed-off-by: Bartlomiej Zolnierkiewicz 24 | --- 25 | drivers/i2c/busses/i2c-mlxbf.c | 2 +- 26 | 1 file changed, 1 insertion(+), 1 deletion(-) 27 | 28 | diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c 29 | index ab261d762..042c83b90 100644 30 | --- a/drivers/i2c/busses/i2c-mlxbf.c 31 | +++ b/drivers/i2c/busses/i2c-mlxbf.c 32 | @@ -675,7 +675,7 @@ static int mlxbf_i2c_smbus_enable(struct mlxbf_i2c_priv *priv, u8 slave, 33 | /* Clear status bits. */ 34 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_STATUS); 35 | /* Set the cause data. */ 36 | - writel(~0x0, priv->smbus->io + MLXBF_I2C_CAUSE_OR_CLEAR); 37 | + writel(~0x0, priv->mst_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR); 38 | /* Zero PEC byte. */ 39 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_PEC); 40 | /* Zero byte count. */ 41 | -- 42 | 2.20.1 43 | 44 | -------------------------------------------------------------------------------- /patches-sonic/driver-net-tg3-change-dma-mask-for-57766.patch: -------------------------------------------------------------------------------- 1 | From 821f6d79ad2773e0ff1537c0bb3c7af93a694709 Mon Sep 17 00:00:00 2001 2 | From: Boyang Yu 3 | Date: Fri, 9 Aug 2024 17:03:51 +0000 4 | Subject: [PATCH] tg3: fix broadcom NIC 57766 staying down issue 5 | 6 | Set consistent dma mask to 31 in the tg3 driver for broadcom NIC 7 | ASIC_REV_57766. Before the change, when a previous DMA end with 8 | lower 16 bits 0xffff, and a new dma starts with upper bits 0xffff, 9 | the hardware seems to think we're at address 0xffffffff and triggers 10 | an overflow. The change asks the kernel to only address 31 bits for 11 | coherent allocations. This will ensure that upper bits are at most 12 | 0x7fff thus avoiding the bug. 13 | 14 | Signed-off-by: Boyang Yu 15 | --- 16 | drivers/net/ethernet/broadcom/tg3.c | 12 +++++++++++- 17 | 1 file changed, 11 insertions(+), 1 deletion(-) 18 | 19 | diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c 20 | index 6a1179935..b1bb1dc55 100644 21 | --- a/drivers/net/ethernet/broadcom/tg3.c 22 | +++ b/drivers/net/ethernet/broadcom/tg3.c 23 | @@ -17794,7 +17794,7 @@ static int tg3_init_one(struct pci_dev *pdev, 24 | * On 64-bit systems without IOMMU, use 64-bit dma_mask and 25 | * do DMA address check in __tg3_start_xmit(). 26 | */ 27 | - if (tg3_flag(tp, 4G_DMA_ONLY)) 28 | + if (tg3_flag(tp, 4G_DMA_ONLY) || (tg3_asic_rev(tp) == ASIC_REV_57766)) 29 | persist_dma_mask = dma_mask = DMA_BIT_MASK(32); 30 | else if (tg3_flag(tp, 40BIT_DMA_BUG)) { 31 | persist_dma_mask = dma_mask = DMA_BIT_MASK(40); 32 | @@ -17825,6 +17825,16 @@ static int tg3_init_one(struct pci_dev *pdev, 33 | "No usable DMA configuration, aborting\n"); 34 | goto err_out_apeunmap; 35 | } 36 | + 37 | + if (tg3_asic_rev(tp) == ASIC_REV_57766) { 38 | + err = dma_set_coherent_mask(&pdev->dev, 39 | + DMA_BIT_MASK(31)); 40 | + if (err < 0) { 41 | + dev_err(&pdev->dev, 42 | + "Unable to obtain 31 bit DMA for consistent allocations\n"); 43 | + goto err_out_apeunmap; 44 | + } 45 | + } 46 | } 47 | 48 | tg3_init_bufmgr_config(tp); 49 | -- 50 | 2.41.0 51 | 52 | -------------------------------------------------------------------------------- /patches-sonic/0004-arm64-traps-Call-platform-handler-for-do_serror.patch: -------------------------------------------------------------------------------- 1 | From 7915f3d766f58398382e8615e987bf45f47db4f8 Mon Sep 17 00:00:00 2001 2 | From: Shantanu Shrivastava 3 | Date: Tue, 24 Oct 2023 08:48:56 +0000 4 | Subject: [PATCH] arm64/traps: Call platform handler for do_serror 5 | 6 | When taking a bad_mode exception, give platform code an opportunity 7 | to decide whether the error the event can be ignored or not. 8 | 9 | Signed-off-by: David Clear 10 | Signed-off-by: Shantanu Shrivastava 11 | --- 12 | arch/arm64/include/asm/traps.h | 1 + 13 | arch/arm64/kernel/traps.c | 9 +++++++++ 14 | 2 files changed, 10 insertions(+) 15 | 16 | diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h 17 | index 6e5826470..bf9f99994 100644 18 | --- a/arch/arm64/include/asm/traps.h 19 | +++ b/arch/arm64/include/asm/traps.h 20 | @@ -29,6 +29,7 @@ void arm64_notify_segfault(unsigned long addr); 21 | void arm64_force_sig_fault(int signo, int code, unsigned long far, const char *str); 22 | void arm64_force_sig_mceerr(int code, unsigned long far, short lsb, const char *str); 23 | void arm64_force_sig_ptrace_errno_trap(int errno, unsigned long far, const char *str); 24 | +int platform_serror(struct pt_regs *regs, unsigned int esr); 25 | 26 | /* 27 | * Move regs->pc to next instruction and do necessary setup before it 28 | diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c 29 | index 23d281ed7..6dac34ab3 100644 30 | --- a/arch/arm64/kernel/traps.c 31 | +++ b/arch/arm64/kernel/traps.c 32 | @@ -956,8 +956,17 @@ bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned long esr) 33 | } 34 | } 35 | 36 | +int __weak platform_serror(struct pt_regs *regs, unsigned int esr) 37 | +{ 38 | + return 0; 39 | +} 40 | + 41 | void do_serror(struct pt_regs *regs, unsigned long esr) 42 | { 43 | + /* give the platform a chance to ignore the event */ 44 | + if (platform_serror(regs, esr)) 45 | + return; 46 | + 47 | /* non-RAS errors are not containable */ 48 | if (!arm64_is_ras_serror(esr) || arm64_is_fatal_ras_serror(regs, esr)) 49 | arm64_serror_panic(regs, esr); 50 | -- 51 | 2.39.2 52 | 53 | -------------------------------------------------------------------------------- /patches-sonic/8013-hwmon-pmbus-mp2975-Clear-interrupts-at-probe.patch: -------------------------------------------------------------------------------- 1 | From ac4dfa5e6a8186732ad1fe31ad70052e44222c9f Mon Sep 17 00:00:00 2001 2 | From: Ciju Rajan K 3 | Date: Tue, 9 Sep 2025 08:48:47 +0300 4 | Subject: hwmon: pmbus: mp2975: Clear interrupts at probe 5 | 6 | This patch clears the the registers 0xfd & 0x03 7 | in both the pages to clear any of the stale interrupts. 8 | 9 | NVBug: #5360318 10 | 11 | Signed-off-by: Ciju Rajan K 12 | --- 13 | drivers/hwmon/pmbus/mp2975.c | 28 ++++++++++++++++++++++++++++ 14 | 1 file changed, 28 insertions(+) 15 | 16 | diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c 17 | index 280bb12f762c..fbaee50c7129 100644 18 | --- a/drivers/hwmon/pmbus/mp2975.c 19 | +++ b/drivers/hwmon/pmbus/mp2975.c 20 | @@ -38,6 +38,7 @@ 21 | #define MP2975_MFR_UVP_SET 0xe6 22 | 23 | #define MP2973_MFR_RESO_SET 0xc7 24 | +#define MP2975_CLEAR_CAT_FAULTS 0xfd 25 | 26 | #define MP2975_VOUT_FORMAT BIT(15) 27 | #define MP2975_VID_STEP_SEL_R1 BIT(4) 28 | @@ -939,6 +940,28 @@ mp2975_vout_per_rail_config_get(struct i2c_client *client, 29 | return 0; 30 | } 31 | 32 | +static int 33 | +mp2975_clear_interrupts(struct i2c_client *client, 34 | + struct mp2975_data *data) 35 | +{ 36 | + int i = 0; 37 | + int ret = 0; 38 | + 39 | + for (i = 0; i < data->info.pages; i++) { 40 | + ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, i); 41 | + if (ret < 0) 42 | + return ret; 43 | + ret = i2c_smbus_write_byte_data(client, PMBUS_CLEAR_FAULTS, 0); 44 | + if (ret < 0) 45 | + return ret; 46 | + ret = i2c_smbus_write_byte_data(client, MP2975_CLEAR_CAT_FAULTS, 0); 47 | + if (ret < 0) 48 | + return ret; 49 | + } 50 | + 51 | + return ret; 52 | +} 53 | + 54 | static const struct pmbus_driver_info mp2975_info = { 55 | .pages = 1, 56 | .format[PSC_VOLTAGE_IN] = linear, 57 | @@ -1068,6 +1091,11 @@ static int mp2975_probe(struct i2c_client *client) 58 | if (ret) 59 | return ret; 60 | 61 | + /* Clear interrupts. */ 62 | + ret = mp2975_clear_interrupts(client, data); 63 | + if (ret) 64 | + return ret; 65 | + 66 | return pmbus_do_probe(client, info); 67 | } 68 | 69 | -- 70 | 2.47.2 71 | -------------------------------------------------------------------------------- /patches-sonic/0008-mlxbf-bootctl-use-sysfs_emit_at-in-secure_boot_fuse_.patch: -------------------------------------------------------------------------------- 1 | From 23b2eeacd3bfb7365002f623cbce2fadda8175ac Mon Sep 17 00:00:00 2001 2 | From: David Thompson 3 | Date: Mon, 7 Apr 2025 13:25:58 +0000 4 | Subject: [PATCH 08/78] mlxbf-bootctl: use sysfs_emit_at() in 5 | secure_boot_fuse_state_show() 6 | MIME-Version: 1.0 7 | Content-Type: text/plain; charset=UTF-8 8 | Content-Transfer-Encoding: 8bit 9 | 10 | A warning is seen when running the latest kernel on a BlueField SOC: 11 | [251.512704] ------------[ cut here ]------------ 12 | [251.512711] invalid sysfs_emit: buf:0000000003aa32ae 13 | [251.512720] WARNING: CPU: 1 PID: 705264 at fs/sysfs/file.c:767 sysfs_emit+0xac/0xc8 14 | 15 | The warning is triggered because the mlxbf-bootctl driver invokes 16 | "sysfs_emit()" with a buffer pointer that is not aligned to the 17 | start of the page. The driver should instead use "sysfs_emit_at()" 18 | to support non-zero offsets into the destination buffer. 19 | 20 | Fixes: 9886f575de5a ("platform/mellanox: mlxbf-bootctl: use sysfs_emit() instead of sprintf()") 21 | Signed-off-by: David Thompson 22 | Link: https://lore.kernel.org/r/20250407132558.2418719-1-davthompson@nvidia.com 23 | Reviewed-by: Ilpo Järvinen 24 | Signed-off-by: Ilpo Järvinen 25 | --- 26 | drivers/platform/mellanox/mlxbf-bootctl.c | 4 ++-- 27 | 1 file changed, 2 insertions(+), 2 deletions(-) 28 | 29 | diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c 30 | index 25ffae1..fd7fb42 100644 31 | --- a/drivers/platform/mellanox/mlxbf-bootctl.c 32 | +++ b/drivers/platform/mellanox/mlxbf-bootctl.c 33 | @@ -333,9 +333,9 @@ static ssize_t secure_boot_fuse_state_show(struct device *dev, 34 | else 35 | status = valid ? "Invalid" : "Free"; 36 | } 37 | - buf_len += sysfs_emit(buf + buf_len, "%d:%s ", key, status); 38 | + buf_len += sysfs_emit_at(buf, buf_len, "%d:%s ", key, status); 39 | } 40 | - buf_len += sysfs_emit(buf + buf_len, "\n"); 41 | + buf_len += sysfs_emit_at(buf, buf_len, "\n"); 42 | 43 | return buf_len; 44 | } 45 | -- 46 | 2.8.4 47 | 48 | -------------------------------------------------------------------------------- /patches-sonic/driver-i2c-bus-intel-ismt-add-delay-param.patch: -------------------------------------------------------------------------------- 1 | Add 'delay' module param to the driver. 2 | 3 | From: Cumulus Networks 4 | 5 | This is needed on S6000 for safe PMBUS access. 6 | Without setting the 'delay', the ismt driver throws 'completion wait 7 | timed out' error message. 8 | --- 9 | drivers/i2c/busses/i2c-ismt.c | 13 ++++++++++--- 10 | 1 file changed, 10 insertions(+), 3 deletions(-) 11 | 12 | diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c 13 | index a35a27c32..b89fbb60d 100644 14 | --- a/drivers/i2c/busses/i2c-ismt.c 15 | +++ b/drivers/i2c/busses/i2c-ismt.c 16 | @@ -66,6 +66,7 @@ 17 | #include 18 | #include 19 | #include 20 | +#include 21 | 22 | #include 23 | 24 | @@ -190,9 +191,12 @@ static const struct pci_device_id ismt_ids[] = { 25 | MODULE_DEVICE_TABLE(pci, ismt_ids); 26 | 27 | /* Bus speed control bits for slow debuggers - refer to the docs for usage */ 28 | -static unsigned int bus_speed; 29 | +static unsigned int bus_speed = 100; 30 | +static unsigned int delay = 1000; 31 | module_param(bus_speed, uint, S_IRUGO); 32 | -MODULE_PARM_DESC(bus_speed, "Bus Speed in kHz (0 = BIOS default)"); 33 | +MODULE_PARM_DESC(bus_speed, "Bus Speed in kHz (1000 by default)"); 34 | +module_param(delay, uint, S_IRUGO); 35 | +MODULE_PARM_DESC(delay, "Delay in microsecs before access (1000 by default)"); 36 | 37 | /** 38 | * __ismt_desc_dump() - dump the contents of a specific descriptor 39 | @@ -400,6 +404,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, 40 | struct device *dev = &priv->pci_dev->dev; 41 | u8 *dma_buffer = PTR_ALIGN(&priv->buffer[0], 16); 42 | 43 | + if (delay > 0) 44 | + udelay(delay); 45 | + 46 | desc = &priv->hw[priv->head]; 47 | 48 | /* Initialize the DMA buffer */ 49 | @@ -759,7 +766,7 @@ static void ismt_hw_init(struct ismt_priv *priv) 50 | bus_speed = 1000; 51 | break; 52 | } 53 | - dev_dbg(dev, "SMBus clock is running at %d kHz\n", bus_speed); 54 | + dev_info(dev, "SMBus clock is running at %d kHz with delay %d us\n", bus_speed, delay); 55 | } 56 | 57 | /** 58 | -------------------------------------------------------------------------------- /patches-sonic/0045-platform-mellanox-mlxreg-hotplug-Add-handling-of-non.patch: -------------------------------------------------------------------------------- 1 | From b33a8c29d95f0b998f326de0c651e0262cd603cd Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Fri, 6 Sep 2024 14:10:30 +0300 4 | Subject: [PATCH 45/78] platform/mellanox: mlxreg-hotplug: Add handling of 5 | non-sticky signals 6 | 7 | Add support for non-sticky signals. For such signal status bit is 8 | non-sticky and changes to the previous value after acknowledging. 9 | 10 | Detection of non-sticky signals is to be performed through the reading 11 | event register, while sticky signals are detected through the reading 12 | status register. 13 | 14 | Signed-off-by: Vadim Pasternak 15 | Reviewed-by: Felix Radensky 16 | --- 17 | drivers/platform/mellanox/mlxreg-hotplug.c | 29 +++++++++++++++++++++-------- 18 | 1 file changed, 21 insertions(+), 8 deletions(-) 19 | 20 | diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c 21 | index 2b52610..a395969e 100644 22 | --- a/drivers/platform/mellanox/mlxreg-hotplug.c 23 | +++ b/drivers/platform/mellanox/mlxreg-hotplug.c 24 | @@ -379,15 +379,28 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv, 25 | if (ret) 26 | goto out; 27 | 28 | - /* Read status. */ 29 | - ret = regmap_read(priv->regmap, item->reg, ®val); 30 | - if (ret) 31 | - goto out; 32 | + if (item->non_sticky) { 33 | + /* Read event. */ 34 | + ret = regmap_read(priv->regmap, item->reg + 35 | + MLXREG_HOTPLUG_EVENT_OFF, ®val); 36 | + if (ret) 37 | + goto out; 38 | + 39 | + /* Set asserted bits. */ 40 | + regval &= item->mask; 41 | + asserted = regval; 42 | + } else { 43 | + /* Read status. */ 44 | + ret = regmap_read(priv->regmap, item->reg, ®val); 45 | + if (ret) 46 | + goto out; 47 | + 48 | + /* Set asserted bits and save last status. */ 49 | + regval &= item->mask; 50 | + asserted = item->cache ^ regval; 51 | + item->cache = regval; 52 | + } 53 | 54 | - /* Set asserted bits and save last status. */ 55 | - regval &= item->mask; 56 | - asserted = item->cache ^ regval; 57 | - item->cache = regval; 58 | for_each_set_bit(bit, &asserted, 8) { 59 | int pos; 60 | 61 | -- 62 | 2.8.4 63 | 64 | -------------------------------------------------------------------------------- /patches-sonic/0036-platform-mellanox-mlxreg-dpu-Fix-smatch-warnings.patch: -------------------------------------------------------------------------------- 1 | From e905a420ecf5b9e2fc526ad6c20150c5c0219c14 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Thu, 8 May 2025 23:31:39 +0300 4 | Subject: [PATCH 36/78] platform/mellanox: mlxreg-dpu: Fix smatch warnings 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Add missed call to release adapter. 10 | Remove wrong error pointer conversion. 11 | 12 | Fixes: 3e75f2954116 ("platform/mellanox: mlxreg-dpu: Add initial support for Nvidia DPU") 13 | Signed-off-by: Vadim Pasternak 14 | Link: https://lore.kernel.org/r/20250508203139.55171-1-vadimp@nvidia.com 15 | Reviewed-by: Ilpo Järvinen 16 | Signed-off-by: Ilpo Järvinen 17 | --- 18 | drivers/platform/mellanox/mlxreg-dpu.c | 8 +++++--- 19 | 1 file changed, 5 insertions(+), 3 deletions(-) 20 | 21 | diff --git a/drivers/platform/mellanox/mlxreg-dpu.c b/drivers/platform/mellanox/mlxreg-dpu.c 22 | index 277e4b8..5226010 100644 23 | --- a/drivers/platform/mellanox/mlxreg-dpu.c 24 | +++ b/drivers/platform/mellanox/mlxreg-dpu.c 25 | @@ -535,8 +535,10 @@ static int mlxreg_dpu_probe(struct platform_device *pdev) 26 | return -EPROBE_DEFER; 27 | 28 | mlxreg_dpu = devm_kzalloc(&pdev->dev, sizeof(*mlxreg_dpu), GFP_KERNEL); 29 | - if (!mlxreg_dpu) 30 | - return -ENOMEM; 31 | + if (!mlxreg_dpu) { 32 | + err = -ENOMEM; 33 | + goto alloc_fail; 34 | + } 35 | 36 | /* Create device at the top of DPU I2C tree. */ 37 | data->hpdev.client = i2c_new_client_device(data->hpdev.adapter, 38 | @@ -562,7 +564,6 @@ static int mlxreg_dpu_probe(struct platform_device *pdev) 39 | if (err) { 40 | dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n", 41 | data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); 42 | - err = PTR_ERR(regmap); 43 | goto regcache_sync_fail; 44 | } 45 | 46 | @@ -581,6 +582,7 @@ static int mlxreg_dpu_probe(struct platform_device *pdev) 47 | devm_regmap_init_i2c_fail: 48 | i2c_unregister_device(data->hpdev.client); 49 | i2c_new_device_fail: 50 | +alloc_fail: 51 | i2c_put_adapter(data->hpdev.adapter); 52 | return err; 53 | } 54 | -- 55 | 2.8.4 56 | 57 | -------------------------------------------------------------------------------- /patches-sonic/0000-Add-support-for-the-TI-TPS53659.patch: -------------------------------------------------------------------------------- 1 | From 770f3b2e6f2fca2267994f4a74b921b59d9cb9a8 Mon Sep 17 00:00:00 2001 2 | From: Shantanu Shrivastava 3 | Date: Tue, 24 Oct 2023 08:25:24 +0000 4 | Subject: [PATCH] Add support for the TI TPS53659 5 | 6 | This patch adds support for the Texas Instruments TPS53659. 7 | 8 | Datasheet: https://www.ti.com/lit/gpn/tps53659 9 | 10 | Signed-off-by: David Clear 11 | Signed-off-by: Shantanu Shrivastava 12 | --- 13 | drivers/hwmon/pmbus/tps53679.c | 9 ++++++++- 14 | 1 file changed, 8 insertions(+), 1 deletion(-) 15 | 16 | diff --git a/drivers/hwmon/pmbus/tps53679.c b/drivers/hwmon/pmbus/tps53679.c 17 | index 81b9d8136..df05e7498 100644 18 | --- a/drivers/hwmon/pmbus/tps53679.c 19 | +++ b/drivers/hwmon/pmbus/tps53679.c 20 | @@ -16,7 +16,7 @@ 21 | #include "pmbus.h" 22 | 23 | enum chips { 24 | - tps53647, tps53667, tps53676, tps53679, tps53681, tps53688 25 | + tps53647, tps53659, tps53667, tps53676, tps53679, tps53681, tps53688 26 | }; 27 | 28 | #define TPS53647_PAGE_NUM 1 29 | @@ -252,6 +252,11 @@ static int tps53679_probe(struct i2c_client *client) 30 | case tps53676: 31 | info->identify = tps53676_identify; 32 | break; 33 | + case tps53659: 34 | + info->pages = TPS53679_PAGE_NUM; 35 | + info->identify = tps53679_identify; 36 | + info->func[0] |= PMBUS_HAVE_PIN; 37 | + break; 38 | case tps53679: 39 | case tps53688: 40 | info->pages = TPS53679_PAGE_NUM; 41 | @@ -274,6 +279,7 @@ static const struct i2c_device_id tps53679_id[] = { 42 | {"bmr474", tps53676}, 43 | {"tps53647", tps53647}, 44 | {"tps53667", tps53667}, 45 | + {"tps53659", tps53659}, 46 | {"tps53676", tps53676}, 47 | {"tps53679", tps53679}, 48 | {"tps53681", tps53681}, 49 | @@ -286,6 +292,7 @@ MODULE_DEVICE_TABLE(i2c, tps53679_id); 50 | static const struct of_device_id __maybe_unused tps53679_of_match[] = { 51 | {.compatible = "ti,tps53647", .data = (void *)tps53647}, 52 | {.compatible = "ti,tps53667", .data = (void *)tps53667}, 53 | + {.compatible = "ti,tps53659", .data = (void *)tps53659}, 54 | {.compatible = "ti,tps53676", .data = (void *)tps53676}, 55 | {.compatible = "ti,tps53679", .data = (void *)tps53679}, 56 | {.compatible = "ti,tps53681", .data = (void *)tps53681}, 57 | -- 58 | 2.39.2 59 | 60 | -------------------------------------------------------------------------------- /patches-sonic/8008-hwmon-mlxsw-Downstream-Allow-fan-speed-setting-granu.patch: -------------------------------------------------------------------------------- 1 | From 4b90028daea354041ff3e9d63752019f30f69760 Mon Sep 17 00:00:00 2001 2 | From: Oleksandr Shamray 3 | Date: Wed, 8 Nov 2023 14:52:38 +0200 4 | Subject: [PATCH 64/78] hwmon: (mlxsw): Downstream: Allow fan speed setting 5 | granularity of 1 PWM 6 | 7 | Currently PWM setting is allowed with 10 percent stepping. 8 | Such configuration is aligned with thermal drivers, which are used to be 9 | bound to "mlxsw" driver. 10 | 11 | This binding happens when the cooling instances created by the driver are 12 | bound to some kernel thermal driver. 13 | 14 | In case system is not using kernel thermal control and the cooling 15 | instances created by the driver are not bound to any thermal driver, the 16 | driver still does not allow setting of PWM granularity less than 10 17 | percent. 18 | 19 | Allow setting fan with one percent granularity, thus any user space 20 | thermal application will be able to set PWM to any allowed value in range 21 | from 51 PWM to 255 PWM. 22 | 23 | Note: this is downstream patch, since it can affect functionality for 24 | the Nvidia users running kernel thermal control. So, it is not going to be 25 | submitted to up-stream. 26 | 27 | Signed-off-by: Oleksandr Shamray 28 | --- 29 | drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 5 +++++ 30 | 1 file changed, 5 insertions(+) 31 | 32 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c 33 | index e746cd9..e19f36f2e 100644 34 | --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c 35 | +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c 36 | @@ -24,8 +24,13 @@ 37 | #define MLXSW_THERMAL_MODULE_TEMP_HOT 80000 /* 80C */ 38 | #define MLXSW_THERMAL_HYSTERESIS_TEMP 5000 /* 5C */ 39 | #define MLXSW_THERMAL_MODULE_TEMP_SHIFT (MLXSW_THERMAL_HYSTERESIS_TEMP * 2) 40 | +#ifdef CONFIG_MLXSW_CORE_THERMAL 41 | #define MLXSW_THERMAL_MAX_STATE 10 42 | #define MLXSW_THERMAL_MIN_STATE 2 43 | +#else 44 | +#define MLXSW_THERMAL_MAX_STATE 255 45 | +#define MLXSW_THERMAL_MIN_STATE 51 /* 20 percent */ 46 | +#endif 47 | #define MLXSW_THERMAL_MAX_DUTY 255 48 | 49 | /* External cooling devices, allowed for binding to mlxsw thermal zones. */ 50 | -- 51 | 2.8.4 52 | 53 | -------------------------------------------------------------------------------- /patches-sonic/driver-arista-i2c-designware-shutdown.patch: -------------------------------------------------------------------------------- 1 | From: Justin Oliver 2 | Date: 2022-12-12 17:42:20 +0000 3 | Subject: [PATCH] i2c: designware: Fix device probe failure after kexec 4 | 5 | The Designware I2C driver sometimes fails to probe the I2C controller after 6 | we boot into another kernel with kexec. Kexec will call the `shutdown` 7 | method of each platform driver before booting the new kernel so this patch 8 | defines a `shutdown` procedure for the Designware I2C platform driver. This 9 | will gracefully bring down the I2C controller, allowing the driver to 10 | successfully initialize the device with the new kernel. 11 | 12 | This patch addresses the following error after kexec: 13 | i2c_designware AMDI0010:00: Unknown Synopsys component type: 0xffffffff 14 | 15 | Signed-off-by: Justin Oliver 16 | Signed-off-by: Karan Jagjitkumar 17 | --- 18 | drivers/i2c/busses/i2c-designware-platdrv.c | 16 ++++++++++++++++ 19 | 1 file changed, 16 insertions(+) 20 | 21 | diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c 22 | index 01234567..89abcdef 100644 23 | --- a/drivers/i2c/busses/i2c-designware-platdrv.c 24 | +++ b/drivers/i2c/busses/i2c-designware-platdrv.c 25 | @@ -333,6 +333,21 @@ static int dw_i2c_plat_remove(struct platform_device *pdev) 26 | reset_control_assert(dev->rst); 27 | } 28 | 29 | +static void dw_i2c_plat_shutdown(struct platform_device *pdev) 30 | +{ 31 | + struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 32 | + 33 | + pm_runtime_get_sync(&pdev->dev); 34 | + 35 | + i2c_dw_disable(dev); 36 | + 37 | + pm_runtime_dont_use_autosuspend(&pdev->dev); 38 | + pm_runtime_put_sync(&pdev->dev); 39 | + dw_i2c_plat_pm_cleanup(dev); 40 | + 41 | + reset_control_assert(dev->rst); 42 | +} 43 | + 44 | static const struct of_device_id dw_i2c_of_match[] = { 45 | { .compatible = "snps,designware-i2c", }, 46 | { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT }, 47 | @@ -371,6 +386,7 @@ MODULE_ALIAS("platform:i2c_designware"); 48 | static struct platform_driver dw_i2c_driver = { 49 | .probe = dw_i2c_plat_probe, 50 | .remove_new = dw_i2c_plat_remove, 51 | + .shutdown = dw_i2c_plat_shutdown, 52 | .driver = { 53 | .name = "i2c_designware", 54 | .of_match_table = dw_i2c_of_match, 55 | -------------------------------------------------------------------------------- /patches-sonic/0001-armhf_secondary_boot_online.patch: -------------------------------------------------------------------------------- 1 | From 500d48948f43d18a07894b5fd4f891afbade1d79 Mon Sep 17 00:00:00 2001 2 | 3 | From: Antony Rheneus 4 | 5 | Subject: [PATCH 1/1] From 28c199cfda1746644211893b6614acbac970515b Mon Sep 17 6 | 00:00:00 2001 Subject: [PATCH 1/1] CPU1 failed to come online 7 | MIME-Version: 1.0 8 | Content-Type: text/plain; charset=UTF-8 9 | Content-Transfer-Encoding: 8bit 10 | 11 | Issue: On contiuous reboot once in a while CPU1 (secondary cpu) doesn't 12 | come online 13 | The issue comes after migrating to Debian gcc 8.3.6, the issue was not seen till gcc7 14 | 15 | Until introducing the Debian GCC 8.x version – the execution process didn’t influence 16 | mmu intialization before starting the socondary processor. 17 | The new GCC version makes some optimizations that execute the SW faster and once in a while, 18 | causing the Secondary CORE to start while the MMU is still in the initialization stage. 19 | Once adding a slight delay right after the MMU initialization – 20 | compensate the optimized code and enables the MMU to init successfully before the 2nd CORE starts. 21 | 22 | Signed-off-by: Antony Rheneus 23 | --- 24 | arch/arm/mach-mvebu/platsmp-a9.c | 4 ++++ 25 | 1 file changed, 4 insertions(+) 26 | 27 | diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c 28 | index d715dec1c..9c076c6fb 100644 29 | --- a/arch/arm/mach-mvebu/platsmp-a9.c 30 | +++ b/arch/arm/mach-mvebu/platsmp-a9.c 31 | @@ -17,12 +17,15 @@ 32 | #include 33 | #include 34 | #include 35 | +#include 36 | +#include 37 | #include 38 | #include 39 | #include "common.h" 40 | #include "pmsu.h" 41 | 42 | extern void mvebu_cortex_a9_secondary_startup(void); 43 | +static DECLARE_COMPLETION(cpu_wait); 44 | 45 | static int mvebu_cortex_a9_boot_secondary(unsigned int cpu, 46 | struct task_struct *idle) 47 | @@ -44,6 +47,7 @@ static int mvebu_cortex_a9_boot_secondary(unsigned int cpu, 48 | mvebu_pmsu_set_cpu_boot_addr(hw_cpu, mvebu_cortex_a9_secondary_startup); 49 | smp_wmb(); 50 | 51 | + wait_for_completion_timeout(&cpu_wait, usecs_to_jiffies(10)); 52 | /* 53 | * Doing this before deasserting the CPUs is needed to wake up CPUs 54 | * in the offline state after using CPU hotplug. 55 | -------------------------------------------------------------------------------- /patches-sonic/0038-platform_data-mlxreg-Add-fields-for-interrupt-storm-.patch: -------------------------------------------------------------------------------- 1 | From 0f24213b7eb71538c48c3df74bc6fb74b08d1842 Mon Sep 17 00:00:00 2001 2 | From: Roy Cohen 3 | Date: Mon, 13 Jan 2025 10:47:27 +0200 4 | Subject: [PATCH 38/78] platform_data/mlxreg: Add fields for interrupt storm 5 | handling 6 | 7 | Add fields for interrupt storm handling. 8 | Extend structure mlxreg_core_data with the following fields: 9 | 'wmark_low_cntr' - interrupt storm counter. 10 | 'mark_low_ts' - interrupt storm low bound timestamp. 11 | 'wmark_high_ts' - interrupt storm high bound timestamp. 12 | 13 | Extend structure mlxreg_core_item with the following field: 14 | 'storming_bits' - interrupt storming bits mask. 15 | 16 | Signed-off-by: Roy Cohen 17 | --- 18 | include/linux/platform_data/mlxreg.h | 8 ++++++++ 19 | 1 file changed, 8 insertions(+) 20 | 21 | diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h 22 | index 20f84cf..97042f6 100644 23 | --- a/include/linux/platform_data/mlxreg.h 24 | +++ b/include/linux/platform_data/mlxreg.h 25 | @@ -133,6 +133,9 @@ struct mlxreg_hotplug_device { 26 | * @regnum: number of registers occupied by multi-register attribute; 27 | * @slot: slot number, at which device is located; 28 | * @secured: if set indicates that entry access is secured; 29 | + * @wmark_low_cntr: interrupt storm counter; 30 | + * @wmark_low_ts: interrupt storm low bound timestamp; 31 | + * @wmark_high_ts: interrupt storm high bound timestamp; 32 | */ 33 | struct mlxreg_core_data { 34 | char label[MLXREG_CORE_LABEL_MAX_SIZE]; 35 | @@ -155,6 +158,9 @@ struct mlxreg_core_data { 36 | u8 regnum; 37 | u8 slot; 38 | u8 secured; 39 | + unsigned int wmark_low_cntr; 40 | + unsigned long wmark_low_ts; 41 | + unsigned long wmark_high_ts; 42 | }; 43 | 44 | /** 45 | @@ -173,6 +179,7 @@ struct mlxreg_core_data { 46 | * @ind: element's index inside the group; 47 | * @inversed: if 0: 0 for signal status is OK, if 1 - 1 is OK; 48 | * @health: true if device has health indication, false in other case; 49 | + * @storming_bits: interrupt storming bits mask; 50 | */ 51 | struct mlxreg_core_item { 52 | struct mlxreg_core_data *data; 53 | @@ -188,6 +195,7 @@ struct mlxreg_core_item { 54 | u8 ind; 55 | u8 inversed; 56 | u8 health; 57 | + u32 storming_bits; 58 | }; 59 | 60 | /** 61 | -- 62 | 2.8.4 63 | 64 | -------------------------------------------------------------------------------- /patches-sonic/0032-platform_data-mlxreg-Add-capability-bit-and-mask-fie.patch: -------------------------------------------------------------------------------- 1 | From aa424ad19acfa09047c184ae619963d51e027a82 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Thu, 24 Aug 2023 13:20:54 +0000 4 | Subject: [PATCH 32/78] platform_data/mlxreg: Add capability bit and mask 5 | fields 6 | 7 | Some 'capability' registers can be shared between different resources. 8 | Add new fields 'capability_bit' and 'capability_mask' to structs 9 | 'mlxreg_core_data' and and 'mlxreg_core_item' for getting only relevant 10 | capability bits. 11 | 12 | Signed-off-by: Vadim Pasternak 13 | Reviewed-by: Felix Radensky 14 | --- 15 | include/linux/platform_data/mlxreg.h | 8 ++++++++ 16 | 1 file changed, 8 insertions(+) 17 | 18 | diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h 19 | index f6cca7a..20f84cf 100644 20 | --- a/include/linux/platform_data/mlxreg.h 21 | +++ b/include/linux/platform_data/mlxreg.h 22 | @@ -118,6 +118,8 @@ struct mlxreg_hotplug_device { 23 | * @mask: attribute access mask; 24 | * @bit: attribute effective bit; 25 | * @capability: attribute capability register; 26 | + * @capability_bit: started bit in attribute capability register; 27 | + * @capability_mask: mask in attribute capability register; 28 | * @reg_prsnt: attribute presence register; 29 | * @reg_sync: attribute synch register; 30 | * @reg_pwr: attribute power register; 31 | @@ -138,6 +140,8 @@ struct mlxreg_core_data { 32 | u32 mask; 33 | u32 bit; 34 | u32 capability; 35 | + u32 capability_bit; 36 | + u32 capability_mask; 37 | u32 reg_prsnt; 38 | u32 reg_sync; 39 | u32 reg_pwr; 40 | @@ -162,6 +166,8 @@ struct mlxreg_core_data { 41 | * @reg: group interrupt status register; 42 | * @mask: group interrupt mask; 43 | * @capability: group capability register; 44 | + * @capability_bit: started bit in attribute capability register; 45 | + * @capability_mask: mask in attribute capability register; 46 | * @cache: last status value for elements fro the same group; 47 | * @count: number of available elements in the group; 48 | * @ind: element's index inside the group; 49 | @@ -175,6 +181,8 @@ struct mlxreg_core_item { 50 | u32 reg; 51 | u32 mask; 52 | u32 capability; 53 | + u32 capability_bit; 54 | + u32 capability_mask; 55 | u32 cache; 56 | u8 count; 57 | u8 ind; 58 | -- 59 | 2.8.4 60 | 61 | -------------------------------------------------------------------------------- /patches-sonic/0017-leds-mlxreg-Add-support-for-new-flavour-of-capabilit.patch: -------------------------------------------------------------------------------- 1 | From 5dc4e5b4c1244e5d974dc87b2b8caf898d7d721c Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Thu, 20 Jul 2023 11:01:56 +0000 4 | Subject: [PATCH 17/78] leds: mlxreg: Add support for new flavour of capability 5 | register 6 | 7 | LED platform data is common across the various systems, while LED 8 | driver should be able to apply only the LED instances relevant 9 | to specific system. 10 | 11 | For example, platform data might contain descriptions for fan1, 12 | fan2, ..., fan{n} LEDs, while some systems equipped with all 'n' fan 13 | LEDs, others with less. 14 | 15 | For detection of the real number of equipped LEDs special capability 16 | register is used. 17 | This register used to indicate presence of LED through the bitmap. 18 | 19 | For some new big modular systems this register will provide presence 20 | data by counter. 21 | 22 | Use slot parameter to distinct whether capability register contains 23 | bitmask or counter. 24 | 25 | Signed-off-by: Vadim Pasternak 26 | --- 27 | drivers/leds/leds-mlxreg.c | 12 +++++++++--- 28 | 1 file changed, 9 insertions(+), 3 deletions(-) 29 | 30 | diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c 31 | index 1b70de7..5b73cc4 100644 32 | --- a/drivers/leds/leds-mlxreg.c 33 | +++ b/drivers/leds/leds-mlxreg.c 34 | @@ -204,16 +204,22 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv) 35 | dev_err(&priv->pdev->dev, "Failed to query capability register\n"); 36 | return err; 37 | } 38 | - if (!(regval & data->bit)) 39 | + /* 40 | + * If slot is specified - validate if slot is equipped on system. 41 | + * In case slot is specified in platform data, capability register 42 | + * comtains the counter of untits. 43 | + */ 44 | + if (data->slot && data->slot > regval) 45 | + continue; 46 | + else if (!(regval & data->bit) && !data->slot) 47 | continue; 48 | /* 49 | * Field "bit" can contain one capability bit in 0 byte 50 | * and offset bit in 1-3 bytes. Clear capability bit and 51 | - * keep only offset bit. 52 | + * contains the counter of units. 53 | */ 54 | data->bit &= MLXREG_LED_CAPABILITY_CLEAR; 55 | } 56 | - 57 | led_cdev = &led_data->led_cdev; 58 | led_data->data_parent = priv; 59 | if (strstr(data->label, "red") || 60 | -- 61 | 2.8.4 62 | 63 | -------------------------------------------------------------------------------- /patches-sonic/8006-hwmon-mlxreg-fan-Downstream-Allow-fan-speed-setting-.patch: -------------------------------------------------------------------------------- 1 | From fc641945e34d2a6b6bc2a5bd083372c7c71b4198 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Thu, 2 Nov 2023 11:42:47 +0000 4 | Subject: [PATCH 62/78] hwmon: (mlxreg-fan): Downstream: Allow fan speed 5 | setting granularity of 1 PWM 6 | 7 | Currently PWM setting is allowed with 10 percent stepping. 8 | Such configuration is aligned with thermal drivers, which are used to be 9 | bound to "mlxreg-fan" driver. 10 | 11 | This binding happens when the cooling instances created by the driver are 12 | bound to some kernel thermal driver. 13 | 14 | In case system is not using kernel thermal control and the cooling 15 | instances created by the driver are not bound to any thermal driver, the 16 | driver still does not allow setting of PWM granularity less than 10 17 | percent. 18 | 19 | Allow setting fan with one percent granularity, thus any user space 20 | thermal application will be able to set PWM to any allowed value in range 21 | from 51 PWM to 255 PWM. 22 | 23 | Note: this is downstream patch, since it can affect functionality for 24 | the Nvidia users running kernel thermal control. So, it is not going to be 25 | submitted to up-stream. 26 | 27 | Signed-off-by: Vadim Pasternak 28 | --- 29 | drivers/hwmon/mlxreg-fan.c | 9 +++++++-- 30 | 1 file changed, 7 insertions(+), 2 deletions(-) 31 | 32 | diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c 33 | index 2cd0b9c..61f592c 100644 34 | --- a/drivers/hwmon/mlxreg-fan.c 35 | +++ b/drivers/hwmon/mlxreg-fan.c 36 | @@ -15,10 +15,15 @@ 37 | #define MLXREG_FAN_MAX_TACHO 24 38 | #define MLXREG_FAN_MAX_PWM 4 39 | #define MLXREG_FAN_PWM_NOT_CONNECTED 0xff 40 | -#define MLXREG_FAN_MAX_STATE 10 41 | +#ifdef CONFIG_MLXSW_CORE_THERMAL 42 | +#define MLXREG_FAN_MAX_STATE 10 43 | +#define MLXREG_FAN_SPEED_MIN_LEVEL 2 /* 20 percent */ 44 | +#else 45 | +#define MLXREG_FAN_MAX_STATE 255 46 | +#define MLXREG_FAN_SPEED_MIN_LEVEL 51 /* 20 percent */ 47 | +#endif 48 | #define MLXREG_FAN_MIN_DUTY 51 /* 20% */ 49 | #define MLXREG_FAN_MAX_DUTY 255 /* 100% */ 50 | -#define MLXREG_FAN_SPEED_MIN_LEVEL 2 /* 20 percent */ 51 | #define MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF 44 52 | #define MLXREG_FAN_TACHO_DIV_MIN 283 53 | #define MLXREG_FAN_TACHO_DIV_DEF (MLXREG_FAN_TACHO_DIV_MIN * 4) 54 | -- 55 | 2.8.4 56 | 57 | -------------------------------------------------------------------------------- /patches-sonic/0001-hwmon-emc2305-Fix-unable-to-probe-emc2301-2-3.patch: -------------------------------------------------------------------------------- 1 | From e487bfd66267b942185a7124893c5f496bce768e Mon Sep 17 00:00:00 2001 2 | From: Natarajan Subbiramani 3 | Date: Fri, 31 Mar 2023 16:06:56 +0000 4 | Subject: [PATCH] hwmon: (emc2305) Fix unable to probe emc2301/2/3 5 | 6 | The definitions of 'EMC2305_REG_PRODUCT_ID' and 'EMC2305_REG_DEVICE' are 7 | both '0xfd', they actually return the same value, but the values returned 8 | by emc2301/2/3/5 are different, so probe emc2301/2/3 will fail, This patch 9 | fixes that. 10 | 11 | Fix is available in upstream: 12 | https://github.com/torvalds/linux/commit/4d50591ebf60ccf79380fff3a4c23659c61c482f 13 | 14 | Signed-off-by: Natarajan Subbiramani 15 | Signed-off-by: Xingjiang Qiao 16 | Link: https://lore.kernel.org/r/20221206055331.170459-1-nanpuyue@gmail.com 17 | Fixes: 0d8400c ("hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller.") 18 | Signed-off-by: Guenter Roeck 19 | --- 20 | drivers/hwmon/emc2305.c | 7 +------ 21 | 1 file changed, 1 insertion(+), 6 deletions(-) 22 | 23 | diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c 24 | index e0b7392..e1a21c7 100644 25 | --- a/drivers/hwmon/emc2305.c 26 | +++ b/drivers/hwmon/emc2305.c 27 | @@ -18,7 +18,6 @@ static const unsigned short 28 | emc2305_normal_i2c[] = { 0x27, 0x2c, 0x2d, 0x2e, 0x2f, 0x4c, 0x4d, I2C_CLIENT_END }; 29 | 30 | #define EMC2305_REG_DRIVE_FAIL_STATUS 0x27 31 | -#define EMC2305_REG_DEVICE 0xfd 32 | #define EMC2305_REG_VENDOR 0xfe 33 | #define EMC2305_FAN_MAX_NUM 5 34 | #define EMC2305_FAN_MAX 0xff /*100%*/ 35 | @@ -432,7 +431,7 @@ static int emc2305_probe(struct i2c_client *client, const struct i2c_device_id * 36 | struct device *dev = &client->dev; 37 | u8 min_pwm, max_pwm, max_state; 38 | struct emc2305_data *data; 39 | - int vendor, device; 40 | + int vendor; 41 | int ret; 42 | int i; 43 | 44 | @@ -443,10 +442,6 @@ static int emc2305_probe(struct i2c_client *client, const struct i2c_device_id * 45 | if (vendor != EMC2305_VENDOR) 46 | return -ENODEV; 47 | 48 | - device = i2c_smbus_read_byte_data(client, EMC2305_REG_DEVICE); 49 | - if (device != EMC2305_DEVICE) 50 | - return -ENODEV; 51 | - 52 | max_state = EMC2305_FAN_MAX_STATE; 53 | max_pwm = EMC2305_FAN_MAX; 54 | min_pwm = EMC2305_FAN_MIN; 55 | -- 56 | 2.25.1 57 | 58 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # C/C++ with GCC 2 | # Build your C/C++ project with GCC using make. 3 | # Add steps that publish test results, save build artifacts, deploy, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc 5 | 6 | trigger: 7 | branches: 8 | include: 9 | - "*" 10 | 11 | stages: 12 | - stage: Build 13 | 14 | jobs: 15 | - template: .azure-pipelines/build-template.yml 16 | parameters: 17 | arch: amd64 18 | pool: sonicso1ES-amd64 19 | sonic_slave: sonic-slave-trixie 20 | old_artifact_name: sonic-linux-kernel 21 | artifact_name: sonic-linux-kernel.amd64 22 | old_linux_deb_pattern: linux-image-*-unsigned_*deb 23 | linux_deb_pattern: linux-image-*-unsigned_*deb 24 | 25 | - template: .azure-pipelines/build-template.yml 26 | parameters: 27 | arch: amd64 28 | pool: sonicso1ES-amd64 29 | sonic_slave: sonic-slave-trixie 30 | old_artifact_name: sonic-linux-kernel 31 | artifact_name: sonic-linux-kernel.amd64.secure 32 | old_linux_deb_pattern: linux-image-*-unsigned_*deb 33 | linux_deb_pattern: linux-image-*-unsigned_*deb 34 | secure_boot: true 35 | 36 | - template: .azure-pipelines/build-template.yml 37 | parameters: 38 | arch: arm64 39 | pool: sonicso1ES-arm64 40 | sonic_slave: sonic-slave-trixie-arm64 41 | old_artifact_name: sonic-linux-kernel.arm64 42 | artifact_name: sonic-linux-kernel.arm64 43 | old_linux_deb_pattern: linux-image-*-unsigned_*deb 44 | linux_deb_pattern: linux-image-*-unsigned_*deb 45 | 46 | - template: .azure-pipelines/build-template.yml 47 | parameters: 48 | arch: armhf 49 | pool: sonicso1ES-armhf 50 | sonic_slave: sonic-slave-trixie-armhf 51 | old_artifact_name: sonic-linux-kernel.armhf 52 | artifact_name: sonic-linux-kernel.armhf 53 | old_linux_deb_pattern: linux-image-*-armmp_*deb 54 | linux_deb_pattern: linux-image-*+deb*-*-armmp_*deb 55 | 56 | - template: .azure-pipelines/build-template.yml 57 | parameters: 58 | arch: arm64 59 | platform: pensando 60 | pool: sonicso1ES-arm64 61 | sonic_slave: sonic-slave-trixie-arm64 62 | old_artifact_name: sonic-linux-kernel.pensando.arm64 63 | artifact_name: sonic-linux-kernel.pensando.arm64 64 | old_linux_deb_pattern: linux-image-*-unsigned_*deb 65 | linux_deb_pattern: linux-image-*-unsigned_*deb 66 | 67 | -------------------------------------------------------------------------------- /patches-sonic/driver-arista-net-tg3-disallow-broadcom-default-mac.patch: -------------------------------------------------------------------------------- 1 | For Arista platforms, after calling kexec in fast-reboot, the MAC address 2 | 3 | From: byu343 4 | 5 | of management interface is reset to 00:10:18:00:00:00. This patch can recover 6 | the MAC with the one previously saved by Arista Aboot. 7 | --- 8 | drivers/net/ethernet/broadcom/tg3.c | 37 +++++++++++++++++------------------ 9 | 1 file changed, 18 insertions(+), 19 deletions(-) 10 | 11 | diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c 12 | index 72198ef56..997de31f9 100644 13 | --- a/drivers/net/ethernet/broadcom/tg3.c 14 | +++ b/drivers/net/ethernet/broadcom/tg3.c 15 | @@ -9365,6 +9365,15 @@ static int tg3_halt(struct tg3 *tp, int kind, bool silent) 16 | return err; 17 | } 18 | 19 | +static inline int is_valid_bcm_ether_addr(const u8 *addr) 20 | +{ 21 | + if (!is_valid_ether_addr(addr)) 22 | + return 0; 23 | + /* Disallow Broadcom default MAC 00:10:18:00:00:00 to avoid conflicts */ 24 | + return (addr[0] || addr[1] != 0x10 || addr[2] != 0x18 || 25 | + addr[3] || addr[4] || addr[5]); 26 | +} 27 | + 28 | static int tg3_set_mac_addr(struct net_device *dev, void *p) 29 | { 30 | struct tg3 *tp = netdev_priv(dev); 31 | @@ -17040,28 +17049,18 @@ static int tg3_get_device_address(struct tg3 *tp) 32 | addr[5] = (lo >> 0) & 0xff; 33 | 34 | /* Some old bootcode may report a 0 MAC address in SRAM */ 35 | - addr_ok = is_valid_ether_addr(addr); 36 | + addr_ok = is_valid_bcm_ether_addr(addr); 37 | } 38 | if (!addr_ok) { 39 | - /* Next, try NVRAM. */ 40 | - if (!tg3_flag(tp, NO_NVRAM) && 41 | - !tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && 42 | - !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { 43 | - memcpy(&addr[0], ((char *)&hi) + 2, 2); 44 | - memcpy(&addr[2], (char *)&lo, sizeof(lo)); 45 | - } 46 | - /* Finally just fetch it out of the MAC control regs. */ 47 | - else { 48 | - hi = tr32(MAC_ADDR_0_HIGH); 49 | - lo = tr32(MAC_ADDR_0_LOW); 50 | + hi = tr32(MAC_ADDR_0_HIGH); 51 | + lo = tr32(MAC_ADDR_0_LOW); 52 | 53 | - addr[5] = lo & 0xff; 54 | - addr[4] = (lo >> 8) & 0xff; 55 | - addr[3] = (lo >> 16) & 0xff; 56 | - addr[2] = (lo >> 24) & 0xff; 57 | - addr[1] = hi & 0xff; 58 | - addr[0] = (hi >> 8) & 0xff; 59 | - } 60 | + addr[5] = lo & 0xff; 61 | + addr[4] = (lo >> 8) & 0xff; 62 | + addr[3] = (lo >> 16) & 0xff; 63 | + addr[2] = (lo >> 24) & 0xff; 64 | + addr[1] = hi & 0xff; 65 | + addr[0] = (hi >> 8) & 0xff; 66 | } 67 | 68 | if (!is_valid_ether_addr(addr)) 69 | -------------------------------------------------------------------------------- /patches-sonic/0023-arch-arm64-boot-dts-psci-support.patch: -------------------------------------------------------------------------------- 1 | From 9eb1b9c1a16013165649fb6331f102569fa67a12 Mon Sep 17 00:00:00 2001 2 | From: Shantanu Shrivastava 3 | Date: Tue, 24 Oct 2023 10:34:55 +0000 4 | Subject: [PATCH] arch/arm64/boot/dts: psci support 5 | 6 | Change CPU enable-method from 'spin-table' to 'psci'. 7 | 8 | Signed-off-by: David Clear 9 | Signed-off-by: Shantanu Shrivastava 10 | --- 11 | .../boot/dts/pensando/elba-16core-psci.dtsi | 57 +++++++++++++++++++ 12 | arch/arm64/boot/dts/pensando/elba-asic.dts | 2 +- 13 | 2 files changed, 58 insertions(+), 1 deletion(-) 14 | create mode 100644 arch/arm64/boot/dts/pensando/elba-16core-psci.dtsi 15 | 16 | diff --git a/arch/arm64/boot/dts/pensando/elba-16core-psci.dtsi b/arch/arm64/boot/dts/pensando/elba-16core-psci.dtsi 17 | new file mode 100644 18 | index 000000000..099bfaec8 19 | --- /dev/null 20 | +++ b/arch/arm64/boot/dts/pensando/elba-16core-psci.dtsi 21 | @@ -0,0 +1,57 @@ 22 | +// SPDX-License-Identifier: GPL-2.0 23 | + 24 | +&cpu0 { 25 | + enable-method = "psci"; 26 | +}; 27 | +&cpu1 { 28 | + enable-method = "psci"; 29 | +}; 30 | +&cpu2 { 31 | + enable-method = "psci"; 32 | +}; 33 | +&cpu3 { 34 | + enable-method = "psci"; 35 | +}; 36 | +&cpu4 { 37 | + enable-method = "psci"; 38 | +}; 39 | +&cpu5 { 40 | + enable-method = "psci"; 41 | +}; 42 | +&cpu6 { 43 | + enable-method = "psci"; 44 | +}; 45 | +&cpu7 { 46 | + enable-method = "psci"; 47 | +}; 48 | +&cpu8 { 49 | + enable-method = "psci"; 50 | +}; 51 | +&cpu9 { 52 | + enable-method = "psci"; 53 | +}; 54 | +&cpu10 { 55 | + enable-method = "psci"; 56 | +}; 57 | +&cpu11 { 58 | + enable-method = "psci"; 59 | +}; 60 | +&cpu12 { 61 | + enable-method = "psci"; 62 | +}; 63 | +&cpu13 { 64 | + enable-method = "psci"; 65 | +}; 66 | +&cpu14 { 67 | + enable-method = "psci"; 68 | +}; 69 | +&cpu15 { 70 | + enable-method = "psci"; 71 | +}; 72 | + 73 | +/ { 74 | + psci { 75 | + compatible = "arm,psci-0.2"; 76 | + method = "smc"; 77 | + }; 78 | +}; 79 | diff --git a/arch/arm64/boot/dts/pensando/elba-asic.dts b/arch/arm64/boot/dts/pensando/elba-asic.dts 80 | index 70d0dbd38..dfa6deaa0 100644 81 | --- a/arch/arm64/boot/dts/pensando/elba-asic.dts 82 | +++ b/arch/arm64/boot/dts/pensando/elba-asic.dts 83 | @@ -19,7 +19,7 @@ chosen { 84 | 85 | #include "elba.dtsi" 86 | #include "elba-16core.dtsi" 87 | -#include "elba-16core-spin-table.dtsi" 88 | +#include "elba-16core-psci.dtsi" 89 | #include "elba-asic-common.dtsi" 90 | #include "elba-flash-parts.dtsi" 91 | #include "elba-asic-memory.dtsi" 92 | -- 93 | 2.39.2 94 | 95 | -------------------------------------------------------------------------------- /patches-sonic/0034-platform-mellanox-Cosmetic-changes-to-improve-code-s.patch: -------------------------------------------------------------------------------- 1 | From c15263c31b19f0dd2cea9e09b9951613ec459afa Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Mon, 21 Apr 2025 12:20:48 +0300 4 | Subject: [PATCH 34/78] platform: mellanox: Cosmetic changes to improve code 5 | style 6 | MIME-Version: 1.0 7 | Content-Type: text/plain; charset=UTF-8 8 | Content-Transfer-Encoding: 8bit 9 | 10 | Replace in 'for' loop - /i >= 0 ; i--/i >= 0 ;i--/. 11 | Replace in 'while' loop - /(--i >= 0)/(--i)/. 12 | 13 | Signed-off-by: Vadim Pasternak 14 | Reviewed-by: Ilpo Järvinen 15 | Link: https://lore.kernel.org/r/20250421092051.7687-4-vadimp@nvidia.com 16 | Signed-off-by: Ilpo Järvinen 17 | --- 18 | drivers/platform/mellanox/mlx-platform.c | 8 ++++---- 19 | 1 file changed, 4 insertions(+), 4 deletions(-) 20 | 21 | diff --git a/drivers/platform/mellanox/mlx-platform.c b/drivers/platform/mellanox/mlx-platform.c 22 | index 053c8a0..fca8883 100644 23 | --- a/drivers/platform/mellanox/mlx-platform.c 24 | +++ b/drivers/platform/mellanox/mlx-platform.c 25 | @@ -7817,7 +7817,7 @@ static int mlxplat_platdevs_init(struct mlxplat_priv *priv) 26 | while (i--) 27 | platform_device_unregister(priv->pdev_dpu[i]); 28 | fail_platform_wd_register: 29 | - while (--i >= 0) 30 | + while (i--) 31 | platform_device_unregister(priv->pdev_wd[i]); 32 | fail_platform_fan_register: 33 | if (mlxplat_regs_io) 34 | @@ -7838,7 +7838,7 @@ static void mlxplat_platdevs_exit(struct mlxplat_priv *priv) 35 | 36 | for (i = MLXPLAT_CPLD_DPU_MAX_DEVS - 1; i >= 0; i--) 37 | platform_device_unregister(priv->pdev_dpu[i]); 38 | - for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0 ; i--) 39 | + for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0; i--) 40 | platform_device_unregister(priv->pdev_wd[i]); 41 | if (priv->pdev_fan) 42 | platform_device_unregister(priv->pdev_fan); 43 | @@ -7923,7 +7923,7 @@ static int mlxplat_i2c_mux_topology_init(struct mlxplat_priv *priv) 44 | return mlxplat_platdevs_init(priv); 45 | 46 | fail_platform_mux_register: 47 | - while (--i >= 0) 48 | + while (i--) 49 | platform_device_unregister(priv->pdev_mux[i]); 50 | return err; 51 | } 52 | @@ -7932,7 +7932,7 @@ static void mlxplat_i2c_mux_topology_exit(struct mlxplat_priv *priv) 53 | { 54 | int i; 55 | 56 | - for (i = mlxplat_mux_num - 1; i >= 0 ; i--) { 57 | + for (i = mlxplat_mux_num - 1; i >= 0; i--) { 58 | if (priv->pdev_mux[i]) 59 | platform_device_unregister(priv->pdev_mux[i]); 60 | } 61 | -- 62 | 2.8.4 63 | 64 | -------------------------------------------------------------------------------- /patches-sonic/driver-arista-mmcblk-not-working-on-AMD-platforms.patch: -------------------------------------------------------------------------------- 1 | amd/mmc: mmcblk not working on some AMD platforms 2 | 3 | ADMA and ADMA-64 seem to be broken on AMD. This patch enables the 4 | following quirks (for AMD only): 5 | SDHCI_QUIRK_BROKEN_ADMA 6 | SDHCI_QUIRK2_BROKEN_64_BIT_DMA 7 | 8 | This fixes issues that would manifest in the following fashion. 9 | 10 | mmc0: Timeout waiting for hardware interrupt. 11 | sdhci: =========== REGISTER DUMP (mmc0)=========== 12 | sdhci: Sys addr: 0x00000078 | Version: 0x00001002 13 | sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000078 14 | sdhci: Argument: 0x000ab148 | Trn mode: 0x0000003b 15 | sdhci: Present: 0x01ff0001 | Host ctl: 0x00000019 16 | sdhci: Power: 0x0000000f | Blk gap: 0x00000000 17 | sdhci: Wake-up: 0x00000000 | Clock: 0x0000fa07 18 | sdhci: Timeout: 0x0000000c | Int stat: 0x00000000 19 | sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b 20 | sdhci: AC12 err: 0x00000002 | Slot int: 0x000000ff 21 | sdhci: Caps: 0x75fec8b2 | Caps_1: 0x00002501 22 | sdhci: Cmd: 0x0000123a | Max curr: 0x00c80064 23 | sdhci: Host ctl2: 0x00000000 24 | sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x000000020f97b20c 25 | sdhci: =========================================== 26 | mmcblk0: error -110 sending status command, retrying 27 | mmcblk0: error -110 sending status command, retrying 28 | mmcblk0: error -110 sending status command, aborting 29 | mmc0: cache flush error -110 30 | mmc0: tried to reset card, got error -110 31 | blk_update_request: I/O error, dev mmcblk0, sector 700744 32 | blk_update_request: I/O error, dev mmcblk0, sector 700752 33 | 34 | Signed-off-by: Radu Rendec 35 | Signed-off-by: Samuel Angebault 36 | --- 37 | drivers/mmc/host/sdhci-pci-core.c | 7 ++++++- 38 | 1 file changed, 6 insertions(+), 1 deletion(-) 39 | 40 | diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c 41 | index bf04a08ee..c10790dd6 100644 42 | --- a/drivers/mmc/host/sdhci-pci-core.c 43 | +++ b/drivers/mmc/host/sdhci-pci-core.c 44 | @@ -1791,8 +1791,13 @@ static int amd_probe(struct sdhci_pci_chip *chip) 45 | 46 | pci_dev_put(smbus_dev); 47 | 48 | - if (gen == AMD_CHIPSET_BEFORE_ML || gen == AMD_CHIPSET_CZ) 49 | + dev_info(&chip->pdev->dev, "identified AMD generation %d chip\n", gen); 50 | + 51 | + if (gen == AMD_CHIPSET_BEFORE_ML || gen == AMD_CHIPSET_CZ) { 52 | + chip->quirks |= SDHCI_QUIRK_BROKEN_ADMA; 53 | + chip->quirks2 |= SDHCI_QUIRK2_BROKEN_64_BIT_DMA; 54 | chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD; 55 | + } 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /patches-sonic/driver-arista-net-tg3-access-regs-indirectly.patch: -------------------------------------------------------------------------------- 1 | Fix kernel hangs seen and easily reproducable using ethtool -t 2 | 3 | From: Samuel Angebault 4 | 5 | This issue is seen at least on Arista DCS-7050QX-32 SKUs 6 | --- 7 | drivers/net/ethernet/broadcom/tg3.c | 25 ++++++++++++++++++------- 8 | 1 file changed, 18 insertions(+), 7 deletions(-) 9 | 10 | diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c 11 | index 997de31f9..1d985ebf1 100644 12 | --- a/drivers/net/ethernet/broadcom/tg3.c 13 | +++ b/drivers/net/ethernet/broadcom/tg3.c 14 | @@ -1005,6 +1005,7 @@ static void tg3_disable_ints(struct tg3 *tp) 15 | static void tg3_enable_ints(struct tg3 *tp) 16 | { 17 | int i; 18 | + static int first_called = 1; 19 | 20 | tp->irq_sync = 0; 21 | wmb(); 22 | @@ -1017,6 +1018,22 @@ static void tg3_enable_ints(struct tg3 *tp) 23 | struct tg3_napi *tnapi = &tp->napi[i]; 24 | 25 | tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); 26 | + 27 | + /* Because Aboot with unpatched kernel accesses 28 | + * registers the old way, if Aboot shell uses the 29 | + * network at all and then boots a system, somehow the new 30 | + * way of accessing registers will fail to enable the 31 | + * interrupt, effectively disabling the interface. 32 | + * 33 | + * To enable the interrupt, redo the above write 34 | + * through mapped memory when this function is _first 35 | + * called_, otherwise kernel lockups may occur again. 36 | + */ 37 | + if (first_called && tg3_flag(tp, ICH_WORKAROUND)) { 38 | + first_called = 0; 39 | + tg3_write32(tp, tnapi->int_mbox, tnapi->last_tag << 24); 40 | + } 41 | + 42 | if (tg3_flag(tp, 1SHOT_MSI)) 43 | tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); 44 | 45 | @@ -16369,6 +16386,7 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent) 46 | if ((tp->pdev->bus->number == 0) && 47 | (tp->pdev->devfn == PCI_DEVFN(0x14, 0x6))) { 48 | tg3_flag_set(tp, 4G_DMA_ONLY); 49 | + tg3_flag_set(tp, ICH_WORKAROUND); 50 | } 51 | } 52 | 53 | @@ -16628,13 +16646,6 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent) 54 | tp->write32_mbox = tg3_write_indirect_mbox; 55 | tp->write32_tx_mbox = tg3_write_indirect_mbox; 56 | tp->write32_rx_mbox = tg3_write_indirect_mbox; 57 | - 58 | - iounmap(tp->regs); 59 | - tp->regs = NULL; 60 | - 61 | - pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd); 62 | - pci_cmd &= ~PCI_COMMAND_MEMORY; 63 | - pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); 64 | } 65 | if (tg3_asic_rev(tp) == ASIC_REV_5906) { 66 | tp->read32_mbox = tg3_read32_mbox_5906; 67 | -------------------------------------------------------------------------------- /patches-sonic/driver-arista-net-tg3-dma-mask-4g-sb800.patch: -------------------------------------------------------------------------------- 1 | Force DMA accesses to be done in the 4G range due to a SB800 limitation 2 | 3 | From: Samuel Angebault 4 | 5 | This issue is seen on Arista DCS-7050QX-32 SKUs 6 | --- 7 | drivers/net/ethernet/broadcom/tg3.c | 17 ++++++++++++++--- 8 | drivers/net/ethernet/broadcom/tg3.h | 1 + 9 | 2 files changed, 15 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c 12 | index 5143cdd0e..72198ef56 100644 13 | --- a/drivers/net/ethernet/broadcom/tg3.c 14 | +++ b/drivers/net/ethernet/broadcom/tg3.c 15 | @@ -16353,6 +16353,16 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent) 16 | } while (bridge); 17 | } 18 | 19 | + /* The embedded nic in ATI's SB800 can only dma to 32bit 20 | + * addresses. partno(noe) rev 5785041 21 | + */ 22 | + if (tg3_asic_rev(tp) == ASIC_REV_5785) { 23 | + if ((tp->pdev->bus->number == 0) && 24 | + (tp->pdev->devfn == PCI_DEVFN(0x14, 0x6))) { 25 | + tg3_flag_set(tp, 4G_DMA_ONLY); 26 | + } 27 | + } 28 | + 29 | if (tg3_asic_rev(tp) == ASIC_REV_5704 || 30 | tg3_asic_rev(tp) == ASIC_REV_5714) 31 | tp->pdev_peer = tg3_find_peer(tp); 32 | @@ -16880,8 +16890,9 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent) 33 | 34 | if (tg3_asic_rev(tp) == ASIC_REV_5705 && 35 | (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 || 36 | - grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) 37 | - tg3_flag_set(tp, IS_5788); 38 | + grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) { 39 | + tg3_flag_set(tp, 4G_DMA_ONLY); 40 | + } 41 | 42 | if (!tg3_flag(tp, IS_5788) && 43 | tg3_asic_rev(tp) != ASIC_REV_5700) 44 | @@ -17796,7 +17807,7 @@ static int tg3_init_one(struct pci_dev *pdev, 45 | * On 64-bit systems without IOMMU, use 64-bit dma_mask and 46 | * do DMA address check in __tg3_start_xmit(). 47 | */ 48 | - if (tg3_flag(tp, IS_5788)) 49 | + if (tg3_flag(tp, 4G_DMA_ONLY)) 50 | persist_dma_mask = dma_mask = DMA_BIT_MASK(32); 51 | else if (tg3_flag(tp, 40BIT_DMA_BUG)) { 52 | persist_dma_mask = dma_mask = DMA_BIT_MASK(40); 53 | diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h 54 | index 1000c8940..3e004b0bf 100644 55 | --- a/drivers/net/ethernet/broadcom/tg3.h 56 | +++ b/drivers/net/ethernet/broadcom/tg3.h 57 | @@ -3120,6 +3120,7 @@ enum TG3_FLAGS { 58 | TG3_FLAG_ROBOSWITCH, 59 | TG3_FLAG_ONE_DMA_AT_ONCE, 60 | TG3_FLAG_RGMII_MODE, 61 | + TG3_FLAG_4G_DMA_ONLY, 62 | 63 | /* Add new flags before this comment and TG3_FLAG_NUMBER_OF_FLAGS */ 64 | TG3_FLAG_NUMBER_OF_FLAGS, /* Last entry in enum TG3_FLAGS */ 65 | -------------------------------------------------------------------------------- /patches-sonic/driver-hwmon-pmbus-add-dps460-support.patch: -------------------------------------------------------------------------------- 1 | enable PMBUS_SKIP_STATUS_CHECK for dps460 2 | 3 | From: Vadim Pasternak 4 | 5 | Patch for pmbus - includes disabling of PMBus status check through platform data structure. 6 | This is due to some PMBus don't support the STATUS_CML register, or report communication errors 7 | for no explicable reason. For such chips, checking the status register must be disabled. 8 | --- 9 | drivers/hwmon/pmbus/pmbus.c | 14 ++++++++++++++ 10 | drivers/hwmon/pmbus/pmbus_core.c | 3 +++ 11 | 2 files changed, 17 insertions(+) 12 | 13 | diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c 14 | index 7e91700..6dd75fb 100644 15 | --- a/drivers/hwmon/pmbus/pmbus.c 16 | +++ b/drivers/hwmon/pmbus/pmbus.c 17 | @@ -25,6 +25,7 @@ 18 | #include 19 | #include 20 | #include 21 | +#include 22 | #include "pmbus.h" 23 | 24 | /* 25 | @@ -166,14 +167,26 @@ static int pmbus_probe(struct i2c_client *client, 26 | const struct i2c_device_id *id) 27 | { 28 | struct pmbus_driver_info *info; 29 | + struct pmbus_platform_data *pdata = NULL; 30 | + struct device *dev = &client->dev; 31 | 32 | info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), 33 | GFP_KERNEL); 34 | if (!info) 35 | return -ENOMEM; 36 | 37 | + if (!strncmp(id->name, "dps460", sizeof("dps460"))) { 38 | + pdata = kzalloc(sizeof(struct pmbus_platform_data), GFP_KERNEL); 39 | + if (!pdata) { 40 | + kfree(info); 41 | + return -ENOMEM; 42 | + } 43 | + pdata->flags = PMBUS_SKIP_STATUS_CHECK; 44 | + } 45 | + 46 | info->pages = id->driver_data; 47 | info->identify = pmbus_identify; 48 | + dev->platform_data = pdata; 49 | 50 | return pmbus_do_probe(client, id, info); 51 | } 52 | @@ -195,6 +208,7 @@ static const struct i2c_device_id pmbus_id[] = { 53 | {"tps40400", 1}, 54 | {"tps40422", 2}, 55 | {"udt020", 1}, 56 | + {"dps460", 1}, 57 | {} 58 | }; 59 | 60 | diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c 61 | index 291d11f..09b123f 100644 62 | --- a/drivers/hwmon/pmbus/pmbus_core.c 63 | +++ b/drivers/hwmon/pmbus/pmbus_core.c 64 | @@ -1792,8 +1792,11 @@ EXPORT_SYMBOL_GPL(pmbus_do_probe); 65 | int pmbus_do_remove(struct i2c_client *client) 66 | { 67 | struct pmbus_data *data = i2c_get_clientdata(client); 68 | + const struct pmbus_platform_data *pdata = dev_get_platdata(&client->dev); 69 | hwmon_device_unregister(data->hwmon_dev); 70 | kfree(data->group.attrs); 71 | + if (pdata) 72 | + kfree(pdata); 73 | return 0; 74 | } 75 | EXPORT_SYMBOL_GPL(pmbus_do_remove); 76 | -- 77 | 2.1.4 78 | 79 | -------------------------------------------------------------------------------- /patches-sonic/8004-leds-leds-mlxreg-Downstream-Send-udev-event-from-led.patch: -------------------------------------------------------------------------------- 1 | From 5122a4cbfb006f1fe5ddc069a52a1be725a21c93 Mon Sep 17 00:00:00 2001 2 | From: Michael Shych 3 | Date: Mon, 11 Jul 2022 12:51:27 +0300 4 | Subject: [PATCH 60/78] leds: leds-mlxreg: Downstream: Send udev event from 5 | leds-mlxreg driver. 6 | 7 | Add sending udev event from leds-mlxreg driver in case of color change. 8 | This patch will not be accepted in upstream as it provides no regular flow. 9 | It's done as a workaround of SN2201 limitation, difference, and in order 10 | to save compatibility of NOS work with sysfs attributes. 11 | The patch should be taken to NOSs as exceptions to the upstream procedure. 12 | 13 | Signed-off-by: Michael Shych 14 | --- 15 | drivers/leds/leds-mlxreg.c | 29 +++++++++++++++++++++++++++-- 16 | 1 file changed, 27 insertions(+), 2 deletions(-) 17 | 18 | diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c 19 | index 26add3e..a647048 100644 20 | --- a/drivers/leds/leds-mlxreg.c 21 | +++ b/drivers/leds/leds-mlxreg.c 22 | @@ -10,6 +10,7 @@ 23 | #include 24 | #include 25 | #include 26 | +#include 27 | #include 28 | 29 | /* Codes for LEDs. */ 30 | @@ -129,15 +130,39 @@ mlxreg_led_get_hw(struct mlxreg_led_data *led_data) 31 | return LED_OFF; 32 | } 33 | 34 | +static char *mlxreg_led_udev_envp[] = { NULL, NULL }; 35 | + 36 | +static int 37 | +mlxreg_led_udev_event_send(struct mlxreg_led_data *led_data, enum led_brightness value) 38 | +{ 39 | + struct mlxreg_core_data *data = led_data->data; 40 | + struct kobject *kobj = &led_data->led_cdev.dev->kobj; 41 | + 42 | + char event_str[MLXREG_CORE_LABEL_MAX_SIZE + 2]; 43 | + char label[MLXREG_CORE_LABEL_MAX_SIZE] = { 0 }; 44 | + 45 | + mlxreg_led_udev_envp[0] = event_str; 46 | + string_upper(label, data->label); 47 | + snprintf(event_str, MLXREG_CORE_LABEL_MAX_SIZE, "%s=%d", label, value); 48 | + 49 | + return kobject_uevent_env(kobj, KOBJ_CHANGE, mlxreg_led_udev_envp); 50 | +} 51 | + 52 | static int 53 | mlxreg_led_brightness_set(struct led_classdev *cled, enum led_brightness value) 54 | { 55 | struct mlxreg_led_data *led_data = cdev_to_priv(cled); 56 | + int err; 57 | 58 | if (value) 59 | - return mlxreg_led_store_hw(led_data, led_data->base_color); 60 | + err = mlxreg_led_store_hw(led_data, led_data->base_color); 61 | else 62 | - return mlxreg_led_store_hw(led_data, MLXREG_LED_IS_OFF); 63 | + err = mlxreg_led_store_hw(led_data, MLXREG_LED_IS_OFF); 64 | + 65 | + if (!err) 66 | + return mlxreg_led_udev_event_send(led_data, value); 67 | + else 68 | + return err; 69 | } 70 | 71 | static enum led_brightness 72 | -- 73 | 2.8.4 74 | 75 | -------------------------------------------------------------------------------- /patches-sonic/0004-arm64-dts-ac5-add-mmc-node-and-clock.patch: -------------------------------------------------------------------------------- 1 | From cd40be983803830da19cb492b250abccf71ace7d Mon Sep 17 00:00:00 2001 2 | From: Elad Nachman 3 | Date: Wed, 3 Jan 2024 19:28:03 +0200 4 | Subject: arm64: dts: ac5: add mmc node and clock 5 | 6 | Add mmc and mmc clock nodes to ac5 and ac5x device tree files 7 | 8 | Signed-off-by: Elad Nachman 9 | Signed-off-by: Gregory CLEMENT 10 | --- 11 | arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi | 31 ++++++++++++++++++- 12 | .../boot/dts/marvell/ac5-98dx35xx-rd.dts | 4 +++ 13 | 2 files changed, 34 insertions(+), 1 deletion(-) 14 | 15 | diff --git a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 16 | index b5e042b8e929..5591939e057b 100644 17 | --- a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 18 | +++ b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 19 | @@ -77,7 +77,6 @@ soc { 20 | #address-cells = <2>; 21 | #size-cells = <2>; 22 | ranges; 23 | - dma-ranges; 24 | 25 | internal-regs@7f000000 { 26 | #address-cells = <1>; 27 | @@ -204,6 +203,30 @@ gpio1: gpio@18140 { 28 | }; 29 | }; 30 | 31 | + mmc_dma: bus@80500000 { 32 | + compatible = "simple-bus"; 33 | + ranges; 34 | + #address-cells = <0x2>; 35 | + #size-cells = <0x2>; 36 | + reg = <0x0 0x80500000 0x0 0x100000>; 37 | + dma-ranges = <0x0 0x0 0x2 0x0 0x0 0x80000000>; 38 | + dma-coherent; 39 | + 40 | + sdhci: mmc@805c0000 { 41 | + compatible = "marvell,ac5-sdhci", 42 | + "marvell,armada-ap806-sdhci"; 43 | + reg = <0x0 0x805c0000 0x0 0x1000>; 44 | + interrupts = ; 45 | + clocks = <&emmc_clock>, <&cnm_clock>; 46 | + clock-names = "core", "axi"; 47 | + bus-width = <8>; 48 | + non-removable; 49 | + mmc-ddr-1_8v; 50 | + mmc-hs200-1_8v; 51 | + mmc-hs400-1_8v; 52 | + }; 53 | + }; 54 | + 55 | /* 56 | * Dedicated section for devices behind 32bit controllers so we 57 | * can configure specific DMA mapping for them 58 | @@ -335,5 +358,11 @@ nand_clock: nand-clock { 59 | #clock-cells = <0>; 60 | clock-frequency = <400000000>; 61 | }; 62 | + 63 | + emmc_clock: emmc-clock { 64 | + compatible = "fixed-clock"; 65 | + #clock-cells = <0>; 66 | + clock-frequency = <400000000>; 67 | + }; 68 | }; 69 | }; 70 | diff --git a/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts b/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts 71 | index f0ebdb84eec9..0c973d7a215a 100644 72 | --- a/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts 73 | +++ b/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts 74 | @@ -99,3 +99,7 @@ parition@2 { 75 | }; 76 | }; 77 | }; 78 | + 79 | +&sdhci { 80 | + status = "okay"; 81 | +}; 82 | -- 83 | 2.25.1 84 | 85 | -------------------------------------------------------------------------------- /patches-sonic/0047-hwmon-mlxreg-fan-Prevent-fans-from-getting-stuck-at-.patch: -------------------------------------------------------------------------------- 1 | From cb4bbd807ddd09b237809ac19e120ee3235f27e6 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Wed, 30 Jul 2025 20:41:33 +0300 4 | Subject: [PATCH 47/78] hwmon: mlxreg-fan: Prevent fans from getting stuck at 0 5 | RPM 6 | 7 | The fans controlled by the driver can get stuck at 0 RPM if they are 8 | configured below a 20% duty cycle. The driver tries to avoid this by 9 | enforcing a minimum duty cycle of 20%, but this is done after the fans 10 | are registered with the thermal subsystem. This is too late as the 11 | thermal subsystem can set their current state before the driver is able 12 | to enforce the minimum duty cycle. 13 | 14 | Fix by setting the minimum duty cycle before registering the fans with 15 | the thermal subsystem. 16 | 17 | Fixes: d7efb2ebc7b3 ("hwmon: (mlxreg-fan) Extend driver to support multiply cooling devices") 18 | Reported-by: Nikolay Aleksandrov 19 | Tested-by: Nikolay Aleksandrov 20 | Signed-off-by: Ido Schimmel 21 | Signed-off-by: Vadim Pasternak 22 | --- 23 | drivers/hwmon/mlxreg-fan.c | 5 ++--- 24 | drivers/platform/mellanox/nvsw-bmc-hid162.c | 2 +- 25 | 2 files changed, 3 insertions(+), 4 deletions(-) 26 | 27 | diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c 28 | index 0e9ce70..2cd0b9c 100644 29 | --- a/drivers/hwmon/mlxreg-fan.c 30 | +++ b/drivers/hwmon/mlxreg-fan.c 31 | @@ -581,15 +581,14 @@ static int mlxreg_fan_cooling_config(struct device *dev, struct mlxreg_fan *fan) 32 | if (!pwm->connected) 33 | continue; 34 | pwm->fan = fan; 35 | + /* Set minimal PWM speed. */ 36 | + pwm->last_hwmon_state = MLXREG_FAN_PWM_DUTY2STATE(MLXREG_FAN_MIN_DUTY); 37 | pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, mlxreg_fan_name[i], 38 | pwm, &mlxreg_fan_cooling_ops); 39 | if (IS_ERR(pwm->cdev)) { 40 | dev_err(dev, "Failed to register cooling device\n"); 41 | return PTR_ERR(pwm->cdev); 42 | } 43 | - 44 | - /* Set minimal PWM speed. */ 45 | - pwm->last_hwmon_state = MLXREG_FAN_PWM_DUTY2STATE(MLXREG_FAN_MIN_DUTY); 46 | } 47 | 48 | return 0; 49 | diff --git a/drivers/platform/mellanox/nvsw-bmc-hid162.c b/drivers/platform/mellanox/nvsw-bmc-hid162.c 50 | index fbc7382..6ebe5be 100644 51 | --- a/drivers/platform/mellanox/nvsw-bmc-hid162.c 52 | +++ b/drivers/platform/mellanox/nvsw-bmc-hid162.c 53 | @@ -2012,7 +2012,7 @@ static struct mlxreg_core_data nvsw_bmc_hid180_regio_data[] = { 54 | { 55 | .label = "mcu2_reset", 56 | .reg = NVSW_REG_RESET_GP2_OFFSET, 57 | - .mask = GENMASK(7, 0) & ~BIT(6), 58 | + .mask = GENMASK(7, 0) & ~BIT(7), 59 | .mode = 0644, 60 | }, 61 | { 62 | -- 63 | 2.8.4 64 | 65 | -------------------------------------------------------------------------------- /patches-sonic/driver-support-optoe-chunk-offset-fix.patch: -------------------------------------------------------------------------------- 1 | From e317fa8a47a3718d21edc9b66a7126b021b8ee6e Mon Sep 17 00:00:00 2001 2 | 3 | From: Don Bollinger 4 | 5 | Subject: [PATCH] Correct a panic inducing defect which is triggered on a read 6 | (or write) which begins beyond byte 128, on a byte which is not aligned on a 7 | 128 byte chunk boundary, and which crosses a chunk boundary. 8 | --- 9 | drivers/misc/eeprom/optoe.c | 27 ++++++++++++++------------- 10 | 1 file changed, 14 insertions(+), 13 deletions(-) 11 | 12 | diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c 13 | index bb33be2a2..f31c409ed 100644 14 | --- a/drivers/misc/eeprom/optoe.c 15 | +++ b/drivers/misc/eeprom/optoe.c 16 | @@ -660,6 +660,7 @@ static ssize_t optoe_read_write(struct optoe_data *optoe, 17 | ssize_t retval; 18 | size_t pending_len = 0, chunk_len = 0; 19 | loff_t chunk_offset = 0, chunk_start_offset = 0; 20 | + loff_t chunk_end_offset = 0; 21 | 22 | dev_dbg(&client->dev, 23 | "%s: off %lld len:%ld, opcode:%s\n", 24 | @@ -699,30 +700,30 @@ static ssize_t optoe_read_write(struct optoe_data *optoe, 25 | /* 26 | * Compute the offset and number of bytes to be read/write 27 | * 28 | - * 1. start at offset 0 (within the chunk), and read/write 29 | - * the entire chunk 30 | - * 2. start at offset 0 (within the chunk) and read/write less 31 | - * than entire chunk 32 | - * 3. start at an offset not equal to 0 and read/write the rest 33 | + * 1. start at an offset not equal to 0 (within the chunk) 34 | + * and read/write less than the rest of the chunk 35 | + * 2. start at an offset not equal to 0 and read/write the rest 36 | * of the chunk 37 | - * 4. start at an offset not equal to 0 and read/write less than 38 | - * (end of chunk - offset) 39 | + * 3. start at offset 0 (within the chunk) and read/write less 40 | + * than entire chunk 41 | + * 4. start at offset 0 (within the chunk), and read/write 42 | + * the entire chunk 43 | */ 44 | chunk_start_offset = chunk * OPTOE_PAGE_SIZE; 45 | + chunk_end_offset = chunk_start_offset + OPTOE_PAGE_SIZE; 46 | 47 | if (chunk_start_offset < off) { 48 | chunk_offset = off; 49 | - if ((off + pending_len) < (chunk_start_offset + 50 | - OPTOE_PAGE_SIZE)) 51 | + if ((off + pending_len) < chunk_end_offset) 52 | chunk_len = pending_len; 53 | else 54 | - chunk_len = OPTOE_PAGE_SIZE - off; 55 | + chunk_len = chunk_end_offset - off; 56 | } else { 57 | chunk_offset = chunk_start_offset; 58 | - if (pending_len > OPTOE_PAGE_SIZE) 59 | - chunk_len = OPTOE_PAGE_SIZE; 60 | - else 61 | + if (pending_len < OPTOE_PAGE_SIZE) 62 | chunk_len = pending_len; 63 | + else 64 | + chunk_len = OPTOE_PAGE_SIZE; 65 | } 66 | 67 | dev_dbg(&client->dev, 68 | -------------------------------------------------------------------------------- /patches-sonic/driver-support-optoe-oneaddr-pageable.patch: -------------------------------------------------------------------------------- 1 | From cb4523bb02cb6228e3e8e5f3333e6af9a1b15466 Mon Sep 17 00:00:00 2001 2 | From: Mihir Patel 3 | Date: Fri, 10 Mar 2023 06:52:27 +0000 4 | Subject: [PATCH] Read ID register to find pageable bit in optoe driver 5 | 6 | The current optoe driver looks at bit 2 for all optoe1 7 | (dev_class as ONE_ADDR) transceivers to detect if it's pageable or not. 8 | However, for QSFP28 w/ CMIS optics, some platforms use it as optoe1 9 | and not optoe3. With CMIS, the pageable bit has now changed to bit 7 for 10 | the same register. This causes incorrect behavior when the driver checks 11 | for pageability on QSFP28 w/ CMIS transceiver and hence, we need to 12 | read the transceiver ID to see if the transceiver is CMIS based and then 13 | find the relevant pageable bit. 14 | 15 | Test result summary 16 | Tested the changes on a switch with a 100G CMIS and non-CMIS transceiver 17 | 18 | No significant time difference is seen related to EEPROM read after adding 19 | the current changes. Below stats were taken for a 100G CMIS based 20 | transceiver with making it as optoe3 v/s optoe1 21 | 22 | Test stats (average time taken after 3 dumps) 23 | Time to dump first 4096B from EEPROM with transceiver as optoe3 - 914ms 24 | Time to dump first 4096B from EEPROM with transceiver as optoe1 - 911ms 25 | 26 | Signed-off-by: Mihir Patel 27 | --- 28 | drivers/misc/eeprom/optoe.c | 20 +++++++++++++++++++- 29 | 1 file changed, 19 insertions(+), 1 deletion(-) 30 | 31 | diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c 32 | index 62294392c..f34bfe88b 100644 33 | --- a/drivers/misc/eeprom/optoe.c 34 | +++ b/drivers/misc/eeprom/optoe.c 35 | @@ -630,7 +630,25 @@ static ssize_t optoe_page_legal(struct optoe_data *optoe, 36 | return status; /* error out (no module?) */ 37 | 38 | if (optoe->dev_class == ONE_ADDR) { 39 | - not_pageable = QSFP_NOT_PAGEABLE; 40 | + u8 idRegVal; 41 | + 42 | + status = optoe_eeprom_read(optoe, client, &idRegVal, 43 | + OPTOE_ID_REG, 1); 44 | + if (status < 0) 45 | + return status; /* error out (no module?) */ 46 | + 47 | + /* 48 | + * For QSFP28 with CMIS optic, if userspace has dev_class as ONE_ADDR, 49 | + * the driver looks at the incorrect bit to find if it is pageable. 50 | + * Below check ensures we read the appropriate bit for such QSFP28 CMIS 51 | + * compliant optics with dev_class as ONE_ADDR 52 | + * The ID values below are based on the SFF-8024 spec (Page 0, byte 0) 53 | + * for CMIS optics 54 | + */ 55 | + if (idRegVal == 0x18 || idRegVal == 0x19 || idRegVal == 0x1e) 56 | + not_pageable = CMIS_NOT_PAGEABLE; 57 | + else 58 | + not_pageable = QSFP_NOT_PAGEABLE; 59 | } else { 60 | not_pageable = CMIS_NOT_PAGEABLE; 61 | } 62 | -- 63 | 2.25.1 64 | 65 | -------------------------------------------------------------------------------- /patches-sonic/0012-PCI-AER-Avoid-NULL-pointer-dereference-in-aer_rateli.patch: -------------------------------------------------------------------------------- 1 | From 5034b584556f1a8fe60d10231ac9a3f687508c54 Mon Sep 17 00:00:00 2001 2 | From: Breno Leitao 3 | Date: Mon, 29 Sep 2025 02:15:47 -0700 4 | Subject: [PATCH 12/12] PCI/AER: Avoid NULL pointer dereference in 5 | aer_ratelimit() 6 | 7 | When platform firmware supplies error information to the OS, e.g., via the 8 | ACPI APEI GHES mechanism, it may identify an error source device that 9 | doesn't advertise an AER Capability and therefore dev->aer_info, which 10 | contains AER stats and ratelimiting data, is NULL. 11 | 12 | pci_dev_aer_stats_incr() already checks dev->aer_info for NULL, but 13 | aer_ratelimit() did not, leading to NULL pointer dereferences like this one 14 | from the URL below: 15 | 16 | {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 0 17 | {1}[Hardware Error]: event severity: corrected 18 | {1}[Hardware Error]: device_id: 0000:00:00.0 19 | {1}[Hardware Error]: vendor_id: 0x8086, device_id: 0x2020 20 | {1}[Hardware Error]: aer_cor_status: 0x00001000, aer_cor_mask: 0x00002000 21 | BUG: kernel NULL pointer dereference, address: 0000000000000264 22 | RIP: 0010:___ratelimit+0xc/0x1b0 23 | pci_print_aer+0x141/0x360 24 | aer_recover_work_func+0xb5/0x130 25 | 26 | [8086:2020] is an Intel "Sky Lake-E DMI3 Registers" device that claims to 27 | be a Root Port but does not advertise an AER Capability. 28 | 29 | Add a NULL check in aer_ratelimit() to avoid the NULL pointer dereference. 30 | Note that this also prevents ratelimiting these events from GHES. 31 | 32 | Fixes: a57f2bfb4a5863 ("PCI/AER: Ratelimit correctable and non-fatal error logging") 33 | Link: https://lore.kernel.org/r/buduna6darbvwfg3aogl5kimyxkggu3n4romnmq6sozut6axeu@clnx7sfsy457/ 34 | Signed-off-by: Breno Leitao 35 | [bhelgaas: add crash details to commit log] 36 | Signed-off-by: Bjorn Helgaas 37 | Reviewed-by: Kuppuswamy Sathyanarayanan 38 | Cc: stable@vger.kernel.org 39 | Link: https://patch.msgid.link/20250929-aer_crash_2-v1-1-68ec4f81c356@debian.org 40 | (cherry picked from commit deb2f228388ff3a9d0623e3b59a053e9235c341d) 41 | --- 42 | drivers/pci/pcie/aer.c | 3 +++ 43 | 1 file changed, 3 insertions(+) 44 | 45 | diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c 46 | index f1886e60f5a2..ac64e5e5c95e 100644 47 | --- a/drivers/pci/pcie/aer.c 48 | +++ b/drivers/pci/pcie/aer.c 49 | @@ -792,6 +792,9 @@ static void __print_tlp_header(struct pci_dev *dev, struct pcie_tlp_log *t) 50 | 51 | static int aer_ratelimit(struct pci_dev *dev, unsigned int severity) 52 | { 53 | + if (!dev->aer_stats) 54 | + return 1; 55 | + 56 | switch (severity) { 57 | case AER_NONFATAL: 58 | return __ratelimit(&dev->aer_stats->nonfatal_ratelimit); 59 | -- 60 | 2.47.0 61 | 62 | -------------------------------------------------------------------------------- /patches-sonic/0002-PCI-AER-Update-statistics-before-ratelimiting.patch: -------------------------------------------------------------------------------- 1 | From dfcd0e7d5008dffb55517a8207d455cab69dc70c Mon Sep 17 00:00:00 2001 2 | From: Bjorn Helgaas 3 | Date: Thu, 22 May 2025 18:21:16 -0500 4 | Subject: [PATCH 02/12] PCI/AER: Update statistics before ratelimiting 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | There are two AER logging entry points: 10 | 11 | - aer_print_error() is used by DPC (dpc_process_error()) and native AER 12 | handling (aer_process_err_devices()). 13 | 14 | - pci_print_aer() is used by GHES (aer_recover_work_func()) and CXL 15 | (cxl_handle_rdport_errors()) 16 | 17 | Both use __aer_print_error() to print the AER error bits. Previously 18 | __aer_print_error() also incremented the AER statistics via 19 | pci_dev_aer_stats_incr(). 20 | 21 | Call pci_dev_aer_stats_incr() early in the entry points instead of in 22 | __aer_print_error() so we update the statistics even if the actual printing 23 | of error bits is rate limited by a future change. 24 | 25 | Signed-off-by: Bjorn Helgaas 26 | Tested-by: Krzysztof Wilczyński 27 | Reviewed-by: Ilpo Järvinen 28 | Reviewed-by: Kuppuswamy Sathyanarayanan 29 | Reviewed-by: Jonathan Cameron 30 | Link: https://patch.msgid.link/20250522232339.1525671-11-helgaas@kernel.org 31 | (cherry picked from commit 88a7765e62b9e4c79c7ca2c7b749ae04f54a5668) 32 | --- 33 | drivers/pci/pcie/aer.c | 5 ++++- 34 | 1 file changed, 4 insertions(+), 1 deletion(-) 35 | 36 | diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c 37 | index 7d7fc4a9fec2..48a33151d145 100644 38 | --- a/drivers/pci/pcie/aer.c 39 | +++ b/drivers/pci/pcie/aer.c 40 | @@ -694,7 +694,6 @@ static void __aer_print_error(struct pci_dev *dev, 41 | pci_printk(level, dev, " [%2d] %-22s%s\n", i, errmsg, 42 | info->first_error == i ? " (First)" : ""); 43 | } 44 | - pci_dev_aer_stats_incr(dev, info); 45 | } 46 | 47 | void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) 48 | @@ -703,6 +702,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) 49 | int id = pci_dev_id(dev); 50 | const char *level; 51 | 52 | + pci_dev_aer_stats_incr(dev, info); 53 | + 54 | if (!info->status) { 55 | pci_err(dev, "PCIe Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n", 56 | aer_error_severity_string[info->severity]); 57 | @@ -783,6 +784,8 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity, 58 | info.status = status; 59 | info.mask = mask; 60 | 61 | + pci_dev_aer_stats_incr(dev, &info); 62 | + 63 | layer = AER_GET_LAYER_ERROR(aer_severity, status); 64 | agent = AER_GET_AGENT(aer_severity, status); 65 | 66 | -- 67 | 2.47.0 68 | 69 | -------------------------------------------------------------------------------- /patches-sonic/0055-platform-mellanox-Downstream-Add-support-DGX-flavor-.patch: -------------------------------------------------------------------------------- 1 | From 817b5cfab9f1eef11a244020caf1987bb37f682e Mon Sep 17 00:00:00 2001 2 | From: Oleksandr Shamray 3 | Date: Mon, 9 Dec 2024 13:38:05 +0200 4 | Subject: [PATCH 55/78] platform: mellanox: Downstream: Add support DGX flavor 5 | of next-generation 800GB/s ethernet switch. 6 | MIME-Version: 1.0 7 | Content-Type: text/plain; charset=UTF-8 8 | Content-Transfer-Encoding: 8bit 9 | 10 | This system is based on Nvidia SN5600 Spectrum™-4 Based 64x800Gb/s ETH Switch System, with the 11 | following key changes: 12 | 13 | Key changes: 14 | - New Power Supply: AC/DC PSUs power repaced by rack busbar input power ORv3 DC 48V-54V. 15 | - Dimensions MGX/DGX 1U compliance Tool-less top cover (fast cover opening with no scre 16 | 17 | Signed-off-by: Oleksandr Shamray 18 | --- 19 | drivers/platform/mellanox/mlx-platform.c | 28 ++++++++++++++++++++++++++++ 20 | 1 file changed, 28 insertions(+) 21 | 22 | diff --git a/drivers/platform/mellanox/mlx-platform.c b/drivers/platform/mellanox/mlx-platform.c 23 | index de3dbaf..3472c99 100644 24 | --- a/drivers/platform/mellanox/mlx-platform.c 25 | +++ b/drivers/platform/mellanox/mlx-platform.c 26 | @@ -7871,6 +7871,27 @@ static int __init mlxplat_dmi_ng800_matched(const struct dmi_system_id *dmi) 27 | return mlxplat_register_platform_device(); 28 | } 29 | 30 | +static int __init mlxplat_dmi_ng800_dgx_matched(const struct dmi_system_id *dmi) 31 | +{ 32 | + int i; 33 | + 34 | + mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; 35 | + mlxplat_mux_num = ARRAY_SIZE(mlxplat_ng800_mux_data); 36 | + mlxplat_mux_data = mlxplat_ng800_mux_data; 37 | + mlxplat_hotplug = &mlxplat_mlxcpld_dgx_ext_data; 38 | + mlxplat_hotplug->deferred_nr = 39 | + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 40 | + mlxplat_led = &mlxplat_default_ng_led_data; 41 | + mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; 42 | + mlxplat_fan = &mlxplat_default_fan_data; 43 | + for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) 44 | + mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; 45 | + mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; 46 | + mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_ng400; 47 | + 48 | + return mlxplat_register_platform_device(); 49 | +} 50 | + 51 | static int __init mlxplat_dmi_l1_switch_matched(const struct dmi_system_id *dmi) 52 | { 53 | int i; 54 | @@ -8072,6 +8093,13 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { 55 | }, 56 | }, 57 | { 58 | + .callback = mlxplat_dmi_ng800_dgx_matched, 59 | + .matches = { 60 | + DMI_MATCH(DMI_BOARD_NAME, "VMOD0013"), 61 | + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "HI174"), 62 | + }, 63 | + }, 64 | + { 65 | .callback = mlxplat_dmi_ng800_matched, 66 | .matches = { 67 | DMI_MATCH(DMI_BOARD_NAME, "VMOD0013"), 68 | -- 69 | 2.8.4 70 | 71 | -------------------------------------------------------------------------------- /patches-sonic/0003-PCI-AER-Trace-error-event-before-ratelimiting.patch: -------------------------------------------------------------------------------- 1 | From b6cbde42bc2406d734511a7b28499f9fda4fd91c Mon Sep 17 00:00:00 2001 2 | From: Bjorn Helgaas 3 | Date: Thu, 22 May 2025 18:21:17 -0500 4 | Subject: [PATCH 03/12] PCI/AER: Trace error event before ratelimiting 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | As with the AER statistics, we always want to emit trace events, even if 10 | the actual dmesg logging is rate limited. 11 | 12 | Call trace_aer_event() immediately after pci_dev_aer_stats_incr() so both 13 | happen before ratelimiting. 14 | 15 | Signed-off-by: Bjorn Helgaas 16 | Tested-by: Krzysztof Wilczyński 17 | Reviewed-by: Ilpo Järvinen 18 | Reviewed-by: Kuppuswamy Sathyanarayanan 19 | Link: https://patch.msgid.link/20250522232339.1525671-12-helgaas@kernel.org 20 | (cherry picked from commit 6bb4befbd65fa7f99688fb707e376637e5acfe36) 21 | --- 22 | drivers/pci/pcie/aer.c | 10 ++++------ 23 | 1 file changed, 4 insertions(+), 6 deletions(-) 24 | 25 | diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c 26 | index 48a33151d145..6fc993d05647 100644 27 | --- a/drivers/pci/pcie/aer.c 28 | +++ b/drivers/pci/pcie/aer.c 29 | @@ -703,6 +703,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) 30 | const char *level; 31 | 32 | pci_dev_aer_stats_incr(dev, info); 33 | + trace_aer_event(pci_name(dev), (info->status & ~info->mask), 34 | + info->severity, info->tlp_header_valid, &info->tlp); 35 | 36 | if (!info->status) { 37 | pci_err(dev, "PCIe Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n", 38 | @@ -730,9 +732,6 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) 39 | out: 40 | if (info->id && info->error_dev_num > 1 && info->id == id) 41 | pci_err(dev, " Error of this Agent is reported first\n"); 42 | - 43 | - trace_aer_event(pci_name(dev), (info->status & ~info->mask), 44 | - info->severity, info->tlp_header_valid, &info->tlp); 45 | } 46 | 47 | static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) 48 | @@ -785,6 +784,8 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity, 49 | info.mask = mask; 50 | 51 | pci_dev_aer_stats_incr(dev, &info); 52 | + trace_aer_event(pci_name(dev), (status & ~mask), 53 | + aer_severity, tlp_header_valid, &aer->header_log); 54 | 55 | layer = AER_GET_LAYER_ERROR(aer_severity, status); 56 | agent = AER_GET_AGENT(aer_severity, status); 57 | @@ -800,9 +801,6 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity, 58 | 59 | if (tlp_header_valid) 60 | __print_tlp_header(dev, &aer->header_log); 61 | - 62 | - trace_aer_event(pci_name(dev), (status & ~mask), 63 | - aer_severity, tlp_header_valid, &aer->header_log); 64 | } 65 | EXPORT_SYMBOL_NS_GPL(pci_print_aer, CXL); 66 | 67 | -- 68 | 2.47.0 69 | 70 | -------------------------------------------------------------------------------- /patches-sonic/driver-support-optoe-twoaddr-a2h-access.patch: -------------------------------------------------------------------------------- 1 | From 23a58d78c8c12b0092e1dfded96e6d648bffe1de Mon Sep 17 00:00:00 2001 2 | From: Jemston Fernando 3 | Date: Thu, 25 Nov 2021 04:30:04 -0800 4 | Subject: [PATCH] A2h access for optoe2 even when DDM is unsupported 5 | 6 | Enable 0x51 (A2h) access for optoe2 even when DDM is unsupported, for 7 | accessing vendor specific fields. Some SFP optics that do not support DDM 8 | can have vendor specific implementation via 0x51 in A2h register space 9 | (eg. Mailbox Registers). 10 | 11 | Removed the DDM support check for optoe2 (TWO_ADDR) and now its EEPROM 12 | size is 512 bytes minimum. Return error when accessing beyond 256 bytes 13 | for optics that do not support I2C address 0x51. 14 | 15 | Signed-off-by: Jemston Fernando 16 | --- 17 | drivers/misc/eeprom/optoe.c | 23 +++-------------------- 18 | 1 file changed, 3 insertions(+), 20 deletions(-) 19 | 20 | diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c 21 | index a7554e9..6229439 100644 22 | --- a/drivers/misc/eeprom/optoe.c 23 | +++ b/drivers/misc/eeprom/optoe.c 24 | @@ -174,8 +174,6 @@ struct optoe_platform_data { 25 | #define CMIS_NOT_PAGEABLE (1<<7) 26 | #define TWO_ADDR_PAGEABLE_REG 0x40 27 | #define TWO_ADDR_PAGEABLE (1<<4) 28 | -#define TWO_ADDR_0X51_REG 92 29 | -#define TWO_ADDR_0X51_SUPP (1<<6) 30 | #define OPTOE_ID_REG 0 31 | #define OPTOE_READ_OP 0 32 | #define OPTOE_WRITE_OP 1 33 | @@ -593,8 +591,8 @@ static ssize_t optoe_page_legal(struct optoe_data *optoe, 34 | return -EINVAL; 35 | if (optoe->dev_class == TWO_ADDR) { 36 | /* SFP case */ 37 | - /* if only using addr 0x50 (first 256 bytes) we're good */ 38 | - if ((off + len) <= TWO_ADDR_NO_0X51_SIZE) 39 | + /* if access is within addr 0x50 or first page of 0x51 (first 512 bytes) we're good */ 40 | + if ((off + len) <= TWO_ADDR_EEPROM_UNPAGED_SIZE) 41 | return len; 42 | /* if offset exceeds possible pages, we're not good */ 43 | if (off >= TWO_ADDR_EEPROM_SIZE) 44 | @@ -611,22 +609,7 @@ static ssize_t optoe_page_legal(struct optoe_data *optoe, 45 | /* pages not supported, trim len to unpaged size */ 46 | if (off >= TWO_ADDR_EEPROM_UNPAGED_SIZE) 47 | return OPTOE_EOF; 48 | - 49 | - /* will be accessing addr 0x51, is that supported? */ 50 | - /* byte 92, bit 6 implies DDM support, 0x51 support */ 51 | - status = optoe_eeprom_read(optoe, client, ®val, 52 | - TWO_ADDR_0X51_REG, 1); 53 | - if (status < 0) 54 | - return status; 55 | - if (regval & TWO_ADDR_0X51_SUPP) { 56 | - /* addr 0x51 is OK */ 57 | - maxlen = TWO_ADDR_EEPROM_UNPAGED_SIZE - off; 58 | - } else { 59 | - /* addr 0x51 NOT supported, trim to 256 max */ 60 | - if (off >= TWO_ADDR_NO_0X51_SIZE) 61 | - return OPTOE_EOF; 62 | - maxlen = TWO_ADDR_NO_0X51_SIZE - off; 63 | - } 64 | + maxlen = TWO_ADDR_EEPROM_UNPAGED_SIZE - off; 65 | } 66 | len = (len > maxlen) ? maxlen : len; 67 | dev_dbg(&client->dev, 68 | -- 69 | 2.7.4 70 | 71 | -------------------------------------------------------------------------------- /patches-sonic/0005-dts-ac5-marvell-Add-switching-watchdog-node.patch: -------------------------------------------------------------------------------- 1 | From: Pavan Naregundi 2 | Date: Wed, 6 Mar 2024 06:34:40 +0000 3 | Subject: dts: ac5: marvell: Add switching/watchdog node 4 | 5 | This patch adds following changes to 98DX25xx and 98DX35xx SoC, 6 | - SDMA(Subsystem DMA engine) node for control path Rx/Tx. 7 | - prestera node for interupt handing from switching ASIC. 8 | - arm watchdog node. 9 | - clock-frequency in timer node. 10 | - ac5-ehci compatible string in usb. 11 | 12 | Signed-off-by: Yuval Shaia 13 | Tested-by: Raz Adashi 14 | Reviewed-by: Raz Adashi 15 | 16 | Signed-off-by: Pavan Naregundi 17 | --- 18 | arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi | 14 +++++++++++++- 19 | arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts | 10 +++++++++- 20 | 2 files changed, 22 insertions(+), 2 deletions(-) 21 | 22 | diff --git a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 23 | index 21ef78f8c..3c01fdc35 100644 24 | --- a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 25 | +++ b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 26 | @@ -64,6 +64,7 @@ timer { 27 | , 28 | , 29 | ; 30 | + clock-frequency = <25000000>; 31 | }; 32 | 33 | pmu { 34 | @@ -258,7 +259,7 @@ eth1: ethernet@24000 { 35 | }; 36 | 37 | usb0: usb@80000 { 38 | - compatible = "marvell,orion-ehci"; 39 | + compatible = "marvell,ac5-ehci", "marvell,orion-ehci"; 40 | reg = <0x0 0x80000 0x0 0x500>; 41 | interrupts = ; 42 | status = "disabled"; 43 | @@ -329,6 +330,17 @@ nand: nand-controller@805b0000 { 44 | status = "disabled"; 45 | }; 46 | 47 | + prestera { 48 | + compatible = "marvell,armada-ac5-switch"; 49 | + interrupts = ; 50 | + status = "okay"; 51 | + }; 52 | + 53 | + wdog { 54 | + compatible = "arm,smc-wdt"; 55 | + status = "okay"; 56 | + }; 57 | + 58 | gic: interrupt-controller@80600000 { 59 | compatible = "arm,gic-v3"; 60 | #interrupt-cells = <3>; 61 | diff --git a/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts b/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts 62 | index 0c973d7a2..68887449a 100644 63 | --- a/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts 64 | +++ b/arch/arm64/boot/dts/marvell/ac5-98dx35xx-rd.dts 65 | @@ -29,7 +29,7 @@ aliases { 66 | 67 | memory@0 { 68 | device_type = "memory"; 69 | - reg = <0x2 0x00000000 0x0 0x40000000>; 70 | + reg = <0x2 0x00000000 0x1 0x00000000>; 71 | }; 72 | 73 | usb1phy: usb-phy { 74 | @@ -103,3 +103,11 @@ parition@2 { 75 | &sdhci { 76 | status = "okay"; 77 | }; 78 | + 79 | +/{ 80 | + sdma_drv { 81 | + compatible = "marvell,mvppnd"; 82 | + interrupts = ; 83 | + status = "okay"; 84 | + }; 85 | +}; 86 | -- 87 | 2.25.1 88 | 89 | -------------------------------------------------------------------------------- /patches-sonic/cisco-npu-disable-other-bars.patch: -------------------------------------------------------------------------------- 1 | From 5b025a4732297147ec5c264225e1ffb50a09bfe5 Mon Sep 17 00:00:00 2001 2 | From: Madhava Reddy Siddareddygari 3 | Date: Wed, 1 Dec 2021 13:59:29 -0800 4 | Subject: [PATCH] NPU disable unused PCI BAR's 5 | 6 | For Cisco Network Processing Unit ASIC only BAR0 is valid. 7 | Not disabling other BAR's was resulting in pci_enable_device 8 | function failure in P0 Pacific ASIC's. Further debugging and 9 | consultion with Hardware team, issue seems to be related to 10 | only P0 version of ASIC and workaround suggested is to disable 11 | unused PCI BAR. 12 | 13 | This patch disables unused PCI BAR of NPU ASIC. 14 | 15 | NPU is commonly used name for the packet forwarding ASIC's. 16 | 17 | Signed-off-by: Madhava Reddy Siddareddygari 18 | --- 19 | drivers/pci/quirks.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 20 | 1 file changed, 45 insertions(+) 21 | 22 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c 23 | index 16fb3d771..0efe3f62a 100644 24 | --- a/drivers/pci/quirks.c 25 | +++ b/drivers/pci/quirks.c 26 | @@ -6314,3 +6314,48 @@ static void apex_pci_fixup_class(struct pci_dev *pdev) 27 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_GLI, 0x9750, pci_mask_replay_timer_timeout); 28 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_GLI, 0x9755, pci_mask_replay_timer_timeout); 29 | #endif 30 | + 31 | +#define PCI_DEVICE_ID_LEABA_PACIFIC 0xabcd 32 | +#define PCI_DEVICE_ID_LEABA_GIBRALTAR 0xa001 33 | +#define PCI_DEVICE_ID_LEABA_GRAPHENE 0xa003 34 | +#define PCI_DEVICE_ID_LEABA_PALLADIUM 0xa004 35 | +#define PCI_DEVICE_ID_LEABA_ARGON 0xa005 36 | +#define PCI_DEVICE_ID_LEABA_KRYPTON 0xa006 37 | + 38 | +/* 39 | + * For Pacific A0, only BAR 0 is valid 40 | + */ 41 | +static void silicon_one_fixup(struct pci_dev *dev) 42 | +{ 43 | + int i; 44 | + struct resource *r; 45 | + 46 | + for (i = 1; i <= PCI_ROM_RESOURCE; i++) { 47 | + r = &dev->resource[i]; 48 | + if (!r->start && !r->end && !r->flags) 49 | + continue; 50 | + 51 | + pci_info(dev, "Cisco Silicon One BAR %d %pR fixed up\n", i, r); 52 | + r->start = 0; 53 | + r->end = 0; 54 | + r->flags = 0; 55 | + } 56 | + 57 | + dev->class = PCI_CLASS_MEMORY_OTHER << 8; 58 | + pci_info(dev, "Cisco Silicon One class adjusted\n"); 59 | +} 60 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_DEVICE_ID_LEABA_PACIFIC, 61 | + silicon_one_fixup); 62 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_LEABA_PACIFIC, 63 | + silicon_one_fixup); 64 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_LEABA_GIBRALTAR, 65 | + silicon_one_fixup); 66 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_LEABA_GRAPHENE, 67 | + silicon_one_fixup); 68 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_LEABA_PALLADIUM, 69 | + silicon_one_fixup); 70 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_LEABA_ARGON, 71 | + silicon_one_fixup); 72 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_LEABA_KRYPTON, 73 | + silicon_one_fixup); 74 | + 75 | -- 76 | 2.25.1 77 | 78 | -------------------------------------------------------------------------------- /patches-sonic/0027-platform-mellanox-mlx-platform-Change-register-name.patch: -------------------------------------------------------------------------------- 1 | From f6d1e88b0f6809f755fae05b74bafb187db36f64 Mon Sep 17 00:00:00 2001 2 | From: Vadim Pasternak 3 | Date: Fri, 24 Jan 2025 19:26:21 +0200 4 | Subject: [PATCH 27/78] platform: mellanox: mlx-platform: Change register name 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Register 0xd9 was repurposed on new systems. Change its name 10 | to correctly reflect the new functionality. 11 | 12 | Reviewed-by: Felix Radensky 13 | Signed-off-by: Vadim Pasternak 14 | Link: https://lore.kernel.org/r/20250124172632.22437-4-vadimp@nvidia.com 15 | Reviewed-by: Ilpo Järvinen 16 | Signed-off-by: Ilpo Järvinen 17 | --- 18 | drivers/platform/mellanox/mlx-platform.c | 7 +++---- 19 | 1 file changed, 3 insertions(+), 4 deletions(-) 20 | 21 | diff --git a/drivers/platform/mellanox/mlx-platform.c b/drivers/platform/mellanox/mlx-platform.c 22 | index a7a4c7f..6f24de1 100644 23 | --- a/drivers/platform/mellanox/mlx-platform.c 24 | +++ b/drivers/platform/mellanox/mlx-platform.c 25 | @@ -146,7 +146,7 @@ 26 | #define MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET 0xd1 27 | #define MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET 0xd2 28 | #define MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET 0xd3 29 | -#define MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET 0xd9 30 | +#define MLXPLAT_CPLD_LPC_REG_CPLD6_MVER_OFFSET 0xd9 31 | #define MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET 0xdb 32 | #define MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET 0xda 33 | #define MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET 0xdc 34 | @@ -5055,7 +5055,6 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) 35 | case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: 36 | case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: 37 | case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: 38 | - case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: 39 | case MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET: 40 | case MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET: 41 | case MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET: 42 | @@ -5191,7 +5190,7 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) 43 | case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: 44 | case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: 45 | case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: 46 | - case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: 47 | + case MLXPLAT_CPLD_LPC_REG_CPLD6_MVER_OFFSET: 48 | case MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET: 49 | case MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET: 50 | case MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET: 51 | @@ -5348,7 +5347,7 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) 52 | case MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET: 53 | case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: 54 | case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: 55 | - case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: 56 | + case MLXPLAT_CPLD_LPC_REG_CPLD6_MVER_OFFSET: 57 | case MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET: 58 | case MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET: 59 | case MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET: 60 | -- 61 | 2.8.4 62 | 63 | -------------------------------------------------------------------------------- /patches-sonic/cisco-add-support-for-ltc2979-chip.patch: -------------------------------------------------------------------------------- 1 | From b2a01dd5afd900448a31090cded7d9f2a378b990 Mon Sep 17 00:00:00 2001 2 | From: Madhava Reddy Siddareddygari 3 | Date: Sat, 25 Sep 2021 21:58:15 -0700 4 | Subject: [PATCH] hwmon: (pmbus/ltc2978) Add support for new sensor 5 | 6 | Current ltc2978 driver does not have support for device ltc2979. 7 | 8 | Added support for the sensor device ltc2979. 9 | Datasheet for the sensor is at followint path. 10 | www.analog.com/media/en/technical-documentation/data-sheets/2979f.pdf 11 | 12 | This chip is used for voltage sensors on cisco-8000 platform. 13 | 14 | Signed-off-by: Madhava Reddy Siddareddygari 15 | --- 16 | drivers/hwmon/pmbus/ltc2978.c | 9 ++++++++- 17 | 1 file changed, 8 insertions(+), 1 deletion(-) 18 | 19 | diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c 20 | index 94eea2ac6..8cbaf3b83 100644 21 | --- a/drivers/hwmon/pmbus/ltc2978.c 22 | +++ b/drivers/hwmon/pmbus/ltc2978.c 23 | @@ -27,7 +27,7 @@ 24 | #include 25 | #include "pmbus.h" 26 | 27 | -enum chips { ltc2974, ltc2975, ltc2977, ltc2978, ltc2980, ltc3880, ltc3882, 28 | +enum chips { ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980, ltc3880, ltc3882, 29 | ltc3883, ltc3886, ltc3887, ltm2987, ltm4675, ltm4676 }; 30 | 31 | /* Common for all chips */ 32 | @@ -36,6 +36,8 @@ enum chips { ltc2974, ltc2975, ltc2977, ltc2978, ltc2980, ltc3880, ltc3882, 33 | #define LTC2978_MFR_TEMPERATURE_PEAK 0xdf 34 | #define LTC2978_MFR_SPECIAL_ID 0xe7 /* Undocumented on LTC3882 */ 35 | #define LTC2978_MFR_COMMON 0xef 36 | +#define LTC2979_ID_A 0x8060 37 | +#define LTC2979_ID_B 0x8070 38 | 39 | /* LTC2974, LTC2975, LCT2977, LTC2980, LTC2978, and LTM2987 */ 40 | #define LTC2978_MFR_VOUT_MIN 0xfb 41 | @@ -503,6 +505,7 @@ static const struct i2c_device_id ltc2978_id[] = { 42 | {"ltc2975", ltc2975}, 43 | {"ltc2977", ltc2977}, 44 | {"ltc2978", ltc2978}, 45 | + {"ltc2979", ltc2979}, 46 | {"ltc2980", ltc2980}, 47 | {"ltc3880", ltc3880}, 48 | {"ltc3882", ltc3882}, 49 | @@ -569,6 +572,8 @@ static int ltc2978_get_id(struct i2c_client *client) 50 | return ltc2977; 51 | else if (chip_id == LTC2978_ID_REV1 || chip_id == LTC2978_ID_REV2) 52 | return ltc2978; 53 | + else if (chip_id == LTC2979_ID_A || chip_id == LTC2979_ID_B) 54 | + return ltc2979; 55 | else if (chip_id == LTC2980_ID_A || chip_id == LTC2980_ID_B) 56 | return ltc2980; 57 | else if (chip_id == LTC3880_ID) 58 | @@ -668,6 +673,7 @@ static int ltc2978_probe(struct i2c_client *client, 59 | break; 60 | case ltc2977: 61 | case ltc2978: 62 | + case ltc2979: 63 | case ltc2980: 64 | case ltm2987: 65 | info->read_word_data = ltc2978_read_word_data; 66 | @@ -761,6 +767,7 @@ static const struct of_device_id ltc2978_of_match[] = { 67 | { .compatible = "lltc,ltc2975" }, 68 | { .compatible = "lltc,ltc2977" }, 69 | { .compatible = "lltc,ltc2978" }, 70 | + { .compatible = "lltc,ltc2979" }, 71 | { .compatible = "lltc,ltc2980" }, 72 | { .compatible = "lltc,ltc3880" }, 73 | { .compatible = "lltc,ltc3882" }, 74 | -- 75 | 2.26.2.dirty 76 | 77 | -------------------------------------------------------------------------------- /patches-sonic/0001-efi-memattr-Ignore-table-if-the-size-is-clearly-bogus.patch: -------------------------------------------------------------------------------- 1 | From 8fbe4c49c0ccac9a6a3cff35a45fa55d4ae35d6e Mon Sep 17 00:00:00 2001 2 | From: Ard Biesheuvel 3 | Date: Thu, 31 Oct 2024 18:58:23 +0100 4 | Subject: [PATCH] efi/memattr: Ignore table if the size is clearly bogus 5 | 6 | There are reports [0] of cases where a corrupt EFI Memory Attributes 7 | Table leads to out of memory issues at boot because the descriptor size 8 | and entry count in the table header are still used to reserve the entire 9 | table in memory, even though the resulting region is gigabytes in size. 10 | 11 | Given that the EFI Memory Attributes Table is supposed to carry up to 3 12 | entries for each EfiRuntimeServicesCode region in the EFI memory map, 13 | and given that there is no reason for the descriptor size used in the 14 | table to exceed the one used in the EFI memory map, 3x the size of the 15 | entire EFI memory map is a reasonable upper bound for the size of this 16 | table. This means that sizes exceeding that are highly likely to be 17 | based on corrupted data, and the table should just be ignored instead. 18 | 19 | [0] https://bugzilla.suse.com/show_bug.cgi?id=1231465 20 | 21 | Cc: Gregory Price 22 | Cc: Usama Arif 23 | Acked-by: Jiri Slaby 24 | Acked-by: Breno Leitao 25 | Link: https://lore.kernel.org/all/20240912155159.1951792-2-ardb+git@google.com/ 26 | Signed-off-by: Ard Biesheuvel 27 | --- 28 | drivers/firmware/efi/memattr.c | 18 +++++++++++++++++- 29 | 1 file changed, 17 insertions(+), 1 deletion(-) 30 | 31 | diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c 32 | index 164203429fa7a3..c38b1a335590d4 100644 33 | --- a/drivers/firmware/efi/memattr.c 34 | +++ b/drivers/firmware/efi/memattr.c 35 | @@ -22,6 +22,7 @@ unsigned long __ro_after_init efi_mem_attr_table = EFI_INVALID_TABLE_ADDR; 36 | int __init efi_memattr_init(void) 37 | { 38 | efi_memory_attributes_table_t *tbl; 39 | + unsigned long size; 40 | 41 | if (efi_mem_attr_table == EFI_INVALID_TABLE_ADDR) 42 | return 0; 43 | @@ -39,7 +40,22 @@ int __init efi_memattr_init(void) 44 | goto unmap; 45 | } 46 | 47 | - tbl_size = sizeof(*tbl) + tbl->num_entries * tbl->desc_size; 48 | + 49 | + /* 50 | + * Sanity check: the Memory Attributes Table contains up to 3 entries 51 | + * for each entry of type EfiRuntimeServicesCode in the EFI memory map. 52 | + * So if the size of the table exceeds 3x the size of the entire EFI 53 | + * memory map, there is clearly something wrong, and the table should 54 | + * just be ignored altogether. 55 | + */ 56 | + size = tbl->num_entries * tbl->desc_size; 57 | + if (size > 3 * efi.memmap.nr_map * efi.memmap.desc_size) { 58 | + pr_warn(FW_BUG "Corrupted EFI Memory Attributes Table detected! (version == %u, desc_size == %u, num_entries == %u)\n", 59 | + tbl->version, tbl->desc_size, tbl->num_entries); 60 | + goto unmap; 61 | + } 62 | + 63 | + tbl_size = sizeof(*tbl) + size; 64 | memblock_reserve(efi_mem_attr_table, tbl_size); 65 | set_bit(EFI_MEM_ATTR, &efi.flags); 66 | 67 | -------------------------------------------------------------------------------- /patches-sonic/cisco-mdio-mux-support-acpi.patch: -------------------------------------------------------------------------------- 1 | From 04be5041b17e03eb5b9ea474431369fa6a76b6b8 Mon Sep 17 00:00:00 2001 2 | 3 | From: Madhava Reddy Siddareddygari 4 | Date: 2021-09-29 13:53:28 -0700 5 | 6 | Subject: [PATCH] support reading mdio config from ACPI tables 7 | 8 | Current mdio-mux does not support reading configuration 9 | from ACPI tables. 10 | 11 | cisco-8000 platform configures mdio phy config through ACPI 12 | tables. 13 | 14 | Added support in the mdio-mux driver to read from ACPI 15 | 16 | Signed-off-by: Madhava Reddy Siddareddygari 17 | --- 18 | drivers/net/mdio/mdio-mux.c | 27 ++++++++++++++++++--------- 19 | 1 file changed, 18 insertions(+), 9 deletions(-) 20 | 21 | diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c 22 | index ccb3ee704..e70c8d36a 100644 23 | --- a/drivers/net/mdio/mdio-mux.c 24 | +++ b/drivers/net/mdio/mdio-mux.c 25 | @@ -101,16 +101,16 @@ int mdio_mux_init(struct device *dev, 26 | struct mii_bus *mux_bus) 27 | { 28 | struct device_node *parent_bus_node; 29 | - struct device_node *child_bus_node; 30 | + struct fwnode_handle *child_bus_node; 31 | int r, ret_val; 32 | struct mii_bus *parent_bus; 33 | struct mdio_mux_parent_bus *pb; 34 | struct mdio_mux_child_bus *cb; 35 | 36 | - if (!mux_node) 37 | - return -ENODEV; 38 | - 39 | if (!mux_bus) { 40 | + if (!mux_node) 41 | + return -ENODEV; 42 | + 43 | parent_bus_node = of_parse_phandle(mux_node, 44 | "mdio-parent-bus", 0); 45 | 46 | @@ -141,16 +141,20 @@ int mdio_mux_init(struct device *dev, 47 | pb->mii_bus = parent_bus; 48 | 49 | ret_val = -ENODEV; 50 | - for_each_available_child_of_node(mux_node, child_bus_node) { 51 | - int v; 52 | + device_for_each_child_node(dev, child_bus_node) { 53 | + u32 v; 54 | + u32 phy_mask; 55 | 56 | - r = of_property_read_u32(child_bus_node, "reg", &v); 57 | + r = fwnode_property_read_u32(child_bus_node, "reg", &v); 58 | if (r) { 59 | dev_err(dev, 60 | "Error: Failed to find reg for child %pOF: %pe\n", 61 | child_bus_node, ERR_PTR(r)); 62 | continue; 63 | } 64 | + r = fwnode_property_read_u32(child_bus_node, "phy_mask", &phy_mask); 65 | + if (r) 66 | + phy_mask = 0; 67 | 68 | cb = devm_kzalloc(dev, sizeof(*cb), GFP_KERNEL); 69 | if (!cb) { 70 | @@ -173,7 +177,12 @@ int mdio_mux_init(struct device *dev, 71 | cb->mii_bus->read_c45 = mdio_mux_read_c45; 72 | if (parent_bus->write_c45) 73 | cb->mii_bus->write_c45 = mdio_mux_write_c45; 74 | - r = of_mdiobus_register(cb->mii_bus, child_bus_node); 75 | + cb->mii_bus->phy_mask = phy_mask; 76 | + if (is_of_node(child_bus_node)) 77 | + r = of_mdiobus_register(cb->mii_bus, to_of_node(child_bus_node)); 78 | + else 79 | + r = mdiobus_register(cb->mii_bus); 80 | + 81 | if (r) { 82 | mdiobus_free(cb->mii_bus); 83 | if (r == -EPROBE_DEFER) { 84 | @@ -199,7 +208,7 @@ int mdio_mux_init(struct device *dev, 85 | 86 | err_loop: 87 | mdio_mux_uninit_children(pb); 88 | - of_node_put(child_bus_node); 89 | + fwnode_handle_put(child_bus_node); 90 | err_pb_kz: 91 | put_device(&parent_bus->dev); 92 | err_parent_bus: 93 | -------------------------------------------------------------------------------- /patches-sonic/driver-arista-restrict-eMMC-drive-to-50Mhz-from-userland.patch: -------------------------------------------------------------------------------- 1 | mmc: restrict eMMC drive to 50Mhz from userland 2 | 3 | This issue was fixed for kernel 3.18 by setting sdhci.debug_quirks2=0x40 4 | from Aboot boot0 (conditionally, for specific Aboot versions). 5 | 6 | For kernel 4.9, however, we need SDHCI_QUIRK2_BROKEN_64_BIT_DMA, which 7 | is also in quirks2. The problem is that debug_quirks2 overwrites whatever 8 | is written to host->quirks2 during device probing (see __sdhci_read_caps). 9 | Since we set both SDHCI_QUIRK_BROKEN_DMA and 10 | SDHCI_QUIRK2_BROKEN_64_BIT_DMA (but the former is in quirks while the 11 | latter is in quirks2) and Aboot overwrites quirks2, we end up with only 12 | SDHCI_QUIRK_BROKEN_DMA being set. This causes some strange behavior with 13 | AMD devices, where the sdhci driver stalls for a while and eventually 14 | falls back to PIO mode. We need both quirk flags to be set in order for 15 | the controller to work in SDMA mode. 16 | 17 | This patch is a workaround for the quirks2 overwrite problem. It adds a 18 | set of new sdhci module parameters (append_quirks and append_quirks2) 19 | that *append* bits (i.e. logical "or") instead of overwriting the 20 | values. Then Aboot can use these parameters instead in order to set 21 | SDHCI_QUIRK2_BROKEN_HS200. Note that both quirk2 flags are set 22 | conditionally and independently by Aboot and the sdhci-pci probe code. 23 | 24 | Advantages of this approach: 25 | * This patch by itself doesn't change any kernel behavior: it just adds 26 | two module parameters that default to zero and will have no effect 27 | unless explicitly set to a different value from outside the driver. 28 | * SDHCI_QUIRK2_BROKEN_HS200 can be still controlled from Aboot and 29 | conditionally (depending on the Aboot version). 30 | * SDHCI_QUIRK2_BROKEN_64_BIT_DMA can be set by the sdhci-pci probing 31 | code, independently of Aboot. 32 | 33 | Signed-off-by: Radu Rendec 34 | Signed-off-by: Samuel Angebault 35 | --- 36 | drivers/mmc/host/sdhci.c | 7 +++++++ 37 | 1 file changed, 7 insertions(+) 38 | 39 | diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c 40 | index b1e1d327c..817934f04 100644 41 | --- a/drivers/mmc/host/sdhci.c 42 | +++ b/drivers/mmc/host/sdhci.c 43 | @@ -45,6 +45,8 @@ 44 | 45 | #define MAX_TUNING_LOOP 40 46 | 47 | +static unsigned int append_quirks; 48 | +static unsigned int append_quirks2; 49 | static unsigned int debug_quirks = 0; 50 | static unsigned int debug_quirks2; 51 | 52 | @@ -3990,6 +3992,9 @@ void __sdhci_read_caps(struct sdhci_host *host, const u16 *ver, 53 | 54 | host->read_caps = true; 55 | 56 | + host->quirks |= append_quirks; 57 | + host->quirks2 |= append_quirks2; 58 | + 59 | if (debug_quirks) 60 | host->quirks = debug_quirks; 61 | 62 | @@ -4850,6 +4855,8 @@ static void __exit sdhci_drv_exit(void) 63 | module_init(sdhci_drv_init); 64 | module_exit(sdhci_drv_exit); 65 | 66 | +module_param(append_quirks, uint, 0444); 67 | +module_param(append_quirks2, uint, 0444); 68 | module_param(debug_quirks, uint, 0444); 69 | module_param(debug_quirks2, uint, 0444); 70 | 71 | -------------------------------------------------------------------------------- /patches-sonic/0004-platform-mellanox-mlxbf-bootctl-use-sysfs_emit-inste.patch: -------------------------------------------------------------------------------- 1 | From 6e425aad9eb78283afa517ef648d7539596bc41b Mon Sep 17 00:00:00 2001 2 | From: Ai Chao 3 | Date: Thu, 16 Jan 2025 16:08:35 +0800 4 | Subject: [PATCH 04/78] platform/mellanox: mlxbf-bootctl: use sysfs_emit() 5 | instead of sprintf() 6 | MIME-Version: 1.0 7 | Content-Type: text/plain; charset=UTF-8 8 | Content-Transfer-Encoding: 8bit 9 | 10 | Follow the advice in Documentation/filesystems/sysfs.rst: 11 | show() should only use sysfs_emit() or sysfs_emit_at() when formatting 12 | the value to be returned to user space. 13 | 14 | Signed-off-by: Ai Chao 15 | Acked-by: Vadim Pasternak 16 | Link: https://lore.kernel.org/r/20250116080836.2890442-1-aichao@kylinos.cn 17 | Reviewed-by: Ilpo Järvinen 18 | Signed-off-by: Ilpo Järvinen 19 | --- 20 | drivers/platform/mellanox/mlxbf-bootctl.c | 14 +++++++------- 21 | 1 file changed, 7 insertions(+), 7 deletions(-) 22 | 23 | diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c 24 | index 7e246dd..e8530ef 100644 25 | --- a/drivers/platform/mellanox/mlxbf-bootctl.c 26 | +++ b/drivers/platform/mellanox/mlxbf-bootctl.c 27 | @@ -177,7 +177,7 @@ static ssize_t post_reset_wdog_show(struct device *dev, 28 | if (ret < 0) 29 | return ret; 30 | 31 | - return sprintf(buf, "%d\n", ret); 32 | + return sysfs_emit(buf, "%d\n", ret); 33 | } 34 | 35 | static ssize_t post_reset_wdog_store(struct device *dev, 36 | @@ -206,7 +206,7 @@ static ssize_t mlxbf_bootctl_show(int smc_op, char *buf) 37 | if (action < 0) 38 | return action; 39 | 40 | - return sprintf(buf, "%s\n", mlxbf_bootctl_action_to_string(action)); 41 | + return sysfs_emit(buf, "%s\n", mlxbf_bootctl_action_to_string(action)); 42 | } 43 | 44 | static int mlxbf_bootctl_store(int smc_op, const char *buf, size_t count) 45 | @@ -274,14 +274,14 @@ static ssize_t lifecycle_state_show(struct device *dev, 46 | * due to using the test bits. 47 | */ 48 | if (test_state) { 49 | - return sprintf(buf, "%s(test)\n", 50 | + return sysfs_emit(buf, "%s(test)\n", 51 | mlxbf_bootctl_lifecycle_states[lc_state]); 52 | } else if (use_dev_key && 53 | (lc_state == MLXBF_BOOTCTL_SB_LIFECYCLE_GA_SECURE)) { 54 | - return sprintf(buf, "Secured (development)\n"); 55 | + return sysfs_emit(buf, "Secured (development)\n"); 56 | } 57 | 58 | - return sprintf(buf, "%s\n", mlxbf_bootctl_lifecycle_states[lc_state]); 59 | + return sysfs_emit(buf, "%s\n", mlxbf_bootctl_lifecycle_states[lc_state]); 60 | } 61 | 62 | static ssize_t secure_boot_fuse_state_show(struct device *dev, 63 | @@ -332,9 +332,9 @@ static ssize_t secure_boot_fuse_state_show(struct device *dev, 64 | else 65 | status = valid ? "Invalid" : "Free"; 66 | } 67 | - buf_len += sprintf(buf + buf_len, "%d:%s ", key, status); 68 | + buf_len += sysfs_emit(buf + buf_len, "%d:%s ", key, status); 69 | } 70 | - buf_len += sprintf(buf + buf_len, "\n"); 71 | + buf_len += sysfs_emit(buf + buf_len, "\n"); 72 | 73 | return buf_len; 74 | } 75 | -- 76 | 2.8.4 77 | 78 | -------------------------------------------------------------------------------- /patches-sonic/0002-arm64-dts-Update-cache-properties-for-marvell.patch: -------------------------------------------------------------------------------- 1 | From: Pierre Gondois 2 | Date: Mon, 31 Oct 2022 10:20:16 +0100 3 | arm64: dts: Update cache properties for marvell 4 | 5 | The DeviceTree Specification v0.3 specifies that the cache node 6 | 'compatible' and 'cache-level' properties are 'required'. Cf. 7 | s3.8 Multi-level and Shared Cache Nodes 8 | 9 | The recently added init_of_cache_level() function checks 10 | these properties. Add them if missing. 11 | 12 | Signed-off-by: Pierre Gondois 13 | Reviewed-by: Chris Packham 14 | Signed-off-by: Gregory CLEMENT 15 | --- 16 | arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi | 1 + 17 | arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi | 1 + 18 | arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi | 2 ++ 19 | arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi | 2 ++ 20 | 4 files changed, 6 insertions(+) 21 | 22 | diff --git a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 23 | index 44ed6f963..7308f7b6b 100644 24 | --- a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 25 | +++ b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi 26 | @@ -49,6 +49,7 @@ cpu1: cpu@1 { 27 | 28 | l2: l2-cache { 29 | compatible = "cache"; 30 | + cache-level = <2>; 31 | }; 32 | }; 33 | 34 | diff --git a/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi 35 | index fcab5173f..990f70303 100644 36 | --- a/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi 37 | +++ b/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi 38 | @@ -51,6 +51,7 @@ l2: l2-cache { 39 | cache-size = <0x80000>; 40 | cache-line-size = <64>; 41 | cache-sets = <512>; 42 | + cache-level = <2>; 43 | }; 44 | }; 45 | 46 | diff --git a/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi 47 | index 3db427122..a7b8e001c 100644 48 | --- a/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi 49 | +++ b/arch/arm64/boot/dts/marvell/armada-ap806-quad.dtsi 50 | @@ -81,6 +81,7 @@ l2_0: l2-cache0 { 51 | cache-size = <0x80000>; 52 | cache-line-size = <64>; 53 | cache-sets = <512>; 54 | + cache-level = <2>; 55 | }; 56 | 57 | l2_1: l2-cache1 { 58 | @@ -88,6 +89,7 @@ l2_1: l2-cache1 { 59 | cache-size = <0x80000>; 60 | cache-line-size = <64>; 61 | cache-sets = <512>; 62 | + cache-level = <2>; 63 | }; 64 | }; 65 | }; 66 | diff --git a/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi b/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi 67 | index 68782f161..7740098fd 100644 68 | --- a/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi 69 | +++ b/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi 70 | @@ -81,6 +81,7 @@ l2_0: l2-cache0 { 71 | cache-size = <0x80000>; 72 | cache-line-size = <64>; 73 | cache-sets = <512>; 74 | + cache-level = <2>; 75 | }; 76 | 77 | l2_1: l2-cache1 { 78 | @@ -88,6 +89,7 @@ l2_1: l2-cache1 { 79 | cache-size = <0x80000>; 80 | cache-line-size = <64>; 81 | cache-sets = <512>; 82 | + cache-level = <2>; 83 | }; 84 | }; 85 | }; 86 | -- 87 | 2.25.1 88 | 89 | --------------------------------------------------------------------------------