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
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _HV_CORE_SCHEDULE_
|
|
|
|
#define _HV_CORE_SCHEDULE_
|
|
|
|
|
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-06-05 15:25:07 +08:00
|
|
|
struct vcpu *curr_vcpu;
|
|
|
|
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
|
|
|
|
|
|
|
void add_vcpu_to_runqueue(struct vcpu *vcpu);
|
|
|
|
void remove_vcpu_from_runqueue(struct vcpu *vcpu);
|
|
|
|
|
|
|
|
void default_idle(void);
|
|
|
|
|
|
|
|
void make_reschedule_request(struct vcpu *vcpu);
|
2018-06-20 15:42:52 +08:00
|
|
|
int need_reschedule(uint16_t pcpu_id);
|
|
|
|
void make_pcpu_offline(uint16_t pcpu_id);
|
|
|
|
int 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);
|
|
|
|
|
|
|
|
void vcpu_thread(struct vcpu *vcpu);
|
|
|
|
#endif
|
|
|
|
|