Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

coresight-etm4x: change etmv4_drvdata spinlock type to raw_spinlock_t

In coresight-etm4x drivers, etmv4_drvdata->spinlock can be held during
__schedule() by perf_event_task_sched_out()/in().

Since etmv4_drvdata->spinlock type is spinlock_t and
perf_event_task_sched_out()/in() is called after acquiring rq_lock,
which is raw_spinlock_t (an unsleepable lock),
this poses an issue in PREEMPT_RT kernel where spinlock_t is sleepable.

To address this, change type etmv4_drvdata->spinlock
in coresight-etm4x drivers, which can be called
by perf_event_task_sched_out()/in(), from spinlock_t to raw_spinlock_t.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250306121110.1647948-3-yeoreum.yun@arm.com

authored by

Yeoreum Yun and committed by
Suzuki K Poulose
743c5a97 26f060c1

+140 -140
+4 -4
drivers/hwtracing/coresight/coresight-config.c
··· 76 76 unsigned long flags; 77 77 int i; 78 78 79 - spin_lock_irqsave(feat_csdev->drv_spinlock, flags); 79 + raw_spin_lock_irqsave(feat_csdev->drv_spinlock, flags); 80 80 for (i = 0; i < feat_csdev->nr_regs; i++) 81 81 cscfg_set_reg(&feat_csdev->regs_csdev[i]); 82 - spin_unlock_irqrestore(feat_csdev->drv_spinlock, flags); 82 + raw_spin_unlock_irqrestore(feat_csdev->drv_spinlock, flags); 83 83 dev_dbg(&feat_csdev->csdev->dev, "Feature %s: %s", 84 84 feat_csdev->feat_desc->name, "set on enable"); 85 85 return 0; ··· 91 91 unsigned long flags; 92 92 int i; 93 93 94 - spin_lock_irqsave(feat_csdev->drv_spinlock, flags); 94 + raw_spin_lock_irqsave(feat_csdev->drv_spinlock, flags); 95 95 for (i = 0; i < feat_csdev->nr_regs; i++) 96 96 cscfg_save_reg(&feat_csdev->regs_csdev[i]); 97 - spin_unlock_irqrestore(feat_csdev->drv_spinlock, flags); 97 + raw_spin_unlock_irqrestore(feat_csdev->drv_spinlock, flags); 98 98 dev_dbg(&feat_csdev->csdev->dev, "Feature %s: %s", 99 99 feat_csdev->feat_desc->name, "save on disable"); 100 100 }
+1 -1
drivers/hwtracing/coresight/coresight-config.h
··· 206 206 const struct cscfg_feature_desc *feat_desc; 207 207 struct coresight_device *csdev; 208 208 struct list_head node; 209 - spinlock_t *drv_spinlock; 209 + raw_spinlock_t *drv_spinlock; 210 210 int nr_params; 211 211 struct cscfg_parameter_csdev *params_csdev; 212 212 int nr_regs;
+9 -9
drivers/hwtracing/coresight/coresight-etm4x-core.c
··· 830 830 return ret; 831 831 } 832 832 833 - spin_lock(&drvdata->spinlock); 833 + raw_spin_lock(&drvdata->spinlock); 834 834 835 835 drvdata->trcid = path->trace_id; 836 836 ··· 849 849 if (ret) 850 850 etm4_release_trace_id(drvdata); 851 851 852 - spin_unlock(&drvdata->spinlock); 852 + raw_spin_unlock(&drvdata->spinlock); 853 853 854 854 if (!ret) 855 855 dev_dbg(&csdev->dev, "ETM tracing enabled\n"); ··· 1011 1011 * DYING hotplug callback is serviced by the ETM driver. 1012 1012 */ 1013 1013 cpus_read_lock(); 1014 - spin_lock(&drvdata->spinlock); 1014 + raw_spin_lock(&drvdata->spinlock); 1015 1015 1016 1016 /* 1017 1017 * Executing etm4_disable_hw on the cpu whose ETM is being disabled ··· 1019 1019 */ 1020 1020 smp_call_function_single(drvdata->cpu, etm4_disable_hw, drvdata, 1); 1021 1021 1022 - spin_unlock(&drvdata->spinlock); 1022 + raw_spin_unlock(&drvdata->spinlock); 1023 1023 cpus_read_unlock(); 1024 1024 1025 1025 /* ··· 1698 1698 if (!etmdrvdata[cpu]) 1699 1699 return 0; 1700 1700 1701 - spin_lock(&etmdrvdata[cpu]->spinlock); 1701 + raw_spin_lock(&etmdrvdata[cpu]->spinlock); 1702 1702 if (!etmdrvdata[cpu]->os_unlock) 1703 1703 etm4_os_unlock(etmdrvdata[cpu]); 1704 1704 1705 1705 if (coresight_get_mode(etmdrvdata[cpu]->csdev)) 1706 1706 etm4_enable_hw(etmdrvdata[cpu]); 1707 - spin_unlock(&etmdrvdata[cpu]->spinlock); 1707 + raw_spin_unlock(&etmdrvdata[cpu]->spinlock); 1708 1708 return 0; 1709 1709 } 1710 1710 ··· 1713 1713 if (!etmdrvdata[cpu]) 1714 1714 return 0; 1715 1715 1716 - spin_lock(&etmdrvdata[cpu]->spinlock); 1716 + raw_spin_lock(&etmdrvdata[cpu]->spinlock); 1717 1717 if (coresight_get_mode(etmdrvdata[cpu]->csdev)) 1718 1718 etm4_disable_hw(etmdrvdata[cpu]); 1719 - spin_unlock(&etmdrvdata[cpu]->spinlock); 1719 + raw_spin_unlock(&etmdrvdata[cpu]->spinlock); 1720 1720 return 0; 1721 1721 } 1722 1722 ··· 2160 2160 return -ENOMEM; 2161 2161 } 2162 2162 2163 - spin_lock_init(&drvdata->spinlock); 2163 + raw_spin_lock_init(&drvdata->spinlock); 2164 2164 2165 2165 drvdata->cpu = coresight_get_cpu(dev); 2166 2166 if (drvdata->cpu < 0)
+125 -125
drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
··· 175 175 if (kstrtoul(buf, 16, &val)) 176 176 return -EINVAL; 177 177 178 - spin_lock(&drvdata->spinlock); 178 + raw_spin_lock(&drvdata->spinlock); 179 179 if (val) 180 180 config->mode = 0x0; 181 181 ··· 267 267 config->vmid_mask0 = 0x0; 268 268 config->vmid_mask1 = 0x0; 269 269 270 - spin_unlock(&drvdata->spinlock); 270 + raw_spin_unlock(&drvdata->spinlock); 271 271 272 272 /* for sysfs - only release trace id when resetting */ 273 273 etm4_release_trace_id(drvdata); ··· 301 301 if (kstrtoul(buf, 16, &val)) 302 302 return -EINVAL; 303 303 304 - spin_lock(&drvdata->spinlock); 304 + raw_spin_lock(&drvdata->spinlock); 305 305 config->mode = val & ETMv4_MODE_ALL; 306 306 307 307 if (drvdata->instrp0 == true) { ··· 438 438 if (config->mode & (ETM_MODE_EXCL_KERN | ETM_MODE_EXCL_USER)) 439 439 etm4_config_trace_mode(config); 440 440 441 - spin_unlock(&drvdata->spinlock); 441 + raw_spin_unlock(&drvdata->spinlock); 442 442 443 443 return size; 444 444 } ··· 467 467 if (kstrtoul(buf, 16, &val)) 468 468 return -EINVAL; 469 469 470 - spin_lock(&drvdata->spinlock); 470 + raw_spin_lock(&drvdata->spinlock); 471 471 if (val > drvdata->nr_pe) { 472 - spin_unlock(&drvdata->spinlock); 472 + raw_spin_unlock(&drvdata->spinlock); 473 473 return -EINVAL; 474 474 } 475 475 476 476 config->pe_sel = val; 477 - spin_unlock(&drvdata->spinlock); 477 + raw_spin_unlock(&drvdata->spinlock); 478 478 return size; 479 479 } 480 480 static DEVICE_ATTR_RW(pe); ··· 502 502 if (kstrtoul(buf, 16, &val)) 503 503 return -EINVAL; 504 504 505 - spin_lock(&drvdata->spinlock); 505 + raw_spin_lock(&drvdata->spinlock); 506 506 switch (drvdata->nr_event) { 507 507 case 0x0: 508 508 /* EVENT0, bits[7:0] */ ··· 523 523 default: 524 524 break; 525 525 } 526 - spin_unlock(&drvdata->spinlock); 526 + raw_spin_unlock(&drvdata->spinlock); 527 527 return size; 528 528 } 529 529 static DEVICE_ATTR_RW(event); ··· 551 551 if (kstrtoul(buf, 16, &val)) 552 552 return -EINVAL; 553 553 554 - spin_lock(&drvdata->spinlock); 554 + raw_spin_lock(&drvdata->spinlock); 555 555 /* start by clearing all instruction event enable bits */ 556 556 config->eventctrl1 &= ~TRCEVENTCTL1R_INSTEN_MASK; 557 557 switch (drvdata->nr_event) { ··· 579 579 default: 580 580 break; 581 581 } 582 - spin_unlock(&drvdata->spinlock); 582 + raw_spin_unlock(&drvdata->spinlock); 583 583 return size; 584 584 } 585 585 static DEVICE_ATTR_RW(event_instren); ··· 740 740 if (kstrtoul(buf, 16, &val)) 741 741 return -EINVAL; 742 742 743 - spin_lock(&drvdata->spinlock); 743 + raw_spin_lock(&drvdata->spinlock); 744 744 val &= TRCVICTLR_EVENT_MASK >> __bf_shf(TRCVICTLR_EVENT_MASK); 745 745 config->vinst_ctrl &= ~TRCVICTLR_EVENT_MASK; 746 746 config->vinst_ctrl |= FIELD_PREP(TRCVICTLR_EVENT_MASK, val); 747 - spin_unlock(&drvdata->spinlock); 747 + raw_spin_unlock(&drvdata->spinlock); 748 748 return size; 749 749 } 750 750 static DEVICE_ATTR_RW(event_vinst); ··· 772 772 if (kstrtoul(buf, 16, &val)) 773 773 return -EINVAL; 774 774 775 - spin_lock(&drvdata->spinlock); 775 + raw_spin_lock(&drvdata->spinlock); 776 776 /* clear all EXLEVEL_S bits */ 777 777 config->vinst_ctrl &= ~TRCVICTLR_EXLEVEL_S_MASK; 778 778 /* enable instruction tracing for corresponding exception level */ 779 779 val &= drvdata->s_ex_level; 780 780 config->vinst_ctrl |= val << __bf_shf(TRCVICTLR_EXLEVEL_S_MASK); 781 - spin_unlock(&drvdata->spinlock); 781 + raw_spin_unlock(&drvdata->spinlock); 782 782 return size; 783 783 } 784 784 static DEVICE_ATTR_RW(s_exlevel_vinst); ··· 807 807 if (kstrtoul(buf, 16, &val)) 808 808 return -EINVAL; 809 809 810 - spin_lock(&drvdata->spinlock); 810 + raw_spin_lock(&drvdata->spinlock); 811 811 /* clear EXLEVEL_NS bits */ 812 812 config->vinst_ctrl &= ~TRCVICTLR_EXLEVEL_NS_MASK; 813 813 /* enable instruction tracing for corresponding exception level */ 814 814 val &= drvdata->ns_ex_level; 815 815 config->vinst_ctrl |= val << __bf_shf(TRCVICTLR_EXLEVEL_NS_MASK); 816 - spin_unlock(&drvdata->spinlock); 816 + raw_spin_unlock(&drvdata->spinlock); 817 817 return size; 818 818 } 819 819 static DEVICE_ATTR_RW(ns_exlevel_vinst); ··· 847 847 * Use spinlock to ensure index doesn't change while it gets 848 848 * dereferenced multiple times within a spinlock block elsewhere. 849 849 */ 850 - spin_lock(&drvdata->spinlock); 850 + raw_spin_lock(&drvdata->spinlock); 851 851 config->addr_idx = val; 852 - spin_unlock(&drvdata->spinlock); 852 + raw_spin_unlock(&drvdata->spinlock); 853 853 return size; 854 854 } 855 855 static DEVICE_ATTR_RW(addr_idx); ··· 863 863 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 864 864 struct etmv4_config *config = &drvdata->config; 865 865 866 - spin_lock(&drvdata->spinlock); 866 + raw_spin_lock(&drvdata->spinlock); 867 867 idx = config->addr_idx; 868 868 val = FIELD_GET(TRCACATRn_TYPE_MASK, config->addr_acc[idx]); 869 869 len = scnprintf(buf, PAGE_SIZE, "%s\n", ··· 871 871 (val == TRCACATRn_TYPE_DATA_LOAD_ADDR ? "data_load" : 872 872 (val == TRCACATRn_TYPE_DATA_STORE_ADDR ? "data_store" : 873 873 "data_load_store"))); 874 - spin_unlock(&drvdata->spinlock); 874 + raw_spin_unlock(&drvdata->spinlock); 875 875 return len; 876 876 } 877 877 ··· 889 889 if (sscanf(buf, "%s", str) != 1) 890 890 return -EINVAL; 891 891 892 - spin_lock(&drvdata->spinlock); 892 + raw_spin_lock(&drvdata->spinlock); 893 893 idx = config->addr_idx; 894 894 if (!strcmp(str, "instr")) 895 895 /* TYPE, bits[1:0] */ 896 896 config->addr_acc[idx] &= ~TRCACATRn_TYPE_MASK; 897 897 898 - spin_unlock(&drvdata->spinlock); 898 + raw_spin_unlock(&drvdata->spinlock); 899 899 return size; 900 900 } 901 901 static DEVICE_ATTR_RW(addr_instdatatype); ··· 910 910 struct etmv4_config *config = &drvdata->config; 911 911 912 912 idx = config->addr_idx; 913 - spin_lock(&drvdata->spinlock); 913 + raw_spin_lock(&drvdata->spinlock); 914 914 if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE || 915 915 config->addr_type[idx] == ETM_ADDR_TYPE_SINGLE)) { 916 - spin_unlock(&drvdata->spinlock); 916 + raw_spin_unlock(&drvdata->spinlock); 917 917 return -EPERM; 918 918 } 919 919 val = (unsigned long)config->addr_val[idx]; 920 - spin_unlock(&drvdata->spinlock); 920 + raw_spin_unlock(&drvdata->spinlock); 921 921 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 922 922 } 923 923 ··· 933 933 if (kstrtoul(buf, 16, &val)) 934 934 return -EINVAL; 935 935 936 - spin_lock(&drvdata->spinlock); 936 + raw_spin_lock(&drvdata->spinlock); 937 937 idx = config->addr_idx; 938 938 if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE || 939 939 config->addr_type[idx] == ETM_ADDR_TYPE_SINGLE)) { 940 - spin_unlock(&drvdata->spinlock); 940 + raw_spin_unlock(&drvdata->spinlock); 941 941 return -EPERM; 942 942 } 943 943 944 944 config->addr_val[idx] = (u64)val; 945 945 config->addr_type[idx] = ETM_ADDR_TYPE_SINGLE; 946 - spin_unlock(&drvdata->spinlock); 946 + raw_spin_unlock(&drvdata->spinlock); 947 947 return size; 948 948 } 949 949 static DEVICE_ATTR_RW(addr_single); ··· 957 957 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 958 958 struct etmv4_config *config = &drvdata->config; 959 959 960 - spin_lock(&drvdata->spinlock); 960 + raw_spin_lock(&drvdata->spinlock); 961 961 idx = config->addr_idx; 962 962 if (idx % 2 != 0) { 963 - spin_unlock(&drvdata->spinlock); 963 + raw_spin_unlock(&drvdata->spinlock); 964 964 return -EPERM; 965 965 } 966 966 if (!((config->addr_type[idx] == ETM_ADDR_TYPE_NONE && 967 967 config->addr_type[idx + 1] == ETM_ADDR_TYPE_NONE) || 968 968 (config->addr_type[idx] == ETM_ADDR_TYPE_RANGE && 969 969 config->addr_type[idx + 1] == ETM_ADDR_TYPE_RANGE))) { 970 - spin_unlock(&drvdata->spinlock); 970 + raw_spin_unlock(&drvdata->spinlock); 971 971 return -EPERM; 972 972 } 973 973 974 974 val1 = (unsigned long)config->addr_val[idx]; 975 975 val2 = (unsigned long)config->addr_val[idx + 1]; 976 - spin_unlock(&drvdata->spinlock); 976 + raw_spin_unlock(&drvdata->spinlock); 977 977 return scnprintf(buf, PAGE_SIZE, "%#lx %#lx\n", val1, val2); 978 978 } 979 979 ··· 996 996 if (val1 > val2) 997 997 return -EINVAL; 998 998 999 - spin_lock(&drvdata->spinlock); 999 + raw_spin_lock(&drvdata->spinlock); 1000 1000 idx = config->addr_idx; 1001 1001 if (idx % 2 != 0) { 1002 - spin_unlock(&drvdata->spinlock); 1002 + raw_spin_unlock(&drvdata->spinlock); 1003 1003 return -EPERM; 1004 1004 } 1005 1005 ··· 1007 1007 config->addr_type[idx + 1] == ETM_ADDR_TYPE_NONE) || 1008 1008 (config->addr_type[idx] == ETM_ADDR_TYPE_RANGE && 1009 1009 config->addr_type[idx + 1] == ETM_ADDR_TYPE_RANGE))) { 1010 - spin_unlock(&drvdata->spinlock); 1010 + raw_spin_unlock(&drvdata->spinlock); 1011 1011 return -EPERM; 1012 1012 } 1013 1013 ··· 1024 1024 exclude = config->mode & ETM_MODE_EXCLUDE; 1025 1025 etm4_set_mode_exclude(drvdata, exclude ? true : false); 1026 1026 1027 - spin_unlock(&drvdata->spinlock); 1027 + raw_spin_unlock(&drvdata->spinlock); 1028 1028 return size; 1029 1029 } 1030 1030 static DEVICE_ATTR_RW(addr_range); ··· 1038 1038 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1039 1039 struct etmv4_config *config = &drvdata->config; 1040 1040 1041 - spin_lock(&drvdata->spinlock); 1041 + raw_spin_lock(&drvdata->spinlock); 1042 1042 idx = config->addr_idx; 1043 1043 1044 1044 if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE || 1045 1045 config->addr_type[idx] == ETM_ADDR_TYPE_START)) { 1046 - spin_unlock(&drvdata->spinlock); 1046 + raw_spin_unlock(&drvdata->spinlock); 1047 1047 return -EPERM; 1048 1048 } 1049 1049 1050 1050 val = (unsigned long)config->addr_val[idx]; 1051 - spin_unlock(&drvdata->spinlock); 1051 + raw_spin_unlock(&drvdata->spinlock); 1052 1052 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1053 1053 } 1054 1054 ··· 1064 1064 if (kstrtoul(buf, 16, &val)) 1065 1065 return -EINVAL; 1066 1066 1067 - spin_lock(&drvdata->spinlock); 1067 + raw_spin_lock(&drvdata->spinlock); 1068 1068 idx = config->addr_idx; 1069 1069 if (!drvdata->nr_addr_cmp) { 1070 - spin_unlock(&drvdata->spinlock); 1070 + raw_spin_unlock(&drvdata->spinlock); 1071 1071 return -EINVAL; 1072 1072 } 1073 1073 if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE || 1074 1074 config->addr_type[idx] == ETM_ADDR_TYPE_START)) { 1075 - spin_unlock(&drvdata->spinlock); 1075 + raw_spin_unlock(&drvdata->spinlock); 1076 1076 return -EPERM; 1077 1077 } 1078 1078 1079 1079 config->addr_val[idx] = (u64)val; 1080 1080 config->addr_type[idx] = ETM_ADDR_TYPE_START; 1081 1081 config->vissctlr |= BIT(idx); 1082 - spin_unlock(&drvdata->spinlock); 1082 + raw_spin_unlock(&drvdata->spinlock); 1083 1083 return size; 1084 1084 } 1085 1085 static DEVICE_ATTR_RW(addr_start); ··· 1093 1093 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1094 1094 struct etmv4_config *config = &drvdata->config; 1095 1095 1096 - spin_lock(&drvdata->spinlock); 1096 + raw_spin_lock(&drvdata->spinlock); 1097 1097 idx = config->addr_idx; 1098 1098 1099 1099 if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE || 1100 1100 config->addr_type[idx] == ETM_ADDR_TYPE_STOP)) { 1101 - spin_unlock(&drvdata->spinlock); 1101 + raw_spin_unlock(&drvdata->spinlock); 1102 1102 return -EPERM; 1103 1103 } 1104 1104 1105 1105 val = (unsigned long)config->addr_val[idx]; 1106 - spin_unlock(&drvdata->spinlock); 1106 + raw_spin_unlock(&drvdata->spinlock); 1107 1107 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1108 1108 } 1109 1109 ··· 1119 1119 if (kstrtoul(buf, 16, &val)) 1120 1120 return -EINVAL; 1121 1121 1122 - spin_lock(&drvdata->spinlock); 1122 + raw_spin_lock(&drvdata->spinlock); 1123 1123 idx = config->addr_idx; 1124 1124 if (!drvdata->nr_addr_cmp) { 1125 - spin_unlock(&drvdata->spinlock); 1125 + raw_spin_unlock(&drvdata->spinlock); 1126 1126 return -EINVAL; 1127 1127 } 1128 1128 if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE || 1129 1129 config->addr_type[idx] == ETM_ADDR_TYPE_STOP)) { 1130 - spin_unlock(&drvdata->spinlock); 1130 + raw_spin_unlock(&drvdata->spinlock); 1131 1131 return -EPERM; 1132 1132 } 1133 1133 1134 1134 config->addr_val[idx] = (u64)val; 1135 1135 config->addr_type[idx] = ETM_ADDR_TYPE_STOP; 1136 1136 config->vissctlr |= BIT(idx + 16); 1137 - spin_unlock(&drvdata->spinlock); 1137 + raw_spin_unlock(&drvdata->spinlock); 1138 1138 return size; 1139 1139 } 1140 1140 static DEVICE_ATTR_RW(addr_stop); ··· 1148 1148 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1149 1149 struct etmv4_config *config = &drvdata->config; 1150 1150 1151 - spin_lock(&drvdata->spinlock); 1151 + raw_spin_lock(&drvdata->spinlock); 1152 1152 idx = config->addr_idx; 1153 1153 /* CONTEXTTYPE, bits[3:2] */ 1154 1154 val = FIELD_GET(TRCACATRn_CONTEXTTYPE_MASK, config->addr_acc[idx]); 1155 1155 len = scnprintf(buf, PAGE_SIZE, "%s\n", val == ETM_CTX_NONE ? "none" : 1156 1156 (val == ETM_CTX_CTXID ? "ctxid" : 1157 1157 (val == ETM_CTX_VMID ? "vmid" : "all"))); 1158 - spin_unlock(&drvdata->spinlock); 1158 + raw_spin_unlock(&drvdata->spinlock); 1159 1159 return len; 1160 1160 } 1161 1161 ··· 1173 1173 if (sscanf(buf, "%s", str) != 1) 1174 1174 return -EINVAL; 1175 1175 1176 - spin_lock(&drvdata->spinlock); 1176 + raw_spin_lock(&drvdata->spinlock); 1177 1177 idx = config->addr_idx; 1178 1178 if (!strcmp(str, "none")) 1179 1179 /* start by clearing context type bits */ ··· 1200 1200 if (drvdata->numvmidc) 1201 1201 config->addr_acc[idx] |= TRCACATRn_CONTEXTTYPE_VMID; 1202 1202 } 1203 - spin_unlock(&drvdata->spinlock); 1203 + raw_spin_unlock(&drvdata->spinlock); 1204 1204 return size; 1205 1205 } 1206 1206 static DEVICE_ATTR_RW(addr_ctxtype); ··· 1214 1214 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1215 1215 struct etmv4_config *config = &drvdata->config; 1216 1216 1217 - spin_lock(&drvdata->spinlock); 1217 + raw_spin_lock(&drvdata->spinlock); 1218 1218 idx = config->addr_idx; 1219 1219 /* context ID comparator bits[6:4] */ 1220 1220 val = FIELD_GET(TRCACATRn_CONTEXT_MASK, config->addr_acc[idx]); 1221 - spin_unlock(&drvdata->spinlock); 1221 + raw_spin_unlock(&drvdata->spinlock); 1222 1222 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1223 1223 } 1224 1224 ··· 1239 1239 drvdata->numcidc : drvdata->numvmidc)) 1240 1240 return -EINVAL; 1241 1241 1242 - spin_lock(&drvdata->spinlock); 1242 + raw_spin_lock(&drvdata->spinlock); 1243 1243 idx = config->addr_idx; 1244 1244 /* clear context ID comparator bits[6:4] */ 1245 1245 config->addr_acc[idx] &= ~TRCACATRn_CONTEXT_MASK; 1246 1246 config->addr_acc[idx] |= val << __bf_shf(TRCACATRn_CONTEXT_MASK); 1247 - spin_unlock(&drvdata->spinlock); 1247 + raw_spin_unlock(&drvdata->spinlock); 1248 1248 return size; 1249 1249 } 1250 1250 static DEVICE_ATTR_RW(addr_context); ··· 1258 1258 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1259 1259 struct etmv4_config *config = &drvdata->config; 1260 1260 1261 - spin_lock(&drvdata->spinlock); 1261 + raw_spin_lock(&drvdata->spinlock); 1262 1262 idx = config->addr_idx; 1263 1263 val = FIELD_GET(TRCACATRn_EXLEVEL_MASK, config->addr_acc[idx]); 1264 - spin_unlock(&drvdata->spinlock); 1264 + raw_spin_unlock(&drvdata->spinlock); 1265 1265 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1266 1266 } 1267 1267 ··· 1280 1280 if (val & ~(TRCACATRn_EXLEVEL_MASK >> __bf_shf(TRCACATRn_EXLEVEL_MASK))) 1281 1281 return -EINVAL; 1282 1282 1283 - spin_lock(&drvdata->spinlock); 1283 + raw_spin_lock(&drvdata->spinlock); 1284 1284 idx = config->addr_idx; 1285 1285 /* clear Exlevel_ns & Exlevel_s bits[14:12, 11:8], bit[15] is res0 */ 1286 1286 config->addr_acc[idx] &= ~TRCACATRn_EXLEVEL_MASK; 1287 1287 config->addr_acc[idx] |= val << __bf_shf(TRCACATRn_EXLEVEL_MASK); 1288 - spin_unlock(&drvdata->spinlock); 1288 + raw_spin_unlock(&drvdata->spinlock); 1289 1289 return size; 1290 1290 } 1291 1291 static DEVICE_ATTR_RW(addr_exlevel_s_ns); ··· 1308 1308 int size = 0; 1309 1309 bool exclude = false; 1310 1310 1311 - spin_lock(&drvdata->spinlock); 1311 + raw_spin_lock(&drvdata->spinlock); 1312 1312 idx = config->addr_idx; 1313 1313 addr_v = config->addr_val[idx]; 1314 1314 addr_ctrl = config->addr_acc[idx]; ··· 1323 1323 } 1324 1324 exclude = config->viiectlr & BIT(idx / 2 + 16); 1325 1325 } 1326 - spin_unlock(&drvdata->spinlock); 1326 + raw_spin_unlock(&drvdata->spinlock); 1327 1327 if (addr_type) { 1328 1328 size = scnprintf(buf, PAGE_SIZE, "addr_cmp[%i] %s %#lx", idx, 1329 1329 addr_type_names[addr_type], addr_v); ··· 1367 1367 if (!drvdata->nr_pe_cmp) 1368 1368 return -EINVAL; 1369 1369 1370 - spin_lock(&drvdata->spinlock); 1370 + raw_spin_lock(&drvdata->spinlock); 1371 1371 config->vipcssctlr = val; 1372 - spin_unlock(&drvdata->spinlock); 1372 + raw_spin_unlock(&drvdata->spinlock); 1373 1373 return size; 1374 1374 } 1375 1375 static DEVICE_ATTR_RW(vinst_pe_cmp_start_stop); ··· 1403 1403 * Use spinlock to ensure index doesn't change while it gets 1404 1404 * dereferenced multiple times within a spinlock block elsewhere. 1405 1405 */ 1406 - spin_lock(&drvdata->spinlock); 1406 + raw_spin_lock(&drvdata->spinlock); 1407 1407 config->seq_idx = val; 1408 - spin_unlock(&drvdata->spinlock); 1408 + raw_spin_unlock(&drvdata->spinlock); 1409 1409 return size; 1410 1410 } 1411 1411 static DEVICE_ATTR_RW(seq_idx); ··· 1449 1449 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1450 1450 struct etmv4_config *config = &drvdata->config; 1451 1451 1452 - spin_lock(&drvdata->spinlock); 1452 + raw_spin_lock(&drvdata->spinlock); 1453 1453 idx = config->seq_idx; 1454 1454 val = config->seq_ctrl[idx]; 1455 - spin_unlock(&drvdata->spinlock); 1455 + raw_spin_unlock(&drvdata->spinlock); 1456 1456 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1457 1457 } 1458 1458 ··· 1468 1468 if (kstrtoul(buf, 16, &val)) 1469 1469 return -EINVAL; 1470 1470 1471 - spin_lock(&drvdata->spinlock); 1471 + raw_spin_lock(&drvdata->spinlock); 1472 1472 idx = config->seq_idx; 1473 1473 /* Seq control has two masks B[15:8] F[7:0] */ 1474 1474 config->seq_ctrl[idx] = val & 0xFFFF; 1475 - spin_unlock(&drvdata->spinlock); 1475 + raw_spin_unlock(&drvdata->spinlock); 1476 1476 return size; 1477 1477 } 1478 1478 static DEVICE_ATTR_RW(seq_event); ··· 1536 1536 * Use spinlock to ensure index doesn't change while it gets 1537 1537 * dereferenced multiple times within a spinlock block elsewhere. 1538 1538 */ 1539 - spin_lock(&drvdata->spinlock); 1539 + raw_spin_lock(&drvdata->spinlock); 1540 1540 config->cntr_idx = val; 1541 - spin_unlock(&drvdata->spinlock); 1541 + raw_spin_unlock(&drvdata->spinlock); 1542 1542 return size; 1543 1543 } 1544 1544 static DEVICE_ATTR_RW(cntr_idx); ··· 1552 1552 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1553 1553 struct etmv4_config *config = &drvdata->config; 1554 1554 1555 - spin_lock(&drvdata->spinlock); 1555 + raw_spin_lock(&drvdata->spinlock); 1556 1556 idx = config->cntr_idx; 1557 1557 val = config->cntrldvr[idx]; 1558 - spin_unlock(&drvdata->spinlock); 1558 + raw_spin_unlock(&drvdata->spinlock); 1559 1559 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1560 1560 } 1561 1561 ··· 1573 1573 if (val > ETM_CNTR_MAX_VAL) 1574 1574 return -EINVAL; 1575 1575 1576 - spin_lock(&drvdata->spinlock); 1576 + raw_spin_lock(&drvdata->spinlock); 1577 1577 idx = config->cntr_idx; 1578 1578 config->cntrldvr[idx] = val; 1579 - spin_unlock(&drvdata->spinlock); 1579 + raw_spin_unlock(&drvdata->spinlock); 1580 1580 return size; 1581 1581 } 1582 1582 static DEVICE_ATTR_RW(cntrldvr); ··· 1590 1590 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1591 1591 struct etmv4_config *config = &drvdata->config; 1592 1592 1593 - spin_lock(&drvdata->spinlock); 1593 + raw_spin_lock(&drvdata->spinlock); 1594 1594 idx = config->cntr_idx; 1595 1595 val = config->cntr_val[idx]; 1596 - spin_unlock(&drvdata->spinlock); 1596 + raw_spin_unlock(&drvdata->spinlock); 1597 1597 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1598 1598 } 1599 1599 ··· 1611 1611 if (val > ETM_CNTR_MAX_VAL) 1612 1612 return -EINVAL; 1613 1613 1614 - spin_lock(&drvdata->spinlock); 1614 + raw_spin_lock(&drvdata->spinlock); 1615 1615 idx = config->cntr_idx; 1616 1616 config->cntr_val[idx] = val; 1617 - spin_unlock(&drvdata->spinlock); 1617 + raw_spin_unlock(&drvdata->spinlock); 1618 1618 return size; 1619 1619 } 1620 1620 static DEVICE_ATTR_RW(cntr_val); ··· 1628 1628 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1629 1629 struct etmv4_config *config = &drvdata->config; 1630 1630 1631 - spin_lock(&drvdata->spinlock); 1631 + raw_spin_lock(&drvdata->spinlock); 1632 1632 idx = config->cntr_idx; 1633 1633 val = config->cntr_ctrl[idx]; 1634 - spin_unlock(&drvdata->spinlock); 1634 + raw_spin_unlock(&drvdata->spinlock); 1635 1635 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1636 1636 } 1637 1637 ··· 1647 1647 if (kstrtoul(buf, 16, &val)) 1648 1648 return -EINVAL; 1649 1649 1650 - spin_lock(&drvdata->spinlock); 1650 + raw_spin_lock(&drvdata->spinlock); 1651 1651 idx = config->cntr_idx; 1652 1652 config->cntr_ctrl[idx] = val; 1653 - spin_unlock(&drvdata->spinlock); 1653 + raw_spin_unlock(&drvdata->spinlock); 1654 1654 return size; 1655 1655 } 1656 1656 static DEVICE_ATTR_RW(cntr_ctrl); ··· 1688 1688 * Use spinlock to ensure index doesn't change while it gets 1689 1689 * dereferenced multiple times within a spinlock block elsewhere. 1690 1690 */ 1691 - spin_lock(&drvdata->spinlock); 1691 + raw_spin_lock(&drvdata->spinlock); 1692 1692 config->res_idx = val; 1693 - spin_unlock(&drvdata->spinlock); 1693 + raw_spin_unlock(&drvdata->spinlock); 1694 1694 return size; 1695 1695 } 1696 1696 static DEVICE_ATTR_RW(res_idx); ··· 1704 1704 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1705 1705 struct etmv4_config *config = &drvdata->config; 1706 1706 1707 - spin_lock(&drvdata->spinlock); 1707 + raw_spin_lock(&drvdata->spinlock); 1708 1708 idx = config->res_idx; 1709 1709 val = config->res_ctrl[idx]; 1710 - spin_unlock(&drvdata->spinlock); 1710 + raw_spin_unlock(&drvdata->spinlock); 1711 1711 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1712 1712 } 1713 1713 ··· 1723 1723 if (kstrtoul(buf, 16, &val)) 1724 1724 return -EINVAL; 1725 1725 1726 - spin_lock(&drvdata->spinlock); 1726 + raw_spin_lock(&drvdata->spinlock); 1727 1727 idx = config->res_idx; 1728 1728 /* For odd idx pair inversal bit is RES0 */ 1729 1729 if (idx % 2 != 0) ··· 1733 1733 TRCRSCTLRn_INV | 1734 1734 TRCRSCTLRn_GROUP_MASK | 1735 1735 TRCRSCTLRn_SELECT_MASK); 1736 - spin_unlock(&drvdata->spinlock); 1736 + raw_spin_unlock(&drvdata->spinlock); 1737 1737 return size; 1738 1738 } 1739 1739 static DEVICE_ATTR_RW(res_ctrl); ··· 1762 1762 if (val >= drvdata->nr_ss_cmp) 1763 1763 return -EINVAL; 1764 1764 1765 - spin_lock(&drvdata->spinlock); 1765 + raw_spin_lock(&drvdata->spinlock); 1766 1766 config->ss_idx = val; 1767 - spin_unlock(&drvdata->spinlock); 1767 + raw_spin_unlock(&drvdata->spinlock); 1768 1768 return size; 1769 1769 } 1770 1770 static DEVICE_ATTR_RW(sshot_idx); ··· 1777 1777 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1778 1778 struct etmv4_config *config = &drvdata->config; 1779 1779 1780 - spin_lock(&drvdata->spinlock); 1780 + raw_spin_lock(&drvdata->spinlock); 1781 1781 val = config->ss_ctrl[config->ss_idx]; 1782 - spin_unlock(&drvdata->spinlock); 1782 + raw_spin_unlock(&drvdata->spinlock); 1783 1783 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1784 1784 } 1785 1785 ··· 1795 1795 if (kstrtoul(buf, 16, &val)) 1796 1796 return -EINVAL; 1797 1797 1798 - spin_lock(&drvdata->spinlock); 1798 + raw_spin_lock(&drvdata->spinlock); 1799 1799 idx = config->ss_idx; 1800 1800 config->ss_ctrl[idx] = FIELD_PREP(TRCSSCCRn_SAC_ARC_RST_MASK, val); 1801 1801 /* must clear bit 31 in related status register on programming */ 1802 1802 config->ss_status[idx] &= ~TRCSSCSRn_STATUS; 1803 - spin_unlock(&drvdata->spinlock); 1803 + raw_spin_unlock(&drvdata->spinlock); 1804 1804 return size; 1805 1805 } 1806 1806 static DEVICE_ATTR_RW(sshot_ctrl); ··· 1812 1812 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1813 1813 struct etmv4_config *config = &drvdata->config; 1814 1814 1815 - spin_lock(&drvdata->spinlock); 1815 + raw_spin_lock(&drvdata->spinlock); 1816 1816 val = config->ss_status[config->ss_idx]; 1817 - spin_unlock(&drvdata->spinlock); 1817 + raw_spin_unlock(&drvdata->spinlock); 1818 1818 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1819 1819 } 1820 1820 static DEVICE_ATTR_RO(sshot_status); ··· 1827 1827 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); 1828 1828 struct etmv4_config *config = &drvdata->config; 1829 1829 1830 - spin_lock(&drvdata->spinlock); 1830 + raw_spin_lock(&drvdata->spinlock); 1831 1831 val = config->ss_pe_cmp[config->ss_idx]; 1832 - spin_unlock(&drvdata->spinlock); 1832 + raw_spin_unlock(&drvdata->spinlock); 1833 1833 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1834 1834 } 1835 1835 ··· 1845 1845 if (kstrtoul(buf, 16, &val)) 1846 1846 return -EINVAL; 1847 1847 1848 - spin_lock(&drvdata->spinlock); 1848 + raw_spin_lock(&drvdata->spinlock); 1849 1849 idx = config->ss_idx; 1850 1850 config->ss_pe_cmp[idx] = FIELD_PREP(TRCSSPCICRn_PC_MASK, val); 1851 1851 /* must clear bit 31 in related status register on programming */ 1852 1852 config->ss_status[idx] &= ~TRCSSCSRn_STATUS; 1853 - spin_unlock(&drvdata->spinlock); 1853 + raw_spin_unlock(&drvdata->spinlock); 1854 1854 return size; 1855 1855 } 1856 1856 static DEVICE_ATTR_RW(sshot_pe_ctrl); ··· 1884 1884 * Use spinlock to ensure index doesn't change while it gets 1885 1885 * dereferenced multiple times within a spinlock block elsewhere. 1886 1886 */ 1887 - spin_lock(&drvdata->spinlock); 1887 + raw_spin_lock(&drvdata->spinlock); 1888 1888 config->ctxid_idx = val; 1889 - spin_unlock(&drvdata->spinlock); 1889 + raw_spin_unlock(&drvdata->spinlock); 1890 1890 return size; 1891 1891 } 1892 1892 static DEVICE_ATTR_RW(ctxid_idx); ··· 1907 1907 if (task_active_pid_ns(current) != &init_pid_ns) 1908 1908 return -EINVAL; 1909 1909 1910 - spin_lock(&drvdata->spinlock); 1910 + raw_spin_lock(&drvdata->spinlock); 1911 1911 idx = config->ctxid_idx; 1912 1912 val = (unsigned long)config->ctxid_pid[idx]; 1913 - spin_unlock(&drvdata->spinlock); 1913 + raw_spin_unlock(&drvdata->spinlock); 1914 1914 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 1915 1915 } 1916 1916 ··· 1945 1945 if (kstrtoul(buf, 16, &pid)) 1946 1946 return -EINVAL; 1947 1947 1948 - spin_lock(&drvdata->spinlock); 1948 + raw_spin_lock(&drvdata->spinlock); 1949 1949 idx = config->ctxid_idx; 1950 1950 config->ctxid_pid[idx] = (u64)pid; 1951 - spin_unlock(&drvdata->spinlock); 1951 + raw_spin_unlock(&drvdata->spinlock); 1952 1952 return size; 1953 1953 } 1954 1954 static DEVICE_ATTR_RW(ctxid_pid); ··· 1968 1968 if (task_active_pid_ns(current) != &init_pid_ns) 1969 1969 return -EINVAL; 1970 1970 1971 - spin_lock(&drvdata->spinlock); 1971 + raw_spin_lock(&drvdata->spinlock); 1972 1972 val1 = config->ctxid_mask0; 1973 1973 val2 = config->ctxid_mask1; 1974 - spin_unlock(&drvdata->spinlock); 1974 + raw_spin_unlock(&drvdata->spinlock); 1975 1975 return scnprintf(buf, PAGE_SIZE, "%#lx %#lx\n", val1, val2); 1976 1976 } 1977 1977 ··· 2004 2004 if ((drvdata->numcidc > 4) && (nr_inputs != 2)) 2005 2005 return -EINVAL; 2006 2006 2007 - spin_lock(&drvdata->spinlock); 2007 + raw_spin_lock(&drvdata->spinlock); 2008 2008 /* 2009 2009 * each byte[0..3] controls mask value applied to ctxid 2010 2010 * comparator[0..3] ··· 2076 2076 mask >>= 0x8; 2077 2077 } 2078 2078 2079 - spin_unlock(&drvdata->spinlock); 2079 + raw_spin_unlock(&drvdata->spinlock); 2080 2080 return size; 2081 2081 } 2082 2082 static DEVICE_ATTR_RW(ctxid_masks); ··· 2110 2110 * Use spinlock to ensure index doesn't change while it gets 2111 2111 * dereferenced multiple times within a spinlock block elsewhere. 2112 2112 */ 2113 - spin_lock(&drvdata->spinlock); 2113 + raw_spin_lock(&drvdata->spinlock); 2114 2114 config->vmid_idx = val; 2115 - spin_unlock(&drvdata->spinlock); 2115 + raw_spin_unlock(&drvdata->spinlock); 2116 2116 return size; 2117 2117 } 2118 2118 static DEVICE_ATTR_RW(vmid_idx); ··· 2132 2132 if (!task_is_in_init_pid_ns(current)) 2133 2133 return -EINVAL; 2134 2134 2135 - spin_lock(&drvdata->spinlock); 2135 + raw_spin_lock(&drvdata->spinlock); 2136 2136 val = (unsigned long)config->vmid_val[config->vmid_idx]; 2137 - spin_unlock(&drvdata->spinlock); 2137 + raw_spin_unlock(&drvdata->spinlock); 2138 2138 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); 2139 2139 } 2140 2140 ··· 2162 2162 if (kstrtoul(buf, 16, &val)) 2163 2163 return -EINVAL; 2164 2164 2165 - spin_lock(&drvdata->spinlock); 2165 + raw_spin_lock(&drvdata->spinlock); 2166 2166 config->vmid_val[config->vmid_idx] = (u64)val; 2167 - spin_unlock(&drvdata->spinlock); 2167 + raw_spin_unlock(&drvdata->spinlock); 2168 2168 return size; 2169 2169 } 2170 2170 static DEVICE_ATTR_RW(vmid_val); ··· 2183 2183 if (!task_is_in_init_pid_ns(current)) 2184 2184 return -EINVAL; 2185 2185 2186 - spin_lock(&drvdata->spinlock); 2186 + raw_spin_lock(&drvdata->spinlock); 2187 2187 val1 = config->vmid_mask0; 2188 2188 val2 = config->vmid_mask1; 2189 - spin_unlock(&drvdata->spinlock); 2189 + raw_spin_unlock(&drvdata->spinlock); 2190 2190 return scnprintf(buf, PAGE_SIZE, "%#lx %#lx\n", val1, val2); 2191 2191 } 2192 2192 ··· 2218 2218 if ((drvdata->numvmidc > 4) && (nr_inputs != 2)) 2219 2219 return -EINVAL; 2220 2220 2221 - spin_lock(&drvdata->spinlock); 2221 + raw_spin_lock(&drvdata->spinlock); 2222 2222 2223 2223 /* 2224 2224 * each byte[0..3] controls mask value applied to vmid ··· 2291 2291 else 2292 2292 mask >>= 0x8; 2293 2293 } 2294 - spin_unlock(&drvdata->spinlock); 2294 + raw_spin_unlock(&drvdata->spinlock); 2295 2295 return size; 2296 2296 } 2297 2297 static DEVICE_ATTR_RW(vmid_masks);
+1 -1
drivers/hwtracing/coresight/coresight-etm4x.h
··· 989 989 struct clk *pclk; 990 990 void __iomem *base; 991 991 struct coresight_device *csdev; 992 - spinlock_t spinlock; 992 + raw_spinlock_t spinlock; 993 993 int cpu; 994 994 u8 arch; 995 995 u8 nr_pe;