forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/xen/events/events_internal.h
....@@ -1,70 +1,11 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Xen Event Channels (internal header)
34 *
45 * Copyright (C) 2013 Citrix Systems R&D Ltd.
5
- *
6
- * This source code is licensed under the GNU General Public License,
7
- * Version 2 or later. See the file COPYING for more details.
86 */
97 #ifndef __EVENTS_INTERNAL_H__
108 #define __EVENTS_INTERNAL_H__
11
-
12
-/* Interrupt types. */
13
-enum xen_irq_type {
14
- IRQT_UNBOUND = 0,
15
- IRQT_PIRQ,
16
- IRQT_VIRQ,
17
- IRQT_IPI,
18
- IRQT_EVTCHN
19
-};
20
-
21
-/*
22
- * Packed IRQ information:
23
- * type - enum xen_irq_type
24
- * event channel - irq->event channel mapping
25
- * cpu - cpu this event channel is bound to
26
- * index - type-specific information:
27
- * PIRQ - vector, with MSB being "needs EIO", or physical IRQ of the HVM
28
- * guest, or GSI (real passthrough IRQ) of the device.
29
- * VIRQ - virq number
30
- * IPI - IPI vector
31
- * EVTCHN -
32
- */
33
-struct irq_info {
34
- struct list_head list;
35
- struct list_head eoi_list;
36
- short refcnt;
37
- short spurious_cnt;
38
- short type; /* type */
39
- u8 mask_reason; /* Why is event channel masked */
40
-#define EVT_MASK_REASON_EXPLICIT 0x01
41
-#define EVT_MASK_REASON_TEMPORARY 0x02
42
-#define EVT_MASK_REASON_EOI_PENDING 0x04
43
- u8 is_active; /* Is event just being handled? */
44
- unsigned irq;
45
- unsigned int evtchn; /* event channel */
46
- unsigned short cpu; /* cpu bound */
47
- unsigned short eoi_cpu; /* EOI must happen on this cpu */
48
- unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
49
- u64 eoi_time; /* Time in jiffies when to EOI. */
50
- raw_spinlock_t lock;
51
-
52
- union {
53
- unsigned short virq;
54
- enum ipi_vector ipi;
55
- struct {
56
- unsigned short pirq;
57
- unsigned short gsi;
58
- unsigned char vector;
59
- unsigned char flags;
60
- uint16_t domid;
61
- } pirq;
62
- } u;
63
-};
64
-
65
-#define PIRQ_NEEDS_EOI (1 << 0)
66
-#define PIRQ_SHAREABLE (1 << 1)
67
-#define PIRQ_MSI_GROUP (1 << 2)
689
6910 struct evtchn_loop_ctrl;
7011
....@@ -72,15 +13,16 @@
7213 unsigned (*max_channels)(void);
7314 unsigned (*nr_channels)(void);
7415
75
- int (*setup)(struct irq_info *info);
16
+ int (*setup)(evtchn_port_t port);
7617 void (*remove)(evtchn_port_t port, unsigned int cpu);
77
- void (*bind_to_cpu)(struct irq_info *info, unsigned cpu);
18
+ void (*bind_to_cpu)(evtchn_port_t evtchn, unsigned int cpu,
19
+ unsigned int old_cpu);
7820
79
- void (*clear_pending)(unsigned port);
80
- void (*set_pending)(unsigned port);
81
- bool (*is_pending)(unsigned port);
82
- void (*mask)(unsigned port);
83
- void (*unmask)(unsigned port);
21
+ void (*clear_pending)(evtchn_port_t port);
22
+ void (*set_pending)(evtchn_port_t port);
23
+ bool (*is_pending)(evtchn_port_t port);
24
+ void (*mask)(evtchn_port_t port);
25
+ void (*unmask)(evtchn_port_t port);
8426
8527 void (*handle_events)(unsigned cpu, struct evtchn_loop_ctrl *ctrl);
8628 void (*resume)(void);
....@@ -91,13 +33,10 @@
9133
9234 extern const struct evtchn_ops *evtchn_ops;
9335
94
-extern int **evtchn_to_irq;
95
-int get_evtchn_to_irq(unsigned int evtchn);
36
+int get_evtchn_to_irq(evtchn_port_t evtchn);
9637 void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl);
9738
98
-struct irq_info *info_for_irq(unsigned irq);
99
-unsigned cpu_from_irq(unsigned irq);
100
-unsigned cpu_from_evtchn(unsigned int evtchn);
39
+unsigned int cpu_from_evtchn(evtchn_port_t evtchn);
10140
10241 static inline unsigned xen_evtchn_max_channels(void)
10342 {
....@@ -108,10 +47,10 @@
10847 * Do any ABI specific setup for a bound event channel before it can
10948 * be unmasked and used.
11049 */
111
-static inline int xen_evtchn_port_setup(struct irq_info *info)
50
+static inline int xen_evtchn_port_setup(evtchn_port_t evtchn)
11251 {
11352 if (evtchn_ops->setup)
114
- return evtchn_ops->setup(info);
53
+ return evtchn_ops->setup(evtchn);
11554 return 0;
11655 }
11756
....@@ -122,33 +61,34 @@
12261 evtchn_ops->remove(evtchn, cpu);
12362 }
12463
125
-static inline void xen_evtchn_port_bind_to_cpu(struct irq_info *info,
126
- unsigned cpu)
64
+static inline void xen_evtchn_port_bind_to_cpu(evtchn_port_t evtchn,
65
+ unsigned int cpu,
66
+ unsigned int old_cpu)
12767 {
128
- evtchn_ops->bind_to_cpu(info, cpu);
68
+ evtchn_ops->bind_to_cpu(evtchn, cpu, old_cpu);
12969 }
13070
131
-static inline void clear_evtchn(unsigned port)
71
+static inline void clear_evtchn(evtchn_port_t port)
13272 {
13373 evtchn_ops->clear_pending(port);
13474 }
13575
136
-static inline void set_evtchn(unsigned port)
76
+static inline void set_evtchn(evtchn_port_t port)
13777 {
13878 evtchn_ops->set_pending(port);
13979 }
14080
141
-static inline bool test_evtchn(unsigned port)
81
+static inline bool test_evtchn(evtchn_port_t port)
14282 {
14383 return evtchn_ops->is_pending(port);
14484 }
14585
146
-static inline void mask_evtchn(unsigned port)
86
+static inline void mask_evtchn(evtchn_port_t port)
14787 {
14888 return evtchn_ops->mask(port);
14989 }
15090
151
-static inline void unmask_evtchn(unsigned port)
91
+static inline void unmask_evtchn(evtchn_port_t port)
15292 {
15393 return evtchn_ops->unmask(port);
15494 }