Skip to content

Conversation

@zhoufuro
Copy link
Contributor

@zhoufuro zhoufuro commented Feb 28, 2024

All the patches picked from kernel.org.

Summary by Sourcery

Sync MEI driver up to v6.7 by merging upstream patches: add timeout-capable MEI APIs, improve PXP driver error handling, extend GSC firmware reset support, and integrate new Intel Visual Sensing Controller transport and interface drivers.

New Features:

  • Add timeout variants for MEI client send/receive and vtag APIs
  • Implement PXP send/receive with configurable timeout and automatic channel reset logic
  • Track firmware resets and PXP mode transitions for Graphics System Controller (GSC) devices
  • Introduce Intel Visual Sensing Controller transport (vsc-tp) and firmware loader drivers with SPI/ACPI integration
  • Add platform driver for Intel Visual Sensing Controller interface (intel_vsc)

Enhancements:

  • Update spelling and comments across MEI core and drivers
  • Rename HBM and DMA control structures for consistency
  • Extend MEI HBM and interrupt structures with VSC support

Build:

  • Add mei-vsc and VSC firmware loader modules to the build Makefile

ausyskin and others added 22 commits February 28, 2024 09:31
commit cf43972 ("mei: bus: add send and recv api with timeout") upstream.

Add variation of the send and recv functions on bus
that define timeout.
Caller can use such functions in flow that can stuck
to bail out and not to put down the whole system.

deepin-Intel-SIG: commit cf43972 ("mei: bus: add send and recv api with timeout").

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231011110157.247552-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit ee5cb39 ("mei: pxp: recover from recv fail under memory pressure") upstream.

Under memory pressure recv fails due to kmalloc failure,
and if drivers(pxp) retry send/receive, send blocks
indefinitely.
Send without recv leaves the channel in a bad state.

Retry send attempt after small timeout and reset the channel if
the retry failed on kmalloc failure too.

deepin-Intel-SIG: commit ee5cb39 ("mei: pxp: recover from recv fail under memory pressure").

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231011110157.247552-3-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit dab79a2 ("mei: pxp: re-enable client on errors") upstream.

Disable and enable mei-pxp client on errors to clean the internal state.

deepin-Intel-SIG: commit dab79a2 ("mei: pxp: re-enable client on errors").

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231011110157.247552-4-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit fb99e79 ("mei: update mei-pxp's component interface with timeouts") upstream.

In debugging platform or firmware related MEI-PXP connection
issues, having a timeout when clients (such as i915) calling
into mei-pxp's send/receive functions have proven useful as opposed to
blocking forever until the kernel triggers a watchdog panic (when
platform issues are experienced).

Update the mei-pxp component interface send and receive functions
to take in timeouts.

deepin-Intel-SIG: commit fb99e79 ("mei: update mei-pxp's component interface with timeouts").

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231011110157.247552-5-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 64459c6 ("mei: docs: use correct structures name in kdoc") upstream.

Fix misalignment between structures names and their kdoc in hw.h

deepin-Intel-SIG: commit 64459c6 ("mei: docs: use correct structures name in kdoc").

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20231011074301.223879-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit d37b59c ("mei: docs: add missing entries to kdoc in struct mei_cfg_idx") upstream.

Document all entries in struct mei_cfg_idx.

deepin-Intel-SIG: commit d37b59c ("mei: docs: add missing entries to kdoc in struct mei_cfg_idx").

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20231011074301.223879-3-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit ae4cb6b ("mei: docs: fix spelling errors") upstream.

Fix spelling errors in the mei code base.

deepin-Intel-SIG: commit ae4cb6b ("mei: docs: fix spelling errors").

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20231011074301.223879-4-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 5d33dc7 ("misc: mei: hw.h: fix kernel-doc warnings") upstream.

Fix kernel-doc warnings in hw.h:

hw.h:809: warning: missing initial short description on line:
 * struct hbm_client_dma_unmap_request
hw.h:812: warning: contents before sections
hw.h:825: warning: missing initial short description on line:
 * struct hbm_client_dma_response
hw.h:828: warning: contents before sections

deepin-Intel-SIG: commit 5d33dc7 ("misc: mei: hw.h: fix kernel-doc warnings").

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231012024845.29169-2-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit daa0c28 ("misc: mei: client.c: fix kernel-doc warnings") upstream.

