Lines Matching +full:event +full:-

1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/arm-smccc.h>
58 /* This pointer is handed to firmware as the event argument. */
77 struct sdei_event *event; member
82 #define CROSSCALL_INIT(arg, event) \ argument
84 arg.event = event; \
90 struct sdei_event *event) in sdei_do_local_call() argument
94 CROSSCALL_INIT(arg, event); in sdei_do_local_call()
101 struct sdei_event *event) in sdei_do_cross_call() argument
105 CROSSCALL_INIT(arg, event); in sdei_do_cross_call()
114 if (err && (atomic_inc_return(&arg->errors) == 1)) in sdei_cross_call_return()
115 arg->first_error = err; in sdei_cross_call_return()
122 return -EOPNOTSUPP; in sdei_to_linux_errno()
124 return -EINVAL; in sdei_to_linux_errno()
126 return -EPERM; in sdei_to_linux_errno()
128 return -EINPROGRESS; in sdei_to_linux_errno()
130 return -ENOMEM; in sdei_to_linux_errno()
151 * sdei_mark_interface_broken(). -EIO is not an error returned in invoke_sdei_fn()
155 err = -EIO; in invoke_sdei_fn()
174 if (e->event_num == event_num) { in sdei_event_find()
191 static int sdei_api_event_get_info(u32 event, u32 info, u64 *result) in sdei_api_event_get_info() argument
193 return invoke_sdei_fn(SDEI_1_0_FN_SDEI_EVENT_GET_INFO, event, info, 0, in sdei_api_event_get_info()
203 struct sdei_event *event; in sdei_event_create() local
208 event = kzalloc(sizeof(*event), GFP_KERNEL); in sdei_event_create()
209 if (!event) { in sdei_event_create()
210 err = -ENOMEM; in sdei_event_create()
214 INIT_LIST_HEAD(&event->list); in sdei_event_create()
215 event->event_num = event_num; in sdei_event_create()
221 event->priority = result; in sdei_event_create()
227 event->type = result; in sdei_event_create()
229 if (event->type == SDEI_EVENT_TYPE_SHARED) { in sdei_event_create()
232 err = -ENOMEM; in sdei_event_create()
236 reg->event_num = event->event_num; in sdei_event_create()
237 reg->priority = event->priority; in sdei_event_create()
239 reg->callback = cb; in sdei_event_create()
240 reg->callback_arg = cb_arg; in sdei_event_create()
241 event->registered = reg; in sdei_event_create()
248 err = -ENOMEM; in sdei_event_create()
255 reg->event_num = event->event_num; in sdei_event_create()
256 reg->priority = event->priority; in sdei_event_create()
257 reg->callback = cb; in sdei_event_create()
258 reg->callback_arg = cb_arg; in sdei_event_create()
261 event->private_registered = regs; in sdei_event_create()
265 list_add(&event->list, &sdei_list); in sdei_event_create()
268 return event; in sdei_event_create()
271 kfree(event); in sdei_event_create()
275 static void sdei_event_destroy_llocked(struct sdei_event *event) in sdei_event_destroy_llocked() argument
280 list_del(&event->list); in sdei_event_destroy_llocked()
282 if (event->type == SDEI_EVENT_TYPE_SHARED) in sdei_event_destroy_llocked()
283 kfree(event->registered); in sdei_event_destroy_llocked()
285 free_percpu(event->private_registered); in sdei_event_destroy_llocked()
287 kfree(event); in sdei_event_destroy_llocked()
290 static void sdei_event_destroy(struct sdei_event *event) in sdei_event_destroy() argument
293 sdei_event_destroy_llocked(event); in sdei_event_destroy()
307 if (err && err != -EIO) { in sdei_mask_local_cpu()
327 if (err && err != -EIO) { in sdei_unmask_local_cpu()
350 if (err && err != -EIO) in _ipi_private_reset()
394 err = sdei_api_event_enable(arg->event->event_num); in _local_event_enable()
401 int err = -EINVAL; in sdei_event_enable()
402 struct sdei_event *event; in sdei_event_enable() local
405 event = sdei_event_find(event_num); in sdei_event_enable()
406 if (!event) { in sdei_event_enable()
408 return -ENOENT; in sdei_event_enable()
413 if (event->type == SDEI_EVENT_TYPE_SHARED) in sdei_event_enable()
414 err = sdei_api_event_enable(event->event_num); in sdei_event_enable()
416 err = sdei_do_cross_call(_local_event_enable, event); in sdei_event_enable()
420 event->reenable = true; in sdei_event_enable()
440 err = sdei_api_event_disable(arg->event->event_num); in _ipi_event_disable()
447 int err = -EINVAL; in sdei_event_disable()
448 struct sdei_event *event; in sdei_event_disable() local
451 event = sdei_event_find(event_num); in sdei_event_disable()
452 if (!event) { in sdei_event_disable()
454 return -ENOENT; in sdei_event_disable()
458 event->reenable = false; in sdei_event_disable()
461 if (event->type == SDEI_EVENT_TYPE_SHARED) in sdei_event_disable()
462 err = sdei_api_event_disable(event->event_num); in sdei_event_disable()
464 err = sdei_do_cross_call(_ipi_event_disable, event); in sdei_event_disable()
482 err = sdei_api_event_unregister(arg->event->event_num); in _local_event_unregister()
490 struct sdei_event *event; in sdei_event_unregister() local
495 event = sdei_event_find(event_num); in sdei_event_unregister()
496 if (!event) { in sdei_event_unregister()
497 pr_warn("Event %u not registered\n", event_num); in sdei_event_unregister()
498 err = -ENOENT; in sdei_event_unregister()
503 event->reregister = false; in sdei_event_unregister()
504 event->reenable = false; in sdei_event_unregister()
507 if (event->type == SDEI_EVENT_TYPE_SHARED) in sdei_event_unregister()
508 err = sdei_api_event_unregister(event->event_num); in sdei_event_unregister()
510 err = sdei_do_cross_call(_local_event_unregister, event); in sdei_event_unregister()
515 sdei_event_destroy(event); in sdei_event_unregister()
523 * unregister events, but don't destroy them as they are re-registered by
529 struct sdei_event *event; in sdei_unregister_shared() local
533 list_for_each_entry(event, &sdei_list, list) { in sdei_unregister_shared()
534 if (event->type != SDEI_EVENT_TYPE_SHARED) in sdei_unregister_shared()
537 err = sdei_api_event_unregister(event->event_num); in sdei_unregister_shared()
562 reg = per_cpu_ptr(arg->event->private_registered, smp_processor_id()); in _local_event_register()
563 err = sdei_api_event_register(arg->event->event_num, sdei_entry_point, in _local_event_register()
572 struct sdei_event *event; in sdei_event_register() local
578 pr_warn("Event %u already registered\n", event_num); in sdei_event_register()
579 err = -EBUSY; in sdei_event_register()
583 event = sdei_event_create(event_num, cb, arg); in sdei_event_register()
584 if (IS_ERR(event)) { in sdei_event_register()
585 err = PTR_ERR(event); in sdei_event_register()
586 pr_warn("Failed to create event %u: %d\n", event_num, err); in sdei_event_register()
591 if (event->type == SDEI_EVENT_TYPE_SHARED) { in sdei_event_register()
592 err = sdei_api_event_register(event->event_num, in sdei_event_register()
594 event->registered, in sdei_event_register()
597 err = sdei_do_cross_call(_local_event_register, event); in sdei_event_register()
599 sdei_do_cross_call(_local_event_unregister, event); in sdei_event_register()
603 sdei_event_destroy(event); in sdei_event_register()
604 pr_warn("Failed to register event %u: %d\n", event_num, err); in sdei_event_register()
609 event->reregister = true; in sdei_event_register()
621 struct sdei_event *event; in sdei_reregister_shared() local
625 list_for_each_entry(event, &sdei_list, list) { in sdei_reregister_shared()
626 if (event->type != SDEI_EVENT_TYPE_SHARED) in sdei_reregister_shared()
629 if (event->reregister) { in sdei_reregister_shared()
630 err = sdei_api_event_register(event->event_num, in sdei_reregister_shared()
631 sdei_entry_point, event->registered, in sdei_reregister_shared()
634 pr_err("Failed to re-register event %u\n", in sdei_reregister_shared()
635 event->event_num); in sdei_reregister_shared()
636 sdei_event_destroy_llocked(event); in sdei_reregister_shared()
641 if (event->reenable) { in sdei_reregister_shared()
642 err = sdei_api_event_enable(event->event_num); in sdei_reregister_shared()
644 pr_err("Failed to re-enable event %u\n", in sdei_reregister_shared()
645 event->event_num); in sdei_reregister_shared()
658 struct sdei_event *event; in sdei_cpuhp_down() local
661 /* un-register private events */ in sdei_cpuhp_down()
663 list_for_each_entry(event, &sdei_list, list) { in sdei_cpuhp_down()
664 if (event->type == SDEI_EVENT_TYPE_SHARED) in sdei_cpuhp_down()
667 err = sdei_do_local_call(_local_event_unregister, event); in sdei_cpuhp_down()
669 pr_err("Failed to unregister event %u: %d\n", in sdei_cpuhp_down()
670 event->event_num, err); in sdei_cpuhp_down()
680 struct sdei_event *event; in sdei_cpuhp_up() local
683 /* re-register/enable private events */ in sdei_cpuhp_up()
685 list_for_each_entry(event, &sdei_list, list) { in sdei_cpuhp_up()
686 if (event->type == SDEI_EVENT_TYPE_SHARED) in sdei_cpuhp_up()
689 if (event->reregister) { in sdei_cpuhp_up()
690 err = sdei_do_local_call(_local_event_register, event); in sdei_cpuhp_up()
692 pr_err("Failed to re-register event %u: %d\n", in sdei_cpuhp_up()
693 event->event_num, err); in sdei_cpuhp_up()
697 if (event->reenable) { in sdei_cpuhp_up()
698 err = sdei_do_local_call(_local_event_enable, event); in sdei_cpuhp_up()
700 pr_err("Failed to re-enable event %u: %d\n", in sdei_cpuhp_up()
701 event->event_num, err); in sdei_cpuhp_up()
757 * The sequence is freeze->thaw. Reboot. freeze->restore. We unregister
758 * events during freeze, then re-register and re-enable them during thaw
779 /* re-register shared events */ in sdei_device_thaw()
782 pr_warn("Failed to re-register shared events...\n"); in sdei_device_thaw()
790 pr_warn("Failed to re-register CPU hotplug notifier...\n"); in sdei_device_thaw()
865 return -EOPNOTSUPP; in sdei_register_ghes()
867 event_num = ghes->generic->notify.vector; in sdei_register_ghes()
870 * Event 0 is reserved by the specification for in sdei_register_ghes()
873 return -EINVAL; in sdei_register_ghes()
897 u32 event_num = ghes->generic->notify.vector; in sdei_unregister_ghes()
902 return -EOPNOTSUPP; in sdei_unregister_ghes()
905 * The event may be running on another CPU. Disable it in sdei_unregister_ghes()
914 if (err != -EINPROGRESS) in sdei_unregister_ghes()
926 struct device_node *np = pdev->dev.of_node; in sdei_get_conduit()
981 return -EINVAL; in sdei_probe()
1030 { .compatible = "arm,sdei-1.0" },
1088 u32 event_num = arg->event_num; in sdei_event_handler()
1090 err = arg->callback(event_num, regs, arg->callback_arg); in sdei_event_handler()
1092 pr_err_ratelimited("event %u on CPU %u failed with error: %d\n", in sdei_event_handler()
1102 * If the crash happened in an SDEI event handler then we need to in sdei_handler_abort()
1107 pr_warn("still in SDEI critical event context, attempting to finish handler.\n"); in sdei_handler_abort()
1112 pr_warn("still in SDEI normal event context, attempting to finish handler.\n"); in sdei_handler_abort()