linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* userspace firmware loader, vmap, and nommu
@ 2009-10-06  4:25 Mike Frysinger
  2009-10-06  4:38 ` David Woodhouse
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Mike Frysinger @ 2009-10-06  4:25 UTC (permalink / raw)
  To: David Howells
  Cc: David Woodhouse, Linux kernel mailing list, uclinux-dist-devel

semi-recently (9 Apr 2009), the userspace firmware code was rewritten
to use vmap().  this causes problems for nommu systems as it isnt
possible to create a virtually contiguous map with physically
discontiguous pages.  the firmware loader used to work before this
change because it would handle the realloc steps itself (allocate
larger contiguous memory, copy over older data, release older memory)
and vmalloc() on nommu is simply kmalloc().

this could be handled transparently on nommu systems by moving this
scatter gathering of pages into vmap:
void *vmap(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;
}
void vunmap(const void *addr)
{
    kfree(addr);
}

or we could add nommu-specific code to the firmware loader to not use
vmap().  how would you like to go David (Howells) ?

there is a possibility for the semi-common case of vmap-ing only one
page.  but i'm not familiar enough with the mm code to figure that
case out.
-mike

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-03-31 23:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-06  4:25 userspace firmware loader, vmap, and nommu Mike Frysinger
2009-10-06  4:38 ` David Woodhouse
2009-10-06  4:56   ` Mike Frysinger
2009-12-21 16:44 ` [PATCH] nommu: implement vmap/vunmap with kmalloc Mike Frysinger
2010-01-07  6:49   ` [uClinux-dev] " Mike Frysinger
2010-03-09 16:11   ` [PATCH v2] NOMMU: " Mike Frysinger
2010-03-31 17:11   ` David Howells
2010-03-31 19:54     ` Mike Frysinger
2010-03-31 23:06     ` David Howells
2010-03-31 23:07     ` David Howells
2010-03-31 23:10       ` Mike Frysinger
2010-01-16 15:57 ` [PATCH] nommu: " David Howells

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).