Fix kernel-doc warnings in client.c:

client.c:53: warning: contents before sections
client.c:68: warning: contents before sections
client.c:334: warning: contents before sections
client.c:349: warning: contents before sections
client.c:364: warning: contents before sections

deepin-Intel-SIG: commit daa0c28 ("misc: mei: client.c: fix kernel-doc warnings").

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231012024845.29169-3-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 4efa1e2 ("misc: mei: dma-ring.c: fix kernel-doc warnings") upstream.

Fix kernel-doc warnings in dma-ring.c:

dma-ring.c:130: warning: No description found for return value of 'mei_dma_copy_from'
dma-ring.c:150: warning: No description found for return value of 'mei_dma_copy_to'

deepin-Intel-SIG: commit 4efa1e2 ("misc: mei: dma-ring.c: fix kernel-doc warnings").

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231012024845.29169-4-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit fbe3599 ("misc: mei: hbm.c: fix kernel-doc warnings") upstream.

Fix kernel-doc warnings in hbm.c:

hbm.c:98: warning: No description found for return value of 'mei_hbm_write_message'

deepin-Intel-SIG: commit fbe3599 ("misc: mei: hbm.c: fix kernel-doc warnings").

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231012024845.29169-5-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit de735e7 ("misc: mei: hw-me.c: fix kernel-doc warnings") upstream.

Fix kernel-doc warnings in hw-me.c:

hw-me.c:1391: warning: contents before sections
hw-me.c:1475: warning: contents before sections
hw-me.c:1501: warning: contents before sections
hw-me.c:1525: warning: contents before sections

deepin-Intel-SIG: commit de735e7 ("misc: mei: hw-me.c: fix kernel-doc warnings").

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231012024845.29169-6-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 980dcc7 ("misc: mei: interrupt.c: fix kernel-doc warnings") upstream.

Fix kernel-doc warnings in interrupt.c:

interrupt.c:631: warning: contents before sections

deepin-Intel-SIG: commit 980dcc7 ("misc: mei: interrupt.c: fix kernel-doc warnings").

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231012024845.29169-7-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 3b54a11 ("misc: mei: main.c: fix kernel-doc warnings") upstream.

Fix kernel-doc warnings in main.c:

main.c:465: warning: contents before sections
main.c:590: warning: missing initial short description on line:
 * mei_ioctl_client_notify_request -

deepin-Intel-SIG: commit 3b54a11 ("misc: mei: main.c: fix kernel-doc warnings").

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20231012024845.29169-8-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 34a674e ("mei: me: emit error only if reset was unexpected") upstream.

GSC devices perform legal firmware initiated resets due to state transition
that may appear as unexpected to the driver. Lower the log level for those
devices to debug level and save the firmware status registers.
When the device comes out of the reset it is possible to check whether the
resets was due to a firmware error or an exception
and only than produce a warning.

deepin-Intel-SIG: commit 34a674e ("mei: me: emit error only if reset was unexpected").

Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231015080540.95922-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit be6f9a3 ("mei: pxp: fix mei_pxp_send_message return value") upstream.

mei_pxp_send_message() should return zero on success and
cannot propagate number of bytes as returned by internally
called mei_cldev_send().

deepin-Intel-SIG: commit be6f9a3 ("mei: pxp: fix mei_pxp_send_message return value").

Fixes: ee5cb39 ("mei: pxp: recover from recv fail under memory pressure")
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231126092449.88310-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 566f5ca ("mei: Add transport driver for IVSC device") upstream.

The Intel visual sensing controller (IVSC) device is designed to control
the camera sharing between host IPU for media usage and IVSC for context
sensing (face detection).

IVSC is exposed to HOST as an SPI device and the message protocol over
the SPI BUS for communicating with the IVSC device is implemented. This
is the backend of mei framework for IVSC device, which usually handles
the hardware data transfer. The mei_csi and mei_ace are the clients of
IVSC mei framework.

The firmware downloading for the IVSC device is implemented as well.

deepin-Intel-SIG: commit 566f5ca ("mei: Add transport driver for IVSC device").

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hao Yao <hao.yao@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/1701651344-20723-2-git-send-email-wentong.wu@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 386a766 ("mei: Add MEI hardware support for IVSC device") upstream.

The protocol used for the IVSC device to communicate with HOST is MEI.
The MEI hardware interfaces for the IVSC device are implemented.

The APIs are exposed by MEI framework to mei clients, e.g. mei_csi and
mei_ace.

deepin-Intel-SIG: commit 386a766 ("mei: Add MEI hardware support for IVSC device").

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Reviewed-by: Alexander Usyskin <alexander.usyskin@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hao Yao <hao.yao@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/1701651344-20723-3-git-send-email-wentong.wu@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit ea0e635 ("mei: pxp: spdx should be at first line") upstream.

Remove stray empty line at the beginning of the file
to have SPDX header t the first line.

deepin-Intel-SIG: commit ea0e635 ("mei: pxp: spdx should be at first line").

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231214143752.294008-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 5370a43 ("mei: vsc: Rework firmware image names") upstream.

Rework firmware image names with the users in mind---there's no need for
variation between firmware names, apart from connected sensors. All
supported SoCs use the same firmware, too.

Use a single set of firmware binaries and assume they'll be found under
intel/vsc directory.

deepin-Intel-SIG: commit 5370a43 ("mei: vsc: Rework firmware image names").

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Wentong Wu <wentong.wu@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231213094055.446611-1-sakari.ailus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit 95171e4 ("mei: fix vsc dependency") upstream.

CONFIG_INTEL_MEI_VSC_HW can be set to built-in even with CONFIG_MEI=m,
but then the driver is not built because Kbuild never enters the
drivers/misc/mei directory for built-in files, leading to a link
failure:

ERROR: modpost: "vsc_tp_reset" [drivers/misc/mei/mei-vsc.ko] undefined!
ERROR: modpost: "vsc_tp_init" [drivers/misc/mei/mei-vsc.ko] undefined!
ERROR: modpost: "vsc_tp_xfer" [drivers/misc/mei/mei-vsc.ko] undefined!
ERROR: modpost: "vsc_tp_need_read" [drivers/misc/mei/mei-vsc.ko] undefined!
ERROR: modpost: "vsc_tp_intr_enable" [drivers/misc/mei/mei-vsc.ko] undefined!
ERROR: modpost: "vsc_tp_intr_synchronize" [drivers/misc/mei/mei-vsc.ko] undefined!
ERROR: modpost: "vsc_tp_intr_disable" [drivers/misc/mei/mei-vsc.ko] undefined!
ERROR: modpost: "vsc_tp_register_event_cb" [drivers/misc/mei/mei-vsc.ko] undefined!

Add an explicit dependency on CONFIG_MEI that was apparently missing,
to ensure the VSC_HW driver cannot be built-in with MEI itself being
a loadable module.

deepin-Intel-SIG: commit 95171e4 ("mei: fix vsc dependency").

Fixes: 566f5ca ("mei: Add transport driver for IVSC device")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Wentong Wu <wentong.wu@intel.com>
Link: https://lore.kernel.org/r/20231214183946.109124-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
commit d667378 ("mei: rework Kconfig dependencies") upstream.

The dependencies in the mei framework are inconsistent, with some symbols
using 'select INTEL_MEI' to force it being enabled and others using
'depends on INTEL_MEI'.

In general, one should not select user-visible symbols, so change all
of these to normal dependencies, but change the default on INTEL_MEI to
be enabled when building a kernel for an Intel CPU with ME or a generic
x86 kernel.

Having consistent dependencies makes the 'menuconfig' listing more
readable by using proper indentation.

A large if/endif block is just a simpler syntax than repeating the
dependencies for each symbol.

deepin-Intel-SIG: commit d667378 ("mei: rework Kconfig dependencies").

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wentong Wu <wentong.wu@intel.com>
Link: https://lore.kernel.org/r/20231214183946.109124-2-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Furong Zhou: amend commit log ]
Signed-off-by: Furong Zhou <furong.zhou@intel.com>
@deepin-ci-robot
Copy link

Hi @zhoufuro. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign utsweetyfish for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@matrix-wsk
Copy link
Contributor

Hi, zhoufuro
Thanks for the pr.
It will be better if pr title follow the style as [Intel-SIG][SUBSYSTEM]

@matrix-wsk matrix-wsk merged commit a3f4e8a into deepin-community:linux-6.6.y Feb 28, 2024
MingcongBai pushed a commit to MingcongBai/deepin-kernel that referenced this pull request Jun 17, 2024
[ Upstream commit 8ecf3c1 ]

Recent additions in BPF like cpu v4 instructions, test_bpf module
exhibits the following failures:

  test_bpf: deepin-community#82 ALU_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#83 ALU_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#84 ALU64_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#85 ALU64_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
  test_bpf: deepin-community#86 ALU64_MOVSX | BPF_W jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)

  test_bpf: deepin-community#165 ALU_SDIV_X: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)
  test_bpf: deepin-community#166 ALU_SDIV_K: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)

  test_bpf: deepin-community#169 ALU_SMOD_X: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
  test_bpf: deepin-community#170 ALU_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)

  test_bpf: deepin-community#172 ALU64_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)

  test_bpf: deepin-community#313 BSWAP 16: 0x0123456789abcdef -> 0xefcd
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 301 PASS
  test_bpf: deepin-community#314 BSWAP 32: 0x0123456789abcdef -> 0xefcdab89
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 555 PASS
  test_bpf: deepin-community#315 BSWAP 64: 0x0123456789abcdef -> 0x67452301
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 268 PASS
  test_bpf: deepin-community#316 BSWAP 64: 0x0123456789abcdef >> 32 -> 0xefcdab89
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 269 PASS
  test_bpf: deepin-community#317 BSWAP 16: 0xfedcba9876543210 -> 0x1032
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 460 PASS
  test_bpf: deepin-community#318 BSWAP 32: 0xfedcba9876543210 -> 0x10325476
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 320 PASS
  test_bpf: deepin-community#319 BSWAP 64: 0xfedcba9876543210 -> 0x98badcfe
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 222 PASS
  test_bpf: deepin-community#320 BSWAP 64: 0xfedcba9876543210 >> 32 -> 0x10325476
  eBPF filter opcode 00d7 (@2) unsupported
  jited:0 273 PASS

  test_bpf: deepin-community#344 BPF_LDX_MEMSX | BPF_B
  eBPF filter opcode 0091 (@5) unsupported
  jited:0 432 PASS
  test_bpf: deepin-community#345 BPF_LDX_MEMSX | BPF_H
  eBPF filter opcode 0089 (@5) unsupported
  jited:0 381 PASS
  test_bpf: deepin-community#346 BPF_LDX_MEMSX | BPF_W
  eBPF filter opcode 0081 (@5) unsupported
  jited:0 505 PASS

  test_bpf: deepin-community#490 JMP32_JA: Unconditional jump: if (true) return 1
  eBPF filter opcode 0006 (@1) unsupported
  jited:0 261 PASS

  test_bpf: Summary: 1040 PASSED, 10 FAILED, [924/1038 JIT'ed]

Fix them by adding missing processing.

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/91de862dda99d170697eb79ffb478678af7e0b27.1709652689.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <sashal@kernel.org>
@Avenger-285714
Copy link
Member

@sourcery-ai review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR synchronizes the MEI (Management Engine Interface) driver with upstream kernel version 6.7, bringing multiple enhancements and fixes to the MEI subsystem.

  • Adds timeout-based send/receive operations for MEI client devices
  • Introduces Visual Sensing Controller (VSC) transport and platform drivers
  • Updates PXP interface to support timeout parameters
  • Fixes various spelling errors and documentation issues throughout the codebase

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
include/linux/mei_cl_bus.h Adds timeout-based function declarations and fixes documentation typos
include/drm/i915_pxp_tee_interface.h Updates PXP interface to include timeout parameters
drivers/misc/mei/vsc-tp.h New VSC transport layer header with API definitions
drivers/misc/mei/vsc-tp.c New VSC transport layer implementation
drivers/misc/mei/vsc-fw-loader.c New VSC firmware loader implementation
drivers/misc/mei/pxp/mei_pxp.c Updates PXP driver to use timeout-based operations
drivers/misc/mei/pxp/Kconfig Changes dependency from select to depends on
drivers/misc/mei/platform-vsc.c New VSC platform driver implementation
drivers/misc/mei/mei_dev.h Adds new enums and helper functions for GSC devices
drivers/misc/mei/main.c Minor documentation formatting fixes
drivers/misc/mei/interrupt.c Spelling corrections and documentation improvements
drivers/misc/mei/init.c Adds firmware status saving for GSC devices
drivers/misc/mei/hw.h Documentation formatting fixes
drivers/misc/mei/hw-me.h Adds new configuration constants
drivers/misc/mei/hw-me.c Adds GSC reset handling and documentation improvements
drivers/misc/mei/hw-me-regs.h Adds power management event constants
drivers/misc/mei/hdcp/Kconfig Changes dependency from select to depends on
drivers/misc/mei/hbm.c Documentation improvements and spelling fixes
drivers/misc/mei/gsc_proxy/Kconfig Changes dependency from select to depends on
drivers/misc/mei/dma-ring.c Documentation improvements and spelling fixes
drivers/misc/mei/client.c Documentation formatting improvements
drivers/misc/mei/bus.c Adds timeout-based send/receive functions and spelling fixes
drivers/misc/mei/Makefile Adds build configuration for new VSC drivers
drivers/misc/mei/Kconfig Restructures configuration and adds VSC driver options
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c Updates to use timeout-based PXP operations

*/
static inline bool kind_is_gsc(struct mei_device *dev)
{
/* check kind for NULL because it may be not set, like at the fist call to hw_start */
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word 'fist' should be 'first'.

Suggested change
/* check kind for NULL because it may be not set, like at the fist call to hw_start */
/* check kind for NULL because it may be not set, like at the first call to hw_start */

Copilot uses AI. Check for mistakes.
*/
static inline bool kind_is_gscfi(struct mei_device *dev)
{
/* check kind for NULL because it may be not set, like at the fist call to hw_start */
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word 'fist' should be 'first'.

Suggested change
/* check kind for NULL because it may be not set, like at the fist call to hw_start */
/* check kind for NULL because it may be not set, like at the first call to hw_start */

Copilot uses AI. Check for mistakes.
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 1, 2025

Reviewer's Guide

This PR synchronizes the MEI driver up to v6.7 by introducing timeout variants for client send/receive operations, strengthening PXP and GSC error handling and reset logic, integrating Intel Visual Sensing Controller support with new transport and loader components, and updating build configurations and documentation.

Sequence diagram for PXP send/receive with timeout and error handling

sequenceDiagram
    participant PXP as PXP Driver
    participant MEI as MEI Core
    participant FW as ME Firmware
    PXP->>MEI: mei_cldev_send_timeout(..., timeout)
    alt send fails (ENOMEM, ENODEV, ETIME)
        PXP->>MEI: mei_cldev_disable()
        PXP->>MEI: mei_cldev_enable()
    end
    MEI->>FW: Send message
    FW-->>MEI: Response
    MEI-->>PXP: Return status
    PXP->>MEI: mei_cldev_recv_timeout(..., timeout)
    alt recv fails (ENOMEM, ENODEV, ETIME)
        PXP->>MEI: mei_cldev_disable()
        PXP->>MEI: mei_cldev_enable()
    end
    MEI->>FW: Receive message
    FW-->>MEI: Response
    MEI-->>PXP: Return data
Loading

Class diagram for new and updated MEI client send/receive timeout APIs

classDiagram
    class mei_cl_device {
        +ssize_t mei_cldev_send(const u8 *buf, size_t length)
        +ssize_t mei_cldev_send_timeout(const u8 *buf, size_t length, unsigned long timeout)
        +ssize_t mei_cldev_send_vtag(const u8 *buf, size_t length, u8 vtag)
        +ssize_t mei_cldev_send_vtag_timeout(const u8 *buf, size_t length, u8 vtag, unsigned long timeout)
        +ssize_t mei_cldev_recv(u8 *buf, size_t length)
        +ssize_t mei_cldev_recv_timeout(u8 *buf, size_t length, unsigned long timeout)
        +ssize_t mei_cldev_recv_vtag(u8 *buf, size_t length, u8 *vtag)
        +ssize_t mei_cldev_recv_vtag_timeout(u8 *buf, size_t length, u8 *vtag, unsigned long timeout)
    }
Loading

Class diagram for new Intel Visual Sensing Controller (VSC) support

classDiagram
    class vsc_tp {
        +int vsc_tp_xfer(u8 cmd, const void *obuf, size_t olen, void *ibuf, size_t ilen)
        +int vsc_tp_rom_xfer(const void *obuf, void *ibuf, size_t len)
        +int vsc_tp_register_event_cb(vsc_tp_event_cb_t event_cb, void *context)
        +void vsc_tp_intr_enable()
        +void vsc_tp_intr_disable()
        +void vsc_tp_intr_synchronize()
        +void vsc_tp_reset()
        +bool vsc_tp_need_read()
        +int vsc_tp_init(struct device *dev)
    }
    class vsc_fw_loader {
        -struct device *dev
        -struct vsc_tp *tp
        -const struct firmware *csi
        -const struct firmware *ace
        -const struct firmware *cfg
        -void *tx_buf
        -void *rx_buf
        -u16 option
        -u16 count
        -char sensor_name[16]
        -struct vsc_img_frag frags[8]
    }
    vsc_fw_loader --> vsc_tp : uses
Loading

Class diagram for updated mei_device structure (GSC/PXP error handling)

classDiagram
    class mei_device {
        +struct mei_fw_status saved_fw_status
        +enum mei_dev_state saved_dev_state
        +bool saved_fw_status_flag
        +enum mei_dev_reset_to_pxp gsc_reset_to_pxp
        +const struct mei_hw_ops *ops
        +char *kind
        ...
    }
    class mei_dev_reset_to_pxp {
        <<enum>>
        MEI_DEV_RESET_TO_PXP_DEFAULT
        MEI_DEV_RESET_TO_PXP_PERFORMED
        MEI_DEV_RESET_TO_PXP_DONE
    }
    mei_device --> mei_dev_reset_to_pxp : uses
Loading

Class diagram for i915_pxp_component_ops interface update

classDiagram
    class i915_pxp_component_ops {
        +int send(struct device *dev, const void *message, size_t size, unsigned long timeout_ms)
        +int recv(struct device *dev, void *buffer, size_t size, unsigned long timeout_ms)
        +ssize_t gsc_command(...)
        +struct module *owner
    }
Loading

File-Level Changes

Change Details Files
Add timed send/receive APIs to MEI client interface
  • Implement mei_cldev_send_vtag_timeout, mei_cldev_recv_timeout, mei_cldev_recv_vtag_timeout and mei_cldev_send_timeout
  • Update function prototypes in mei_cl_bus.h
  • Export new timeout-based symbols
drivers/misc/mei/bus.c
include/linux/mei_cl_bus.h
Bolster PXP driver with timeout-based operations and recovery
  • Switch PXP send/receive to use timeout variants
  • Introduce retry and channel re-enable logic on ENODEV, ENOMEM and ETIME errors
  • Add msleep-based retry in receive path and include <linux/delay.h>
drivers/misc/mei/pxp/mei_pxp.c
Enhance GSC firmware reset detection and error logging
  • Add saved_fw_status, saved_dev_state flag and gsc_reset_to_pxp enum in mei_dev.h
  • Implement mei_save_fw_status, kind_is_gsc/GSCFI helpers and mei_me_check_fw_reset
  • Invoke new checks in mei_me_hw_start, mei_reset and IRQ handler
drivers/misc/mei/mei_dev.h
drivers/misc/mei/hw-me.c
drivers/misc/mei/init.c
Onboard Intel Visual Sensing Controller (VSC) support
  • Add vsc-tp transport driver and header
  • Implement VSC firmware loader vsc-fw-loader.c
  • Create platform-vsc interface driver and integrate with MEI hw_ops
  • Register event callbacks and hook into build
drivers/misc/mei/vsc-tp.c
drivers/misc/mei/vsc-fw-loader.c
drivers/misc/mei/platform-vsc.c
drivers/misc/mei/vsc-tp.h
Update build configuration for new modules
  • Extend Makefile with VSC transport and interface targets
  • Add Kconfig entries for VSC modules
drivers/misc/mei/Makefile
Miscellaneous documentation and code cleanups
  • Fix typos and formatting in comments across multiple files
  • Rename struct identifiers in hw.h and DRM interface
  • Re-align lock annotations in client.c and correct return descriptions
  • Annotate function arguments and tidy header includes
drivers/misc/mei/bus.c
drivers/misc/mei/client.c
drivers/misc/mei/hw.h
drivers/misc/mei/hbm.c
drivers/misc/mei/interrupt.c
drivers/misc/mei/dma-ring.c
include/drm/i915_pxp_tee_interface.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zhoufuro - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `drivers/misc/mei/vsc-fw-loader.c:423` </location>
<code_context>
+			goto err_release_image;
+		}
+
+		if (!le32_to_cpu(img->image_location[i])) {
+			ret = -EINVAL;
+			goto err_release_image;
</code_context>

<issue_to_address>
Zero image location is treated as an error, but later code allows zero and calculates location.

Please align the handling of zero image locations between vsc_identify_csi_image and vsc_identify_ace_image, or document the reason for the differing behavior.
</issue_to_address>

### Comment 2
<location> `drivers/misc/mei/vsc-fw-loader.c:432` </location>
<code_context>
+
+		frag->data = sign->image;
+		frag->size = le32_to_cpu(sign->image_size);
+		frag->location = le32_to_cpu(img->image_location[i]);
+		frag->type = csi_image_map[i].image_type;
+
</code_context>

<issue_to_address>
No check for overlapping image fragments.

If non-overlapping regions are required, add a check to prevent fragments from sharing memory.

Suggested implementation:

```c

		frag = &fw_loader->frags[csi_image_map[i].frag_index];

		{
			u32 new_start = le32_to_cpu(img->image_location[i]);
			u32 new_size = le32_to_cpu(sign->image_size);
			u32 new_end = new_start + new_size;
			int j;
			for (j = 0; j < i; j++) {
				u32 prev_start = le32_to_cpu(img->image_location[j]);
				u32 prev_size = le32_to_cpu(sign->image_size); /* Assuming same size field for all */
				u32 prev_end = prev_start + prev_size;
				if ((new_start < prev_end) && (prev_start < new_end)) {
					ret = -EINVAL;
					goto err_release_image;
				}
			}
		}

		frag->data = sign->image;
		frag->size = le32_to_cpu(sign->image_size);

```

- If `sign->image_size` is not the correct size field for all fragments, you may need to use a per-fragment size array or field.
- If fragments can come from different images or have different size fields, adjust the overlap check accordingly.
- This check assumes that all fragments are in the same address space and that `img->image_location` and `sign->image_size` are valid for all indices.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

goto err_release_image;
}

if (!le32_to_cpu(img->image_location[i])) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Zero image location is treated as an error, but later code allows zero and calculates location.

Please align the handling of zero image locations between vsc_identify_csi_image and vsc_identify_ace_image, or document the reason for the differing behavior.


frag->data = sign->image;
frag->size = le32_to_cpu(sign->image_size);
frag->location = le32_to_cpu(img->image_location[i]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): No check for overlapping image fragments.

If non-overlapping regions are required, add a check to prevent fragments from sharing memory.

Suggested implementation:

		frag = &fw_loader->frags[csi_image_map[i].frag_index];

		{
			u32 new_start = le32_to_cpu(img->image_location[i]);
			u32 new_size = le32_to_cpu(sign->image_size);
			u32 new_end = new_start + new_size;
			int j;
			for (j = 0; j < i; j++) {
				u32 prev_start = le32_to_cpu(img->image_location[j]);
				u32 prev_size = le32_to_cpu(sign->image_size); /* Assuming same size field for all */
				u32 prev_end = prev_start + prev_size;
				if ((new_start < prev_end) && (prev_start < new_end)) {
					ret = -EINVAL;
					goto err_release_image;
				}
			}
		}

		frag->data = sign->image;
		frag->size = le32_to_cpu(sign->image_size);
  • If sign->image_size is not the correct size field for all fragments, you may need to use a per-fragment size array or field.
  • If fragments can come from different images or have different size fields, adjust the overlap check accordingly.
  • This check assumes that all fragments are in the same address space and that img->image_location and sign->image_size are valid for all indices.

@Avenger-285714
Copy link
Member

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zhoufuro - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants