[TGL][EHL][ADL] Enable MEI (Intel Management Engine Interface)

Bug #1929894 reported by Chao Qin
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
intel
New
Undecided
Unassigned
Lookout-canyon-series
Fix Released
Undecided
Philip Cox
linux (Ubuntu)
Incomplete
Undecided
Unassigned
Focal
Incomplete
Undecided
Unassigned
linux-intel (Ubuntu)
Won't Fix
Medium
Unassigned
Focal
Won't Fix
Undecided
Unassigned
linux-intel-5.13 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned

Bug Description

Description
Enable MEI (Intel Management Engine Interface)
Host communicates with secured apps in firmware with this interface

Hardware: Tiger Lake/Elkhart Lake/Alder Lake

Target Release: 21.04
Target Kernel: TBD

External links:
https://github.com/intel/linux-intel-quilt/tree/mainline-tracking-v5.11-yocto-210223T083754Z

X-HWE-Bug: Bug #1945464

Revision history for this message
Chao Qin (chaoqin) wrote :

Please find the following patches in the above external link

0001-mei-fix-transfer-over-dma-with-extended-header.security
0002-watchdog-mei_wdt-request-stop-on-unregister.security
0003-mei-hbm-call-mei_set_devstate-on-hbm-stop-respons.security
0004-mei-allow-clients-on-bus-to-communicate-in-remove.security
0005-mei-hbm-drop-hbm-responces-on-shutdown.security
0006-mei-virtio-virtualization-frontend-driver.security
0007-mei-dal-add-dal-module-stub.security
0008-mei-dal-add-acp-parser-code.security
0009-mei-dal-add-bh-plugin-code.security
0010-mei-dal-dynamic-application-loader.security
0011-mei-dal-add-character-device-for-user-space-inter.security
0012-mei-dal-add-kernel-space-interface.security
0013-mei-dal-add-exclusive-access-management.security
0014-mei-dal-make-access-list-global-instead-of-per-de.security
0015-mei-dal-fix-check-for-valid-request-pointer.security
0016-mei-dal-initialize-request-link-list-upon-allocat.security
0017-mei-dal-put-message-into-buffer-in-single-operati.security
0018-mei-dal-dal_wait_for_write-reverse-wake-up-condit.security
0019-mei-dal-move-read-wait-queue-to-the-dal-client-st.security
0020-mei-dal-fix-dal-read-function.security
0021-mei-dal-remove-conn_idx-from-session-commands.security
0022-mei-dal-add-test-module.security
0023-mei-dal-support-3K-key-signature.security
0024-mei-dal-don-t-use-mutex_lock_interruptible-in-rel.security
0025-mei-dal-validated-input-params-in-dal_set_ta_excl.security
0026-mei-dal-set-drvdata-of-mei-before-registering-eve.security
0027-mei-dal-remove-dc-from-writers-list-when-destroye.security

Chao Qin (chaoqin)
no longer affects: ubuntu
Revision history for this message
Stéphane Verdy (sverdy) wrote :

What is the upstreaming status of these patches?

tags: added: lookout-canyon
Changed in linux-intel (Ubuntu):
importance: Undecided → Medium
assignee: nobody → Hsuan-Yu Lin (shanelin)
Brad Figg (brad-figg)
summary: - [TGL][EHL] Enable MEI
+ [TGL][EHL] Enable MEI (Intel Management Engine Interface)
Brad Figg (brad-figg)
Changed in intel:
assignee: nobody → Brad Figg (brad-figg)
Changed in linux-intel (Ubuntu):
assignee: Hsuan-Yu Lin (shanelin) → Brad Figg (brad-figg)
Changed in intel:
status: New → In Progress
Changed in linux-intel (Ubuntu):
status: New → In Progress
Revision history for this message
Brad Figg (brad-figg) wrote : Re: [TGL][EHL] Enable MEI (Intel Management Engine Interface)

Already upstream:

0001-mei-fix-transfer-over-dma-with-extended-header.security
0002-watchdog-mei_wdt-request-stop-on-unregister.security
0003-mei-hbm-call-mei_set_devstate-on-hbm-stop-respons.security
0004-mei-allow-clients-on-bus-to-communicate-in-remove.security
0005-mei-hbm-drop-hbm-responces-on-shutdown.security

