[PATCH v8 2/5] HV: Kconfig: Remove CPU_UP_TIMEOUT


Kaige Fu
 

This patch remove the over design CPU_UP_TIMEOUT and
use CPU_UP_TIMEOUT and CPU_DOWN_TIMEOUT instead.

Signed-off-by: Kaige Fu <kaige.fu@...>
Acked-by: Eddie Dong <eddie.dong@...>
---
hypervisor/arch/x86/Kconfig | 8 --------
hypervisor/arch/x86/cpu.c | 7 +++++--
2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/hypervisor/arch/x86/Kconfig b/hypervisor/arch/x86/Kconfig
index fb259167..744e01d4 100644
--- a/hypervisor/arch/x86/Kconfig
+++ b/hypervisor/arch/x86/Kconfig
@@ -107,14 +107,6 @@ config LOG_DESTINATION
are 3 destinations available. Bit 0 represents the serial console, bit
1 the SOS ACRN log and bit 2 NPK log. Effective only in debug builds.

-config CPU_UP_TIMEOUT
- int "Timeout in ms when bringing up secondary CPUs"
- range 100 200
- default 100
- help
- A 32-bit integer specifying the timeout in millisecond when waiting
- for secondary CPUs to start up.
-
choice
prompt "Serial IO type"
depends on !RELEASE
diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c
index d6546419..e3bdd0e2 100644
--- a/hypervisor/arch/x86/cpu.c
+++ b/hypervisor/arch/x86/cpu.c
@@ -27,6 +27,9 @@
#include <cat.h>
#include <firmware.h>

+#define CPU_UP_TIMEOUT 100U /* millisecond */
+#define CPU_DOWN_TIMEOUT 100U /* millisecond */
+
struct per_cpu_region per_cpu_data[CONFIG_MAX_PCPU_NUM] __aligned(PAGE_SIZE);
static uint16_t phys_cpu_num = 0U;
static uint64_t pcpu_sync = 0UL;
@@ -273,7 +276,7 @@ static void start_cpu(uint16_t pcpu_id)
/* Wait until the pcpu with pcpu_id is running and set the active bitmap or
* configured time-out has expired
*/
- timeout = (uint32_t)CONFIG_CPU_UP_TIMEOUT * 1000U;
+ timeout = CPU_UP_TIMEOUT * 1000U;
while (!is_pcpu_active(pcpu_id) && (timeout != 0U)) {
/* Delay 10us */
udelay(10U);
@@ -317,7 +320,6 @@ void stop_cpus(void)
uint16_t pcpu_id, expected_up;
uint32_t timeout;

- timeout = (uint32_t)CONFIG_CPU_UP_TIMEOUT * 1000U;
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++) {
if (get_cpu_id() == pcpu_id) { /* avoid offline itself */
continue;
@@ -327,6 +329,7 @@ void stop_cpus(void)
}

expected_up = 1U;
+ timeout = CPU_DOWN_TIMEOUT * 1000U;
while ((atomic_load16(&up_count) != expected_up) && (timeout != 0U)) {
/* Delay 10us */
udelay(10U);
--
2.20.0

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