]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/arm_sdei.h
net: rtnetlink: validate IFLA_MTU attribute in rtnl_create_link()
[mirror_ubuntu-bionic-kernel.git] / include / linux / arm_sdei.h
CommitLineData
513f52be
JM
1// SPDX-License-Identifier: GPL-2.0
2// Copyright (C) 2017 Arm Ltd.
3#ifndef __LINUX_ARM_SDEI_H
4#define __LINUX_ARM_SDEI_H
5
6#include <uapi/linux/arm_sdei.h>
7
8enum sdei_conduit_types {
9 CONDUIT_INVALID = 0,
10 CONDUIT_SMC,
11 CONDUIT_HVC,
12};
13
14#include <asm/sdei.h>
15
16/* Arch code should override this to set the entry point from firmware... */
17#ifndef sdei_arch_get_entry_point
18#define sdei_arch_get_entry_point(conduit) (0)
19#endif
20
21/*
22 * When an event occurs sdei_event_handler() will call a user-provided callback
23 * like this in NMI context on the CPU that received the event.
24 */
25typedef int (sdei_event_callback)(u32 event, struct pt_regs *regs, void *arg);
26
27/*
28 * Register your callback to claim an event. The event must be described
29 * by firmware.
30 */
31int sdei_event_register(u32 event_num, sdei_event_callback *cb, void *arg);
32
33/*
34 * Calls to sdei_event_unregister() may return EINPROGRESS. Keep calling
35 * it until it succeeds.
36 */
37int sdei_event_unregister(u32 event_num);
38
39int sdei_event_enable(u32 event_num);
40int sdei_event_disable(u32 event_num);
41
42#ifdef CONFIG_ARM_SDE_INTERFACE
43/* For use by arch code when CPU hotplug notifiers are not appropriate. */
44int sdei_mask_local_cpu(void);
45int sdei_unmask_local_cpu(void);
46#else
47static inline int sdei_mask_local_cpu(void) { return 0; }
48static inline int sdei_unmask_local_cpu(void) { return 0; }
49#endif /* CONFIG_ARM_SDE_INTERFACE */
50
51
52/*
53 * This struct represents an event that has been registered. The driver
54 * maintains a list of all events, and which ones are registered. (Private
55 * events have one entry in the list, but are registered on each CPU).
56 * A pointer to this struct is passed to firmware, and back to the event
57 * handler. The event handler can then use this to invoke the registered
58 * callback, without having to walk the list.
59 *
60 * For CPU private events, this structure is per-cpu.
61 */
62struct sdei_registered_event {
63 /* For use by arch code: */
64 struct pt_regs interrupted_regs;
65
66 sdei_event_callback *callback;
67 void *callback_arg;
68 u32 event_num;
69 u8 priority;
70};
71
72/* The arch code entry point should then call this when an event arrives. */
73int notrace sdei_event_handler(struct pt_regs *regs,
74 struct sdei_registered_event *arg);
75
76/* arch code may use this to retrieve the extra registers. */
77int sdei_api_event_context(u32 query, u64 *result);
78
79#endif /* __LINUX_ARM_SDEI_H */