Lines Matching +full:scu +full:- +full:index
1 // SPDX-License-Identifier: GPL-2.0
17 #include <asm/intel-family.h>
191 *unit_config = &(telm_conf->pss_config); in telem_get_unitconfig()
193 *unit_config = &(telm_conf->ioss_config); in telem_get_unitconfig()
195 return -EINVAL; in telem_get_unitconfig()
215 return -EINVAL; in telemetry_check_evtid()
221 return -EINVAL; in telemetry_check_evtid()
224 return -EINVAL; in telemetry_check_evtid()
229 if ((len + unit_config->ssram_evts_used) > in telemetry_check_evtid()
231 return -EINVAL; in telemetry_check_evtid()
234 return -EINVAL; in telemetry_check_evtid()
240 return -EINVAL; in telemetry_check_evtid()
247 static inline int telemetry_plt_config_ioss_event(u32 evt_id, int index) in telemetry_plt_config_ioss_event() argument
253 write_buf |= index; in telemetry_plt_config_ioss_event()
255 return intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_plt_config_ioss_event()
260 static inline int telemetry_plt_config_pss_event(u32 evt_id, int index) in telemetry_plt_config_pss_event() argument
267 index, 0, &write_buf, NULL); in telemetry_plt_config_pss_event()
275 struct intel_scu_ipc_dev *scu = telm_conf->scu; in telemetry_setup_iossevtconfig() local
277 int ret, index, idx; in telemetry_setup_iossevtconfig() local
286 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
297 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
311 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
319 telm_conf->ioss_config.ssram_evts_used = 0; in telemetry_setup_iossevtconfig()
324 telm_conf->ioss_config.telem_evts[idx].evt_id, in telemetry_setup_iossevtconfig()
327 telm_conf->ioss_config.telem_evts[idx].evt_id); in telemetry_setup_iossevtconfig()
330 telm_conf->ioss_config.ssram_evts_used++; in telemetry_setup_iossevtconfig()
334 /* Re-Configure Everything */ in telemetry_setup_iossevtconfig()
339 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
347 telm_conf->ioss_config.ssram_evts_used = 0; in telemetry_setup_iossevtconfig()
350 for (index = 0; index < num_ioss_evts; index++) { in telemetry_setup_iossevtconfig()
351 telm_conf->ioss_config.telem_evts[index].evt_id = in telemetry_setup_iossevtconfig()
352 ioss_evtmap[index]; in telemetry_setup_iossevtconfig()
355 telm_conf->ioss_config.telem_evts[index].evt_id, in telemetry_setup_iossevtconfig()
356 index)) { in telemetry_setup_iossevtconfig()
358 ioss_evtmap[index]); in telemetry_setup_iossevtconfig()
361 telm_conf->ioss_config.ssram_evts_used++; in telemetry_setup_iossevtconfig()
368 for (index = telm_conf->ioss_config.ssram_evts_used, idx = 0; in telemetry_setup_iossevtconfig()
369 idx < num_ioss_evts; index++, idx++) { in telemetry_setup_iossevtconfig()
370 telm_conf->ioss_config.telem_evts[index].evt_id = in telemetry_setup_iossevtconfig()
374 telm_conf->ioss_config.telem_evts[index].evt_id, in telemetry_setup_iossevtconfig()
375 index)) { in telemetry_setup_iossevtconfig()
380 telm_conf->ioss_config.ssram_evts_used++; in telemetry_setup_iossevtconfig()
390 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
398 telm_conf->ioss_config.curr_period = ioss_period; in telemetry_setup_iossevtconfig()
408 int ret, index, idx; in telemetry_setup_pssevtconfig() local
446 telm_conf->pss_config.ssram_evts_used = 0; in telemetry_setup_pssevtconfig()
450 telm_conf->pss_config.telem_evts[idx].evt_id, in telemetry_setup_pssevtconfig()
453 telm_conf->pss_config.telem_evts[idx].evt_id); in telemetry_setup_pssevtconfig()
456 telm_conf->pss_config.ssram_evts_used++; in telemetry_setup_pssevtconfig()
460 /* Re-Configure Everything */ in telemetry_setup_pssevtconfig()
472 telm_conf->pss_config.ssram_evts_used = 0; in telemetry_setup_pssevtconfig()
475 for (index = 0; index < num_pss_evts; index++) { in telemetry_setup_pssevtconfig()
476 telm_conf->pss_config.telem_evts[index].evt_id = in telemetry_setup_pssevtconfig()
477 pss_evtmap[index]; in telemetry_setup_pssevtconfig()
480 telm_conf->pss_config.telem_evts[index].evt_id, in telemetry_setup_pssevtconfig()
481 index)) { in telemetry_setup_pssevtconfig()
483 pss_evtmap[index]); in telemetry_setup_pssevtconfig()
486 telm_conf->pss_config.ssram_evts_used++; in telemetry_setup_pssevtconfig()
493 for (index = telm_conf->pss_config.ssram_evts_used, idx = 0; in telemetry_setup_pssevtconfig()
494 idx < num_pss_evts; index++, idx++) { in telemetry_setup_pssevtconfig()
496 telm_conf->pss_config.telem_evts[index].evt_id = in telemetry_setup_pssevtconfig()
500 telm_conf->pss_config.telem_evts[index].evt_id, in telemetry_setup_pssevtconfig()
501 index)) { in telemetry_setup_pssevtconfig()
506 telm_conf->pss_config.ssram_evts_used++; in telemetry_setup_pssevtconfig()
523 telm_conf->pss_config.curr_period = pss_period; in telemetry_setup_pssevtconfig()
534 mutex_lock(&(telm_conf->telem_lock)); in telemetry_setup_evtconfig()
536 if ((action == TELEM_UPDATE) && (telm_conf->telem_in_use)) { in telemetry_setup_evtconfig()
537 ret = -EBUSY; in telemetry_setup_evtconfig()
564 telm_conf->telem_in_use = true; in telemetry_setup_evtconfig()
566 telm_conf->telem_in_use = false; in telemetry_setup_evtconfig()
569 mutex_unlock(&(telm_conf->telem_lock)); in telemetry_setup_evtconfig()
579 ret = intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_setup()
583 dev_err(&pdev->dev, "IOSS TELEM_INFO Read Failed\n"); in telemetry_setup()
593 dev_err(&pdev->dev, "IOSS:Insufficient Space for SRAM Trace\n"); in telemetry_setup()
594 dev_err(&pdev->dev, "SRAM Events %d; Event Regs %d\n", in telemetry_setup()
596 return -ENOMEM; in telemetry_setup()
599 telm_conf->ioss_config.min_period = TELEM_MIN_PERIOD(read_buf); in telemetry_setup()
600 telm_conf->ioss_config.max_period = TELEM_MAX_PERIOD(read_buf); in telemetry_setup()
606 dev_err(&pdev->dev, "PSS TELEM_INFO Read Failed\n"); in telemetry_setup()
616 dev_err(&pdev->dev, "PSS:Insufficient Space for SRAM Trace\n"); in telemetry_setup()
617 dev_err(&pdev->dev, "SRAM Events %d; Event Regs %d\n", in telemetry_setup()
619 return -ENOMEM; in telemetry_setup()
622 telm_conf->pss_config.min_period = TELEM_MIN_PERIOD(read_buf); in telemetry_setup()
623 telm_conf->pss_config.max_period = TELEM_MAX_PERIOD(read_buf); in telemetry_setup()
636 dev_err(&pdev->dev, "TELEMETRY Setup Failed\n"); in telemetry_setup()
650 return -EINVAL; in telemetry_plt_update_events()
656 return -EINVAL; in telemetry_plt_update_events()
673 mutex_lock(&(telm_conf->telem_lock)); in telemetry_plt_set_sampling_period()
675 struct intel_scu_ipc_dev *scu = telm_conf->scu; in telemetry_plt_set_sampling_period() local
679 ret = -EINVAL; in telemetry_plt_set_sampling_period()
684 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_plt_set_sampling_period()
695 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_plt_set_sampling_period()
710 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_plt_set_sampling_period()
718 telm_conf->ioss_config.curr_period = ioss_period; in telemetry_plt_set_sampling_period()
724 ret = -EINVAL; in telemetry_plt_set_sampling_period()
760 telm_conf->pss_config.curr_period = pss_period; in telemetry_plt_set_sampling_period()
764 mutex_unlock(&(telm_conf->telem_lock)); in telemetry_plt_set_sampling_period()
774 *pss_min_period = telm_conf->pss_config.min_period; in telemetry_plt_get_sampling_period()
775 *pss_max_period = telm_conf->pss_config.max_period; in telemetry_plt_get_sampling_period()
776 *ioss_min_period = telm_conf->ioss_config.min_period; in telemetry_plt_get_sampling_period()
777 *ioss_max_period = telm_conf->ioss_config.max_period; in telemetry_plt_get_sampling_period()
810 u32 index; in telemetry_plt_get_eventconfig() local
812 pss_evtmap = pss_config->evtmap; in telemetry_plt_get_eventconfig()
813 ioss_evtmap = ioss_config->evtmap; in telemetry_plt_get_eventconfig()
815 mutex_lock(&(telm_conf->telem_lock)); in telemetry_plt_get_eventconfig()
816 pss_config->num_evts = telm_conf->pss_config.ssram_evts_used; in telemetry_plt_get_eventconfig()
817 ioss_config->num_evts = telm_conf->ioss_config.ssram_evts_used; in telemetry_plt_get_eventconfig()
819 pss_config->period = telm_conf->pss_config.curr_period; in telemetry_plt_get_eventconfig()
820 ioss_config->period = telm_conf->ioss_config.curr_period; in telemetry_plt_get_eventconfig()
822 if ((pss_len < telm_conf->pss_config.ssram_evts_used) || in telemetry_plt_get_eventconfig()
823 (ioss_len < telm_conf->ioss_config.ssram_evts_used)) { in telemetry_plt_get_eventconfig()
824 mutex_unlock(&(telm_conf->telem_lock)); in telemetry_plt_get_eventconfig()
825 return -EINVAL; in telemetry_plt_get_eventconfig()
828 for (index = 0; index < telm_conf->pss_config.ssram_evts_used; in telemetry_plt_get_eventconfig()
829 index++) { in telemetry_plt_get_eventconfig()
830 pss_evtmap[index] = in telemetry_plt_get_eventconfig()
831 telm_conf->pss_config.telem_evts[index].evt_id; in telemetry_plt_get_eventconfig()
834 for (index = 0; index < telm_conf->ioss_config.ssram_evts_used; in telemetry_plt_get_eventconfig()
835 index++) { in telemetry_plt_get_eventconfig()
836 ioss_evtmap[index] = in telemetry_plt_get_eventconfig()
837 telm_conf->ioss_config.telem_evts[index].evt_id; in telemetry_plt_get_eventconfig()
840 mutex_unlock(&(telm_conf->telem_lock)); in telemetry_plt_get_eventconfig()
853 pss_evtconfig.period = telm_conf->pss_config.curr_period; in telemetry_plt_add_events()
857 ioss_evtconfig.period = telm_conf->ioss_config.curr_period; in telemetry_plt_add_events()
872 int ret, index, timeout = 0; in telem_evtlog_read() local
878 if (len > unit_config->ssram_evts_used) in telem_evtlog_read()
879 len = unit_config->ssram_evts_used; in telem_evtlog_read()
882 timestamp_prev = readq(unit_config->regmap); in telem_evtlog_read()
885 return -EBUSY; in telem_evtlog_read()
888 ssram_region->start_time = readq(unit_config->regmap + in telem_evtlog_read()
891 for (index = 0; index < len; index++) { in telem_evtlog_read()
892 ssram_region->events[index] = in telem_evtlog_read()
893 readq(unit_config->regmap + TELEM_SSRAM_EVTLOG_OFFSET + in telem_evtlog_read()
894 BYTES_PER_LONG*index); in telem_evtlog_read()
897 timestamp_next = readq(unit_config->regmap); in telem_evtlog_read()
900 return -EBUSY; in telem_evtlog_read()
905 return -EBUSY; in telem_evtlog_read()
910 ssram_region->timestamp = timestamp_next; in telem_evtlog_read()
919 int index, idx1, ret, readlen = len; in telemetry_plt_raw_read_eventlog() local
925 evtmap = telm_conf->pss_config.telem_evts; in telemetry_plt_raw_read_eventlog()
929 evtmap = telm_conf->ioss_config.telem_evts; in telemetry_plt_raw_read_eventlog()
934 return -EINVAL; in telemetry_plt_raw_read_eventlog()
944 /* Invalid evt-id array specified via length mismatch */ in telemetry_plt_raw_read_eventlog()
946 return -EINVAL; in telemetry_plt_raw_read_eventlog()
949 for (index = 0; index < ret; index++) { in telemetry_plt_raw_read_eventlog()
950 evtlog[index].telem_evtlog = ssram_region.events[index]; in telemetry_plt_raw_read_eventlog()
951 evtlog[index].telem_evtid = evtmap[index].evt_id; in telemetry_plt_raw_read_eventlog()
954 for (index = 0, readlen = 0; (index < ret) && (readlen < len); in telemetry_plt_raw_read_eventlog()
955 index++) { in telemetry_plt_raw_read_eventlog()
958 if (evtmap[index].evt_id == in telemetry_plt_raw_read_eventlog()
961 ssram_region.events[index]; in telemetry_plt_raw_read_eventlog()
977 mutex_lock(&(telm_conf->telem_lock)); in telemetry_plt_read_eventlog()
980 mutex_unlock(&(telm_conf->telem_lock)); in telemetry_plt_read_eventlog()
992 return -EINVAL; in telemetry_plt_get_trace_verbosity()
994 mutex_lock(&(telm_conf->telem_trace_lock)); in telemetry_plt_get_trace_verbosity()
1008 ret = intel_scu_ipc_dev_command(telm_conf->scu, in telemetry_plt_get_trace_verbosity()
1020 ret = -EINVAL; in telemetry_plt_get_trace_verbosity()
1026 mutex_unlock(&(telm_conf->telem_trace_lock)); in telemetry_plt_get_trace_verbosity()
1038 mutex_lock(&(telm_conf->telem_trace_lock)); in telemetry_plt_set_trace_verbosity()
1062 ret = intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_plt_set_trace_verbosity()
1073 ret = intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_plt_set_trace_verbosity()
1084 ret = -EINVAL; in telemetry_plt_set_trace_verbosity()
1089 mutex_unlock(&(telm_conf->telem_trace_lock)); in telemetry_plt_set_trace_verbosity()
1114 return -ENODEV; in telemetry_pltdrv_probe()
1116 telm_conf = (struct telemetry_plt_config *)id->driver_data; in telemetry_pltdrv_probe()
1118 telm_conf->pmc = dev_get_drvdata(pdev->dev.parent); in telemetry_pltdrv_probe()
1124 telm_conf->pss_config.regmap = mem; in telemetry_pltdrv_probe()
1130 telm_conf->ioss_config.regmap = mem; in telemetry_pltdrv_probe()
1132 telm_conf->scu = devm_intel_scu_ipc_dev_get(&pdev->dev); in telemetry_pltdrv_probe()
1133 if (!telm_conf->scu) { in telemetry_pltdrv_probe()
1134 ret = -EPROBE_DEFER; in telemetry_pltdrv_probe()
1138 mutex_init(&telm_conf->telem_lock); in telemetry_pltdrv_probe()
1139 mutex_init(&telm_conf->telem_trace_lock); in telemetry_pltdrv_probe()
1147 dev_err(&pdev->dev, "TELEMETRY Set Pltops Failed.\n"); in telemetry_pltdrv_probe()
1154 dev_err(&pdev->dev, "TELEMETRY Setup Failed.\n"); in telemetry_pltdrv_probe()