rpms/kernel/devel linux-2.6-ps3-drivers-only-on-ps3.patch, NONE, 1.1 kernel-2.6.spec, 1.3108, 1.3109 linux-2.6-cell-spu-device-tree.patch, 1.4, 1.5

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Apr 24 21:48:56 UTC 2007


Author: dwmw2

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv17574

Modified Files:
	kernel-2.6.spec linux-2.6-cell-spu-device-tree.patch 
Added Files:
	linux-2.6-ps3-drivers-only-on-ps3.patch 
Log Message:
Fix SPU patches on QS21, don't try to init PS3 drivers on non-PS3

linux-2.6-ps3-drivers-only-on-ps3.patch:
 arch/powerpc/platforms/ps3/device-init.c |    4 ++++
 drivers/net/gelic_net.c                  |    5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

--- NEW FILE linux-2.6-ps3-drivers-only-on-ps3.patch ---
commit 8c1099f5198da6c3457dc9c229df7121afec0b81
Author: Geoff Levand <geoffrey.levand at am.sony.com>
Date:   Wed Apr 18 11:45:33 2007 -0700

    [PS3] Add firmware_has_feature to device-init, gelic.

diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index 63bea8f..a832889 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -22,6 +22,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <asm/firmware.h>
 
 #include "platform.h"
 
