From 5c5c12afb7d17934da6fe1ae56010c4e0d03ad7d Mon Sep 17 00:00:00 2001 From: Jiping Ma Date: Wed, 6 Mar 2024 07:02:44 +0000 Subject: [PATCH] Switch drivers between OOT and in-tree In order to select between the in-tree and OOT drivers, a cmdline parameter multi-drivers-switch need be used. If cmdline parameter multi-drivers-switch is set to cvl-4.0.1, the OOT drivers will be loaded by "insmod" command before udevd is started, and that ensures that the OOT drivers will be loaded rather than the in-tree drivers. The default drivers will be the in-tree drivers if there is not multi-drivers-switch in the cmdline parameters or it is not set correct because the out-of-tree drivers have been moved to the the "weak-updates" subdirectory, we would like them to have a lower precedence/lower priority than the in-tree versions. Note: The in-tree driver ice will use the OOT ice driver's ice.pkg file, The version is 1.3.30.0. We will wait Intel's test result and give feedback which DDP package should be used for the in-tree drivers, and do the related update. Verification: Switch drivers between the OOT and in-tree drivers. - switch to the OOT drivers 1. Add cmdline parameter multi-drivers-switch=cvl-4.0.1 2. reboot can switch to the OOT drivers. - switch to the in-tree drivers 1. Remove cmdline parameter multi-drivers-switch=cvl-4.0.1 2. reboot can switch to the in-tree drivers. Story: 2011056 Task: 49673 Depends-On: https://review.opendev.org/c/starlingx/tools/+/911401 Change-Id: I9a89d5a541b9da822fe5e079b919df3caf1acffc Signed-off-by: Jiping Ma (cherry picked from commit 8bac1a85a8d2b9ec3212b4afa6e10c149e3aff6e) Signed-off-by: Jiping Ma --- ...pport-OOT-and-In-tree-drivers-switch.patch | 101 ++++++++++++++++++ ostree/initramfs-ostree/debian/patches/series | 1 + 2 files changed, 102 insertions(+) create mode 100644 ostree/initramfs-ostree/debian/patches/0018-Support-OOT-and-In-tree-drivers-switch.patch diff --git a/ostree/initramfs-ostree/debian/patches/0018-Support-OOT-and-In-tree-drivers-switch.patch b/ostree/initramfs-ostree/debian/patches/0018-Support-OOT-and-In-tree-drivers-switch.patch new file mode 100644 index 000000000..d51d3a389 --- /dev/null +++ b/ostree/initramfs-ostree/debian/patches/0018-Support-OOT-and-In-tree-drivers-switch.patch @@ -0,0 +1,101 @@ +From c357f75f321d4f1407db951e7482716acba7412f Mon Sep 17 00:00:00 2001 +From: Jiping Ma +Date: Sun, 3 Mar 2024 22:05:18 -0800 +Subject: [PATCH 18/18] Support OOT and In-tree drivers switch + +In order to select between the in-tree and OOT drivers, a cmdline +parameter multi-drivers-switch need be used. If cmdline parameter +multi-drivers-switch is set to cvl-4.0.1, the OOT drivers will be +loaded by "insmod" command before udevd is started, and that ensures +that the OOT drivers will be loaded rather than the in-tree drivers. + +The default drivers will be the in-tree drivers if there is not +multi-drivers-switch in the cmdline parameters or it is not set +correct, because the out-of-tree drivers have been moved to the +"weak-updates" subdirectory, we would like them to have a lower +precedence/lower priority than the in-tree versions. + +Note: The in-tree drivers will use the OOT drivers' ice.pkg file, +The version is 1.3.30.0. We will wait Intel's test result and give +feedback which DDP package should be used for the in-tree drivers, +and do the related update. + +Signed-off-by: Jiping Ma +--- + init-ostree-install.sh | 23 ++++++++++++----------- + init-ostree.sh | 23 ++++++++++++----------- + 2 files changed, 24 insertions(+), 22 deletions(-) + +diff --git a/init-ostree-install.sh b/init-ostree-install.sh +index 092db4b..c9172de 100644 +--- a/init-ostree-install.sh ++++ b/init-ostree-install.sh +@@ -478,18 +478,19 @@ do_mount_fs() { + } + network_modules() { + if grep -s -q '\smulti-drivers-switch=' /proc/cmdline ; then +- if [ -d /lib/modules/"$(uname -r)"/extra/ice-"${DRIVER_VERSION}" ]; then +- insmod /lib/modules/"$(uname -r)"/extra/ice-"${DRIVER_VERSION}"/ice.ko +- insmod /lib/modules/"$(uname -r)"/extra/i40e-"${DRIVER_VERSION}"/i40e.ko +- insmod /lib/modules/"$(uname -r)"/extra/iavf-"${DRIVER_VERSION}"/iavf.ko +- echo "Legacy NIC ${DRIVER_VERSION} drivers have been activated" +- elif [ -d /lib/modules/"$(uname -r)"/updates/ice-"${DRIVER_VERSION}" ]; then +- insmod /lib/modules/"$(uname -r)"/updates/ice-"${DRIVER_VERSION}"/ice.ko +- insmod /lib/modules/"$(uname -r)"/updates/i40e-"${DRIVER_VERSION}"/i40e.ko +- insmod /lib/modules/"$(uname -r)"/updates/iavf-"${DRIVER_VERSION}"/iavf.ko +- echo "NIC ${DRIVER_VERSION} drivers have been activated" ++ if [ -d /lib/modules/"$(uname -r)"/weak-updates/ice-"${DRIVER_VERSION}" ]; then ++ insmod /lib/modules/"$(uname -r)"/weak-updates/ice-"${DRIVER_VERSION}"/ice.ko ++ insmod /lib/modules/"$(uname -r)"/weak-updates/i40e-"${DRIVER_VERSION}"/i40e.ko ++ insmod /lib/modules/"$(uname -r)"/weak-updates/iavf-"${DRIVER_VERSION}"/iavf.ko ++ echo "OOT NIC ${DRIVER_VERSION} drivers have been activated" ++ else ++ ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg ++ echo "In-tree NIC drivers have been activated" + fi +- fi ++ else ++ ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg ++ echo "In-tree NIC drivers have been activated" ++ fi + } + + disable_lvm() { +diff --git a/init-ostree.sh b/init-ostree.sh +index 32de301..c74f350 100644 +--- a/init-ostree.sh ++++ b/init-ostree.sh +@@ -69,18 +69,19 @@ do_mount_fs() { + + network_modules() { + if grep -s -q '\smulti-drivers-switch=' /proc/cmdline ; then +- if [ -d /lib/modules/"$(uname -r)"/extra/ice-"${DRIVER_VERSION}" ]; then +- insmod /lib/modules/"$(uname -r)"/extra/ice-"${DRIVER_VERSION}"/ice.ko +- insmod /lib/modules/"$(uname -r)"/extra/i40e-"${DRIVER_VERSION}"/i40e.ko +- insmod /lib/modules/"$(uname -r)"/extra/iavf-"${DRIVER_VERSION}"/iavf.ko +- echo "Legacy NIC ${DRIVER_VERSION} drivers have been activated" +- elif [ -d /lib/modules/"$(uname -r)"/updates/ice-"${DRIVER_VERSION}" ]; then +- insmod /lib/modules/"$(uname -r)"/updates/ice-"${DRIVER_VERSION}"/ice.ko +- insmod /lib/modules/"$(uname -r)"/updates/i40e-"${DRIVER_VERSION}"/i40e.ko +- insmod /lib/modules/"$(uname -r)"/updates/iavf-"${DRIVER_VERSION}"/iavf.ko +- echo "NIC ${DRIVER_VERSION} drivers have been activated" ++ if [ -d /lib/modules/"$(uname -r)"/weak-updates/ice-"${DRIVER_VERSION}" ]; then ++ insmod /lib/modules/"$(uname -r)"/weak-updates/ice-"${DRIVER_VERSION}"/ice.ko ++ insmod /lib/modules/"$(uname -r)"/weak-updates/i40e-"${DRIVER_VERSION}"/i40e.ko ++ insmod /lib/modules/"$(uname -r)"/weak-updates/iavf-"${DRIVER_VERSION}"/iavf.ko ++ echo "OOT NIC ${DRIVER_VERSION} drivers have been activated" ++ else ++ ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg ++ echo "In-tree NIC drivers have been activated" + fi +- fi ++ else ++ ln -s /lib/firmware/updates/intel/ice/ddp/ice-*.pkg /lib/firmware/intel/ice/ddp/ice.pkg ++ echo "In-tree NIC drivers have been activated" ++ fi + } + + disable_lvm() { +-- +2.42.0 + diff --git a/ostree/initramfs-ostree/debian/patches/series b/ostree/initramfs-ostree/debian/patches/series index 7127e13ea..95260137c 100644 --- a/ostree/initramfs-ostree/debian/patches/series +++ b/ostree/initramfs-ostree/debian/patches/series @@ -15,3 +15,4 @@ 0015-Support-driver-switch-in-installer.patch 0016-init-ostree-install.sh-skip-eject-operation-through-.patch 0017-Allow-adjusting-boot-order.patch +0018-Support-OOT-and-In-tree-drivers-switch.patch