2021-06-18 02:38:54

by David E. Box

[permalink] [raw]
Subject: [PATCH 0/4] MFD: intel_pmt: Split OOBMSM from intel_pmt driver

Most of the devices in the intel_pmt driver are PMT only devices. However,
the Out of Band Management Services Module (OOBMSM) can also be used
access non-PMT devices. In order to better support this without the
confusion of a dependency on MFD_INTEL_PMT, this patch set rewrites the
intel_pmt driver to split the functionality into 3 components:

1. intel_pmt - driver for PMT only devices
2. intel-oobmsm - driver for devices using the OOBMSM IP which can
support multiple types of capabilities, including PMT
3. intel-extended-cap - symbols to handle adding platform device
for both drivers

Additionally, this patch set provides additional DVSEC macros in the PCI
header as well as support for reading capabilities from a VSEC structure.

Patch 1 - Adds PCI defines for DVSEC registers
Patch 2 - Removes OOBMSM from intel_pmt and creates intel-extended-cap.c
support the creation of platform devices for capabilities from
both intel_pmt and intel-oobmsm (Patch 3)
Patch 2 - Creates a separate driver for OOBMSM
Patch 3 - Adds support for reading capabilities from PCIe VSEC structures

For submission through MFD branch.

David E. Box (4):
PCI: Add #defines for accessing PCIE DVSEC fields
MFD: intel_pmt: Remove OOBMSM device for placement in own driver
MFD: Add the Intel Out of Band Management Services Module (OOBMSM)
driver
MFD: intel-extended-cap: Add support for PCIe VSEC structures

MAINTAINERS | 2 +
drivers/mfd/Kconfig | 15 ++
drivers/mfd/Makefile | 2 +
drivers/mfd/intel_extended_caps.c | 267 +++++++++++++++++++++
drivers/mfd/intel_extended_caps.h | 40 +++
drivers/mfd/intel_oobmsm.c | 61 +++++
drivers/mfd/intel_pmt.c | 198 ++-------------
drivers/platform/x86/Kconfig | 4 +-
drivers/platform/x86/intel_pmt_crashlog.c | 2 +-
drivers/platform/x86/intel_pmt_telemetry.c | 2 +-
include/uapi/linux/pci_regs.h | 4 +
11 files changed, 409 insertions(+), 188 deletions(-)
create mode 100644 drivers/mfd/intel_extended_caps.c
create mode 100644 drivers/mfd/intel_extended_caps.h
create mode 100644 drivers/mfd/intel_oobmsm.c

--
2.25.1


2021-06-18 02:39:19

by David E. Box

[permalink] [raw]
Subject: [PATCH 3/4] MFD: Intel Out of Band Management Services Module (OOBMSM) driver

The Intel Out of Band Management Services Module (OOBMSM) is a device
that provides access to Intel capabilities described in PCIE vendor
specific extended capability registers (both VSEC and DVSEC). These
capabilities include features like Intel Platform Monitoring Technology
as well as others that are not supported by the intel_pmt driver. Add a
driver for creating platform devices for these capabilities coming from
OOBMSM.

Signed-off-by: David E. Box <[email protected]>
---
MAINTAINERS | 1 +
drivers/mfd/Kconfig | 11 +++++++
drivers/mfd/Makefile | 1 +
drivers/mfd/intel_oobmsm.c | 61 ++++++++++++++++++++++++++++++++++++
drivers/platform/x86/Kconfig | 4 +--
5 files changed, 76 insertions(+), 2 deletions(-)
create mode 100644 drivers/mfd/intel_oobmsm.c

diff --git a/MAINTAINERS b/MAINTAINERS
index ebdc2a0f794b..0961e3f89497 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9356,6 +9356,7 @@ INTEL PMT DRIVER
M: "David E. Box" <[email protected]>
S: Maintained
F: drivers/mfd/intel_extended_cap.c
+F: drivers/mfd/intel_oobmsm.c
F: drivers/mfd/intel_pmt.c
F: drivers/platform/x86/intel_pmt_*

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 4dde8e223a9e..269312de2666 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -687,6 +687,17 @@ config MFD_INTEL_PMT
Telemetry, Watcher, and Crashlog PMT capabilities/devices for
platforms starting from Tiger Lake.

+config MFD_INTEL_OOBMSM
+ tristate "Intel Out Of Band Management Services Module (OOBMSM) support"
+ depends on PCI
+ select MFD_INTEL_EXTENDED_CAPS
+ help
+ The Intel Out of Band Management Service Module driver is used to
+ enumerate auxiliary platform features described in both Vendor
+ Specific and Designated Vendor Specific PCIe config space. Supported
+ features include Intel Platform Monitoring Technology (PMT) as well
+ as other non-PMT capabilities.
+
config MFD_IPAQ_MICRO
bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support"
depends on SA1100_H3100 || SA1100_H3600
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 7fa35399ec76..50fa38810bbd 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -213,6 +213,7 @@ obj-$(CONFIG_MFD_INTEL_EXTENDED_CAPS) += intel_extended_caps.o
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_OOBMSM) += intel_oobmsm.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
diff --git a/drivers/mfd/intel_oobmsm.c b/drivers/mfd/intel_oobmsm.c
new file mode 100644
index 000000000000..c66532f11c29
--- /dev/null
+++ b/drivers/mfd/intel_oobmsm.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Intel Out of Band Management Services Module driver
+ *
+ * Copyright (c) 2021, Intel Corporation.
+ * All Rights Reserved.
+ *
+ * Author: David E. Box <[email protected]>
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/pm_runtime.h>
+
+#include "intel_extended_caps.h"
+
+static int intel_oobmsm_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+ struct intel_ext_cap_platform_info *info;
+ int ret;
+
+ ret = pcim_enable_device(pdev);
+ if (ret)
+ return ret;
+
+ info = (struct intel_ext_cap_platform_info *)id->driver_data;
+
+ ret = intel_ext_cap_probe(pdev, info);
+ if (ret)
+ return ret;
+
+ pm_runtime_put(&pdev->dev);
+ pm_runtime_allow(&pdev->dev);
+
+ return 0;
+}
+
+static void intel_oobmsm_pci_remove(struct pci_dev *pdev)
+{
+ pm_runtime_forbid(&pdev->dev);
+ pm_runtime_get_sync(&pdev->dev);
+}
+
+#define PCI_DEVICE_ID_INTEL_PMT_OOBMSM 0x09a7
+static const struct pci_device_id intel_oobmsm_pci_ids[] = {
+ { PCI_DEVICE_DATA(INTEL, PMT_OOBMSM, NULL) },
+ { }
+};
+MODULE_DEVICE_TABLE(pci, intel_oobmsm_pci_ids);
+
+static struct pci_driver intel_oobmsm_pci_driver = {
+ .name = "intel-oobmsm",
+ .id_table = intel_oobmsm_pci_ids,
+ .probe = intel_oobmsm_pci_probe,
+ .remove = intel_oobmsm_pci_remove,
+};
+module_pci_driver(intel_oobmsm_pci_driver);
+
+MODULE_AUTHOR("David E. Box <[email protected]>");
+MODULE_DESCRIPTION("Intel Out of Band Management Services Module driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 60592fb88e7a..4dd3af9f848e 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1226,7 +1226,7 @@ config INTEL_PMT_CLASS

config INTEL_PMT_TELEMETRY
tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver"
- depends on MFD_INTEL_PMT
+ depends on MFD_INTEL_PMT || MFD_INTEL_OOBMSM
select INTEL_PMT_CLASS
help
The Intel Platform Monitory Technology (PMT) Telemetry driver provides
@@ -1238,7 +1238,7 @@ config INTEL_PMT_TELEMETRY

config INTEL_PMT_CRASHLOG
tristate "Intel Platform Monitoring Technology (PMT) Crashlog driver"
- depends on MFD_INTEL_PMT
+ depends on MFD_INTEL_PMT || MFD_INTEL_OOBMSM
select INTEL_PMT_CLASS
help
The Intel Platform Monitoring Technology (PMT) crashlog driver provides
--
2.25.1

2021-06-30 10:18:47

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 3/4] MFD: Intel Out of Band Management Services Module (OOBMSM) driver

On Thu, 17 Jun 2021, David E. Box wrote:

> The Intel Out of Band Management Services Module (OOBMSM) is a device
> that provides access to Intel capabilities described in PCIE vendor
> specific extended capability registers (both VSEC and DVSEC). These
> capabilities include features like Intel Platform Monitoring Technology
> as well as others that are not supported by the intel_pmt driver. Add a
> driver for creating platform devices for these capabilities coming from
> OOBMSM.
>
> Signed-off-by: David E. Box <[email protected]>
> ---
> MAINTAINERS | 1 +
> drivers/mfd/Kconfig | 11 +++++++
> drivers/mfd/Makefile | 1 +
> drivers/mfd/intel_oobmsm.c | 61 ++++++++++++++++++++++++++++++++++++
> drivers/platform/x86/Kconfig | 4 +--
> 5 files changed, 76 insertions(+), 2 deletions(-)
> create mode 100644 drivers/mfd/intel_oobmsm.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index ebdc2a0f794b..0961e3f89497 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9356,6 +9356,7 @@ INTEL PMT DRIVER
> M: "David E. Box" <[email protected]>
> S: Maintained
> F: drivers/mfd/intel_extended_cap.c
> +F: drivers/mfd/intel_oobmsm.c
> F: drivers/mfd/intel_pmt.c
> F: drivers/platform/x86/intel_pmt_*
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 4dde8e223a9e..269312de2666 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -687,6 +687,17 @@ config MFD_INTEL_PMT
> Telemetry, Watcher, and Crashlog PMT capabilities/devices for
> platforms starting from Tiger Lake.
>
> +config MFD_INTEL_OOBMSM
> + tristate "Intel Out Of Band Management Services Module (OOBMSM) support"
> + depends on PCI
> + select MFD_INTEL_EXTENDED_CAPS
> + help
> + The Intel Out of Band Management Service Module driver is used to
> + enumerate auxiliary platform features described in both Vendor
> + Specific and Designated Vendor Specific PCIe config space. Supported
> + features include Intel Platform Monitoring Technology (PMT) as well
> + as other non-PMT capabilities.
> +
> config MFD_IPAQ_MICRO
> bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support"
> depends on SA1100_H3100 || SA1100_H3600
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 7fa35399ec76..50fa38810bbd 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -213,6 +213,7 @@ obj-$(CONFIG_MFD_INTEL_EXTENDED_CAPS) += intel_extended_caps.o
> 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_OOBMSM) += intel_oobmsm.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
> diff --git a/drivers/mfd/intel_oobmsm.c b/drivers/mfd/intel_oobmsm.c
> new file mode 100644
> index 000000000000..c66532f11c29
> --- /dev/null
> +++ b/drivers/mfd/intel_oobmsm.c
> @@ -0,0 +1,61 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Intel Out of Band Management Services Module driver
> + *
> + * Copyright (c) 2021, Intel Corporation.
> + * All Rights Reserved.
> + *
> + * Author: David E. Box <[email protected]>
> + */
> +
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/pm_runtime.h>

This doesn't appear to have anything to do with MFD?

> +#include "intel_extended_caps.h"
> +
> +static int intel_oobmsm_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> +{
> + struct intel_ext_cap_platform_info *info;
> + int ret;
> +
> + ret = pcim_enable_device(pdev);
> + if (ret)
> + return ret;
> +
> + info = (struct intel_ext_cap_platform_info *)id->driver_data;
> +
> + ret = intel_ext_cap_probe(pdev, info);
> + if (ret)
> + return ret;
> +
> + pm_runtime_put(&pdev->dev);
> + pm_runtime_allow(&pdev->dev);
> +
> + return 0;
> +}
> +
> +static void intel_oobmsm_pci_remove(struct pci_dev *pdev)
> +{
> + pm_runtime_forbid(&pdev->dev);
> + pm_runtime_get_sync(&pdev->dev);
> +}
> +
> +#define PCI_DEVICE_ID_INTEL_PMT_OOBMSM 0x09a7
> +static const struct pci_device_id intel_oobmsm_pci_ids[] = {
> + { PCI_DEVICE_DATA(INTEL, PMT_OOBMSM, NULL) },
> + { }
> +};
> +MODULE_DEVICE_TABLE(pci, intel_oobmsm_pci_ids);
> +
> +static struct pci_driver intel_oobmsm_pci_driver = {
> + .name = "intel-oobmsm",
> + .id_table = intel_oobmsm_pci_ids,
> + .probe = intel_oobmsm_pci_probe,
> + .remove = intel_oobmsm_pci_remove,
> +};
> +module_pci_driver(intel_oobmsm_pci_driver);
> +
> +MODULE_AUTHOR("David E. Box <[email protected]>");
> +MODULE_DESCRIPTION("Intel Out of Band Management Services Module driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 60592fb88e7a..4dd3af9f848e 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -1226,7 +1226,7 @@ config INTEL_PMT_CLASS
>
> config INTEL_PMT_TELEMETRY
> tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver"
> - depends on MFD_INTEL_PMT
> + depends on MFD_INTEL_PMT || MFD_INTEL_OOBMSM
> select INTEL_PMT_CLASS
> help
> The Intel Platform Monitory Technology (PMT) Telemetry driver provides
> @@ -1238,7 +1238,7 @@ config INTEL_PMT_TELEMETRY
>
> config INTEL_PMT_CRASHLOG
> tristate "Intel Platform Monitoring Technology (PMT) Crashlog driver"
> - depends on MFD_INTEL_PMT
> + depends on MFD_INTEL_PMT || MFD_INTEL_OOBMSM
> select INTEL_PMT_CLASS
> help
> The Intel Platform Monitoring Technology (PMT) crashlog driver provides

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog