Skip to content

Commit

Permalink
SMP
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuzhuzhus committed Sep 12, 2024
1 parent 66cee98 commit 57305fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions components/smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void rt_smp_call_func_cond(int cpu_mask, smp_call_func_back func, void *data,rt_
tmp_id++;
tmp_mask = tmp_mask >> 1;
}
rt_hw_ipi_send(RT_IPI_FUNC, cpu_mask);
rt_hw_ipi_send(RT_FUNC_IPI, cpu_mask);
}

if(need_wait)
Expand Down Expand Up @@ -143,4 +143,3 @@ void smp_init(void)
rt_spin_lock_init(&global_work[i].lock);
}
}

5 changes: 3 additions & 2 deletions examples/utest/testcases/smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ void test1()
cpu_mask = rand() % 0xf;
if (cpu_mask == 0)
pass--;
rt_call_each_cpu(test_call, &cpu_mask, SMP_CALL_NO_WAIT);
rt_call_any_cpu(cpu_mask,test_call, &cpu_mask, SMP_CALL_WAIT_ALL);
if (i % 20 == 0)
rt_kprintf("#");
rt_thread_mdelay(1);
}
rt_kprintf("\n");
uassert_true(pass_count == pass);
Expand Down Expand Up @@ -57,6 +56,8 @@ void test2(void)

static rt_err_t utest_tc_init(void)
{
pass_count = 0;
pass = 1000;
rt_spin_lock_init(&lock);
return RT_EOK;
}
Expand Down
6 changes: 4 additions & 2 deletions include/rtdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,12 @@ typedef struct rt_cpu_usage_stats *rt_cpu_usage_stats_t;
#define RT_STOP_IPI 1
#endif /* RT_STOP_IPI */

#ifndef RT_IPI_FUNC
#define RT_IPI_FUNC 2
#ifndef RT_FUNC_IPI
#define RT_FUNC_IPI 2
#endif

#define RT_MAX_IPI 3

#define _SCHEDULER_CONTEXT(fileds) fileds

/**
Expand Down
4 changes: 2 additions & 2 deletions libcpu/aarch64/common/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ void rt_hw_common_setup(void)
/* Install the IPI handle */
rt_hw_ipi_handler_install(RT_SCHEDULE_IPI, rt_scheduler_ipi_handler);
rt_hw_ipi_handler_install(RT_STOP_IPI, rt_scheduler_ipi_handler);
rt_hw_ipi_handler_install(RT_IPI_FUNC, rt_smp_call_ipi_handler);
rt_hw_ipi_handler_install(RT_FUNC_IPI, rt_smp_call_ipi_handler);
rt_hw_interrupt_umask(RT_SCHEDULE_IPI);
rt_hw_interrupt_umask(RT_STOP_IPI);
rt_hw_interrupt_umask(RT_IPI_FUNC);
rt_hw_interrupt_umask(RT_FUNC_IPI);
#endif
}

Expand Down

0 comments on commit 57305fa

Please sign in to comment.