[PATCH 1/4] HV: Introduce a new local function notify_cpus


Kaige Fu
 

This patch introduces a new local function notify_cpus to replace
send_dest_ipi_mask. And in following patch, we will check if the
target cpu is for lapic_pt enabled vCPU in notify_cpus. If yes, we
will use NMI to notify target vCPU. Otherwise, use IPI to notify
target vCPU.

Signed-off-by: Kaige Fu <kaige.fu@...>
---
hypervisor/arch/x86/notify.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/x86/notify.c b/hypervisor/arch/x86/notify.c
index c56bb3cf..e5cb2000 100644
--- a/hypervisor/arch/x86/notify.c
+++ b/hypervisor/arch/x86/notify.c
@@ -37,6 +37,17 @@ static void kick_notification(__unused uint32_t irq, __unused void *data)
}
}

+static void notify_cpus(uint64_t mask)
+{
+ uint16_t pcpu_id = ffs64(mask);
+
+ while (pcpu_id < MAX_PCPU_NUM) {
+ bitmap_clear_nolock(pcpu_id, &mask);
+ send_single_ipi(pcpu_id, VECTOR_NOTIFY_VCPU);
+ pcpu_id = ffs64(mask);
+ }
+}
+
void smp_call_function(uint64_t mask, smp_call_func_t func, void *data)
{
uint16_t pcpu_id;
@@ -58,7 +69,8 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data)
}
pcpu_id = ffs64(mask);
}
- send_dest_ipi_mask((uint32_t)smp_call_mask, VECTOR_NOTIFY_VCPU);
+
+ notify_cpus(smp_call_mask);
/* wait for current smp call complete */
wait_sync_change(&smp_call_mask, 0UL);
}
--
2.20.0

Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.