linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ohad Ben-Cohen <ohad@wizery.com>
To: linux-omap@vger.kernel.org
Cc: Kanigeri Hari <h-kanigeri2@ti.com>,
	Omar Ramirez Luna <omar.ramirez@ti.com>,
	Guzman Lugo Fernando <x0095840@ti.com>,
	Menon Nishanth <nm@ti.com>, Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
	Ohad Ben-Cohen <ohad@wizery.com>
Subject: [RFC/PATCH 3/6] DSPBRIDGE: remove mapping information in proc_unmap
Date: Sat,  1 May 2010 23:44:28 +0300	[thread overview]
Message-ID: <1272746671-13423-4-git-send-email-ohad@wizery.com> (raw)
In-Reply-To: <1272746671-13423-1-git-send-email-ohad@wizery.com>

Clean up all mapping information resources whenever
a buffer is unmapped.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
If you want, you can also reach me at <  ohadb at ti dot com  >.

 drivers/dsp/bridge/rmgr/proc.c |   43 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index b03232f..ebb11b1 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -169,6 +169,46 @@ static struct memory_map_info *add_mapping_info(struct proc_object *pr_obj,
 	return map_info;
 }
 
+static int match_exact_map_info(struct memory_map_info *map_info,
+					u32 dsp_addr, u32 size)
+{
+	return map_info->dsp_addr == dsp_addr &&
+		map_info->size == size;
+}
+
+static void remove_mapping_information(struct proc_object *pr_obj,
+					u32 dsp_addr, u32 size)
+{
+	struct memory_map_info *map_info;
+	struct list_head *iter;
+
+	pr_debug("%s: looking for virt 0x%x size 0x%x\n", __func__,
+							dsp_addr, size);
+
+	spin_lock(&pr_obj->maps_lock);
+	list_for_each(iter, &pr_obj->maps) {
+		map_info = list_entry(iter, struct memory_map_info, node);
+		pr_debug("%s: candidate: mpu_addr 0x%x virt 0x%x size 0x%x\n",
+						__func__,
+						map_info->mpu_addr,
+						map_info->dsp_addr,
+						map_info->size);
+
+		if (match_exact_map_info(map_info, dsp_addr, size)) {
+			pr_debug("%s: match, deleting map info\n", __func__);
+			list_del(&map_info->node);
+			kfree(map_info->pages);
+			kfree(map_info);
+			goto out;
+		}
+		pr_debug("%s: candidate didn't match\n", __func__);
+	}
+
+	pr_err("%s: failed to find given map info\n", __func__);
+out:
+	spin_unlock(&pr_obj->maps_lock);
+}
+
 /*
  *  ======== proc_attach ========
  *  Purpose:
@@ -1508,6 +1548,9 @@ dsp_status proc_un_map(void *hprocessor, void *map_addr,
 		status = (*p_proc_object->intf_fxns->pfn_brd_mem_un_map)
 		    (p_proc_object->hwmd_context, va_align, size_align);
 	}
+
+	remove_mapping_information(p_proc_object, va_align, size_align);
+
 	mutex_unlock(&proc_lock);
 	if (DSP_FAILED(status))
 		goto func_end;
-- 
1.6.3.3


  parent reply	other threads:[~2010-05-01 20:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-01 20:44 [RFC/PATCH 0/6] DSPBRIDGE: fix mem+cache API issues Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 1/6] DSPBRIDGE: add memory_map_info to PROC Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 2/6] DSPBRIDGE: remember mapping and page info in proc_map Ohad Ben-Cohen
2010-05-15  8:34   ` Felipe Contreras
2010-05-16 23:00     ` Ohad Ben-Cohen
2010-05-01 20:44 ` Ohad Ben-Cohen [this message]
2010-05-15  8:38   ` [RFC/PATCH 3/6] DSPBRIDGE: remove mapping information in proc_unmap Felipe Contreras
2010-05-16 23:02     ` Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 4/6] DSPBRIDGE: do not call follow_page Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 5/6] DSPBRIDGE: do not use low level cache manipulation API Ohad Ben-Cohen
2010-05-02 11:56   ` Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 6/6] DSPBRIDGE: add dspbridge API to mark end of DMA Ohad Ben-Cohen
2010-05-02 13:17 ` [RFC/PATCH 0/6] DSPBRIDGE: fix mem+cache API issues Felipe Contreras
2010-05-02 17:47   ` Ohad Ben-Cohen
2010-05-14 19:27     ` Felipe Contreras
2010-05-14 19:49       ` Omar Ramirez Luna
2010-05-15  8:26         ` Felipe Contreras
2010-05-15  9:08           ` Felipe Contreras
2010-05-16 16:08             ` Felipe Contreras
2010-05-16 17:35       ` Felipe Contreras
2010-05-16 22:57         ` Ohad Ben-Cohen
2010-05-16 23:51           ` Felipe Contreras
2010-05-18  8:05             ` Ohad Ben-Cohen
2010-05-18 11:02               ` Felipe Contreras
2010-05-18 11:14                 ` Ohad Ben-Cohen
2010-05-18 11:43                   ` Felipe Contreras
2010-05-18 11:57                     ` Ohad Ben-Cohen
2010-05-18 12:24                       ` Felipe Contreras
2010-05-18 12:53                         ` Ohad Ben-Cohen
2010-05-19 16:50                           ` Felipe Contreras
2010-05-20 21:22                             ` Ohad Ben-Cohen
2010-05-20 21:23                               ` Ohad Ben-Cohen
2010-05-21  6:14                               ` Felipe Contreras
2010-05-21  8:22                                 ` Ohad Ben-Cohen
2010-05-21  9:42                                   ` Felipe Contreras
2010-05-24 16:19                                     ` Ohad Ben-Cohen
2010-05-24 19:21                                       ` Felipe Contreras
2010-05-24 19:49                                         ` Ohad Ben-Cohen
2010-05-16 22:35       ` Ohad Ben-Cohen
2010-05-16 23:15         ` Felipe Contreras
2010-05-16 23:21           ` Ohad Ben-Cohen
2010-05-16 23:25           ` Ohad Ben-Cohen
2010-05-17  0:05             ` Felipe Contreras
2010-05-18  6:20               ` Ohad Ben-Cohen
2010-05-20 21:18       ` Ohad Ben-Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1272746671-13423-4-git-send-email-ohad@wizery.com \
    --to=ohad@wizery.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=h-kanigeri2@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=omar.ramirez@ti.com \
    --cc=x0095840@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).