Move intel_pm from MFD to Auxiliary bus
Subsystems (6)
David E. Box
maintainercover Move intel_pm from MFD to Auxiliary bus
This patch series converts the intel_pmt driver from an MFD driver to an auxiliary bus driver. The series also combines and supersedes two previous patch sets [1] and [2]. Though starting from V1, revision history from each series is summarized for each patch.
David E. Box (5):
PCI: Add #defines for accessing PCIe DVSEC fields platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus platform/x86/intel: extended_caps: Add support for PCIe VSEC
structures
Documentation: Update ioctl-number.rst for Intel Software Defined
Silicon interface
platform/x86: Add Intel Software Defined Silicon driver
.../ABI/testing/sysfs-driver-intel_sdsi | 28 + .../userspace-api/ioctl/ioctl-number.rst | 1 + MAINTAINERS | 16 +- drivers/mfd/Kconfig | 10 - drivers/mfd/Makefile | 1 - drivers/mfd/intel_pmt.c | 261 ------- drivers/platform/x86/intel/Kconfig | 23 + drivers/platform/x86/intel/Makefile | 4 + drivers/platform/x86/intel/extended_caps.c | 401 ++++++++++ drivers/platform/x86/intel/extended_caps.h | 42 ++ drivers/platform/x86/intel/pmt/Kconfig | 4 +- drivers/platform/x86/intel/pmt/class.c | 18 +- drivers/platform/x86/intel/pmt/class.h | 5 +- drivers/platform/x86/intel/pmt/crashlog.c | 43 +- drivers/platform/x86/intel/pmt/telemetry.c | 47 +- drivers/platform/x86/intel/sdsi.c | 692 ++++++++++++++++++ include/uapi/linux/pci_regs.h | 4 + include/uapi/linux/sdsi_if.h | 47 ++ 18 files changed, 1318 insertions(+), 329 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-intel_sdsi delete mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel/extended_caps.c create mode 100644 drivers/platform/x86/intel/extended_caps.h create mode 100644 drivers/platform/x86/intel/sdsi.c create mode 100644 include/uapi/linux/sdsi_if.h
Signature · 1 line
2.25.1
David E. Box
maintainerPATCH 4/5 Documentation: Update ioctl-number.rst for Intel Software Defined Silicon interface
Reserve ioctl number and range for the Intel Software Defined Silicon driver.
---
V1: No change from previous submission
Documentation/userspace-api/ioctl/ioctl-number.rst | 1 + 1 file changed, 1 insertion(+)
Documentation/userspace-api/ioctl/ioctl-number.rst +1 -0
@@ -363,6 +363,7 @@ Code Seq# Include File Comments 0xDB 00-0F drivers/char/mwave/mwavepub.h 0xDD 00-3F ZFCP device driver see drivers/s390/scsi/ <mailto:[email protected]> +0xDF all linux/isdsi_if.h 0xE5 00-3F linux/fuse.h 0xEC 00-01 drivers/platform/chrome/cros_ec_dev.h ChromeOS EC driver 0xF3 00-3F drivers/usb/misc/sisusbvga/sisusb.h sisfb (in development)
Signature · 1 line
2.25.1
David E. Box
maintainerPATCH 3/5 platform/x86/intel: extended_caps: Add support for PCIe VSEC structures
In reply to David E. BoxAdds support for discovering Intel extended capability features from Vendor Specific Extended Capability (VSEC) registers in PCIe config space.
---
V1: - Modified version of [1] applied to auxiliary bus driver.
- Use bool instead of int to track whether any device has been added.
[1] https://lore.kernel.org/all/[email protected]/
drivers/platform/x86/intel/extended_caps.c | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+)
drivers/platform/x86/intel/extended_caps.c +49 -0
@@ -294,6 +294,54 @@ static bool extended_caps_walk_dvsec(struct pci_dev *pdev, unsigned long quirks)return have_devices; } +static bool extended_caps_walk_vsec (struct pci_dev *pdev,unsigned long quirks) +{ +bool have_devices = false; +int pos =0 ; + +do { +struct extended_caps_header header; +u32 table, hdr; +int ret; + + pos =pci_find_next_ext_capability (pdev, pos,PCI_EXT_CAP_ID_VNDR ); +if (!pos) +break ; + +pci_read_config_dword (pdev, pos +PCI_VNDR_HEADER , &hdr); + +/* Support only revision 1 */ + header.rev =PCI_VNDR_HEADER_REV (hdr); +if (header.rev !=1 ) { +dev_warn (&pdev->dev,"Unsupported VSEC revision %d\n" , + header.rev); +continue ; + } + + header.id =PCI_VNDR_HEADER_ID (hdr); + header.length =PCI_VNDR_HEADER_LEN (hdr); + +/* entry, size, and table offset are the same as DVSEC */ +pci_read_config_byte (pdev, pos +INTEL_DVSEC_ENTRIES , + &header.num_entries); +pci_read_config_byte (pdev, pos +INTEL_DVSEC_SIZE , + &header.entry_size); +pci_read_config_dword (pdev, pos +INTEL_DVSEC_TABLE , + &table); + + header.tbir =INTEL_DVSEC_TABLE_BAR (table); + header.offset =INTEL_DVSEC_TABLE_OFFSET (table); + + ret =extended_caps_add_dev (pdev, &header, quirks); +if (ret) +continue ; + + have_devices = true; + }while (true); + +return have_devices; +} +static int extended_caps_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {struct extended_caps_platform_info *info;
@@ -310,6 +358,7 @@ static int extended_caps_pci_probe(struct pci_dev *pdev, const struct pci_device quirks = info->quirks; have_devices |=extended_caps_walk_dvsec (pdev, quirks); + have_devices |=extended_caps_walk_vsec (pdev, quirks);if (info && (info->quirks &EXT_CAPS_QUIRK_NO_DVSEC )) have_devices |=extended_caps_walk_header (pdev, quirks, info->capabilities);
Signature · 1 line
2.25.1
David E. Box
maintainerPATCH 5/5 platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. BoxIntel Software Defined Silicon (SDSi) is a post manufacturing mechanism for activating additional silicon features. Features are enabled through a license activation process. The SDSi driver provides a per socket, ioctl interface for applications to perform 3 main provisioning functions:
1. Provision an Authentication Key Certificate (AKC), a key written to internal NVRAM that is used to authenticate a capability specific activation payload.
2. Provision a Capability Activation Payload (CAP), a token authenticated using the AKC and applied to the CPU configuration to activate a new feature.
3. Read the SDSi State Certificate, containing the CPU configuration state.
The ioctl operations perform function specific mailbox commands that forward the requests to SDSi hardware to perform authentication of the payloads and enable the silicon configuration (to be made available after power cycling).
The SDSi device itself is enumerated as an auxiliary device from the intel_extended_caps driver and as such has a build dependency on CONFIG_INTEL_EXTENDED_CAPS.
---
V1:
- Converted to auxiliary bus device driver
- Combined and added groups to miscdev per GKH
- Added ABI documentation per GKH
- Dropped the kref for private structure. Instead manage the reference count of the miscdev and use an added devm action to free the structure
.../ABI/testing/sysfs-driver-intel_sdsi | 28 + MAINTAINERS | 6 + drivers/platform/x86/intel/Kconfig | 12 + drivers/platform/x86/intel/Makefile | 2 + drivers/platform/x86/intel/extended_caps.c | 2 + drivers/platform/x86/intel/sdsi.c | 692 ++++++++++++++++++ include/uapi/linux/sdsi_if.h | 47 ++ 7 files changed, 789 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-intel_sdsi create mode 100644 drivers/platform/x86/intel/sdsi.c create mode 100644 include/uapi/linux/sdsi_if.h
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +28 -0
@@ -0,0 +1,28 @@ +What: /sys/class/misc/isdsi-<x> +Date: Sep 2021 +KernelVersion: 5.16 +Contact: "David E. Box" <[email protected]> +Description: + This folder contains files describing information about the + Software Defined Silicon miscdevice for a particular socket. + +What: /sys/class/misc/isdsi-<x>/guid +Date: Sep 2021 +KernelVersion: 5.16 +Contact: "David E. Box" <[email protected]> +Description: + (RO) The GUID for the registers file. The GUID identifies + the register layout of the registers file in this folder. + Information about the register layouts for a particular GUID + is available at http://github.com/intel/intel-sdsi + +What: /sys/class/misc/isdsi-<x>/registers +Date: Sep 2021 +KernelVersion: 5.16 +Contact: "David E. Box" <[email protected]> +Description: + (RO) Contains information needed by applications to provision + a CPU and monitor status intformation. The layout of this file + is determined by the GUID in this folder. Information about the + layout for a particular GUID is available at + http://github.com/intel/intel-sdsi
MAINTAINERS +6 -0
@@ -9614,6 +9614,12 @@ S: Maintained F: arch/x86/include/asm/intel_scu_ipc.h F: drivers/platform/x86/intel_scu_* +INTEL SDSI DRIVER +M: David E. Box <[email protected]> +S: Supported +F: drivers/platform/x86/intel/sdsi.c +F: include/uapi/linux/sdsi_if.h + INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER M: Daniel Scally <[email protected]> S: Maintained
drivers/platform/x86/intel/Kconfig +12 -0
@@ -142,6 +142,18 @@ config INTEL_RST firmware will copy the memory contents back to RAM and resume the OS as usual. +config INTEL_SDSI + tristate "Intel Software Defined Silicon Driver" + depends on INTEL_EXTENDED_CAPS + depends on X86_64 + help + This driver enables access to the Intel Software Defined Silicon + interface used to provision silicon features with an authentication + certificate and capability license. + + To compile this driver as a module, choose M here: the module will + be called intel_sdsi. + config INTEL_SMARTCONNECT tristate "Intel Smart Connect disabling driver" depends on ACPI
drivers/platform/x86/intel/Makefile +2 -0
@@ -27,6 +27,8 @@ intel_int0002_vgpio-y := int0002_vgpio.o obj-$(CONFIG_INTEL_INT0002_VGPIO) += intel_int0002_vgpio.o intel_oaktrail-y := oaktrail.o obj-$(CONFIG_INTEL_OAKTRAIL) += intel_oaktrail.o +intel_sdsi-y := sdsi.o +obj-$(CONFIG_INTEL_SDSI) += intel_sdsi.o # Intel PMIC / PMC / P-Unit drivers intel_bxtwc_tmu-y := bxtwc_tmu.o
drivers/platform/x86/intel/extended_caps.c +2 -0
@@ -31,6 +31,7 @@#define EXTENDED_CAP_ID_TELEMETRY 2#define EXTENDED_CAP_ID_WATCHER 3#define EXTENDED_CAP_ID_CRASHLOG 4 +#define EXTENDED_CAP_ID_SDSI 65static DEFINE_IDA (extended_caps_ida);
@@ -38,6 +39,7 @@ static int extended_caps_allow_list[] = {EXTENDED_CAP_ID_TELEMETRY ,EXTENDED_CAP_ID_WATCHER ,EXTENDED_CAP_ID_CRASHLOG , + EXTENDED_CAP_ID_SDSI, }; struct extended_caps_platform_info {
drivers/platform/x86/intel/sdsi.c new file +692 -0
692 lines not on this page · raw message
include/uapi/linux/sdsi_if.h new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.25.1
David E. Box
maintainerPATCH 1/5 PCI: Add #defines for accessing PCIe DVSEC fields
In reply to David E. BoxAdd #defines for accessing Vendor ID, Revision, Length, and ID offsets in the Designated Vendor Specific Extended Capability (DVSEC). Defined in PCIe r5.0, sec 7.9.6.
---
V1: s/PCIE/PCIe in commit message as requested by Bjorn
include/uapi/linux/pci_regs.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/linux/pci_regs.h +4 -0
@@ -1080,7 +1080,11 @@/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ #define PCI_DVSEC_HEADER1 0x4/* Designated Vendor-Specific Header1 */ +#define PCI_DVSEC_HEADER1_VID (x) ((x) & 0xffff) +#define PCI_DVSEC_HEADER1_REV (x) (((x) >> 16) & 0xf) +#define PCI_DVSEC_HEADER1_LEN (x) (((x) >> 20) & 0xfff)#define PCI_DVSEC_HEADER2 0x8/* Designated Vendor-Specific Header2 */ +#define PCI_DVSEC_HEADER2_ID (x) ((x) & 0xffff)/* Data Link Feature */ #define PCI_DLF_CAP 0x04/* Capabilities Register */
Signature · 1 line
2.25.1
David E. Box
maintainerPATCH 2/5 platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
In reply to David E. BoxIntel Platform Monitoring Technology (PMT) support is indicated by presence of an Intel defined PCIe DVSEC structure with a PMT ID. However DVSEC structures may also be used by Intel to indicate support for other capabilities unrelated to PMT. The Out Of Band Management Services Module (OOBMSM) is an example of a device that can have both PMT and non-PMT capabilities. In order to support these capabilities it is necessary to modify the intel_pmt driver to handle the creation of platform devices more generically. To that end the following changes are made.
Convert the driver and child drivers from MFD to the Auxiliary Bus. This architecture is more suitable anyway since the driver partitions a multifunctional PCIe device. This also moves the driver out of the MFD subsystem and into platform/x86/intel.
Before, devices were named by their capability (e.g. pmt_telemetry). Instead, generically name them by their capability ID (e.g. intel_extended_cap.2). This allows the IDs to be created automatically, minimizing the code needed to support future capabilities. However, to ensure that unsupported devices aren't created, use an allow list to specify supported capabilities. Along these lines, rename the driver from intel_pmt to intel_extended_caps to better reflect the purpose.
---
V1: New patch. However incorporates some elements of [1] which was
dropped. Namely enumerating features generically and creating an allow list. Also cleans up probe by moving some code to functions and using a bool instead of an int to track whether a device was added.
[1] https://lore.kernel.org/all/[email protected]/
MAINTAINERS | 10 +- drivers/mfd/Kconfig | 10 - drivers/mfd/Makefile | 1 - drivers/mfd/intel_pmt.c | 261 --------------- drivers/platform/x86/intel/Kconfig | 11 + drivers/platform/x86/intel/Makefile | 2 + drivers/platform/x86/intel/extended_caps.c | 350 +++++++++++++++++++++ drivers/platform/x86/intel/extended_caps.h | 42 +++ drivers/platform/x86/intel/pmt/Kconfig | 4 +- drivers/platform/x86/intel/pmt/class.c | 18 +- drivers/platform/x86/intel/pmt/class.h | 5 +- drivers/platform/x86/intel/pmt/crashlog.c | 43 +-- drivers/platform/x86/intel/pmt/telemetry.c | 47 +-- 13 files changed, 475 insertions(+), 329 deletions(-) delete mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel/extended_caps.c create mode 100644 drivers/platform/x86/intel/extended_caps.h
MAINTAINERS +7 -3
@@ -9369,6 +9369,11 @@ S: Supported F: drivers/infiniband/hw/irdma/ F: include/uapi/rdma/irdma-abi.h +INTEL EXTENDED CAPABILITIES DRIVER +M: "David E. Box" <[email protected]> +S: Supported +F: drivers/platform/x86/intel/extended_caps.* + INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) M: Maik Broemme <[email protected]> L: [email protected]
@@ -9578,10 +9583,9 @@ S: Maintained F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_soc_pmic* -INTEL PMT DRIVER +INTEL PMT DRIVERS M: "David E. Box" <[email protected]> -S: Maintained -F: drivers/mfd/intel_pmt.c +S: Supported F: drivers/platform/x86/intel/pmt/ INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
drivers/mfd/Kconfig +0 -10
@@ -690,16 +690,6 @@ config MFD_INTEL_PMC_BXT Register and P-unit access. In addition this creates devices for iTCO watchdog and telemetry that are part of the PMC. -config MFD_INTEL_PMT - tristate "Intel Platform Monitoring Technology (PMT) support" - depends on PCI - select MFD_CORE - help - The Intel Platform Monitoring Technology (PMT) is an interface that - provides access to hardware monitor registers. This driver supports - Telemetry, Watcher, and Crashlog PMT capabilities/devices for - platforms starting from Tiger Lake. - config MFD_IPAQ_MICRO bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600
drivers/mfd/Makefile +0 -1
@@ -212,7 +212,6 @@ obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o -obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_NTXEC) += ntxec.o
drivers/mfd/intel_pmt.c deleted +0 -261
261 lines not on this page · raw message
drivers/platform/x86/intel/Kconfig +11 -0
@@ -26,6 +26,17 @@ source "drivers/platform/x86/intel/speed_select_if/Kconfig" source "drivers/platform/x86/intel/telemetry/Kconfig" source "drivers/platform/x86/intel/wmi/Kconfig" +config INTEL_EXTENDED_CAPS + tristate "Intel Extended Capabilities support" + depends on PCI + select AUXILIARY_BUS + help + Adds support for feature drivers exposed using Intel PCIe VSEC and + DVSEC. + + To compile this driver as a module, choose M here: the module will + be called intel_extended_caps. + config INTEL_HID_EVENT tristate "Intel HID Event" depends on ACPI
drivers/platform/x86/intel/Makefile +2 -0
@@ -21,6 +21,8 @@ intel-vbtn-y := vbtn.o obj-$(CONFIG_INTEL_VBTN) += intel-vbtn.o # Intel miscellaneous drivers +intel_extended_caps-y := extended_caps.o +obj-$(CONFIG_INTEL_EXTENDED_CAPS) += intel_extended_caps.o intel_int0002_vgpio-y := int0002_vgpio.o obj-$(CONFIG_INTEL_INT0002_VGPIO) += intel_int0002_vgpio.o intel_oaktrail-y := oaktrail.o
drivers/platform/x86/intel/extended_caps.c new file +350 -0
350 lines not on this page · raw message
drivers/platform/x86/intel/extended_caps.h new file +42 -0
42 lines not on this page · raw message
drivers/platform/x86/intel/pmt/Kconfig +2 -2
@@ -17,7 +17,7 @@ config INTEL_PMT_CLASS config INTEL_PMT_TELEMETRY tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" - depends on MFD_INTEL_PMT + depends on INTEL_EXTENDED_CAPS select INTEL_PMT_CLASS help The Intel Platform Monitory Technology (PMT) Telemetry driver provides
@@ -29,7 +29,7 @@ config INTEL_PMT_TELEMETRY config INTEL_PMT_CRASHLOG tristate "Intel Platform Monitoring Technology (PMT) Crashlog driver" - depends on MFD_INTEL_PMT + depends on INTEL_EXTENDED_CAPS select INTEL_PMT_CLASS help The Intel Platform Monitoring Technology (PMT) crashlog driver provides
drivers/platform/x86/intel/pmt/class.c +10 -8
@@ -14,6 +14,7 @@#include <linux/pci.h> #include "class.h" +#include "../extended_caps.h" #define PMT_XA_START 0#define PMT_XA_MAX INT_MAX
@@ -281,31 +282,31 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,return ret; } -int intel_pmt_dev_create (struct intel_pmt_entry *entry, -struct intel_pmt_namespace *ns, -struct platform_device *pdev,int idx) +int intel_pmt_dev_create (struct intel_pmt_entry *entry,struct intel_pmt_namespace *ns, +struct intel_extended_cap_device *intel_cap_dev,int idx) { +struct device *dev = &intel_cap_dev->aux_dev.dev;struct intel_pmt_header header;struct resource *disc_res;int ret = -ENODEV ; - disc_res =platform_get_resource (pdev,IORESOURCE_MEM , idx); + disc_res =intel_ext_cap_get_resource (intel_cap_dev, idx);if (!disc_res)return ret; - entry->disc_table =devm_platform_ioremap_resource (pdev, idx); + entry->disc_table =devm_ioremap_resource (dev, disc_res);if (IS_ERR (entry->disc_table))return PTR_ERR (entry->disc_table); - ret = ns->pmt_header_decode (entry, &header, &pdev->dev); + ret = ns->pmt_header_decode (entry, &header, dev);if (ret)return ret; - ret =intel_pmt_populate_entry (entry, &header, &pdev->dev, disc_res); + ret =intel_pmt_populate_entry (entry, &header, dev, disc_res);if (ret)return ret; -return intel_pmt_dev_register (entry, ns, &pdev->dev); +return intel_pmt_dev_register (entry, ns, dev); }EXPORT_SYMBOL_GPL (intel_pmt_dev_create);
@@ -342,3 +343,4 @@ module_exit(pmt_class_exit);MODULE_AUTHOR ("Alexander Duyck <[email protected]>" );MODULE_DESCRIPTION ("Intel PMT Class driver" );MODULE_LICENSE ("GPL v2" ); +MODULE_IMPORT_NS (INTEL_EXT_CAPS );
drivers/platform/x86/intel/pmt/class.h +3 -2
@@ -2,13 +2,14 @@#ifndef _INTEL_PMT_CLASS_H#define _INTEL_PMT_CLASS_H -#include <linux/platform_device.h> #include <linux/xarray.h> #include <linux/types.h> #include <linux/bits.h> #include <linux/err.h> #include <linux/io.h> +#include "../extended_caps.h" +/* PMT access types */ #define ACCESS_BARID 2#define ACCESS_LOCAL 3
@@ -47,7 +48,7 @@ struct intel_pmt_namespace {bool intel_pmt_is_early_client_hw (struct device *dev);int intel_pmt_dev_create (struct intel_pmt_entry *entry,struct intel_pmt_namespace *ns, -struct platform_device *pdev,int idx); +struct intel_extended_cap_device *dev,int idx);void intel_pmt_dev_destroy (struct intel_pmt_entry *entry,struct intel_pmt_namespace *ns);#endif
drivers/platform/x86/intel/pmt/crashlog.c +23 -20
104 lines not on this page · raw message
drivers/platform/x86/intel/pmt/telemetry.c +25 -22
107 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. Boxdrivers/platform/x86/intel/sdsi.c line 490
Quoted 5 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +5
-0+static int sdsi_device_open (struct inode *inode,struct file *file) +{ +struct miscdevice *miscdev = file->private_data; + +get_device (miscdev->this_device);
Why do you think this is needed? Shouldn't the misc core handle all of this for you already?
drivers/platform/x86/intel/sdsi.c line 502
Quoted 12 lines
drivers/platform/x86/intel/sdsi.c new file +12
-0+ +return 0 ; +} + +static int sdsi_device_release (struct inode *inode,struct file *file) +{ + +struct miscdevice *miscdev = file->private_data; +struct sdsi_priv *priv =to_sdsi_priv (miscdev); + +if (priv->akc_owner == file) + priv->akc_owner =NULL ;
Why is this needed?
drivers/platform/x86/intel/sdsi.c line 504
Quoted 2 lines
drivers/platform/x86/intel/sdsi.c new file +2
-0+ +put_device (miscdev->this_device);
I see this matches the open call, but if you do not have this in the open call, is it needed here as well?
drivers/platform/x86/intel/sdsi.c line 643
Quoted 3 lines
drivers/platform/x86/intel/sdsi.c new file +3
-0+ ret =devm_add_action_or_reset (priv->miscdev.this_device, sdsi_miscdev_remove, priv); +if (ret) + goto deregister_misc;
I think this is all you need to clean up your device memory, not the get/put device in open/release, right?
thanks,
greg k-h
Re: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. BoxDocumentation/ABI/testing/sysfs-driver-intel_sdsi line 1
Quoted 2 lines · David E. Box
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +1
-0@@ -0,0 +1,28 @@ +What: /sys/class/misc/isdsi-<x>
Shouldn't that be:
/sys/class/misc/idsi-X
?
Also, why the "-"? What needs that?
thanks,
greg k-h
Re: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. BoxQuoted 21 lines · David E. Box
Intel Software Defined Silicon (SDSi) is a post manufacturing mechanism for activating additional silicon features. Features are enabled through a license activation process. The SDSi driver provides a per socket, ioctl interface for applications to perform 3 main provisioning functions:
1. Provision an Authentication Key Certificate (AKC), a key written to internal NVRAM that is used to authenticate a capability specific activation payload.
2. Provision a Capability Activation Payload (CAP), a token authenticated using the AKC and applied to the CPU configuration to activate a new feature.
3. Read the SDSi State Certificate, containing the CPU configuration state.
The ioctl operations perform function specific mailbox commands that forward the requests to SDSi hardware to perform authentication of the payloads and enable the silicon configuration (to be made available after power cycling).
Quoted 6 lines
The SDSi device itself is enumerated as an auxiliary device from the
intel_extended_capsdriver and as such has a build dependency onCONFIG_INTEL_EXTENDED_CAPS.Signed-off-by David E. Box <[email protected]>
I do not see the "required" review that Intel developers need when sending stuff to me. What happened here?
thanks,
greg k-h
Re: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. BoxQuoted 17 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +17
-0+static long sdsi_device_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +struct miscdevice *miscdev = file->private_data; +struct sdsi_priv *priv =to_sdsi_priv (miscdev); +void __user *argp = (void __user *)arg; +long ret = -EINVAL ; + +if (!priv->dev_present) +return -ENODEV ; + +if (!priv->sdsi_enabled) +return -EPERM ; + +if (cmd ==SDSI_IF_READ_STATE ) +return sdsi_if_read_state_cert (priv, argp); + +mutex_lock (&priv->akc_lock);
drivers/platform/x86/intel/sdsi.c line 416
Quoted 10 lines
drivers/platform/x86/intel/sdsi.c new file +10
-0+switch (cmd) { +case SDSI_IF_PROVISION_AKC : +/* +* While writing an authentication certificate disallow other openers +* from using AKC or CAP. +*/ +if (!priv->akc_owner) + priv->akc_owner = file; + +if (priv->akc_owner != file) {
Please explain how this test would ever trigger and how you tested it?
What exactly are you trying to protect from here? If userspace has your file descriptor, it can do whatever it wants, don't try to be smarter than it as you will never win.
And why are you using ioctls at all here? As you are just reading/writing to the hardware directly, why not just use a binary sysfs file to be that pipe? What requires an ioctl at all?
thanks,
greg k-h
David E. Box
maintainerRe: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to Greg KHQuoted 31 lines · Greg KH
drivers/platform/x86/intel/sdsi.c line 490
Quoted 5 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +5
-0+static int sdsi_device_open (struct inode *inode,struct file *file) +{ + struct miscdevice *miscdev = file->private_data; + + get_device(miscdev->this_device);Why do you think this is needed? Shouldn't the misc core handle all of this for you already?
drivers/platform/x86/intel/sdsi.c line 502
Quoted 12 lines
drivers/platform/x86/intel/sdsi.c new file +12
-0+ + return 0; +} + +static int sdsi_device_release (struct inode *inode,struct file *file) +{ + + struct miscdevice *miscdev = file->private_data; + struct sdsi_priv *priv = to_sdsi_priv(miscdev); + + if (priv->akc_owner == file) + priv->akc_owner = NULL;Why is this needed?
Quoted 2 lines
+
+ put_device(miscdev->this_device);I see this matches the open call, but if you do not have this in the open call, is it needed here as well?
Quoted 6 lines
Quoted 3 lines
+ ret =
devm_add_action_or_reset(priv->miscdev.this_device, sdsi_miscdev_remove, priv); + if (ret)
+ gotoderegister_misc;I think this is all you need to clean up your device memory, not the get/put device in open/release, right?
It does clean up the memory, but it does so immediately after the device has been unregistered, even if a file is open. The get/put ensures that if files are open, the memory isn't cleaned up until the files are closed.
I can show that this happens without the get/put,
open() unbind device -> devm action called -> kfree(priv) ioctl() -> priv accessed
but it doesn't blow up. I guess because the former location of priv is accessible by container_of on the miscdev. But that memory was freed right?
David
Quoted 4 lines
thanks,
greg k-h
David E. Box
maintainerRe: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to Greg KHQuoted 26 lines · Greg KH
Quoted 25 lines · David E. Box
Intel Software Defined Silicon (SDSi) is a post manufacturing mechanism for activating additional silicon features. Features are enabled through a license activation process. The SDSi driver provides a per socket, ioctl interface for applications to perform 3 main provisioning functions:
1. Provision an Authentication Key Certificate (AKC), a key written to internal NVRAM that is used to authenticate a capability specific activation payload.
2. Provision a Capability Activation Payload (CAP), a token authenticated using the AKC and applied to the CPU configuration to activate a new feature.
3. Read the SDSi State Certificate, containing the CPU configuration state.
The ioctl operations perform function specific mailbox commands that forward the requests to SDSi hardware to perform authentication of the payloads and enable the silicon configuration (to be made available after power cycling).
The SDSi device itself is enumerated as an auxiliary device from the
intel_extended_capsdriver and as such has a build dependency onCONFIG_INTEL_EXTENDED_CAPS.
Quoted 5 lines
Quoted 2 lines
Signed-off-by David E. Box <[email protected]>I do not see the "required" review that Intel developers need when sending stuff to me. What happened here?
Ah. You were added because of the doc change. Normally, the changes to the driver wouldn't have gone through you. So it's just a miss on that. But it been through internal review.
David
Quoted 4 lines
thanks,
greg k-h
David E. Box
maintainerRe: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to Greg KHQuoted 31 lines · Greg KH
Quoted 17 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +17
-0+static long sdsi_device_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ + struct miscdevice *miscdev = file->private_data; + struct sdsi_priv *priv = to_sdsi_priv(miscdev); + void __user *argp = (void __user *)arg; + long ret = -EINVAL; + + if (!priv->dev_present) + return -ENODEV; + + if (!priv->sdsi_enabled) + return -EPERM; + + if (cmd == SDSI_IF_READ_STATE) + return sdsi_if_read_state_cert(priv, argp); + + mutex_lock(&priv->akc_lock);drivers/platform/x86/intel/sdsi.c line 416
Quoted 10 lines
drivers/platform/x86/intel/sdsi.c new file +10
-0+ switch (cmd) { + case SDSI_IF_PROVISION_AKC: + /* + * While writing an authentication certificate disallow other openers + * from using AKC or CAP. + */ + if (!priv->akc_owner) + priv->akc_owner = file; + + if (priv->akc_owner != file) {Please explain how this test would ever trigger and how you tested it?
Quoted 7 lines
What exactly are you trying to protect from here? If userspace has your file descriptor, it can do whatever it wants, don't try to be smarter than it as you will never win.
And why are you using ioctls at all here? As you are just reading/writing to the hardware directly, why not just use a binary sysfs file to be that pipe? What requires an ioctl at all?
So an original internal version of this did use binary attributes. But there was concern during review that a flow, particularly when doing the two write operations, could not be handled atomically while exposed as separate files. Above is the attempt to handle the situation in the ioctl. That is, whichever opener performs AKC write first would lock out all other openers from performing any write until that file is closed. This is to avoid interfering with that process, should the opener also decide to perform a CAP operation.
There may be future commands requiring RW ioctls as well.
David
Quoted 4 lines
thanks,
greg k-h
Re: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
Quoted 40 lines · David E. Box
Quoted 31 lines · Greg KH
Quoted 17 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +17
-0+static long sdsi_device_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ + struct miscdevice *miscdev = file->private_data; + struct sdsi_priv *priv = to_sdsi_priv(miscdev); + void __user *argp = (void __user *)arg; + long ret = -EINVAL; + + if (!priv->dev_present) + return -ENODEV; + + if (!priv->sdsi_enabled) + return -EPERM; + + if (cmd == SDSI_IF_READ_STATE) + return sdsi_if_read_state_cert(priv, argp); + + mutex_lock(&priv->akc_lock);drivers/platform/x86/intel/sdsi.c line 416
Quoted 10 lines
drivers/platform/x86/intel/sdsi.c new file +10
-0+ switch (cmd) { + case SDSI_IF_PROVISION_AKC: + /* + * While writing an authentication certificate disallow other openers + * from using AKC or CAP. + */ + if (!priv->akc_owner) + priv->akc_owner = file; + + if (priv->akc_owner != file) {Please explain how this test would ever trigger and how you tested it?
Quoted 7 lines
What exactly are you trying to protect from here? If userspace has your file descriptor, it can do whatever it wants, don't try to be smarter than it as you will never win.
And why are you using ioctls at all here? As you are just reading/writing to the hardware directly, why not just use a binary sysfs file to be that pipe? What requires an ioctl at all?
Quoted 6 lines
So an original internal version of this did use binary attributes. But there was concern during review that a flow, particularly when doing the two write operations, could not be handled atomically while exposed as separate files. Above is the attempt to handle the situation in the ioctl. That is, whichever opener performs AKC write first would lock out all other openers from performing any write until that file is closed. This is to avoid interfering with that process, should the opener also decide to perform a CAP operation.
Unfortunately, your code here does not prevent that at all, so your moving off of a binary sysfs attribute changed nothing.
You can "prevent" this from happening just as easily through a sysfs attribute as you can a character device node.
Quoted 1 line
There may be future commands requiring RW ioctls as well.
How am I or anyone else supposed to know that? We write code and review it for _today_, not what might be sometime in the future someday. As that will be dealt with when it actually happens.
greg k-h
Re: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. BoxQuoted 27 lines · David E. Box
Quoted 26 lines · Greg KH
Quoted 25 lines · David E. Box
Intel Software Defined Silicon (SDSi) is a post manufacturing mechanism for activating additional silicon features. Features are enabled through a license activation process. The SDSi driver provides a per socket, ioctl interface for applications to perform 3 main provisioning functions:
1. Provision an Authentication Key Certificate (AKC), a key written to internal NVRAM that is used to authenticate a capability specific activation payload.
2. Provision a Capability Activation Payload (CAP), a token authenticated using the AKC and applied to the CPU configuration to activate a new feature.
3. Read the SDSi State Certificate, containing the CPU configuration state.
The ioctl operations perform function specific mailbox commands that forward the requests to SDSi hardware to perform authentication of the payloads and enable the silicon configuration (to be made available after power cycling).
The SDSi device itself is enumerated as an auxiliary device from the
intel_extended_capsdriver and as such has a build dependency onCONFIG_INTEL_EXTENDED_CAPS.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by David E. Box <[email protected]>I do not see the "required" review that Intel developers need when sending stuff to me. What happened here?
Ah. You were added because of the doc change. Normally, the changes to the driver wouldn't have gone through you. So it's just a miss on that. But it been through internal review.
Then where is the "reviewed-by:" line that shows this happened?
Re: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. BoxQuoted 43 lines · David E. Box
Quoted 31 lines · Greg KH
drivers/platform/x86/intel/sdsi.c line 490
Quoted 5 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +5
-0+static int sdsi_device_open (struct inode *inode,struct file *file) +{ + struct miscdevice *miscdev = file->private_data; + + get_device(miscdev->this_device);Why do you think this is needed? Shouldn't the misc core handle all of this for you already?
drivers/platform/x86/intel/sdsi.c line 502
Quoted 12 lines
drivers/platform/x86/intel/sdsi.c new file +12
-0+ + return 0; +} + +static int sdsi_device_release (struct inode *inode,struct file *file) +{ + + struct miscdevice *miscdev = file->private_data; + struct sdsi_priv *priv = to_sdsi_priv(miscdev); + + if (priv->akc_owner == file) + priv->akc_owner = NULL;Why is this needed?
Quoted 2 lines
+
+ put_device(miscdev->this_device);I see this matches the open call, but if you do not have this in the open call, is it needed here as well?
Quoted 6 lines
Quoted 3 lines
+ ret =
devm_add_action_or_reset(priv->miscdev.this_device, sdsi_miscdev_remove, priv); + if (ret)
+ gotoderegister_misc;I think this is all you need to clean up your device memory, not the get/put device in open/release, right?
It does clean up the memory, but it does so immediately after the device has been unregistered, even if a file is open. The get/put ensures that if files are open, the memory isn't cleaned up until the files are closed.
Quoted 8 lines
I can show that this happens without the get/put,
open() unbind device -> devm action called -> kfree(priv) ioctl() -> priv accessedbut it doesn't blow up. I guess because the former location of priv is accessible by
container_ofon the miscdev. But that memory was freed right?
You are dealing with two different structures with two different lifecycles and reference counts. Yes, you can kind of try to tie them together here, but really, that way lies madness. Why not just drop the misc device entirely and only use the struct device that the kernel created for you? That would make everything much simpler.
thanks,
greg k-h
David E. Box
maintainerRe: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
In reply to Greg KHQuoted 51 lines · Greg KH
Quoted 40 lines · David E. Box
Quoted 31 lines · Greg KH
Quoted 17 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +17
-0+static long sdsi_device_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ + struct miscdevice *miscdev = file->private_data; + struct sdsi_priv *priv = to_sdsi_priv(miscdev); + void __user *argp = (void __user *)arg; + long ret = -EINVAL; + + if (!priv->dev_present) + return -ENODEV; + + if (!priv->sdsi_enabled) + return -EPERM; + + if (cmd == SDSI_IF_READ_STATE) + return sdsi_if_read_state_cert(priv, argp); + + mutex_lock(&priv->akc_lock);drivers/platform/x86/intel/sdsi.c line 416
Quoted 10 lines
drivers/platform/x86/intel/sdsi.c new file +10
-0+ switch (cmd) { + case SDSI_IF_PROVISION_AKC: + /* + * While writing an authentication certificate disallow other openers + * from using AKC or CAP. + */ + if (!priv->akc_owner) + priv->akc_owner = file; + + if (priv->akc_owner != file) {Please explain how this test would ever trigger and how you tested it?
Quoted 7 lines
What exactly are you trying to protect from here? If userspace has your file descriptor, it can do whatever it wants, don't try to be smarter than it as you will never win.
And why are you using ioctls at all here? As you are just reading/writing to the hardware directly, why not just use a binary sysfs file to be that pipe? What requires an ioctl at all?
Quoted 6 lines
So an original internal version of this did use binary attributes. But there was concern during review that a flow, particularly when doing the two write operations, could not be handled atomically while exposed as separate files. Above is the attempt to handle the situation in the ioctl. That is, whichever opener performs AKC write first would lock out all other openers from performing any write until that file is closed. This is to avoid interfering with that process, should the opener also decide to perform a CAP operation.
Unfortunately, your code here does not prevent that at all, so your moving off of a binary sysfs attribute changed nothing.
Quoted 8 lines
You can "prevent" this from happening just as easily through a sysfs attribute as you can a character device node.
Quoted 1 line
There may be future commands requiring RW ioctls as well.
How am I or anyone else supposed to know that? We write code and review it for _today_, not what might be sometime in the future someday. As that will be dealt with when it actually happens.
Sure. Thanks for the insightful review. I'll take your comments back and submit with the reviewed-by tag. Will probably switch back to sysfs.
David
Quoted 2 lines
greg k-h
Re: [PATCH 2/5] platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
In reply to David E. BoxQuoted 32 lines · David E. Box
Intel Platform Monitoring Technology (PMT) support is indicated by presence of an Intel defined PCIe DVSEC structure with a PMT ID. However DVSEC structures may also be used by Intel to indicate support for other capabilities unrelated to PMT. The Out Of Band Management Services Module (OOBMSM) is an example of a device that can have both PMT and non-PMT capabilities. In order to support these capabilities it is necessary to modify the
intel_pmtdriver to handle the creation of platform devices more generically. To that end the following changes are made.Convert the driver and child drivers from MFD to the Auxiliary Bus. This architecture is more suitable anyway since the driver partitions a multifunctional PCIe device. This also moves the driver out of the MFD subsystem and into platform/x86/intel.
Before, devices were named by their capability (e.g.
pmt_telemetry). Instead, generically name them by their capability ID (e.g. intel_extended_cap.2). This allows the IDs to be created automatically, minimizing the code needed to support future capabilities. However, to ensure that unsupported devices aren't created, use an allow list to specify supported capabilities. Along these lines, rename the driver fromintel_pmttointel_extended_capsto better reflect the purpose.Signed-off-by David E. Box <[email protected]>---
V1: New patch. However incorporates some elements of [1] which was
dropped. Namely enumerating features generically and creating an allow list. Also cleans up probe by moving some code to functions and using a bool instead of an int to track whether a device was added.
<...>
drivers/platform/x86/intel/extended_caps.c line 308
Quoted 12 lines
drivers/platform/x86/intel/extended_caps.c new file +12
-0+static int extended_caps_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) +{ +struct extended_caps_platform_info *info; +bool have_devices = false; +unsigned long quirks =0 ; +int ret; + + ret =pcim_enable_device (pdev); +if (ret) +return ret; + + info = (struct extended_caps_platform_info *)id->driver_data;
pci_get_drvdata() in all places and no need to cast void *.
Quoted 13 lines
drivers/platform/x86/intel/extended_caps.c new file +13
-0+if (info) + quirks = info->quirks; + + have_devices |=extended_caps_walk_dvsec (pdev, quirks); + +if (info && (info->quirks &EXT_CAPS_QUIRK_NO_DVSEC )) + have_devices |=extended_caps_walk_header (pdev, quirks, info->capabilities); + +if (!have_devices) +return -ENODEV ; + +return 0 ; +}
<...>
drivers/platform/x86/intel/pmt/telemetry.c static int pmt_telem_probe(struct platform_device *pdev) · line 125
Quoted 8 lines
drivers/platform/x86/intel/pmt/telemetry.c +2
-6-static struct platform_driver pmt_telem_driver = { - .driver = { - .name =TELEM_DEV_NAME , - }, - .remove = pmt_telem_remove, - .probe = pmt_telem_probe, +static const struct auxiliary_device_id pmt_telem_aux_id_table[] = { + { .name ="intel_extended_caps.2" , },
Why "2" in the name?
Thanks
Quoted 10 lines
drivers/platform/x86/intel/pmt/telemetry.c +8
-0+ {}, +}; +MODULE_DEVICE_TABLE (auxiliary, pmt_telem_aux_id_table); + +static struct auxiliary_driver pmt_telem_aux_driver = { + .id_table = pmt_telem_aux_id_table, + .remove = pmt_telem_remove, + .probe = pmt_telem_probe, };
David E. Box
maintainerRe: [PATCH 2/5] platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
Quoted 36 lines · Leon Romanovsky
Quoted 32 lines · David E. Box
Intel Platform Monitoring Technology (PMT) support is indicated by presence of an Intel defined PCIe DVSEC structure with a PMT ID. However DVSEC structures may also be used by Intel to indicate support for other capabilities unrelated to PMT. The Out Of Band Management Services Module (OOBMSM) is an example of a device that can have both PMT and non-PMT capabilities. In order to support these capabilities it is necessary to modify the
intel_pmtdriver to handle the creation of platform devices more generically. To that end the following changes are made.Convert the driver and child drivers from MFD to the Auxiliary Bus. This architecture is more suitable anyway since the driver partitions a multifunctional PCIe device. This also moves the driver out of the MFD subsystem and into platform/x86/intel.
Before, devices were named by their capability (e.g.
pmt_telemetry). Instead, generically name them by their capability ID (e.g. intel_extended_cap.2). This allows the IDs to be created automatically, minimizing the code needed to support future capabilities. However, to ensure that unsupported devices aren't created, use an allow list to specify supported capabilities. Along these lines, rename the driver fromintel_pmttointel_extended_capsto better reflect the purpose.Signed-off-by David E. Box <[email protected]>---
V1: New patch. However incorporates some elements of [1] which was dropped. Namely enumerating features generically and creating an allow list. Also cleans up probe by moving some code to functions and using a bool instead of an int to track whether a device was added.
<...>
Quoted 14 lines
drivers/platform/x86/intel/extended_caps.c line 308
Quoted 12 lines
drivers/platform/x86/intel/extended_caps.c new file +12
-0+static int extended_caps_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) +{ + struct extended_caps_platform_info *info; + bool have_devices = false; + unsigned long quirks = 0; + int ret; + + ret = pcim_enable_device(pdev); + if (ret) + return ret; + + info = (struct extended_caps_platform_info *)id->driver_data;
pci_get_drvdata()in all places and no need to cast void *.
This is coming from the id not the pdev. The data here is type kernel_ulong_t.
Quoted 17 lines
Quoted 14 lines
+ if (info)
+ quirks =info->quirks;drivers/platform/x86/intel/extended_caps.c new file +11
-0+ + have_devices |= extended_caps_walk_dvsec(pdev, quirks); + + if (info && (info->quirks & EXT_CAPS_QUIRK_NO_DVSEC)) + have_devices |= extended_caps_walk_header(pdev, quirks, info->capabilities); + + if (!have_devices) + return -ENODEV; + + return 0; +}<...>
Quoted 10 lines
drivers/platform/x86/intel/pmt/telemetry.c static int pmt_telem_probe(struct platform_device *pdev) · line 125
Quoted 8 lines
drivers/platform/x86/intel/pmt/telemetry.c +2
-6-static struct platform_driver pmt_telem_driver = { - .driver = { - .name = TELEM_DEV_NAME, - }, - .remove = pmt_telem_remove, - .probe = pmt_telem_probe, +static const struct auxiliary_device_id pmt_telem_aux_id_table[] = { + { .name = "intel_extended_caps.2", },Why "2" in the name?
This is being changed to a string for the next version after similar comment. Thanks.
David
Quoted 13 lines
Thanks
Quoted 10 lines
+ {},
drivers/platform/x86/intel/pmt/telemetry.c +7
-0+}; +MODULE_DEVICE_TABLE (auxiliary, pmt_telem_aux_id_table); + +static struct auxiliary_driver pmt_telem_aux_driver = { + .id_table = pmt_telem_aux_id_table, + .remove = pmt_telem_remove, + .probe = pmt_telem_probe,};
Re: [PATCH 2/5] platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
Quoted 52 lines · David E. Box
Quoted 36 lines · Leon Romanovsky
Quoted 32 lines · David E. Box
Intel Platform Monitoring Technology (PMT) support is indicated by presence of an Intel defined PCIe DVSEC structure with a PMT ID. However DVSEC structures may also be used by Intel to indicate support for other capabilities unrelated to PMT. The Out Of Band Management Services Module (OOBMSM) is an example of a device that can have both PMT and non-PMT capabilities. In order to support these capabilities it is necessary to modify the
intel_pmtdriver to handle the creation of platform devices more generically. To that end the following changes are made.Convert the driver and child drivers from MFD to the Auxiliary Bus. This architecture is more suitable anyway since the driver partitions a multifunctional PCIe device. This also moves the driver out of the MFD subsystem and into platform/x86/intel.
Before, devices were named by their capability (e.g.
pmt_telemetry). Instead, generically name them by their capability ID (e.g. intel_extended_cap.2). This allows the IDs to be created automatically, minimizing the code needed to support future capabilities. However, to ensure that unsupported devices aren't created, use an allow list to specify supported capabilities. Along these lines, rename the driver fromintel_pmttointel_extended_capsto better reflect the purpose.Signed-off-by David E. Box <[email protected]>---
V1: New patch. However incorporates some elements of [1] which was dropped. Namely enumerating features generically and creating an allow list. Also cleans up probe by moving some code to functions and using a bool instead of an int to track whether a device was added.
<...>
Quoted 14 lines
drivers/platform/x86/intel/extended_caps.c line 308
Quoted 12 lines
drivers/platform/x86/intel/extended_caps.c new file +12
-0+static int extended_caps_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) +{ + struct extended_caps_platform_info *info; + bool have_devices = false; + unsigned long quirks = 0; + int ret; + + ret = pcim_enable_device(pdev); + if (ret) + return ret; + + info = (struct extended_caps_platform_info *)id->driver_data;
pci_get_drvdata()in all places and no need to cast void *.
Quoted 1 line
This is coming from the id not the pdev. The data here is type
kernel_ulong_t.
Ohh, this is very unusual.
Thanks
kernel test robot
build botRe: [PATCH 2/5] platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
In reply to David E. BoxI love your patch! Yet something to improve:
Hi "David,
I love your patch! Yet something to improve:
[auto build test ERROR on helgaas-pci/next]
[also build test ERROR on v5.15]
[cannot apply to lee-mfd/for-mfd-next linus/master next-20211112] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/David-E-Box/Move-intel_pm-from-MFD-to-Auxiliary-bus/20211001-092947 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: i386-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/d63e76113333b937640e263f8b63be91d307a61e git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review David-E-Box/Move-intel_pm-from-MFD-to-Auxiliary-bus/20211001-092947 git checkout d63e76113333b937640e263f8b63be91d307a61e # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/platform/x86/intel/pmt/crashlog.c:303:41: error: 'pmt_crashlog_aux_id_table' defined but not used [-Werror=unused-const-variable=]
303 | static const struct auxiliary_device_id pmt_crashlog_aux_id_table[] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
vim +/pmt_crashlog_aux_id_table +303 drivers/platform/x86/intel/pmt/crashlog.c
302
> 303 static const struct auxiliary_device_id pmt_crashlog_aux_id_table[] = { 304 { .name = "intel_extended_caps.4", },
305 {},
306 };
307 MODULE_DEVICE_TABLE(auxiliary, pmt_crashlog_aux_id_table);
308
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org