[PATCH 1/2] mei: me: Add exported function to check ME device availabiliy

Daniele Ceraolo Spurio daniele.ceraolospurio at intel.com
Tue Jul 15 23:00:01 UTC 2025


The intel GFX drivers (i915/xe) interface with the ME device for some of
their features (e.g. PXP, HDCP) via the component interface. Given that
the MEI device can be hidden by BIOS/Coreboot, the GFX drivers need a
way to check if the device is available before attempting to bind the
component, otherwise they'll go ahead and initialize features that will
never work.
The simplest way to check if the device is available is to check the
available devices against the PCI ID list of the mei_me driver. To avoid
duplication of the list, the function to do such a check is added to
the mei_me driver and exported so that the GFX driver can call it
directly.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Cc: Alexander Usyskin <alexander.usyskin at intel.com>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/misc/mei/pci-me.c | 17 +++++++++++++++++
 include/linux/mei_me.h    | 20 ++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 include/linux/mei_me.h

diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 3f9c60b579ae..16e9a11eb286 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -18,6 +18,7 @@
 #include <linux/pm_runtime.h>
 
 #include <linux/mei.h>
+#include <linux/mei_me.h>
 
 #include "mei_dev.h"
 #include "client.h"
@@ -133,6 +134,22 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, mei_me_pci_tbl);
 
+/**
+ * mei_me_device_present - check if an ME device is present on the system
+ *
+ * Other drivers (e.g., i915, xe) interface with the ME device for some of their
+ * features (e.g., PXP, HDCP). However, the ME device can be hidden by
+ * BIOS/coreboot, so this function offers a way for those drivers to check if
+ * the device is available before attempting to interface with it.
+ *
+ * Return: true if an ME device is available, false otherwise
+ */
+bool mei_me_device_present(void)
+{
+	return pci_dev_present(mei_me_pci_tbl);
+}
+EXPORT_SYMBOL(mei_me_device_present);
+
 #ifdef CONFIG_PM
 static inline void mei_me_set_pm_domain(struct mei_device *dev);
 static inline void mei_me_unset_pm_domain(struct mei_device *dev);
diff --git a/include/linux/mei_me.h b/include/linux/mei_me.h
new file mode 100644
index 000000000000..761ef5970a1e
--- /dev/null
+++ b/include/linux/mei_me.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2025, Intel Corporation. All rights reserved.
+ */
+
+#ifndef _LINUX_MEI_ME_H
+#define _LINUX_MEI_ME_H
+
+#include <linux/types.h>
+
+#if IS_ENABLED(CONFIG_INTEL_MEI_ME)
+bool mei_me_device_present(void);
+#else
+static inline bool mei_me_device_present(void)
+{
+	return false;
+}
+#endif
+
+#endif /* _LINUX_MEI_ME_H */
-- 
2.43.0



More information about the Intel-gfx mailing list