diff options
| -rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_uncore.c | 9 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_uncore.h | 18 |
2 files changed, 12 insertions, 15 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index 10b8d3eaaf15..c635b8b49e93 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
| @@ -840,7 +840,6 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id | |||
| 840 | box->phys_id = phys_id; | 840 | box->phys_id = phys_id; |
| 841 | box->pci_dev = pdev; | 841 | box->pci_dev = pdev; |
| 842 | box->pmu = pmu; | 842 | box->pmu = pmu; |
| 843 | uncore_box_init(box); | ||
| 844 | pci_set_drvdata(pdev, box); | 843 | pci_set_drvdata(pdev, box); |
| 845 | 844 | ||
| 846 | raw_spin_lock(&uncore_box_lock); | 845 | raw_spin_lock(&uncore_box_lock); |
| @@ -1004,10 +1003,8 @@ static int uncore_cpu_starting(int cpu) | |||
| 1004 | pmu = &type->pmus[j]; | 1003 | pmu = &type->pmus[j]; |
| 1005 | box = *per_cpu_ptr(pmu->box, cpu); | 1004 | box = *per_cpu_ptr(pmu->box, cpu); |
| 1006 | /* called by uncore_cpu_init? */ | 1005 | /* called by uncore_cpu_init? */ |
| 1007 | if (box && box->phys_id >= 0) { | 1006 | if (box && box->phys_id >= 0) |
| 1008 | uncore_box_init(box); | ||
| 1009 | continue; | 1007 | continue; |
| 1010 | } | ||
| 1011 | 1008 | ||
| 1012 | for_each_online_cpu(k) { | 1009 | for_each_online_cpu(k) { |
| 1013 | exist = *per_cpu_ptr(pmu->box, k); | 1010 | exist = *per_cpu_ptr(pmu->box, k); |
| @@ -1023,10 +1020,8 @@ static int uncore_cpu_starting(int cpu) | |||
| 1023 | } | 1020 | } |
| 1024 | } | 1021 | } |
| 1025 | 1022 | ||
| 1026 | if (box) { | 1023 | if (box) |
| 1027 | box->phys_id = phys_id; | 1024 | box->phys_id = phys_id; |
| 1028 | uncore_box_init(box); | ||
| 1029 | } | ||
| 1030 | } | 1025 | } |
| 1031 | } | 1026 | } |
| 1032 | return 0; | 1027 | return 0; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h index 863d9b02563e..6c8c1e7e69d8 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h | |||
| @@ -257,6 +257,14 @@ static inline int uncore_num_counters(struct intel_uncore_box *box) | |||
| 257 | return box->pmu->type->num_counters; | 257 | return box->pmu->type->num_counters; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | static inline void uncore_box_init(struct intel_uncore_box *box) | ||
| 261 | { | ||
| 262 | if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { | ||
| 263 | if (box->pmu->type->ops->init_box) | ||
| 264 | box->pmu->type->ops->init_box(box); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 260 | static inline void uncore_disable_box(struct intel_uncore_box *box) | 268 | static inline void uncore_disable_box(struct intel_uncore_box *box) |
| 261 | { | 269 | { |
| 262 | if (box->pmu->type->ops->disable_box) | 270 | if (box->pmu->type->ops->disable_box) |
| @@ -265,6 +273,8 @@ static inline void uncore_disable_box(struct intel_uncore_box *box) | |||
| 265 | 273 | ||
| 266 | static inline void uncore_enable_box(struct intel_uncore_box *box) | 274 | static inline void uncore_enable_box(struct intel_uncore_box *box) |
| 267 | { | 275 | { |
| 276 | uncore_box_init(box); | ||
| 277 | |||
| 268 | if (box->pmu->type->ops->enable_box) | 278 | if (box->pmu->type->ops->enable_box) |
| 269 | box->pmu->type->ops->enable_box(box); | 279 | box->pmu->type->ops->enable_box(box); |
| 270 | } | 280 | } |
| @@ -287,14 +297,6 @@ static inline u64 uncore_read_counter(struct intel_uncore_box *box, | |||
| 287 | return box->pmu->type->ops->read_counter(box, event); | 297 | return box->pmu->type->ops->read_counter(box, event); |
| 288 | } | 298 | } |
| 289 | 299 | ||
| 290 | static inline void uncore_box_init(struct intel_uncore_box *box) | ||
| 291 | { | ||
| 292 | if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { | ||
| 293 | if (box->pmu->type->ops->init_box) | ||
| 294 | box->pmu->type->ops->init_box(box); | ||
| 295 | } | ||
| 296 | } | ||
| 297 | |||
| 298 | static inline bool uncore_box_is_fake(struct intel_uncore_box *box) | 300 | static inline bool uncore_box_is_fake(struct intel_uncore_box *box) |
| 299 | { | 301 | { |
| 300 | return (box->phys_id < 0); | 302 | return (box->phys_id < 0); |
