acrn-hypervisor/hypervisor/include/common/schedule.h
Xiangyang Wu cc50165018 HV:treewide:Cleanup the type for parameters of bitmap
operations

For reducing sign conversion in hypervisor:
Update parameters of bitmap operations as unsigned type;
Update the input of related caller as unsigned type when the
caller's input parameter is const variable or the variable is
only used by bitmap operations.

V1-->V2:
        (1) Explicit casting for the first parameter
            of all bitmap operations;
        (2) Remove mask operation for explicit casting
            of all bitmap operations, since masking is
            useless. Otherwise, this trucation is dangerous.
V2-->V3:
        (1) Explicit casting for all bitmap operations parameter;
        (2) Masking bit offset with 6-bit;
        (3) Add few comments about bit offset.
V3-->V4:
        add '\' for some statement of bitmap macro

Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-02 10:46:11 +08:00

44 lines
956 B
C

/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _HV_CORE_SCHEDULE_
#define _HV_CORE_SCHEDULE_
#define NEED_RESCHEDULE (1U)
#define NEED_OFFLINE (2U)
struct sched_context {
spinlock_t runqueue_lock;
struct list_head runqueue;
uint64_t flags;
struct vcpu *curr_vcpu;
spinlock_t scheduler_lock;
};
void init_scheduler(void);
void get_schedule_lock(uint16_t pcpu_id);
void release_schedule_lock(uint16_t pcpu_id);
void set_pcpu_used(uint16_t pcpu_id);
uint16_t allocate_pcpu(void);
void free_pcpu(uint16_t pcpu_id);
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);
int need_reschedule(uint16_t pcpu_id);
void make_pcpu_offline(uint16_t pcpu_id);
int need_offline(uint16_t pcpu_id);
void schedule(void);
void vcpu_thread(struct vcpu *vcpu);
#endif