[Marvell-arm64] Support lazy install of sdk drivers (#17135)

* Support lazy install of sdk drivers

This patch adds support for lazy install of Marvell prestera SDK
drivers for platform-nokia. Lazy install for drivers is added as
updated sdk driver needs to classify the drivers required for platform
during compile time. SDK drivers and platform files are now fetched
from a submodule(mrvl-prestera).

Additionaly, DTB required for sonic_fit creation during compile time
is sourced from sonic-linux-kernel.

Signed-off-by: Pavan Naregundi <pnaregundi@marvell.com>

* Add hugepage cmdline agrument

Updated sdk & driver requries hugepage to be reserved during kernel
boot. These kernel command line agrument are passed from installer.conf
in device folder.

Signed-off-by: Pavan Naregundi <pnaregundi@marvell.com>

* Update SAI deb to 1.12.0-3

Signed-off-by: Pavan Naregundi <pnaregundi@marvell.com>

---------

Signed-off-by: Pavan Naregundi <pnaregundi@marvell.com>
This commit is contained in:
Pavan Naregundi 2023-11-16 18:54:53 +05:30 committed by GitHub
parent 60dc4d2e89
commit fdf54a01cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 29 additions and 129 deletions

3
.gitmodules vendored
View File

@ -122,3 +122,6 @@
[submodule "src/dhcpmon"] [submodule "src/dhcpmon"]
path = src/dhcpmon path = src/dhcpmon
url = https://github.com/sonic-net/sonic-dhcpmon.git url = https://github.com/sonic-net/sonic-dhcpmon.git
[submodule "platform/marvell-arm64/mrvl-prestera"]
path = platform/marvell-arm64/mrvl-prestera
url = https://github.com/Marvell-switching/mrvl-prestera.git

View File

@ -1 +1,2 @@
VAR_LOG_SIZE=4096 VAR_LOG_SIZE=4096
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="default_hugepagesz=32M hugepages=4 loglevel=4"

@ -0,0 +1 @@
Subproject commit a5e93cbd8d90c767891e9ad56447b1047cfa558a

View File

@ -1,11 +1,8 @@
# Marvell Prestera # Marvell Prestera platform package
export MRVL_PRESTERA_VER = 1.0 export MRVL_PRESTERA_VER = 1.0
export MRVL_PRESTERA = mrvlprestera_$(MRVL_PRESTERA_VER)_$(PLATFORM_ARCH) export MRVL_PRESTERA = mrvlprestera_$(MRVL_PRESTERA_VER)_$(PLATFORM_ARCH)
export MRVL_PRESTERA_DEB = $(MRVL_PRESTERA).deb export MRVL_PRESTERA_DEB = $(MRVL_PRESTERA).deb
export MRVL_PRESTERA_SRC_URL = https://github.com/Marvell-switching/mrvl-prestera.git
export MRVL_PRESTERA_SRC_TAG = MRVL_PRESTERA_DRIVER_1.3
$(MRVL_PRESTERA_DEB)_SRC_PATH = $(PLATFORM_PATH)/prestera $(MRVL_PRESTERA_DEB)_SRC_PATH = $(PLATFORM_PATH)/mrvl-prestera
$(MRVL_PRESTERA_DEB)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(MRVL_PRESTERA_DEB)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
SONIC_DPKG_DEBS += $(MRVL_PRESTERA_DEB) SONIC_DPKG_DEBS += $(MRVL_PRESTERA_DEB)

View File

@ -48,7 +48,7 @@ else
fit_addr=0x8000000 fit_addr=0x8000000
initrd_addr=0x2000000 initrd_addr=0x2000000
fdt_fname="/boot/armada-7020-comexpress.dtb" fdt_fname="/usr/lib/linux-image-$kernel_version/marvell/armada-7020-comexpress.dtb"
FW_ENV_DEFAULT='/dev/mtd1 0x0 0x10000 0x100000' FW_ENV_DEFAULT='/dev/mtd1 0x0 0x10000 0x100000'
demo_part=1 demo_part=1
@ -194,8 +194,8 @@ prepare_boot_menu() {
BORDER='echo "---------------------------------------------------";echo;' BORDER='echo "---------------------------------------------------";echo;'
fw_setenv ${FW_ARG} print_menu $BORDER $BOOT1 $BOOT2 $BOOT3 $BORDER > /dev/null fw_setenv ${FW_ARG} print_menu $BORDER $BOOT1 $BOOT2 $BOOT3 $BORDER > /dev/null
fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG ${extra_cmdline_linux} loglevel=4" > /dev/null fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG ${ONIE_PLATFORM_EXTRA_CMDLINE_LINUX}" > /dev/null
fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG loglevel=4" > /dev/null fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS systemd.unified_cgroup_hierarchy=0 varlog_size=$VAR_LOG ${ONIE_PLATFORM_EXTRA_CMDLINE_LINUX}" > /dev/null
sonic_bootargs_old='setenv bootargs root='$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs_old}' sonic_bootargs_old='setenv bootargs root='$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,${baudrate} ${othbootargs} ${mtdparts} ${linuxargs_old}'
fw_setenv ${FW_ARG} sonic_bootargs_old $sonic_bootargs_old > /dev/null || true fw_setenv ${FW_ARG} sonic_bootargs_old $sonic_bootargs_old > /dev/null || true
sonic_boot_load_old=$(fw_printenv -n sonic_boot_load || true) sonic_boot_load_old=$(fw_printenv -n sonic_boot_load || true)

View File

@ -1,5 +0,0 @@
mrvlprestera (1.0) unstable; urgency=low
* Prestera switch driver
-- Marvell <pnaregundi@marvell.com> Fri, 19 Feb 2021 10:39:18 +0800

View File

@ -1 +0,0 @@
9

View File

@ -1,15 +0,0 @@
Source: mrvlprestera
Section: unknown
Priority: optional
Maintainer: Marvell <pnaregundi@marvell.com>
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.6
Homepage: <insert the upstream URL, if relevant>
#Vcs-Git: git://anonscm.debian.org/collab-maint/mrvlprestera.git
#Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/mrvlprestera.git
Package: mrvlprestera
Architecture: arm64
Homepage: <insert the upstream URL, if relevant>
Description:
kernel modules for prestera switch driver

View File

@ -1,3 +0,0 @@
mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers/mvMbusDrv.ko /lib/modules/KVERSION/kernel/extra
mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers/mvIntDrv.ko /lib/modules/KVERSION/kernel/extra
mrvl-prestera/platform/arm64/* /

View File

@ -1,56 +0,0 @@
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
PACKAGE_PRE_NAME := mrvlprestera
ifneq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= $(shell uname -r)
endif
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIR := mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers
%:
dh $@ --with systemd,python2,python3 --buildsystem=pybuild
clean:
dh_testdir
dh_testroot
dh_clean
build:
# get sources
rm -rf mrvl-prestera || true
git clone ${MRVL_PRESTERA_SRC_URL}
cd mrvl-prestera && git checkout ${MRVL_PRESTERA_SRC_TAG} && cd ..
sed "s/KVERSION/${KVERSION}/g" /sonic/platform/marvell-arm64/prestera/debian/mrvlprestera.install.template > /sonic/platform/marvell-arm64/prestera/debian/mrvlprestera.install
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$(MODULE_DIR)/
binary: binary-arch binary-indep
# Nothing to do
binary-arch:
# Nothing to do
binary-indep:
dh_testdir
dh_installdirs
# Resuming debhelper scripts
dh_testroot
dh_install
dh_installchangelogs
dh_installdocs
dh_systemd_enable
dh_installinit
dh_systemd_start
dh_link
dh_fixperms
dh_compress
dh_strip
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
.PHONY: build binary binary-arch binary-indep clean

View File

@ -5,7 +5,7 @@ include $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.mk
include $(PLATFORM_PATH)/docker-saiserver-mrvl.mk include $(PLATFORM_PATH)/docker-saiserver-mrvl.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/prestera.mk include $(PLATFORM_PATH)/mrvl-prestera.mk
include $(PLATFORM_PATH)/platform-nokia.mk include $(PLATFORM_PATH)/platform-nokia.mk
SONIC_ALL += $(SONIC_ONE_IMAGE) \ SONIC_ALL += $(SONIC_ONE_IMAGE) \

View File

@ -1,6 +1,6 @@
# Marvell SAI # Marvell SAI
export MRVL_SAI_VERSION = 1.11.0-1 export MRVL_SAI_VERSION = 1.12.0-3
export MRVL_SAI = mrvllibsai_$(MRVL_SAI_VERSION)_$(PLATFORM_ARCH).deb export MRVL_SAI = mrvllibsai_$(MRVL_SAI_VERSION)_$(PLATFORM_ARCH).deb
$(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai $(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai

View File

@ -4,9 +4,9 @@
# Load required kernel-mode drivers # Load required kernel-mode drivers
load_kernel_drivers() { load_kernel_drivers() {
echo "Loading Kernel Drivers" echo "Loading Kernel Drivers"
sudo insmod /lib/modules/5.10.0-23-2-arm64/nokia_7215_ixs_a1_cpld.ko sudo insmod /lib/modules/5.10.0-23-2-arm64/kernel/extra/nokia_7215_ixs_a1_cpld.ko
sudo insmod /lib/modules/5.10.0-23-2-arm64/ac5_thermal_sensor.ko sudo insmod /lib/modules/5.10.0-23-2-arm64/kernel/extra/ac5_thermal_sensor.ko
} }
nokia_7215_profile() nokia_7215_profile()

View File

@ -1,33 +0,0 @@
#!/bin/bash
fw_uboot_env_cfg()
{
echo "Setting up U-Boot environment..."
MACH_FILE="/host/machine.conf"
PLATFORM=`sed -n 's/onie_platform=\(.*\)/\1/p' $MACH_FILE`
FW_ENV_DEFAULT='/dev/mtd0 0x400000 0x10000 0x10000'
echo $FW_ENV_DEFAULT > /etc/fw_env.config
}
update_modulelist()
{
MODULE_FILE="/etc/modules-load.d/marvell.conf"
if grep -Fxq "mvMbusDrv" $MODULE_FILE
then
echo "Module list up to date"
else
echo "mvMbusDrv" >> $MODULE_FILE
modprobe mvMbusDrv
fi
}
main()
{
fw_uboot_env_cfg
update_modulelist
}
main $@

View File

@ -11,10 +11,13 @@ ifneq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= $(shell uname -r) KVERSION ?= $(shell uname -r)
endif endif
KERNEL_SRC := /lib/modules/$(KVERSION) KERNEL_SRC := /lib/modules/$(KVERSION)
INSTALL_MOD_DIR := kernel/extra/
MOD_SRC_DIR:= $(shell pwd) MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= 7215 MODULE_DIRS:= 7215
UTILS_DIR := utils UTILS_DIR := utils
MODULE_DIR:= modules MODULE_DIR:= modules
MRVL_MODULE_DIR:= mrvl-modules
PRESTERA_MODULE_SRC := mrvl-prestera/drivers/generic/cpssEnabler/linuxNoKernelModule/drivers
SERVICE_DIR := service SERVICE_DIR := service
PLATFORM_DIR := sonic_platform PLATFORM_DIR := sonic_platform
@ -28,6 +31,12 @@ clean:
build: build:
(for mod in $(MODULE_DIRS); do \ (for mod in $(MODULE_DIRS); do \
cd $(MOD_SRC_DIR)/../$(PRESTERA_MODULE_SRC)/; \
make clean; \
make modules -C $(KERNEL_SRC)/build M=`pwd` CONFIG_KM_MVMBUS=y CONFIG_KM_MVINT=y || exit 1; \
mkdir $(MOD_SRC_DIR)/$${mod}/$(MRVL_MODULE_DIR); \
cp *.ko $(MOD_SRC_DIR)/$${mod}/$(MRVL_MODULE_DIR)/; \
cd $(MOD_SRC_DIR); \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules || exit 1; \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules || exit 1; \
python3 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \ python3 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \
done) done)
@ -50,6 +59,7 @@ binary-indep:
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /lib/systemd/system; \ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /lib/systemd/system; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
cp $(MOD_SRC_DIR)/$${mod}/$(MRVL_MODULE_DIR)/mvcpss.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
python3 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ python3 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
done) done)

View File

@ -1,4 +1,4 @@
7215/scripts/nokia-7215_plt_setup.sh usr/local/bin
7215/scripts/nokia-7215-init.sh usr/local/bin 7215/scripts/nokia-7215-init.sh usr/local/bin
7215/service/nokia-7215init.service etc/systemd/system 7215/service/nokia-7215init.service etc/systemd/system
7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-nokia_ixs7215_52xb-r0 7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-nokia_ixs7215_52xb-r0
../mrvl-prestera/platform/arm64/ac5x/* /

View File

@ -20,8 +20,9 @@ set -e
case "$1" in case "$1" in
configure) configure)
sh /usr/local/bin/nokia-7215_plt_setup.sh
chmod a+x /usr/local/bin/nokia-7215-init.sh chmod a+x /usr/local/bin/nokia-7215-init.sh
depmod -a
systemctl restart kmod
systemctl enable nokia-7215init.service systemctl enable nokia-7215init.service
systemctl start nokia-7215init.service systemctl start nokia-7215init.service

View File

@ -20,7 +20,7 @@
}; };
fdt_ac5x { fdt_ac5x {
description = "Flattened Device Tree blob for AC5x"; description = "Flattened Device Tree blob for AC5x";
data = /incbin/("/boot/ac5x.dtb"); data = /incbin/("/usr/lib/linux-image-5.10.0-23-2-arm64/marvell/ac5-98dx35xx-rd.dtb");
type = "flat_dt"; type = "flat_dt";
arch = "arm64"; arch = "arm64";
compression = "none"; compression = "none";