Since commit 681a67288655 ("usertools: check if module is loaded
before binding") in dpdk, usertools/dpdk-devbind.py only checks
dynamic kernel drivers in /sys/module. So built-in kernel driver
cannot be bound.

Add "usertools-devbind-fix-binding-for-built-in-kernel-dr.patch" to
fix this issue.

Signed-off-by: Yongxin Liu <[email protected]>
---
 ...evbind-fix-binding-for-built-in-kernel-dr.patch | 54 ++++++++++++++++++++++
 recipes-extended/dpdk/dpdk_19.11.5.bb              |  3 +-
 2 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 
recipes-extended/dpdk/dpdk/usertools-devbind-fix-binding-for-built-in-kernel-dr.patch

diff --git 
a/recipes-extended/dpdk/dpdk/usertools-devbind-fix-binding-for-built-in-kernel-dr.patch
 
b/recipes-extended/dpdk/dpdk/usertools-devbind-fix-binding-for-built-in-kernel-dr.patch
new file mode 100644
index 0000000..7eb28f8
--- /dev/null
+++ 
b/recipes-extended/dpdk/dpdk/usertools-devbind-fix-binding-for-built-in-kernel-dr.patch
@@ -0,0 +1,54 @@
+From b2a1d7a4661dc78a4c070de5542bf2c201762cb2 Mon Sep 17 00:00:00 2001
+From: Yongxin Liu <[email protected]>
+Date: Mon, 23 Nov 2020 11:02:52 +0800
+Subject: [PATCH] usertools/devbind: fix binding for built-in kernel drivers
+
+A driver can be loaded as a dynamic module or a built-in module.
+In commit 681a67288655 ("usertools: check if module is loaded
+before binding"), script only checks modules in /sys/module/.
+
+However, for built-in kernel driver, it only shows up in /sys/module/,
+if it has a version or at least one parameter. So add check for
+modules in /lib/modules/$(uname -r)/modules.builtin.
+
+Upstream-Status: Submitted [https://patches.dpdk.org/patch/84454]
+
+Signed-off-by: Yongxin Liu <[email protected]>
+---
+ usertools/dpdk-devbind.py | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
+index b1d149876..89a0ab1c9 100755
+--- a/usertools/dpdk-devbind.py
++++ b/usertools/dpdk-devbind.py
+@@ -8,6 +8,7 @@
+ import os
+ import getopt
+ import subprocess
++import platform
+ from os.path import exists, abspath, dirname, basename
+ 
+ # The PCI base class for all devices
+@@ -172,7 +173,17 @@ def module_is_loaded(module):
+ 
+     loaded_modules = sysfs_mods
+ 
+-    return module in sysfs_mods
++    # add built-in modules as loaded
++    release = platform.uname().release
++    filename = os.path.join("/lib/modules/", release, "modules.builtin")
++    if os.path.exists(filename):
++        try:
++            with open(filename) as f:
++                loaded_modules += [os.path.splitext(os.path.basename(mod))[0] 
for mod in f]
++        except IOError:
++            print("Warning: cannot read list of built-in kernel modules")
++
++    return module in loaded_modules
+ 
+ 
+ def check_modules():
+-- 
+2.14.4
+
diff --git a/recipes-extended/dpdk/dpdk_19.11.5.bb 
b/recipes-extended/dpdk/dpdk_19.11.5.bb
index aedaa8a..60d5786 100644
--- a/recipes-extended/dpdk/dpdk_19.11.5.bb
+++ b/recipes-extended/dpdk/dpdk_19.11.5.bb
@@ -12,7 +12,8 @@ LIC_FILES_CHKSUM = 
"file://license/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4
                     
file://license/lgpl-2.1.txt;md5=4b54a1fd55a448865a0b32d41598759d \
                     
file://license/bsd-3-clause.txt;md5=0f00d99239d922ffd13cabef83b33444"
 
-SRC_URI += 
"file://0001-Starting-from-Linux-5.9-get_user_pages_remote-API-do.patch"
+SRC_URI += 
"file://0001-Starting-from-Linux-5.9-get_user_pages_remote-API-do.patch \
+            file://usertools-devbind-fix-binding-for-built-in-kernel-dr.patch"
 
 do_install_append () {
     # Remove the unneeded dir
-- 
2.14.4

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6839): 
https://lists.yoctoproject.org/g/meta-intel/message/6839
Mute This Topic: https://lists.yoctoproject.org/mt/78768995/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to