The remainder of the patches were committed to focal:linux-intel intel-5.13-next

Changed in intel:
status: In Progress → Fix Committed
Changed in linux-intel (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Anthony Wong (anthonywong) wrote :

Disabled CONFIG_INTEL_MEI_DAL and CONFIG_INTEL_MEI_VIRTIO temporarily in 5.13 tree due to build failure.

Changed in linux-intel (Ubuntu):
status: Fix Committed → Triaged
assignee: Brad Figg (brad-figg) → nobody
Changed in intel:
status: Fix Committed → New
assignee: Brad Figg (brad-figg) → nobody
Jesse Sung (wenchien)
information type: Private → Public
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1929894

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
tags: added: hirsute
Jesse Sung (wenchien)
Changed in linux-intel-5.13 (Ubuntu Focal):
status: New → Fix Committed
Revision history for this message
Chao Qin (chaoqin) wrote (last edit ): Re: [TGL][EHL] Enable MEI (Intel Management Engine Interface)

commits for v5.13 are included in the following

https://github.com/intel/linux-intel-quilt/tree/mainline-tracking-v5.13-yocto-210914T042118Z

0001-mei-virtio-virtualization-frontend-driver.patch
0002-mei-dal-add-dal-module-stub.patch
0003-mei-dal-add-acp-parser-code.patch
0004-mei-dal-add-bh-plugin-code.patch
0005-mei-dal-dynamic-application-loader.patch
0006-mei-dal-add-character-device-for-user-space-interfac.patch
0007-mei-dal-add-kernel-space-interface.patch
0008-mei-dal-add-exclusive-access-management.patch
0009-mei-dal-make-access-list-global-instead-of-per-devic.patch
0010-mei-dal-fix-check-for-valid-request-pointer.patch
0011-mei-dal-initialize-request-link-list-upon-allocation.patch
0012-mei-dal-put-message-into-buffer-in-single-operation.patch
0013-mei-dal-dal_wait_for_write-reverse-wake-up-condition.patch
0014-mei-dal-move-read-wait-queue-to-the-dal-client-struc.patch
0015-mei-dal-fix-dal-read-function.patch
0016-mei-dal-remove-conn_idx-from-session-commands.patch
0017-mei-dal-support-3K-key-signature.patch
0018-mei-dal-don-t-use-mutex_lock_interruptible-in-releas.patch
0019-mei-dal-validated-input-params-in-dal_set_ta_exclusi.patch
0020-mei-dal-set-drvdata-of-mei-before-registering-event-.patch
0021-mei-dal-remove-dc-from-writers-list-when-destroyed.patch
0022-mei-backport-fix-from-5.12.patch

information type: Public → Private
Changed in linux-intel-5.13 (Ubuntu):
status: New → Invalid
Revision history for this message
Kent Lin (kent-jclin) wrote :

@Qin,

Could you please advise how this should be tested and verified?

Revision history for this message
Chao Qin (chaoqin) wrote :

@Kent We've got some test cases internal and I will share them with you when ready.

summary: - [TGL][EHL] Enable MEI (Intel Management Engine Interface)
+ [TGL][EHL][ADL] Enable MEI (Intel Management Engine Interface)
description: updated
tags: added: iotg-adl
description: updated
Revision history for this message
Kent Lin (kent-jclin) wrote :

Test Steps:
1. Install LMS Snap:
- sudo snap install lms
2. Check if lms connect to Intel-MEI
- snap connections lms
3. Check lsm service status:
- sudo systemctl status snap.lms.lms.service

Revision history for this message
Kent Lin (kent-jclin) wrote (last edit ):

Test Result on AAEON EHL Board. Need to check with Intel to see if we miss any steps on comment#9. Or this is good enough.

u@linux:~$ sudo systemctl status snap.lms.lms.service
● snap.lms.lms.service - Service for snap application lms.lms
     Loaded: loaded (/etc/systemd/system/snap.lms.lms.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-10-13 11:07:28 CST; 1min 11s ago
   Main PID: 5021 (lms)
      Tasks: 5 (limit: 18266)
     Memory: 39.2M
     CGroup: /system.slice/snap.lms.lms.service
             └─5021 /snap/lms/34/bin/lms

Oct 13 11:07:28 linux systemd[1]: Started Service for snap application lms.lms.
Oct 13 11:07:30 linux lms.lms[5021]: (140546317167936)[2021-10-13 11:07:30.291521][LM_DEBUG ] BaseWSManClient::WsmanInitializer::WsmanInitializer()
Oct 13 11:07:30 linux lms.lms[5021]: (140546317167936)[2021-10-13 11:07:30.380134][LM_DEBUG ] Starting LMS Service
Oct 13 11:07:30 linux LMS[5021]: Local Management Service started.
Oct 13 11:07:30 linux lms_svc[5021]: me: error: Cannot connect to client [-25]:Inappropriate ioctl for device
Oct 13 11:07:30 linux lms_svc[5021]: me: error: Cannot establish a handle to the Intel MEI driver /dev/mei1 [-2]:No such file or directory
Oct 13 11:07:30 linux lms_svc[5021]: me: error: Cannot establish a handle to the Intel MEI driver /dev/mei2 [-2]:No such file or directory
Oct 13 11:07:30 linux lms_svc[5021]: me: error: Cannot establish a handle to the Intel MEI driver /dev/mei3 [-2]:No such file or directory
Oct 13 11:07:30 linux lms_svc[5021]: (140546122090240)[2021-10-13 11:07:30.408954][LM_WARNING ] Heci init failed, LME doesn't exist. Client not found. /dev/mei0 connect 8 /dev/mei1 init 1 /dev/mei2 init 1>

Revision history for this message
Chao Qin (chaoqin) wrote :

@Kent Could you please check if the following kernel options are enabled in your kernel? It seems like the MEI driver is not probed.

CONFIG_INTEL_MEI=m

CONFIG_INTEL_MEI_ME=m

CONFIG_INTEL_MEI_TXE=m

CONFIG_INTEL_MEI_DAL=m

CONFIG_INTEL_MEI_HDCP=m

CONFIG_INTEL_MEI_IAF=m

Revision history for this message
Kent Lin (kent-jclin) wrote :

@Anthony,
Please help check #11.

Revision history for this message
Anthony Wong (anthonywong) wrote :

linux-intel 1007 has:

CONFIG_INTEL_MEI=m
CONFIG_INTEL_MEI_DAL=m
CONFIG_INTEL_MEI_HDCP=m
CONFIG_INTEL_MEI_ME=m
CONFIG_INTEL_MEI_TXE=m
CONFIG_INTEL_MEI_VIRTIO=m
CONFIG_INTEL_MEI_WDT=m

I can't find INTEL_MEI_IAF is used anywhere. Have we missed any patches?

Revision history for this message
Chao Qin (chaoqin) wrote :

@Anthony Please ignore this kernel option which is added recently and not included in v5.13 release.

@Kent, please check as below and there is only one MEI device on my platform.
root@iotg:/home/seven# lsmod | grep mei
mei_hdcp 20480 0
mei_me 40960 1
mei 139264 3 mei_hdcp,mei_me
root@iotg:/home/seven# ls -l /dev/me
mei0 mem
root@iotg:/home/seven# ls -l /dev/mei*
crw------- 1 root root 241, 0 7月 22 03:00 /dev/mei0
root@iotg:/home/seven#

According to your logs, it seems you need 5 MEI devices attached to the board.

Ana Lasprilla (anamlt)
Changed in linux-intel-5.13 (Ubuntu Focal):
status: Fix Committed → Fix Released
Changed in linux-intel (Ubuntu Focal):
status: New → Won't Fix
Changed in linux-intel (Ubuntu):
status: Triaged → Won't Fix
Changed in linux (Ubuntu):
status: Incomplete → New
Revision history for this message
Chao Qin (chaoqin) wrote :

0001-mei-virtio-virtualization-frontend-driver.patch is upstreamed and the commit ID is d162219c655c8cf8003128a13840d6c1e183fb80

Revision history for this message
Kent Lin (kent-jclin) wrote :
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the linux-intel-iotg-5.15/5.15.0-1002.4~20.04.2 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-focal' to 'verification-done-focal'. If the problem still exists, change the tag 'verification-needed-focal' to 'verification-failed-focal'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-focal
Ana Lasprilla (anamlt)
information type: Private → Public
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1929894

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Changed in linux (Ubuntu Focal):
status: New → Incomplete
Revision history for this message
Philip Cox (philcox) wrote :

@chaoqin @sachin

In the linux-intel-iotg-5.15 kernel, we have the MEI support.

Also, the commit d162219c655c8cf8003128a13840d6c1e183fb80 is in the linux-intel-iotg-5.15 kernel.

Is there anything remaining to be done on this ticket? If not, I'd like to close it off.

ubuntu@adl-s:~$ grep CONFIG_INTEL_MEI /boot/config-5.15.0-1003-intel-iotg
CONFIG_INTEL_MEI=m
CONFIG_INTEL_MEI_ME=m
CONFIG_INTEL_MEI_TXE=m
# CONFIG_INTEL_MEI_VIRTIO is not set
CONFIG_INTEL_MEI_HDCP=m
# CONFIG_INTEL_MEI_DAL is not set
CONFIG_INTEL_MEI_WDT=m
ubuntu@adl-s:~$ lsmod|grep -i mei
mei_hdcp 24576 0
iwlmei 45056 2 iwlmvm,iwlwifi
cfg80211 958464 4 iwlmvm,iwlmei,iwlwifi,mac80211
mei_me 40960 2
mei 135168 5 mei_hdcp,iwlmei,mei_me
ubuntu@adl-s:~$ dmesg|grep -i mei
[ 10.968639] mei_me 0000:00:16.0: enabling device (0000 -> 0002)
[ 11.143843] mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_component_ops [i915])
ubuntu@adl-s:~$

Revision history for this message
Sachin Mokashi (sachinmokashi) wrote :

@Phil,

We need the CONFIG_INTEL_MEI_DAL=m to be enabled as requested in #11,

But both CONFIG_INTEL_MEI_DAL=m and CONFIG_INTEL_MEI_VIRTIO=m are seen to be disabled.

Can you please check

Revision history for this message
Philip Cox (philcox) wrote :

@Sachin, I've looked into those two, and they seem to have been disabled because they were not building. I am looking at them again, and will see about re-enabling them.

Revision history for this message
Philip Cox (philcox) wrote :

@Sachin, Both the CONFIG_INTEL_MEI_DAL and CONFIG_INTEL_MEI_VIRTIO code paths have build breakages currently.

I have not looked in to these failures too much yet, but the virtio one looks like missing function prototypes, or actually missing functions. This may be a patch is that is missing, or something has moved/renamed.

The MEI_DAL one looks like the function pointer return type changed from "int" to "void".

Looking at dal_remove(), I suspect changing the return type from int to void would be safe, but there I haven't found an upstream version of this code to compare with.

With: CONFIG_INTEL_MEI_VIRTIO=m

/build/focal/drivers/misc/mei/hw-virtio.c: In function 'mei_virtio_intr_enable':
/build/focal/drivers/misc/mei/hw-virtio.c:178:2: error: implicit declaration of function 'virtio_config_enable'; did you mean 'virtio_config_changed'? [-Werror=implicit-function-declaration]
  178 | virtio_config_enable(vdev);
      | ^~~~~~~~~~~~~~~~~~~~

/build/focal/drivers/misc/mei/hw-virtio.c: In function 'mei_virtio_intr_disable':
/build/focal/drivers/misc/mei/hw-virtio.c:194:2: error: implicit declaration of function 'virtio_config_disable'; did you mean 'virtio_config_changed'? [-Werror=implicit-function-declaration]
  194 | virtio_config_disable(vdev);
      | ^~~~~~~~~~~~~~~~~~~~~
      | virtio_config_changed

With CONFIG_INTEL_MEI_DAL=m

/build/focal/drivers/misc/mei/dal/dal_class.c:800:12: error: initialization of 'void (*)(struct mei_cl_device *)' from incompatible pointer type 'int (*)(struct mei_cl_device *)' [-Werror=incompatible-pointer-types]
  800 | .remove = dal_remove,
      | ^~~~~~~~~~
/build/focal/drivers/misc/mei/dal/dal_class.c:800:12: note: (near initialization for 'dal_driver.remove')

Revision history for this message
Philip Cox (philcox) wrote :

I just checked, and this is enabled in the IOTG 5.15 based jammy kernel.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.