aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c58
-rw-r--r--include/asm-powerpc/spu.h9
2 files changed, 67 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index d78b0af038e6..b75b091098ef 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -333,6 +333,7 @@ static void spu_free_irqs(struct spu *spu)
333} 333}
334 334
335static struct list_head spu_list[MAX_NUMNODES]; 335static struct list_head spu_list[MAX_NUMNODES];
336static LIST_HEAD(spu_full_list);
336static DEFINE_MUTEX(spu_mutex); 337static DEFINE_MUTEX(spu_mutex);
337 338
338static void spu_init_channels(struct spu *spu) 339static void spu_init_channels(struct spu *spu)
@@ -744,6 +745,57 @@ struct sysdev_class spu_sysdev_class = {
744 set_kset_name("spu") 745 set_kset_name("spu")
745}; 746};
746 747
748int spu_add_sysdev_attr(struct sysdev_attribute *attr)
749{
750 struct spu *spu;
751 mutex_lock(&spu_mutex);
752
753 list_for_each_entry(spu, &spu_full_list, full_list)
754 sysdev_create_file(&spu->sysdev, attr);
755
756 mutex_unlock(&spu_mutex);
757 return 0;
758}
759EXPORT_SYMBOL_GPL(spu_add_sysdev_attr);
760
761int spu_add_sysdev_attr_group(struct attribute_group *attrs)
762{
763 struct spu *spu;
764 mutex_lock(&spu_mutex);
765
766 list_for_each_entry(spu, &spu_full_list, full_list)
767 sysfs_create_group(&spu->sysdev.kobj, attrs);
768
769 mutex_unlock(&spu_mutex);
770 return 0;
771}
772EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group);
773
774
775void spu_remove_sysdev_attr(struct sysdev_attribute *attr)
776{
777 struct spu *spu;
778 mutex_lock(&spu_mutex);
779
780 list_for_each_entry(spu, &spu_full_list, full_list)
781 sysdev_remove_file(&spu->sysdev, attr);
782
783 mutex_unlock(&spu_mutex);
784}
785EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr);
786
787void spu_remove_sysdev_attr_group(struct attribute_group *attrs)
788{
789 struct spu *spu;
790 mutex_lock(&spu_mutex);
791
792 list_for_each_entry(spu, &spu_full_list, full_list)
793 sysfs_remove_group(&spu->sysdev.kobj, attrs);
794
795 mutex_unlock(&spu_mutex);
796}
797EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr_group);
798
747static int spu_create_sysdev(struct spu *spu) 799static int spu_create_sysdev(struct spu *spu)
748{ 800{
749 int ret; 801 int ret;
@@ -817,6 +869,9 @@ static int __init create_spu(struct device_node *spe)
817 goto out_free_irqs; 869 goto out_free_irqs;
818 870
819 list_add(&spu->list, &spu_list[spu->node]); 871 list_add(&spu->list, &spu_list[spu->node]);
872 list_add(&spu->full_list, &spu_full_list);
873 spu->devnode = of_node_get(spe);
874
820 mutex_unlock(&spu_mutex); 875 mutex_unlock(&spu_mutex);
821 876
822 pr_debug(KERN_DEBUG "Using SPE %s %p %p %p %p %d\n", 877 pr_debug(KERN_DEBUG "Using SPE %s %p %p %p %p %d\n",
@@ -839,6 +894,9 @@ out:
839static void destroy_spu(struct spu *spu) 894static void destroy_spu(struct spu *spu)
840{ 895{
841 list_del_init(&spu->list); 896 list_del_init(&spu->list);
897 list_del_init(&spu->full_list);
898
899 of_node_put(spu->devnode);
842 900
843 spu_destroy_sysdev(spu); 901 spu_destroy_sysdev(spu);
844 spu_free_irqs(spu); 902 spu_free_irqs(spu);
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 704e8a8d2ebd..ffa4df083609 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -115,6 +115,7 @@ struct spu {
115 struct spu_priv2 __iomem *priv2; 115 struct spu_priv2 __iomem *priv2;
116 struct list_head list; 116 struct list_head list;
117 struct list_head sched_list; 117 struct list_head sched_list;
118 struct list_head full_list;
118 int number; 119 int number;
119 int nid; 120 int nid;
120 unsigned int irqs[3]; 121 unsigned int irqs[3];
@@ -143,6 +144,8 @@ struct spu {
143 char irq_c1[8]; 144 char irq_c1[8];
144 char irq_c2[8]; 145 char irq_c2[8];
145 146
147 struct device_node *devnode;
148
146 struct sys_device sysdev; 149 struct sys_device sysdev;
147}; 150};
148 151
@@ -200,6 +203,12 @@ static inline void unregister_spu_syscalls(struct spufs_calls *calls)
200} 203}
201#endif /* MODULE */ 204#endif /* MODULE */
202 205
206int spu_add_sysdev_attr(struct sysdev_attribute *attr);
207void spu_remove_sysdev_attr(struct sysdev_attribute *attr);
208
209int spu_add_sysdev_attr_group(struct attribute_group *attrs);
210void spu_remove_sysdev_attr_group(struct attribute_group *attrs);
211
203 212
204/* 213/*
205 * Notifier blocks: 214 * Notifier blocks: