Lines Matching refs:hfi_instance

118 struct hfi_instance {  struct
156 struct hfi_instance *hfi_instance; member
163 static struct hfi_instance *hfi_instances;
172 static void get_hfi_caps(struct hfi_instance *hfi_instance, in get_hfi_caps() argument
177 raw_spin_lock_irq(&hfi_instance->table_lock); in get_hfi_caps()
178 for_each_cpu(cpu, hfi_instance->cpus) { in get_hfi_caps()
183 caps = hfi_instance->data + index * hfi_features.cpu_stride; in get_hfi_caps()
195 raw_spin_unlock_irq(&hfi_instance->table_lock); in get_hfi_caps()
201 static void update_capabilities(struct hfi_instance *hfi_instance) in update_capabilities() argument
209 cpu_count = cpumask_weight(hfi_instance->cpus); in update_capabilities()
219 get_hfi_caps(hfi_instance, cpu_caps); in update_capabilities()
245 struct hfi_instance *hfi_instance; in hfi_update_work_fn() local
247 hfi_instance = container_of(to_delayed_work(work), struct hfi_instance, in hfi_update_work_fn()
250 update_capabilities(hfi_instance); in hfi_update_work_fn()
255 struct hfi_instance *hfi_instance; in intel_hfi_process_event() local
272 hfi_instance = info->hfi_instance; in intel_hfi_process_event()
273 if (unlikely(!hfi_instance)) { in intel_hfi_process_event()
284 if (!raw_spin_trylock(&hfi_instance->event_lock)) in intel_hfi_process_event()
290 raw_spin_unlock(&hfi_instance->event_lock); in intel_hfi_process_event()
299 new_timestamp = *(u64 *)hfi_instance->hw_table; in intel_hfi_process_event()
300 if (*hfi_instance->timestamp == new_timestamp) { in intel_hfi_process_event()
302 raw_spin_unlock(&hfi_instance->event_lock); in intel_hfi_process_event()
306 raw_spin_lock(&hfi_instance->table_lock); in intel_hfi_process_event()
312 memcpy(hfi_instance->local_table, hfi_instance->hw_table, in intel_hfi_process_event()
321 raw_spin_unlock(&hfi_instance->table_lock); in intel_hfi_process_event()
322 raw_spin_unlock(&hfi_instance->event_lock); in intel_hfi_process_event()
324 queue_delayed_work(hfi_updates_wq, &hfi_instance->update_work, in intel_hfi_process_event()
344 static void init_hfi_instance(struct hfi_instance *hfi_instance) in init_hfi_instance() argument
347 hfi_instance->hdr = hfi_instance->local_table + in init_hfi_instance()
348 sizeof(*hfi_instance->timestamp); in init_hfi_instance()
351 hfi_instance->data = hfi_instance->hdr + hfi_features.hdr_size; in init_hfi_instance()
364 static void hfi_set_hw_table(struct hfi_instance *hfi_instance) in hfi_set_hw_table() argument
369 hw_table_pa = virt_to_phys(hfi_instance->hw_table); in hfi_set_hw_table()
415 struct hfi_instance *hfi_instance; in intel_hfi_online() local
429 hfi_instance = info->hfi_instance; in intel_hfi_online()
430 if (!hfi_instance) { in intel_hfi_online()
434 hfi_instance = &hfi_instances[pkg_id]; in intel_hfi_online()
435 info->hfi_instance = hfi_instance; in intel_hfi_online()
447 if (hfi_instance->hdr) in intel_hfi_online()
458 hfi_instance->hw_table = alloc_pages_exact(hfi_features.nr_table_pages, in intel_hfi_online()
460 if (!hfi_instance->hw_table) in intel_hfi_online()
467 hfi_instance->local_table = kzalloc(hfi_features.nr_table_pages << PAGE_SHIFT, in intel_hfi_online()
469 if (!hfi_instance->local_table) in intel_hfi_online()
472 init_hfi_instance(hfi_instance); in intel_hfi_online()
474 INIT_DELAYED_WORK(&hfi_instance->update_work, hfi_update_work_fn); in intel_hfi_online()
475 raw_spin_lock_init(&hfi_instance->table_lock); in intel_hfi_online()
476 raw_spin_lock_init(&hfi_instance->event_lock); in intel_hfi_online()
479 cpumask_set_cpu(cpu, hfi_instance->cpus); in intel_hfi_online()
485 if (cpumask_weight(hfi_instance->cpus) == 1 && hfi_clients_nr > 0) { in intel_hfi_online()
486 hfi_set_hw_table(hfi_instance); in intel_hfi_online()
495 free_pages_exact(hfi_instance->hw_table, hfi_features.nr_table_pages); in intel_hfi_online()
512 struct hfi_instance *hfi_instance; in intel_hfi_offline() local
519 hfi_instance = info->hfi_instance; in intel_hfi_offline()
520 if (!hfi_instance) in intel_hfi_offline()
523 if (!hfi_instance->hdr) in intel_hfi_offline()
527 cpumask_clear_cpu(cpu, hfi_instance->cpus); in intel_hfi_offline()
529 if (!cpumask_weight(hfi_instance->cpus)) in intel_hfi_offline()
599 struct hfi_instance *hfi_instance = info->hfi_instance; in hfi_syscore_resume() local
603 hfi_enable_instance(hfi_instance); in hfi_syscore_resume()
623 struct hfi_instance *hfi_instance; in hfi_thermal_notify() local
651 hfi_instance = &hfi_instances[i]; in hfi_thermal_notify()
652 if (cpumask_empty(hfi_instance->cpus)) in hfi_thermal_notify()
655 cpu = cpumask_any(hfi_instance->cpus); in hfi_thermal_notify()
656 smp_call_function_single(cpu, func, hfi_instance, true); in hfi_thermal_notify()
671 struct hfi_instance *hfi_instance; in intel_hfi_init() local
695 hfi_instance = &hfi_instances[i]; in intel_hfi_init()
696 if (!zalloc_cpumask_var(&hfi_instance->cpus, GFP_KERNEL)) in intel_hfi_init()
722 hfi_instance = &hfi_instances[j]; in intel_hfi_init()
723 free_cpumask_var(hfi_instance->cpus); in intel_hfi_init()