2018-03-07 20:57:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
|
|
*
|
2018-05-26 01:49:13 +08:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2018-03-07 20:57:14 +08:00
|
|
|
*/
|
|
|
|
|
2018-09-29 15:46:27 +08:00
|
|
|
#ifndef SCHEDULE_H
|
|
|
|
#define SCHEDULE_H
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-06-30 00:17:34 +08:00
|
|
|
#define NEED_RESCHEDULE (1U)
|
|
|
|
#define NEED_OFFLINE (2U)
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-06-05 15:25:07 +08:00
|
|
|
struct sched_context {
|
|
|
|
spinlock_t runqueue_lock;
|
|
|
|
struct list_head runqueue;
|
2018-06-29 14:29:34 +08:00
|
|
|
uint64_t flags;
|
2018-11-05 13:25:25 +08:00
|
|
|
struct acrn_vcpu *curr_vcpu;
|
2018-06-05 15:25:07 +08:00
|
|
|
spinlock_t scheduler_lock;
|
|
|
|
};
|
|
|
|
|
2018-03-07 20:57:14 +08:00
|
|
|
void init_scheduler(void);
|
2018-06-20 15:42:52 +08:00
|
|
|
void get_schedule_lock(uint16_t pcpu_id);
|
|
|
|
void release_schedule_lock(uint16_t pcpu_id);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-06-20 15:42:52 +08:00
|
|
|
void set_pcpu_used(uint16_t pcpu_id);
|
2018-06-25 17:51:00 +08:00
|
|
|
uint16_t allocate_pcpu(void);
|
2018-06-20 15:42:52 +08:00
|
|
|
void free_pcpu(uint16_t pcpu_id);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-11-05 13:25:25 +08:00
|
|
|
void add_vcpu_to_runqueue(struct acrn_vcpu *vcpu);
|
|
|
|
void remove_vcpu_from_runqueue(struct acrn_vcpu *vcpu);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
void default_idle(void);
|
|
|
|
|
2018-11-05 13:25:25 +08:00
|
|
|
void make_reschedule_request(const struct acrn_vcpu *vcpu);
|
2018-12-08 00:30:49 +08:00
|
|
|
int32_t need_reschedule(uint16_t pcpu_id);
|
2018-06-20 15:42:52 +08:00
|
|
|
void make_pcpu_offline(uint16_t pcpu_id);
|
2018-12-08 00:30:49 +08:00
|
|
|
int32_t need_offline(uint16_t pcpu_id);
|
2018-06-02 22:31:58 +08:00
|
|
|
|
2018-03-07 20:57:14 +08:00
|
|
|
void schedule(void);
|
|
|
|
|
2018-11-05 13:25:25 +08:00
|
|
|
void vcpu_thread(struct acrn_vcpu *vcpu);
|
2018-09-29 15:46:27 +08:00
|
|
|
#endif /* SCHEDULE_H */
|
2018-03-07 20:57:14 +08:00
|
|
|
|