File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ zephyr_sources(hvm.c)
55zephyr_sources(events.c)
66zephyr_sources_ifdef(CONFIG_XEN_GRANT_TABLE gnttab.c)
77zephyr_sources(memory.c)
8+ zephyr_sources_ifdef(CONFIG_XEN_SCHED sched.c)
89
910add_subdirectory_ifdef(CONFIG_XEN_DOM0 dom0)
Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ config NR_GRANT_FRAMES
2929 grant table driver in runtime. This value should be <= max_grant_frames
3030 configured for domain in Xen hypervisor.
3131
32+ config XEN_SCHED
33+ bool "Xen scheduler helpers"
34+ default y
35+ help
36+ Enable Xen scheduler helper functions
37+
3238endmenu
3339
3440endif # XEN
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 TOKITA Hiroshi
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ #include <zephyr/arch/arm64/hypercall.h>
8+ #include <zephyr/xen/sched.h>
9+
10+ int xen_sched_poll (evtchn_port_t * ports , unsigned int nr_ports , uint64_t timeout )
11+ {
12+ struct sched_poll poll = {
13+ .ports .p = ports ,
14+ .nr_ports = 1 ,
15+ .timeout = timeout ,
16+ };
17+
18+ return HYPERVISOR_sched_op (SCHEDOP_poll , & poll );
19+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 TOKITA Hiroshi
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ #ifndef ZEPHYR_XEN_SCHED_H_
8+ #define ZEPHYR_XEN_SCHED_H_
9+
10+ #include <zephyr/xen/public/sched.h>
11+
12+ /**
13+ * @brief Poll one or more Xen event channels for activity.
14+ *
15+ * Issues the SCHEDOP_poll hypercall to wait for events on the specified ports.
16+ *
17+ * @param ports Array of event channel ports to poll.
18+ * @param nr_ports Number of ports in the array.
19+ * @param timeout Timeout in microseconds to wait for an event.
20+ * @return 0 if an event occurred, -EAGAIN on timeout, or negative errno on error.
21+ */
22+ int xen_sched_poll (evtchn_port_t * ports , unsigned int nr_ports , uint64_t timeout );
23+
24+ #endif /* ZEPHYR_XEN_SCHED_H_ */
You can’t perform that action at this time.
0 commit comments