mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-13 12:59:45 +00:00
hv:fix return value violations for vpic/vioapic
-- Change these APIs to void type, add pre-conditions, and move parameter-check to upper-layer functions. handle_vpic_irqline vpic_set_irqstate vpic_assert_irq vpic_deassert_irq vpic_pulse_irq vpic_get_irq_trigger handle_vioapic_irqline vioapic_assert_irq vioapic_deassert_irq vioapic_pulse_irq -- Remove dead code vpic_set_irq_trigger v1-->v2: add cleanup vpic change some APIs to void type, add pre-conditions, and move the parameter-check to upper-layer functions. Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -67,17 +67,15 @@ vm_ioapic(struct vm *vm)
|
||||
return (struct vioapic *)vm->arch_vm.virt_ioapic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre pin < vioapic_pincount(vm)
|
||||
*/
|
||||
static void
|
||||
vioapic_send_intr(struct vioapic *vioapic, uint32_t pin)
|
||||
{
|
||||
uint32_t vector, dest, delmode;
|
||||
union ioapic_rte rte;
|
||||
bool level, phys;
|
||||
uint32_t pincount = vioapic_pincount(vioapic->vm);
|
||||
|
||||
if (pin >= pincount) {
|
||||
pr_err("vioapic_send_intr: invalid pin number %hhu", pin);
|
||||
}
|
||||
|
||||
rte = vioapic->rtbl[pin];
|
||||
|
||||
@@ -105,16 +103,14 @@ vioapic_send_intr(struct vioapic *vioapic, uint32_t pin)
|
||||
delmode, vector, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre pin < vioapic_pincount(vm)
|
||||
*/
|
||||
static void
|
||||
vioapic_set_pinstate(struct vioapic *vioapic, uint32_t pin, bool newstate)
|
||||
{
|
||||
int oldcnt, newcnt;
|
||||
bool needintr;
|
||||
uint32_t pincount = vioapic_pincount(vioapic->vm);
|
||||
|
||||
if (pin >= pincount) {
|
||||
pr_err("vioapic_set_pinstate: invalid pin number %hhu", pin);
|
||||
}
|
||||
|
||||
oldcnt = vioapic->acnt[pin];
|
||||
if (newstate) {
|
||||
@@ -150,16 +146,15 @@ enum irqstate {
|
||||
IRQSTATE_PULSE
|
||||
};
|
||||
|
||||
static int
|
||||
/**
|
||||
* @pre irq < vioapic_pincount(vm)
|
||||
*/
|
||||
static void
|
||||
vioapic_set_irqstate(struct vm *vm, uint32_t irq, enum irqstate irqstate)
|
||||
{
|
||||
struct vioapic *vioapic;
|
||||
uint32_t pin = irq;
|
||||
|
||||
if (pin >= vioapic_pincount(vm)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
vioapic = vm_ioapic(vm);
|
||||
|
||||
VIOAPIC_LOCK(vioapic);
|
||||
@@ -178,26 +173,23 @@ vioapic_set_irqstate(struct vm *vm, uint32_t irq, enum irqstate irqstate)
|
||||
panic("vioapic_set_irqstate: invalid irqstate %d", irqstate);
|
||||
}
|
||||
VIOAPIC_UNLOCK(vioapic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
vioapic_assert_irq(struct vm *vm, uint32_t irq)
|
||||
{
|
||||
return vioapic_set_irqstate(vm, irq, IRQSTATE_ASSERT);
|
||||
vioapic_set_irqstate(vm, irq, IRQSTATE_ASSERT);
|
||||
}
|
||||
|
||||
int
|
||||
vioapic_deassert_irq(struct vm *vm, uint32_t irq)
|
||||
void vioapic_deassert_irq(struct vm *vm, uint32_t irq)
|
||||
{
|
||||
return vioapic_set_irqstate(vm, irq, IRQSTATE_DEASSERT);
|
||||
vioapic_set_irqstate(vm, irq, IRQSTATE_DEASSERT);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
vioapic_pulse_irq(struct vm *vm, uint32_t irq)
|
||||
{
|
||||
return vioapic_set_irqstate(vm, irq, IRQSTATE_PULSE);
|
||||
vioapic_set_irqstate(vm, irq, IRQSTATE_PULSE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user