Skip to contentSkip to conversation

staging tidspbridge: iommu migration

PATCH Superseded Fernando Guzman Lugo 4 participants 16 messages Oct 1, 2010 – Oct 5, 2010 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover staging tidspbridge: iommu migration

This set of patches remove the dspbridge custom mmu implementation and use iommu module instead.

Version2:
- Comments from FUJITA Tomonori and previous patch "tidspbridge: add map support for big buffers" was removed and instead a patch to define ARCH_HAS_SG_CHAIN in arm architecture will be sent.
- Rebase to the latest tidspbridge.

Fernando Guzman Lugo (11):
staging: tidspbridge: replace iommu custom for opensource
implementation
staging: tidspbridge - move shared memory iommu maps to tiomap3430.c
staging: tidspbridge - rename bridge_brd_mem_map/unmap to a proper
name
staging: tidspbridge - remove custom mmu code from tiomap3430.c
staging: tidspbridge - fix mmufault support
staging: tidspbrge - remove hw directory
staging: tidspbridge - move all iommu related code to a new file
staging: tidspbridge: remove dw_dmmu_base from cfg_hostres struct
staging: tidspbridge - remove reserved memory clean up
staging: tidspbridge - deprecate reserve/unreserve_memory funtions
staging: tidspbridge - remove dmm custom module

 drivers/staging/tidspbridge/Makefile               |    7 +-
 drivers/staging/tidspbridge/core/_deh.h            |    5 +-
 drivers/staging/tidspbridge/core/_tiomap.h         |   19 +-
 drivers/staging/tidspbridge/core/dsp-mmu.c         |  316 ++++++
 drivers/staging/tidspbridge/core/io_sm.c           |  180 +---
 drivers/staging/tidspbridge/core/tiomap3430.c      | 1070 ++------------------
 drivers/staging/tidspbridge/core/tiomap3430_pwr.c  |    4 -
 drivers/staging/tidspbridge/core/tiomap_io.c       |   17 +-
 drivers/staging/tidspbridge/core/ue_deh.c          |  115 +---
 drivers/staging/tidspbridge/hw/EasiGlobal.h        |   41 -
 drivers/staging/tidspbridge/hw/MMUAccInt.h         |   76 --
 drivers/staging/tidspbridge/hw/MMURegAcM.h         |  225 ----
 drivers/staging/tidspbridge/hw/hw_defs.h           |   58 --
 drivers/staging/tidspbridge/hw/hw_mmu.c            |  562 ----------
 drivers/staging/tidspbridge/hw/hw_mmu.h            |  163 ---
 .../tidspbridge/include/dspbridge/cfgdefs.h        |    1 -
 .../staging/tidspbridge/include/dspbridge/dev.h    |   24 -
 .../staging/tidspbridge/include/dspbridge/dmm.h    |   75 --
 .../staging/tidspbridge/include/dspbridge/drv.h    |   10 -
 .../tidspbridge/include/dspbridge/dsp-mmu.h        |   67 ++
 .../tidspbridge/include/dspbridge/dspdefs.h        |   44 -
 .../tidspbridge/include/dspbridge/dspioctl.h       |    7 -
 .../staging/tidspbridge/include/dspbridge/proc.h   |   46 -
 drivers/staging/tidspbridge/pmgr/dev.c             |   63 +--
 drivers/staging/tidspbridge/pmgr/dmm.c             |  533 ----------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |   34 +-
 drivers/staging/tidspbridge/rmgr/drv.c             |   15 -
 drivers/staging/tidspbridge/rmgr/drv_interface.c   |    2 -
 drivers/staging/tidspbridge/rmgr/node.c            |   48 +-
 drivers/staging/tidspbridge/rmgr/proc.c            |  197 +----
 30 files changed, 568 insertions(+), 3456 deletions(-)
 create mode 100644 drivers/staging/tidspbridge/core/dsp-mmu.c
 delete mode 100644 drivers/staging/tidspbridge/hw/EasiGlobal.h
 delete mode 100644 drivers/staging/tidspbridge/hw/MMUAccInt.h
 delete mode 100644 drivers/staging/tidspbridge/hw/MMURegAcM.h
 delete mode 100644 drivers/staging/tidspbridge/hw/hw_defs.h
 delete mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.c
 delete mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.h
 delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/dmm.h
 create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dsp-mmu.h
 delete mode 100644 drivers/staging/tidspbridge/pmgr/dmm.c
#1 lore raw

PATCH v2 1/11 staging: tidspbridge: replace iommu custom for opensource implementation

Now the tidspbridge uses the API's from
iovmm module.

---
 drivers/staging/tidspbridge/core/_tiomap.h         |    4 +-
 drivers/staging/tidspbridge/core/io_sm.c           |  121 ++----
 drivers/staging/tidspbridge/core/tiomap3430.c      |  522 ++++----------------
 drivers/staging/tidspbridge/core/ue_deh.c          |    8 -
 .../tidspbridge/include/dspbridge/dspdefs.h        |    2 +-
 drivers/staging/tidspbridge/rmgr/proc.c            |    2 +-
 6 files changed, 138 insertions(+), 521 deletions(-)
drivers/staging/tidspbridge/core/_tiomap.h +3 -1
index 1c1f157..a42c393 100644
@@ -23,6 +23,8 @@
 #include <plat/clockdomain.h>
 #include <mach-omap2/prm-regbits-34xx.h>
 #include <mach-omap2/cm-regbits-34xx.h>
+#include <plat/iommu.h>
+#include <plat/iovmm.h>
 #include <dspbridge/devdefs.h>
 #include <hw_defs.h>
 #include <dspbridge/dspioctl.h>	/* for bridge_ioctl_extproc defn */
@@ -328,7 +330,7 @@ struct bridge_dev_context {
 	u32 dw_internal_size;	/* Internal memory size */
 
 	struct omap_mbox *mbox;		/* Mail box handle */
-
+	struct iommu *dsp_mmu;      /* iommu for iva2 handler */
 	struct cfg_hostres *resources;	/* Host Resources */
 
 	/*
drivers/staging/tidspbridge/core/io_sm.c +36 -85

169 lines not on this page · raw message

drivers/staging/tidspbridge/core/tiomap3430.c +94 -422

634 lines not on this page · raw message

drivers/staging/tidspbridge/core/ue_deh.c +0 -8
index 3430418..14f3191 100644
@@ -115,12 +115,6 @@ int bridge_deh_create(struct deh_mgr **ret_deh,
 	/* Fill in context structure */
 	deh->hbridge_context = hbridge_context;
 
-	/* Install ISR function for DSP MMU fault */
-	status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
-			"DspBridge\tiommu fault", deh);
-	if (status < 0)
-		goto err;
-
 	*ret_deh = deh;
 	return 0;
 
@@ -140,8 +134,6 @@ int bridge_deh_destroy(struct deh_mgr *deh)
 		ntfy_delete(deh->ntfy_obj);
 		kfree(deh->ntfy_obj);
 	}
-	/* Disable DSP MMU fault */
-	free_irq(INT_DSP_MMU_IRQ, deh);
 
 	/* Free DPC object */
 	tasklet_kill(&deh->dpc_tasklet);
drivers/staging/tidspbridge/include/dspbridge/dspdefs.h +1 -1
index 0ae7d16..173dfbb 100644
@@ -201,7 +201,7 @@ typedef int(*fxn_brd_memmap) (struct bridge_dev_context
  */
 typedef int(*fxn_brd_memunmap) (struct bridge_dev_context
 				       * dev_ctxt,
-				       u32 virt_addr, u32 ul_num_bytes);
+				       u32 da);
 
 /*
  *  ======== bridge_brd_stop ========
drivers/staging/tidspbridge/rmgr/proc.c +1 -1
index b47d7aa..97c5b61 100644
@@ -1723,7 +1723,7 @@ int proc_un_map(void *hprocessor, void *map_addr,
 	/* Remove mapping from the page tables. */
 	if (!status) {
 		status = (*p_proc_object->intf_fxns->pfn_brd_mem_un_map)
-		    (p_proc_object->hbridge_context, va_align, size_align);
+		    (p_proc_object->hbridge_context, va_align);
 	}
 
 	mutex_unlock(&proc_lock);
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH v2 2/11 staging: tidspbridge - move shared memory iommu maps to tiomap3430.c

Now iommu maps of shared memory segments are done in bridge_brd_start and unmaped in bridge_brd_stop.

---
 drivers/staging/tidspbridge/core/_tiomap.h    |   13 +++
 drivers/staging/tidspbridge/core/io_sm.c      |  125 +++--------------------
 drivers/staging/tidspbridge/core/tiomap3430.c |  136 +++++++++++++++++++-----
 drivers/staging/tidspbridge/core/tiomap_io.c  |   12 +-
 4 files changed, 139 insertions(+), 147 deletions(-)
drivers/staging/tidspbridge/core/_tiomap.h +13 -0
index a42c393..c1bf95d 100644
@@ -308,6 +308,18 @@ static const struct bpwr_clk_t bpwr_clks[] = {
 
 #define CLEAR_BIT_INDEX(reg, index)   (reg &= ~(1 << (index)))
 
+struct shm_segs {
+	u32 seg0_da;
+	u32 seg0_pa;
+	u32 seg0_va;
+	u32 seg0_size;
+	u32 seg1_da;
+	u32 seg1_pa;
+	u32 seg1_va;
+	u32 seg1_size;
+};
+
+
 /* This Bridge driver's device context: */
 struct bridge_dev_context {
 	struct dev_object *hdev_obj;	/* Handle to Bridge device object. */
@@ -331,6 +343,7 @@ struct bridge_dev_context {
 
 	struct omap_mbox *mbox;		/* Mail box handle */
 	struct iommu *dsp_mmu;      /* iommu for iva2 handler */
+	struct shm_segs sh_s;
 	struct cfg_hostres *resources;	/* Host Resources */
 
 	/*
drivers/staging/tidspbridge/core/io_sm.c +13 -112

171 lines not on this page · raw message

drivers/staging/tidspbridge/core/tiomap3430.c +107 -29

209 lines not on this page · raw message

drivers/staging/tidspbridge/core/tiomap_io.c +6 -6
index e78a7cd..1300bd3 100644
@@ -132,10 +132,9 @@ int read_ext_dsp_data(struct bridge_dev_context *dev_ctxt,
 
 		if (!status) {
 			ul_tlb_base_virt =
-			    dev_context->atlb_entry[0].ul_dsp_va * DSPWORDSIZE;
+			    dev_context->sh_s.seg0_da * DSPWORDSIZE;
 			DBC_ASSERT(ul_tlb_base_virt <= ul_shm_base_virt);
-			dw_ext_prog_virt_mem =
-			    dev_context->atlb_entry[0].ul_gpp_va;
+			dw_ext_prog_virt_mem = dev_context->sh_s.seg0_va;
 
 			if (!trace_read) {
 				ul_shm_offset_virt =
@@ -316,8 +315,9 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
 			ret = -EPERM;
 
 		if (!ret) {
-			ul_tlb_base_virt =
-			    dev_context->atlb_entry[0].ul_dsp_va * DSPWORDSIZE;
+			ul_tlb_base_virt = dev_context->sh_s.seg0_da *
+								DSPWORDSIZE;
+
 			DBC_ASSERT(ul_tlb_base_virt <= ul_shm_base_virt);
 
 			if (symbols_reloaded) {
@@ -335,7 +335,7 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
 			    ul_shm_base_virt - ul_tlb_base_virt;
 			if (trace_load) {
 				dw_ext_prog_virt_mem =
-				    dev_context->atlb_entry[0].ul_gpp_va;
+					dev_context->sh_s.seg0_va;
 			} else {
 				dw_ext_prog_virt_mem = host_res->dw_mem_base[1];
 				dw_ext_prog_virt_mem +=
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH v2 3/11 staging: tidspbridge - rename bridge_brd_mem_map/unmap to a proper name

Now these functions only map user space addresses to dsp virtual addresses, so now the functions have a more meaningful name. Also now user_to_dsp_map returns the mapped address.

---
 drivers/staging/tidspbridge/core/_tiomap.h         |   24 +++
 drivers/staging/tidspbridge/core/tiomap3430.c      |  153 ++++++++++----------
 .../tidspbridge/include/dspbridge/dspdefs.h        |   44 ------
 drivers/staging/tidspbridge/pmgr/dev.c             |    2 -
 drivers/staging/tidspbridge/rmgr/proc.c            |   34 +++--
 5 files changed, 116 insertions(+), 141 deletions(-)
drivers/staging/tidspbridge/core/_tiomap.h +24 -0
index c1bf95d..8777492 100644
@@ -383,4 +383,28 @@ extern s32 dsp_debug;
  */
 int sm_interrupt_dsp(struct bridge_dev_context *dev_context, u16 mb_val);
 
+/**
+ * user_to_dsp_map() - maps user to dsp virtual address
+ * @mmu:	Pointer to iommu handle.
+ * @uva:		Virtual user space address.
+ * @da		DSP address
+ * @size		Buffer size to map.
+ * @usr_pgs	struct page array pointer where the user pages will be stored
+ *
+ * This function maps a user space buffer into DSP virtual address.
+ *
+ */
+u32 user_to_dsp_map(struct iommu *mmu, u32 uva, u32 da, u32 size,
+						struct page **usr_pgs);
+
+/**
+ * user_to_dsp_unmap() - unmaps DSP virtual buffer.
+ * @mmu:	Pointer to iommu handle.
+ * @da		DSP address
+ *
+ * This function unmaps a user space buffer into DSP virtual address.
+ *
+ */
+int user_to_dsp_unmap(struct iommu *mmu, u32 da);
+
 #endif /* _TIOMAP_ */
drivers/staging/tidspbridge/core/tiomap3430.c +74 -79

208 lines not on this page · raw message

drivers/staging/tidspbridge/include/dspbridge/dspdefs.h +0 -44

56 lines not on this page · raw message

drivers/staging/tidspbridge/pmgr/dev.c +0 -2
index 132e960..e3c78fb 100644
@@ -1118,8 +1118,6 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns,
 		STORE_FXN(fxn_brd_setstate, pfn_brd_set_state);
 		STORE_FXN(fxn_brd_memcopy, pfn_brd_mem_copy);
 		STORE_FXN(fxn_brd_memwrite, pfn_brd_mem_write);
-		STORE_FXN(fxn_brd_memmap, pfn_brd_mem_map);
-		STORE_FXN(fxn_brd_memunmap, pfn_brd_mem_un_map);
 		STORE_FXN(fxn_chnl_create, pfn_chnl_create);
 		STORE_FXN(fxn_chnl_destroy, pfn_chnl_destroy);
 		STORE_FXN(fxn_chnl_open, pfn_chnl_open);
drivers/staging/tidspbridge/rmgr/proc.c +18 -16
index 97c5b61..59c946b 100644
@@ -52,6 +52,7 @@
 #include <dspbridge/msg.h>
 #include <dspbridge/dspioctl.h>
 #include <dspbridge/drv.h>
+#include <_tiomap.h>
 
 /*  ----------------------------------- This */
 #include <dspbridge/proc.h>
@@ -1357,7 +1358,6 @@ int proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size,
 	int status = 0;
 	struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
 	struct dmm_map_object *map_obj;
-	u32 tmp_addr = 0;
 
 #ifdef CONFIG_TIDSPBRIDGE_CACHE_LINE_CHECK
 	if ((ul_map_attr & BUFMODE_MASK) != RBUF) {
@@ -1390,24 +1390,27 @@ int proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size,
 
 	/* Add mapping to the page tables. */
 	if (!status) {
-
-		/* Mapped address = MSB of VA | LSB of PA */
-		tmp_addr = (va_align | ((u32) pmpu_addr & (PG_SIZE4K - 1)));
 		/* mapped memory resource tracking */
-		map_obj = add_mapping_info(pr_ctxt, pa_align, tmp_addr,
+		map_obj = add_mapping_info(pr_ctxt, pa_align, va_align,
 						size_align);
-		if (!map_obj)
+		if (!map_obj) {
 			status = -ENOMEM;
-		else
-			status = (*p_proc_object->intf_fxns->pfn_brd_mem_map)
-			    (p_proc_object->hbridge_context, pa_align, va_align,
-			     size_align, ul_map_attr, map_obj->pages);
+		} else {
+			va_align = user_to_dsp_map(
+				p_proc_object->hbridge_context->dsp_mmu,
+				pa_align, va_align, size_align,
+				map_obj->pages);
+			if (IS_ERR_VALUE(va_align))
+				status = (int)va_align;
+		}
 	}
 	if (!status) {
 		/* Mapped address = MSB of VA | LSB of PA */
-		*pp_map_addr = (void *) tmp_addr;
+		map_obj->dsp_addr = (va_align |
+					((u32)pmpu_addr & (PG_SIZE4K - 1)));
+		*pp_map_addr = (void *)map_obj->dsp_addr;
 	} else {
-		remove_mapping_information(pr_ctxt, tmp_addr, size_align);
+		remove_mapping_information(pr_ctxt, va_align, size_align);
 		dmm_un_map_memory(dmm_mgr, va_align, &size_align);
 	}
 	mutex_unlock(&proc_lock);
@@ -1721,10 +1724,9 @@ int proc_un_map(void *hprocessor, void *map_addr,
 	 */
 	status = dmm_un_map_memory(dmm_mgr, (u32) va_align, &size_align);
 	/* Remove mapping from the page tables. */
-	if (!status) {
-		status = (*p_proc_object->intf_fxns->pfn_brd_mem_un_map)
-		    (p_proc_object->hbridge_context, va_align);
-	}
+	if (!status)
+		status = user_to_dsp_unmap(
+			p_proc_object->hbridge_context->dsp_mmu, va_align);
 
 	mutex_unlock(&proc_lock);
 	if (status)
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH v2 4/11 staging: tidspbridge - remove custom mmu code from tiomap3430.c

This patch removes all the custom mmu code remaining in tiomap3430.c which is not needed anymore.

---
 drivers/staging/tidspbridge/core/_tiomap.h    |    2 -
 drivers/staging/tidspbridge/core/tiomap3430.c |  425 -------------------------
 2 files changed, 0 insertions(+), 427 deletions(-)
drivers/staging/tidspbridge/core/_tiomap.h +0 -2
index 8777492..394a64a 100644
@@ -330,7 +330,6 @@ struct bridge_dev_context {
 	 */
 	u32 dw_dsp_ext_base_addr;	/* See the comment above */
 	u32 dw_api_reg_base;	/* API mem map'd registers */
-	void __iomem *dw_dsp_mmu_base;	/* DSP MMU Mapped registers */
 	u32 dw_api_clk_base;	/* CLK Registers */
 	u32 dw_dsp_clk_m2_base;	/* DSP Clock Module m2 */
 	u32 dw_public_rhea;	/* Pub Rhea */
@@ -356,7 +355,6 @@ struct bridge_dev_context {
 
 	/* TC Settings */
 	bool tc_word_swap_on;	/* Traffic Controller Word Swap */
-	struct pg_table_attrs *pt_attrs;
 	u32 dsp_per_clks;
 };
 
drivers/staging/tidspbridge/core/tiomap3430.c +0 -425

489 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#5 lore raw

PATCH v2 5/11 staging: tidspbridge - fix mmufault support

With changes for iommu migration mmufault report and dsp track dump is broken, this patch fixes that.

---
 drivers/staging/tidspbridge/core/_deh.h       |    2 +
 drivers/staging/tidspbridge/core/tiomap3430.c |    2 +
 drivers/staging/tidspbridge/core/ue_deh.c     |   93 ++++++++++---------------
 3 files changed, 40 insertions(+), 57 deletions(-)
drivers/staging/tidspbridge/core/_deh.h +2 -0
index 16723cd..f1254f0 100644
@@ -32,4 +32,6 @@ struct deh_mgr {
 	struct tasklet_struct dpc_tasklet;
 };
 
+int mmu_fault_isr(struct iommu *mmu);
+
 #endif /* _DEH_ */
drivers/staging/tidspbridge/core/tiomap3430.c +2 -0
index f99cc24..55ea265 100644
@@ -56,6 +56,7 @@
 #include "_tiomap.h"
 #include "_tiomap_pwr.h"
 #include "tiomap_io.h"
+#include "_deh.h"
 
 /* Offset in shared mem to write to in order to synchronize start with DSP */
 #define SHMSYNCOFFSET 4		/* GPP byte offset */
@@ -365,6 +366,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
 	}
 	if (!status) {
 		dev_context->dsp_mmu = mmu;
+		mmu->isr = mmu_fault_isr;
 		sm_sg = &dev_context->sh_s;
 		sg0_da = iommu_kmap(mmu, sm_sg->seg0_da, sm_sg->seg0_pa,
 			sm_sg->seg0_size, IOVMF_ENDIAN_LITTLE | IOVMF_ELSZ_32);
drivers/staging/tidspbridge/core/ue_deh.c +36 -57

142 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#6 lore raw

PATCH v2 6/11 staging: tidspbrge - remove hw directory

hw directory was only being used for custom iommu implementation APIs, so after the iommu module migration this directory is not needed anymore.

---
 drivers/staging/tidspbridge/Makefile               |    3 +-
 drivers/staging/tidspbridge/core/_tiomap.h         |    1 -
 drivers/staging/tidspbridge/core/io_sm.c           |    4 -
 drivers/staging/tidspbridge/core/tiomap3430.c      |    4 -
 drivers/staging/tidspbridge/core/tiomap3430_pwr.c  |    4 -
 drivers/staging/tidspbridge/core/tiomap_io.c       |    2 +-
 drivers/staging/tidspbridge/hw/EasiGlobal.h        |   41 --
 drivers/staging/tidspbridge/hw/MMUAccInt.h         |   76 ---
 drivers/staging/tidspbridge/hw/MMURegAcM.h         |  225 --------
 drivers/staging/tidspbridge/hw/hw_defs.h           |   58 --
 drivers/staging/tidspbridge/hw/hw_mmu.c            |  562 --------------------
 drivers/staging/tidspbridge/hw/hw_mmu.h            |  163 ------
 .../tidspbridge/include/dspbridge/dspioctl.h       |    7 -
 13 files changed, 2 insertions(+), 1148 deletions(-)
 delete mode 100644 drivers/staging/tidspbridge/hw/EasiGlobal.h
 delete mode 100644 drivers/staging/tidspbridge/hw/MMUAccInt.h
 delete mode 100644 drivers/staging/tidspbridge/hw/MMURegAcM.h
 delete mode 100644 drivers/staging/tidspbridge/hw/hw_defs.h
 delete mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.c
 delete mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.h
drivers/staging/tidspbridge/Makefile +1 -2
index 8082d5c..e09547d 100644
@@ -11,10 +11,9 @@ librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \
 		rmgr/nldr.o rmgr/drv_interface.o
 libdload = dynload/cload.o dynload/getsection.o dynload/reloc.o \
 		 dynload/tramp.o
-libhw = hw/hw_mmu.o
 
 bridgedriver-objs = $(libgen) $(libservices) $(libcore) $(libpmgr) $(librmgr) \
-			$(libdload) $(libhw)
+			$(libdload)
 
 #Machine dependent
 ccflags-y += -D_TI_ -D_DB_TIOMAP -DTMS32060 \
drivers/staging/tidspbridge/core/_tiomap.h +0 -1
index 394a64a..cd7ff88 100644
@@ -26,7 +26,6 @@
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
 #include <dspbridge/devdefs.h>
-#include <hw_defs.h>
 #include <dspbridge/dspioctl.h>	/* for bridge_ioctl_extproc defn */
 #include <dspbridge/sync.h>
 #include <dspbridge/clk.h>
drivers/staging/tidspbridge/core/io_sm.c +0 -4
index 56856ad..194bada 100644
@@ -39,10 +39,6 @@
 #include <dspbridge/ntfy.h>
 #include <dspbridge/sync.h>
 
-/* Hardware Abstraction Layer */
-#include <hw_defs.h>
-#include <hw_mmu.h>
-
 /* Bridge Driver */
 #include <dspbridge/dspdeh.h>
 #include <dspbridge/dspio.h>
drivers/staging/tidspbridge/core/tiomap3430.c +0 -4
index 55ea265..58118aa 100644
@@ -33,10 +33,6 @@
 #include <dspbridge/drv.h>
 #include <dspbridge/sync.h>
 
-/* ------------------------------------ Hardware Abstraction Layer */
-#include <hw_defs.h>
-#include <hw_mmu.h>
-
 /*  ----------------------------------- Link Driver */
 #include <dspbridge/dspdefs.h>
 #include <dspbridge/dspchnl.h>
drivers/staging/tidspbridge/core/tiomap3430_pwr.c +0 -4
index b9d0753..e29b969 100644
@@ -29,10 +29,6 @@
 #include <dspbridge/dev.h>
 #include <dspbridge/iodefs.h>
 
-/* ------------------------------------ Hardware Abstraction Layer */
-#include <hw_defs.h>
-#include <hw_mmu.h>
-
 #include <dspbridge/pwr_sh.h>
 
 /*  ----------------------------------- Bridge Driver */
drivers/staging/tidspbridge/core/tiomap_io.c +1 -1
index 1300bd3..63d46bc 100644
@@ -141,7 +141,7 @@ int read_ext_dsp_data(struct bridge_dev_context *dev_ctxt,
 				    ul_shm_base_virt - ul_tlb_base_virt;
 				ul_shm_offset_virt +=
 				    PG_ALIGN_HIGH(ul_ext_end - ul_dyn_ext_base +
-						  1, HW_PAGE_SIZE64KB);
+						  1, PAGE_SIZE * 16);
 				dw_ext_prog_virt_mem -= ul_shm_offset_virt;
 				dw_ext_prog_virt_mem +=
 				    (ul_ext_base - ul_dyn_ext_base);
drivers/staging/tidspbridge/hw/EasiGlobal.h deleted +0 -41

41 lines not on this page · raw message

drivers/staging/tidspbridge/hw/MMUAccInt.h deleted +0 -76

76 lines not on this page · raw message

drivers/staging/tidspbridge/hw/MMURegAcM.h deleted +0 -225

225 lines not on this page · raw message

drivers/staging/tidspbridge/hw/hw_defs.h deleted +0 -58

58 lines not on this page · raw message

drivers/staging/tidspbridge/hw/hw_mmu.c deleted +0 -562

562 lines not on this page · raw message

drivers/staging/tidspbridge/hw/hw_mmu.h deleted +0 -163

163 lines not on this page · raw message

drivers/staging/tidspbridge/include/dspbridge/dspioctl.h +0 -7
index 41e0594..bad1801 100644
@@ -19,10 +19,6 @@
 #ifndef DSPIOCTL_
 #define DSPIOCTL_
 
-/* ------------------------------------ Hardware Abstraction Layer */
-#include <hw_defs.h>
-#include <hw_mmu.h>
-
 /*
  * Any IOCTLS at or above this value are reserved for standard Bridge driver
  * interfaces.
@@ -65,9 +61,6 @@ struct bridge_ioctl_extproc {
 	/* GPP virtual address. __va does not work for ioremapped addresses */
 	u32 ul_gpp_va;
 	u32 ul_size;		/* Size of the mapped memory in bytes */
-	enum hw_endianism_t endianism;
-	enum hw_mmu_mixed_size_t mixed_mode;
-	enum hw_element_size_t elem_size;
 };
 
 #endif /* DSPIOCTL_ */
Signature · 1 line
1.6.3.3
#7 lore raw

PATCH v2 7/11 staging: tidspbridge - move all iommu related code to a new file

Create dsp-mmu module and moves all the iommu code related to this module.

---
 drivers/staging/tidspbridge/Makefile               |    2 +-
 drivers/staging/tidspbridge/core/_deh.h            |    3 -
 drivers/staging/tidspbridge/core/_tiomap.h         |   27 +--
 drivers/staging/tidspbridge/core/dsp-mmu.c         |  316 ++++++++++++++++++++
 drivers/staging/tidspbridge/core/tiomap3430.c      |  178 +-----------
 drivers/staging/tidspbridge/core/ue_deh.c          |   86 +------
 .../tidspbridge/include/dspbridge/dsp-mmu.h        |   67 ++++
 7 files changed, 390 insertions(+), 289 deletions(-)
 create mode 100644 drivers/staging/tidspbridge/core/dsp-mmu.c
 create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dsp-mmu.h
drivers/staging/tidspbridge/Makefile +1 -1
index e09547d..bd36651 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_TIDSPBRIDGE)	+= bridgedriver.o
 
 libgen = gen/gb.o gen/gs.o gen/gh.o gen/uuidutil.o
 libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \
-		core/tiomap3430_pwr.o core/tiomap_io.o \
+		core/tiomap3430_pwr.o core/tiomap_io.o core/dsp-mmu.o \
 		core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o
 libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o pmgr/dspapi.o \
 		pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o
drivers/staging/tidspbridge/core/_deh.h +0 -3
index f1254f0..8ae2633 100644
@@ -27,9 +27,6 @@
 struct deh_mgr {
 	struct bridge_dev_context *hbridge_context;	/* Bridge context. */
 	struct ntfy_object *ntfy_obj;	/* NTFY object */
-
-	/* MMU Fault DPC */
-	struct tasklet_struct dpc_tasklet;
 };
 
 int mmu_fault_isr(struct iommu *mmu);
drivers/staging/tidspbridge/core/_tiomap.h +1 -26
index cd7ff88..e0a801c 100644
@@ -23,8 +23,7 @@
 #include <plat/clockdomain.h>
 #include <mach-omap2/prm-regbits-34xx.h>
 #include <mach-omap2/cm-regbits-34xx.h>
-#include <plat/iommu.h>
-#include <plat/iovmm.h>
+#include <dspbridge/dsp-mmu.h>
 #include <dspbridge/devdefs.h>
 #include <dspbridge/dspioctl.h>	/* for bridge_ioctl_extproc defn */
 #include <dspbridge/sync.h>
@@ -380,28 +379,4 @@ extern s32 dsp_debug;
  */
 int sm_interrupt_dsp(struct bridge_dev_context *dev_context, u16 mb_val);
 
-/**
- * user_to_dsp_map() - maps user to dsp virtual address
- * @mmu:	Pointer to iommu handle.
- * @uva:		Virtual user space address.
- * @da		DSP address
- * @size		Buffer size to map.
- * @usr_pgs	struct page array pointer where the user pages will be stored
- *
- * This function maps a user space buffer into DSP virtual address.
- *
- */
-u32 user_to_dsp_map(struct iommu *mmu, u32 uva, u32 da, u32 size,
-						struct page **usr_pgs);
-
-/**
- * user_to_dsp_unmap() - unmaps DSP virtual buffer.
- * @mmu:	Pointer to iommu handle.
- * @da		DSP address
- *
- * This function unmaps a user space buffer into DSP virtual address.
- *
- */
-int user_to_dsp_unmap(struct iommu *mmu, u32 da);
-
 #endif /* _TIOMAP_ */
drivers/staging/tidspbridge/core/dsp-mmu.c new file +316 -0

316 lines not on this page · raw message

drivers/staging/tidspbridge/core/tiomap3430.c +4 -174

215 lines not on this page · raw message

drivers/staging/tidspbridge/core/ue_deh.c +1 -85

122 lines not on this page · raw message

drivers/staging/tidspbridge/include/dspbridge/dsp-mmu.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#8 lore raw

PATCH v2 8/11 staging: tidspbridge: remove dw_dmmu_base from cfg_hostres struct

We don't need to map iva2 iommu register base address anymore.

---
 drivers/staging/tidspbridge/core/tiomap3430.c      |    3 ---
 drivers/staging/tidspbridge/core/tiomap_io.c       |    3 +--
 .../tidspbridge/include/dspbridge/cfgdefs.h        |    1 -
 drivers/staging/tidspbridge/rmgr/drv.c             |    4 ----
 4 files changed, 1 insertions(+), 10 deletions(-)
drivers/staging/tidspbridge/core/tiomap3430.c +0 -3
index 789cc5e..f890a0e 100644
@@ -830,8 +830,6 @@ static int bridge_dev_destroy(struct bridge_dev_context *dev_ctxt)
 			iounmap((void *)host_res->dw_mem_base[3]);
 		if (host_res->dw_mem_base[4])
 			iounmap((void *)host_res->dw_mem_base[4]);
-		if (host_res->dw_dmmu_base)
-			iounmap(host_res->dw_dmmu_base);
 		if (host_res->dw_per_base)
 			iounmap(host_res->dw_per_base);
 		if (host_res->dw_per_pm_base)
@@ -845,7 +843,6 @@ static int bridge_dev_destroy(struct bridge_dev_context *dev_ctxt)
 		host_res->dw_mem_base[2] = (u32) NULL;
 		host_res->dw_mem_base[3] = (u32) NULL;
 		host_res->dw_mem_base[4] = (u32) NULL;
-		host_res->dw_dmmu_base = NULL;
 		host_res->dw_sys_ctrl_base = NULL;
 
 		kfree(host_res);
drivers/staging/tidspbridge/core/tiomap_io.c +1 -2
index 63d46bc..81a5401 100644
@@ -391,7 +391,6 @@ int sm_interrupt_dsp(struct bridge_dev_context *dev_context, u16 mb_val)
 		omap_dspbridge_dev->dev.platform_data;
 	struct cfg_hostres *resources = dev_context->resources;
 	int status = 0;
-	u32 temp;
 
 	if (!dev_context->mbox)
 		return 0;
@@ -435,7 +434,7 @@ int sm_interrupt_dsp(struct bridge_dev_context *dev_context, u16 mb_val)
 		omap_mbox_restore_ctx(dev_context->mbox);
 
 		/* Access MMU SYS CONFIG register to generate a short wakeup */
-		temp = readl(resources->dw_dmmu_base + 0x10);
+		iommu_read_reg(dev_context->dsp_mmu, MMU_SYSCONFIG);
 
 		dev_context->dw_brd_state = BRD_RUNNING;
 	} else if (dev_context->dw_brd_state == BRD_RETENTION) {
drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h +0 -1
index 38122db..dfb55cc 100644
@@ -68,7 +68,6 @@ struct cfg_hostres {
 	void __iomem *dw_per_base;
 	u32 dw_per_pm_base;
 	u32 dw_core_pm_base;
-	void __iomem *dw_dmmu_base;
 	void __iomem *dw_sys_ctrl_base;
 };
 
drivers/staging/tidspbridge/rmgr/drv.c +0 -4
index 81b1b90..0c857b9 100644
@@ -743,7 +743,6 @@ static int request_bridge_resources(struct cfg_hostres *res)
 	host_res->dw_sys_ctrl_base = ioremap(OMAP_SYSC_BASE, OMAP_SYSC_SIZE);
 	dev_dbg(bridge, "dw_mem_base[0] 0x%x\n", host_res->dw_mem_base[0]);
 	dev_dbg(bridge, "dw_mem_base[3] 0x%x\n", host_res->dw_mem_base[3]);
-	dev_dbg(bridge, "dw_dmmu_base %p\n", host_res->dw_dmmu_base);
 
 	/* for 24xx base port is not mapping the mamory for DSP
 	 * internal memory TODO Do a ioremap here */
@@ -797,8 +796,6 @@ int drv_request_bridge_res_dsp(void **phost_resources)
 							 OMAP_PER_PRM_SIZE);
 		host_res->dw_core_pm_base = (u32) ioremap(OMAP_CORE_PRM_BASE,
 							  OMAP_CORE_PRM_SIZE);
-		host_res->dw_dmmu_base = ioremap(OMAP_DMMU_BASE,
-						 OMAP_DMMU_SIZE);
 
 		dev_dbg(bridge, "dw_mem_base[0] 0x%x\n",
 			host_res->dw_mem_base[0]);
@@ -810,7 +807,6 @@ int drv_request_bridge_res_dsp(void **phost_resources)
 			host_res->dw_mem_base[3]);
 		dev_dbg(bridge, "dw_mem_base[4] 0x%x\n",
 			host_res->dw_mem_base[4]);
-		dev_dbg(bridge, "dw_dmmu_base %p\n", host_res->dw_dmmu_base);
 
 		shm_size = drv_datap->shm_size;
 		if (shm_size >= 0x10000) {
Signature · 1 line
1.6.3.3
#9 lore raw

PATCH v2 9/11 staging: tidspbridge - remove reserved memory clean up

Now iommv module keeps track of iommu memory used, we do not need resource cleanup for reserved memories anymore.

---
 .../staging/tidspbridge/include/dspbridge/drv.h    |    4 --
 drivers/staging/tidspbridge/rmgr/drv.c             |   11 ------
 drivers/staging/tidspbridge/rmgr/drv_interface.c   |    2 -
 drivers/staging/tidspbridge/rmgr/proc.c            |   36 --------------------
 4 files changed, 0 insertions(+), 53 deletions(-)
drivers/staging/tidspbridge/include/dspbridge/drv.h +0 -4
index c1f363e..427f38b 100644
@@ -165,10 +165,6 @@ struct process_context {
 	struct list_head dmm_map_list;
 	spinlock_t dmm_map_lock;
 
-	/* DMM reserved memory resources */
-	struct list_head dmm_rsv_list;
-	spinlock_t dmm_rsv_lock;
-
 	/* DSP Heap resources */
 	struct dspheap_res_object *pdspheap_list;
 
drivers/staging/tidspbridge/rmgr/drv.c +0 -11
index 0c857b9..91cc168 100644
@@ -146,7 +146,6 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
 	struct process_context *ctxt = (struct process_context *)process_ctxt;
 	int status = 0;
 	struct dmm_map_object *temp_map, *map_obj;
-	struct dmm_rsv_object *temp_rsv, *rsv_obj;
 
 	/* Free DMM mapped memory resources */
 	list_for_each_entry_safe(map_obj, temp_map, &ctxt->dmm_map_list, link) {
@@ -156,16 +155,6 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
 			pr_err("%s: proc_un_map failed!"
 			       " status = 0x%xn", __func__, status);
 	}
-
-	/* Free DMM reserved memory resources */
-	list_for_each_entry_safe(rsv_obj, temp_rsv, &ctxt->dmm_rsv_list, link) {
-		status = proc_un_reserve_memory(ctxt->hprocessor, (void *)
-						rsv_obj->dsp_reserved_addr,
-						ctxt);
-		if (status)
-			pr_err("%s: proc_un_reserve_memory failed!"
-			       " status = 0x%xn", __func__, status);
-	}
 	return status;
 }
 
drivers/staging/tidspbridge/rmgr/drv_interface.c +0 -2
index 4c0b9ee..f9a1e0b 100644
@@ -507,8 +507,6 @@ static int bridge_open(struct inode *ip, struct file *filp)
 		pr_ctxt->res_state = PROC_RES_ALLOCATED;
 		spin_lock_init(&pr_ctxt->dmm_map_lock);
 		INIT_LIST_HEAD(&pr_ctxt->dmm_map_list);
-		spin_lock_init(&pr_ctxt->dmm_rsv_lock);
-		INIT_LIST_HEAD(&pr_ctxt->dmm_rsv_list);
 
 		pr_ctxt->node_id = kzalloc(sizeof(struct idr), GFP_KERNEL);
 		if (pr_ctxt->node_id) {
drivers/staging/tidspbridge/rmgr/proc.c +0 -36
index 59c946b..e5fec57 100644
@@ -1515,7 +1515,6 @@ int proc_reserve_memory(void *hprocessor, u32 ul_size,
 	struct dmm_object *dmm_mgr;
 	int status = 0;
 	struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
-	struct dmm_rsv_object *rsv_obj;
 
 	if (!p_proc_object) {
 		status = -EFAULT;
@@ -1529,22 +1528,6 @@ int proc_reserve_memory(void *hprocessor, u32 ul_size,
 	}
 
 	status = dmm_reserve_memory(dmm_mgr, ul_size, (u32 *) pp_rsv_addr);
-	if (status != 0)
-		goto func_end;
-
-	/*
-	 * A successful reserve should be followed by insertion of rsv_obj
-	 * into dmm_rsv_list, so that reserved memory resource tracking
-	 * remains uptodate
-	 */
-	rsv_obj = kmalloc(sizeof(struct dmm_rsv_object), GFP_KERNEL);
-	if (rsv_obj) {
-		rsv_obj->dsp_reserved_addr = (u32) *pp_rsv_addr;
-		spin_lock(&pr_ctxt->dmm_rsv_lock);
-		list_add(&rsv_obj->link, &pr_ctxt->dmm_rsv_list);
-		spin_unlock(&pr_ctxt->dmm_rsv_lock);
-	}
-
 func_end:
 	dev_dbg(bridge, "%s: hprocessor: 0x%p ul_size: 0x%x pp_rsv_addr: 0x%p "
 		"status 0x%x\n", __func__, hprocessor,
@@ -1756,7 +1739,6 @@ int proc_un_reserve_memory(void *hprocessor, void *prsv_addr,
 	struct dmm_object *dmm_mgr;
 	int status = 0;
 	struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
-	struct dmm_rsv_object *rsv_obj;
 
 	if (!p_proc_object) {
 		status = -EFAULT;
@@ -1770,24 +1752,6 @@ int proc_un_reserve_memory(void *hprocessor, void *prsv_addr,
 	}
 
 	status = dmm_un_reserve_memory(dmm_mgr, (u32) prsv_addr);
-	if (status != 0)
-		goto func_end;
-
-	/*
-	 * A successful unreserve should be followed by removal of rsv_obj
-	 * from dmm_rsv_list, so that reserved memory resource tracking
-	 * remains uptodate
-	 */
-	spin_lock(&pr_ctxt->dmm_rsv_lock);
-	list_for_each_entry(rsv_obj, &pr_ctxt->dmm_rsv_list, link) {
-		if (rsv_obj->dsp_reserved_addr == (u32) prsv_addr) {
-			list_del(&rsv_obj->link);
-			kfree(rsv_obj);
-			break;
-		}
-	}
-	spin_unlock(&pr_ctxt->dmm_rsv_lock);
-
 func_end:
 	dev_dbg(bridge, "%s: hprocessor: 0x%p prsv_addr: 0x%p status: 0x%x\n",
 		__func__, hprocessor, prsv_addr, status);
Signature · 1 line
1.6.3.3
#10 lore raw

PATCH v2 10/11 staging: tidspbridge - deprecate reserve/unreserve_memory funtions

Now what iommu memory usage is kept track by iommu module the functions reserve/unreserve_memory are not needed anymore.

---
 .../staging/tidspbridge/include/dspbridge/proc.h   |   46 --------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |   34 +-----
 drivers/staging/tidspbridge/rmgr/node.c            |   20 +----
 drivers/staging/tidspbridge/rmgr/proc.c            |  114 ++------------------
 4 files changed, 17 insertions(+), 197 deletions(-)
drivers/staging/tidspbridge/include/dspbridge/proc.h +0 -46
index 5e09fd1..2d12aab 100644
@@ -551,29 +551,6 @@ extern int proc_map(void *hprocessor,
 			   struct process_context *pr_ctxt);
 
 /*
- *  ======== proc_reserve_memory ========
- *  Purpose:
- *      Reserve a virtually contiguous region of DSP address space.
- *  Parameters:
- *      hprocessor      :   The processor handle.
- *      ul_size	  :   Size of the address space to reserve.
- *      pp_rsv_addr       :   Ptr to DSP side reserved u8 address.
- *  Returns:
- *      0	 :   Success.
- *      -EFAULT     :   Invalid processor handle.
- *      -EPERM       :   General failure.
- *      -ENOMEM     :   Cannot reserve chunk of this size.
- *  Requires:
- *      pp_rsv_addr is not NULL
- *      PROC Initialized.
- *  Ensures:
- *  Details:
- */
-extern int proc_reserve_memory(void *hprocessor,
-				      u32 ul_size, void **pp_rsv_addr,
-				      struct process_context *pr_ctxt);
-
-/*
  *  ======== proc_un_map ========
  *  Purpose:
  *      Removes a MPU buffer mapping from the DSP address space.
@@ -595,27 +572,4 @@ extern int proc_reserve_memory(void *hprocessor,
 extern int proc_un_map(void *hprocessor, void *map_addr,
 			      struct process_context *pr_ctxt);
 
-/*
- *  ======== proc_un_reserve_memory ========
- *  Purpose:
- *      Frees a previously reserved region of DSP address space.
- *  Parameters:
- *      hprocessor      :   The processor handle.
- *      prsv_addr	:   Ptr to DSP side reservedBYTE address.
- *  Returns:
- *      0	 :   Success.
- *      -EFAULT     :   Invalid processor handle.
- *      -EPERM       :   General failure.
- *      -ENOENT   :   Cannot find a reserved region starting with this
- *		      :   address.
- *  Requires:
- *      prsv_addr is not NULL
- *      PROC Initialized.
- *  Ensures:
- *  Details:
- */
-extern int proc_un_reserve_memory(void *hprocessor,
-					 void *prsv_addr,
-					 struct process_context *pr_ctxt);
-
 #endif /* PROC_ */
drivers/staging/tidspbridge/pmgr/dspapi.c +6 -28
index faf8304..0187c47 100644
@@ -989,27 +989,10 @@ u32 procwrap_register_notify(union trapped_args *args, void *pr_ctxt)
 /*
  * ======== procwrap_reserve_memory ========
  */
-u32 procwrap_reserve_memory(union trapped_args *args, void *pr_ctxt)
+u32 __deprecated procwrap_reserve_memory(union trapped_args *args,
+							void *pr_ctxt)
 {
-	int status;
-	void *prsv_addr;
-	void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
-
-	if ((args->args_proc_rsvmem.ul_size <= 0) ||
-	    (args->args_proc_rsvmem.ul_size & (PG_SIZE4K - 1)) != 0)
-		return -EINVAL;
-
-	status = proc_reserve_memory(hprocessor,
-				     args->args_proc_rsvmem.ul_size, &prsv_addr,
-				     pr_ctxt);
-	if (!status) {
-		if (put_user(prsv_addr, args->args_proc_rsvmem.pp_rsv_addr)) {
-			status = -EINVAL;
-			proc_un_reserve_memory(args->args_proc_rsvmem.
-					       hprocessor, prsv_addr, pr_ctxt);
-		}
-	}
-	return status;
+	return 0;
 }
 
 /*
@@ -1038,15 +1021,10 @@ u32 procwrap_un_map(union trapped_args *args, void *pr_ctxt)
 /*
  * ======== procwrap_un_reserve_memory ========
  */
-u32 procwrap_un_reserve_memory(union trapped_args *args, void *pr_ctxt)
+u32 __deprecated procwrap_un_reserve_memory(union trapped_args *args,
+							void *pr_ctxt)
 {
-	int status;
-	void *hprocessor = ((struct process_context *)pr_ctxt)->hprocessor;
-
-	status = proc_un_reserve_memory(hprocessor,
-					args->args_proc_unrsvmem.prsv_addr,
-					pr_ctxt);
-	return status;
+	return 0;
 }
 
 /*
drivers/staging/tidspbridge/rmgr/node.c +1 -19
index 84882dc..d681617 100644
@@ -430,17 +430,6 @@ int node_allocate(struct proc_object *hprocessor,
 	if (status)
 		goto func_cont;
 
-	status = proc_reserve_memory(hprocessor,
-				     pnode->create_args.asa.task_arg_obj.
-				     heap_size + PAGE_SIZE,
-				     (void **)&(pnode->create_args.asa.
-					task_arg_obj.udsp_heap_res_addr),
-				     pr_ctxt);
-	if (status) {
-		pr_err("%s: Failed to reserve memory for heap: 0x%x\n",
-		       __func__, status);
-		goto func_cont;
-	}
 #ifdef DSP_DMM_DEBUG
 	status = dmm_get_handle(p_proc_object, &dmm_mgr);
 	if (!dmm_mgr) {
@@ -456,8 +445,7 @@ int node_allocate(struct proc_object *hprocessor,
 	map_attrs |= DSP_MAPVIRTUALADDR;
 	status = proc_map(hprocessor, (void *)attr_in->pgpp_virt_addr,
 			  pnode->create_args.asa.task_arg_obj.heap_size,
-			  (void *)pnode->create_args.asa.task_arg_obj.
-			  udsp_heap_res_addr, (void **)&mapped_addr, map_attrs,
+			  NULL, (void **)&mapped_addr, map_attrs,
 			  pr_ctxt);
 	if (status)
 		pr_err("%s: Failed to map memory for Heap: 0x%x\n",
@@ -2577,12 +2565,6 @@ static void delete_node(struct node_object *hnode,
 			status = proc_un_map(hnode->hprocessor, (void *)
 					     task_arg_obj.udsp_heap_addr,
 					     pr_ctxt);
-
-			status = proc_un_reserve_memory(hnode->hprocessor,
-							(void *)
-							task_arg_obj.
-							udsp_heap_res_addr,
-							pr_ctxt);
 #ifdef DSP_DMM_DEBUG
 			status = dmm_get_handle(p_proc_object, &dmm_mgr);
 			if (dmm_mgr)
drivers/staging/tidspbridge/rmgr/proc.c +10 -104

182 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#11 lore raw

PATCH v2 11/11 staging: tidspbridge - remove dmm custom module

Dmm custom module is not needed anymore.

---
 drivers/staging/tidspbridge/Makefile               |    2 +-
 drivers/staging/tidspbridge/core/tiomap3430.c      |    1 -
 .../staging/tidspbridge/include/dspbridge/dev.h    |   24 -
 .../staging/tidspbridge/include/dspbridge/dmm.h    |   75 ---
 .../staging/tidspbridge/include/dspbridge/drv.h    |    6 -
 drivers/staging/tidspbridge/pmgr/dev.c             |   61 +---
 drivers/staging/tidspbridge/pmgr/dmm.c             |  533 --------------------
 drivers/staging/tidspbridge/rmgr/node.c            |   28 +-
 drivers/staging/tidspbridge/rmgr/proc.c            |   23 -
 9 files changed, 6 insertions(+), 747 deletions(-)
 delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/dmm.h
 delete mode 100644 drivers/staging/tidspbridge/pmgr/dmm.c
drivers/staging/tidspbridge/Makefile +1 -1
index bd36651..7c122fa 100644
@@ -5,7 +5,7 @@ libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \
 		core/tiomap3430_pwr.o core/tiomap_io.o core/dsp-mmu.o \
 		core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o
 libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o pmgr/dspapi.o \
-		pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o
+		pmgr/cmm.o pmgr/dbll.o
 librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \
 		rmgr/proc.o rmgr/pwr.o rmgr/rmm.o rmgr/strm.o rmgr/dspdrv.o \
 		rmgr/nldr.o rmgr/drv_interface.o
drivers/staging/tidspbridge/core/tiomap3430.c +0 -1
index f890a0e..0e3558a 100644
@@ -45,7 +45,6 @@
 /*  ----------------------------------- Platform Manager */
 #include <dspbridge/dev.h>
 #include <dspbridge/dspapi.h>
-#include <dspbridge/dmm.h>
 #include <dspbridge/wdt.h>
 
 /*  ----------------------------------- Local */
drivers/staging/tidspbridge/include/dspbridge/dev.h +0 -24
index 357458f..9bdd48f 100644
@@ -27,7 +27,6 @@
 #include <dspbridge/nodedefs.h>
 #include <dspbridge/dispdefs.h>
 #include <dspbridge/dspdefs.h>
-#include <dspbridge/dmm.h>
 #include <dspbridge/host_os.h>
 
 /*  ----------------------------------- This */
@@ -234,29 +233,6 @@ extern int dev_get_cmm_mgr(struct dev_object *hdev_obj,
 				  struct cmm_object **mgr);
 
 /*
- *  ======== dev_get_dmm_mgr ========
- *  Purpose:
- *      Retrieve the handle to the dynamic memory manager created for this
- *      device.
- *  Parameters:
- *      hdev_obj:     Handle to device object created with
- *                      dev_create_device().
- *      *mgr:           Ptr to location to store handle.
- *  Returns:
- *      0:        Success.
- *      -EFAULT:    Invalid hdev_obj.
- *  Requires:
- *      mgr != NULL.
- *      DEV Initialized.
- *  Ensures:
- *      0:        *mgr contains a handle to a channel manager object,
- *                      or NULL.
- *      else:           *mgr is NULL.
- */
-extern int dev_get_dmm_mgr(struct dev_object *hdev_obj,
-				  struct dmm_object **mgr);
-
-/*
  *  ======== dev_get_cod_mgr ========
  *  Purpose:
  *      Retrieve the COD manager create for this device.
drivers/staging/tidspbridge/include/dspbridge/dmm.h deleted +0 -75

75 lines not on this page · raw message

drivers/staging/tidspbridge/include/dspbridge/drv.h +0 -6
index 427f38b..75a2c9b 100644
@@ -108,12 +108,6 @@ struct dmm_map_object {
 	struct bridge_dma_map_info dma_info;
 };
 
-/* Used for DMM reserved memory accounting */
-struct dmm_rsv_object {
-	struct list_head link;
-	u32 dsp_reserved_addr;
-};
-
 /* New structure (member of process context) abstracts DMM resource info */
 struct dspheap_res_object {
 	s32 heap_allocated;	/* DMM status */
drivers/staging/tidspbridge/pmgr/dev.c +4 -57

113 lines not on this page · raw message

drivers/staging/tidspbridge/pmgr/dmm.c deleted +0 -533

533 lines not on this page · raw message

drivers/staging/tidspbridge/rmgr/node.c +1 -27
index d681617..a2d3c1b 100644
@@ -56,7 +56,6 @@
 /*  ----------------------------------- This */
 #include <dspbridge/nodepriv.h>
 #include <dspbridge/node.h>
-#include <dspbridge/dmm.h>
 
 /* Static/Dynamic Loader includes */
 #include <dspbridge/dbll.h>
@@ -317,10 +316,6 @@ int node_allocate(struct proc_object *hprocessor,
 	u32 mapped_addr = 0;
 	u32 map_attrs = 0x0;
 	struct dsp_processorstate proc_state;
-#ifdef DSP_DMM_DEBUG
-	struct dmm_object *dmm_mgr;
-	struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
-#endif
 
 	void *node_res;
 
@@ -430,16 +425,6 @@ int node_allocate(struct proc_object *hprocessor,
 	if (status)
 		goto func_cont;
 
-#ifdef DSP_DMM_DEBUG
-	status = dmm_get_handle(p_proc_object, &dmm_mgr);
-	if (!dmm_mgr) {
-		status = DSP_EHANDLE;
-		goto func_cont;
-	}
-
-	dmm_mem_map_dump(dmm_mgr);
-#endif
-
 	map_attrs |= DSP_MAPLITTLEENDIAN;
 	map_attrs |= DSP_MAPELEMSIZE32;
 	map_attrs |= DSP_MAPVIRTUALADDR;
@@ -2500,11 +2485,7 @@ static void delete_node(struct node_object *hnode,
 	struct stream_chnl stream;
 	struct node_msgargs node_msg_args;
 	struct node_taskargs task_arg_obj;
-#ifdef DSP_DMM_DEBUG
-	struct dmm_object *dmm_mgr;
-	struct proc_object *p_proc_object =
-	    (struct proc_object *)hnode->hprocessor;
-#endif
+
 	int status;
 	if (!hnode)
 		goto func_end;
@@ -2565,13 +2546,6 @@ static void delete_node(struct node_object *hnode,
 			status = proc_un_map(hnode->hprocessor, (void *)
 					     task_arg_obj.udsp_heap_addr,
 					     pr_ctxt);
-#ifdef DSP_DMM_DEBUG
-			status = dmm_get_handle(p_proc_object, &dmm_mgr);
-			if (dmm_mgr)
-				dmm_mem_map_dump(dmm_mgr);
-			else
-				status = DSP_EHANDLE;
-#endif
 		}
 	}
 	if (node_type != NODE_MESSAGE) {
drivers/staging/tidspbridge/rmgr/proc.c +0 -23
index 429f354..7a15a02 100644
@@ -39,7 +39,6 @@
 #include <dspbridge/cod.h>
 #include <dspbridge/dev.h>
 #include <dspbridge/procpriv.h>
-#include <dspbridge/dmm.h>
 
 /*  ----------------------------------- Resource Manager */
 #include <dspbridge/mgr.h>
@@ -1078,7 +1077,6 @@ int proc_load(void *hprocessor, const s32 argc_index,
 	s32 cnew_envp;		/* "  " in new_envp[] */
 	s32 nproc_id = 0;	/* Anticipate MP version. */
 	struct dcd_manager *hdcd_handle;
-	struct dmm_object *dmm_mgr;
 	u32 dw_ext_end;
 	u32 proc_id;
 	int brd_state;
@@ -1269,25 +1267,6 @@ int proc_load(void *hprocessor, const s32 argc_index,
 			if (!status)
 				status = cod_get_sym_value(cod_mgr, EXTEND,
 							   &dw_ext_end);
-
-			/* Reset DMM structs and add an initial free chunk */
-			if (!status) {
-				status =
-				    dev_get_dmm_mgr(p_proc_object->hdev_obj,
-						    &dmm_mgr);
-				if (dmm_mgr) {
-					/* Set dw_ext_end to DMM START u8
-					 * address */
-					dw_ext_end =
-					    (dw_ext_end + 1) * DSPWORDSIZE;
-					/* DMM memory is from EXT_END */
-					status = dmm_create_tables(dmm_mgr,
-								   dw_ext_end,
-								   DMMPOOLSIZE);
-				} else {
-					status = -EFAULT;
-				}
-			}
 		}
 	}
 	/* Restore the original argv[0] */
@@ -1390,7 +1369,6 @@ int proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size,
 		map_obj->dsp_addr = (va_align |
 					((u32)pmpu_addr & (PG_SIZE4K - 1)));
 		*pp_map_addr = (void *)map_obj->dsp_addr;
-		pr_err("%s: mapped address %x\n", __func__, *pp_map_addr);
 	} else {
 		remove_mapping_information(pr_ctxt, va_align);
 	}
@@ -1633,7 +1611,6 @@ int proc_un_map(void *hprocessor, void *map_addr,
 	int status = 0;
 	struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
 	u32 va_align;
-	u32 size_align;
 
 	va_align = PG_ALIGN_LOW((u32) map_addr, PG_SIZE4K);
 	if (!p_proc_object) {
Signature · 1 line
1.6.3.3
#13 lore raw

RE: [PATCHv2 01/11] staging: tidspbridge: replace iommu custom for opensource implementation

Hi,

Quoted 12 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, October 05, 2010 10:56 AM
To: Guzman Lugo, Fernando
Cc: [email protected]; [email protected]; [email protected]; Menon, Nishanth; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCHv2 01/11] staging: tidspbridge: replace iommu custom for opensource implementation

Quoted 7 lines
Quoted 3 lines · Fernando Guzman Lugo

Now the tidspbridge uses the API's from iovmm module.

This patch applied, but number 2 and others didn't. Care to respin those against the new linux-next tree and resend?

I will rebase and send then as soon as possible.

Regards,
Fernando.

Quoted 5 lines

thanks,

greg k-h

#14 lore raw

RE: [PATCHv2 01/11] staging: tidspbridge: replace iommu custom for opensource implementation

In reply to Greg KH
Quoted 14 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, October 05, 2010 10:56 AM
To: Guzman Lugo, Fernando
Cc: [email protected]; [email protected]; [email protected]; Menon, Nishanth; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCHv2 01/11] staging: tidspbridge: replace iommu custom for opensource implementation

Quoted 7 lines
Quoted 3 lines · Fernando Guzman Lugo

Now the tidspbridge uses the API's from iovmm module.

This patch applied, but number 2 and others didn't. Care to respin those against the new linux-next tree and resend?

Done, you should not have any problem now.

Regards,
Fernando.

Quoted 5 lines

thanks,

greg k-h

#15 lore raw
In reply to Fernando Guzman Lugo

Hi,

Quoted 2 lines · Fernando Guzman Lugo

This set of patches remove the dspbridge custom mmu implementation and use iommu module instead.

I suppose the driver wouldn't work in the middle of this patch series. I wanted to try this patches and experiment to see if I could come with a version that doesn't break in the middle, but it turns out the driver doesn't work at all on 2.6.36, I just sent an email with the details.

Have you tried with the mainline? Or am I missing something?

Signature · 1 line
Felipe Contreras