Skip to contentSkip to conversation

Cell: Add spu shutdown method

PATCH In review Geoff Levand 8 participants 69 messages Jun 12, 2007 – Jun 15, 2007 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/30 Cell: Add spu shutdown method

Add a shutdown method to spu_sysdev_class to allow proper spu resource cleanup on system shutdown. This is needed to support kexec on the PS3 platform.

---
 arch/powerpc/platforms/cell/spu_base.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
arch/powerpc/platforms/cell/spu_base.c +11 -1
@@ -462,8 +462,18 @@ void spu_free(struct spu *spu)
 }
 EXPORT_SYMBOL_GPL(spu_free);
 
+static int spu_shutdown(struct sys_device *sysdev)
+{
+	struct spu *spu = container_of(sysdev, struct spu, sysdev);
+
+	spu_free_irqs(spu);
+	spu_destroy_spu(spu);
+	return 0;
+}
+
 struct sysdev_class spu_sysdev_class = {
-	set_kset_name("spu")
+	set_kset_name("spu"),
+	.shutdown = spu_shutdown,
 };
 
 int spu_add_sysdev_attr(struct sysdev_attribute *attr)
#2 lore raw

PATCH 2/30 PS3: Rename IPI symbols

In reply to a message not in the archive

Rename the PS3 static symbol virqs to ps3_ipi_virqs to aid in debugging.

---
 arch/powerpc/platforms/ps3/smp.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/ps3/smp.c +6 -6
@@ -39,11 +39,11 @@ static irqreturn_t ipi_function_handler(
 }
 
 /**
-  * virqs - a per cpu array of virqs for ipi use
+  * ps3_ipi_virqs - a per cpu array of virqs for ipi use
   */
 
 #define MSG_COUNT 4
