mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Ingo Molnar <mingo@redhat.com>, David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH] dma-debug: Allow archs to override check_for_illegal_area
Date: Tue, 11 Aug 2009 17:43:01 +0200	[thread overview]
Message-ID: <1250005381-17903-1-git-send-email-joerg.roedel@amd.com> (raw)

For some architectures (like sparc32) the default
check_for_illegal_area function does not work reliable. This patch
makes this function a weak symbol allowing architectures to override
it if necessary.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 lib/dma-debug.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 65b0d99..4f6ad34 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -866,7 +866,9 @@ static inline bool overlap(void *addr, unsigned long len, void *start, void *end
 	return !(b1 <= a2 || a1 >= b2);
 }
 
-static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len)
+void __weak dma_debug_check_for_illegal_area(struct device *dev,
+					     void *addr,
+					     unsigned long len)
 {
 	if (overlap(addr, len, _text, _etext) ||
 	    overlap(addr, len, __start_rodata, __end_rodata))
@@ -971,7 +973,7 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
 		void *addr = page_address(page) + offset;
 
 		check_for_stack(dev, addr);
-		check_for_illegal_area(dev, addr, size);
+		dma_debug_check_for_illegal_area(dev, addr, size);
 	}
 
 	add_dma_entry(entry);
@@ -1025,7 +1027,8 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
 
 		if (!PageHighMem(sg_page(s))) {
 			check_for_stack(dev, sg_virt(s));
-			check_for_illegal_area(dev, sg_virt(s), sg_dma_len(s));
+			dma_debug_check_for_illegal_area(dev, sg_virt(s),
+							 sg_dma_len(s));
 		}
 
 		add_dma_entry(entry);
-- 
1.6.3.3



             reply	other threads:[~2009-08-11 15:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11 15:43 Joerg Roedel [this message]
2009-08-12  8:54 ` Ingo Molnar
2009-08-14 20:02   ` David Miller
2009-08-15  8:46     ` Ingo Molnar

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=1250005381-17903-1-git-send-email-joerg.roedel@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.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

all inboxes | Powered by JetHome®