Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	<intel-gfx@lists.freedesktop.org>
Cc: <gregkh@linuxfoundation.org>,
	Alexander Usyskin <alexander.usyskin@intel.com>
Subject: Re: [PATCH v3 1/2] mei: me: Export the PCI ID list
Date: Tue, 25 Nov 2025 14:00:54 -0800	[thread overview]
Message-ID: <09aaeb7e-35b4-4a7a-9471-6bb0c247f2ed@intel.com> (raw)
In-Reply-To: <632d00475a9dc4e878d7145834a70028ab298f95@intel.com>



On 11/25/2025 2:26 AM, Jani Nikula wrote:
> On Fri, 14 Nov 2025, Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> wrote:
>> 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 ME 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 ME device is available is to check the
>> available devices against the PCI ID list of the mei_me driver. To avoid
>> duplication, this patch exports the list, so that it can be used directly
>> from the GFX drivers.
>>
>> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> Cc: Alexander Usyskin <alexander.usyskin@intel.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>>   drivers/misc/mei/pci-me.c | 12 +++++++++++-
>>   include/linux/mei_me.h    | 15 +++++++++++++++
>>   2 files changed, 26 insertions(+), 1 deletion(-)
>>   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 b017ff29dbd1..632756f9da66 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"
>> @@ -25,7 +26,7 @@
>>   #include "hw-me.h"
>>   
>>   /* mei_pci_tbl - PCI Device ID Table */
>> -static const struct pci_device_id mei_me_pci_tbl[] = {
>> +const struct pci_device_id mei_me_pci_tbl[] = {
>>   	{MEI_PCI_DEVICE(MEI_DEV_ID_82946GZ, MEI_ME_ICH_CFG)},
>>   	{MEI_PCI_DEVICE(MEI_DEV_ID_82G35, MEI_ME_ICH_CFG)},
>>   	{MEI_PCI_DEVICE(MEI_DEV_ID_82Q965, MEI_ME_ICH_CFG)},
>> @@ -135,6 +136,15 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
>>   
>>   MODULE_DEVICE_TABLE(pci, mei_me_pci_tbl);
>>   
>> +/*
>> + * 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 unplugged via the
>> + * pci subsystem or hidden by BIOS/coreboot, so those drivers might want to
>> + * check if the device is available before initializing those features. To
>> + * allow them to perform such a check, we export the list of ME device IDs.
>> + */
>> +EXPORT_SYMBOL_GPL(mei_me_pci_tbl);
> Data is not an interface.
>
> Please add an exported helper function (with a sensible stub for
> CONFIG_INTEL_MEI_ME=n) and everything becomes much cleaner both mei and
> i915 side.

That is actually what I had in v2 [1], but Greg suggested to export the 
table directly instead. I am ok either way.

[1] https://patchwork.freedesktop.org/patch/674368/?series=151677&rev=2

Daniele

>
> BR,
> Jani.
>
>> +
>>   #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..48fd913a3d95
>> --- /dev/null
>> +++ b/include/linux/mei_me.h
>> @@ -0,0 +1,15 @@
>> +/* 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/pci.h>
>> +
>> +#if IS_ENABLED(CONFIG_INTEL_MEI_ME)
>> +extern const struct pci_device_id mei_me_pci_tbl[];
>> +#endif
>> +
>> +#endif /* _LINUX_MEI_ME_H */


  reply	other threads:[~2025-11-25 22:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14 20:14 [PATCH v3 0/2] Check if CSME is available before initializing PXP Daniele Ceraolo Spurio
2025-11-14 20:14 ` [PATCH v3 1/2] mei: me: Export the PCI ID list Daniele Ceraolo Spurio
2025-11-25 10:26   ` Jani Nikula
2025-11-25 22:00     ` Daniele Ceraolo Spurio [this message]
2025-11-26  9:25       ` Jani Nikula
2025-11-14 20:14 ` [PATCH v3 2/2] drm/i915/pxp: Do not support PXP if CSME is not available Daniele Ceraolo Spurio
2025-11-25 10:28   ` Jani Nikula
2025-11-25 22:07     ` Daniele Ceraolo Spurio
2025-11-26  9:31       ` Jani Nikula
2025-11-26 22:24         ` Daniele Ceraolo Spurio
2025-11-15 13:13 ` ✗ i915.CI.Full: failure for Check if CSME is available before initializing PXP (rev3) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09aaeb7e-35b4-4a7a-9471-6bb0c247f2ed@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox