2007-12-19 10:15:32

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 0/2] ps3fb bug fixes for 2.6.24

Hi Linus, Andrew,

Here are 2 bug fixes for the PS3 Virtual Frame Buffer Device Driver:
[1] ps3fb: Update for firmware 2.10
[2] ps3fb: Fix ps3fb free_irq() dev_id

The first one fixes a problem with PS3 firmware 2.10 (released yesterday),
which causes a non-working display.

The second one fixes an incorrect dev_id parameter used with the free_irq()
calls.

Please apply for 2.6.24. Thanks!

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 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 Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619


2007-12-19 10:16:52

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 1/2] ps3fb: Update for firmware 2.10

From: Geert Uytterhoeven <[email protected]>

ps3fb: Update for firmware 2.10

As of PS3 firmware version 2.10, the GPU command buffer size must be at least 2
MiB large. Since we use only a small part of the GPU command buffer and don't
want to waste precious XDR memory, move the GPU command buffer back to the
start of the XDR memory reserved for ps3fb and let the unused part overlap with
the actual frame buffer.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/video/ps3fb.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)

--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -51,7 +51,8 @@
#define L1GPU_DISPLAY_SYNC_HSYNC 1
#define L1GPU_DISPLAY_SYNC_VSYNC 2

-#define GPU_CMD_BUF_SIZE (64 * 1024)
+#define GPU_CMD_BUF_SIZE (2 * 1024 * 1024)
+#define GPU_FB_START (64 * 1024)
#define GPU_IOIF (0x0d000000UL)
#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64)
#define GPU_MAX_LINE_LENGTH (65536 - 64)
@@ -406,6 +407,7 @@ static void ps3fb_sync_image(struct devi
if (src_line_length != dst_line_length)
line_length |= (u64)src_line_length << 32;

+ src_offset += GPU_FB_START;
status = lv1_gpu_context_attribute(ps3fb.context_handle,
L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
dst_offset, GPU_IOIF + src_offset,
@@ -976,9 +978,8 @@ static int ps3fb_xdr_settings(u64 xdr_lp

status = lv1_gpu_context_attribute(ps3fb.context_handle,
L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP,
- xdr_lpar + ps3fb.xdr_size,
- GPU_CMD_BUF_SIZE,
- GPU_IOIF + ps3fb.xdr_size, 0);
+ xdr_lpar, GPU_CMD_BUF_SIZE,
+ GPU_IOIF, 0);
if (status) {
dev_err(dev,
"%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n",
@@ -1061,6 +1062,11 @@ static int __devinit ps3fb_probe(struct
struct task_struct *task;
unsigned long max_ps3fb_size;

+ if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) {
+ dev_err(&dev->core, "%s: Not enough video memory\n", __func__);
+ return -ENOMEM;
+ }
+
status = ps3_open_hv_device(dev);
if (status) {
dev_err(&dev->core, "%s: ps3_open_hv_device failed\n",
@@ -1131,8 +1137,14 @@ static int __devinit ps3fb_probe(struct
/* Clear memory to prevent kernel info leakage into userspace */
memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size);

- /* The GPU command buffer is at the end of video memory */
- ps3fb.xdr_size = ps3fb_videomemory.size - GPU_CMD_BUF_SIZE;
+ /*
+ * The GPU command buffer is at the start of video memory
+ * As we don't use the full command buffer, we can put the actual
+ * frame buffer at offset GPU_FB_START and save some precious XDR
+ * memory
+ */
+ ps3fb.xdr_ea += GPU_FB_START;
+ ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START;

retval = ps3fb_xdr_settings(xdr_lpar, &dev->core);
if (retval)

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 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 Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

2007-12-19 10:17:41

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 2/2] ps3fb: Fix ps3fb free_irq() dev_id

From: Geoff Levand <[email protected]>

The dev_id arg passed to free_irq() must match that passed to
request_irq().

Fixes this PS3 error message:

Trying to free already-free IRQ 44

Signed-off-by: Geoff Levand <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/video/ps3fb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1212,7 +1212,7 @@ err_fb_dealloc:
err_framebuffer_release:
framebuffer_release(info);
err_free_irq:
- free_irq(ps3fb.irq_no, dev);
+ free_irq(ps3fb.irq_no, &dev->core);
ps3_irq_plug_destroy(ps3fb.irq_no);
err_iounmap_dinfo:
iounmap((u8 __iomem *)ps3fb.dinfo);
@@ -1247,7 +1247,7 @@ static int ps3fb_shutdown(struct ps3_sys
kthread_stop(task);
}
if (ps3fb.irq_no) {
- free_irq(ps3fb.irq_no, dev);
+ free_irq(ps3fb.irq_no, &dev->core);
ps3_irq_plug_destroy(ps3fb.irq_no);
}
iounmap((u8 __iomem *)ps3fb.dinfo);

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 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 Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619