-static DEFINE_PER_CPU(unsigned int, virqs[MSG_COUNT]);
+static DEFINE_PER_CPU(unsigned int, ps3_ipi_virqs[MSG_COUNT]);
 
 static const char *names[MSG_COUNT] = {
 	"ipi call",
@@ -62,7 +62,7 @@ static void do_message_pass(int target, 
 		return;
 	}
 
-	virq = per_cpu(virqs, target)[msg];
+	virq = per_cpu(ps3_ipi_virqs, target)[msg];
 	result = ps3_send_event_locally(virq);
 
 	if (result)
@@ -94,13 +94,13 @@ static int ps3_smp_probe(void)
 static void __init ps3_smp_setup_cpu(int cpu)
 {
 	int result;
-	unsigned int *virqs = per_cpu(virqs, cpu);
+	unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu);
 	int i;
 
 	DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
 
 	/*
-	 * Check assumptions on virqs[] indexing. If this
+	 * Check assumptions on ps3_ipi_virqs[] indexing. If this
 	 * check fails, then a different mapping of PPC_MSG_
 	 * to index needs to be setup.
 	 */
@@ -132,7 +132,7 @@ static void __init ps3_smp_setup_cpu(int
 
 void ps3_smp_cleanup_cpu(int cpu)
 {
-	unsigned int *virqs = per_cpu(virqs, cpu);
+	unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu);
 	int i;
 
 	DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
#3 lore raw

PATCH 3/30 PS3: Use __maybe_unused

In reply to a message not in the archive

Change the PS3 debug routines from using the GCC specific '__attribute__ ((unused))' to the preprocessor macro __maybe_unused.

---
 arch/powerpc/platforms/ps3/interrupt.c |    4 ++--
 arch/powerpc/platforms/ps3/time.c      |    2 +-
 drivers/ps3/vuart.c                    |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/platforms/ps3/interrupt.c +2 -2
@@ -533,7 +533,7 @@ static void _dump_64_bmp(const char *hea
 		*p & 0xffff);
 }
 
-static void __attribute__ ((unused)) _dump_256_bmp(const char *header,
+static void __maybe_unused _dump_256_bmp(const char *header,
 	const u64 *p, unsigned cpu, const char* func, int line)
 {
 	pr_debug("%s:%d: %s %u {%016lx:%016lx:%016lx:%016lx}\n",
@@ -552,7 +552,7 @@ static void _dump_bmp(struct ps3_private
 }
 
 #define dump_mask(_x) _dump_mask(_x, __func__, __LINE__)
-static void __attribute__ ((unused)) _dump_mask(struct ps3_private* pd,
+static void __maybe_unused _dump_mask(struct ps3_private* pd,
 	const char* func, int line)
 {
 	unsigned long flags;
arch/powerpc/platforms/ps3/time.c +1 -1
@@ -39,7 +39,7 @@ static void _dump_tm(const struct rtc_ti
 }
 
 #define dump_time(_a) _dump_time(_a, __func__, __LINE__)
-static void __attribute__ ((unused)) _dump_time(int time, const char* func,
+static void __maybe_unused _dump_time(int time, const char* func,
 	int line)
 {
 	struct rtc_time tm;
drivers/ps3/vuart.c +2 -2
@@ -83,7 +83,7 @@ struct ports_bmp {
 } __attribute__ ((aligned (32)));
 
 #define dump_ports_bmp(_b) _dump_ports_bmp(_b, __func__, __LINE__)
-static void __attribute__ ((unused)) _dump_ports_bmp(
+static void __maybe_unused _dump_ports_bmp(
 	const struct ports_bmp* bmp, const char* func, int line)
 {
 	pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status);
@@ -107,7 +107,7 @@ static int ps3_vuart_match_id_to_port(en
 }
 
 #define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__)
-static void __attribute__ ((unused)) _dump_port_params(unsigned int port_number,
+static void __maybe_unused _dump_port_params(unsigned int port_number,
 	const char* func, int line)
 {
 #if defined(DEBUG)
#4 lore raw

PATCH 4/30 PS3: Compare firmware version

In reply to a message not in the archive

From: Masakazu Mokuno <[email protected]>

Add a utility routine ps3_compare_firmware_version() to compare system firmware versions. Uses the existing ps3_get_firmware_version() routine.

---
 arch/powerpc/platforms/ps3/setup.c |   32 ++++++++++++++++++++------------
 include/asm-powerpc/ps3.h          |    3 ++-
 2 files changed, 22 insertions(+), 13 deletions(-)
arch/powerpc/platforms/ps3/setup.c +20 -12
@@ -46,18 +46,26 @@
 static void smp_send_stop(void) {}
 #endif
 
-int ps3_get_firmware_version(union ps3_firmware_version *v)
+static union ps3_firmware_version ps3_firmware_version;
+
+void ps3_get_firmware_version(union ps3_firmware_version *v)
 {
-	int result = lv1_get_version_info(&v->raw);
+	*v = ps3_firmware_version;
+}
+EXPORT_SYMBOL_GPL(ps3_get_firmware_version);
 
-	if (result) {
-		v->raw = 0;
-		return -1;
-	}
+int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev)
+{
+	union ps3_firmware_version x;
+
+	x.pad = 0;
+	x.major = major;
+	x.minor = minor;
+	x.rev = rev;
 
-	return result;
+	return (ps3_firmware_version.raw - x.raw);
 }
-EXPORT_SYMBOL_GPL(ps3_get_firmware_version);
+EXPORT_SYMBOL_GPL(ps3_compare_firmware_version);
 
 static void ps3_power_save(void)
 {
@@ -146,13 +154,13 @@ static int ps3_set_dabr(u64 dabr)
 
 static void __init ps3_setup_arch(void)
 {
-	union ps3_firmware_version v;
 
 	DBG(" -> %s:%d\n", __func__, __LINE__);
 
-	ps3_get_firmware_version(&v);
-	printk(KERN_INFO "PS3 firmware version %u.%u.%u\n", v.major, v.minor,
-		v.rev);
+	lv1_get_version_info(&ps3_firmware_version.raw);
+	printk(KERN_INFO "PS3 firmware version %u.%u.%u\n",
+	       ps3_firmware_version.major, ps3_firmware_version.minor,
+	       ps3_firmware_version.rev);
 
 	ps3_spu_set_platform();
 	ps3_map_htab();
include/asm-powerpc/ps3.h +2 -1
@@ -35,7 +35,8 @@ union ps3_firmware_version {
 	};
 };
 
-int ps3_get_firmware_version(union ps3_firmware_version *v);
+void ps3_get_firmware_version(union ps3_firmware_version *v);
+int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev);
 
 /* 'Other OS' area */
 
#5 lore raw

PATCH 5/30 PS3: Use ioremap_flags

In reply to a message not in the archive

Use ioremap_flags() to map SPU regions as non-guarded. Change the use of _ioremap() to ioremap_flags().

CC Arnd Bergmann <[email protected]>
CC Masato Noguchi <[email protected]>
CC Takao Shinohara <[email protected]>
---
 arch/powerpc/platforms/ps3/htab.c |    2 +-
 arch/powerpc/platforms/ps3/spu.c  |   19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)
arch/powerpc/platforms/ps3/htab.c +1 -1
@@ -273,7 +273,7 @@ void __init ps3_map_htab(void)
 
 	result = lv1_map_htab(0, &htab_addr);
 
-	htab = (hpte_t *)__ioremap(htab_addr, htab_size,
+	htab = (hpte_t *)ioremap_flags(htab_addr, htab_size,
 				   pgprot_val(PAGE_READONLY_X));
 
 	DBG("%s:%d: lpar %016lxh, virt %016lxh\n", __func__, __LINE__,
arch/powerpc/platforms/ps3/spu.c +12 -7
@@ -182,30 +182,35 @@ static int __init setup_areas(struct spu
 {
 	struct table {char* name; unsigned long addr; unsigned long size;};
 
-	spu_pdata(spu)->shadow = __ioremap(
+	spu_pdata(spu)->shadow = (__force void *)ioremap_flags(
 		spu_pdata(spu)->shadow_addr, sizeof(struct spe_shadow),
-		pgprot_val(PAGE_READONLY) | _PAGE_NO_CACHE | _PAGE_GUARDED);
+		pgprot_val(PAGE_READONLY) | _PAGE_NO_CACHE);
+
 	if (!spu_pdata(spu)->shadow) {
 		pr_debug("%s:%d: ioremap shadow failed\n", __func__, __LINE__);
 		goto fail_ioremap;
 	}
 
-	spu->local_store = ioremap(spu->local_store_phys, LS_SIZE);
+	spu->local_store = (__force void *)ioremap_flags(spu->local_store_phys,
+		LS_SIZE, _PAGE_NO_CACHE);
+
 	if (!spu->local_store) {
 		pr_debug("%s:%d: ioremap local_store failed\n",
 			__func__, __LINE__);
 		goto fail_ioremap;
 	}
 
-	spu->problem = ioremap(spu->problem_phys,
-		sizeof(struct spu_problem));
+	spu->problem = (__force void *)ioremap_flags(spu->problem_phys,
+		sizeof(struct spu_problem), _PAGE_NO_CACHE);
+
 	if (!spu->problem) {
 		pr_debug("%s:%d: ioremap problem failed\n", __func__, __LINE__);
 		goto fail_ioremap;
 	}
 
-	spu->priv2 = ioremap(spu_pdata(spu)->priv2_addr,
-		sizeof(struct spu_priv2));
+	spu->priv2 = (__force void *)ioremap_flags(spu_pdata(spu)->priv2_addr,
+		sizeof(struct spu_priv2), _PAGE_NO_CACHE);
+
 	if (!spu->priv2) {
 		pr_debug("%s:%d: ioremap priv2 failed\n", __func__, __LINE__);
 		goto fail_ioremap;
#6 lore raw

Re: [patch 05/30] PS3: Use ioremap_flags

T24gVHVlc2RheSAxMiBKdW5lIDIwMDcsIEdlb2ZmIExldmFuZCB3cm90ZToKPiAtwqDCoMKgwqDC oMKgwqBzcHUtPnByb2JsZW0gPSBpb3JlbWFwKHNwdS0+cHJvYmxlbV9waHlzLAo+IC3CoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqBzaXplb2Yoc3RydWN0IHNwdV9wcm9ibGVtKSk7Cj4gK8Kg wqDCoMKgwqDCoMKgc3B1LT5wcm9ibGVtID0gKF9fZm9yY2Ugdm9pZCAqKWlvcmVtYXBfZmxhZ3Mo c3B1LT5wcm9ibGVtX3BoeXMsCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoHNpemVv ZihzdHJ1Y3Qgc3B1X3Byb2JsZW0pLCBfUEFHRV9OT19DQUNIRSk7Cj4gKwoKVW5saWtlIHRoZSBs b2NhbF9zdG9yZSBtZW1iZXIsIG9mIHN0cnVjdCBzcHUsIC0+cHJvYmxlbSBhbmQgLT5wcml2Mgpt ZW1iZXJzIGFyZSBfX2lvbWVtLCBzbyB5b3Ugc2hvdWxkIG5vdCBkbyBhIF9fZm9yY2UgY2FzdCBo ZXJlLgoKT3RoZXIgdGhhbiB0aGF0LCB0aGUgcGF0Y2ggbG9va3MgZ29vZC4KCk5vdGUgdGhhdCBJ IG1heSByZXBseSBmYXN0ZXIgaXMgeW91IHNlbmQgeW91ciBtZXNzYWdlcyB0byBhcm5kQGFybmRi LmRlCmluc3RlYWQgb2YgYXJuZC5iZXJnbWFubkBkZS5pYm0uY29tLgoKCUFybmQgPD48Cg==

#7 lore raw

Re: [patch 05/30] PS3: Use ioremap_flags

Quoted 9 lines · Arnd Bergmann

arch/powerpc/platforms/ps3/spu.c static int __init setup_areas(struct spu · line 205

Quoted 5 lines · Geoff Levand
arch/powerpc/platforms/ps3/spu.c +3 -2
-       spu->problem = ioremap(spu->problem_phys,
-               sizeof(struct spu_problem));
+       spu->problem = (__force void *)ioremap_flags(spu->problem_phys,
+               sizeof(struct spu_problem), _PAGE_NO_CACHE);
+

Unlike the local_store member, of struct spu, ->problem and ->priv2 members are __iomem, so you should not do a __force cast here.

OK, thanks for checking it, I just did a quick edit without thinking.

-Geoff

#8 lore raw

Re: [patch 05/30] PS3: Use ioremap_flags

In reply to Geoff Levand
Quoted 14 lines · Geoff Levand
arch/powerpc/platforms/ps3/spu.c +4 -4
-	spu->problem = ioremap(spu->problem_phys,
-		sizeof(struct spu_problem));
+	spu->problem = (__force void *)ioremap_flags(spu->problem_phys,
+		sizeof(struct spu_problem), _PAGE_NO_CACHE);
+
 	if (!spu->problem) {
 		pr_debug("%s:%d: ioremap problem failed\n", __func__, __LINE__);
 		goto fail_ioremap;
 	}
 
-	spu->priv2 = ioremap(spu_pdata(spu)->priv2_addr,
-		sizeof(struct spu_priv2));
+	spu->priv2 = (__force void 

*)ioremap_flags(spu_pdata(spu)->priv2_addr,

arch/powerpc/platforms/ps3/spu.c static int __init setup_areas(struct spu · line 216

Quoted 5 lines
arch/powerpc/platforms/ps3/spu.c +2 -0
+		sizeof(struct spu_priv2), _PAGE_NO_CACHE);
+
 	if (!spu->priv2) {
 		pr_debug("%s:%d: ioremap priv2 failed\n", __func__, __LINE__);
 		goto fail_ioremap;

spu->problem and spu->priv2 needs _PAGE_GUARDED, because they are MMIO register region.

-- Takao Shinohara

#9 lore raw

PATCH v2 5/30 PS3: Use ioremap_flags

In reply to Geoff Levand

Use ioremap_flags() to map SPU and htab regions as non-guarded. Change the use of _ioremap() to ioremap_flags().

CC Arnd Bergmann <[email protected]>
CC Masato Noguchi <[email protected]>
CC Takao Shinohara <[email protected]>

---

Ver 2: Fixed casts, removed _PAGE_GUARDED from spu problem and priv2 regions.

 arch/powerpc/platforms/ps3/htab.c |    2 +-
 arch/powerpc/platforms/ps3/spu.c  |   13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
arch/powerpc/platforms/ps3/htab.c +1 -1
@@ -273,7 +273,7 @@ void __init ps3_map_htab(void)
 
 	result = lv1_map_htab(0, &htab_addr);
 
-	htab = (hpte_t *)__ioremap(htab_addr, htab_size,
+	htab = (__force hpte_t *)ioremap_flags(htab_addr, htab_size,
 				   pgprot_val(PAGE_READONLY_X));
 
 	DBG("%s:%d: lpar %016lxh, virt %016lxh\n", __func__, __LINE__,
arch/powerpc/platforms/ps3/spu.c +9 -4
@@ -182,15 +182,18 @@ static int __init setup_areas(struct spu
 {
 	struct table {char* name; unsigned long addr; unsigned long size;};
 
-	spu_pdata(spu)->shadow = __ioremap(
-		spu_pdata(spu)->shadow_addr, sizeof(struct spe_shadow),
-		pgprot_val(PAGE_READONLY) | _PAGE_NO_CACHE | _PAGE_GUARDED);
+	spu_pdata(spu)->shadow = ioremap_flags(spu_pdata(spu)->shadow_addr,
+					       sizeof(struct spe_shadow),
+					       pgprot_val(PAGE_READONLY) |
+					       _PAGE_NO_CACHE);
 	if (!spu_pdata(spu)->shadow) {
 		pr_debug("%s:%d: ioremap shadow failed\n", __func__, __LINE__);
 		goto fail_ioremap;
 	}
 
-	spu->local_store = ioremap(spu->local_store_phys, LS_SIZE);
+	spu->local_store = (__force void *)ioremap_flags(spu->local_store_phys,
+		LS_SIZE, _PAGE_NO_CACHE);
+
 	if (!spu->local_store) {
 		pr_debug("%s:%d: ioremap local_store failed\n",
 			__func__, __LINE__);
@@ -199,6 +202,7 @@ static int __init setup_areas(struct spu
 
 	spu->problem = ioremap(spu->problem_phys,
 		sizeof(struct spu_problem));
+
 	if (!spu->problem) {
 		pr_debug("%s:%d: ioremap problem failed\n", __func__, __LINE__);
 		goto fail_ioremap;
@@ -206,6 +210,7 @@ static int __init setup_areas(struct spu
 
 	spu->priv2 = ioremap(spu_pdata(spu)->priv2_addr,
 		sizeof(struct spu_priv2));
+
 	if (!spu->priv2) {
 		pr_debug("%s:%d: ioremap priv2 failed\n", __func__, __LINE__);
 		goto fail_ioremap;
Acked-by on v2 5/30
#10 lore raw

Re: [patch 05/30 v2] PS3: Use ioremap_flags

Quoted 8 lines · Geoff Levand

Use ioremap_flags() to map SPU and htab regions as non-guarded. Change the use of _ioremap() to ioremap_flags().

CC Arnd Bergmann <[email protected]>
CC Masato Noguchi <[email protected]>
CC Takao Shinohara <[email protected]>
#11 lore raw

PATCH 6/30 PS3: Fix sparse warnings

In reply to a message not in the archive

From: Geert Uytterhoeven <[email protected]>

Fix some PS3 build warnings reported by `make C=1'. You need to install sparse:
git://git.kernel.org/pub/scm/devel/sparse/sparse.git

---
 arch/powerpc/platforms/ps3/os-area.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/ps3/os-area.c +2 -2
@@ -133,7 +133,7 @@ struct saved_params {
 } static saved_params;
 
 #define dump_header(_a) _dump_header(_a, __func__, __LINE__)
-static void _dump_header(const struct os_area_header __iomem *h, const char* func,
+static void _dump_header(const struct os_area_header *h, const char* func,
 	int line)
 {
 	pr_debug("%s:%d: h.magic_num:         '%s'\n", func, line,
@@ -151,7 +151,7 @@ static void _dump_header(const struct os
 }
 
 #define dump_params(_a) _dump_params(_a, __func__, __LINE__)
-static void _dump_params(const struct os_area_params __iomem *p, const char* func,
+static void _dump_params(const struct os_area_params *p, const char* func,
 	int line)
 {
 	pr_debug("%s:%d: p.boot_flag:       %u\n", func, line, p->boot_flag);
#12 lore raw

PATCH 7/30 PS3: Add support for HDMI RGB Full Range mode

In reply to a message not in the archive

From: Masashi Kimoto <[email protected]>

Add support for HDMI RGB Full Range mode, which is available on system software 1.80 or newer.

---
 drivers/ps3/ps3av_cmd.c     |   16 ++++++++++++++++
 include/asm-powerpc/ps3av.h |   12 +++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)
drivers/ps3/ps3av_cmd.c +16 -0
@@ -143,6 +143,14 @@ static u32 ps3av_vid_video2av(int vid)
 	return PS3AV_CMD_AV_VID_480P;
 }
 
+static int ps3av_hdmi_range(void)
+{
+	if (ps3_compare_firmware_version(1, 8, 0) < 0)
+		return 0;
+	else
+		return 1; /* supported */
+}
+
 int ps3av_cmd_init(void)
 {
 	int res;
@@ -350,6 +358,10 @@ u32 ps3av_cmd_set_av_video_cs(void *p, u
 	/* should be same as video_mode.video_cs_out */
 	av_video_cs->av_cs_in = ps3av_cs_video2av(PS3AV_CMD_VIDEO_CS_RGB_8);
 	av_video_cs->bitlen_out = ps3av_cs_video2av_bitlen(cs_out);
+	if ((id & PS3AV_MODE_WHITE) && ps3av_hdmi_range())
+		av_video_cs->super_white = PS3AV_CMD_AV_SUPER_WHITE_ON;
+	else /* default off */
+		av_video_cs->super_white = PS3AV_CMD_AV_SUPER_WHITE_OFF;
 	av_video_cs->aspect = aspect;
 	if (id & PS3AV_MODE_DITHER) {
 		av_video_cs->dither = PS3AV_CMD_AV_DITHER_ON
@@ -392,6 +404,10 @@ u32 ps3av_cmd_set_video_mode(void *p, u3
 	video_mode->pitch = video_mode->width * 4;	/* line_length */
 	video_mode->video_out_format = PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT;
 	video_mode->video_format = ps3av_video_fmt_table[video_fmt].format;
+	if ((id & PS3AV_MODE_COLOR) && ps3av_hdmi_range())
+		video_mode->video_cl_cnv = PS3AV_CMD_VIDEO_CL_CNV_DISABLE_LUT;
+	else /* default enable */
+		video_mode->video_cl_cnv = PS3AV_CMD_VIDEO_CL_CNV_ENABLE_LUT;
 	video_mode->video_order = ps3av_video_fmt_table[video_fmt].order;
 
 	pr_debug("%s: video_mode:vid:%x width:%d height:%d pitch:%d out_format:%d format:%x order:%x\n",
include/asm-powerpc/ps3av.h +9 -3
@@ -159,6 +159,9 @@
 #define PS3AV_CMD_VIDEO_FMT_X8R8G8B8			0x0000
 /* video_out_format */
 #define PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT		0x0000
+/* video_cl_cnv */
+#define PS3AV_CMD_VIDEO_CL_CNV_ENABLE_LUT		0x0000
+#define PS3AV_CMD_VIDEO_CL_CNV_DISABLE_LUT		0x0010
 /* video_sync */
 #define PS3AV_CMD_VIDEO_SYNC_VSYNC			0x0001
 #define PS3AV_CMD_VIDEO_SYNC_CSYNC			0x0004
@@ -311,6 +314,8 @@
 #define PS3AV_MODE_MASK				0x000F
 #define PS3AV_MODE_HDCP_OFF			0x1000	/* Retail PS3 product doesn't support this */
 #define PS3AV_MODE_DITHER			0x0800
+#define PS3AV_MODE_COLOR			0x0400
+#define PS3AV_MODE_WHITE			0x0200
 #define PS3AV_MODE_FULL				0x0080
 #define PS3AV_MODE_DVI				0x0040
 #define PS3AV_MODE_RGB				0x0020
@@ -529,9 +534,9 @@ struct ps3av_pkt_video_mode {
 	u32 video_out_format;	/* in: out format */
 	u32 video_format;	/* in: input frame buffer format */
 	u8 reserved3;
-	u8 reserved4;
+	u8 video_cl_cnv;	/* in: color conversion */
 	u16 video_order;	/* in: input RGB order */
-	u32 reserved5;
+	u32 reserved4;
 };
 
 /* video: format */
@@ -539,7 +544,8 @@ struct ps3av_pkt_video_format {
 	struct ps3av_send_hdr send_hdr;
 	u32 video_head;		/* in: head */
 	u32 video_format;	/* in: frame buffer format */
-	u16 reserved;
+	u8 reserved;
+	u8 video_cl_cnv;	/* in: color conversion */
 	u16 video_order;	/* in: input RGB order */
 };
 
#13 lore raw

PATCH 8/30 PS3: Move chip mask defs up

In reply to a message not in the archive

This just moves the definitions of the PS3 chip_mask routines up above the irq setup routines. This change is needed for the kexec updates that follow. Also adds some inline documentation to the routines.

---
 arch/powerpc/platforms/ps3/interrupt.c |  147 +++++++++++++++++++--------------
 1 file changed, 86 insertions(+), 61 deletions(-)
arch/powerpc/platforms/ps3/interrupt.c +86 -61
@@ -91,6 +91,92 @@ struct ps3_private {
 static DEFINE_PER_CPU(struct ps3_private, ps3_private);
 
 /**
+ * ps3_chip_mask - Set an interrupt mask bit in ps3_bmp.
+ * @virq: The assigned Linux virq.
+ *
+ * Sets ps3_bmp.mask and calls lv1_did_update_interrupt_mask().
+ */
+
+static void ps3_chip_mask(unsigned int virq)
+{
+	struct ps3_private *pd = get_irq_chip_data(virq);
+	u64 bit = 0x8000000000000000UL >> virq;
+	u64 *p = &pd->bmp.mask;
+	u64 old;
+	unsigned long flags;
+
+	pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
+
+	local_irq_save(flags);
+	asm volatile(
+		     "1:	ldarx %0,0,%3\n"
+		     "andc	%0,%0,%2\n"
+		     "stdcx.	%0,0,%3\n"
+		     "bne-	1b"
+		     : "=&r" (old), "+m" (*p)
+		     : "r" (bit), "r" (p)
+		     : "cc" );
+
+	lv1_did_update_interrupt_mask(pd->node, pd->cpu);
+	local_irq_restore(flags);
+}
+
+/**
+ * ps3_chip_unmask - Clear an interrupt mask bit in ps3_bmp.
+ * @virq: The assigned Linux virq.
+ *
+ * Clears ps3_bmp.mask and calls lv1_did_update_interrupt_mask().
+ */
+
+static void ps3_chip_unmask(unsigned int virq)
+{
+	struct ps3_private *pd = get_irq_chip_data(virq);
+	u64 bit = 0x8000000000000000UL >> virq;
+	u64 *p = &pd->bmp.mask;
+	u64 old;
+	unsigned long flags;
+
+	pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
+
+	local_irq_save(flags);
+	asm volatile(
+		     "1:	ldarx %0,0,%3\n"
+		     "or	%0,%0,%2\n"
+		     "stdcx.	%0,0,%3\n"
+		     "bne-	1b"
+		     : "=&r" (old), "+m" (*p)
+		     : "r" (bit), "r" (p)
+		     : "cc" );
+
+	lv1_did_update_interrupt_mask(pd->node, pd->cpu);
+	local_irq_restore(flags);
+}
+
+/**
+ * ps3_chip_eoi - HV end-of-interrupt.
+ * @virq: The assigned Linux virq.
+ *
+ * Calls lv1_end_of_interrupt_ext().
+ */
+
+static void ps3_chip_eoi(unsigned int virq)
+{
+	const struct ps3_private *pd = get_irq_chip_data(virq);
+	lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq);
+}
+
+/**
+ * ps3_irq_chip - Represents the ps3_bmp as a Linux struct irq_chip.
+ */
+
+static struct irq_chip ps3_irq_chip = {
+	.typename = "ps3",
+	.mask = ps3_chip_mask,
+	.unmask = ps3_chip_unmask,
+	.eoi = ps3_chip_eoi,
+};
+
+/**
  * ps3_virq_setup - virq related setup.
  * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
  * serviced on.
@@ -565,67 +651,6 @@ static void __maybe_unused _dump_mask(st
 static void dump_bmp(struct ps3_private* pd) {};
 #endif /* defined(DEBUG) */
 
-static void ps3_chip_mask(unsigned int virq)
-{
-	struct ps3_private *pd = get_irq_chip_data(virq);
-	u64 bit = 0x8000000000000000UL >> virq;
-	u64 *p = &pd->bmp.mask;
-	u64 old;
-	unsigned long flags;
-
-	pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
-
-	local_irq_save(flags);
-	asm volatile(
-		     "1:	ldarx %0,0,%3\n"
-		     "andc	%0,%0,%2\n"
-		     "stdcx.	%0,0,%3\n"
-		     "bne-	1b"
-		     : "=&r" (old), "+m" (*p)
-		     : "r" (bit), "r" (p)
-		     : "cc" );
-
-	lv1_did_update_interrupt_mask(pd->node, pd->cpu);
-	local_irq_restore(flags);
-}
-
-static void ps3_chip_unmask(unsigned int virq)
-{
-	struct ps3_private *pd = get_irq_chip_data(virq);
-	u64 bit = 0x8000000000000000UL >> virq;
-	u64 *p = &pd->bmp.mask;
-	u64 old;
-	unsigned long flags;
-
-	pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
-
-	local_irq_save(flags);
-	asm volatile(
-		     "1:	ldarx %0,0,%3\n"
-		     "or	%0,%0,%2\n"
-		     "stdcx.	%0,0,%3\n"
-		     "bne-	1b"
-		     : "=&r" (old), "+m" (*p)
-		     : "r" (bit), "r" (p)
-		     : "cc" );
-
-	lv1_did_update_interrupt_mask(pd->node, pd->cpu);
-	local_irq_restore(flags);
-}
-
-static void ps3_chip_eoi(unsigned int virq)
-{
-	const struct ps3_private *pd = get_irq_chip_data(virq);
-	lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq);
-}
-
-static struct irq_chip irq_chip = {
-	.typename = "ps3",
-	.mask = ps3_chip_mask,
-	.unmask = ps3_chip_unmask,
-	.eoi = ps3_chip_eoi,
-};
-
 static void ps3_host_unmap(struct irq_host *h, unsigned int virq)
 {
 	set_irq_chip_data(virq, NULL);
#14 lore raw

PATCH 9/30 PS3: Use inline DBG

In reply to a message not in the archive

Change the PS3 early debug routine DBG from a pritk call to a local inline call.

---
 arch/powerpc/platforms/ps3/htab.c      |    3 ++-
 arch/powerpc/platforms/ps3/interrupt.c |    3 ++-
 arch/powerpc/platforms/ps3/mm.c        |    3 ++-
 arch/powerpc/platforms/ps3/setup.c     |    3 ++-
 arch/powerpc/platforms/ps3/smp.c       |    3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)
arch/powerpc/platforms/ps3/htab.c +2 -1
@@ -31,7 +31,8 @@
 #if defined(DEBUG)
 #define DBG(fmt...) udbg_printf(fmt)
 #else
-#define DBG(fmt...) do{if(0)printk(fmt);}while(0)
+static inline int __attribute__ ((format (printf, 1, 2))) DBG(
+	const char *fmt, ...) {return 0;}
 #endif
 
 static hpte_t *htab;
arch/powerpc/platforms/ps3/interrupt.c +2 -1
@@ -32,7 +32,8 @@
 #if defined(DEBUG)
 #define DBG(fmt...) udbg_printf(fmt)
 #else
-#define DBG(fmt...) do{if(0)printk(fmt);}while(0)
+static inline int __attribute__ ((format (printf, 1, 2))) DBG(
+	const char *fmt, ...) {return 0;}
 #endif
 
 /**
arch/powerpc/platforms/ps3/mm.c +2 -1
@@ -32,7 +32,8 @@
 #if defined(DEBUG)
 #define DBG(fmt...) udbg_printf(fmt)
 #else
-#define DBG(fmt...) do{if(0)printk(fmt);}while(0)
+static inline int __attribute__ ((format (printf, 1, 2))) DBG(
+	const char *fmt, ...) {return 0;}
 #endif
 
 enum {
arch/powerpc/platforms/ps3/setup.c +2 -1
@@ -39,7 +39,8 @@
 #if defined(DEBUG)
 #define DBG(fmt...) udbg_printf(fmt)
 #else
-#define DBG(fmt...) do{if(0)printk(fmt);}while(0)
+static inline int __attribute__ ((format (printf, 1, 2))) DBG(
+	const char *fmt, ...) {return 0;}
 #endif
 
 #if !defined(CONFIG_SMP)
arch/powerpc/platforms/ps3/smp.c +2 -1
@@ -29,7 +29,8 @@
 #if defined(DEBUG)
 #define DBG(fmt...) udbg_printf(fmt)
 #else
-#define DBG(fmt...) do{if(0)printk(fmt);}while(0)
+static inline int __attribute__ ((format (printf, 1, 2))) DBG(
+	const char *fmt, ...) {return 0;}
 #endif
 
 static irqreturn_t ipi_function_handler(int irq, void *msg)
#15 lore raw

PATCH 10/30 PS3: Kexec support

In reply to a message not in the archive

Fixup the core platform parts needed for kexec to work on the PS3.
- Setup ps3_hpte_clear correctly.
- Mask interrupts on irq removal.
- Release all hypervisor resources.
- Create new routine ps3_shutdown_IRQ()

---
 arch/powerpc/platforms/ps3/htab.c      |   13 ++++--
 arch/powerpc/platforms/ps3/interrupt.c |   68 +++++++++++++++++++++++++--------
 arch/powerpc/platforms/ps3/platform.h  |    1 
 arch/powerpc/platforms/ps3/setup.c     |   29 ++------------
 arch/powerpc/platforms/ps3/smp.c       |    2 
 5 files changed, 70 insertions(+), 43 deletions(-)
arch/powerpc/platforms/ps3/htab.c +10 -3
@@ -235,10 +235,17 @@ static void ps3_hpte_invalidate(unsigned
 
 static void ps3_hpte_clear(void)
 {
-	/* Make sure to clean up the frame buffer device first */
-	ps3fb_cleanup();
+	int result;
 
-	lv1_unmap_htab(htab_addr);
+	DBG(" -> %s:%d\n", __func__, __LINE__);
+
+	result = lv1_unmap_htab(htab_addr);
+	BUG_ON(result);
+
+	ps3_mm_shutdown();
+	ps3_mm_vas_destroy();
+
+	DBG(" <- %s:%d\n", __func__, __LINE__);
 }
 
 void __init ps3_hpte_init(unsigned long htab_size)
arch/powerpc/platforms/ps3/interrupt.c +53 -15

143 lines not on this page · raw message

arch/powerpc/platforms/ps3/platform.h +1 -0
@@ -41,6 +41,7 @@ void ps3_mm_shutdown(void);
 /* irq */
 
 void ps3_init_IRQ(void);
+void ps3_shutdown_IRQ(int cpu);
 void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq);
 
 /* smp */
arch/powerpc/platforms/ps3/setup.c +5 -24
@@ -210,31 +210,12 @@ static int __init ps3_probe(void)
 #if defined(CONFIG_KEXEC)
 static void ps3_kexec_cpu_down(int crash_shutdown, int secondary)
 {
-	DBG(" -> %s:%d\n", __func__, __LINE__);
+	int cpu = smp_processor_id();
 
-	if (secondary) {
-		int cpu;
-		for_each_online_cpu(cpu)
-			if (cpu)
-				ps3_smp_cleanup_cpu(cpu);
-	} else
-		ps3_smp_cleanup_cpu(0);
+	DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
 
-	DBG(" <- %s:%d\n", __func__, __LINE__);
-}
-
-static void ps3_machine_kexec(struct kimage *image)
-{
-	unsigned long ppe_id;
-
-	DBG(" -> %s:%d\n", __func__, __LINE__);
-
-	lv1_get_logical_ppe_id(&ppe_id);
-	lv1_configure_irq_state_bitmap(ppe_id, 0, 0);
-	ps3_mm_shutdown();
-	ps3_mm_vas_destroy();
-
-	default_machine_kexec(image);
+	ps3_smp_cleanup_cpu(cpu);
+	ps3_shutdown_IRQ(cpu);
 
 	DBG(" <- %s:%d\n", __func__, __LINE__);
 }
@@ -256,7 +237,7 @@ define_machine(ps3) {
 	.power_off			= ps3_power_off,
 #if defined(CONFIG_KEXEC)
 	.kexec_cpu_down			= ps3_kexec_cpu_down,
-	.machine_kexec			= ps3_machine_kexec,
+	.machine_kexec			= default_machine_kexec,
 	.machine_kexec_prepare		= default_machine_kexec_prepare,
 	.machine_crash_shutdown		= default_machine_crash_shutdown,
 #endif
arch/powerpc/platforms/ps3/smp.c +1 -1
@@ -139,7 +139,7 @@ void ps3_smp_cleanup_cpu(int cpu)
 	DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
 
 	for (i = 0; i < MSG_COUNT; i++) {
-		free_irq(virqs[i], (void*)(long)i);
+		/* Can't call free_irq from interrupt context. */
 		ps3_event_receive_port_destroy(virqs[i]);
 		virqs[i] = NO_IRQ;
 	}
#16 lore raw

PATCH 11/30 PS3: System-bus rework

In reply to a message not in the archive

Rework the PS3 system bus to unify device support.
- DMA region sizes must be a power of two
- storage bus DMA updates:
- Small fixes for the PS3 DMA core:
o fix alignment bug
o kill superfluous test
o indentation
o spelling
o export ps3_dma_region_{create,free}()
- ps3_dma_region_init():
o Add addr' and len' parameters, so you can create a DMA region that does not cover all memory (use NULL' and 0' to cover all memory). This is needed because there are not sufficient IOMMU resources to have all DMA regions cover all memory.
o Uninline
- Added remove and shutdown routines to all drivers.
- Added loadable module support to all drivers.
- Added HV calls for iopte management (needed by sound driver).

---
 arch/powerpc/platforms/ps3/interrupt.c  |   24 -
 arch/powerpc/platforms/ps3/mm.c         |  618 ++++++++++++++++++++++++++------
 arch/powerpc/platforms/ps3/platform.h   |   11 
 arch/powerpc/platforms/ps3/system-bus.c |  527 +++++++++++++++++++++++----
 include/asm-powerpc/lv1call.h           |    3 
 include/asm-powerpc/ps3.h               |  149 +++++--
 6 files changed, 1081 insertions(+), 251 deletions(-)
arch/powerpc/platforms/ps3/interrupt.c +11 -13
@@ -401,17 +401,15 @@ int ps3_send_event_locally(unsigned int 
  * ps3_sb_event_receive_port_setup - Setup a system bus event receive port.
  * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be
  * serviced on.
- * @did: The HV device identifier read from the system repository.
- * @interrupt_id: The device interrupt id read from the system repository.
+ * @dev: The system bus device instance.
  * @virq: The assigned Linux virq.
  *
  * An event irq represents a virtual device interrupt.  The interrupt_id
  * coresponds to the software interrupt number.
  */
 
-int ps3_sb_event_receive_port_setup(enum ps3_cpu_binding cpu,
-	const struct ps3_device_id *did, unsigned int interrupt_id,
-	unsigned int *virq)
+int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev,
+	enum ps3_cpu_binding cpu, unsigned int *virq)
 {
 	/* this should go in system-bus.c */
 
@@ -422,8 +420,8 @@ int ps3_sb_event_receive_port_setup(enum
 	if (result)
 		return result;
 
-	result = lv1_connect_interrupt_event_receive_port(did->bus_id,
-		did->dev_id, virq_to_hw(*virq), interrupt_id);
+	result = lv1_connect_interrupt_event_receive_port(dev->bus_id,
+		dev->dev_id, virq_to_hw(*virq), dev->interrupt_id);
 
 	if (result) {
 		pr_debug("%s:%d: lv1_connect_interrupt_event_receive_port"
@@ -435,24 +433,24 @@ int ps3_sb_event_receive_port_setup(enum
 	}
 
 	pr_debug("%s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__,
-		interrupt_id, *virq);
+		dev->interrupt_id, *virq);
 
 	return 0;
 }
 EXPORT_SYMBOL(ps3_sb_event_receive_port_setup);
 
-int ps3_sb_event_receive_port_destroy(const struct ps3_device_id *did,
-	unsigned int interrupt_id, unsigned int virq)
+int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev,
+	unsigned int virq)
 {
 	/* this should go in system-bus.c */
 
 	int result;
 
 	pr_debug(" -> %s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__,
-		interrupt_id, virq);
+		dev->interrupt_id, virq);
 
-	result = lv1_disconnect_interrupt_event_receive_port(did->bus_id,
-		did->dev_id, virq_to_hw(virq), interrupt_id);
+	result = lv1_disconnect_interrupt_event_receive_port(dev->bus_id,
+		dev->dev_id, virq_to_hw(virq), dev->interrupt_id);
 
 	if (result)
 		pr_debug("%s:%d: lv1_disconnect_interrupt_event_receive_port"
arch/powerpc/platforms/ps3/mm.c +511 -107

904 lines not on this page · raw message

arch/powerpc/platforms/ps3/platform.h +11 -0
@@ -83,6 +83,7 @@ enum ps3_dev_type {
 	PS3_DEV_TYPE_STOR_ROM = TYPE_ROM,	/* 5 */
 	PS3_DEV_TYPE_SB_GPIO = 6,
 	PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC,	/* 14 */
+	PS3_DEV_TYPE_NOACCESS = 255,
 };
 
 int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str,
@@ -217,4 +218,14 @@ int ps3_repository_read_num_spu_resource
 int ps3_repository_read_spu_resource_id(unsigned int res_index,
 	enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);
 
+/* Page table entries */
+#define IOPTE_PP_W		0x8000000000000000ul /* protection: write */
+#define IOPTE_PP_R		0x4000000000000000ul /* protection: read */
+#define IOPTE_M			0x2000000000000000ul /* coherency required */
+#define IOPTE_SO_R		0x1000000000000000ul /* ordering: writes */
+#define IOPTE_SO_RW             0x1800000000000000ul /* ordering: r & w */
+#define IOPTE_RPN_Mask		0x07fffffffffff000ul /* RPN */
+#define IOPTE_H			0x0000000000000800ul /* cache hint */
+#define IOPTE_IOID_Mask		0x00000000000007fful /* ioid */
+
 #endif
arch/powerpc/platforms/ps3/system-bus.c +446 -81

724 lines not on this page · raw message

include/asm-powerpc/lv1call.h +3 -0
@@ -238,6 +238,7 @@ LV1_CALL(destruct_virtual_address_space,
 LV1_CALL(configure_irq_state_bitmap,                    3, 0,  11 )
 LV1_CALL(connect_irq_plug_ext,                          5, 0,  12 )
 LV1_CALL(release_memory,                                1, 0,  13 )
+LV1_CALL(put_iopte,                                     5, 0,  15 )
 LV1_CALL(disconnect_irq_plug_ext,                       3, 0,  17 )
 LV1_CALL(construct_event_receive_port,                  0, 1,  18 )
 LV1_CALL(destruct_event_receive_port,                   1, 0,  19 )
@@ -268,6 +269,8 @@ LV1_CALL(remove_repository_node,        
 LV1_CALL(read_htab_entries,                             2, 5,  95 )
 LV1_CALL(set_dabr,                                      2, 0,  96 )
 LV1_CALL(get_total_execution_time,                      2, 1, 103 )
+LV1_CALL(allocate_io_segment,                           3, 1, 116 )
+LV1_CALL(release_io_segment,                            2, 0, 117 )
 LV1_CALL(construct_io_irq_outlet,                       1, 1, 120 )
 LV1_CALL(destruct_io_irq_outlet,                        1, 0, 121 )
 LV1_CALL(map_htab,                                      1, 1, 122 )
include/asm-powerpc/ps3.h +99 -50

254 lines not on this page · raw message

#17 lore raw

PATCH 12/30 PS3: System-bus uevent

In reply to a message not in the archive

From: David Woodhouse <[email protected]>

To allow userspace to automatically load modules, we need to hook up uevent for ps3_system_bus devices. I've used the form 'ps3:%d' with the ps3_match_id, since that's what we use for matching drivers.

---
 arch/powerpc/platforms/ps3/system-bus.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/powerpc/platforms/ps3/system-bus.c +16 -0
@@ -437,9 +437,25 @@ static void ps3_system_bus_shutdown(stru
 	dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
 }
 
+static int ps3_system_bus_uevent(struct device *_dev, char **envp,
+				 int num_envp, char *buffer, int buffer_size)
+{
+	struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
+	int i=0, length = 0;
+
+	if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
+			   &length, "MODALIAS=ps3:%d",
+			   dev->match_id))
+		return -ENOMEM;
+
+	envp[i] = NULL;
+	return 0;
+}
+
 struct bus_type ps3_system_bus_type = {
 	.name = "ps3_system_bus",
 	.match = ps3_system_bus_match,
+	.uevent = ps3_system_bus_uevent,
 	.probe = ps3_system_bus_probe,
 	.remove = ps3_system_bus_remove,
 	.shutdown = ps3_system_bus_shutdown,
#18 lore raw

PATCH 13/30 PS3: System-bus modinfo attribute

In reply to a message not in the archive

From: David Woodhouse <[email protected]>

Add modinfo attribute to ps3_system_bus devices. Also make them all children of the same ps3_system_bus 'device' so they appear in a corresponding subdirectory under /sys/devices

---
 arch/powerpc/platforms/ps3/system-bus.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/powerpc/platforms/ps3/system-bus.c +15 -0
@@ -452,6 +452,20 @@ static int ps3_system_bus_uevent(struct 
 	return 0;
 }
 
+static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
+	char *buf)
+{
+	struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
+	int len = snprintf(buf, PAGE_SIZE, "ps3:%d\n", dev->match_id);
+
+	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
+}
+
+static struct device_attribute ps3_system_bus_dev_attrs[] = {
+	__ATTR_RO(modalias),
+	__ATTR_NULL,
+};
+
 struct bus_type ps3_system_bus_type = {
 	.name = "ps3_system_bus",
 	.match = ps3_system_bus_match,
@@ -459,6 +473,7 @@ struct bus_type ps3_system_bus_type = {
 	.probe = ps3_system_bus_probe,
 	.remove = ps3_system_bus_remove,
 	.shutdown = ps3_system_bus_shutdown,
+	.dev_attrs = ps3_system_bus_dev_attrs,
 };
 
 static int __init ps3_system_bus_init(void)
#19 lore raw

PATCH 14/30 PS3: Repository probe cleanups

In reply to a message not in the archive

Repository updates:
- Extract ps3_repository_find_bus() from ps3_repository_find_device(), as the storage driver needs it.
- Make ps3_repository_find_device() return -ENODEV if a device is not found, just like if a bus is not found.
- Add ps3_repository_read_vuart_sysmgr_port() and ps3_repository_read_vuart_av_port() to get vuart port info.
- Add device enumeration routines ps3_repository_find_device() and ps3_repository_find_devices().
- Cleanup debug routines.

---
 arch/powerpc/platforms/ps3/platform.h   |   31 +
 arch/powerpc/platforms/ps3/repository.c |  592 +++++++++++++++++---------------
 2 files changed, 340 insertions(+), 283 deletions(-)
arch/powerpc/platforms/ps3/platform.h +20 -11
@@ -131,24 +131,28 @@ int ps3_repository_read_dev_reg(unsigned
 /* repository bus enumerators */
 
 struct ps3_repository_device {
+	enum ps3_bus_type bus_type;
 	unsigned int bus_index;
+	unsigned int bus_id;
+	enum ps3_dev_type dev_type;
 	unsigned int dev_index;
-	struct ps3_device_id did;
+	unsigned int dev_id;
 };
 
-int ps3_repository_find_device(enum ps3_bus_type bus_type,
-	enum ps3_dev_type dev_type,
-	const struct ps3_repository_device *start_dev,
-	struct ps3_repository_device *dev);
-static inline int ps3_repository_find_first_device(
-	enum ps3_bus_type bus_type, enum ps3_dev_type dev_type,
-	struct ps3_repository_device *dev)
+static inline struct ps3_repository_device *ps3_repository_bump_device(
+	struct ps3_repository_device *repo)
 {
-	return ps3_repository_find_device(bus_type, dev_type, NULL, dev);
+	repo->dev_index++;
+	return repo;
 }
-int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
+int ps3_repository_find_device(struct ps3_repository_device *repo);
+int ps3_repository_find_devices(enum ps3_bus_type bus_type,
+	int (*callback)(const struct ps3_repository_device *repo));
+int ps3_repository_find_bus(enum ps3_bus_type bus_type, unsigned int from,
+	unsigned int *bus_index);
+int ps3_repository_find_interrupt(const struct ps3_repository_device *repo,
 	enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
-int ps3_repository_find_reg(const struct ps3_repository_device *dev,
+int ps3_repository_find_reg(const struct ps3_repository_device *repo,
 	enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len);
 
 /* repository block device info */
@@ -218,6 +222,11 @@ int ps3_repository_read_num_spu_resource
 int ps3_repository_read_spu_resource_id(unsigned int res_index,
 	enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);
 
+/* repository vuart info */
+
+int ps3_repository_read_vuart_av_port(unsigned int *port);
+int ps3_repository_read_vuart_sysmgr_port(unsigned int *port);
+
 /* Page table entries */
 #define IOPTE_PP_W		0x8000000000000000ul /* protection: write */
 #define IOPTE_PP_R		0x4000000000000000ul /* protection: read */
arch/powerpc/platforms/ps3/repository.c +320 -272

690 lines not on this page · raw message

#20 lore raw

PATCH 15/30 PS3: Vuart rework

In reply to a message not in the archive

PS3 vuart updates to reflect the new PS3 unified device support.
- Move vuart devices to the PS3 system bus.
- Replace use of ps3_vuart_port_device with ps3_system_bus_device.
- Make the PS3 vuart bus driver a loadable module.
- Add remove() and shutdown() routines.
- Move ps3_vuart_work into ps3_vuart_port_priv.tx_list.
- Remove redundant spinlock ps3_vuart_work.lock.
- No longer free ps3_vuart_port_device.priv on shutdown.
- Cleanup Kconfig defs.
- Export symbols needed for modular port drivers.
- Arrange to use port numbers found in repository.
- Fix bugs in ps3_vuart_read_async() and polled reading
- Cleanup handling of shared interrupt with ps3_vuart_bus_interrupt_get() and ps3_vuart_bus_interrupt_put()
- Add more comments to vuart.c.

---
 arch/powerpc/platforms/ps3/Kconfig     |   21 
 arch/powerpc/platforms/ps3/interrupt.c |    2 
 drivers/ps3/vuart.c                    |  813 +++++++++++++++++++--------------
 drivers/ps3/vuart.h                    |   71 --
 include/asm-powerpc/ps3.h              |   17 
 5 files changed, 520 insertions(+), 404 deletions(-)
arch/powerpc/platforms/ps3/Kconfig +8 -13
@@ -73,18 +73,12 @@ config PS3_USE_LPAR_ADDR
 
 config PS3_VUART
 	depends on PPC_PS3
-	bool "PS3 Virtual UART support" if PS3_ADVANCED
-	default y
-	help
-	  Include support for the PS3 Virtual UART.
-
-	  This support is required for several system services
-	  including the System Manager and AV Settings.  In
-	  general, all users will say Y.
+	tristate
 
 config PS3_PS3AV
+	depends on PPC_PS3
 	tristate "PS3 AV settings driver" if PS3_ADVANCED
-	depends on PS3_VUART
+	select PS3_VUART
 	default y
 	help
 	  Include support for the PS3 AV Settings driver.
@@ -93,13 +87,14 @@ config PS3_PS3AV
 	  general, all users will say Y or M.
 
 config PS3_SYS_MANAGER
-	bool "PS3 System Manager driver" if PS3_ADVANCED
-	depends on PS3_VUART
-	default y
+	depends on PPC_PS3
+	tristate "PS3 System Manager driver" if PS3_ADVANCED
+	select PS3_VUART
+	default m
 	help
 	  Include support for the PS3 System Manager.
 
 	  This support is required for system control.  In
-	  general, all users will say Y.
+	  general, all users will say Y or M.
 
 endmenu
arch/powerpc/platforms/ps3/interrupt.c +2 -0
@@ -565,6 +565,7 @@ int ps3_vuart_irq_setup(enum ps3_cpu_bin
 
 	return result;
 }
+EXPORT_SYMBOL_GPL(ps3_vuart_irq_setup);
 
 int ps3_vuart_irq_destroy(unsigned int virq)
 {
@@ -584,6 +585,7 @@ int ps3_vuart_irq_destroy(unsigned int v
 
 	return result;
 }
+EXPORT_SYMBOL_GPL(ps3_vuart_irq_destroy);
 
 /**
  * ps3_spe_irq_setup - Setup an spe virq.
drivers/ps3/vuart.c +487 -326

1,294 lines not on this page · raw message

drivers/ps3/vuart.h +23 -48

98 lines not on this page · raw message

include/asm-powerpc/ps3.h +0 -17
@@ -408,23 +408,6 @@ static inline void *ps3_system_bus_get_d
 
 extern struct bus_type ps3_system_bus_type;
 
-/* vuart routines */
-
-struct ps3_vuart_port_priv;
-
-/**
- * struct ps3_vuart_port_device - a device on a vuart port
- */
-
-struct ps3_vuart_port_device {
-	enum ps3_match_id match_id;
-	struct device core;
-	struct ps3_vuart_port_priv* priv; /* private driver variables */
-
-};
-
-int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
-
 /* system manager */
 
 #ifdef CONFIG_PS3_SYS_MANAGER
#21 lore raw

PATCH 16/30 PS3: System manager re-work

In reply to a message not in the archive

PS3 sys-manager updates to reflect the new PS3 unifed device support. Fixups to the PS3 sys-manager driver to properly support sys_reboot().
- Add varable request_tag to struct ps3_sys_manager_header.
- Move ctrl_alt_del from PS3_SM_EVENT_POWER_RELEASED to PS3_SM_EVENT_POWER_PRESSED.
- Make the PS3 sys-manager driver a loadable module.
- Add new file sys-manager-core.c.
- Add new struct ps3_sys_manager_ops for dynamic binding.
- Put data sent to device on stack.
- Add support for PS3_SM_SERVICE_ID_REQUEST_ERROR.

---
 drivers/ps3/Makefile           |    1 
 drivers/ps3/sys-manager-core.c |   68 +++++++++
 drivers/ps3/sys-manager.c      |  280 ++++++++++++++++++++++++++---------------
 include/asm-powerpc/ps3.h      |   15 +-
 4 files changed, 259 insertions(+), 105 deletions(-)
drivers/ps3/Makefile +1 -0
@@ -1,3 +1,4 @@
 obj-$(CONFIG_PS3_VUART) += vuart.o
 obj-$(CONFIG_PS3_PS3AV) += ps3av.o ps3av_cmd.o
+obj-$(CONFIG_PPC_PS3) += sys-manager-core.o
 obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o
drivers/ps3/sys-manager-core.c new file +68 -0

68 lines not on this page · raw message

drivers/ps3/sys-manager.c +181 -99

506 lines not on this page · raw message

include/asm-powerpc/ps3.h +9 -6
@@ -410,13 +410,15 @@ extern struct bus_type ps3_system_bus_ty
 
 /* system manager */
 
-#ifdef CONFIG_PS3_SYS_MANAGER
-void ps3_sys_manager_restart(void);
+struct ps3_sys_manager_ops {
+	struct ps3_system_bus_device *dev;
+	void (*power_off)(struct ps3_system_bus_device *dev);
+	void (*restart)(struct ps3_system_bus_device *dev);
+};
+
+void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops);
 void ps3_sys_manager_power_off(void);
-#else
-static inline void ps3_sys_manager_restart(void) {}
-static inline void ps3_sys_manager_power_off(void) {}
-#endif
+void ps3_sys_manager_restart(void);
 
 struct ps3_prealloc {
     const char *name;
@@ -427,4 +429,5 @@ struct ps3_prealloc {
 
 extern struct ps3_prealloc ps3fb_videomemory;
 
+
 #endif
#22 lore raw

PATCH 17/30 PS3: Rework AV settings driver

In reply to a message not in the archive

Make the PS3 ps3av driver a loadable module.
- Replace static data with malloc'ed.
o Allocate struct ps3av dynamically, as it contains data used as vuart receive/transmit buffers
o Move static recv_buf from ps3av_do_pkt() to struct ps3av
- Move ps3av_vuart_{read,write}() from drivers/ps3/ps3av_cmd.c to drivers/ps3/ps3av.c and make them static as they're used in that file only.
- Make device a PS3 system-bus device.
- Update copyright formatting.
- Make two new routines ps3av_register_flip_ctl() and ps3av_flip_ctl() to support late binding of the frame buffer flip control routine.

---
 drivers/ps3/Makefile        |    3 
 drivers/ps3/ps3av.c         |  369 +++++++++++++++++++++++---------------------
 drivers/ps3/ps3av_cmd.c     |   35 ----
 include/asm-powerpc/ps3av.h |   36 ++--
 4 files changed, 219 insertions(+), 224 deletions(-)
drivers/ps3/Makefile +2 -1
@@ -1,4 +1,5 @@
 obj-$(CONFIG_PS3_VUART) += vuart.o
-obj-$(CONFIG_PS3_PS3AV) += ps3av.o ps3av_cmd.o
+obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o
+ps3av_mod-objs		+= ps3av.o ps3av_cmd.o
 obj-$(CONFIG_PPC_PS3) += sys-manager-core.o
 obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o
drivers/ps3/ps3av.c +197 -172

732 lines not on this page · raw message

drivers/ps3/ps3av_cmd.c +2 -33
@@ -868,7 +868,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt
 {
 	int res;
 
-	ps3fb_flip_ctl(0);	/* flip off */
+	ps3av_flip_ctl(0);	/* flip off */
 
 	/* avb packet */
 	res = ps3av_do_pkt(PS3AV_CID_AVB_PARAM, send_len, sizeof(*avb),
@@ -882,7 +882,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt
 			 res);
 
       out:
-	ps3fb_flip_ctl(1);	/* flip on */
+	ps3av_flip_ctl(1);	/* flip on */
 	return res;
 }
 
@@ -1003,34 +1003,3 @@ void ps3av_cmd_av_monitor_info_dump(cons
 		| PS3AV_CMD_AV_LAYOUT_176 \
 		| PS3AV_CMD_AV_LAYOUT_192)
 
-/************************* vuart ***************************/
-
-#define POLLING_INTERVAL  25	/* in msec */
-
-int ps3av_vuart_write(struct ps3_vuart_port_device *dev, const void *buf,
-		      unsigned long size)
-{
-	int error = ps3_vuart_write(dev, buf, size);
-	return error ? error : size;
-}
-
-int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
-		     unsigned long size, int timeout)
-{
-	int error;
-	int loopcnt = 0;
-
-	timeout = (timeout + POLLING_INTERVAL - 1) / POLLING_INTERVAL;
-	while (loopcnt++ <= timeout) {
-		error = ps3_vuart_read(dev, buf, size);
-		if (!error)
-			return size;
-		if (error != -EAGAIN) {
-			printk(KERN_ERR "%s: ps3_vuart_read failed %d\n",
-			       __func__, error);
-			return error;
-		}
-		msleep(POLLING_INTERVAL);
-	}
-	return -EWOULDBLOCK;
-}
include/asm-powerpc/ps3av.h +18 -18
@@ -1,20 +1,23 @@
 /*
- * Copyright (C) 2006 Sony Computer Entertainment Inc.
- * Copyright 2006, 2007 Sony Corporation
+ *  PS3 AV backend support.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published
- * by the Free Software Foundation; version 2 of the License.
+ *  Copyright (C) 2007 Sony Computer Entertainment Inc.
+ *  Copyright 2007 Sony Corp.
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
  *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
 #ifndef _ASM_POWERPC_PS3AV_H_
 #define _ASM_POWERPC_PS3AV_H_
 
@@ -704,12 +707,6 @@ static inline void ps3av_cmd_av_monitor_
 extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
 					    u32);
 
-struct ps3_vuart_port_device;
-extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev,
-			     const void *buf, unsigned long size);
-extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
-			    unsigned long size, int timeout);
-
 extern int ps3av_set_video_mode(u32, int);
 extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
 extern int ps3av_get_auto_mode(int);
@@ -722,5 +719,8 @@ extern int ps3av_video_mute(int);
 extern int ps3av_audio_mute(int);
 extern int ps3av_dev_open(void);
 extern int ps3av_dev_close(void);
+extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
+				    void *flip_data);
+extern void ps3av_flip_ctl(int on);
 
 #endif	/* _ASM_POWERPC_PS3AV_H_ */
#23 lore raw

PATCH 18/30 PS3: Frame buffer system-bus rework

In reply to a message not in the archive

From: Geert Uytterhoeven <[email protected]>

Convert the ps3fb device from a platform device to a PS3 system bus device. Fix the remove and shutdown methods to support kexec and to make ps3fb a loadable module.

---
 arch/powerpc/platforms/ps3/setup.c |    9 -
 drivers/video/Kconfig              |    4 
 drivers/video/ps3fb.c              |  288 ++++++++++++++++---------------------
 include/asm-powerpc/ps3fb.h        |   12 -
 4 files changed, 132 insertions(+), 181 deletions(-)
arch/powerpc/platforms/ps3/setup.c +5 -4
@@ -108,7 +108,7 @@ static void ps3_panic(char *str)
 	while(1);
 }
 
-#ifdef CONFIG_FB_PS3
+#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE)
 static void prealloc(struct ps3_prealloc *p)
 {
 	if (!p->size)
@@ -126,10 +126,11 @@ static void prealloc(struct ps3_prealloc
 }
 
 struct ps3_prealloc ps3fb_videomemory = {
-    .name = "ps3fb videomemory",
-    .size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024,
-    .align = 1024*1024			/* the GPU requires 1 MiB alignment */
+	.name = "ps3fb videomemory",
+	.size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024,
+	.align = 1024*1024		/* the GPU requires 1 MiB alignment */
 };
+EXPORT_SYMBOL_GPL(ps3fb_videomemory);
 #define prealloc_ps3fb_videomemory()	prealloc(&ps3fb_videomemory)
 
 static int __init early_parse_ps3fb(char *p)
drivers/video/Kconfig +2 -2
@@ -1790,8 +1790,8 @@ config FB_IBM_GXT4500
 	  adaptor, found on some IBM System P (pSeries) machines.
 
 config FB_PS3
-	bool "PS3 GPU framebuffer driver"
-	depends on (FB = y) && PS3_PS3AV
+	tristate "PS3 GPU framebuffer driver"
+	depends on FB && PS3_PS3AV
 	select FB_SYS_FILLRECT
 	select FB_SYS_COPYAREA
 	select FB_SYS_IMAGEBLIT
drivers/video/ps3fb.c +125 -163

443 lines not on this page · raw message

include/asm-powerpc/ps3fb.h +0 -12
@@ -41,16 +41,4 @@ struct ps3fb_ioctl_res {
 	__u32 num_frames; /* num of frame buffers */
 };
 
-#ifdef __KERNEL__
-
-#ifdef CONFIG_FB_PS3
-extern void ps3fb_flip_ctl(int on);
-extern void ps3fb_cleanup(void);
-#else
-static inline void ps3fb_flip_ctl(int on) {}
-static inline void ps3fb_cleanup(void) {}
-#endif
-
-#endif /* __KERNEL__ */
-
 #endif /* _ASM_POWERPC_PS3FB_H_ */
#24 lore raw

PATCH 19/30 PS3: Device registration routines.

In reply to a message not in the archive

Add routines to probe devices present on the system and to register those devices with the LDM.

---
 arch/powerpc/platforms/ps3/Makefile      |    1 
 arch/powerpc/platforms/ps3/device-init.c |  499 +++++++++++++++++++++++++++++++
 2 files changed, 500 insertions(+)
arch/powerpc/platforms/ps3/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-y += system-bus.o
 
 obj-$(CONFIG_SMP) += smp.o
 obj-$(CONFIG_SPU_BASE) += spu.o
+obj-y += device-init.o
arch/powerpc/platforms/ps3/device-init.c new file +499 -0

499 lines not on this page · raw message

#25 lore raw

PATCH 20/30 PS3: Rename processor id symbols

In reply to a message not in the archive

Rename the PS3 static symbols node to ppe_id and cpu to thread_id to clarify usage.

---
 arch/powerpc/platforms/ps3/interrupt.c |   55 +++++++++++++++++----------------
 1 file changed, 29 insertions(+), 26 deletions(-)
arch/powerpc/platforms/ps3/interrupt.c +29 -26
@@ -79,14 +79,14 @@ struct ps3_bmp {
 /**
  * struct ps3_private - a per cpu data structure
  * @bmp: ps3_bmp structure
- * @node: HV logical_ppe_id
- * @cpu: HV thread_id
+ * @ppe_id: HV logical_ppe_id
+ * @thread_id: HV thread_id
  */
 
 struct ps3_private {
 	struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN)));
-	u64 node;
-	unsigned int cpu;
+	u64 ppe_id;
+	u64 thread_id;
 };
 
 static DEFINE_PER_CPU(struct ps3_private, ps3_private);
@@ -106,7 +106,8 @@ static void ps3_chip_mask(unsigned int v
 	u64 old;
 	unsigned long flags;
 
-	pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
+	pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__,
+		pd->thread_id, virq);
 
 	local_irq_save(flags);
 	asm volatile(
@@ -118,7 +119,7 @@ static void ps3_chip_mask(unsigned int v
 		     : "r" (bit), "r" (p)
 		     : "cc" );
 
-	lv1_did_update_interrupt_mask(pd->node, pd->cpu);
+	lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id);
 	local_irq_restore(flags);
 }
 
@@ -137,7 +138,8 @@ static void ps3_chip_unmask(unsigned int
 	u64 old;
 	unsigned long flags;
 
-	pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
+	pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__,
+		pd->thread_id, virq);
 
 	local_irq_save(flags);
 	asm volatile(
@@ -149,7 +151,7 @@ static void ps3_chip_unmask(unsigned int
 		     : "r" (bit), "r" (p)
 		     : "cc" );
 
-	lv1_did_update_interrupt_mask(pd->node, pd->cpu);
+	lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id);
 	local_irq_restore(flags);
 }
 
@@ -163,7 +165,7 @@ static void ps3_chip_unmask(unsigned int
 static void ps3_chip_eoi(unsigned int virq)
 {
 	const struct ps3_private *pd = get_irq_chip_data(virq);
-	lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq);
+	lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, virq);
 }
 
 /**
@@ -242,8 +244,8 @@ int ps3_virq_destroy(unsigned int virq)
 {
 	const struct ps3_private *pd = get_irq_chip_data(virq);
 
-	pr_debug("%s:%d: node %lu, cpu %d, virq %u\n", __func__, __LINE__,
-		pd->node, pd->cpu, virq);
+	pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__,
+		__LINE__, pd->ppe_id, pd->thread_id, virq);
 
 	set_irq_chip_data(virq, NULL);
 	irq_dispose_mapping(virq);
@@ -279,7 +281,8 @@ int ps3_irq_plug_setup(enum ps3_cpu_bind
 
 	/* Binds outlet to cpu + virq. */
 
-	result = lv1_connect_irq_plug_ext(pd->node, pd->cpu, *virq, outlet, 0);
+	result = lv1_connect_irq_plug_ext(pd->ppe_id, pd->thread_id, *virq,
+		outlet, 0);
 
 	if (result) {
 		pr_info("%s:%d: lv1_connect_irq_plug_ext failed: %s\n",
@@ -311,12 +314,12 @@ int ps3_irq_plug_destroy(unsigned int vi
 	int result;
 	const struct ps3_private *pd = get_irq_chip_data(virq);
 
-	pr_debug("%s:%d: node %lu, cpu %d, virq %u\n", __func__, __LINE__,
-		pd->node, pd->cpu, virq);
+	pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__,
+		__LINE__, pd->ppe_id, pd->thread_id, virq);
 
 	ps3_chip_mask(virq);
 
-	result = lv1_disconnect_irq_plug_ext(pd->node, pd->cpu, virq);
+	result = lv1_disconnect_irq_plug_ext(pd->ppe_id, pd->thread_id, virq);
 
 	if (result)
 		pr_info("%s:%d: lv1_disconnect_irq_plug_ext failed: %s\n",
@@ -658,8 +661,8 @@ static void _dump_bmp(struct ps3_private
 	unsigned long flags;
 
 	spin_lock_irqsave(&pd->bmp.lock, flags);
-	_dump_64_bmp("stat", &pd->bmp.status, pd->cpu, func, line);
-	_dump_64_bmp("mask", &pd->bmp.mask, pd->cpu, func, line);
+	_dump_64_bmp("stat", &pd->bmp.status, pd->thread_id, func, line);
+	_dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line);
 	spin_unlock_irqrestore(&pd->bmp.lock, flags);
 }
 
@@ -670,7 +673,7 @@ static void __maybe_unused _dump_mask(st
 	unsigned long flags;
 
 	spin_lock_irqsave(&pd->bmp.lock, flags);
-	_dump_64_bmp("mask", &pd->bmp.mask, pd->cpu, func, line);
+	_dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line);
 	spin_unlock_irqrestore(&pd->bmp.lock, flags);
 }
 #else
@@ -723,8 +726,8 @@ static unsigned int ps3_get_irq(void)
 	plug &= 0x3f;
 
 	if (unlikely(plug) == NO_IRQ) {
-		pr_debug("%s:%d: no plug found: cpu %u\n", __func__, __LINE__,
-			pd->cpu);
+		pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__,
+			__LINE__, pd->thread_id);
 		dump_bmp(&per_cpu(ps3_private, 0));
 		dump_bmp(&per_cpu(ps3_private, 1));
 		return NO_IRQ;
@@ -754,16 +757,16 @@ void __init ps3_init_IRQ(void)
 	for_each_possible_cpu(cpu) {
 		struct ps3_private *pd = &per_cpu(ps3_private, cpu);
 
-		lv1_get_logical_ppe_id(&pd->node);
-		pd->cpu = get_hard_smp_processor_id(cpu);
+		lv1_get_logical_ppe_id(&pd->ppe_id);
+		pd->thread_id = get_hard_smp_processor_id(cpu);
 		spin_lock_init(&pd->bmp.lock);
 
-		pr_debug("%s:%d: node %lu, cpu %d, bmp %lxh\n", __func__,
-			__LINE__, pd->node, pd->cpu,
+		pr_debug("%s:%d: ppe_id %lu, thread_id %lu, bmp %lxh\n",
+			__func__, __LINE__, pd->ppe_id, pd->thread_id,
 			ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
 
-		result = lv1_configure_irq_state_bitmap(pd->node, pd->cpu,
-			ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
+		result = lv1_configure_irq_state_bitmap(pd->ppe_id,
+			pd->thread_id, ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
 
 		if (result)
 			pr_debug("%s:%d: lv1_configure_irq_state_bitmap failed:"
#26 lore raw

PATCH 21/30 PS3: Use clear_bit

In reply to a message not in the archive

Replace inline asm to bitops routines in the PS3 interrupt chip mask routines.

---
 arch/powerpc/platforms/ps3/interrupt.c |   26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)
arch/powerpc/platforms/ps3/interrupt.c +2 -24
@@ -101,24 +101,13 @@ static DEFINE_PER_CPU(struct ps3_private
 static void ps3_chip_mask(unsigned int virq)
 {
 	struct ps3_private *pd = get_irq_chip_data(virq);
-	u64 bit = 0x8000000000000000UL >> virq;
-	u64 *p = &pd->bmp.mask;
-	u64 old;
 	unsigned long flags;
 
 	pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__,
 		pd->thread_id, virq);
 
 	local_irq_save(flags);
-	asm volatile(
-		     "1:	ldarx %0,0,%3\n"
-		     "andc	%0,%0,%2\n"
-		     "stdcx.	%0,0,%3\n"
-		     "bne-	1b"
-		     : "=&r" (old), "+m" (*p)
-		     : "r" (bit), "r" (p)
-		     : "cc" );
-
+	clear_bit(63 - virq, &pd->bmp.mask);
 	lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id);
 	local_irq_restore(flags);
 }
@@ -133,24 +122,13 @@ static void ps3_chip_mask(unsigned int v
 static void ps3_chip_unmask(unsigned int virq)
 {
 	struct ps3_private *pd = get_irq_chip_data(virq);
-	u64 bit = 0x8000000000000000UL >> virq;
-	u64 *p = &pd->bmp.mask;
-	u64 old;
 	unsigned long flags;
 
 	pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__,
 		pd->thread_id, virq);
 
 	local_irq_save(flags);
-	asm volatile(
-		     "1:	ldarx %0,0,%3\n"
-		     "or	%0,%0,%2\n"
-		     "stdcx.	%0,0,%3\n"
-		     "bne-	1b"
-		     : "=&r" (old), "+m" (*p)
-		     : "r" (bit), "r" (p)
-		     : "cc" );
-
+	set_bit(63 - virq, &pd->bmp.mask);
 	lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id);
 	local_irq_restore(flags);
 }
#27 lore raw

PATCH 22/30 Powerpc: Output params value in early_init_devtree

In reply to a message not in the archive

Add a printout of the params value to early_init_devtree. This value is handy to have for comparison when debugging the bootwrapper code.

---
 arch/powerpc/kernel/prom.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom.c +1 -1
@@ -1005,7 +1005,7 @@ static void __init early_reserve_mem(voi
 
 void __init early_init_devtree(void *params)
 {
-	DBG(" -> early_init_devtree()\n");
+	DBG(" -> early_init_devtree(%p)\n", params);
 
 	/* Setup flat device-tree pointer */
 	initial_boot_params = params;
#28 lore raw

PATCH 23/30 powerpc: Localize mmu_off

In reply to a message not in the archive

This just removes the dependency __mmu_off has on the symbol __after_prom_start. I found the current code inconvenient when I wanted to put some debugging code between the call to __mmu_off and the branch to __after_prom_start.

---
 arch/powerpc/kernel/head_64.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/head_64.S +3 -1
@@ -1695,9 +1695,11 @@ _GLOBAL(__start_initialization_multiplat
 2:
 
 	/* Switch off MMU if not already */
-	LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
+	LOAD_REG_IMMEDIATE(r4, __mmu_off_return - KERNELBASE)
 	add	r4,r4,r30
 	bl	.__mmu_off
+__mmu_off_return:
+
 	b	.__after_prom_start
 
 _STATIC(__boot_from_prom)
#29 lore raw

PATCH 24/30 powerpc: Correct __secondary_hold comment

In reply to a message not in the archive

Remove references to pSeries and OpenFirmware in the __secondary_hold usage comment. __secondary_hold is a generic routine and can be used by other platforms.

---
 arch/powerpc/kernel/head_64.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/head_64.S +2 -2
@@ -103,8 +103,8 @@ __secondary_hold_acknowledge:
 
 	. = 0x60
 /*
- * The following code is used on pSeries to hold secondary processors
- * in a spin loop after they have been freed from OpenFirmware, but
+ * The following code is used to hold secondary processors
+ * in a spin loop after they have entered the kernel, but
  * before the bulk of the kernel has been relocated.  This code
  * is relocated to physical address 0x60 before prom_init is run.
  * All of it must fit below the first exception vector at 0x100.
#30 lore raw

PATCH 25/30 Powerpc: Add signed types to bootwrapper

In reply to a message not in the archive

Add signed types to the powerpc zImage bootwrapper. These are needed by the PS3 hcall interface.

---
 arch/powerpc/boot/types.h |    4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/boot/types.h +4 -0
@@ -7,6 +7,10 @@ typedef unsigned char		u8;
 typedef unsigned short		u16;
 typedef unsigned int		u32;
 typedef unsigned long long	u64;
+typedef signed char		s8;
+typedef short			s16;
+typedef int			s32;
+typedef long long		s64;
 
 #define min(x,y) ({ \
 	typeof(x) _x = (x);	\
#31 lore raw

PATCH 26/30 Powerpc: Add u64 printf to bootwrapper

In reply to a message not in the archive

Add support for the 'll' (long long) printf qualifier in the powerpc zImage bootwrapper. This is useful for bootwrapper debugging on 64 bit platforms.

---
 arch/powerpc/boot/stdio.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/powerpc/boot/stdio.c +9 -1
@@ -190,7 +190,11 @@ int vsprintf(char *buf, const char *fmt,
 
 		/* get the conversion qualifier */
 		qualifier = -1;
-		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
+		if (*fmt == 'l' && *(fmt + 1) =='l') {
+			qualifier = 'q';
+			fmt += 2;
+		} else if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L'
+			|| *fmt =='Z') {
 			qualifier = *fmt;
 			++fmt;
 		}
@@ -281,6 +285,10 @@ int vsprintf(char *buf, const char *fmt,
 			num = va_arg(args, unsigned long);
 			if (flags & SIGN)
 				num = (signed long) num;
+		} else if (qualifier == 'q') {
+			num = va_arg(args, unsigned long long);
+			if (flags & SIGN)
+				num = (signed long long) num;
 		} else if (qualifier == 'Z') {
 			num = va_arg(args, size_t);
 		} else if (qualifier == 'h') {
#32 lore raw

PATCH 27/30 Powerpc: Fix constantness of bootwrapper arg

In reply to a message not in the archive

Fixes the constantness of the powerpc bootwrapper's console_ops.write routine. Allows writing of constant strings.

---
 arch/powerpc/boot/of.c     |    2 +-
 arch/powerpc/boot/ops.h    |    2 +-
 arch/powerpc/boot/serial.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/boot/of.c +1 -1
@@ -261,7 +261,7 @@ static int of_console_open(void)
 	return -1;
 }
 
-static void of_console_write(char *buf, int len)
+static void of_console_write(const char *buf, int len)
 {
 	call_prom("write", 3, 1, of_stdout_handle, buf, len);
 }
arch/powerpc/boot/ops.h +1 -1
@@ -51,7 +51,7 @@ extern struct dt_ops dt_ops;
 /* Console operations */
 struct console_ops {
 	int	(*open)(void);
-	void	(*write)(char *buf, int len);
+	void	(*write)(const char *buf, int len);
 	void	(*edit_cmdline)(char *buf, int len);
 	void	(*close)(void);
 	void	*data;
arch/powerpc/boot/serial.c +1 -1
@@ -27,7 +27,7 @@ static int serial_open(void)
 	return scdp->open();
 }
 
-static void serial_write(char *buf, int len)
+static void serial_write(const char *buf, int len)
 {
 	struct serial_console_data *scdp = console_ops.data;
 
#33 lore raw

PATCH 28/30 powerpc: Bootwrapper global scope kernel_entry_t.

In reply to a message not in the archive

For the convenience of custom platform code make the powerpc bootwrapper typdef kernel_entry_t global in scope.

---
 arch/powerpc/boot/main.c |    2 --
 arch/powerpc/boot/ops.h  |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/boot/main.c +0 -2
@@ -36,8 +36,6 @@ struct addr_range {
 	unsigned long size;
 };
 
-typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *);
-
 #undef DEBUG
 
 static struct addr_range prep_kernel(void)
arch/powerpc/boot/ops.h +2 -0
@@ -19,6 +19,8 @@
 #define	MAX_PATH_LEN		256
 #define	MAX_PROP_LEN		256 /* What should this be? */
 
+typedef void (*kernel_entry_t)(unsigned long r3, unsigned long r4, void *r5);
+
 /* Platform specific operations */
 struct platform_ops {
 	void	(*fixups)(void);
#34 lore raw

PATCH 29/30 PS3: Device tree source.

In reply to a message not in the archive

The PS3 device tree source.

---
 arch/powerpc/boot/dts/ps3.dts |   74 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
arch/powerpc/boot/dts/ps3.dts new file +74 -0
@@ -0,0 +1,74 @@
+/*
+ *  PS3 Game Console device tree.
+ *
+ *  Copyright (C) 2006 Sony Computer Entertainment Inc.
+ *  Copyright 2006 Sony Corp.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+/ {
+	model = "PS3 Game Console";
+	compatible = "PS3";
+	#size-cells = <2>;
+	#address-cells = <2>;
+
+	/*
+	 * Need to keep linux,platform for a while, not used by kernel.
+	 */
+
+	chosen {
+		linux,platform = <0>;
+	};
+
+	/*
+	 * dtc expects a memory entry, so we'll put a null entry here.
+	 * We'll get the size of the bootmem block from lv1 after startup.
+	 */
+
+	memory {
+		device_type = "memory";
+		reg = <0 0 0 0>;
+	};
+
+	/*
+	 * dtc expects a clock-frequency and timebase-frequency entries, so
+	 * we'll put a null entries here.  These will be initialized after
+	 * startup with data from lv1.
+	 *
+	 * The boot cpu is always zero for PS3.
+	 *
+	 * Seems the only way currently to indicate a processor has multiple
+	 * threads is with an ibm,ppc-interrupt-server#s entry.  We'll put one
+	 * here so we can bring up both of ours.  See smp_setup_cpu_maps().
+	 */
+
+	cpus {
+		#size-cells = <0>;
+		#address-cells = <1>;
+
+		CBE,PPE {
+			device_type = "cpu";
+			reg = <0>;
+			ibm,ppc-interrupt-server#s = <0 1>;
+			clock-frequency = <0>;
+			timebase-frequency = <0>;
+			i-cache-size = <8000>;
+			d-cache-size = <8000>;
+			i-cache-line-size = <80>;
+			d-cache-line-size = <80>;
+		};
+	};
+};
#35 lore raw

Re: [patch 29/30] PS3: Device tree source.

Hi Geoff,

Not much that can be wrong in this tree, so I'll get really pedantic, so you can have the best device tree ever ;-)

There is one real bug though.

arch/powerpc/boot/dts/ps3.dts line 23

Quoted 2 lines
arch/powerpc/boot/dts/ps3.dts new file +2 -0
+/ {
+	model = "PS3 Game Console";

model = "sony,some-model-number" or similar

arch/powerpc/boot/dts/ps3.dts line 24

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+	compatible = "PS3";

name = "sony,ps3"

arch/powerpc/boot/dts/ps3.dts line 30

Quoted 3 lines
arch/powerpc/boot/dts/ps3.dts new file +3 -0
+	/*
+	 * Need to keep linux,platform for a while, not used by kernel.
+	 */

Why that?

Review

Quoted 2 lines
(quoted diff) +2 -0
+	 * Seems the only way currently to indicate a processor has multiple
+	 * threads is with an ibm,ppc-interrupt-server#s entry.

Yes, a better way should be defined. Any suggestions?

arch/powerpc/boot/dts/ps3.dts line 62

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+		CBE,PPE {

PowerPC,CBE@0 or cpu@0 -- the important thing is you need the @0 unit address.

arch/powerpc/boot/dts/ps3.dts line 69

Quoted 7 lines
arch/powerpc/boot/dts/ps3.dts new file +7 -0
+			device_type = "cpu";
+			reg = <0>;
+			ibm,ppc-interrupt-server#s = <0 1>;
+			clock-frequency = <0>;
+			timebase-frequency = <0>;
+			i-cache-size = <8000>;
+			d-cache-size = <8000>;

I thought DL1 was 64kB, I might be wrong though?

Segher

#36 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 1 line · Segher Boessenkool

There is one real bug though.

Indeed.

Quoted 8 lines

arch/powerpc/boot/dts/ps3.dts line 23

Quoted 2 lines
arch/powerpc/boot/dts/ps3.dts new file +2 -0
+/ {
+	model = "PS3 Game Console";

model = "sony,some-model-number" or similar

arch/powerpc/boot/dts/ps3.dts line 24

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+	compatible = "PS3";

name = "sony,ps3"

Both are wrong.

Stick to the values used right now.
Which is 'PS3PF'

#37 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 5 lines
Quoted 5 lines

arch/powerpc/boot/dts/ps3.dts line 23

Quoted 2 lines
arch/powerpc/boot/dts/ps3.dts new file +2 -0
+/ {
+	model = "PS3 Game Console";

model = "sony,some-model-number" or similar

Quoted 8 lines
Quoted 3 lines

arch/powerpc/boot/dts/ps3.dts line 24

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+	compatible = "PS3";

name = "sony,ps3"

Both are wrong.

Stick to the values used right now.
Which is 'PS3PF'

It should include "sony,", in the "name" property at least.

"model" same as "name" cannot make sense either.

Please read up on what those properties mean exactly.

It won't matter too much for Linux, but if you have a chance too make it right for a new port, why fail to do so?

Segher

#38 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 1 line · Segher Boessenkool

Please read up on what those properties mean exactly.

Yes, do that before the inital release.

currently name contains ''
currently compatible contains 'PS3PF'
currently model contains 'PLAYSTATION 3'

Now, do not break the userspace ABI.
If there is really an urge to break it, add the new device-tree to 2.6.22 and do not change the new values anymore.

#39 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 9 lines
Quoted 1 line

Please read up on what those properties mean exactly.

Yes, do that before the inital release.

currently name contains '' currently compatible contains 'PS3PF' currently model contains 'PLAYSTATION 3'

Now, do not break the userspace ABI.

The device tree is not a userspace ABI. Since in this case it is built into the kernel image (is it, actually?) there is no breakage between firmware and kernel versions, either.

Quoted 1 line

If there is really an urge to break it,

Break what? It's just a bugfix.

Quoted 2 lines

add the new device-tree to
2.6.22 and do not change the new values anymore.

If you require the device tree not ever to change, you can just as well not have a device tree at all.

Segher

#40 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 1 line · Segher Boessenkool

The device tree is not a userspace ABI.

It is an userspace ABI. Simply because at some point the OS wants to know which platform/boardtype/whatever it is running on.

#41 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 4 lines
Quoted 1 line

The device tree is not a userspace ABI.

It is an userspace ABI. Simply because at some point the OS wants to know which platform/boardtype/whatever it is running on.

What's wrong with uname -m or cat /proc/cpuinfo?

Segher

#42 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 1 line · Segher Boessenkool

What's wrong with uname -m or cat /proc/cpuinfo?

At some point I switched to the device-tree, but I can not remember why /proc/cpuinfo was not good enough.

#43 lore raw

Re: [patch 29/30] PS3: Device tree source.

In reply to Segher Boessenkool
Quoted 7 lines · Segher Boessenkool
Quoted 7 lines
Quoted 1 line

Please read up on what those properties mean exactly.

Yes, do that before the inital release.

currently name contains ''
currently compatible contains 'PS3PF'
currently model contains 'PLAYSTATION 3'

Quoted 6 lines
Quoted 1 line

Now, do not break the userspace ABI.

The device tree is not a userspace ABI. Since in this case it is built into the kernel image (is it, actually?) there is no breakage between firmware and kernel versions, either.

It is built-in for the kboot kernel.
It is passed from the bootstrap to the 2nd stage kernel.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1930 Zaventem · Belgium

Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   [email protected]	
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Centre Europe
A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 413.825.160 · RPR Brussels
Fortis Bank Londerzeel IBAN BE39 0013 8235 8619 GEBA-BE-BB

#44 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 7 lines
Quoted 4 lines

The device tree is not a userspace ABI. Since in this case it is built into the kernel image (is it, actually?) there is no breakage between firmware and kernel versions, either.

It is built-in for the kboot kernel.
It is passed from the bootstrap to the 2nd stage kernel.

The 2nd stage kernel isn't userland.

Segher

#45 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 9 lines · Segher Boessenkool
Quoted 7 lines
Quoted 4 lines

The device tree is not a userspace ABI. Since in this case it is built into the kernel image (is it, actually?) there is no breakage between firmware and kernel versions, either.

It is built-in for the kboot kernel.
It is passed from the bootstrap to the 2nd stage kernel.

The 2nd stage kernel isn't userland.

If you consider the kboot kernel `firmware', there can be breakage between firmware and kernel versions.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1930 Zaventem · Belgium

Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   [email protected]	
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Centre Europe
A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 413.825.160 · RPR Brussels
Fortis Bank Londerzeel IBAN BE39 0013 8235 8619 GEBA-BE-BB

#46 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It is built-in for the kboot kernel.
It is passed from the bootstrap to the 2nd stage kernel.

The 2nd stage kernel isn't userland.

If you consider the kboot kernel `firmware', there can be breakage between firmware and kernel versions.

Ah I see. Your first kernel is in flash, the second on disk?

There's no reason not to have the second kernel recognise the old device tree names, at least for a while. Nothing special here. This is independent from either or not correcting the device tree, and correcting the kernel to look at the right properties if possible (it can always fall back to the bad old ways, if it cannot figure out what machine type it is running on otherwise).

Segher

#47 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 10 lines · Segher Boessenkool
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It is built-in for the kboot kernel.
It is passed from the bootstrap to the 2nd stage kernel.

The 2nd stage kernel isn't userland.

If you consider the kboot kernel `firmware', there can be breakage between firmware and kernel versions.

Ah I see. Your first kernel is in flash, the second on disk?

Yes.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1930 Zaventem · Belgium

Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   [email protected]	
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Centre Europe
A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 413.825.160 · RPR Brussels
Fortis Bank Londerzeel IBAN BE39 0013 8235 8619 GEBA-BE-BB

#48 lore raw

Re: [patch 29/30] PS3: Device tree source.

In reply to Segher Boessenkool
Quoted 10 lines · Segher Boessenkool
Quoted 9 lines
Quoted 1 line

Please read up on what those properties mean exactly.

Yes, do that before the inital release.

currently name contains ''
currently compatible contains 'PS3PF'
currently model contains 'PLAYSTATION 3'

Now, do not break the userspace ABI.

Quoted 8 lines

The device tree is not a userspace ABI. Since in this case it is built into the kernel image (is it, actually?) there is no breakage between firmware and kernel versions, either.

Quoted 1 line

If there is really an urge to break it,

Break what? It's just a bugfix.

This is the first time I am submitting the PS3 device tree for inclusion in the mainline kernel, so there is no breakage or even bugfix, just new code.

I understand that Olaf would like to match what the out-of-tree 2.6.16 legacy kernel port did, but that port was never accepted nor even recognized by the Linux community. I do not plan to keep compatibility with that work in the mainline linux kernel. Correctness will always take precedence over compatibility in the mainline kernel. I will maintain what patches I can to ease the transition from the legacy kernel to the mainline kernel in the 'ps3-hacks' directory of my ps3-linux-patches.git repository. I will not submit those patches for mainline inclusion though. I'm sorry for any inconvenience.

-Geoff

#49 lore raw

Re: [patch 29/30] PS3: Device tree source.

In reply to Segher Boessenkool
Quoted 3 lines · Segher Boessenkool

It should include "sony,", in the "name" property at least.

"model" same as "name" cannot make sense either.

Dunno what you are on about the model vs. name but this is the root of the DT, it has no name.

Ben.

#50 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 6 lines
Quoted 3 lines

It should include "sony,", in the "name" property at least.

"model" same as "name" cannot make sense either.

Dunno what you are on about the model vs. name but this is the root of the DT, it has no name.

Please review the OF spec, sections 3.4 and the "/" entry of 3.5.

I'f the flat device tree doc and/or code says differently here, that is a bug.

Segher

#51 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 4 lines · Segher Boessenkool
Quoted 4 lines
Quoted 3 lines

It should include "sony,", in the "name" property at least.

"model" same as "name" cannot make sense either.

Quoted 8 lines
Quoted 2 lines

Dunno what you are on about the model vs. name but this is the root of the DT, it has no name.

Please review the OF spec, sections 3.4 and the "/" entry of 3.5.

I'f the flat device tree doc and/or code says differently here, that is a bug.

Well, I wonder if that's been superceeded by some RFC or never validated addition ... None of the Apple trees for example has a /name property and the idea of having a node with a name that doesn't participate in the path resolution in just wrong. We should check but I don't think IBM trees have one either.

So I stand by the way I defined the flat DT -> no name in the root. But you are welcome to use compatible and model.

Ben.

#52 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 8 lines
Quoted 5 lines

Please review the OF spec, sections 3.4 and the "/" entry of 3.5.

I'f the flat device tree doc and/or code says differently here, that is a bug.

Well, I wonder if that's been superceeded by some RFC or never validated addition ...

It has been that way since before the OF standard existed, and never has been changed.

Quoted 1 line

None of the Apple trees for example has a /name property

Apple's trees have many many problems, you know that as well as anybody.

Quoted 2 lines

and the idea of having a node with a name that doesn't participate in the path resolution in just wrong.

Nonsense, a pathname starting with "/" is handled specially. This is true on Unix systems as well.

Quoted 5 lines

We should check but I don't think IBM
trees have one either.

So I stand by the way I defined the flat DT -> no name in the root. But you are welcome to use compatible

You can use "compatible" as an alternate name, sure. Not allowing a "name" in the root node is simply an oversight in the flat device tree, and should be fixed in my opinion. There is no backwwards-compatibility problem with that.

Quoted 3 lines

and model.

"model" is a completely separate thing, so yeah.

Segher

#53 lore raw

Re: [patch 29/30] PS3: Device tree source.

In reply to Olaf Hering
Quoted 11 lines · Olaf Hering
Quoted 1 line · Segher Boessenkool

There is one real bug though.

Indeed.

Quoted 5 lines

arch/powerpc/boot/dts/ps3.dts line 23

Quoted 2 lines
arch/powerpc/boot/dts/ps3.dts new file +2 -0
+/ {
+	model = "PS3 Game Console";

model = "sony,some-model-number" or similar

Quoted 8 lines
Quoted 3 lines

arch/powerpc/boot/dts/ps3.dts line 24

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+	compatible = "PS3";

name = "sony,ps3"

Both are wrong.

Stick to the values used right now.
Which is 'PS3PF'

Hi Olaf.

I specifically changed this because this kernel is NOT compatible with the device tree of the legacy kernel (2.6.16) that used PS3PF.

If this was set as PS3PF, then there would be no way to tell that an incompatible DT has been passed.

See my patch below how I use it to work around the incompatability:

http://git.kernel.org/?p=linux/kernel/git/geoff/ps3-linux-patches.git;a=blob;f=ps3-hacks/ps3-legacy-bootloader-hack.diff

-Geoff

#54 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 2 lines · Geoff Levand

If this was set as PS3PF, then there would be no way to tell that an incompatible DT has been passed.

Ok, so what will be the final values for name, model and compatible? Can you add them to 2.6.22 to fixate them?

#55 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 3 lines · Olaf Hering

Ok, so what will be the final values for name, model and compatible? Can you add them to 2.6.22 to fixate them?

No name for the root of the DT.

IMHO, model can be whatever he wants, I would say SonyPS3-XX or something like that, whatever, doens't matter, the most precise the better.

Then you want compatible which is the really important one. sony,ps3 looks good to me for that, though you could have a list if you wanted.

Ben.

#56 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 1 line

No name for the root of the DT.

See my previous mail.

Quoted 3 lines

IMHO, model can be whatever he wants, I would say SonyPS3-XX or something like that, whatever, doens't matter, the most precise the better.

It should be the model number of the machine.

Quoted 2 lines

Then you want compatible which is the really important one. sony,ps3 looks good to me for that, though you could have a list if you wanted.

"compatible" is only needed if your "name" is bogus, or your machine _actually_ is 100% compatible to some other machine.

Segher

#57 lore raw

RE: [patch 29/30] PS3: Device tree source.

=20

Quoted 19 lines

-----Original Message-----
From: [email protected]=20 [mailto:[email protected]]=20 On Behalf Of Segher Boessenkool
Sent: Thursday, June 14, 2007 2:33 AM
To: Benjamin Herrenschmidt
Cc: [email protected]; Olaf Hering; [email protected]
Subject: Re: [patch 29/30] PS3: Device tree source.
=20

Quoted 1 line

No name for the root of the DT.

=20
See my previous mail.
=20

Quoted 3 lines

IMHO, model can be whatever he wants, I would say SonyPS3-XX or something like that, whatever, doens't matter, the most precise the better.

=20
It should be the model number of the machine.
=20

Quoted 6 lines
Quoted 2 lines

Then you want compatible which is the really important one. sony,ps3 looks good to me for that, though you could have a list if=20

you wanted.
=20
"compatible" is only needed if your "name" is bogus, or your machine _actually_ is 100% compatible to some other machine.

Segher,

I don't understand this if we are following the 'Generic Names' recommendation (which I thought we were).

http://playground.sun.com/1275/practice/gnames/gnamv14a.html

It gives two guidelines:

Guideline 1: "name" property values must be generic, reflecting the device's function, but not necessarily its precise programming model.=20

Guideline 2: The "compatible" property must be present. Its first component should be an explicit, unique name that identifies the device precisely enough to be able to infer the detailed programming model from that name. The format of that explicit name is manufacturer,model,...

I read that and my understand is that _compatible_ is required and specifies the precise programming model. name is supposed to be generic-- currently booting-without-of.txt says the property is optional because the name can be inferred from the node name which should be generic.

Stuart

#58 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 7 lines
Quoted 2 lines

"compatible" is only needed if your "name" is bogus, or your machine _actually_ is 100% compatible to some other machine.

Segher,

I don't understand this if we are following the 'Generic Names' recommendation (which I thought we were).

Yes, we should follow that recommended practice.

Quoted 3 lines

Guideline 1: "name" property values must be generic, reflecting the device's function, but not necessarily its precise programming model.

Yes -- a short clear name that makes device tree paths easily readable (and easy to type ;-) ) for human beings.

Quoted 1 line

Guideline 2: The "compatible" property must be present.

...if "name" doesn't perform the same function yet, which of course is almost always.

Quoted 5 lines

Its first
component should be an explicit, unique name that identifies the device precisely enough to be able to infer the detailed programming model from that name. The format of that explicit name is manufacturer,model,...

Yep. You understand "generic names" just fine.

Quoted 5 lines

I read that and my understand is that _compatible_ is required and specifies the precise programming model. name is supposed to be generic-- currently booting-without-of.txt says the property is optional because the name can be inferred from the node name which should be generic.

"node name" in flat device trees doesn't allow a proper "name" property to exist for the root node. This is a bug in the flat device tree tools, and either should be fixed, or this should be clearly documented as a divergence from "real" OF.

"name" of the root node is a bit special, since it is never displayed as part of a device path or used for device selection (instead, "/" at start of a path is handled specially, just like on unix filesystems).

Since anything that matches for "compatible" entries also first should check the "name" contents, it should be okay for flat device trees to have the information that could/should be in "name" in "compatible", instead.

Does this answer all questions / clarify my position on all this?

Cheers,

Segher

#59 lore raw

RE: [patch 29/30] PS3: Device tree source.

=20

Quoted 22 lines

-----Original Message-----
From: [email protected]=20 [mailto:[email protected]]=20 On Behalf Of Segher Boessenkool
Sent: Thursday, June 14, 2007 10:36 AM
To: Yoder Stuart-B08248
Cc: [email protected]; Olaf Hering; [email protected]
Subject: Re: [patch 29/30] PS3: Device tree source.
=20

Quoted 7 lines
Quoted 2 lines

"compatible" is only needed if your "name" is bogus, or your machine _actually_ is 100% compatible to some other machine.

Segher,

I don't understand this if we are following the 'Generic Names' recommendation (which I thought we were).

=20
Yes, we should follow that recommended practice. =20

Quoted 3 lines

Guideline 1: "name" property values must be generic, reflecting the device's function, but not necessarily its precise programming model.

Quoted 8 lines

=20
Yes -- a short clear name that makes device tree paths easily readable (and easy to type ;-) ) for human beings. =20

Quoted 1 line

Guideline 2: The "compatible" property must be present.

=20
...if "name" doesn't perform the same function yet, which of course is almost always.

But the recommended practice doesn't have an "...if". It says "compatible" must always be present.

The reason an OS would need to support "name" as well as=20 "compatbile" for device driver matching would be for _legacy_ device trees that don't follow the recommended practice.

For newly developed trees "compatible" should specify the programming model, if we are following that recommended practice.

So bottom line is that we shouldn't be moving toward using "name" to specify the programming model.

[snip]

Quoted 5 lines

=20
Since anything that matches for "compatible" entries also first should check the "name" contents, it should be okay for flat device trees to have the information that could/should be in "name" in "compatible", instead.

As mentioned above, matching on "name" would seem to be needed to handle legacy device trees as I read some of the reasoning in the generic names recommended practice. Not sure if that applies to Linux or not...=20

Stuart

#60 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Guideline 2: The "compatible" property must be present.

...if "name" doesn't perform the same function yet, which of course is almost always.

But the recommended practice doesn't have an "...if". It says "compatible" must always be present.

If you read the r.p. more closely, you'll see this applies to normal devices only. Either way, the r.p. says very clearly that the "old way" of doing things is still supported.

Quoted 4 lines

The reason an OS would need to support "name" as well as "compatbile" for device driver matching would be for _legacy_ device trees that don't follow the recommended practice.

No, the OS has to do this since that is what the OF spec says has to be done. The generic names recommended practice goes into this in some detail, too.

Quoted 2 lines

For newly developed trees "compatible" should specify the programming model, if we are following that recommended practice.

Yes.

Quoted 2 lines

So bottom line is that we shouldn't be moving toward using "name" to specify the programming model.

And no one suggested that.

Quoted 9 lines
Quoted 4 lines

Since anything that matches for "compatible" entries also first should check the "name" contents, it should be okay for flat device trees to have the information that could/should be in "name" in "compatible", instead.

As mentioned above, matching on "name" would seem to be needed to handle legacy device trees as I read some of the reasoning in the generic names recommended practice. Not sure if that applies to Linux or not...

Not all Linux systems use a flat device tree, some use a "real" Open Firmware. Not doing the matching the way it is described but differently is asking for problems, needing unnecessary workarounds.

Segher

#61 lore raw

Re: [patch 29/30] PS3: Device tree source.

In reply to Segher Boessenkool
Quoted 11 lines · Segher Boessenkool

"node name" in flat device trees doesn't allow a proper "name" property to exist for the root node. This is a bug in the flat device tree tools, and either should be fixed, or this should be clearly documented as a divergence from "real" OF.

"name" of the root node is a bit special, since it is never displayed as part of a device path or used for device selection (instead, "/" at start of a path is handled specially, just like on unix filesystems).

This 'special' behaviour, the fact that it's definition is out of sync with the generic name recommended practice, and finally, the fact that quite a lot of real OFs out there don't even bother having one, makes me think that it's a good idea to stick to what I did, which is to say the root node has no name in a flat device-tree.

Now, what I -may- do to avoid information loss is tweak prom_init.c to actually extract that name if it exist and stick a "name" property in the root node in that case when flattening the tree.

But I still beleive as far as flat DTs for embedded are concerned, we shouldn't use and rely on having a name at the root of the tree.

Quoted 7 lines

Since anything that matches for "compatible" entries also first should check the "name" contents, it should be okay for flat device trees to have the information that could/should be in "name" in "compatible", instead.

Does this answer all questions / clarify my position on all this?

Ben.

#62 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 11 lines
Quoted 10 lines

"node name" in flat device trees doesn't allow a proper "name" property to exist for the root node. This is a bug in the flat device tree tools, and either should be fixed, or this should be clearly documented as a divergence from "real" OF.

"name" of the root node is a bit special, since it is never displayed as part of a device path or used for device selection (instead, "/" at start of a path is handled specially, just like on unix filesystems).

Quoted 5 lines

This 'special' behaviour, the fact that it's definition is out of sync with the generic name recommended practice, and finally, the fact that quite a lot of real OFs out there don't even bother having one, makes me think that it's a good idea to stick to what I did, which is to say the root node has no name in a flat device-tree.

Putting that info in "compatible" instead should work fine enough.

Quoted 3 lines

Now, what I -may- do to avoid information loss is tweak prom_init.c to actually extract that name if it exist and stick a "name" property in the root node in that case when flattening the tree.

Nice, thanks!

Quoted 2 lines

But I still beleive as far as flat DTs for embedded are concerned, we shouldn't use and rely on having a name at the root of the tree.

There _has_ to be a "name" property. But you have one, just not with interesting contents ;-)

Quoted 4 lines
Quoted 4 lines

Since anything that matches for "compatible" entries also first should check the "name" contents, it should be okay for flat device trees to have the information that could/should be in "name" in "compatible", instead.

Segher

#63 lore raw

Re: [patch 29/30] PS3: Device tree source.

In reply to Geoff Levand
Quoted 7 lines · Geoff Levand

I specifically changed this because this kernel is NOT compatible with the device tree of the legacy kernel (2.6.16) that used PS3PF.

If this was set as PS3PF, then there would be no way to tell that an incompatible DT has been passed.

No way ? heh, there are ways, you can test for a version property for example that you add in the new one, or you can use an additional compatible entry (compatible is a list of strings).

Ben.

#64 lore raw

Re: [patch 29/30] PS3: Device tree source.

In reply to Segher Boessenkool

Hi.

Quoted 11 lines · Segher Boessenkool

Hi Geoff,

Not much that can be wrong in this tree, so I'll get really pedantic, so you can have the best device tree ever ;-)

There is one real bug though.

arch/powerpc/boot/dts/ps3.dts line 23

Quoted 2 lines
arch/powerpc/boot/dts/ps3.dts new file +2 -0
+/ {
+	model = "PS3 Game Console";

model = "sony,some-model-number" or similar

There is no real model number for this product. Model numbers specify configuration like PAL video or 60GB disk.

model = "sony,ps3xxxxx"? That doesn't seem any better than model = "sony,ps3", but then what will be used for compatible?

I will use model = "SonyPS3";

Quoted 3 lines

arch/powerpc/boot/dts/ps3.dts line 24

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+	compatible = "PS3";

name = "sony,ps3"

As Ben H. said, the top level 'name' cannot be set, and I found dtc exits with an error if you include one.

The compatible entry is generally used to test for machine type, so I think that needs to remain, and I will use compatible = "sony,ps3".

Quoted 5 lines

arch/powerpc/boot/dts/ps3.dts line 30

Quoted 3 lines
arch/powerpc/boot/dts/ps3.dts new file +3 -0
+	/*
+	 * Need to keep linux,platform for a while, not used by kernel.
+	 */

Why that?

Newer dtc seems to be OK with this removed, old ones exited with error.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	 * Seems the only way currently to indicate a processor has multiple
+	 * threads is with an ibm,ppc-interrupt-server#s entry.

Yes, a better way should be defined. Any suggestions?

No, there was some discussion to fix it, but no action.

Quoted 4 lines

arch/powerpc/boot/dts/ps3.dts line 62

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+		CBE,PPE {

PowerPC,CBE@0 or cpu@0 -- the important thing is you need the @0 unit address.

OK, I set it up as cpu@0, since the actual type seems to be probed for.

Quoted 9 lines

arch/powerpc/boot/dts/ps3.dts line 69

Quoted 7 lines
arch/powerpc/boot/dts/ps3.dts new file +7 -0
+			device_type = "cpu";
+			reg = <0>;
+			ibm,ppc-interrupt-server#s = <0 1>;
+			clock-frequency = <0>;
+			timebase-frequency = <0>;
+			i-cache-size = <8000>;
+			d-cache-size = <8000>;

I thought DL1 was 64kB, I might be wrong though?

The BE handbook says 32.

-Geoff

#65 lore raw

Re: [patch 29/30] PS3: Device tree source.

Quoted 1 line

I will use model = "SonyPS3";

Okie.

Quoted 6 lines
Quoted 3 lines

arch/powerpc/boot/dts/ps3.dts line 24

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+	compatible = "PS3";

name = "sony,ps3"

As Ben H. said, the top level 'name' cannot be set,

Bug in the flat device tree stuff.

Quoted 6 lines

and
I found dtc exits with an error if you include one.

The compatible entry is generally used to test for machine type, so I think that needs to remain, and I will use compatible = "sony,ps3".

"compatible" is a set of alternates for "name", so you can use it if you have to.

Quoted 6 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	 * Need to keep linux,platform for a while, not used by kernel.
+	 */

Why that?

Newer dtc seems to be OK with this removed, old ones exited with error.

Ok. So you'll remove it?

Quoted 6 lines
Quoted 4 lines

arch/powerpc/boot/dts/ps3.dts line 62

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+		CBE,PPE {

PowerPC,CBE@0 or cpu@0 -- the important thing is you need the @0 unit address.

OK, I set it up as cpu@0, since the actual type seems to be probed for.

PowerPC CPUs have a defined way of identifying themselves exactly, and this PVR value is supposed to be in the device tree too (although Linux probes it directly from the CPU). You could still put the name in the "compatible" property, but CPU nodes are a bit special, I don't think that would gain anything.

Quoted 5 lines
Quoted 3 lines

arch/powerpc/boot/dts/ps3.dts line 69

Quoted 1 line
arch/powerpc/boot/dts/ps3.dts new file +1 -0
+			d-cache-size = <8000>;

I thought DL1 was 64kB, I might be wrong though?

The BE handbook says 32.

Ok, good.

Segher

#66 lore raw

PATCH v2 29/30 PS3: Device tree source.

In reply to Geoff Levand

Subject: PS3: Device tree source.

The PS3 device tree source.

---

ver2: Here's an updated version based on the discussions.

-Geoff

 arch/powerpc/boot/dts/ps3.dts      |   68 +++++++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/ps3/setup.c |    2 -
 2 files changed, 69 insertions(+), 1 deletion(-)
arch/powerpc/boot/dts/ps3.dts new file +68 -0
@@ -0,0 +1,68 @@
+/*
+ *  PS3 Game Console device tree.
+ *
+ *  Copyright (C) 2007 Sony Computer Entertainment Inc.
+ *  Copyright 2007 Sony Corp.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/ {
+	model = "SonyPS3";
+	compatible = "sony,ps3";
+	#size-cells = <2>;
+	#address-cells = <2>;
+
+	chosen {
+	};
+
+	/*
+	 * We'll get the size of the bootmem block from lv1 after startup,
+	 * so we'll put a null entry here.
+	 */
+
+	memory {
+		device_type = "memory";
+		reg = <0 0 0 0>;
+	};
+
+	/*
+	 * The boot cpu is always zero for PS3.
+	 *
+	 * dtc expects a clock-frequency and timebase-frequency entries, so
+	 * we'll put a null entries here.  These will be initialized after
+	 * startup with data from lv1.
+	 *
+	 * Seems the only way currently to indicate a processor has multiple
+	 * threads is with an ibm,ppc-interrupt-server#s entry.  We'll put one
+	 * here so we can bring up both of ours.  See smp_setup_cpu_maps().
+	 */
+
+	cpus {
+		#size-cells = <0>;
+		#address-cells = <1>;
+
+		cpu@0 {
+			device_type = "cpu";
+			reg = <0>;
+			ibm,ppc-interrupt-server#s = <0 1>;
+			clock-frequency = <0>;
+			timebase-frequency = <0>;
+			i-cache-size = <8000>;
+			d-cache-size = <8000>;
+			i-cache-line-size = <80>;
+			d-cache-line-size = <80>;
+		};
+	};
+};
arch/powerpc/platforms/ps3/setup.c +1 -1
@@ -193,7 +193,7 @@ static int __init ps3_probe(void)
 	DBG(" -> %s:%d\n", __func__, __LINE__);
 
 	dt_root = of_get_flat_dt_root();
-	if (!of_flat_dt_is_compatible(dt_root, "PS3"))
+	if (!of_flat_dt_is_compatible(dt_root, "sony,ps3"))
 		return 0;
 
 	powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE;
#67 lore raw

Re: [patch 29/30 v2] PS3: Device tree source.

Quoted 8 lines · Geoff Levand

Subject: PS3: Device tree source.

The PS3 device tree source.

---

ver2: Here's an updated version based on the discussions.

This one doesn't seem to work. The kernel hangs very early in the boot process. I haven't digged into it yet to find out why.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1930 Zaventem · Belgium

Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   [email protected]	
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Centre Europe
A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 413.825.160 · RPR Brussels
Fortis Bank Londerzeel IBAN BE39 0013 8235 8619 GEBA-BE-BB

#68 lore raw

Re: [patch 29/30 v2] PS3: Device tree source.

Quoted 5 lines · Geert Uytterhoeven
Quoted 4 lines · Geoff Levand

Subject: PS3: Device tree source.

The PS3 device tree source.

Quoted 7 lines
Quoted 4 lines

---

ver2: Here's an updated version based on the discussions.

This one doesn't seem to work. The kernel hangs very early in the boot process. I haven't digged into it yet to find out why.

The trouble was not in this patch, but that I didn't update ps3-legacy-bootloader-hack.diff to match this change. I committed an update to my git repositories on kernel.org.

Sorry if this inconvenienced anyone.

-Geoff

#69 lore raw

PATCH 30/30 PS3: Bootwrapper support.

In reply to a message not in the archive

Add suport to build the PS3 flash rom image.

zImage.ps3 is a wrapped image that contains a flat device tree, an lv1 compatible entry point, a standard _start entry point, a wrapper program, and an optional initrd. otheros.bld is the gzip compresed rom image built from zImage.ps3. otheros.bld is suitable for programming into the PS3 boot flash memory.

Also remove the now unneeded lmb calls in the platform code.

---
 arch/powerpc/boot/Makefile         |   21 ++--
 arch/powerpc/boot/ps3-head.S       |   84 ++++++++++++++++
 arch/powerpc/boot/ps3-hvcall.S     |  184 +++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/ps3.c            |  158 +++++++++++++++++++++++++++++++
 arch/powerpc/boot/wrapper          |   42 ++++++++
 arch/powerpc/boot/zImage.ps3.lds.S |   50 ++++++++++
 arch/powerpc/platforms/ps3/mm.c    |    2 
 7 files changed, 530 insertions(+), 11 deletions(-)
arch/powerpc/boot/Makefile +12 -9
@@ -41,11 +41,13 @@ zliblinuxheader := zlib.h zconf.h zutil.
 $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \
 	$(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
 
+src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
+
 src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
 		ns16550.c serial.c simple_alloc.c div64.S util.S \
 		gunzip_util.c elf_util.c $(zlib) devtree.c \
 		44x.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c
-src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
+src-plat := $(src-plat-y) of.c cuboot-83xx.c cuboot-85xx.c holly.c \
 		cuboot-ebony.c treeboot-ebony.c prpmc2800.c
 src-boot := $(src-wlib) $(src-plat) empty.c
 
@@ -75,11 +77,11 @@ $(addprefix $(obj)/,$(zliblinuxheader)):
 $(obj)/empty.c:
 	@touch $@
 
-$(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S
+$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S
 	@cp $< $@
 
 clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
-		empty.c zImage.coff.lds zImage.lds
+		empty.c zImage zImage.coff.lds zImage.ps3.lds zImage.lds
 
 quiet_cmd_bootcc = BOOTCC  $@
       cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
@@ -102,7 +104,7 @@ hostprogs-y	:= addnote addRamDisk hack-c
 
 targets		+= $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
 extra-y		:= $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
-		   $(obj)/zImage.lds $(obj)/zImage.coff.lds
+		   $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
 
 wrapper		:=$(srctree)/$(src)/wrapper
 wrapperbits	:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
@@ -187,11 +189,12 @@ $(obj)/zImage.%: vmlinux $(wrapperbits)
 $(obj)/zImage.iseries: vmlinux
 	$(STRIP) -s -R .comment $< -o $@
 
-$(obj)/zImage.ps3: vmlinux
-	$(STRIP) -s -R .comment $< -o $@
+$(obj)/zImage.ps3: vmlinux  $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts
+	$(STRIP) -s -R .comment $< -o vmlinux.strip
+	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,)
 
-$(obj)/zImage.initrd.ps3: vmlinux
-	@echo "  WARNING zImage.initrd.ps3 not supported (yet)"
+$(obj)/zImage.initrd.ps3: vmlinux  $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts $(obj)/ramdisk.image.gz
+	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,$(obj)/ramdisk.image.gz)
 
 $(obj)/zImage.holly-elf: vmlinux $(wrapperbits)
 	$(call if_changed,wrap,holly,$(obj)/dts/holly.dts,,)
@@ -230,7 +233,7 @@ install: $(CONFIGURE) $(addprefix $(obj)
 
 # anything not in $(targets)
 clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* \
-	treeImage.* zImage.dts zImage.dts_initrd
+	treeImage.* zImage.dts zImage.dts_initrd otheros.bld
 
 # clean up files cached by wrapper
 clean-kernel := vmlinux.strip vmlinux.bin
arch/powerpc/boot/ps3-head.S new file +84 -0

84 lines not on this page · raw message

arch/powerpc/boot/ps3-hvcall.S new file +184 -0

184 lines not on this page · raw message

arch/powerpc/boot/ps3.c new file +158 -0

158 lines not on this page · raw message

arch/powerpc/boot/wrapper +42 -0

52 lines not on this page · raw message

arch/powerpc/boot/zImage.ps3.lds.S new file +50 -0

50 lines not on this page · raw message

arch/powerpc/platforms/ps3/mm.c +0 -2
@@ -1212,8 +1212,6 @@ void __init ps3_mm_init(void)
 	BUG_ON(map.rm.base);
 	BUG_ON(!map.rm.size);
 
-	lmb_add(map.rm.base, map.rm.size);
-	lmb_analyze();
 
 	/* arrange to do this in ps3_mm_add_memory */
 	ps3_mm_region_create(&map.r1, map.total - map.rm.size);