LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Minor SST optimizations
@ 2023-10-03 16:32 Srinivas Pandruvada
  2023-10-03 16:32 ` [PATCH v2 1/4] platform/x86: ISST: Use fuse enabled mask instead of allowed levels Srinivas Pandruvada
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Srinivas Pandruvada @ 2023-10-03 16:32 UTC (permalink / raw
  To: hdegoede, markgross, ilpo.jarvinen, andriy.shevchenko
  Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada

Contains some minor changes to use SST for non dynamic use cases
for display purpose and remove hardcoded size for map.

v2
Update commit description, no code change
Added a new patch which was independent before

Srinivas Pandruvada (4):
  platform/x86: ISST: Use fuse enabled mask instead of allowed levels
  platform/x86: ISST: Allow level 0 to be not present
  platform/x86: intel_speed_select_if: Remove hardcoded map size
  platform/x86: intel_speed_select_if: Use devm_ioremap_resource

 .../x86/intel/speed_select_if/isst_if_mmio.c  | 21 ++++++++++++-------
 .../intel/speed_select_if/isst_tpmi_core.c    |  5 +----
 2 files changed, 14 insertions(+), 12 deletions(-)

-- 
2.41.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/4] platform/x86: ISST: Use fuse enabled mask instead of allowed levels
  2023-10-03 16:32 [PATCH v2 0/4] Minor SST optimizations Srinivas Pandruvada
@ 2023-10-03 16:32 ` Srinivas Pandruvada
  2023-10-03 16:32 ` [PATCH v2 2/4] platform/x86: ISST: Allow level 0 to be not present Srinivas Pandruvada
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Pandruvada @ 2023-10-03 16:32 UTC (permalink / raw
  To: hdegoede, markgross, ilpo.jarvinen, andriy.shevchenko
  Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada

Allowed level mask is a mask of levels, which are currently allowed to
dynamically switch by the OS. Fused mask is a mask of all levels even if
OS is not allowed to switch.

Even if OS is not allowed to dynamically switch, it is still possible for
user to boot to a level by using BIOS option. To decide which level to
boot next time, user wants to check parameters (power, performance or
thermal) of that level to decide.

So, when passing the level mask for display to user space, use fuse
enabled mask, which has all levels.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
v2:
- Updated the commit description

 drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
index 63faa2ea8327..a672a1c814af 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
@@ -704,7 +704,7 @@ static int isst_if_get_perf_level(void __user *argp)
 		return -EINVAL;
 
 	perf_level.max_level = power_domain_info->max_level;
-	perf_level.level_mask = power_domain_info->pp_header.allowed_level_mask;
+	perf_level.level_mask = power_domain_info->pp_header.level_en_mask;
 	perf_level.feature_rev = power_domain_info->pp_header.feature_rev;
 	_read_pp_info("current_level", perf_level.current_level, SST_PP_STATUS_OFFSET,
 		      SST_PP_LEVEL_START, SST_PP_LEVEL_WIDTH, SST_MUL_FACTOR_NONE)
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/4] platform/x86: ISST: Allow level 0 to be not present
  2023-10-03 16:32 [PATCH v2 0/4] Minor SST optimizations Srinivas Pandruvada
  2023-10-03 16:32 ` [PATCH v2 1/4] platform/x86: ISST: Use fuse enabled mask instead of allowed levels Srinivas Pandruvada
