Skip to contentSkip to conversation

Minor SST optimizations

PATCH In review Srinivas Pandruvada 2 participants 6 messages Oct 3, 2023 – Oct 4, 2023

Subsystems (2)
lore
Share & tools
lore

Srinivas Pandruvada

author maintainer
#0 lore raw

v2 cover Minor SST optimizations

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(-)
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH v2 1/4 platform/x86: ISST: Use fuse enabled mask instead of allowed levels

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.

---
v2:
- Updated the commit description

 drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +1 -1
index 63faa2ea8327..a672a1c814af 100644
@@ -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)
Signature · 1 line
2.41.0
author maintainer
#2 lore raw

PATCH v2 2/4 platform/x86: ISST: Allow level 0 to be not present

In reply to 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.

---
v2:
No change, just added Reviewed by

 drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +0 -3
index a672a1c814af..ac5c6a812592 100644
@@ -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) {
Signature · 1 line
2.41.0
author maintainer
#3 lore raw

PATCH v2 3/4 platform/x86: intel_speed_select_if: Remove hardcoded map size

In reply to 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.

---
v2
No change except additional Reviewed-by

 .../x86/intel/speed_select_if/isst_if_mmio.c     | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +10 -6
index ff49025ec085..13e068c77d50 100644
@@ -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);
Signature · 1 line
2.41.0
author maintainer
#4 lore raw

PATCH v2 4/4 platform/x86: intel_speed_select_if: Use devm_ioremap_resource

In reply to Srinivas Pandruvada

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

---
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(-)
drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +5 -4
index 13e068c77d50..3f4343147dad 100644
@@ -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);
Signature · 1 line
2.41.0
maintainer
#5 lore raw
In reply to Srinivas Pandruvada
Quoted 8 lines · 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

[...]

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.