mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 22:42:53 +00:00
hv:Move several inline APIs from vm.h to *.c
-- move vm_pic() from vm.h to vpic.c since it is only used in vpic.c -- move vm_ioapic() from vm.h to vioapic.c change vioapic_reset(struct acrn_vioapic *vioapic) --> vioapic_reset(struct acrn_vm *vm) then vm_vioapic() is only used in vioapic.c -- move vm_vuart() from vm.h to vuart.c, now this api is used in vuart.c and shell.c Tracked-On: #1842 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
61552458f0
commit
cc2c0c3a9a
@ -321,7 +321,7 @@ int32_t reset_vm(struct acrn_vm *vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset_vm_ioreqs(vm);
|
reset_vm_ioreqs(vm);
|
||||||
vioapic_reset(vm_ioapic(vm));
|
vioapic_reset(vm);
|
||||||
destroy_secure_world(vm, false);
|
destroy_secure_world(vm, false);
|
||||||
vm->sworld_control.flag.active = 0UL;
|
vm->sworld_control.flag.active = 0UL;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -122,6 +122,11 @@ static uint8_t vuart_intr_reason(const struct acrn_vuart *vu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct acrn_vuart *vm_vuart(struct acrn_vm *vm)
|
||||||
|
{
|
||||||
|
return &(vm->vuart);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Toggle the COM port's intr pin depending on whether or not we have an
|
* Toggle the COM port's intr pin depending on whether or not we have an
|
||||||
* interrupt condition to report to the processor.
|
* interrupt condition to report to the processor.
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
#define IOAPIC_ID_MASK 0x0f000000U
|
#define IOAPIC_ID_MASK 0x0f000000U
|
||||||
#define MASK_ALL_INTERRUPTS 0x0001000000010000UL
|
#define MASK_ALL_INTERRUPTS 0x0001000000010000UL
|
||||||
|
|
||||||
|
static inline struct acrn_vioapic *vm_ioapic(const struct acrn_vm *vm)
|
||||||
|
{
|
||||||
|
return (struct acrn_vioapic *)&(vm->arch_vm.vioapic);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pre pin < vioapic_pincount(vm)
|
* @pre pin < vioapic_pincount(vm)
|
||||||
*/
|
*/
|
||||||
@ -495,12 +500,13 @@ vioapic_process_eoi(struct acrn_vm *vm, uint32_t vector)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vioapic_reset(struct acrn_vioapic *vioapic)
|
vioapic_reset(struct acrn_vm *vm)
|
||||||
{
|
{
|
||||||
uint32_t pin, pincount;
|
uint32_t pin, pincount;
|
||||||
|
struct acrn_vioapic *vioapic = vm_ioapic(vm);
|
||||||
|
|
||||||
/* Initialize all redirection entries to mask all interrupts */
|
/* Initialize all redirection entries to mask all interrupts */
|
||||||
pincount = vioapic_pincount(vioapic->vm);
|
pincount = vioapic_pincount(vm);
|
||||||
for (pin = 0U; pin < pincount; pin++) {
|
for (pin = 0U; pin < pincount; pin++) {
|
||||||
vioapic->rtbl[pin].full = MASK_ALL_INTERRUPTS;
|
vioapic->rtbl[pin].full = MASK_ALL_INTERRUPTS;
|
||||||
}
|
}
|
||||||
@ -514,7 +520,7 @@ vioapic_init(struct acrn_vm *vm)
|
|||||||
vm->arch_vm.vioapic.vm = vm;
|
vm->arch_vm.vioapic.vm = vm;
|
||||||
spinlock_init(&(vm->arch_vm.vioapic.mtx));
|
spinlock_init(&(vm->arch_vm.vioapic.mtx));
|
||||||
|
|
||||||
vioapic_reset(vm_ioapic(vm));
|
vioapic_reset(vm);
|
||||||
|
|
||||||
(void)register_mmio_emulation_handler(vm,
|
(void)register_mmio_emulation_handler(vm,
|
||||||
vioapic_mmio_access_handler,
|
vioapic_mmio_access_handler,
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
|
|
||||||
static void vpic_set_pinstate(struct acrn_vpic *vpic, uint32_t pin, uint8_t level);
|
static void vpic_set_pinstate(struct acrn_vpic *vpic, uint32_t pin, uint8_t level);
|
||||||
|
|
||||||
|
static inline struct acrn_vpic *vm_pic(const struct acrn_vm *vm)
|
||||||
|
{
|
||||||
|
return (struct acrn_vpic *)&(vm->arch_vm.vpic);
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool master_pic(const struct acrn_vpic *vpic, const struct i8259_reg_state *i8259)
|
static inline bool master_pic(const struct acrn_vpic *vpic, const struct i8259_reg_state *i8259)
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
|
@ -60,7 +60,7 @@ struct acrn_vioapic {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void vioapic_init(struct acrn_vm *vm);
|
void vioapic_init(struct acrn_vm *vm);
|
||||||
void vioapic_reset(struct acrn_vioapic *vioapic);
|
void vioapic_reset(struct acrn_vm *vm);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,24 +272,6 @@ static inline struct acrn_vcpu *get_primary_vcpu(struct acrn_vm *vm)
|
|||||||
return target_vcpu;
|
return target_vcpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct acrn_vuart*
|
|
||||||
vm_vuart(struct acrn_vm *vm)
|
|
||||||
{
|
|
||||||
return &(vm->vuart);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct acrn_vpic *
|
|
||||||
vm_pic(const struct acrn_vm *vm)
|
|
||||||
{
|
|
||||||
return (struct acrn_vpic *)&(vm->arch_vm.vpic);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct acrn_vioapic *
|
|
||||||
vm_ioapic(const struct acrn_vm *vm)
|
|
||||||
{
|
|
||||||
return (struct acrn_vioapic *)&(vm->arch_vm.vioapic);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t shutdown_vm(struct acrn_vm *vm);
|
int32_t shutdown_vm(struct acrn_vm *vm);
|
||||||
void pause_vm(struct acrn_vm *vm);
|
void pause_vm(struct acrn_vm *vm);
|
||||||
void resume_vm(struct acrn_vm *vm);
|
void resume_vm(struct acrn_vm *vm);
|
||||||
|
@ -70,6 +70,7 @@ struct acrn_vuart {
|
|||||||
extern int8_t vuart_vmid;
|
extern int8_t vuart_vmid;
|
||||||
#endif /* CONFIG_PARTITION_MODE */
|
#endif /* CONFIG_PARTITION_MODE */
|
||||||
|
|
||||||
|
struct acrn_vuart *vm_vuart(struct acrn_vm *vm);
|
||||||
void vuart_init(struct acrn_vm *vm);
|
void vuart_init(struct acrn_vm *vm);
|
||||||
struct acrn_vuart *vuart_console_active(void);
|
struct acrn_vuart *vuart_console_active(void);
|
||||||
void vuart_console_tx_chars(struct acrn_vuart *vu);
|
void vuart_console_tx_chars(struct acrn_vuart *vu);
|
||||||
|
Loading…
Reference in New Issue
Block a user