Auxiliary bus driver support for Intel PCIe VSEC/DVSEC
Subsystems (7)
David E. Box
maintainercover Auxiliary bus driver support for Intel PCIe VSEC/DVSEC
This series makes changes to the current intel_pmt driver to give it broader support for Intel defined PCIe VSEC and DVSEC features. It moves the implementation from MFD to the auxiliary bus and creates a generic framework for enumerating the extended capabilities. It also adds support for a new VSEC, Software Defined Silicon (SDSi).
David E. Box (4):
PCI: Add #defines for accessing PCIe DVSEC fields driver core: auxiliary bus: Add driver data helpers platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus platform/x86: Add Intel Software Defined Silicon driver
.../ABI/testing/sysfs-driver-intel_sdsi | 75 +++ MAINTAINERS | 17 +- 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/pmt/Kconfig | 4 +- drivers/platform/x86/intel/pmt/class.c | 21 +- drivers/platform/x86/intel/pmt/class.h | 5 +- drivers/platform/x86/intel/pmt/crashlog.c | 47 +- drivers/platform/x86/intel/pmt/telemetry.c | 46 +- drivers/platform/x86/intel/sdsi.c | 571 ++++++++++++++++++ drivers/platform/x86/intel/vsec.c | 418 +++++++++++++ drivers/platform/x86/intel/vsec.h | 43 ++ include/linux/auxiliary_bus.h | 10 + include/uapi/linux/pci_regs.h | 4 + 17 files changed, 1225 insertions(+), 335 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/sdsi.c create mode 100644 drivers/platform/x86/intel/vsec.c create mode 100644 drivers/platform/x86/intel/vsec.h
Signature · 1 line
2.25.1
David E. Box
maintainerPATCH 1/4 PCI: Add #defines for accessing PCIe DVSEC fields
Add #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.
--- include/uapi/linux/pci_regs.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/linux/pci_regs.h +4 -0
@@ -1086,7 +1086,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
Greg KH
maintainerRe: [PATCH 1/4] PCI: Add #defines for accessing PCIe DVSEC fields
Quoted 16 lines · David E. Box
Add #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.
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>Reviewed-by Rafael J. Wysocki <[email protected]>--- include/uapi/linux/pci_regs.h | 4 ++++ 1 file changed, 4 insertions(+)include/uapi/linux/pci_regs.h +0
-0
include/uapi/linux/pci_regs.h line 1093
Quoted 8 lines
include/uapi/linux/pci_regs.h +4
-0@@ -1086,7 +1086,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)
Why does userspace need to have these defines? What userspace tool is going to use these?
thanks,
greg k-h
David E. Box
maintainerRe: [PATCH 1/4] PCI: Add #defines for accessing PCIe DVSEC fields
Quoted 18 lines · Greg KH
Quoted 17 lines · David E. Box
Add #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.
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>Reviewed-by Rafael J. Wysocki <[email protected]>--- include/uapi/linux/pci_regs.h | 4 ++++ 1 file changed, 4 insertions(+)include/uapi/linux/pci_regs.h +0
-0@@ -1086,7 +1086,11 @@
Quoted 12 lines
Quoted 9 lines
include/uapi/linux/pci_regs.h +0
-0/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ #define PCI_DVSEC_HEADER1 0x4/* Designated Vendor-Specific Header1 */
include/uapi/linux/pci_regs.h +3
-0+#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 */
+#definePCI_DVSEC_HEADER2_ID(x)((x) &0xffff)Why does userspace need to have these defines? What userspace tool is going to use these?
These headers should useful for userspace tools that access PCI devices. DVSEC is also used by CXL so they should come in handy for tools accesses those devices.
Quoted 4 lines
thanks,
greg k-h
Re: [PATCH 1/4] PCI: Add #defines for accessing PCIe DVSEC fields
In reply to Greg KHQuoted 18 lines · Greg KH
Quoted 17 lines · David E. Box
Add #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.
Signed-off-by David E. Box <[email protected]>Acked-by Bjorn Helgaas <[email protected]>Reviewed-by Rafael J. Wysocki <[email protected]>--- include/uapi/linux/pci_regs.h | 4 ++++ 1 file changed, 4 insertions(+)include/uapi/linux/pci_regs.h +0
-0@@ -1086,7 +1086,11 @@
Quoted 10 lines
include/uapi/linux/pci_regs.h line 1093
Quoted 7 lines
include/uapi/linux/pci_regs.h +4
-0/* 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)Why does userspace need to have these defines? What userspace tool is going to use these?
This is pretty typical of other content in pci_regs.h. There's lots of existing content that may not be directly useful to userspace, but it's there because it's convenient to have definitions prescribed by the spec all together in one place.
They probably shouldn't go in drivers/pci/pci.h because by definition this vendor-specific stuff will be used by vendor-specific drivers but not by the PCI core.
I guess these *could* go in include/linux/pci.h, but that wouldn't be my first choice because there's nothing similar there.
Bjorn
David E. Box
maintainerPATCH 2/4 driver core: auxiliary bus: Add driver data helpers
In reply to David E. BoxAdds get/set driver data helpers for auxiliary devices.
---
Note, I have another patchset that modifies current auxiliary drivers to use this new helper. But since it touches 5 different subsystems, I plan to submit it after this series is accepted.
include/linux/auxiliary_bus.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/linux/auxiliary_bus.h +10 -0
@@ -28,6 +28,16 @@ struct auxiliary_driver {const struct auxiliary_device_id *id_table; }; +static inline void *auxiliary_get_drvdata (struct auxiliary_device *auxdev) +{ +return dev_get_drvdata (&auxdev->dev); +} + +static inline void auxiliary_set_drvdata (struct auxiliary_device *auxdev,void *data) +{ +dev_set_drvdata (&auxdev->dev, data); +} +static inline struct auxiliary_device *to_auxiliary_dev (struct device *dev) { return container_of(dev, struct auxiliary_device, dev);
Signature · 1 line
2.25.1
David E. Box
maintainerPATCH 3/4 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 Designated Vendor Specific Extended Capabilities (DVSEC) structure with a PMT specific ID. The current MFD implementation creates child devices for each PMT feature, currently telemetry and crashlog. However DVSEC structures may also be used by Intel to indicate support for other features. The Out Of Band Management Services Module (OOBMSM) uses DVSEC to enumerate several features, including PMT. In order to support them it is necessary to modify the intel_pmt driver to handle the creation of the child devices more generically. Additionally, since these are not platform devices (which is what MFD is really intended for) move the implementation to the more appropriate Auxiliary bus and host in platform/x86/intel. Also, rename the driver from intel_pmt to intel_vsec to better reflect the purpose.
--- MAINTAINERS | 12 +- 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/pmt/Kconfig | 4 +- drivers/platform/x86/intel/pmt/class.c | 21 +- drivers/platform/x86/intel/pmt/class.h | 5 +- drivers/platform/x86/intel/pmt/crashlog.c | 47 +-- drivers/platform/x86/intel/pmt/telemetry.c | 46 +-- drivers/platform/x86/intel/vsec.c | 408 +++++++++++++++++++++ drivers/platform/x86/intel/vsec.h | 43 +++ 13 files changed, 536 insertions(+), 335 deletions(-) delete mode 100644 drivers/mfd/intel_pmt.c create mode 100644 drivers/platform/x86/intel/vsec.c create mode 100644 drivers/platform/x86/intel/vsec.h
MAINTAINERS +8 -4
@@ -9741,10 +9741,9 @@ S: Maintained F: drivers/mfd/intel_soc_pmic* F: include/linux/mfd/intel_soc_pmic* -INTEL PMT DRIVER -M: "David E. Box" <[email protected]> -S: Maintained -F: drivers/mfd/intel_pmt.c +INTEL PMT DRIVERS +M: David E. Box <[email protected]> +S: Supported F: drivers/platform/x86/intel/pmt/ INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
@@ -9811,6 +9810,11 @@ L: [email protected] S: Maintained F: drivers/platform/x86/intel/uncore-frequency.c +INTEL VENDOR SPECIFIC EXTENDED CAPABILITIES DRIVER +M: David E. Box <[email protected]> +S: Supported +F: drivers/platform/x86/intel/vsec.* + INTEL VIRTUAL BUTTON DRIVER M: AceLan Kao <[email protected]> L: [email protected]
drivers/mfd/Kconfig +0 -10
@@ -692,16 +692,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 X86 && 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
@@ -211,7 +211,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
@@ -184,4 +184,15 @@ config INTEL_UNCORE_FREQ_CONTROL To compile this driver as a module, choose M here: the module will be called intel-uncore-frequency. +config INTEL_VSEC + tristate "Intel Vendor Specific Extended Capabilities Driver" + 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_vsec. + endif # X86_PLATFORM_DRIVERS_INTEL
drivers/platform/x86/intel/Makefile +2 -0
@@ -26,6 +26,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_vsec-y := vsec.o +obj-$(CONFIG_INTEL_VSEC) += intel_vsec.o # Intel PMIC / PMC / P-Unit drivers intel_bxtwc_tmu-y := bxtwc_tmu.o
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_VSEC 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_VSEC select INTEL_PMT_CLASS help The Intel Platform Monitoring Technology (PMT) crashlog driver provides
drivers/platform/x86/intel/pmt/class.c +10 -11
@@ -13,6 +13,7 @@#include <linux/mm.h> #include <linux/pci.h> +#include "../vsec.h" #include "class.h" #define PMT_XA_START 0
@@ -281,31 +282,29 @@ 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_vsec_device *intel_vsec_dev,int idx) { +struct device *dev = &intel_vsec_dev->auxdev.dev;struct intel_pmt_header header;struct resource *disc_res; -int ret = -ENODEV ; +int ret; - disc_res =platform_get_resource (pdev,IORESOURCE_MEM , idx); -if (!disc_res) -return ret; + disc_res = &intel_vsec_dev->resource[idx]; - 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);
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 "../vsec.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_vsec_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 +25 -22
106 lines not on this page · raw message
drivers/platform/x86/intel/pmt/telemetry.c +24 -22
106 lines not on this page · raw message
drivers/platform/x86/intel/vsec.c new file +408 -0
408 lines not on this page · raw message
drivers/platform/x86/intel/vsec.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 3/4] platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
Quoted 5 lines · David E. Box
Intel Platform Monitoring Technology (PMT) support is indicated by presence of an Intel defined PCIe Designated Vendor Specific Extended Capabilities (DVSEC) structure with a PMT specific ID. The current MFD implementation creates child devices for each PMT feature, currently telemetry and crashlog.
Apparently "watcher," too?
Quoted 3 lines
However DVSEC structures may also be used by Intel to indicate support for other features. The Out Of Band Management Services Module (OOBMSM)
OOBMSM refers to something outside this series? Oh, I see ... looks like that's a specific device (PCI_DEVICE_ID_INTEL_VSEC_OOBMSM).
Quoted 6 lines
uses DVSEC to enumerate several features,
including PMT. In order to support them it is necessary to modify theintel_pmtdriver to handle the creation of the child devices more generically. Additionally, since these are not platform devices (which is what MFD is really intended for) move the implementation to the more appropriate Auxiliary bus and host in platform/x86/intel.
It'd be useful to mention *why* the auxiliary bus is more appropriate. It's not obvious to me.
drivers/mfd/intel_pmt.c line 227
Quoted 12 lines
Also, rename
the driver fromintel_pmttointel_vsecto better reflect the purpose.Signed-off-by David E. Box <[email protected]>Reviewed-by Mark Gross <[email protected]>drivers/mfd/intel_pmt.c deleted +0
-6-static int pmt_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) -{ - ... - -pm_runtime_put (&pdev->dev); -pm_runtime_allow (&pdev->dev);
What happened to this runtime PM functionality? Is it no longer needed when using the auxiliary bus? I don't see corresponding functionality there.
Quoted 16 lines
drivers/platform/x86/intel/vsec.c new file +7
-8-return 0 ; -} - -static void pmt_pci_remove (struct pci_dev *pdev) -{ -pm_runtime_forbid (&pdev->dev); -pm_runtime_get_sync (&pdev->dev); -} +static int intel_vsec_add_dev (struct pci_dev *pdev,struct intel_vsec_header *header, +unsigned long quirks) +{ + ... + res =kcalloc (header->num_entries,sizeof (*res),GFP_KERNEL ); +if (!res) { +kfree (intel_vsec_dev);
drivers/platform/x86/intel/vsec.c line 201
Quoted 10 lines
drivers/platform/x86/intel/vsec.c new file +10
-0+return -ENOMEM ; + } + +if (quirks &VSEC_QUIRK_TABLE_SHIFT ) + header->offset >>=TABLE_OFFSET_SHIFT ; + +/* +* The DVSEC/VSEC contains the starting offset and count for a block of +* discovery tables. Create a resource list of these tables to the +* auxiliary device driver.
"res" looks like an array of resources, not a list, i.e., I don't see any ->next pointers here.
Quoted 11 lines
drivers/platform/x86/intel/vsec.c new file +11
-0+*/ +for (i =0 , tmp = res; i < header->num_entries; i++, tmp++) { + tmp->start = pdev->resource[header->tbir].start + + header->offset + i * (header->entry_size *sizeof (u32)); + tmp->end = tmp->start + (header->entry_size *sizeof (u32)) -1 ; + tmp->flags =IORESOURCE_MEM ; + } + + intel_vsec_dev->pcidev = pdev; + intel_vsec_dev->resource = res; + intel_vsec_dev->num_resources = header->num_entries;
drivers/platform/x86/intel/vsec.c
Quoted 10 lines
drivers/platform/x86/intel/vsec.c new file +9
-0+ intel_vsec_dev->quirks = quirks; + intel_vsec_dev->ida = &intel_vsec_ida; + +return intel_vsec_add_aux (pdev, intel_vsec_dev,intel_vsec_name (header->id)); +} +/* TGL info */ +static const struct intel_vsec_platform_info tgl_info = { + .quirks =VSEC_QUIRK_NO_WATCHER |VSEC_QUIRK_NO_CRASHLOG |VSEC_QUIRK_TABLE_SHIFT , +};
I guess these are essentially device defects, i.e., TGL advertises watcher and crashlog via VSEC, but doesn't actually support them?
drivers/platform/x86/intel/vsec.c line 394
Quoted 9 lines
drivers/platform/x86/intel/vsec.c new file +9
-0+#define PCI_DEVICE_ID_INTEL_VSEC_ADL 0x467d +#define PCI_DEVICE_ID_INTEL_VSEC_DG1 0x490e +#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM 0x09a7 +#define PCI_DEVICE_ID_INTEL_VSEC_TGL 0x9a0d +static const struct pci_device_id intel_vsec_pci_ids[] = { + {PCI_DEVICE_DATA (INTEL ,VSEC_ADL , &tgl_info) }, + {PCI_DEVICE_DATA (INTEL ,VSEC_DG1 , &dg1_info) }, + {PCI_DEVICE_DATA (INTEL ,VSEC_OOBMSM ,NULL ) }, + {PCI_DEVICE_DATA (INTEL ,VSEC_TGL , &tgl_info) },
IIUC, you're implicitly saying that only these listed Device IDs can have these VSEC capabilities, or at least, that these VSEC-described features are only supported on these Device IDs.
That's not the way PCI capabilities work in general, so this doesn't feel like a perfect fit to me, but I guess it's probably the only way to identify the devices you care about.
Bjorn
David E. Box
maintainerRe: [PATCH 3/4] platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
Quoted 8 lines · Bjorn Helgaas
Quoted 5 lines · David E. Box
Intel Platform Monitoring Technology (PMT) support is indicated by presence of an Intel defined PCIe Designated Vendor Specific Extended Capabilities (DVSEC) structure with a PMT specific ID. The current MFD implementation creates child devices for each PMT feature, currently telemetry and crashlog.
Apparently "watcher," too?
Yes.
Quoted 7 lines
Quoted 4 lines
However DVSEC structures may also be used by Intel to indicate support for other features. The Out Of Band Management Services Module (OOBMSM)
OOBMSM refers to something outside this series? Oh, I see ... looks like that's a specific device (
PCI_DEVICE_ID_INTEL_VSEC_OOBMSM).
Yes
Quoted 10 lines
Quoted 7 lines
uses DVSEC to enumerate several features,
including PMT. In order to support them it is necessary to modify theintel_pmtdriver to handle the creation of the child devices more generically. Additionally, since these are not platform devices (which is what MFD is really intended for) move the implementation to the more appropriate Auxiliary bus and host in platform/x86/intel.It'd be useful to mention *why* the auxiliary bus is more appropriate. It's not obvious to me.
Sure I'll add this.
Quoted 4 lines
Quoted 4 lines
Also, rename
the driver fromintel_pmttointel_vsecto better reflect the purpose.
Quoted 13 lines
drivers/mfd/intel_pmt.c line 227
Quoted 9 lines
Signed-off-by David E. Box <[email protected]>Reviewed-by Mark Gross <[email protected]>-static int
pmt_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)drivers/mfd/intel_pmt.c deleted +0
-5-{ - ... - -pm_runtime_put (&pdev->dev); -pm_runtime_allow (&pdev->dev);What happened to this runtime PM functionality? Is it no longer needed when using the auxiliary bus? I don't see corresponding functionality there.
I need to add a comment for this. Support will be added back when a device is added that needs it. Current devices do not.
Quoted 22 lines
Quoted 22 lines
drivers/mfd/intel_pmt.c deleted +1
-8-return 0 ; -} - -static void pmt_pci_remove (struct pci_dev *pdev) -{ -pm_runtime_forbid (&pdev->dev); -pm_runtime_get_sync (&pdev->dev); -} +static int intel_vsec_add_dev(struct pci_dev *pdev, struct
intel_vsec_header*header,drivers/platform/x86/intel/vsec.c new file +11
-0+ unsigned long quirks) +{ + ... + res =kcalloc (header->num_entries,sizeof (*res),GFP_KERNEL ); +if (!res) { +kfree (intel_vsec_dev); +return -ENOMEM ; + } + +if (quirks &VSEC_QUIRK_TABLE_SHIFT ) + header->offset >>=TABLE_OFFSET_SHIFT ;
Quoted 8 lines
drivers/platform/x86/intel/vsec.c line 201
Quoted 5 lines
drivers/platform/x86/intel/vsec.c new file +5
-0+ +/* +* The DVSEC/VSEC contains the starting offset and count for a block of +* discovery tables. Create a resource list of these tables to the +* auxiliary device driver. "res" looks like an array of resources, not a list, i.e., I don't see any ->next pointers here.
Yes. Sorry I used "list" loosely.
Quoted 18 lines
Quoted 18 lines
drivers/platform/x86/intel/vsec.c new file +4
-0+*/ +for (i =0 , tmp = res; i < header->num_entries; i++, tmp++) { + tmp->start = pdev->resource[header->tbir].start + + header->offset + i * (header->entry_size *sizeof(u32));
drivers/platform/x86/intel/vsec.c new file +11
-0+ tmp->end = tmp->start + (header->entry_size *sizeof (u32)) -1 ; + tmp->flags =IORESOURCE_MEM ; + } + + intel_vsec_dev->pcidev = pdev; + intel_vsec_dev->resource = res; + intel_vsec_dev->num_resources = header->num_entries; + intel_vsec_dev->quirks = quirks; + intel_vsec_dev->ida = &intel_vsec_ida; + + return intel_vsec_add_aux(pdev, intel_vsec_dev, intel_vsec_name(header-Quoted 1 line
id));
Quoted 9 lines
Quoted 6 lines
drivers/platform/x86/intel/vsec.c new file +4
-0+} +/* TGL info */ +static const struct intel_vsec_platform_info tgl_info = { + .quirks = VSEC_QUIRK_NO_WATCHER | VSEC_QUIRK_NO_CRASHLOG |
VSEC_QUIRK_TABLE_SHIFT,
+};I guess these are essentially device defects, i.e., TGL advertises watcher and crashlog via VSEC, but doesn't actually support them?
That's correct. There were several deviations in implementation between the first devices and this is how they were resolved. The OOBMSM device doesn't require any of these workarounds, hence why it provides no info. Though we may use this structure in the future for actual platform data.
Quoted 14 lines
drivers/platform/x86/intel/vsec.c line 394
Quoted 10 lines
drivers/platform/x86/intel/vsec.c new file +9
-0+#define PCI_DEVICE_ID_INTEL_VSEC_ADL 0x467d +#define PCI_DEVICE_ID_INTEL_VSEC_DG1 0x490e +#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM 0x09a7 +#define PCI_DEVICE_ID_INTEL_VSEC_TGL 0x9a0d +static const struct pci_device_id intel_vsec_pci_ids[] = { + {PCI_DEVICE_DATA (INTEL ,VSEC_ADL , &tgl_info) }, + {PCI_DEVICE_DATA (INTEL ,VSEC_DG1 , &dg1_info) }, + {PCI_DEVICE_DATA (INTEL ,VSEC_OOBMSM ,NULL ) }, + {PCI_DEVICE_DATA (INTEL ,VSEC_TGL , &tgl_info) },IIUC, you're implicitly saying that only these listed Device IDs can have these VSEC capabilities, or at least, that these VSEC-described features are only supported on these Device IDs.
Yes and yes.
Quoted 4 lines
That's not the way PCI capabilities work in general, so this doesn't feel like a perfect fit to me, but I guess it's probably the only way to identify the devices you care about.
Understood.
David
Quoted 2 lines
Bjorn
David E. Box
maintainerPATCH 4/4 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, sysfs attribute 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 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_vsec driver and as such has a build dependency on CONFIG_INTEL_VSEC.
--- .../ABI/testing/sysfs-driver-intel_sdsi | 75 +++ MAINTAINERS | 5 + drivers/platform/x86/intel/Kconfig | 12 + drivers/platform/x86/intel/Makefile | 2 + drivers/platform/x86/intel/sdsi.c | 571 ++++++++++++++++++ drivers/platform/x86/intel/vsec.c | 12 +- 6 files changed, 676 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-intel_sdsi create mode 100644 drivers/platform/x86/intel/sdsi.c
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +75 -0
@@ -0,0 +1,75 @@ +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + This folder contains interface files for accessing Intel + Software Defined Silicon (SDSi) features on a CPU. X + represent the socket instance (though not the socket id). + + Some files communicate with SDSi hardware through a mailbox. + Should the operation fail, one of the following error codes + may be returned: + + Error Code Cause + ---------- ----- + EIO General mailbox failure. Log may indicate cause. + EBUSY Mailbox is owned by another agent. + EPERM SDSI capability is not enabled in hardware. + EPROTO Failure in mailbox protocol detected by driver. + See log for details. + EOVERFLOW For provision commands, the size of the data + exceeds what may be written. + ESPIPE Seeking is not allowed. + ETIMEDOUT Failure to complete mailbox transaction in time. + +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/guid +Date: Nov 2021 +KernelVersion: 5.17 +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/bus/auxiliary/devices/intel_extended_cap.sdsi.X/registers +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (RO) Contains information needed by applications to provision + a CPU and monitor status information. 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 + +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/provision_akc +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (WO) Used to write an Authentication Key Certificate (AKC) to + the SDSi NVRAM for the CPU. The AKC is used to authentication a + Capability Activation Payload. Mailbox command. + +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/provision_cap +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (WO) Used to write a Capability Activation Payload (CAP) to the + SDSi NVRAM for the CPU. CAP files are used to activate a given + CPU feature. The CAP file is validated by SDSi hardware using a + previously provision AKC file. Upon successful authentication, the + CPU configuration is updated. A cold reboot is required to fully + activate the feature. Mailbox command. + +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/read_state_cert +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (RO) Used to read back the current State Certificate for the CPU + from SDSi hardware. The State Certificate contains information + about the current licenses on the CPU. Mailbox command.
MAINTAINERS +5 -0
@@ -9772,6 +9772,11 @@ 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 + INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER M: Daniel Scally <[email protected]> S: Maintained
drivers/platform/x86/intel/Kconfig +12 -0
@@ -147,6 +147,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_VSEC + 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
@@ -26,6 +26,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_vsec-y := vsec.o obj-$(CONFIG_INTEL_VSEC) += intel_vsec.o
drivers/platform/x86/intel/sdsi.c new file +571 -0
571 lines not on this page · raw message
drivers/platform/x86/intel/vsec.c +11 -1
@@ -32,6 +32,7 @@#define TABLE_OFFSET_SHIFT 3static DEFINE_IDA (intel_vsec_ida); +static DEFINE_IDA (intel_vsec_sdsi_ida);/** * struct intel_vsec_header - Common fields of Intel VSEC and DVSEC registers.
@@ -63,12 +64,14 @@ enum intel_vsec_id {VSEC_ID_TELEMETRY =2 ,VSEC_ID_WATCHER =3 ,VSEC_ID_CRASHLOG =4 , + VSEC_ID_SDSI = 65, };static enum intel_vsec_id intel_vsec_allow_list[] = {VSEC_ID_TELEMETRY ,VSEC_ID_WATCHER ,VSEC_ID_CRASHLOG , +VSEC_ID_SDSI , };static const char *intel_vsec_name (enum intel_vsec_id id)
@@ -83,6 +86,9 @@ static const char *intel_vsec_name(enum intel_vsec_id id)case VSEC_ID_CRASHLOG :return "crashlog" ; +case VSEC_ID_SDSI : +return "sdsi" ; +default :return NULL ; }
@@ -211,7 +217,11 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he intel_vsec_dev->resource = res; intel_vsec_dev->num_resources = header->num_entries; intel_vsec_dev->quirks = quirks; - intel_vsec_dev->ida = &intel_vsec_ida; + +if (header->id ==VSEC_ID_SDSI ) + intel_vsec_dev->ida = &intel_vsec_sdsi_ida; +else + intel_vsec_dev->ida = &intel_vsec_ida;return intel_vsec_add_aux (pdev, intel_vsec_dev,intel_vsec_name (header->id)); }
Signature · 1 line
2.25.1
Greg KH
maintainerRe: [PATCH 4/4] platform/x86: Add Intel Software Defined Silicon driver
drivers/platform/x86/intel/sdsi.c line 435
Quoted 9 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +9
-0+static ssize_t registers_read (struct file *filp,struct kobject *kobj, +struct bin_attribute *attr,char *buf,loff_t off, +size_t count) +{ +struct device *dev =kobj_to_dev (kobj); +struct sdsi_priv *priv =dev_get_drvdata (dev); +void __iomem *addr = priv->regs_addr; + +memcpy_fromio (buf, addr + off, count);
Oh nice, this will be fun if I provide "interesting" values for off to the function right?
Remember:
All input is evil.
Quoted 8 lines
drivers/platform/x86/intel/sdsi.c new file +8
-0+ +return count; +} +static BIN_ATTR(registers, 0400, registers_read, NULL, SDSI_SIZE_REGS); + +static struct bin_attribute *sdsi_bin_attrs[] = { + &bin_attr_registers, + &bin_attr_state_certificate,
drivers/platform/x86/intel/sdsi.c line 453
Quoted 10 lines
drivers/platform/x86/intel/sdsi.c new file +10
-0+ &bin_attr_provision_akc, + &bin_attr_provision_cap, + NULL +}; + +static ssize_t guid_show (struct device *dev,struct device_attribute *attr,char *buf) +{ +struct sdsi_priv *priv =dev_get_drvdata (dev); + +return sprintf (buf,"0x%x\n" , priv->guid);
sysfs_emit() please.
These sysfs attributes are crazy. Who has audited them to be correct and work properly? It feels like there are just buffer overflows waiting to be exploited in them due to the reading/writing of raw memory buffers all over the place.
Where is the userspace tool that uses these files?
thanks,
greg k-h
David E. Box
maintainerRe: [PATCH 4/4] platform/x86: Add Intel Software Defined Silicon driver
Hi Greg,
Quoted 14 lines · Greg KH
drivers/platform/x86/intel/sdsi.c line 435
Quoted 9 lines · David E. Box
drivers/platform/x86/intel/sdsi.c new file +9
-0+static ssize_t registers_read (struct file *filp,struct kobject *kobj, +struct bin_attribute *attr,char *buf,loff_t off, +size_t count) +{ +struct device *dev =kobj_to_dev (kobj); +struct sdsi_priv *priv =dev_get_drvdata (dev); +void __iomem *addr = priv->regs_addr; + +memcpy_fromio (buf, addr + off, count);Oh nice, this will be fun if I provide "interesting" values for off to the function right?
Quoted 2 lines
Remember:
All input is evil.
I was relying on sysfs_kf_bin_read() which checks off (pos) before calling us.
if (size) {
if (pos >= size)
return 0;
if (pos + count > size)
count = size - pos;
}Quoted 23 lines
Quoted 16 lines
drivers/platform/x86/intel/sdsi.c new file +14
-0+ +return count; +} +static BIN_ATTR(registers, 0400, registers_read, NULL, SDSI_SIZE_REGS); + +static struct bin_attribute *sdsi_bin_attrs[] = { + &bin_attr_registers, + &bin_attr_state_certificate, + &bin_attr_provision_akc, + &bin_attr_provision_cap, +NULL +}; + +static ssize_t guid_show(struct device *dev, struct device_attribute *attr,char *buf)
drivers/platform/x86/intel/sdsi.c line 453
Quoted 4 lines
drivers/platform/x86/intel/sdsi.c new file +4
-0+{ +struct sdsi_priv *priv =dev_get_drvdata (dev); + +return sprintf (buf,"0x%x\n" , priv->guid);
sysfs_emit()please.
Quoted 4 lines
These sysfs attributes are crazy. Who has audited them to be correct and work properly? It feels like there are just buffer overflows waiting to be exploited in them due to the reading/writing of raw memory buffers all over the place.
Agree with the concern. I can submit the tests that were used. Is selftests the best place?
Quoted 2 lines
Where is the userspace tool that uses these files?
The tool will be published in the same github repo as the spec once the driver is ready.
Thanks.
David
Quoted 4 lines
thanks,
greg k-h
Greg KH
maintainerRe: [PATCH 4/4] platform/x86: Add Intel Software Defined Silicon driver
Quoted 7 lines · David E. Box
Quoted 4 lines
These sysfs attributes are crazy. Who has audited them to be correct and work properly? It feels like there are just buffer overflows waiting to be exploited in them due to the reading/writing of raw memory buffers all over the place.
Agree with the concern. I can submit the tests that were used. Is selftests the best place?
Yes.
Quoted 4 lines
Quoted 1 line
Where is the userspace tool that uses these files?
The tool will be published in the same github repo as the spec once the driver is ready.
Isn't the driver "ready" if you are asking for it to be accepted here? Why isn't it published already so we can see if it actually is tested?
thanks,
greg k-h
David E. Box
maintainerRe: [PATCH 4/4] platform/x86: Add Intel Software Defined Silicon driver
Quoted 14 lines · Greg KH
Quoted 8 lines · David E. Box
Quoted 4 lines
These sysfs attributes are crazy. Who has audited them to be correct and work properly? It feels like there are just buffer overflows waiting to be exploited in them due to the reading/writing of raw memory buffers all over the place.
Agree with the concern. I can submit the tests that were used. Is selftests the
best place?Yes.
Quoted 2 lines
Quoted 1 line
Where is the userspace tool that uses these files?
Quoted 7 lines
Quoted 3 lines
The tool will be published in the same github repo as the spec once the driver
is ready.Isn't the driver "ready" if you are asking for it to be accepted here? Why isn't it published already so we can see if it actually is tested?
It will be required for the tests anyway, so I'll submit it with them.
Thanks.
David
Re: [PATCH 4/4] platform/x86: Add Intel Software Defined Silicon driver
In reply to David E. BoxQuoted 45 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, sysfs attribute 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 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_vsecdriver and as such has a build dependency onCONFIG_INTEL_VSEC.Signed-off-by David E. Box <[email protected]>Reviewed-by Mark Gross <[email protected]>--- .../ABI/testing/sysfs-driver-intel_sdsi | 75 +++ MAINTAINERS | 5 + drivers/platform/x86/intel/Kconfig | 12 + drivers/platform/x86/intel/Makefile | 2 + drivers/platform/x86/intel/sdsi.c | 571 ++++++++++++++++++ drivers/platform/x86/intel/vsec.c | 12 +- 6 files changed, 676 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-intel_sdsi create mode 100644 drivers/platform/x86/intel/sdsi.cDocumentation/ABI/testing/sysfs-driver-intel_sdsi new file +0
-0
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 8
Quoted 8 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +8
-0@@ -0,0 +1,75 @@ +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + This folder contains interface files for accessing Intel + Software Defined Silicon (SDSi) features on a CPU. X + represent the socket instance (though not the socket id).
s/represent/represents/
s/socket id/socket ID/
As a user, how do I learn the socket instance? Look at dmesg? Look at some other sysfs file?
Quoted 15 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +15
-0+ Some files communicate with SDSi hardware through a mailbox. + Should the operation fail, one of the following error codes + may be returned: + + Error Code Cause + ---------- ----- + EIO General mailbox failure. Log may indicate cause. + EBUSY Mailbox is owned by another agent. + EPERM SDSI capability is not enabled in hardware. + EPROTO Failure in mailbox protocol detected by driver. + See log for details. + EOVERFLOW For provision commands, the size of the data + exceeds what may be written. + ESPIPE Seeking is not allowed. + ETIMEDOUT Failure to complete mailbox transaction in time.
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 34
Quoted 10 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +10
-0+ +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/guid +Date: Nov 2021 +KernelVersion: 5.17 +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
s/register layout of the registers file/layout of the registers file/
Quoted 9 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +9
-0+What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/registers +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (RO) Contains information needed by applications to provision + a CPU and monitor status information. The layout of this file + is determined by the GUID in this folder. Information about the + layout for a particular GUID is available at
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 54
Quoted 10 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +10
-0+ http://github.com/intel/intel-sdsi + +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/provision_akc +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (WO) Used to write an Authentication Key Certificate (AKC) to + the SDSi NVRAM for the CPU. The AKC is used to authentication a + Capability Activation Payload. Mailbox command.
s/used to authentication/used to authenticate/
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 66
Quoted 11 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +11
-0+What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/provision_cap +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (WO) Used to write a Capability Activation Payload (CAP) to the + SDSi NVRAM for the CPU. CAP files are used to activate a given + CPU feature. The CAP file is validated by SDSi hardware using a + previously provision AKC file. Upon successful authentication, the + CPU configuration is updated. A cold reboot is required to fully + activate the feature. Mailbox command.
"CAP file" sounds like it might be redundant. It *seems* like the *payload* is what will be validated by SDSi and activate the feature. Not sure "file" is meaningful if this is really talking about the content of the CAP.
s/previously provision/previously provisioned/
Quoted 8 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +8
-0+What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/read_state_cert +Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (RO) Used to read back the current State Certificate for the CPU + from SDSi hardware. The State Certificate contains information + about the current licenses on the CPU. Mailbox command.
David E. Box
maintainerRe: [PATCH 4/4] platform/x86: Add Intel Software Defined Silicon driver
Hi Bjorn,
Thanks for reviewing.
Quoted 50 lines · Bjorn Helgaas
Quoted 49 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, sysfs attribute 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 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_vsecdriver and as such has a build dependency onCONFIG_INTEL_VSEC.Signed-off-by David E. Box <[email protected]>Reviewed-by Mark Gross <[email protected]>--- .../ABI/testing/sysfs-driver-intel_sdsi | 75 +++ MAINTAINERS | 5 + drivers/platform/x86/intel/Kconfig | 12 + drivers/platform/x86/intel/Makefile | 2 + drivers/platform/x86/intel/sdsi.c | 571 ++++++++++++++++++ drivers/platform/x86/intel/vsec.c | 12 +- 6 files changed, 676 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-intel_sdsi create mode 100644 drivers/platform/x86/intel/sdsi.cDocumentation/ABI/testing/sysfs-driver-intel_sdsi new file +3
-0@@ -0,0 +1,75 @@ +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X +Date: Nov 2021 +KernelVersion: 5.17
Quoted 8 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 8
Quoted 5 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +5
-0+Contact: "David E. Box" <[email protected]> +Description: + This folder contains interface files for accessing Intel + Software Defined Silicon (SDSi) features on a CPU. X + represent the socket instance (though not the socket id).s/represent/represents/
s/socket id/socket ID/
Ack
Quoted 3 lines
As a user, how do I learn the socket instance? Look at dmesg? Look at some other sysfs file?
Instances are just the list of SDSi devices in this folder. Each device represents a socket. They are enumerated in the order they are discovered. If you meant socket ID, that is read from the registers file in this folder per the spec. Ideally the two would be the same, but the socket ID is not known until probe.
Quoted 22 lines
Quoted 22 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +10
-0+ Some files communicate with SDSi hardware through a mailbox. + Should the operation fail, one of the following error codes + may be returned: + + Error Code Cause + ---------- ----- + EIO General mailbox failure. Log may indicate cause. + EBUSY Mailbox is owned by another agent. + EPERM SDSI capability is not enabled in hardware. + EPROTO Failure in mailbox protocol detected bydriver.
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +7
-0+ See log for details. + EOVERFLOW For provision commands, the size of the data + exceeds what may be written. + ESPIPE Seeking is not allowed. + ETIMEDOUT Failure to complete mailbox transaction in time. + +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/guid
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +2
-0+Date: Nov 2021 +KernelVersion: 5.17
Quoted 8 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 34
Quoted 6 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +6
-0+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-sdsis/register layout of the registers file/layout of the registers file/
Ack
Quoted 16 lines
Quoted 16 lines
+What:
/sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/reg
istersDocumentation/ABI/testing/sysfs-driver-intel_sdsi new file +11
-0+Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (RO) Contains information needed by applications to provision + a CPU and monitor status information. 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 + +What: /sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/pro
vision_akc
+Date: Nov 2021
Quoted 8 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 54
Quoted 6 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +6
-0+KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (WO) Used to write an Authentication Key Certificate (AKC) to + the SDSi NVRAM for the CPU. The AKC is used to authentication a + Capability Activation Payload. Mailbox command.s/used to authentication/used to authenticate/
Ack
Quoted 20 lines
Quoted 12 lines
+What:
/sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/provision_capDocumentation/ABI/testing/sysfs-driver-intel_sdsi new file +8
-0+Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (WO) Used to write a Capability Activation Payload (CAP) to the + SDSi NVRAM for the CPU. CAP files are used to activate a given + CPU feature. The CAP file is validated by SDSi hardware using a + previously provision AKC file. Upon successful authentication,the
Documentation/ABI/testing/sysfs-driver-intel_sdsi line 66
Quoted 2 lines
Documentation/ABI/testing/sysfs-driver-intel_sdsi new file +2
-0+ CPU configuration is updated. A cold reboot is required to fully + activate the feature. Mailbox command."CAP file" sounds like it might be redundant. It *seems* like the *payload* is what will be validated by SDSi and activate the feature. Not sure "file" is meaningful if this is really talking about the content of the CAP.
Quoted 1 line
s/previously provision/previously provisioned/
Ack
David
Quoted 10 lines
Quoted 10 lines
+What:
/sys/bus/auxiliary/devices/intel_extended_cap.sdsi.X/read_state_certDocumentation/ABI/testing/sysfs-driver-intel_sdsi new file +7
-0+Date: Nov 2021 +KernelVersion: 5.17 +Contact: "David E. Box" <[email protected]> +Description: + (RO) Used to read back the current State Certificate for the CPU + from SDSi hardware. The State Certificate contains information + about the current licenses on the CPU. Mailbox command.