From patchwork Fri May 8 14:01:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [09/15] ps3fb: GPU memory mapping cleanup Date: Fri, 08 May 2009 04:01:18 -0000 From: Geert Uytterhoeven X-Patchwork-Id: 27009 Message-Id: <1241791284-11490-10-git-send-email-Geert.Uytterhoeven@sonycom.com> To: Benjamin Herrenschmidt Cc: Geert Uytterhoeven , linux-fbdev-devel@lists.sourceforge.net, cbe-oss-dev@ozlabs.org, linux-kernel@vger.kernel.org - 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(..., IOPTE_M) to unmap the memory during cleanup. Signed-off-by: Geert Uytterhoeven --- drivers/video/ps3fb.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 542ffc3..43c58a9 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -1122,7 +1123,8 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb_videomemory.address)); status = lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, - xdr_lpar, ps3fb_videomemory.size, 0); + xdr_lpar, ps3fb_videomemory.size, + IOPTE_PP_W | IOPTE_PP_R | IOPTE_M); if (status) { dev_err(&dev->core, "%s: lv1_gpu_context_iomap failed: %d\n", __func__, status); @@ -1143,12 +1145,12 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", __func__, status); retval = -ENXIO; - goto err_free_irq; + goto err_context_unmap; } info = framebuffer_alloc(sizeof(struct ps3fb_par), &dev->core); if (!info) - goto err_free_irq; + goto err_context_unmap; par = info->par; par->mode_id = ~ps3fb_mode; /* != ps3fb_mode, to trigger change */ @@ -1213,6 +1215,9 @@ err_fb_dealloc: fb_dealloc_cmap(&info->cmap); err_framebuffer_release: framebuffer_release(info); +err_context_unmap: + lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, xdr_lpar, + ps3fb_videomemory.size, IOPTE_M); err_free_irq: free_irq(ps3fb.irq_no, &dev->core); err_destroy_plug: @@ -1232,6 +1237,7 @@ err: static int ps3fb_shutdown(struct ps3_system_bus_device *dev) { struct fb_info *info = dev->core.driver_data; + u64 xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb_videomemory.address)); dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__); @@ -1254,6 +1260,8 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev) info = dev->core.driver_data = NULL; } iounmap((u8 __force __iomem *)ps3fb.dinfo); + lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, xdr_lpar, + ps3fb_videomemory.size, IOPTE_M); lv1_gpu_context_free(ps3fb.context_handle); lv1_gpu_memory_free(ps3fb.memory_handle); ps3_close_hv_device(dev);