@ 2023-10-03 16:32 ` Srinivas Pandruvada
  2023-10-03 16:32 ` [PATCH v2 3/4] platform/x86: intel_speed_select_if: Remove hardcoded map size Srinivas Pandruvada
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Pandruvada @ 2023-10-03 16:32 UTC (permalink / raw
  To: hdegoede, markgross, ilpo.jarvinen, andriy.shevchenko
  Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada

It is possible that SST level 0 or base level is not present in some
configurations. So don't set level 0 mask in level_en_mask by default.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
v2:
No change, just added Reviewed by

 drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
index a672a1c814af..ac5c6a812592 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
@@ -364,9 +364,6 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai
 	/* Read PP header */
 	*((u64 *)&pd_info->pp_header) = readq(pd_info->sst_base + pd_info->sst_header.pp_offset);
 
-	/* Force level_en_mask level 0 */
-	pd_info->pp_header.level_en_mask |= 0x01;
-
 	mask = 0x01;
 	levels = 0;
 	for (i = 0; i < 8; ++i) {
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/4] platform/x86: intel_speed_select_if: Remove hardcoded map size
  2023-10-03 16:32 [PATCH v2 0/4] Minor SST optimizations Srinivas Pandruvada
  2023-10-03 16:32 ` [PATCH v2 1/4] platform/x86: ISST: Use fuse enabled mask instead of allowed levels Srinivas Pandruvada
  2023-10-03 16:32 ` [PATCH v2 2/4] platform/x86: ISST: Allow level 0 to be not present Srinivas Pandruvada
@ 2023-10-03 16:32 ` Srinivas Pandruvada
  2023-10-03 16:32 ` [PATCH v2 4/4] platform/x86: intel_speed_select_if: Use devm_ioremap_resource Srinivas Pandruvada
  2023-10-04  9:08 ` [PATCH v2 0/4] Minor SST optimizations Ilpo Järvinen
  4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Pandruvada @ 2023-10-03 16:32 UTC (permalink / raw
  To: hdegoede, markgross, ilpo.jarvinen, andriy.shevchenko
  Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada

The driver is using 256 as the size while calling devm_ioremap(). The
maximum offset can be obtained from isst_mmio_range. Add a field "size"
to the isst_mmio_range and use it instead of hardcoding.

No functional impact is expected.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
v2
No change except additional Reviewed-by

 .../x86/intel/speed_select_if/isst_if_mmio.c     | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
index ff49025ec085..13e068c77d50 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
@@ -18,16 +18,17 @@
 struct isst_mmio_range {
 	int beg;
 	int end;
+	int size;
 };
 
 static struct isst_mmio_range mmio_range_devid_0[] = {
-	{0x04, 0x14},
-	{0x20, 0xD0},
+	{0x04, 0x14, 0x18},
+	{0x20, 0xD0, 0xD4},
 };
 
 static struct isst_mmio_range mmio_range_devid_1[] = {
-	{0x04, 0x14},
-	{0x20, 0x11C},
+	{0x04, 0x14, 0x18},
+	{0x20, 0x11C, 0x120},
 };
 
 struct isst_if_device {
@@ -114,13 +115,16 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	pcu_base &= GENMASK(10, 0);
 	base_addr = (u64)mmio_base << 23 | (u64) pcu_base << 12;
-	punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, 256);
+
+	punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data;
+
+	punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr,
+					     punit_dev->mmio_range[1].size);
 	if (!punit_dev->punit_mmio)
 		return -ENOMEM;
 
 	mutex_init(&punit_dev->mutex);
 	pci_set_drvdata(pdev, punit_dev);
-	punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data;
 
 	memset(&cb, 0, sizeof(cb));
 	cb.cmd_size = sizeof(struct isst_if_io_reg);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 4/4] platform/x86: intel_speed_select_if: Use devm_ioremap_resource
  2023-10-03 16:32 [PATCH v2 0/4] Minor SST optimizations Srinivas Pandruvada
                   ` (2 preceding siblings ...)
  2023-10-03 16:32 ` [PATCH v2 3/4] platform/x86: intel_speed_select_if: Remove hardcoded map size Srinivas Pandruvada
@ 2023-10-03 16:32 ` Srinivas Pandruvada
  2023-10-04  9:08 ` [PATCH v2 0/4] Minor SST optimizations Ilpo Järvinen
  4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Pandruvada @ 2023-10-03 16:32 UTC (permalink / raw
  To: hdegoede, markgross, ilpo.jarvinen, andriy.shevchenko
  Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada

Replace devm_ioremap() with devm_ioremap_resource() by defining a
resource.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2
New patch in the series. Moved from indepedent patch to the SST series.
Updated commit log and added Reviewed-by.

 .../platform/x86/intel/speed_select_if/isst_if_mmio.c    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
index 13e068c77d50..3f4343147dad 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
@@ -94,6 +94,7 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	struct isst_if_device *punit_dev;
 	struct isst_if_cmd_cb cb;
 	u32 mmio_base, pcu_base;
+	struct resource r;
 	u64 base_addr;
 	int ret;
 
@@ -118,10 +119,10 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data;
 
-	punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr,
-					     punit_dev->mmio_range[1].size);
-	if (!punit_dev->punit_mmio)
-		return -ENOMEM;
+	r = DEFINE_RES_MEM(base_addr, punit_dev->mmio_range[1].size);
+	punit_dev->punit_mmio = devm_ioremap_resource(&pdev->dev, &r);
+	if (IS_ERR(punit_dev->punit_mmio))
+		return PTR_ERR(punit_dev->punit_mmio);
 
 	mutex_init(&punit_dev->mutex);
 	pci_set_drvdata(pdev, punit_dev);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/4] Minor SST optimizations
  2023-10-03 16:32 [PATCH v2 0/4] Minor SST optimizations Srinivas Pandruvada
                   ` (3 preceding siblings ...)
  2023-10-03 16:32 ` [PATCH v2 4/4] platform/x86: intel_speed_select_if: Use devm_ioremap_resource Srinivas Pandruvada
@ 2023-10-04  9:08 ` Ilpo Järvinen
  4 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2023-10-04  9:08 UTC (permalink / raw
  To: hdegoede, markgross, andriy.shevchenko, Srinivas Pandruvada
  Cc: platform-driver-x86, linux-kernel

On Tue, 03 Oct 2023 09:32:30 -0700, Srinivas Pandruvada wrote:

> Contains some minor changes to use SST for non dynamic use cases
> for display purpose and remove hardcoded size for map.
> 
> v2
> Update commit description, no code change
> Added a new patch which was independent before
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.

Once I've run some tests on the review-ilpo branch the patches
there will be added to the platform-drivers-x86/for-next branch
and eventually will be included in the pdx86 pull-request to
Linus for the next merge-window.

The list of commits applied:
[1/4] platform/x86: ISST: Use fuse enabled mask instead of allowed levels
      commit: da4082841ccf022beae73e63d3f476f59777172b
[2/4] platform/x86: ISST: Allow level 0 to be not present
      commit: a22d36eb5b150913325640cb793e13e08d1bd715
[3/4] platform/x86: intel_speed_select_if: Remove hardcoded map size
      commit: 7525cea3ef9384054a30f25ebb501234befecdcb
[4/4] platform/x86: intel_speed_select_if: Use devm_ioremap_resource
      commit: 23f392ea6d1916f68be8067e2a038ef9a746a94b

--
 i.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-04  9:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03 16:32 [PATCH v2 0/4] Minor SST optimizations Srinivas Pandruvada
2023-10-03 16:32 ` [PATCH v2 1/4] platform/x86: ISST: Use fuse enabled mask instead of allowed levels Srinivas Pandruvada
2023-10-03 16:32 ` [PATCH v2 2/4] platform/x86: ISST: Allow level 0 to be not present Srinivas Pandruvada
2023-10-03 16:32 ` [PATCH v2 3/4] platform/x86: intel_speed_select_if: Remove hardcoded map size Srinivas Pandruvada
2023-10-03 16:32 ` [PATCH v2 4/4] platform/x86: intel_speed_select_if: Use devm_ioremap_resource Srinivas Pandruvada
2023-10-04  9:08 ` [PATCH v2 0/4] Minor SST optimizations Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).