]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: use actual CPU number for allocating memory
authorMiao Yan <yanmiaobest@gmail.com>
Thu, 7 Jan 2016 09:32:03 +0000 (01:32 -0800)
committerBin Meng <bmeng.cn@gmail.com>
Wed, 13 Jan 2016 04:20:15 +0000 (12:20 +0800)
Use actual CPU number, instead of maximum cpu configured, to allocate
stack memory in 'load_sipi_vector'

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/mp_init.c

index 2f34317858e40d94e86f39590a7c1aaea4552855..2a3ce488a90132ed1b7f0795a51c076f617743de 100644 (file)
@@ -210,7 +210,7 @@ static int save_bsp_msrs(char *start, int size)
        return msr_count;
 }
 
-static int load_sipi_vector(atomic_t **ap_countp)
+static int load_sipi_vector(atomic_t **ap_countp, int num_cpus)
 {
        struct sipi_params_16bit *params16;
        struct sipi_params *params;
@@ -239,7 +239,7 @@ static int load_sipi_vector(atomic_t **ap_countp)
        params->idt_ptr = (uint32_t)x86_get_idt();
 
        params->stack_size = CONFIG_AP_STACK_SIZE;
-       size = params->stack_size * CONFIG_MAX_CPUS;
+       size = params->stack_size * num_cpus;
        stack = memalign(size, 4096);
        if (!stack)
                return -ENOMEM;
@@ -483,7 +483,7 @@ int mp_init(struct mp_params *p)
        mp_info.records = p->flight_plan;
 
        /* Load the SIPI vector */
-       ret = load_sipi_vector(&ap_count);
+       ret = load_sipi_vector(&ap_count, num_cpus);
        if (ap_count == NULL)
                return -1;