mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-03 02:26:24 +00:00
HV: x86: fix "Procedure has more than one exit point"
IEC 61508, ISO 26262 standards highly recommand single-exit rule. Tracked-On: #861 Signed-off-by: Kaige Fu <kaige.fu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
e283e77424
commit
eff9459110
@ -262,13 +262,15 @@ uint8_t irq_to_pin(uint32_t irq)
|
|||||||
uint32_t pin_to_irq(uint8_t pin)
|
uint32_t pin_to_irq(uint8_t pin)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
uint32_t irq = IRQ_INVALID;
|
||||||
|
|
||||||
for (i = 0U; i < nr_gsi; i++) {
|
for (i = 0U; i < nr_gsi; i++) {
|
||||||
if (gsi_table[i].pin == pin) {
|
if (gsi_table[i].pin == pin) {
|
||||||
return i;
|
irq = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return IRQ_INVALID;
|
return irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -60,35 +60,30 @@ static int32_t request_notification_irq(irq_action_t func, void *data)
|
|||||||
int32_t retval;
|
int32_t retval;
|
||||||
|
|
||||||
if (notification_irq != IRQ_INVALID) {
|
if (notification_irq != IRQ_INVALID) {
|
||||||
pr_info("%s, Notification vector already allocated on this CPU",
|
pr_info("%s, Notification vector already allocated on this CPU", __func__);
|
||||||
__func__);
|
retval = -EBUSY;
|
||||||
return -EBUSY;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
/* all cpu register the same notification vector */
|
/* all cpu register the same notification vector */
|
||||||
retval = request_irq(NOTIFY_IRQ, func, data, IRQF_NONE);
|
retval = request_irq(NOTIFY_IRQ, func, data, IRQF_NONE);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
pr_err("Failed to add notify isr");
|
pr_err("Failed to add notify isr");
|
||||||
return -ENODEV;
|
retval = -ENODEV;
|
||||||
|
} else {
|
||||||
|
notification_irq = (uint32_t)retval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notification_irq = (uint32_t)retval;
|
return retval;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @pre be called only by BSP initialization process
|
||||||
|
*/
|
||||||
void setup_notification(void)
|
void setup_notification(void)
|
||||||
{
|
{
|
||||||
uint16_t cpu = get_cpu_id();
|
|
||||||
|
|
||||||
if (cpu > 0U) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* support IPI notification, VM0 will register all CPU */
|
/* support IPI notification, VM0 will register all CPU */
|
||||||
if (request_notification_irq(kick_notification, NULL) < 0) {
|
if (request_notification_irq(kick_notification, NULL) < 0) {
|
||||||
pr_err("Failed to setup notification");
|
pr_err("Failed to setup notification");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(ACRN_DBG_PTIRQ, "NOTIFY: irq[%d] setup vector %x",
|
dev_dbg(ACRN_DBG_PTIRQ, "NOTIFY: irq[%d] setup vector %x",
|
||||||
|
Loading…
Reference in New Issue
Block a user