@@ -439,6 +440,9 @@ ps3_register_known_devices (void)
 {
 	int result;
 
+	if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
+		return -ENODEV;
+
 	pr_debug(" -> %s:%d\n", __func__, __LINE__);
 
 	//ps3_repository_dump_bus_info();
diff --git a/drivers/net/gelic_net.c b/drivers/net/gelic_net.c
index 1169960..2588a4a 100644
--- a/drivers/net/gelic_net.c
+++ b/drivers/net/gelic_net.c
@@ -56,6 +56,7 @@
 #include <asm/pci-bridge.h>
 #include <net/checksum.h>
 #include <asm/io.h>
+#include <asm/firmware.h>
 #include <asm/ps3.h>
 #include <asm/lv1call.h>
 
@@ -1849,7 +1850,9 @@ static struct ps3_system_bus_driver ps3_gelic_driver = {
 static int __init
 ps3_gelic_driver_init (void)
 {
-	return ps3_system_bus_driver_register(&ps3_gelic_driver);
+	return firmware_has_feature(FW_FEATURE_PS3_LV1)
+		? ps3_system_bus_driver_register(&ps3_gelic_driver)
+		: -ENODEV;
 }
 
 static void __exit


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.3108
retrieving revision 1.3109
diff -u -r1.3108 -r1.3109
--- kernel-2.6.spec	24 Apr 2007 17:03:10 -0000	1.3108
+++ kernel-2.6.spec	24 Apr 2007 21:48:53 -0000	1.3109
@@ -440,6 +440,7 @@
 Patch359: linux-2.6-ps3-ehci-iso.patch
 Patch360: linux-2.6-ps3-wrap-spu-runctl.patch
 Patch361: linux-2.6-ps3-clear-spu-irq.patch
+Patch362: linux-2.6-ps3-drivers-only-on-ps3.patch
 
 # And then some minor tweaks...
 Patch370: linux-2.6-ps3-memory-probe.patch
@@ -1091,6 +1092,7 @@
 %patch359 -p1
 %patch360 -p1
 %patch361 -p1
+%patch362 -p1
 
 %patch370 -p1
 %patch371 -p1

linux-2.6-cell-spu-device-tree.patch:
 arch/powerpc/oprofile/op_model_cell.c  |    1 
 arch/powerpc/platforms/cell/cbe_regs.c |   54 +++++++++++++++++++++++----------
 arch/powerpc/platforms/cell/cbe_regs.h |    5 +++
 include/asm-powerpc/cell-pmu.h         |    5 ---
 include/asm/cell-pmu.h                 |    5 ---
 5 files changed, 45 insertions(+), 25 deletions(-)

Index: linux-2.6-cell-spu-device-tree.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-cell-spu-device-tree.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- linux-2.6-cell-spu-device-tree.patch	24 Apr 2007 11:42:37 -0000	1.4
+++ linux-2.6-cell-spu-device-tree.patch	24 Apr 2007 21:48:53 -0000	1.5
@@ -1,267 +1,195 @@
-Index: linux-2.6/arch/powerpc/sysdev/pmi.c
-===================================================================
---- linux-2.6.orig/arch/powerpc/sysdev/pmi.c
-+++ linux-2.6/arch/powerpc/sysdev/pmi.c
-@@ -33,7 +33,7 @@
- #include <asm/of_platform.h>
- #include <asm/io.h>
- #include <asm/pmi.h>
--
-+#include <asm/prom.h>
- 
- struct pmi_data {
- 	struct list_head	handler;
-@@ -49,21 +49,6 @@ struct pmi_data {
- };
- 
- 
--
--static void __iomem *of_iomap(struct device_node *np)
--{
--	struct resource res;
--
--	if (of_address_to_resource(np, 0, &res))
--		return NULL;
--
--	pr_debug("Resource start: 0x%lx\n", res.start);
--	pr_debug("Resource end: 0x%lx\n", res.end);
--
--	return ioremap(res.start, 1 + res.end - res.start);
--}
--
--
- static int pmi_irq_handler(int irq, void *dev_id)
- {
- 	struct pmi_data *data;
-@@ -154,7 +139,7 @@ static int pmi_of_probe(struct of_device
- 		goto out;
- 	}
- 
--	data->pmi_reg = of_iomap(np);
-+	data->pmi_reg = of_iomap(np, 0);
- 	if (!data->pmi_reg) {
- 		printk(KERN_ERR "pmi: invalid register address.\n");
- 		rc = -EFAULT;
-Index: linux-2.6/include/asm-powerpc/prom.h
-===================================================================
---- linux-2.6.orig/include/asm-powerpc/prom.h
-+++ linux-2.6/include/asm-powerpc/prom.h
-@@ -20,6 +20,7 @@
- #include <linux/platform_device.h>
- #include <asm/irq.h>
- #include <asm/atomic.h>
-+#include <asm/io.h>
- 
- /* Definitions used by the flattened device tree */
- #define OF_DT_HEADER		0xd00dfeed	/* marker */
-@@ -355,6 +356,16 @@ static inline int of_irq_to_resource(str
- 	return irq;
- }
- 
-+static inline void __iomem *of_iomap(struct device_node *np, int index)
-+{
-+	struct resource res;
-+
-+	if (of_address_to_resource(np, index, &res))
-+		return NULL;
-+
-+	return ioremap(res.start, 1 + res.end - res.start);
-+}
-+
- 
- #endif /* __KERNEL__ */
- #endif /* _POWERPC_PROM_H */
+Subject: [PATCH 01/10] cell: add cbe_node_to_cpu function
+From: Christian Krafft <krafft at de.ibm.com>
 
---
+This patch adds code to deal with conversion of
+logical cpu to cbe nodes. It removes code that
+assummed there were two logical CPUs per CBE.
 
-_______________________________________________
-Linuxppc-dev mailing list
-Linuxppc-dev at ozlabs.org
-https://ozlabs.org/mailman/listinfo/linuxppc-dev
---- linux-2.6.20.ppc64/arch/powerpc//platforms/cell/cbe_regs.c.orig	2007-04-24 12:37:04.000000000 +0100
-+++ linux-2.6.20.ppc64/arch/powerpc//platforms/cell/cbe_regs.c	2007-04-24 12:36:18.000000000 +0100
-@@ -14,6 +14,8 @@
- #include <asm/pgtable.h>
- #include <asm/prom.h>
- #include <asm/ptrace.h>
-+#include <asm/of_device.h>
-+#include <asm/of_platform.h>
- 
- #include "cbe_regs.h"
- 
-@@ -27,6 +29,7 @@
- static struct cbe_regs_map
- {
- 	struct device_node *cpu_node;
-+	struct device_node *be_node;
- 	struct cbe_pmd_regs __iomem *pmd_regs;
- 	struct cbe_iic_regs __iomem *iic_regs;
- 	struct cbe_mic_tm_regs __iomem *mic_tm_regs;
-@@ -37,6 +40,7 @@ static int cbe_regs_map_count;
- static struct cbe_thread_map
- {
+Signed-off-by: Christian Krafft <krafft at de.ibm.com>
+Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
+
+----------
+
+Subject: [PATCH 07/10] add of_iomap function
+From: Christian Krafft <krafft at de.ibm.com>
+
+The of_iomap function maps memory for a given
+device_node and returns a pointer to that memory.
+This is used at some places, so it makes sense to
+a seperate function.
+
+Signed-off-by: Christian Krafft <krafft at de.ibm.com>
+Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
+
+----------
+
+Subject: [PATCH 08/10] cell: add support for proper device-tree
+From: Christian Krafft <krafft at de.ibm.com>
+
+This patch adds support for a proper device-tree.
+A porper device-tree on cell contains be nodes
+for each CBE containg nodes for SPEs and all the
+other special devices on it.
+Ofcourse oldschool devicetree is still supported.
+
+Signed-off-by: Christian Krafft <krafft at de.ibm.com>
+Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
+
+
+diff -ur linux-2.6.20.ppc64.3108/arch/powerpc/oprofile/op_model_cell.c linux-2.6.20.ppc64/arch/powerpc/oprofile/op_model_cell.c
+--- linux-2.6.20.ppc64.3108/arch/powerpc/oprofile/op_model_cell.c	2007-04-24 18:03:51.000000000 +0100
++++ linux-2.6.20.ppc64/arch/powerpc/oprofile/op_model_cell.c	2007-04-24 19:34:42.000000000 +0100
+@@ -37,6 +37,7 @@
+ #include <asm/system.h>
+ 
+ #include "../platforms/cell/interrupt.h"
++#include "../platforms/cell/cbe_regs.h"
+ 
+ #define PPU_CYCLES_EVENT_NUM 1	/*  event number for CYCLES */
+ #define PPU_CYCLES_GRP_NUM   1  /* special group number for identifying
+diff -ur linux-2.6.20.ppc64.3108/arch/powerpc/platforms/cell/cbe_regs.c linux-2.6.20.ppc64/arch/powerpc/platforms/cell/cbe_regs.c
+--- linux-2.6.20.ppc64.3108/arch/powerpc/platforms/cell/cbe_regs.c	2007-04-24 18:04:00.000000000 +0100
++++ linux-2.6.20.ppc64/arch/powerpc/platforms/cell/cbe_regs.c	2007-04-24 19:39:15.000000000 +0100
+@@ -42,8 +42,13 @@
  	struct device_node *cpu_node;
-+	struct device_node *be_node;
+ 	struct device_node *be_node;
  	struct cbe_regs_map *regs;
++	unsigned int thread_id;
++	unsigned int cbe_id;
  } cbe_thread_map[NR_CPUS];
  
-@@ -45,22 +49,29 @@ static struct cbe_regs_map *cbe_find_map
- 	int i;
- 	struct device_node *tmp_np;
- 
--	if (strcasecmp(np->type, "spe") == 0) {
--		if (np->data == NULL) {
--			/* walk up path until cpu node was found */
--			tmp_np = np->parent;
--			while (tmp_np != NULL && strcasecmp(tmp_np->type, "cpu") != 0)
--				tmp_np = tmp_np->parent;
-+	if (strcasecmp(np->type, "spe")) {
-+		for (i = 0; i < cbe_regs_map_count; i++)
-+			if (cbe_regs_maps[i].cpu_node == np ||
-+			    cbe_regs_maps[i].be_node == np)
-+				return &cbe_regs_maps[i];
-+		return NULL;
-+	}
- 
--			np->data = cbe_find_map(tmp_np);
--		}
-+	if (np->data)
- 		return np->data;
--	}
- 
--	for (i = 0; i < cbe_regs_map_count; i++)
--		if (cbe_regs_maps[i].cpu_node == np)
--			return &cbe_regs_maps[i];
--	return NULL;
-+	/* walk up path until cpu or be node was found */
-+	tmp_np = np;
-+	do {
-+		tmp_np = tmp_np->parent;
-+		/* on a correct devicetree we wont get up to root */
-+		BUG_ON(!tmp_np);
-+	} while (strcasecmp(tmp_np->type, "cpu") &&
-+		 strcasecmp(tmp_np->type, "be"));
-+
-+	np->data = cbe_find_map(tmp_np);
++static cpumask_t cbe_local_mask[MAX_CBE] = { [0 ... MAX_CBE-1] = CPU_MASK_NONE };
++static cpumask_t cbe_first_online_cpu = CPU_MASK_NONE;
 +
-+	return np->data;
+ static struct cbe_regs_map *cbe_find_map(struct device_node *np)
+ {
+ 	int i;
+@@ -141,19 +146,24 @@
  }
+ EXPORT_SYMBOL_GPL(cbe_get_cpu_mic_tm_regs);
  
- struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np)
-@@ -143,26 +154,82 @@ u32 cbe_get_hw_thread_id(int cpu)
+-/* FIXME
+- * This is little more than a stub at the moment.  It should be
+- * fleshed out so that it works for both SMT and non-SMT, no
+- * matter if the passed cpu is odd or even.
+- * For SMT enabled, returns 0 for even-numbered cpu; otherwise 1.
+- * For SMT disabled, returns 0 for all cpus.
+- */
+ u32 cbe_get_hw_thread_id(int cpu)
+ {
+-	return (cpu & 1);
++	return cbe_thread_map[cpu].thread_id;
  }
  EXPORT_SYMBOL_GPL(cbe_get_hw_thread_id);
  
-+static struct device_node *cbe_get_be_node(int cpu_id)
++u32 cbe_cpu_to_node(int cpu)
 +{
-+	struct device_node *np;
-+
-+	for_each_node_by_type (np, "be") {
-+		int len,i;
-+		const phandle *cpu_handle;
-+
-+		cpu_handle = get_property(np, "cpus", &len);
-+
-+		for (i=0; i<len; i++)
-+			if (of_find_node_by_phandle(cpu_handle[i]) == of_get_cpu_node(cpu_id, NULL))
-+				return np;
-+	}
-+
-+	return NULL;
++	return cbe_thread_map[cpu].cbe_id;
 +}
++EXPORT_SYMBOL_GPL(cbe_cpu_to_node);
 +
-+void __init cbe_fill_regs_map(struct cbe_regs_map *map)
++u32 cbe_node_to_cpu(int node)
 +{
-+	if(map->be_node) {
-+		struct device_node *be, *np;
-+
-+		be = map->be_node;
-+
-+		for_each_node_by_type(np, "pervasive")
-+			if (of_get_parent(np) == be)
-+				map->pmd_regs = of_iomap(np, 0);
-+
-+		for_each_node_by_type(np, "CBEA-Internal-Interrupt-Controller")
-+			if (of_get_parent(np) == be)
-+				map->iic_regs = of_iomap(np, 2);
-+
-+		for_each_node_by_type(np, "mic-tm")
-+			if (of_get_parent(np) == be)
-+				map->mic_tm_regs = of_iomap(np, 0);
-+	} else {
-+		struct device_node *cpu;
-+		/* That hack must die die die ! */
-+		const struct address_prop {
-+			unsigned long address;
-+			unsigned int len;
-+		} __attribute__((packed)) *prop;
-+
-+		cpu = map->cpu_node;
-+
-+		prop = get_property(cpu, "pervasive", NULL);
-+		if (prop != NULL)
-+			map->pmd_regs = ioremap(prop->address, prop->len);
-+
-+		prop = get_property(cpu, "iic", NULL);
-+		if (prop != NULL)
-+			map->iic_regs = ioremap(prop->address, prop->len);
-+
-+		prop = get_property(cpu, "mic-tm", NULL);
-+		if (prop != NULL)
-+			map->mic_tm_regs = ioremap(prop->address, prop->len);
-+	}
++	return find_first_bit( (unsigned long *) &cbe_local_mask[node], sizeof(cpumask_t));
 +}
++EXPORT_SYMBOL_GPL(cbe_node_to_cpu);
 +
-+
+ static struct device_node *cbe_get_be_node(int cpu_id)
+ {
+ 	struct device_node *np;
+@@ -218,17 +228,23 @@
  void __init cbe_regs_init(void)
  {
  	int i;
++	unsigned int thread_id;
  	struct device_node *cpu;
  
  	/* Build local fast map of CPUs */
--	for_each_possible_cpu(i)
-+	for_each_possible_cpu(i) {
- 		cbe_thread_map[i].cpu_node = of_get_cpu_node(i, NULL);
-+ 		cbe_thread_map[i].be_node = cbe_get_be_node(i);
-+	}
+ 	for_each_possible_cpu(i) {
+-		cbe_thread_map[i].cpu_node = of_get_cpu_node(i, NULL);
+- 		cbe_thread_map[i].be_node = cbe_get_be_node(i);
++		cbe_thread_map[i].cpu_node = of_get_cpu_node(i, &thread_id);
++		cbe_thread_map[i].be_node = cbe_get_be_node(i);
++		cbe_thread_map[i].thread_id = thread_id;
+ 	}
  
  	/* Find maps for each device tree CPU */
  	for_each_node_by_type(cpu, "cpu") {
- 		struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++];
+-		struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++];
++		struct cbe_regs_map *map;
++		unsigned int cbe_id;
++
++		cbe_id = cbe_regs_map_count++;
++		map = &cbe_regs_maps[cbe_id];
  
--		/* That hack must die die die ! */
--		const struct address_prop {
--			unsigned long address;
--			unsigned int len;
--		} __attribute__((packed)) *prop;
--
--
  		if (cbe_regs_map_count > MAX_CBE) {
  			printk(KERN_ERR "cbe_regs: More BE chips than supported"
- 			       "!\n");
-@@ -171,21 +238,12 @@ void __init cbe_regs_init(void)
+@@ -237,11 +253,19 @@
+ 			return;
  		}
  		map->cpu_node = cpu;
- 		for_each_possible_cpu(i)
--			if (cbe_thread_map[i].cpu_node == cpu)
-+			if (cbe_thread_map[i].cpu_node == cpu) {
- 				cbe_thread_map[i].regs = map;
-+				map->be_node = cbe_thread_map[i].be_node;
-+			}
- 
--		prop = get_property(cpu, "pervasive", NULL);
--		if (prop != NULL)
--			map->pmd_regs = ioremap(prop->address, prop->len);
--
--		prop = get_property(cpu, "iic", NULL);
--		if (prop != NULL)
--			map->iic_regs = ioremap(prop->address, prop->len);
--
--		prop = (struct address_prop *)get_property(cpu, "mic-tm",
--							   NULL);
--		if (prop != NULL)
--			map->mic_tm_regs = ioremap(prop->address, prop->len);
-+		cbe_fill_regs_map(map);
- 	}
- }
+-		for_each_possible_cpu(i)
+-			if (cbe_thread_map[i].cpu_node == cpu) {
+-				cbe_thread_map[i].regs = map;
+-				map->be_node = cbe_thread_map[i].be_node;
++
++		for_each_possible_cpu(i) {
++			struct cbe_thread_map *thread = &cbe_thread_map[i];
++
++			if (thread->cpu_node == cpu) {
++				thread->regs = map;
++				thread->cbe_id = cbe_id;
++				map->be_node = thread->be_node;
++				cpu_set(i, cbe_local_mask[cbe_id]);
++				if(thread->thread_id == 0)
++					cpu_set(i, cbe_first_online_cpu);
+ 			}
++		}
  
+ 		cbe_fill_regs_map(map);
+ 	}
+diff -ur linux-2.6.20.ppc64.3108/arch/powerpc/platforms/cell/cbe_regs.h linux-2.6.20.ppc64/arch/powerpc/platforms/cell/cbe_regs.h
+--- linux-2.6.20.ppc64.3108/arch/powerpc/platforms/cell/cbe_regs.h	2007-02-04 18:44:54.000000000 +0000
++++ linux-2.6.20.ppc64/arch/powerpc/platforms/cell/cbe_regs.h	2007-04-24 19:34:42.000000000 +0100
+@@ -255,6 +255,11 @@
+ extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
+ extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);
+ 
++/* some utility functions to deal with SMT */
++extern u32 cbe_get_hw_thread_id(int cpu);
++extern u32 cbe_cpu_to_node(int cpu);
++extern u32 cbe_node_to_cpu(int node);
++
+ /* Init this module early */
+ extern void cbe_regs_init(void);
+ 
+diff -ur linux-2.6.20.ppc64.3108/include/asm/cell-pmu.h linux-2.6.20.ppc64/include/asm/cell-pmu.h
+--- linux-2.6.20.ppc64.3108/include/asm/cell-pmu.h	2007-04-24 18:03:57.000000000 +0100
++++ linux-2.6.20.ppc64/include/asm/cell-pmu.h	2007-04-24 19:34:42.000000000 +0100
+@@ -97,11 +97,6 @@
+ extern u32  cbe_get_and_clear_pm_interrupts(u32 cpu);
+ extern void cbe_sync_irq(int node);
+ 
+-/* Utility functions, macros */
+-extern u32 cbe_get_hw_thread_id(int cpu);
+-
+-#define cbe_cpu_to_node(cpu) ((cpu) >> 1)
+-
+ #define CBE_COUNT_SUPERVISOR_MODE       0
+ #define CBE_COUNT_HYPERVISOR_MODE       1
+ #define CBE_COUNT_PROBLEM_MODE          2
+diff -ur linux-2.6.20.ppc64.3108/include/asm-powerpc/cell-pmu.h linux-2.6.20.ppc64/include/asm-powerpc/cell-pmu.h
+--- linux-2.6.20.ppc64.3108/include/asm-powerpc/cell-pmu.h	2007-04-24 18:03:57.000000000 +0100
++++ linux-2.6.20.ppc64/include/asm-powerpc/cell-pmu.h	2007-04-24 19:34:42.000000000 +0100
+@@ -97,11 +97,6 @@
+ extern u32  cbe_get_and_clear_pm_interrupts(u32 cpu);
+ extern void cbe_sync_irq(int node);
+ 
+-/* Utility functions, macros */
+-extern u32 cbe_get_hw_thread_id(int cpu);
+-
+-#define cbe_cpu_to_node(cpu) ((cpu) >> 1)
+-
+ #define CBE_COUNT_SUPERVISOR_MODE       0
+ #define CBE_COUNT_HYPERVISOR_MODE       1
+ #define CBE_COUNT_PROBLEM_MODE          2




More information about the fedora-cvs-commits mailing list