This patch series aims to cleanup the PMC Core driver and convert it to a
module.
Subsequent patch series will add support for newer Intel SoC like Coffeelake
and Cannonlake, this series builds a foundation for them.
Rajneesh Bhardwaj (5):
platform/x86: intel_pmc_core: Remove unused EXPORTED API
platform/x86: intel_pmc_core: Remove unused variable
platform/x86: intel_pmc_core: Fix kernel doc for pmc_dev
platform/x86: intel_pmc_core: Fix file permission warnings
platform/x86: intel_pmc_core: Update Kconfig
Srinivas Pandruvada (1):
platform/x86: intel_pmc_core: Change driver to a module
drivers/platform/x86/Kconfig | 7 ++--
drivers/platform/x86/intel_pmc_core.c | 65 +++++++++++------------------------
drivers/platform/x86/intel_pmc_core.h | 15 ++++----
3 files changed, 32 insertions(+), 55 deletions(-)
--
2.7.4
Though ChromeOs uses the exported API as part of their S0ix failsafe
mechanism, there is no active consumer of this API in upstream kernel.
We can revisit this when ChromeOs kernel team is able to get their S0ix
failsafe framework in mainline.
Cc: Derek Basehore <[email protected]>
Cc: Rajat Jain <[email protected]>
Link: https://patchwork.kernel.org/patch/9831229/
Suggested-by: Andriy Shevchenko <[email protected]>
Signed-off-by: Srinivas Pandruvada <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
---
drivers/platform/x86/intel_pmc_core.c | 32 --------------------------------
drivers/platform/x86/intel_pmc_core.h | 1 -
2 files changed, 33 deletions(-)
diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index 17e08b42b0a9..00748472a55e 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -146,37 +146,6 @@ static inline u32 pmc_core_adjust_slp_s0_step(u32 value)
return value * SPT_PMC_SLP_S0_RES_COUNTER_STEP;
}
-/**
- * intel_pmc_slp_s0_counter_read() - Read SLP_S0 residency.
- * @data: Out param that contains current SLP_S0 count.
- *
- * This API currently supports Intel Skylake SoC and Sunrise
- * Point Platform Controller Hub. Future platform support
- * should be added for platforms that support low power modes
- * beyond Package C10 state.
- *
- * SLP_S0_RESIDENCY counter counts in 100 us granularity per
- * step hence function populates the multiplied value in out
- * parameter @data.
- *
- * Return: an error code or 0 on success.
- */
-int intel_pmc_slp_s0_counter_read(u32 *data)
-{
- struct pmc_dev *pmcdev = &pmc;
- const struct pmc_reg_map *map = pmcdev->map;
- u32 value;
-
- if (!pmcdev->has_slp_s0_res)
- return -EACCES;
-
- value = pmc_core_reg_read(pmcdev, map->slp_s0_offset);
- *data = pmc_core_adjust_slp_s0_step(value);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(intel_pmc_slp_s0_counter_read);
-
static int pmc_core_dev_state_get(void *data, u64 *val)
{
struct pmc_dev *pmcdev = data;
@@ -548,7 +517,6 @@ static int pmc_core_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (err < 0)
dev_warn(&dev->dev, "PMC Core: debugfs register failed.\n");
- pmc.has_slp_s0_res = true;
return 0;
}
diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h
index 3d225a9cc09f..ecff50356c71 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -178,7 +178,6 @@ struct pmc_dev {
#if IS_ENABLED(CONFIG_DEBUG_FS)
struct dentry *dbgfs_dir;
#endif /* CONFIG_DEBUG_FS */
- bool has_slp_s0_res;
int pmc_xram_read_bit;
struct mutex lock; /* generic mutex lock for PMC Core */
};
--
2.7.4
base_address field is redundant and unused in the driver so get rid of it.
Signed-off-by: Srinivas Pandruvada <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
---
drivers/platform/x86/intel_pmc_core.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h
index ecff50356c71..c6169fe0edf2 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -135,7 +135,6 @@ struct pmc_bit_map {
* @pll_sts: Maps name of PLL to corresponding bit status
* @slp_s0_offset: PWRMBASE offset to read SLP_S0 residency
* @ltr_ignore_offset: PWRMBASE offset to read/write LTR ignore bit
- * @base_address: Base address of PWRMBASE defined in BIOS writer guide
* @regmap_length: Length of memory to map from PWRMBASE address to access
* @ppfear0_offset: PWRMBASE offset to to read PPFEAR*
* @ppfear_buckets: Number of 8 bits blocks to read all IP blocks from
@@ -152,7 +151,6 @@ struct pmc_reg_map {
const struct pmc_bit_map *pll_sts;
const u32 slp_s0_offset;
const u32 ltr_ignore_offset;
- const u32 base_address;
const int regmap_length;
const u32 ppfear0_offset;
const int ppfear_buckets;
--
2.7.4
From: Srinivas Pandruvada <[email protected]>
Allow the driver to be a module since builtin_pci_driver funtionality is no
longer needed.
Signed-off-by: Srinivas Pandruvada <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
---
drivers/platform/x86/Kconfig | 2 +-
drivers/platform/x86/intel_pmc_core.c | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 2c745e8ccad6..683a875f3b6c 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -949,7 +949,7 @@ config INTEL_IMR
If you are running on a Galileo/Quark say Y here.
config INTEL_PMC_CORE
- bool "Intel PMC Core driver"
+ tristate "Intel PMC Core driver"
depends on PCI
---help---
The Intel Platform Controller Hub for Intel Core SoCs provides access
diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index 00748472a55e..44353034718a 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -21,8 +21,8 @@
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/device.h>
-#include <linux/init.h>
#include <linux/io.h>
+#include <linux/module.h>
#include <linux/pci.h>
#include <linux/uaccess.h>
@@ -124,6 +124,7 @@ static const struct pci_device_id pmc_pci_ids[] = {
(kernel_ulong_t)&spt_reg_map },
{ 0, },
};
+MODULE_DEVICE_TABLE(pci, pmc_pci_ids);
static inline u8 pmc_core_reg_read_byte(struct pmc_dev *pmcdev, int offset)
{
@@ -520,10 +521,20 @@ static int pmc_core_probe(struct pci_dev *dev, const struct pci_device_id *id)
return 0;
}
+static void pmc_core_remove(struct pci_dev *dev)
+{
+ pmc_core_dbgfs_unregister(&pmc);
+ mutex_destroy(&pmc.lock);
+}
+
static struct pci_driver intel_pmc_core_driver = {
.name = "intel_pmc_core",
.id_table = pmc_pci_ids,
.probe = pmc_core_probe,
+ .remove = pmc_core_remove,
};
-builtin_pci_driver(intel_pmc_core_driver);
+module_pci_driver(intel_pmc_core_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Intel PMC Core Driver");
--
2.7.4
Symbolic permissions 'S_IRUGO' are not preferred. This patch changes the
debugfs files to use octal permissions '0644' or '0444' as needed by the
attribute.
Signed-off-by: Srinivas Pandruvada <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
---
drivers/platform/x86/intel_pmc_core.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index 44353034718a..cf8b3b34a979 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -414,31 +414,27 @@ static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev)
return -ENOMEM;
pmcdev->dbgfs_dir = dir;
- file = debugfs_create_file("slp_s0_residency_usec", S_IFREG | S_IRUGO,
+ file = debugfs_create_file("slp_s0_residency_usec", 0444,
dir, pmcdev, &pmc_core_dev_state);
if (!file)
goto err;
- file = debugfs_create_file("pch_ip_power_gating_status",
- S_IFREG | S_IRUGO, dir, pmcdev,
- &pmc_core_ppfear_ops);
+ file = debugfs_create_file("pch_ip_power_gating_status", 0444,
+ dir, pmcdev, &pmc_core_ppfear_ops);
if (!file)
goto err;
- file = debugfs_create_file("mphy_core_lanes_power_gating_status",
- S_IFREG | S_IRUGO, dir, pmcdev,
- &pmc_core_mphy_pg_ops);
+ file = debugfs_create_file("mphy_core_lanes_power_gating_status", 0444,
+ dir, pmcdev, &pmc_core_mphy_pg_ops);
if (!file)
goto err;
- file = debugfs_create_file("pll_status",
- S_IFREG | S_IRUGO, dir, pmcdev,
+ file = debugfs_create_file("pll_status", 0444, dir, pmcdev,
&pmc_core_pll_ops);
if (!file)
goto err;
- file = debugfs_create_file("ltr_ignore",
- S_IFREG | S_IRUGO, dir, pmcdev,
+ file = debugfs_create_file("ltr_ignore", 0644, dir, pmcdev,
&pmc_core_ltr_ignore_ops);
if (!file)
--
2.7.4
This adds list of supported features by this driver to the Kconfig.
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
---
drivers/platform/x86/Kconfig | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 683a875f3b6c..5d2c2a180f0c 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -958,7 +958,10 @@ config INTEL_PMC_CORE
exposed by the Power Management Controller.
Supported features:
- - SLP_S0_RESIDENCY counter.
+ - SLP_S0_RESIDENCY counter
+ - PCH IP Power Gating status
+ - LTR Ignore
+ - MPHY/PLL gating status (Sunrisepoint PCH only)
config IBM_RTL
tristate "Device driver to enable PRTL support"
--
2.7.4
Fix invalid field information and add missing fields in kernel doc comments.
Signed-off-by: Srinivas Pandruvada <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
---
drivers/platform/x86/intel_pmc_core.h | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h
index c6169fe0edf2..e3be1d2b08cd 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -160,12 +160,14 @@ struct pmc_reg_map {
/**
* struct pmc_dev - pmc device structure
- * @base_addr: comtains pmc base address
+ * @base_addr: contains pmc base address
* @regbase: pointer to io-remapped memory location
- * @dbgfs_dir: path to debug fs interface
- * @feature_available: flag to indicate whether
- * the feature is available
- * on a particular platform or not.
+ * @map: pointer to pmc_reg_map struct that contains platform
+ * specific attributes
+ * @dbgfs_dir: path to debugfs interface
+ * @pmc_xram_read_bit: flag to indicate whether PMC XRAM shadow registers
+ * used to read MPHY PG and PLL status are available
+ * @mutex_lock: mutex to complete one transcation
*
* pmc_dev contains info about power management controller device.
*/
--
2.7.4
On Thu, Jan 11, 2018 at 1:10 PM, Rajneesh Bhardwaj
<[email protected]> wrote:
> This patch series aims to cleanup the PMC Core driver and convert it to a
> module.
>
> Subsequent patch series will add support for newer Intel SoC like Coffeelake
> and Cannonlake, this series builds a foundation for them.
>
All 6 are pushed to my review and testing queue, thanks!
> Rajneesh Bhardwaj (5):
> platform/x86: intel_pmc_core: Remove unused EXPORTED API
> platform/x86: intel_pmc_core: Remove unused variable
> platform/x86: intel_pmc_core: Fix kernel doc for pmc_dev
> platform/x86: intel_pmc_core: Fix file permission warnings
> platform/x86: intel_pmc_core: Update Kconfig
>
> Srinivas Pandruvada (1):
> platform/x86: intel_pmc_core: Change driver to a module
>
> drivers/platform/x86/Kconfig | 7 ++--
> drivers/platform/x86/intel_pmc_core.c | 65 +++++++++++------------------------
> drivers/platform/x86/intel_pmc_core.h | 15 ++++----
> 3 files changed, 32 insertions(+), 55 deletions(-)
>
> --
> 2.7.4
>
--
With Best Regards,
Andy Shevchenko