diff options
author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2009-06-10 00:38:47 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-14 23:26:20 -0400 |
commit | 56ac72dba5d24a477d281b985797d5e62d3f5c2e (patch) | |
tree | d2eba5567ba763b054f8c185b209b81bb35381da /drivers | |
parent | e78d0c5c14ab91648274b2c5e6c4c35f072cea64 (diff) |
ps3vram: 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: Jim Paris <jim@jtan.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/ps3vram.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index 3c9ad1959a69..83c14533aea5 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/seq_file.h> | 14 | #include <linux/seq_file.h> |
15 | 15 | ||
16 | #include <asm/firmware.h> | 16 | #include <asm/firmware.h> |
17 | #include <asm/iommu.h> | ||
17 | #include <asm/lv1call.h> | 18 | #include <asm/lv1call.h> |
18 | #include <asm/ps3.h> | 19 | #include <asm/ps3.h> |
19 | 20 | ||
@@ -603,8 +604,8 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev) | |||
603 | int error, status; | 604 | int error, status; |
604 | struct request_queue *queue; | 605 | struct request_queue *queue; |
605 | struct gendisk *gendisk; | 606 | struct gendisk *gendisk; |
606 | u64 ddr_lpar, ctrl_lpar, info_lpar, reports_lpar, ddr_size, | 607 | u64 ddr_size, ddr_lpar, ctrl_lpar, info_lpar, reports_lpar, |
607 | reports_size; | 608 | reports_size, xdr_lpar; |
608 | char *rest; | 609 | char *rest; |
609 | 610 | ||
610 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 611 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
@@ -675,9 +676,11 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev) | |||
675 | } | 676 | } |
676 | 677 | ||
677 | /* Map XDR buffer to RSX */ | 678 | /* Map XDR buffer to RSX */ |
679 | xdr_lpar = ps3_mm_phys_to_lpar(__pa(priv->xdr_buf)); | ||
678 | status = lv1_gpu_context_iomap(priv->context_handle, XDR_IOIF, | 680 | status = lv1_gpu_context_iomap(priv->context_handle, XDR_IOIF, |
679 | ps3_mm_phys_to_lpar(__pa(priv->xdr_buf)), | 681 | xdr_lpar, XDR_BUF_SIZE, |
680 | XDR_BUF_SIZE, 0); | 682 | CBE_IOPTE_PP_W | CBE_IOPTE_PP_R | |
683 | CBE_IOPTE_M); | ||
681 | if (status) { | 684 | if (status) { |
682 | dev_err(&dev->core, "lv1_gpu_context_iomap failed %d\n", | 685 | dev_err(&dev->core, "lv1_gpu_context_iomap failed %d\n", |
683 | status); | 686 | status); |
@@ -690,7 +693,7 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev) | |||
690 | if (!priv->ddr_base) { | 693 | if (!priv->ddr_base) { |
691 | dev_err(&dev->core, "ioremap DDR failed\n"); | 694 | dev_err(&dev->core, "ioremap DDR failed\n"); |
692 | error = -ENOMEM; | 695 | error = -ENOMEM; |
693 | goto out_free_context; | 696 | goto out_unmap_context; |
694 | } | 697 | } |
695 | 698 | ||
696 | priv->ctrl = ioremap(ctrl_lpar, 64 * 1024); | 699 | priv->ctrl = ioremap(ctrl_lpar, 64 * 1024); |
@@ -776,6 +779,9 @@ out_unmap_ctrl: | |||
776 | iounmap(priv->ctrl); | 779 | iounmap(priv->ctrl); |
777 | out_unmap_vram: | 780 | out_unmap_vram: |
778 | iounmap(priv->ddr_base); | 781 | iounmap(priv->ddr_base); |
782 | out_unmap_context: | ||
783 | lv1_gpu_context_iomap(priv->context_handle, XDR_IOIF, xdr_lpar, | ||
784 | XDR_BUF_SIZE, CBE_IOPTE_M); | ||
779 | out_free_context: | 785 | out_free_context: |
780 | lv1_gpu_context_free(priv->context_handle); | 786 | lv1_gpu_context_free(priv->context_handle); |
781 | out_free_memory: | 787 | out_free_memory: |
@@ -803,6 +809,9 @@ static int ps3vram_remove(struct ps3_system_bus_device *dev) | |||
803 | iounmap(priv->reports); | 809 | iounmap(priv->reports); |
804 | iounmap(priv->ctrl); | 810 | iounmap(priv->ctrl); |
805 | iounmap(priv->ddr_base); | 811 | iounmap(priv->ddr_base); |
812 | lv1_gpu_context_iomap(priv->context_handle, XDR_IOIF, | ||
813 | ps3_mm_phys_to_lpar(__pa(priv->xdr_buf)), | ||
814 | XDR_BUF_SIZE, CBE_IOPTE_M); | ||
806 | lv1_gpu_context_free(priv->context_handle); | 815 | lv1_gpu_context_free(priv->context_handle); |
807 | lv1_gpu_memory_free(priv->memory_handle); | 816 | lv1_gpu_memory_free(priv->memory_handle); |
808 | ps3_close_hv_device(dev); | 817 | ps3_close_hv_device(dev); |