* [PATCH 1/2] NOMMU: new vcoalesce helper function
@ 2011-01-12 5:08 Mike Frysinger
2011-01-12 5:08 ` [PATCH 2/2] firmware loader: use vcoalesce for NOMMU Mike Frysinger
0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2011-01-12 5:08 UTC (permalink / raw)
To: uclinux-dev, David Howells, David McCullough, Greg Ungerer, Paul Mundt
Cc: uclinux-dist-devel, linux-kernel
We can't support vmap on NOMMU systems, so add a new vcoalesce function
which combines maps via kmalloc. A bit more overhead, but at least it
works. For MMU systems, vcoalesce simply redirects to vmap.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
include/linux/vmalloc.h | 3 +++
mm/nommu.c | 22 +++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 44b54f6..1dec450 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -44,10 +44,13 @@ extern void vm_unmap_aliases(void);
#ifdef CONFIG_MMU
extern void __init vmalloc_init(void);
+#define vcoalesce(...) vmap(...)
#else
static inline void vmalloc_init(void)
{
}
+extern void *vcoalesce(struct page **pages, unsigned int count,
+ unsigned long flags, pgprot_t prot);
#endif
extern void *vmalloc(unsigned long size);
diff --git a/mm/nommu.c b/mm/nommu.c
index ef4045d..c1b8e39 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -402,6 +402,26 @@ void *vmalloc_32_user(unsigned long size)
}
EXPORT_SYMBOL(vmalloc_32_user);
+void *vcoalesce(struct page **pages, unsigned int count,
+ unsigned long flags, pgprot_t prot)
+{
+ unsigned int i;
+ void *new_map, *page_data;
+
+ new_map = kmalloc(count << PAGE_SHIFT, GFP_KERNEL);
+ if (!new_map)
+ return NULL;
+
+ for (i = 0; i < count; ++i) {
+ page_data = kmap(pages[i]);
+ memcpy(new_map + (i << PAGE_SHIFT), page_data, PAGE_SIZE);
+ kunmap(page_data);
+ }
+
+ return new_map;
+}
+EXPORT_SYMBOL(vcoalesce);
+
void *vmap(struct page **pages, unsigned int count, unsigned long flags, pgprot_t prot)
{
BUG();
@@ -411,7 +431,7 @@ EXPORT_SYMBOL(vmap);
void vunmap(const void *addr)
{
- BUG();
+ kfree(addr);
}
EXPORT_SYMBOL(vunmap);
--
1.7.4.rc1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH 2/2] firmware loader: use vcoalesce for NOMMU
2011-01-12 5:08 [PATCH 1/2] NOMMU: new vcoalesce helper function Mike Frysinger
@ 2011-01-12 5:08 ` Mike Frysinger
0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2011-01-12 5:08 UTC (permalink / raw)
To: uclinux-dev, David Howells, David McCullough, Greg Ungerer, Paul Mundt
Cc: uclinux-dist-devel, linux-kernel
NOMMU parts can't support vmap, so use vcoalesce instead.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
drivers/base/firmware_class.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 40af43e..ab1488d 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -248,7 +248,7 @@ static ssize_t firmware_loading_store(struct device *dev,
case 0:
if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
vunmap(fw_priv->fw->data);
- fw_priv->fw->data = vmap(fw_priv->pages,
+ fw_priv->fw->data = vcoalesce(fw_priv->pages,
fw_priv->nr_pages,
0, PAGE_KERNEL_RO);
if (!fw_priv->fw->data) {
--
1.7.4.rc1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-12 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12 5:08 [PATCH 1/2] NOMMU: new vcoalesce helper function Mike Frysinger
2011-01-12 5:08 ` [PATCH 2/2] firmware loader: use vcoalesce for NOMMU Mike Frysinger
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®