Minor SST optimizations
Subsystems (2)
Srinivas Pandruvada
maintainercover Minor SST optimizations
Contains some minor changes to use SST for non dynamic use cases for display purpose and remove hardcoded size for map.
Srinivas Pandruvada (3):
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
drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c | 7 +++++-- .../platform/x86/intel/speed_select_if/isst_tpmi_core.c | 5 +---- 2 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.41.0
Srinivas Pandruvada
maintainerPATCH 1/3 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. But even dynamic switching is not allowed, user should be able to check all parameters for selection via BIOS.
So when passing the level mask for display to user space, use fuse enabled mask, which has all levels.
--- 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
@@ -712,7 +712,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
Ilpo Järvinen
maintainerRe: [PATCH 1/3] platform/x86: ISST: Use fuse enabled mask instead of allowed levels
Quoted 2 lines · Srinivas Pandruvada
Allowed level mask is a mask of levels, which are currently allowed to dynamically switch. But even dynamic switching is not allowed,
even if ?
Quoted 1 line
user should be able to check all parameters for selection via BIOS.
I think you're lacking a negation in the above paragraph because it sounds like there's an internal contradiction in it. Can you please take a look.
Signature · 1 line
i.
Quoted 22 lines
So when passing the level mask for display to user space, use fuse enabled mask, which has all levels.
Signed-off-by Srinivas Pandruvada <[email protected]>--- 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@@ -712,7 +712,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 )
srinivas pandruvada
maintainerRe: [PATCH 1/3] platform/x86: ISST: Use fuse enabled mask instead of allowed levels
Quoted 6 lines · Ilpo Järvinen
Quoted 2 lines · Srinivas Pandruvada
Allowed level mask is a mask of levels, which are currently allowed to dynamically switch. But even dynamic switching is not allowed,
even if ?
OK
Quoted 7 lines
Quoted 2 lines
user should be able to check all parameters for selection via BIOS.
I think you're lacking a negation in the above paragraph because it sounds
like there's an internal contradiction in it. Can you please take a look.
I can try to improve.
Quoted 1 line
Srinivas Pandruvada
maintainerPATCH 2/3 platform/x86: ISST: Allow level 0 to be not present
In reply to Srinivas PandruvadaIt 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.
--- 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
@@ -372,9 +372,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
Re: [PATCH 2/3] platform/x86: ISST: Allow level 0 to be not present
Quoted 14 lines · 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_maskby default.Signed-off-by Srinivas Pandruvada <[email protected]>--- 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
-0
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai · line 377
Quoted 9 lines
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +0
-3@@ -372,9 +372,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
i.
Srinivas Pandruvada
maintainerPATCH 3/3 platform/x86: intel_speed_select_if: Remove hardcoded map size
In reply to Srinivas PandruvadaThe driver is using 256 as the size while calling devm_ioremap(). The maximum offset is already part of struct isst_mmio_range. Use the maximum offset (end field of the struct) plus 4 as the map size to remove hardcoded value of 256.
--- drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +5 -2
@@ -114,13 +114,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 ].end +sizeof (u32));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
Re: [PATCH 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size
Quoted 4 lines · Srinivas Pandruvada
The driver is using 256 as the size while calling
devm_ioremap(). The maximum offset is already part of structisst_mmio_range. Use the maximum offset (end field of the struct) plus 4 as the map size to remove hardcoded value of 256.
...
drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 121
Quoted 4 lines
drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +4
-0+ 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 ].end +sizeof (u32));
Can we rather fix the mmio_range driver data to have end be actually not the offset of the last dword? (Better maybe to keep length there.)
With help of
struct resource r; ... r = DEFINE_RES_MEM(base_addr, mmio_range.beg + mmio_range.len);
you can switch to devm_ioremap_resource() API.
Signature · 2 lines
With Best Regards, Andy Shevchenko
srinivas pandruvada
maintainerRe: [PATCH 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size
Quoted 12 lines · Andy Shevchenko
Quoted 6 lines · Srinivas Pandruvada
The driver is using 256 as the size while calling
devm_ioremap(). The
maximum offset is already part of structisst_mmio_range. Use the maximum offset (end field of the struct) plus 4 as the map size to remove
hardcoded value of 256....
Quoted 2 lines
+ punit_dev->mmio_range = (struct
isst_mmio_range*) ent-Quoted 1 line
driver_data;
Quoted 9 lines
Quoted 4 lines
+
+ punit_dev->punit_mmio = devm_ioremap(&pdev->dev,base_addr, + punit_dev-Quoted 1 line
mmio_range[1].end + sizeof(u32));
Can we rather fix the
mmio_rangedriver data to have end be actually not the
offset of the last dword? (Better maybe to keep length there.)
We can. But that has to be separate patch on top as there are other places this range is used.
Quoted 8 lines
With help of
struct resource r;
...
r =DEFINE_RES_MEM(base_addr, mmio_range.beg + mmio_range.len);you can switch to
devm_ioremap_resource()API.
What is the advantage of creating a resource and then call devm_ioremap_resource()?
Thanks,
Srinivas
Quoted 1 line
Re: [PATCH 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size
Quoted 8 lines · srinivas pandruvada
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Srinivas Pandruvada
The driver is using 256 as the size while calling
devm_ioremap(). The
maximum offset is already part of structisst_mmio_range. Use the maximum offset (end field of the struct) plus 4 as the map size to remove
hardcoded value of 256.
...
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
+ punit_dev->mmio_range = (struct
isst_mmio_range*) ent-Quoted 1 line
driver_data;+
+ punit_dev->punit_mmio = devm_ioremap(&pdev->dev,base_addr, + punit_dev-
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
mmio_range[1].end + sizeof(u32));
Can we rather fix the
mmio_rangedriver data to have end be actually not the
offset of the last dword? (Better maybe to keep length there.)We can. But that has to be separate patch on top as there are other places this range is used.
Still you can add a third member for now and then clean up it later as it's all in one file.
...
Quoted 10 lines
Quoted 8 lines
With help of
struct resource r;
...
r =DEFINE_RES_MEM(base_addr, mmio_range.beg + mmio_range.len);you can switch to
devm_ioremap_resource()API.What is the advantage of creating a resource and then call
devm_ioremap_resource()?
It manages resource via global resource management and also prints an error messages in case of errors.
Signature · 2 lines
With Best Regards, Andy Shevchenko