[PATCH][MTD] mtdpart.c: allow other drivers to get physical address of partition

Jared Hulbert jaredeh at gmail.com
Thu Aug 2 17:55:32 EDT 2007

> That does'nt work on smp machines, does it?

Probably not.  That code is machine specific, and only implemented for
a couple of ARM targets.

> Sounds like a hack to me.

:)  Yes but it works where it needs to.  It's done a lot in the cellular world.

> How do you know a user app that has a valid pte to your flash media
> accesses it? Userspace may do so at any time it wants, and as far as I
> understand Joerns and Davids explanations on flash it will just see
> invalid data rather than raising a page fault.

Maybe I wasn't so clear.  Assuming the MTD is going to do an erase you would:

(a) zap all page affected by block erase
(b) identify all pte's mapped to the affected region
(c) modify these pte's so they now trigger a fault
(d) wait for completion of erase
(c) reestablish valid pte mappings

If you get a fault it gets routed to the filesystem .fault or
something like that.  The .fault routine can:
(a) suspend the erase
(b) copy the page to RAM
(c) update the pte to point to RAM
(d) resume the erase
(a) suspend the erase
(b) reenable the pte
(c) wait a short time
(d) disable pte again
(e) resume the erase

More information about the linux-mtd mailing list