aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/ps3fb.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2009-06-10 00:38:46 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-06-14 23:26:20 -0400
commite78d0c5c14ab91648274b2c5e6c4c35f072cea64 (patch)
treedf3c70542e5f7e31d30552957bc528af8575014e /drivers/video/ps3fb.c
parent5c6fc8db768fb9990ee67ab052896fd46fbe2651 (diff)
ps3fb: GPU memory mapping cleanup
- Make the IOMMU flags used for mapping main memory into the GPU's I/O space explicit, instead of relying on the default in the hypervisor, - Add missing calls to lv1_gpu_context_iomap(..., CBE_IOPTE_M) to unmap the memory during cleanup. Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Cc: linux-fbdev-devel@lists.sourceforge.net Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/video/ps3fb.c')
-rw-r--r--drivers/video/ps3fb.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 542ffc306c72..a61c1d89bd87 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -32,6 +32,7 @@
32#include <linux/init.h> 32#include <linux/init.h>
33 33
34#include <asm/abs_addr.h> 34#include <asm/abs_addr.h>
35#include <asm/iommu.h>
35#include <asm/lv1call.h> 36#include <asm/lv1call.h>
36#include <asm/ps3av.h> 37#include <asm/ps3av.h>
37#include <asm/ps3fb.h> 38#include <asm/ps3fb.h>
@@ -1122,7 +1123,9 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1122 xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb_videomemory.address)); 1123 xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb_videomemory.address));
1123 1124
1124 status = lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, 1125 status = lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF,
1125 xdr_lpar, ps3fb_videomemory.size, 0); 1126 xdr_lpar, ps3fb_videomemory.size,
1127 CBE_IOPTE_PP_W | CBE_IOPTE_PP_R |
1128 CBE_IOPTE_M);
1126 if (status) { 1129 if (status) {
1127 dev_err(&dev->core, "%s: lv1_gpu_context_iomap failed: %d\n", 1130 dev_err(&dev->core, "%s: lv1_gpu_context_iomap failed: %d\n",
1128 __func__, status); 1131 __func__, status);
@@ -1143,12 +1146,12 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1143 "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", 1146 "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n",
1144 __func__, status); 1147 __func__, status);
1145 retval = -ENXIO; 1148 retval = -ENXIO;
1146 goto err_free_irq; 1149 goto err_context_unmap;
1147 } 1150 }
1148 1151
1149 info = framebuffer_alloc(sizeof(struct ps3fb_par), &dev->core); 1152 info = framebuffer_alloc(sizeof(struct ps3fb_par), &dev->core);
1150 if (!info) 1153 if (!info)
1151 goto err_free_irq; 1154 goto err_context_unmap;
1152 1155
1153 par = info->par; 1156 par = info->par;
1154 par->mode_id = ~ps3fb_mode; /* != ps3fb_mode, to trigger change */ 1157 par->mode_id = ~ps3fb_mode; /* != ps3fb_mode, to trigger change */
@@ -1213,6 +1216,9 @@ err_fb_dealloc:
1213 fb_dealloc_cmap(&info->cmap); 1216 fb_dealloc_cmap(&info->cmap);
1214err_framebuffer_release: 1217err_framebuffer_release:
1215 framebuffer_release(info); 1218 framebuffer_release(info);
1219err_context_unmap:
1220 lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, xdr_lpar,
1221 ps3fb_videomemory.size, CBE_IOPTE_M);
1216err_free_irq: 1222err_free_irq:
1217 free_irq(ps3fb.irq_no, &dev->core); 1223 free_irq(ps3fb.irq_no, &dev->core);
1218err_destroy_plug: 1224err_destroy_plug:
@@ -1232,6 +1238,7 @@ err:
1232static int ps3fb_shutdown(struct ps3_system_bus_device *dev) 1238static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1233{ 1239{
1234 struct fb_info *info = dev->core.driver_data; 1240 struct fb_info *info = dev->core.driver_data;
1241 u64 xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb_videomemory.address));
1235 1242
1236 dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__); 1243 dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
1237 1244
@@ -1254,6 +1261,8 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1254 info = dev->core.driver_data = NULL; 1261 info = dev->core.driver_data = NULL;
1255 } 1262 }
1256 iounmap((u8 __force __iomem *)ps3fb.dinfo); 1263 iounmap((u8 __force __iomem *)ps3fb.dinfo);
1264 lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, xdr_lpar,
1265 ps3fb_videomemory.size, CBE_IOPTE_M);
1257 lv1_gpu_context_free(ps3fb.context_handle); 1266 lv1_gpu_context_free(ps3fb.context_handle);
1258 lv1_gpu_memory_free(ps3fb.memory_handle); 1267 lv1_gpu_memory_free(ps3fb.memory_handle);
1259 ps3_close_hv_device(dev); 1268 ps3_close_hv_device(dev);