Rev 5 | Rev 7 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5 | Rev 6 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | #include <arch/atomic.h> |
32 | #include <arch/atomic.h> |
33 | #include <config.h> |
33 | #include <config.h> |
34 | 34 | ||
35 | #ifdef __SMP__ |
35 | #ifdef __SMP__ |
36 | static spinlock_t tlblock; |
36 | static spinlock_t tlblock; |
37 | static volatile int tlb_shutdown_cnt; |
37 | static volatile int tlb_shootdown_cnt; |
38 | 38 | ||
39 | void tlb_init(void) |
39 | void tlb_init(void) |
40 | { |
40 | { |
41 | spinlock_initialize(&tlblock); |
41 | spinlock_initialize(&tlblock); |
42 | tlb_shutdown_cnt = 0; |
42 | tlb_shootdown_cnt = 0; |
43 | } |
43 | } |
44 | 44 | ||
45 | /* must be called with interrupts disabled */ |
45 | /* must be called with interrupts disabled */ |
46 | void tlb_shutdown_start(void) |
46 | void tlb_shootdown_start(void) |
47 | { |
47 | { |
48 | spinlock_lock(&tlblock); |
48 | spinlock_lock(&tlblock); |
49 | tlb_shutdown_ipi_send(); |
49 | tlb_shootdown_ipi_send(); |
50 | 50 | ||
51 | while (tlb_shutdown_cnt < config.cpu_active - 1) |
51 | while (tlb_shootdown_cnt < config.cpu_active - 1) |
52 | ; |
52 | ; |
53 | 53 | ||
54 | tlb_shutdown_cnt = 0; |
54 | tlb_shootdown_cnt = 0; |
55 | } |
55 | } |
56 | 56 | ||
57 | void tlb_shutdown_finalize(void) |
57 | void tlb_shootdown_finalize(void) |
58 | { |
58 | { |
59 | spinlock_unlock(&tlblock); |
59 | spinlock_unlock(&tlblock); |
60 | } |
60 | } |
61 | 61 | ||
62 | void tlb_shutdown_ipi_recv(void) |
62 | void tlb_shootdown_ipi_recv(void) |
63 | { |
63 | { |
64 | atomic_inc((int *) &tlb_shutdown_cnt); |
64 | atomic_inc((int *) &tlb_shootdown_cnt); |
65 | spinlock_lock(&tlblock); |
65 | spinlock_lock(&tlblock); |
66 | spinlock_unlock(&tlblock); |
66 | spinlock_unlock(&tlblock); |
67 | tlb_invalidate(0); /* TODO: use valid ASID */ |
67 | tlb_invalidate(0); /* TODO: use valid ASID */ |
68 | } |
68 | } |
69 | #endif /* __SMP__ */ |
69 | #endif /* __SMP__ */ |