mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-10 12:32:45 +00:00
HV:treewide:rename struct timer as struct hv_timer
The variable timer's name is identical with struct timer s name. This MISRA C violation is detected by static analysis tool. According to naming convention rule: If the data structure type is used by multi modules, its corresponding logic resource is only used by hypervisor/host and isn't exposed to external components (such as SOS, UOS), its name meaning is simplistic (such as timer), its name needs prefix "hv_". Rename struct timer as struct hv_timer. Replace regular expression:s/struct timer\([ ),;\t\*]\+\) /struct hv_timer\1 Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
cf7a94071b
commit
3446e84ea5
@ -280,7 +280,7 @@ static void vlapic_create_timer(struct acrn_vlapic *vlapic)
|
||||
|
||||
static void vlapic_reset_timer(struct acrn_vlapic *vlapic)
|
||||
{
|
||||
struct timer *timer;
|
||||
struct hv_timer *timer;
|
||||
|
||||
if (vlapic == NULL) {
|
||||
return;
|
||||
@ -299,7 +299,7 @@ set_expiration(struct acrn_vlapic *vlapic)
|
||||
uint64_t now = rdtsc();
|
||||
uint64_t delta;
|
||||
struct vlapic_timer *vtimer;
|
||||
struct timer *timer;
|
||||
struct hv_timer *timer;
|
||||
uint32_t tmicr, divisor_shift;
|
||||
|
||||
vtimer = &vlapic->vtimer;
|
||||
@ -328,7 +328,7 @@ static void vlapic_update_lvtt(struct acrn_vlapic *vlapic,
|
||||
struct vlapic_timer *vtimer = &vlapic->vtimer;
|
||||
|
||||
if (vtimer->mode != timer_mode) {
|
||||
struct timer *timer = &vtimer->timer;
|
||||
struct hv_timer *timer = &vtimer->timer;
|
||||
|
||||
/*
|
||||
* A write to the LVT Timer Register that changes
|
||||
@ -411,7 +411,7 @@ static uint64_t vlapic_get_tsc_deadline_msr(struct acrn_vlapic *vlapic)
|
||||
static void vlapic_set_tsc_deadline_msr(struct acrn_vlapic *vlapic,
|
||||
uint64_t val_arg)
|
||||
{
|
||||
struct timer *timer;
|
||||
struct hv_timer *timer;
|
||||
uint64_t val = val_arg;
|
||||
|
||||
if (!vlapic_lvtt_tsc_deadline(vlapic)) {
|
||||
|
@ -109,7 +109,7 @@ struct vlapic_ops {
|
||||
};
|
||||
|
||||
struct vlapic_timer {
|
||||
struct timer timer;
|
||||
struct hv_timer timer;
|
||||
uint32_t mode;
|
||||
uint32_t tmicr;
|
||||
uint32_t divisor_shift;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
uint32_t tsc_khz = 0U;
|
||||
|
||||
static void run_timer(struct timer *timer)
|
||||
static void run_timer(struct hv_timer *timer)
|
||||
{
|
||||
/* deadline = 0 means stop timer, we should skip */
|
||||
if ((timer->func != NULL) && timer->fire_tsc != 0UL) {
|
||||
@ -32,12 +32,12 @@ static int tsc_deadline_handler(__unused int irq, __unused void *data)
|
||||
|
||||
static inline void update_physical_timer(struct per_cpu_timers *cpu_timer)
|
||||
{
|
||||
struct timer *timer = NULL;
|
||||
struct hv_timer *timer = NULL;
|
||||
|
||||
/* find the next event timer */
|
||||
if (!list_empty(&cpu_timer->timer_list)) {
|
||||
timer = list_entry((&cpu_timer->timer_list)->next,
|
||||
struct timer, node);
|
||||
struct hv_timer, node);
|
||||
|
||||
/* it is okay to program a expired time */
|
||||
msr_write(MSR_IA32_TSC_DEADLINE, timer->fire_tsc);
|
||||
@ -45,16 +45,16 @@ static inline void update_physical_timer(struct per_cpu_timers *cpu_timer)
|
||||
}
|
||||
|
||||
static void __add_timer(struct per_cpu_timers *cpu_timer,
|
||||
struct timer *timer,
|
||||
struct hv_timer *timer,
|
||||
bool *need_update)
|
||||
{
|
||||
struct list_head *pos, *prev;
|
||||
struct timer *tmp;
|
||||
struct hv_timer *tmp;
|
||||
uint64_t tsc = timer->fire_tsc;
|
||||
|
||||
prev = &cpu_timer->timer_list;
|
||||
list_for_each(pos, &cpu_timer->timer_list) {
|
||||
tmp = list_entry(pos, struct timer, node);
|
||||
tmp = list_entry(pos, struct hv_timer, node);
|
||||
if (tmp->fire_tsc < tsc) {
|
||||
prev = &tmp->node;
|
||||
}
|
||||
@ -71,7 +71,7 @@ static void __add_timer(struct per_cpu_timers *cpu_timer,
|
||||
}
|
||||
}
|
||||
|
||||
int add_timer(struct timer *timer)
|
||||
int add_timer(struct hv_timer *timer)
|
||||
{
|
||||
struct per_cpu_timers *cpu_timer;
|
||||
uint16_t pcpu_id;
|
||||
@ -100,7 +100,7 @@ int add_timer(struct timer *timer)
|
||||
|
||||
}
|
||||
|
||||
void del_timer(struct timer *timer)
|
||||
void del_timer(struct hv_timer *timer)
|
||||
{
|
||||
if ((timer != NULL) && !list_empty(&timer->node)) {
|
||||
list_del_init(&timer->node);
|
||||
@ -184,7 +184,7 @@ void timer_cleanup(void)
|
||||
void timer_softirq(uint16_t pcpu_id)
|
||||
{
|
||||
struct per_cpu_timers *cpu_timer;
|
||||
struct timer *timer;
|
||||
struct hv_timer *timer;
|
||||
struct list_head *pos, *n;
|
||||
int tries = MAX_TIMER_ACTIONS;
|
||||
uint64_t current_tsc = rdtsc();
|
||||
@ -199,7 +199,7 @@ void timer_softirq(uint16_t pcpu_id)
|
||||
* already passed due to previously func()'s delay.
|
||||
*/
|
||||
list_for_each_safe(pos, n, &cpu_timer->timer_list) {
|
||||
timer = list_entry(pos, struct timer, node);
|
||||
timer = list_entry(pos, struct hv_timer, node);
|
||||
/* timer expried */
|
||||
tries--;
|
||||
if (timer->fire_tsc <= current_tsc && tries > 0) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
static spinlock_t lock;
|
||||
|
||||
static uint32_t serial_handle = SERIAL_INVALID_HANDLE;
|
||||
struct timer console_timer;
|
||||
struct hv_timer console_timer;
|
||||
|
||||
#define CONSOLE_KICK_TIMER_TIMEOUT 40 /* timeout is 40ms*/
|
||||
|
||||
|
@ -18,7 +18,7 @@ struct per_cpu_timers {
|
||||
struct list_head timer_list; /* it's for runtime active timer list */
|
||||
};
|
||||
|
||||
struct timer {
|
||||
struct hv_timer {
|
||||
struct list_head node; /* link all timers */
|
||||
int mode; /* timer mode: one-shot or periodic */
|
||||
uint64_t fire_tsc; /* tsc deadline to interrupt */
|
||||
@ -31,7 +31,7 @@ struct timer {
|
||||
* Don't initialize a timer twice if it has been add to the timer list
|
||||
* after call add_timer. If u want, delete the timer from the list first.
|
||||
*/
|
||||
static inline void initialize_timer(struct timer *timer,
|
||||
static inline void initialize_timer(struct hv_timer *timer,
|
||||
timer_handle_t func,
|
||||
void *priv_data,
|
||||
uint64_t fire_tsc,
|
||||
@ -51,8 +51,8 @@ static inline void initialize_timer(struct timer *timer,
|
||||
/*
|
||||
* Don't call add_timer/del_timer in the timer callback function.
|
||||
*/
|
||||
int add_timer(struct timer *timer);
|
||||
void del_timer(struct timer *timer);
|
||||
int add_timer(struct hv_timer *timer);
|
||||
void del_timer(struct hv_timer *timer);
|
||||
|
||||
void timer_softirq(uint16_t pcpu_id);
|
||||
void timer_init(void);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define CONSOLE_H
|
||||
|
||||
#ifdef HV_DEBUG
|
||||
extern struct timer console_timer;
|
||||
extern struct hv_timer console_timer;
|
||||
|
||||
/** Initializes the console module.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user