Lines Matching refs:spu

78 static inline void acquire_spu_lock(struct spu *spu)  in acquire_spu_lock()  argument
87 static inline void release_spu_lock(struct spu *spu) in release_spu_lock() argument
95 static inline int check_spu_isolate(struct spu_state *csa, struct spu *spu) in check_spu_isolate() argument
97 struct spu_problem __iomem *prob = spu->problem; in check_spu_isolate()
111 static inline void disable_interrupts(struct spu_state *csa, struct spu *spu) in disable_interrupts() argument
124 spin_lock_irq(&spu->register_lock); in disable_interrupts()
126 csa->priv1.int_mask_class0_RW = spu_int_mask_get(spu, 0); in disable_interrupts()
127 csa->priv1.int_mask_class1_RW = spu_int_mask_get(spu, 1); in disable_interrupts()
128 csa->priv1.int_mask_class2_RW = spu_int_mask_get(spu, 2); in disable_interrupts()
130 spu_int_mask_set(spu, 0, 0ul); in disable_interrupts()
131 spu_int_mask_set(spu, 1, 0ul); in disable_interrupts()
132 spu_int_mask_set(spu, 2, 0ul); in disable_interrupts()
134 spin_unlock_irq(&spu->register_lock); in disable_interrupts()
141 set_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); in disable_interrupts()
142 clear_bit(SPU_CONTEXT_FAULT_PENDING, &spu->flags); in disable_interrupts()
143 synchronize_irq(spu->irqs[0]); in disable_interrupts()
144 synchronize_irq(spu->irqs[1]); in disable_interrupts()
145 synchronize_irq(spu->irqs[2]); in disable_interrupts()
148 static inline void set_watchdog_timer(struct spu_state *csa, struct spu *spu) in set_watchdog_timer() argument
161 static inline void inhibit_user_access(struct spu_state *csa, struct spu *spu) in inhibit_user_access() argument
172 static inline void set_switch_pending(struct spu_state *csa, struct spu *spu) in set_switch_pending() argument
181 static inline void save_mfc_cntl(struct spu_state *csa, struct spu *spu) in save_mfc_cntl() argument
183 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_mfc_cntl()
215 static inline void save_spu_runcntl(struct spu_state *csa, struct spu *spu) in save_spu_runcntl() argument
217 struct spu_problem __iomem *prob = spu->problem; in save_spu_runcntl()
226 static inline void save_mfc_sr1(struct spu_state *csa, struct spu *spu) in save_mfc_sr1() argument
231 csa->priv1.mfc_sr1_RW = spu_mfc_sr1_get(spu); in save_mfc_sr1()
234 static inline void save_spu_status(struct spu_state *csa, struct spu *spu) in save_spu_status() argument
236 struct spu_problem __iomem *prob = spu->problem; in save_spu_status()
261 struct spu *spu) in save_mfc_stopped_status() argument
263 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_mfc_stopped_status()
277 static inline void halt_mfc_decr(struct spu_state *csa, struct spu *spu) in halt_mfc_decr() argument
279 struct spu_priv2 __iomem *priv2 = spu->priv2; in halt_mfc_decr()
290 static inline void save_timebase(struct spu_state *csa, struct spu *spu) in save_timebase() argument
300 struct spu *spu) in remove_other_spu_access() argument
308 static inline void do_mfc_mssync(struct spu_state *csa, struct spu *spu) in do_mfc_mssync() argument
310 struct spu_problem __iomem *prob = spu->problem; in do_mfc_mssync()
321 static inline void issue_mfc_tlbie(struct spu_state *csa, struct spu *spu) in issue_mfc_tlbie() argument
329 spu_tlb_invalidate(spu); in issue_mfc_tlbie()
334 struct spu *spu) in handle_pending_interrupts() argument
347 static inline void save_mfc_queues(struct spu_state *csa, struct spu *spu) in save_mfc_queues() argument
349 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_mfc_queues()
380 static inline void save_ppu_querymask(struct spu_state *csa, struct spu *spu) in save_ppu_querymask() argument
382 struct spu_problem __iomem *prob = spu->problem; in save_ppu_querymask()
391 static inline void save_ppu_querytype(struct spu_state *csa, struct spu *spu) in save_ppu_querytype() argument
393 struct spu_problem __iomem *prob = spu->problem; in save_ppu_querytype()
402 static inline void save_ppu_tagstatus(struct spu_state *csa, struct spu *spu) in save_ppu_tagstatus() argument
404 struct spu_problem __iomem *prob = spu->problem; in save_ppu_tagstatus()
415 static inline void save_mfc_csr_tsq(struct spu_state *csa, struct spu *spu) in save_mfc_csr_tsq() argument
417 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_mfc_csr_tsq()
427 static inline void save_mfc_csr_cmd(struct spu_state *csa, struct spu *spu) in save_mfc_csr_cmd() argument
429 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_mfc_csr_cmd()
439 static inline void save_mfc_csr_ato(struct spu_state *csa, struct spu *spu) in save_mfc_csr_ato() argument
441 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_mfc_csr_ato()
450 static inline void save_mfc_tclass_id(struct spu_state *csa, struct spu *spu) in save_mfc_tclass_id() argument
456 csa->priv1.mfc_tclass_id_RW = spu_mfc_tclass_id_get(spu); in save_mfc_tclass_id()
459 static inline void set_mfc_tclass_id(struct spu_state *csa, struct spu *spu) in set_mfc_tclass_id() argument
466 spu_mfc_tclass_id_set(spu, 0x10000000); in set_mfc_tclass_id()
470 static inline void purge_mfc_queue(struct spu_state *csa, struct spu *spu) in purge_mfc_queue() argument
472 struct spu_priv2 __iomem *priv2 = spu->priv2; in purge_mfc_queue()
484 static inline void wait_purge_complete(struct spu_state *csa, struct spu *spu) in wait_purge_complete() argument
486 struct spu_priv2 __iomem *priv2 = spu->priv2; in wait_purge_complete()
497 static inline void setup_mfc_sr1(struct spu_state *csa, struct spu *spu) in setup_mfc_sr1() argument
510 spu_mfc_sr1_set(spu, (MFC_STATE1_MASTER_RUN_CONTROL_MASK | in setup_mfc_sr1()
515 static inline void save_spu_npc(struct spu_state *csa, struct spu *spu) in save_spu_npc() argument
517 struct spu_problem __iomem *prob = spu->problem; in save_spu_npc()
525 static inline void save_spu_privcntl(struct spu_state *csa, struct spu *spu) in save_spu_privcntl() argument
527 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_spu_privcntl()
535 static inline void reset_spu_privcntl(struct spu_state *csa, struct spu *spu) in reset_spu_privcntl() argument
537 struct spu_priv2 __iomem *priv2 = spu->priv2; in reset_spu_privcntl()
547 static inline void save_spu_lslr(struct spu_state *csa, struct spu *spu) in save_spu_lslr() argument
549 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_spu_lslr()
557 static inline void reset_spu_lslr(struct spu_state *csa, struct spu *spu) in reset_spu_lslr() argument
559 struct spu_priv2 __iomem *priv2 = spu->priv2; in reset_spu_lslr()
569 static inline void save_spu_cfg(struct spu_state *csa, struct spu *spu) in save_spu_cfg() argument
571 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_spu_cfg()
579 static inline void save_pm_trace(struct spu_state *csa, struct spu *spu) in save_pm_trace() argument
587 static inline void save_mfc_rag(struct spu_state *csa, struct spu *spu) in save_mfc_rag() argument
594 spu_resource_allocation_groupID_get(spu); in save_mfc_rag()
596 spu_resource_allocation_enable_get(spu); in save_mfc_rag()
599 static inline void save_ppu_mb_stat(struct spu_state *csa, struct spu *spu) in save_ppu_mb_stat() argument
601 struct spu_problem __iomem *prob = spu->problem; in save_ppu_mb_stat()
609 static inline void save_ppu_mb(struct spu_state *csa, struct spu *spu) in save_ppu_mb() argument
611 struct spu_problem __iomem *prob = spu->problem; in save_ppu_mb()
619 static inline void save_ppuint_mb(struct spu_state *csa, struct spu *spu) in save_ppuint_mb() argument
621 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_ppuint_mb()
629 static inline void save_ch_part1(struct spu_state *csa, struct spu *spu) in save_ch_part1() argument
631 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_ch_part1()
655 static inline void save_spu_mb(struct spu_state *csa, struct spu *spu) in save_spu_mb() argument
657 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_spu_mb()
673 static inline void save_mfc_cmd(struct spu_state *csa, struct spu *spu) in save_mfc_cmd() argument
675 struct spu_priv2 __iomem *priv2 = spu->priv2; in save_mfc_cmd()
686 static inline void reset_ch(struct spu_state *csa, struct spu *spu) in reset_ch() argument
688 struct spu_priv2 __iomem *priv2 = spu->priv2; in reset_ch()
706 static inline void resume_mfc_queue(struct spu_state *csa, struct spu *spu) in resume_mfc_queue() argument
708 struct spu_priv2 __iomem *priv2 = spu->priv2; in resume_mfc_queue()
717 static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu, in setup_mfc_slbs() argument
734 spu_invalidate_slbs(spu); in setup_mfc_slbs()
735 spu_setup_kernel_slbs(spu, csa->lscsa, code, code_size); in setup_mfc_slbs()
738 static inline void set_switch_active(struct spu_state *csa, struct spu *spu) in set_switch_active() argument
749 if (test_bit(SPU_CONTEXT_FAULT_PENDING, &spu->flags)) in set_switch_active()
751 clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); in set_switch_active()
755 static inline void enable_interrupts(struct spu_state *csa, struct spu *spu) in enable_interrupts() argument
768 spin_lock_irq(&spu->register_lock); in enable_interrupts()
769 spu_int_stat_clear(spu, 0, CLASS0_INTR_MASK); in enable_interrupts()
770 spu_int_stat_clear(spu, 1, CLASS1_INTR_MASK); in enable_interrupts()
771 spu_int_stat_clear(spu, 2, CLASS2_INTR_MASK); in enable_interrupts()
772 spu_int_mask_set(spu, 0, 0ul); in enable_interrupts()
773 spu_int_mask_set(spu, 1, class1_mask); in enable_interrupts()
774 spu_int_mask_set(spu, 2, 0ul); in enable_interrupts()
775 spin_unlock_irq(&spu->register_lock); in enable_interrupts()
778 static inline int send_mfc_dma(struct spu *spu, unsigned long ea, in send_mfc_dma() argument
783 struct spu_problem __iomem *prob = spu->problem; in send_mfc_dma()
812 static inline void save_ls_16kb(struct spu_state *csa, struct spu *spu) in save_ls_16kb() argument
825 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd); in save_ls_16kb()
828 static inline void set_spu_npc(struct spu_state *csa, struct spu *spu) in set_spu_npc() argument
830 struct spu_problem __iomem *prob = spu->problem; in set_spu_npc()
845 static inline void set_signot1(struct spu_state *csa, struct spu *spu) in set_signot1() argument
847 struct spu_problem __iomem *prob = spu->problem; in set_signot1()
863 static inline void set_signot2(struct spu_state *csa, struct spu *spu) in set_signot2() argument
865 struct spu_problem __iomem *prob = spu->problem; in set_signot2()
881 static inline void send_save_code(struct spu_state *csa, struct spu *spu) in send_save_code() argument
894 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd); in send_save_code()
897 static inline void set_ppu_querymask(struct spu_state *csa, struct spu *spu) in set_ppu_querymask() argument
899 struct spu_problem __iomem *prob = spu->problem; in set_ppu_querymask()
910 static inline void wait_tag_complete(struct spu_state *csa, struct spu *spu) in wait_tag_complete() argument
912 struct spu_problem __iomem *prob = spu->problem; in wait_tag_complete()
928 spu_int_stat_clear(spu, 0, CLASS0_INTR_MASK); in wait_tag_complete()
929 spu_int_stat_clear(spu, 2, CLASS2_INTR_MASK); in wait_tag_complete()
933 static inline void wait_spu_stopped(struct spu_state *csa, struct spu *spu) in wait_spu_stopped() argument
935 struct spu_problem __iomem *prob = spu->problem; in wait_spu_stopped()
947 spu_int_stat_clear(spu, 0, CLASS0_INTR_MASK); in wait_spu_stopped()
948 spu_int_stat_clear(spu, 2, CLASS2_INTR_MASK); in wait_spu_stopped()
952 static inline int check_save_status(struct spu_state *csa, struct spu *spu) in check_save_status() argument
954 struct spu_problem __iomem *prob = spu->problem; in check_save_status()
967 static inline void terminate_spu_app(struct spu_state *csa, struct spu *spu) in terminate_spu_app() argument
976 struct spu *spu) in suspend_mfc_and_halt_decr() argument
978 struct spu_priv2 __iomem *priv2 = spu->priv2; in suspend_mfc_and_halt_decr()
990 struct spu *spu) in wait_suspend_mfc_complete() argument
992 struct spu_priv2 __iomem *priv2 = spu->priv2; in wait_suspend_mfc_complete()
1003 static inline int suspend_spe(struct spu_state *csa, struct spu *spu) in suspend_spe() argument
1005 struct spu_problem __iomem *prob = spu->problem; in suspend_spe()
1045 static inline void clear_spu_status(struct spu_state *csa, struct spu *spu) in clear_spu_status() argument
1047 struct spu_problem __iomem *prob = spu->problem; in clear_spu_status()
1056 spu_mfc_sr1_set(spu, in clear_spu_status()
1068 spu_mfc_sr1_set(spu, in clear_spu_status()
1079 static inline void reset_ch_part1(struct spu_state *csa, struct spu *spu) in reset_ch_part1() argument
1081 struct spu_priv2 __iomem *priv2 = spu->priv2; in reset_ch_part1()
1104 static inline void reset_ch_part2(struct spu_state *csa, struct spu *spu) in reset_ch_part2() argument
1106 struct spu_priv2 __iomem *priv2 = spu->priv2; in reset_ch_part2()
1125 struct spu *spu) in setup_spu_status_part1() argument
1217 struct spu *spu) in setup_spu_status_part2() argument
1240 static inline void restore_mfc_rag(struct spu_state *csa, struct spu *spu) in restore_mfc_rag() argument
1246 spu_resource_allocation_groupID_set(spu, in restore_mfc_rag()
1248 spu_resource_allocation_enable_set(spu, in restore_mfc_rag()
1252 static inline void send_restore_code(struct spu_state *csa, struct spu *spu) in send_restore_code() argument
1265 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd); in send_restore_code()
1268 static inline void setup_decr(struct spu_state *csa, struct spu *spu) in setup_decr() argument
1293 static inline void setup_ppu_mb(struct spu_state *csa, struct spu *spu) in setup_ppu_mb() argument
1301 static inline void setup_ppuint_mb(struct spu_state *csa, struct spu *spu) in setup_ppuint_mb() argument
1309 static inline int check_restore_status(struct spu_state *csa, struct spu *spu) in check_restore_status() argument
1311 struct spu_problem __iomem *prob = spu->problem; in check_restore_status()
1324 static inline void restore_spu_privcntl(struct spu_state *csa, struct spu *spu) in restore_spu_privcntl() argument
1326 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_spu_privcntl()
1335 static inline void restore_status_part1(struct spu_state *csa, struct spu *spu) in restore_status_part1() argument
1337 struct spu_problem __iomem *prob = spu->problem; in restore_status_part1()
1355 static inline void restore_status_part2(struct spu_state *csa, struct spu *spu) in restore_status_part2() argument
1357 struct spu_problem __iomem *prob = spu->problem; in restore_status_part2()
1382 static inline void restore_ls_16kb(struct spu_state *csa, struct spu *spu) in restore_ls_16kb() argument
1395 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd); in restore_ls_16kb()
1398 static inline void suspend_mfc(struct spu_state *csa, struct spu *spu) in suspend_mfc() argument
1400 struct spu_priv2 __iomem *priv2 = spu->priv2; in suspend_mfc()
1410 static inline void clear_interrupts(struct spu_state *csa, struct spu *spu) in clear_interrupts() argument
1420 spin_lock_irq(&spu->register_lock); in clear_interrupts()
1421 spu_int_mask_set(spu, 0, 0ul); in clear_interrupts()
1422 spu_int_mask_set(spu, 1, 0ul); in clear_interrupts()
1423 spu_int_mask_set(spu, 2, 0ul); in clear_interrupts()
1424 spu_int_stat_clear(spu, 0, CLASS0_INTR_MASK); in clear_interrupts()
1425 spu_int_stat_clear(spu, 1, CLASS1_INTR_MASK); in clear_interrupts()
1426 spu_int_stat_clear(spu, 2, CLASS2_INTR_MASK); in clear_interrupts()
1427 spin_unlock_irq(&spu->register_lock); in clear_interrupts()
1430 static inline void restore_mfc_queues(struct spu_state *csa, struct spu *spu) in restore_mfc_queues() argument
1432 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_mfc_queues()
1464 static inline void restore_ppu_querymask(struct spu_state *csa, struct spu *spu) in restore_ppu_querymask() argument
1466 struct spu_problem __iomem *prob = spu->problem; in restore_ppu_querymask()
1475 static inline void restore_ppu_querytype(struct spu_state *csa, struct spu *spu) in restore_ppu_querytype() argument
1477 struct spu_problem __iomem *prob = spu->problem; in restore_ppu_querytype()
1486 static inline void restore_mfc_csr_tsq(struct spu_state *csa, struct spu *spu) in restore_mfc_csr_tsq() argument
1488 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_mfc_csr_tsq()
1498 static inline void restore_mfc_csr_cmd(struct spu_state *csa, struct spu *spu) in restore_mfc_csr_cmd() argument
1500 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_mfc_csr_cmd()
1511 static inline void restore_mfc_csr_ato(struct spu_state *csa, struct spu *spu) in restore_mfc_csr_ato() argument
1513 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_mfc_csr_ato()
1521 static inline void restore_mfc_tclass_id(struct spu_state *csa, struct spu *spu) in restore_mfc_tclass_id() argument
1526 spu_mfc_tclass_id_set(spu, csa->priv1.mfc_tclass_id_RW); in restore_mfc_tclass_id()
1530 static inline void set_llr_event(struct spu_state *csa, struct spu *spu) in set_llr_event() argument
1553 static inline void restore_decr_wrapped(struct spu_state *csa, struct spu *spu) in restore_decr_wrapped() argument
1571 static inline void restore_ch_part1(struct spu_state *csa, struct spu *spu) in restore_ch_part1() argument
1573 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_ch_part1()
1590 static inline void restore_ch_part2(struct spu_state *csa, struct spu *spu) in restore_ch_part2() argument
1592 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_ch_part2()
1613 static inline void restore_spu_lslr(struct spu_state *csa, struct spu *spu) in restore_spu_lslr() argument
1615 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_spu_lslr()
1624 static inline void restore_spu_cfg(struct spu_state *csa, struct spu *spu) in restore_spu_cfg() argument
1626 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_spu_cfg()
1635 static inline void restore_pm_trace(struct spu_state *csa, struct spu *spu) in restore_pm_trace() argument
1643 static inline void restore_spu_npc(struct spu_state *csa, struct spu *spu) in restore_spu_npc() argument
1645 struct spu_problem __iomem *prob = spu->problem; in restore_spu_npc()
1654 static inline void restore_spu_mb(struct spu_state *csa, struct spu *spu) in restore_spu_mb() argument
1656 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_spu_mb()
1671 static inline void check_ppu_mb_stat(struct spu_state *csa, struct spu *spu) in check_ppu_mb_stat() argument
1673 struct spu_problem __iomem *prob = spu->problem; in check_ppu_mb_stat()
1686 static inline void check_ppuint_mb_stat(struct spu_state *csa, struct spu *spu) in check_ppuint_mb_stat() argument
1688 struct spu_priv2 __iomem *priv2 = spu->priv2; in check_ppuint_mb_stat()
1698 spu_int_stat_clear(spu, 2, CLASS2_ENABLE_MAILBOX_INTR); in check_ppuint_mb_stat()
1703 static inline void restore_mfc_sr1(struct spu_state *csa, struct spu *spu) in restore_mfc_sr1() argument
1708 spu_mfc_sr1_set(spu, csa->priv1.mfc_sr1_RW); in restore_mfc_sr1()
1712 static inline void set_int_route(struct spu_state *csa, struct spu *spu) in set_int_route() argument
1714 struct spu_context *ctx = spu->ctx; in set_int_route()
1716 spu_cpu_affinity_set(spu, ctx->last_ran); in set_int_route()
1720 struct spu *spu) in restore_other_spu_access() argument
1727 static inline void restore_spu_runcntl(struct spu_state *csa, struct spu *spu) in restore_spu_runcntl() argument
1729 struct spu_problem __iomem *prob = spu->problem; in restore_spu_runcntl()
1741 static inline void restore_mfc_cntl(struct spu_state *csa, struct spu *spu) in restore_mfc_cntl() argument
1743 struct spu_priv2 __iomem *priv2 = spu->priv2; in restore_mfc_cntl()
1761 static inline void enable_user_access(struct spu_state *csa, struct spu *spu) in enable_user_access() argument
1771 static inline void reset_switch_active(struct spu_state *csa, struct spu *spu) in reset_switch_active() argument
1779 static inline void reenable_interrupts(struct spu_state *csa, struct spu *spu) in reenable_interrupts() argument
1784 spin_lock_irq(&spu->register_lock); in reenable_interrupts()
1785 spu_int_mask_set(spu, 0, csa->priv1.int_mask_class0_RW); in reenable_interrupts()
1786 spu_int_mask_set(spu, 1, csa->priv1.int_mask_class1_RW); in reenable_interrupts()
1787 spu_int_mask_set(spu, 2, csa->priv1.int_mask_class2_RW); in reenable_interrupts()
1788 spin_unlock_irq(&spu->register_lock); in reenable_interrupts()
1791 static int quiece_spu(struct spu_state *prev, struct spu *spu) in quiece_spu() argument
1803 if (check_spu_isolate(prev, spu)) { /* Step 2. */ in quiece_spu()
1806 disable_interrupts(prev, spu); /* Step 3. */ in quiece_spu()
1807 set_watchdog_timer(prev, spu); /* Step 4. */ in quiece_spu()
1808 inhibit_user_access(prev, spu); /* Step 5. */ in quiece_spu()
1809 if (check_spu_isolate(prev, spu)) { /* Step 6. */ in quiece_spu()
1812 set_switch_pending(prev, spu); /* Step 7. */ in quiece_spu()
1813 save_mfc_cntl(prev, spu); /* Step 8. */ in quiece_spu()
1814 save_spu_runcntl(prev, spu); /* Step 9. */ in quiece_spu()
1815 save_mfc_sr1(prev, spu); /* Step 10. */ in quiece_spu()
1816 save_spu_status(prev, spu); /* Step 11. */ in quiece_spu()
1817 save_mfc_stopped_status(prev, spu); /* Step 12. */ in quiece_spu()
1818 halt_mfc_decr(prev, spu); /* Step 13. */ in quiece_spu()
1819 save_timebase(prev, spu); /* Step 14. */ in quiece_spu()
1820 remove_other_spu_access(prev, spu); /* Step 15. */ in quiece_spu()
1821 do_mfc_mssync(prev, spu); /* Step 16. */ in quiece_spu()
1822 issue_mfc_tlbie(prev, spu); /* Step 17. */ in quiece_spu()
1823 handle_pending_interrupts(prev, spu); /* Step 18. */ in quiece_spu()
1828 static void save_csa(struct spu_state *prev, struct spu *spu) in save_csa() argument
1835 save_mfc_queues(prev, spu); /* Step 19. */ in save_csa()
1836 save_ppu_querymask(prev, spu); /* Step 20. */ in save_csa()
1837 save_ppu_querytype(prev, spu); /* Step 21. */ in save_csa()
1838 save_ppu_tagstatus(prev, spu); /* NEW. */ in save_csa()
1839 save_mfc_csr_tsq(prev, spu); /* Step 22. */ in save_csa()
1840 save_mfc_csr_cmd(prev, spu); /* Step 23. */ in save_csa()
1841 save_mfc_csr_ato(prev, spu); /* Step 24. */ in save_csa()
1842 save_mfc_tclass_id(prev, spu); /* Step 25. */ in save_csa()
1843 set_mfc_tclass_id(prev, spu); /* Step 26. */ in save_csa()
1844 save_mfc_cmd(prev, spu); /* Step 26a - moved from 44. */ in save_csa()
1845 purge_mfc_queue(prev, spu); /* Step 27. */ in save_csa()
1846 wait_purge_complete(prev, spu); /* Step 28. */ in save_csa()
1847 setup_mfc_sr1(prev, spu); /* Step 30. */ in save_csa()
1848 save_spu_npc(prev, spu); /* Step 31. */ in save_csa()
1849 save_spu_privcntl(prev, spu); /* Step 32. */ in save_csa()
1850 reset_spu_privcntl(prev, spu); /* Step 33. */ in save_csa()
1851 save_spu_lslr(prev, spu); /* Step 34. */ in save_csa()
1852 reset_spu_lslr(prev, spu); /* Step 35. */ in save_csa()
1853 save_spu_cfg(prev, spu); /* Step 36. */ in save_csa()
1854 save_pm_trace(prev, spu); /* Step 37. */ in save_csa()
1855 save_mfc_rag(prev, spu); /* Step 38. */ in save_csa()
1856 save_ppu_mb_stat(prev, spu); /* Step 39. */ in save_csa()
1857 save_ppu_mb(prev, spu); /* Step 40. */ in save_csa()
1858 save_ppuint_mb(prev, spu); /* Step 41. */ in save_csa()
1859 save_ch_part1(prev, spu); /* Step 42. */ in save_csa()
1860 save_spu_mb(prev, spu); /* Step 43. */ in save_csa()
1861 reset_ch(prev, spu); /* Step 45. */ in save_csa()
1864 static void save_lscsa(struct spu_state *prev, struct spu *spu) in save_lscsa() argument
1872 resume_mfc_queue(prev, spu); /* Step 46. */ in save_lscsa()
1874 setup_mfc_slbs(prev, spu, spu_save_code, sizeof(spu_save_code)); in save_lscsa()
1875 set_switch_active(prev, spu); /* Step 48. */ in save_lscsa()
1876 enable_interrupts(prev, spu); /* Step 49. */ in save_lscsa()
1877 save_ls_16kb(prev, spu); /* Step 50. */ in save_lscsa()
1878 set_spu_npc(prev, spu); /* Step 51. */ in save_lscsa()
1879 set_signot1(prev, spu); /* Step 52. */ in save_lscsa()
1880 set_signot2(prev, spu); /* Step 53. */ in save_lscsa()
1881 send_save_code(prev, spu); /* Step 54. */ in save_lscsa()
1882 set_ppu_querymask(prev, spu); /* Step 55. */ in save_lscsa()
1883 wait_tag_complete(prev, spu); /* Step 56. */ in save_lscsa()
1884 wait_spu_stopped(prev, spu); /* Step 57. */ in save_lscsa()
1887 static void force_spu_isolate_exit(struct spu *spu) in force_spu_isolate_exit() argument
1889 struct spu_problem __iomem *prob = spu->problem; in force_spu_isolate_exit()
1890 struct spu_priv2 __iomem *priv2 = spu->priv2; in force_spu_isolate_exit()
1898 spu_mfc_sr1_set(spu, MFC_STATE1_MASTER_RUN_CONTROL_MASK); in force_spu_isolate_exit()
1919 static void stop_spu_isolate(struct spu *spu) in stop_spu_isolate() argument
1921 struct spu_problem __iomem *prob = spu->problem; in stop_spu_isolate()
1928 force_spu_isolate_exit(spu); in stop_spu_isolate()
1932 static void harvest(struct spu_state *prev, struct spu *spu) in harvest() argument
1940 disable_interrupts(prev, spu); /* Step 2. */ in harvest()
1941 inhibit_user_access(prev, spu); /* Step 3. */ in harvest()
1942 terminate_spu_app(prev, spu); /* Step 4. */ in harvest()
1943 set_switch_pending(prev, spu); /* Step 5. */ in harvest()
1944 stop_spu_isolate(spu); /* NEW. */ in harvest()
1945 remove_other_spu_access(prev, spu); /* Step 6. */ in harvest()
1946 suspend_mfc_and_halt_decr(prev, spu); /* Step 7. */ in harvest()
1947 wait_suspend_mfc_complete(prev, spu); /* Step 8. */ in harvest()
1948 if (!suspend_spe(prev, spu)) /* Step 9. */ in harvest()
1949 clear_spu_status(prev, spu); /* Step 10. */ in harvest()
1950 do_mfc_mssync(prev, spu); /* Step 11. */ in harvest()
1951 issue_mfc_tlbie(prev, spu); /* Step 12. */ in harvest()
1952 handle_pending_interrupts(prev, spu); /* Step 13. */ in harvest()
1953 purge_mfc_queue(prev, spu); /* Step 14. */ in harvest()
1954 wait_purge_complete(prev, spu); /* Step 15. */ in harvest()
1955 reset_spu_privcntl(prev, spu); /* Step 16. */ in harvest()
1956 reset_spu_lslr(prev, spu); /* Step 17. */ in harvest()
1957 setup_mfc_sr1(prev, spu); /* Step 18. */ in harvest()
1958 spu_invalidate_slbs(spu); /* Step 19. */ in harvest()
1959 reset_ch_part1(prev, spu); /* Step 20. */ in harvest()
1960 reset_ch_part2(prev, spu); /* Step 21. */ in harvest()
1961 enable_interrupts(prev, spu); /* Step 22. */ in harvest()
1962 set_switch_active(prev, spu); /* Step 23. */ in harvest()
1963 set_mfc_tclass_id(prev, spu); /* Step 24. */ in harvest()
1964 resume_mfc_queue(prev, spu); /* Step 25. */ in harvest()
1967 static void restore_lscsa(struct spu_state *next, struct spu *spu) in restore_lscsa() argument
1975 set_watchdog_timer(next, spu); /* Step 26. */ in restore_lscsa()
1976 setup_spu_status_part1(next, spu); /* Step 27. */ in restore_lscsa()
1977 setup_spu_status_part2(next, spu); /* Step 28. */ in restore_lscsa()
1978 restore_mfc_rag(next, spu); /* Step 29. */ in restore_lscsa()
1980 setup_mfc_slbs(next, spu, spu_restore_code, sizeof(spu_restore_code)); in restore_lscsa()
1981 set_spu_npc(next, spu); /* Step 31. */ in restore_lscsa()
1982 set_signot1(next, spu); /* Step 32. */ in restore_lscsa()
1983 set_signot2(next, spu); /* Step 33. */ in restore_lscsa()
1984 setup_decr(next, spu); /* Step 34. */ in restore_lscsa()
1985 setup_ppu_mb(next, spu); /* Step 35. */ in restore_lscsa()
1986 setup_ppuint_mb(next, spu); /* Step 36. */ in restore_lscsa()
1987 send_restore_code(next, spu); /* Step 37. */ in restore_lscsa()
1988 set_ppu_querymask(next, spu); /* Step 38. */ in restore_lscsa()
1989 wait_tag_complete(next, spu); /* Step 39. */ in restore_lscsa()
1990 wait_spu_stopped(next, spu); /* Step 40. */ in restore_lscsa()
1993 static void restore_csa(struct spu_state *next, struct spu *spu) in restore_csa() argument
2000 restore_spu_privcntl(next, spu); /* Step 41. */ in restore_csa()
2001 restore_status_part1(next, spu); /* Step 42. */ in restore_csa()
2002 restore_status_part2(next, spu); /* Step 43. */ in restore_csa()
2003 restore_ls_16kb(next, spu); /* Step 44. */ in restore_csa()
2004 wait_tag_complete(next, spu); /* Step 45. */ in restore_csa()
2005 suspend_mfc(next, spu); /* Step 46. */ in restore_csa()
2006 wait_suspend_mfc_complete(next, spu); /* Step 47. */ in restore_csa()
2007 issue_mfc_tlbie(next, spu); /* Step 48. */ in restore_csa()
2008 clear_interrupts(next, spu); /* Step 49. */ in restore_csa()
2009 restore_mfc_queues(next, spu); /* Step 50. */ in restore_csa()
2010 restore_ppu_querymask(next, spu); /* Step 51. */ in restore_csa()
2011 restore_ppu_querytype(next, spu); /* Step 52. */ in restore_csa()
2012 restore_mfc_csr_tsq(next, spu); /* Step 53. */ in restore_csa()
2013 restore_mfc_csr_cmd(next, spu); /* Step 54. */ in restore_csa()
2014 restore_mfc_csr_ato(next, spu); /* Step 55. */ in restore_csa()
2015 restore_mfc_tclass_id(next, spu); /* Step 56. */ in restore_csa()
2016 set_llr_event(next, spu); /* Step 57. */ in restore_csa()
2017 restore_decr_wrapped(next, spu); /* Step 58. */ in restore_csa()
2018 restore_ch_part1(next, spu); /* Step 59. */ in restore_csa()
2019 restore_ch_part2(next, spu); /* Step 60. */ in restore_csa()
2020 restore_spu_lslr(next, spu); /* Step 61. */ in restore_csa()
2021 restore_spu_cfg(next, spu); /* Step 62. */ in restore_csa()
2022 restore_pm_trace(next, spu); /* Step 63. */ in restore_csa()
2023 restore_spu_npc(next, spu); /* Step 64. */ in restore_csa()
2024 restore_spu_mb(next, spu); /* Step 65. */ in restore_csa()
2025 check_ppu_mb_stat(next, spu); /* Step 66. */ in restore_csa()
2026 check_ppuint_mb_stat(next, spu); /* Step 67. */ in restore_csa()
2027 spu_invalidate_slbs(spu); /* Modified Step 68. */ in restore_csa()
2028 restore_mfc_sr1(next, spu); /* Step 69. */ in restore_csa()
2029 set_int_route(next, spu); /* NEW */ in restore_csa()
2030 restore_other_spu_access(next, spu); /* Step 70. */ in restore_csa()
2031 restore_spu_runcntl(next, spu); /* Step 71. */ in restore_csa()
2032 restore_mfc_cntl(next, spu); /* Step 72. */ in restore_csa()
2033 enable_user_access(next, spu); /* Step 73. */ in restore_csa()
2034 reset_switch_active(next, spu); /* Step 74. */ in restore_csa()
2035 reenable_interrupts(next, spu); /* Step 75. */ in restore_csa()
2038 static int __do_spu_save(struct spu_state *prev, struct spu *spu) in __do_spu_save() argument
2054 rc = quiece_spu(prev, spu); /* Steps 2-16. */ in __do_spu_save()
2059 harvest(prev, spu); in __do_spu_save()
2065 save_csa(prev, spu); /* Steps 17-43. */ in __do_spu_save()
2066 save_lscsa(prev, spu); /* Steps 44-53. */ in __do_spu_save()
2067 return check_save_status(prev, spu); /* Step 54. */ in __do_spu_save()
2070 static int __do_spu_restore(struct spu_state *next, struct spu *spu) in __do_spu_restore() argument
2085 restore_lscsa(next, spu); /* Steps 24-39. */ in __do_spu_restore()
2086 rc = check_restore_status(next, spu); /* Step 40. */ in __do_spu_restore()
2096 restore_csa(next, spu); in __do_spu_restore()
2108 int spu_save(struct spu_state *prev, struct spu *spu) in spu_save() argument
2112 acquire_spu_lock(spu); /* Step 1. */ in spu_save()
2113 rc = __do_spu_save(prev, spu); /* Steps 2-53. */ in spu_save()
2114 release_spu_lock(spu); in spu_save()
2117 __func__, spu->number, rc); in spu_save()
2132 int spu_restore(struct spu_state *new, struct spu *spu) in spu_restore() argument
2136 acquire_spu_lock(spu); in spu_restore()
2137 harvest(NULL, spu); in spu_restore()
2138 spu->slb_replace = 0; in spu_restore()
2139 rc = __do_spu_restore(new, spu); in spu_restore()
2140 release_spu_lock(spu); in spu_restore()
2143 __func__, spu->number, rc); in spu_restore()