Lines Matching refs:hwt
162 #define mtspr_XDN(hwt, name, val) \ argument
163 do { (void)(hwt); __insn_mtspr(SPR_UDN_##name, (val)); } while (0)
164 #define mtspr_MPL_XDN(hwt, name, val) \ argument
165 do { (void)(hwt); __insn_mtspr(SPR_MPL_UDN_##name, (val)); } while (0)
166 #define mfspr_XDN(hwt, name) \ argument
167 ((void)(hwt), __insn_mfspr(SPR_UDN_##name))
169 #define mtspr_XDN(hwt, name, val) \ argument
171 if ((hwt)->is_idn) \
176 #define mtspr_MPL_XDN(hwt, name, val) \ argument
178 if ((hwt)->is_idn) \
183 #define mfspr_XDN(hwt, name) \ argument
184 ((hwt)->is_idn ? __insn_mfspr(SPR_IDN_##name) : __insn_mfspr(SPR_UDN_##name))
250 static inline int xdn_which_interrupt(struct hardwall_type *hwt) in xdn_which_interrupt() argument
253 if (hwt->is_idn) in xdn_which_interrupt()
259 static void enable_firewall_interrupts(struct hardwall_type *hwt) in enable_firewall_interrupts() argument
261 arch_local_irq_unmask_now(xdn_which_interrupt(hwt)); in enable_firewall_interrupts()
264 static void disable_firewall_interrupts(struct hardwall_type *hwt) in disable_firewall_interrupts() argument
266 arch_local_irq_mask_now(xdn_which_interrupt(hwt)); in disable_firewall_interrupts()
273 struct hardwall_type *hwt = r->type; in hardwall_setup_func() local
288 mtspr_XDN(hwt, DIRECTION_PROTECT, bits); in hardwall_setup_func()
289 enable_firewall_interrupts(hwt); in hardwall_setup_func()
324 struct hardwall_type *hwt; in do_hardwall_trap() local
337 hwt = &hardwall_types[HARDWALL_IDN]; in do_hardwall_trap()
341 hwt = &hardwall_types[HARDWALL_UDN]; in do_hardwall_trap()
346 BUG_ON(hwt->disabled); in do_hardwall_trap()
349 spin_lock(&hwt->lock); in do_hardwall_trap()
350 list_for_each_entry(rect, &hwt->list, list) { in do_hardwall_trap()
360 BUG_ON(&rect->list == &hwt->list); in do_hardwall_trap()
370 cpu, hwt->name, in do_hardwall_trap()
371 (long)mfspr_XDN(hwt, DIRECTION_PROTECT)); in do_hardwall_trap()
386 cpu, hwt->name, (long)mfspr_XDN(hwt, DIRECTION_PROTECT)); in do_hardwall_trap()
392 thread.hardwall[hwt->index].list) { in do_hardwall_trap()
393 BUG_ON(p->thread.hardwall[hwt->index].info != rect); in do_hardwall_trap()
404 spin_unlock(&hwt->lock); in do_hardwall_trap()
413 disable_firewall_interrupts(hwt); in do_hardwall_trap()
420 void grant_hardwall_mpls(struct hardwall_type *hwt) in grant_hardwall_mpls() argument
423 if (!hwt->is_xdn) { in grant_hardwall_mpls()
428 mtspr_MPL_XDN(hwt, ACCESS_SET_0, 1); in grant_hardwall_mpls()
429 mtspr_MPL_XDN(hwt, AVAIL_SET_0, 1); in grant_hardwall_mpls()
430 mtspr_MPL_XDN(hwt, COMPLETE_SET_0, 1); in grant_hardwall_mpls()
431 mtspr_MPL_XDN(hwt, TIMER_SET_0, 1); in grant_hardwall_mpls()
433 mtspr_MPL_XDN(hwt, REFILL_SET_0, 1); in grant_hardwall_mpls()
434 mtspr_MPL_XDN(hwt, CA_SET_0, 1); in grant_hardwall_mpls()
439 void restrict_hardwall_mpls(struct hardwall_type *hwt) in restrict_hardwall_mpls() argument
442 if (!hwt->is_xdn) { in restrict_hardwall_mpls()
447 mtspr_MPL_XDN(hwt, ACCESS_SET_1, 1); in restrict_hardwall_mpls()
448 mtspr_MPL_XDN(hwt, AVAIL_SET_1, 1); in restrict_hardwall_mpls()
449 mtspr_MPL_XDN(hwt, COMPLETE_SET_1, 1); in restrict_hardwall_mpls()
450 mtspr_MPL_XDN(hwt, TIMER_SET_1, 1); in restrict_hardwall_mpls()
452 mtspr_MPL_XDN(hwt, REFILL_SET_1, 1); in restrict_hardwall_mpls()
453 mtspr_MPL_XDN(hwt, CA_SET_1, 1); in restrict_hardwall_mpls()
489 static struct hardwall_info *hardwall_create(struct hardwall_type *hwt, in hardwall_create() argument
530 info->type = hwt; in hardwall_create()
535 if (hwt->is_xdn) { in hardwall_create()
552 spin_lock_irqsave(&hwt->lock, flags); in hardwall_create()
553 list_for_each_entry(iter, &hwt->list, list) { in hardwall_create()
555 spin_unlock_irqrestore(&hwt->lock, flags); in hardwall_create()
560 list_add_tail(&info->list, &hwt->list); in hardwall_create()
561 spin_unlock_irqrestore(&hwt->lock, flags); in hardwall_create()
564 if (hwt->is_xdn) in hardwall_create()
580 struct hardwall_type *hwt; in hardwall_activate() local
604 hwt = info->type; in hardwall_activate()
605 if (ts->hardwall[hwt->index].info) { in hardwall_activate()
606 BUG_ON(ts->hardwall[hwt->index].info != info); in hardwall_activate()
611 ts->hardwall[hwt->index].info = info; in hardwall_activate()
612 spin_lock_irqsave(&hwt->lock, flags); in hardwall_activate()
613 list_add(&ts->hardwall[hwt->index].list, &info->task_head); in hardwall_activate()
614 spin_unlock_irqrestore(&hwt->lock, flags); in hardwall_activate()
615 grant_hardwall_mpls(hwt); in hardwall_activate()
617 p->pid, p->comm, hwt->name, cpu); in hardwall_activate()
627 static void _hardwall_deactivate(struct hardwall_type *hwt, in _hardwall_deactivate() argument
635 task->pid, task->comm, hwt->name, in _hardwall_deactivate()
640 BUG_ON(ts->hardwall[hwt->index].info == NULL); in _hardwall_deactivate()
641 ts->hardwall[hwt->index].info = NULL; in _hardwall_deactivate()
642 list_del(&ts->hardwall[hwt->index].list); in _hardwall_deactivate()
644 restrict_hardwall_mpls(hwt); in _hardwall_deactivate()
648 static int hardwall_deactivate(struct hardwall_type *hwt, in hardwall_deactivate() argument
654 spin_lock_irqsave(&hwt->lock, flags); in hardwall_deactivate()
655 activated = (task->thread.hardwall[hwt->index].info != NULL); in hardwall_deactivate()
657 _hardwall_deactivate(hwt, task); in hardwall_deactivate()
658 spin_unlock_irqrestore(&hwt->lock, flags); in hardwall_deactivate()
664 task->pid, task->comm, hwt->name, raw_smp_processor_id()); in hardwall_deactivate()
697 struct hardwall_type *hwt = arg; in stop_xdn_switch()
698 unsigned long protect = mfspr_XDN(hwt, DIRECTION_PROTECT); in stop_xdn_switch()
699 mtspr_XDN(hwt, DIRECTION_PROTECT, (protect | C_PROTECT) << 5); in stop_xdn_switch()
703 static void empty_xdn_demuxes(struct hardwall_type *hwt) in empty_xdn_demuxes() argument
706 if (hwt->is_idn) { in empty_xdn_demuxes()
728 struct hardwall_type *hwt = info->type; in drain_xdn_switch() local
738 int pending = mfspr_XDN(hwt, PENDING); in drain_xdn_switch()
740 empty_xdn_demuxes(hwt); in drain_xdn_switch()
741 if (hwt->is_idn) in drain_xdn_switch()
748 empty_xdn_demuxes(hwt); in drain_xdn_switch()
769 empty_xdn_demuxes(hwt); in drain_xdn_switch()
792 static void reset_xdn_network_state(struct hardwall_type *hwt) in reset_xdn_network_state() argument
794 if (hwt->disabled) in reset_xdn_network_state()
798 mtspr_XDN(hwt, DIRECTION_PROTECT, 0); in reset_xdn_network_state()
799 mtspr_XDN(hwt, AVAIL_EN, 0); in reset_xdn_network_state()
800 mtspr_XDN(hwt, DEADLOCK_TIMEOUT, 0); in reset_xdn_network_state()
839 struct hardwall_type *hwt = arg; in restart_xdn_switch() local
843 empty_xdn_demuxes(hwt); in restart_xdn_switch()
846 reset_xdn_network_state(hwt); in restart_xdn_switch()
849 disable_firewall_interrupts(hwt); in restart_xdn_switch()
856 struct hardwall_type *hwt; in hardwall_destroy() local
870 hwt = info->type; in hardwall_destroy()
872 spin_lock_irqsave(&hwt->lock, flags); in hardwall_destroy()
874 thread.hardwall[hwt->index].list) in hardwall_destroy()
875 _hardwall_deactivate(hwt, task); in hardwall_destroy()
876 spin_unlock_irqrestore(&hwt->lock, flags); in hardwall_destroy()
878 if (hwt->is_xdn) { in hardwall_destroy()
882 hwt->name, info->width, info->height, in hardwall_destroy()
884 on_each_cpu_mask(&info->cpumask, stop_xdn_switch, hwt, 1); in hardwall_destroy()
896 on_each_cpu_mask(&info->cpumask, restart_xdn_switch, hwt, 1); in hardwall_destroy()
903 spin_lock_irqsave(&hwt->lock, flags); in hardwall_destroy()
906 spin_unlock_irqrestore(&hwt->lock, flags); in hardwall_destroy()
967 struct hardwall_type *hwt = &hardwall_types[i]; in proc_tile_hardwall_init() local
968 if (hwt->disabled) in proc_tile_hardwall_init()
972 hwt->proc_dir = proc_mkdir(hwt->name, hardwall_proc_dir); in proc_tile_hardwall_init()
985 struct hardwall_type* hwt; in hardwall_ioctl() local
996 hwt = &hardwall_types[minor]; in hardwall_ioctl()
997 WARN_ON(info && hwt != info->type); in hardwall_ioctl()
1001 if (hwt->disabled) in hardwall_ioctl()
1005 info = hardwall_create(hwt, _IOC_SIZE(a), in hardwall_ioctl()
1016 if (current->thread.hardwall[hwt->index].info != info) in hardwall_ioctl()
1018 return hardwall_deactivate(hwt, current); in hardwall_ioctl()
1054 struct hardwall_type *hwt = info->type; in hardwall_flush() local
1055 spin_lock_irqsave(&hwt->lock, flags); in hardwall_flush()
1057 thread.hardwall[hwt->index].list) { in hardwall_flush()
1059 _hardwall_deactivate(hwt, task); in hardwall_flush()
1061 spin_unlock_irqrestore(&hwt->lock, flags); in hardwall_flush()