Add configuration ettings for the on-demand paging option

This commit is contained in:
Gregory Nutt 2014-03-05 14:25:49 -06:00
parent 6f3f870d31
commit 972eeae12d
8 changed files with 243 additions and 70 deletions

View File

@ -145,6 +145,134 @@ config ARCH_NAND_HWECC
bool
default n
menuconfig PAGING
bool "On-demand paging"
default n
depends on ARCH_HAVE_MMU && !ARCH_ROMPGTABLE
---help---
If set =y in your configation file, this setting will enable the on-demand
paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html.
if PAGING
config PAGING_PAGESIZE
int "Page size (bytes)"
default 4096
---help---
The size of one managed page. This must be a value supported by the
processor's memory management unit
config PAGING_NLOCKED
int "Number of locked pages"
default 48
---help---
This is the number of locked pages in the memory map.
config PAGING_CUSTOM_BASE
bool "Custom paging base address"
default n
---help---
By default, the page begins at RAM_START/VSTART. That base address
can be changed if this value is selected.
if PAGING_CUSTOM_BASE
config PAGING_LOCKED_PBASE
hex "Physical base address"
config PAGING_LOCKED_VBASE
hex "Virtual base address"
endif # PAGING_CUSTOM_BASE
config PAGING_NPPAGED
int "Number of physical pages"
default 256
---help---
This is the number of physical pages available to support the paged
text region.
config PAGING_NVPAGED
int "Number of virtual pages"
default 1024
---help---
This actual size of the virtual paged text region (in pages). This
is also the number of virtual pages required to span the entire
paged region. The on-demand paging feature is intended to support
only the case where the virtual paged text area is much larger the
available physical pages. Otherwise, why would you enable on-demand paging?
config PAGING_NDATA
int "Number of data pages"
default 256
---help---
This is the number of data pages in the memory map. The data region
will extend to the end of RAM unless overridden by a setting in the
configuration file.
NOTE: In some architectures, it may be necessary to take some memory
from the end of RAM for page tables or other system usage. The
configuration settings and linker directives must be cognizant of
that: PAGING_NDATA should be defined to prevent the data region from
extending all the way to the end of memory.
config PAGING_DEFPRIO
int "Page fill worker thread priority"
default 100
---help---
The default, minimum priority of the page fill worker thread. The
priority of the page fill work thread will be boosted boosted
dynamically so that it matches the priority of the task on behalf
of which it performs the fill. This defines the minimum priority
that will be used. Default: 100.
config PAGING_STACKSIZE
int "Page fill worker thread stack size"
default 1024
---help---
Defines the size of the allocated stack for the page fill worker
thread. Default: 1024.
config PAGING_BLOCKINGFILL
bool "Blocking fill"
default n
---help---
The architecture specific up_fillpage() function may be blocking
or non-blocking. If defined, this setting indicates that the
up_fillpage() implementation will block until the transfer is
completed. Default: Undefined (non-blocking).
config PAGING_WORKPERIOD
int "Work period (usec)"
default 500000
---help---
The page fill worker thread will wake periodically even if there
is no mapping to do. This selection controls that wake-up period
(in microseconds). This wake-up a failsafe that will handle any
cases where a single is lost (that would really be a bug and
shouldn't happen!) and also supports timeouts for case of non-
blocking, asynchronous fills (see CONFIG_PAGING_TIMEOUT_TICKS).
config PAGING_TIMEOUT
bool "Paging timeout"
default n
---help---
If defined, the implementation will monitor the (asynchronous) page
fill logic. If the fill takes longer than than a timeout value,
then a fatal error will be declared. Default: No timeouts monitored
config PAGING_TIMEOUT_TICKS
int "Paging timeout ticks"
default 10
depends on PAGING_TIMEOUT
---help---
If PAGING_TIMEOUT is defined, then implementation will monitor the
(asynchronous) page fill logic. If the fill takes longer than this
number if microseconds, then a fatal error will be declared.
Default: No timeouts monitored
endif # PAGING
config ARCH_IRQPRIO
bool "Prioritized interrupt support"
default n

View File

@ -306,14 +306,6 @@ config ARCH_ROMPGTABLE
---help---
Support a fixed memory mapping use a (read-only) page table in ROM/FLASH.
config PAGING
bool "On-demand paging"
default n
depends on ARCH_HAVE_MMU && !ARCH_ROMPGTABLE
---help---
If set =y in your configation file, this setting will enable the on-demand
paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html.
config DEBUG_HARDFAULT
bool "Verbose Hard-Fault Debug"
default n

View File

@ -4,4 +4,30 @@
#
if ARCH_BOARD_EA3131
endif
if PAGING
config EA3131_PAGING_MINOR
int "Page device minor number"
default 0
config EA3131_PAGING_MOUNTPT
string "Page device mount point"
default "/mnt/pgsrc"
config EA3131_PAGING_BINOFFSET
int "Volume offset"
default 0
config EA3131_PAGING_SDSLOT
int "SD page device slot number"
default 0
depends on MMCSD
config EA3131_PAGING_SPIPORT
int "SD SPI port number"
default 0
depends on SPI
endif # PAGING
endif # ARCH_BOARD_EA3131

View File

@ -53,7 +53,7 @@
# include <stdbool.h>
# include <unistd.h>
# include <fcntl.h>
# ifdef CONFIG_PAGING_SDSLOT
# ifdef CONFIG_EA3131_PAGING_SDSLOT
# include <stdio.h>
# include <sys/mount.h>
# include <nuttx/sdio.h>
@ -80,14 +80,14 @@
#ifdef CONFIG_ARCH_BOARD_EA3131
# define HAVE_SD 1
# define HAVE_SPINOR 1
# if defined(CONFIG_PAGING_SDSLOT) && CONFIG_PAGING_SDSLOT != 0
# if defined(CONFIG_EA3131_PAGING_SDSLOT) && CONFIG_EA3131_PAGING_SDSLOT != 0
# error "Only one SD slot"
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3131_PAGING_SDSLOT
# endif
#else
/* Add configuration for new LPC31XX boards here */
# error "Unrecognized LPC31XX board"
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3131_PAGING_SDSLOT
# undef HAVE_SD
# undef HAVE_SPINOR
#endif
@ -113,9 +113,9 @@
/* Can't support SD if the board does not support SD (duh) */
# if defined(CONFIG_PAGING_SDSLOT) && !defined(HAVE_SD)
# if defined(CONFIG_EA3131_PAGING_SDSLOT) && !defined(HAVE_SD)
# error "This board does not support SD"
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3131_PAGING_SDSLOT
# endif
/* Can't support SD if mountpoints are disabled or if SDIO support
@ -123,25 +123,25 @@
*/
# if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI)
# ifdef CONFIG_PAGING_SDSLOT
# ifdef CONFIG_EA3131_PAGING_SDSLOT
# error "Mountpoints and/or MCI disabled"
# endif
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3131_PAGING_SDSLOT
# undef HAVE_SD
# endif
/* A mountpoint for the FAT file system must be provided */
# if !defined(CONFIG_PAGING_MOUNTPT) && defined(CONFIG_PAGING_SDSLOT)
# error "No CONFIG_PAGING_MOUNTPT provided"
# undef CONFIG_PAGING_SDSLOT
# if !defined(CONFIG_EA3131_PAGING_MOUNTPT) && defined(CONFIG_EA3131_PAGING_SDSLOT)
# error "No CONFIG_EA3131_PAGING_MOUNTPT provided"
# undef CONFIG_EA3131_PAGING_SDSLOT
# undef HAVE_SD
# endif
/* If no minor number is provided, default to zero */
# ifndef CONFIG_PAGING_MINOR
# define CONFIG_PAGING_MINOR 0
# ifndef CONFIG_EA3131_PAGING_MINOR
# define CONFIG_EA3131_PAGING_MINOR 0
# endif
#endif /* CONFIG_PAGING_BINPATH */
@ -160,14 +160,14 @@
* of the NuttX binary image.
*/
# ifndef CONFIG_PAGING_BINOFFSET
# define CONFIG_PAGING_BINOFFSET 0
# ifndef CONFIG_EA3131_PAGING_BINOFFSET
# define CONFIG_EA3131_PAGING_BINOFFSET 0
# endif
/* Make sure that some value is defined for the SPI port number */
# ifndef CONFIG_PAGING_SPIPORT
# define CONFIG_PAGING_SPIPORT 0
# ifndef CONFIG_EA3131_PAGING_SPIPORT
# define CONFIG_EA3131_PAGING_SPIPORT 0
# endif
#endif
@ -232,7 +232,7 @@ static struct pg_source_s g_pgsrc;
#if defined(CONFIG_PAGING_BINPATH)
static inline void lpc31_initsrc(void)
{
#ifdef CONFIG_PAGING_SDSLOT
#ifdef CONFIG_EA3131_PAGING_SDSLOT
FAR struct sdio_dev_s *sdio;
int ret;
#endif
@ -241,7 +241,7 @@ static inline void lpc31_initsrc(void)
if (!g_pgsrc.initialized)
{
#ifdef CONFIG_PAGING_SDSLOT
#ifdef CONFIG_EA3131_PAGING_SDSLOT
char devname[16];
#endif
@ -249,16 +249,16 @@ static inline void lpc31_initsrc(void)
/* No, do we need to mount an SD device? */
#ifdef CONFIG_PAGING_SDSLOT
#ifdef CONFIG_EA3131_PAGING_SDSLOT
/* Yes.. First, get an instance of the SDIO interface */
sdio = sdio_initialize(CONFIG_PAGING_SDSLOT);
sdio = sdio_initialize(CONFIG_EA3131_PAGING_SDSLOT);
DEBUGASSERT(sdio != NULL);
/* Then bind the SDIO interface to the SD driver */
ret = mmcsd_slotinitialize(CONFIG_PAGING_MINOR, sdio);
ret = mmcsd_slotinitialize(CONFIG_EA3131_PAGING_MINOR, sdio);
DEBUGASSERT(ret == OK);
/* Then let's guess and say that there is a card in the slot.
@ -269,11 +269,11 @@ static inline void lpc31_initsrc(void)
/* Now mount the file system */
snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_PAGING_MINOR);
ret = mount(devname, CONFIG_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL);
snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3131_PAGING_MINOR);
ret = mount(devname, CONFIG_EA3131_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL);
DEBUGASSERT(ret == OK);
#endif /* CONFIG_PAGING_SDSLOT */
#endif /* CONFIG_EA3131_PAGING_SDSLOT */
/* Open the selected path for read-only access */
@ -305,7 +305,7 @@ static inline void lpc31_initsrc(void)
/* First get an instance of the SPI device interface */
spi = up_spiinitialize(CONFIG_PAGING_SPIPORT);
spi = up_spiinitialize(CONFIG_EA3131_PAGING_SPIPORT);
DEBUGASSERT(spi != NULL);
/* Then bind the SPI interface to the MTD driver */
@ -329,7 +329,7 @@ static inline void lpc31_initsrc(void)
DEBUGASSERT(ret >= 0);
capacity = g_pgsrc.geo.erasesize*g_pgsrc.geo.neraseblocks;
pgllvdbg("capacity: %d\n", capacity);
DEBUGASSERT(capacity >= (CONFIG_PAGING_BINOFFSET + PG_TEXT_VSIZE));
DEBUGASSERT(capacity >= (CONFIG_EA3131_PAGING_BINOFFSET + PG_TEXT_VSIZE));
#endif
/* We are now initialized */
@ -454,7 +454,7 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage)
* virtual address. File offset 0 corresponds to PG_LOCKED_VBASE.
*/
offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_PAGING_BINOFFSET;
offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_EA3131_PAGING_BINOFFSET;
/* Read the page at the correct offset into the SPI FLASH device */

View File

@ -4,4 +4,30 @@
#
if ARCH_BOARD_EA3152
endif
if PAGING
config EA3152_PAGING_MINOR
int "Page device minor number"
default 0
config EA3152_PAGING_MOUNTPT
string "Page device mount point"
default "/mnt/pgsrc"
config EA3152_PAGING_BINOFFSET
int "Volume offset"
default 0
config EA3152_PAGING_SDSLOT
int "SD page device slot number"
default 0
depends on MMCSD
config EA3152_PAGING_SPIPORT
int "SD SPI port number"
default 0
depends on SPI
endif # PAGING
endif # ARCH_BOARD_EA3152

View File

@ -53,7 +53,7 @@
# include <stdbool.h>
# include <unistd.h>
# include <fcntl.h>
# ifdef CONFIG_PAGING_SDSLOT
# ifdef CONFIG_EA3152_PAGING_SDSLOT
# include <stdio.h>
# include <sys/mount.h>
# include <nuttx/sdio.h>
@ -80,14 +80,14 @@
#ifdef CONFIG_ARCH_BOARD_EA3152
# define HAVE_SD 1
# define HAVE_SPINOR 1
# if defined(CONFIG_PAGING_SDSLOT) && CONFIG_PAGING_SDSLOT != 0
# if defined(CONFIG_EA3152_PAGING_SDSLOT) && CONFIG_EA3152_PAGING_SDSLOT != 0
# error "Only one SD slot"
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3152_PAGING_SDSLOT
# endif
#else
/* Add configuration for new LPC31XX boards here */
# error "Unrecognized LPC31XX board"
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3152_PAGING_SDSLOT
# undef HAVE_SD
# undef HAVE_SPINOR
#endif
@ -113,9 +113,9 @@
/* Can't support SD if the board does not support SD (duh) */
# if defined(CONFIG_PAGING_SDSLOT) && !defined(HAVE_SD)
# if defined(CONFIG_EA3152_PAGING_SDSLOT) && !defined(HAVE_SD)
# error "This board does not support SD"
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3152_PAGING_SDSLOT
# endif
/* Can't support SD if mountpoints are disabled or if SDIO support
@ -123,25 +123,25 @@
*/
# if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI)
# ifdef CONFIG_PAGING_SDSLOT
# ifdef CONFIG_EA3152_PAGING_SDSLOT
# error "Mountpoints and/or MCI disabled"
# endif
# undef CONFIG_PAGING_SDSLOT
# undef CONFIG_EA3152_PAGING_SDSLOT
# undef HAVE_SD
# endif
/* A mountpoint for the FAT file system must be provided */
# if !defined(CONFIG_PAGING_MOUNTPT) && defined(CONFIG_PAGING_SDSLOT)
# error "No CONFIG_PAGING_MOUNTPT provided"
# undef CONFIG_PAGING_SDSLOT
# if !defined(CONFIG_EA3152_PAGING_MOUNTPT) && defined(CONFIG_EA3152_PAGING_SDSLOT)
# error "No CONFIG_EA3152_PAGING_MOUNTPT provided"
# undef CONFIG_EA3152_PAGING_SDSLOT
# undef HAVE_SD
# endif
/* If no minor number is provided, default to zero */
# ifndef CONFIG_PAGING_MINOR
# define CONFIG_PAGING_MINOR 0
# ifndef CONFIG_EA3152_PAGING_MINOR
# define CONFIG_EA3152_PAGING_MINOR 0
# endif
#endif /* CONFIG_PAGING_BINPATH */
@ -160,14 +160,14 @@
* of the NuttX binary image.
*/
# ifndef CONFIG_PAGING_BINOFFSET
# define CONFIG_PAGING_BINOFFSET 0
# ifndef CONFIG_EA3152_PAGING_BINOFFSET
# define CONFIG_EA3152_PAGING_BINOFFSET 0
# endif
/* Make sure that some value is defined for the SPI port number */
# ifndef CONFIG_PAGING_SPIPORT
# define CONFIG_PAGING_SPIPORT 0
# ifndef CONFIG_EA3152_PAGING_SPIPORT
# define CONFIG_EA3152_PAGING_SPIPORT 0
# endif
#endif
@ -232,7 +232,7 @@ static struct pg_source_s g_pgsrc;
#if defined(CONFIG_PAGING_BINPATH)
static inline void lpc31_initsrc(void)
{
#ifdef CONFIG_PAGING_SDSLOT
#ifdef CONFIG_EA3152_PAGING_SDSLOT
FAR struct sdio_dev_s *sdio;
int ret;
#endif
@ -241,7 +241,7 @@ static inline void lpc31_initsrc(void)
if (!g_pgsrc.initialized)
{
#ifdef CONFIG_PAGING_SDSLOT
#ifdef CONFIG_EA3152_PAGING_SDSLOT
char devname[16];
#endif
@ -249,16 +249,16 @@ static inline void lpc31_initsrc(void)
/* No, do we need to mount an SD device? */
#ifdef CONFIG_PAGING_SDSLOT
#ifdef CONFIG_EA3152_PAGING_SDSLOT
/* Yes.. First, get an instance of the SDIO interface */
sdio = sdio_initialize(CONFIG_PAGING_SDSLOT);
sdio = sdio_initialize(CONFIG_EA3152_PAGING_SDSLOT);
DEBUGASSERT(sdio != NULL);
/* Then bind the SDIO interface to the SD driver */
ret = mmcsd_slotinitialize(CONFIG_PAGING_MINOR, sdio);
ret = mmcsd_slotinitialize(CONFIG_EA3152_PAGING_MINOR, sdio);
DEBUGASSERT(ret == OK);
/* Then let's guess and say that there is a card in the slot.
@ -269,11 +269,11 @@ static inline void lpc31_initsrc(void)
/* Now mount the file system */
snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_PAGING_MINOR);
ret = mount(devname, CONFIG_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL);
snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3152_PAGING_MINOR);
ret = mount(devname, CONFIG_EA3152_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL);
DEBUGASSERT(ret == OK);
#endif /* CONFIG_PAGING_SDSLOT */
#endif /* CONFIG_EA3152_PAGING_SDSLOT */
/* Open the selected path for read-only access */
@ -305,7 +305,7 @@ static inline void lpc31_initsrc(void)
/* First get an instance of the SPI device interface */
spi = up_spiinitialize(CONFIG_PAGING_SPIPORT);
spi = up_spiinitialize(CONFIG_EA3152_PAGING_SPIPORT);
DEBUGASSERT(spi != NULL);
/* Then bind the SPI interface to the MTD driver */
@ -329,7 +329,7 @@ static inline void lpc31_initsrc(void)
DEBUGASSERT(ret >= 0);
capacity = g_pgsrc.geo.erasesize*g_pgsrc.geo.neraseblocks;
pgllvdbg("capacity: %d\n", capacity);
DEBUGASSERT(capacity >= (CONFIG_PAGING_BINOFFSET + PG_TEXT_VSIZE));
DEBUGASSERT(capacity >= (CONFIG_EA3152_PAGING_BINOFFSET + PG_TEXT_VSIZE));
#endif
/* We are now initialized */
@ -454,7 +454,7 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage)
* virtual address. File offset 0 corresponds to PG_LOCKED_VBASE.
*/
offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_PAGING_BINOFFSET;
offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_EA3152_PAGING_BINOFFSET;
/* Read the page at the correct offset into the SPI FLASH device */

View File

@ -118,8 +118,8 @@
/* CONFIG_PAGING_NPPAGED - This is the number of physical pages available to
* support the paged text region.
* CONFIG_PAGING_NVPAGED - This actual size of the paged text region (in
* pages). This is also the number of virtual pages required to support
* CONFIG_PAGING_NVPAGED - This actual size of the virtual paged text region (in
* pages). This is also the number of virtual pages required to span
* the entire paged region. The on-demand paging feature is intended to
* support only the case where the virtual paged text area is much larger
* the available physical pages. Otherwise, why would you enable on-demand
@ -202,8 +202,8 @@
/* CONFIG_PAGING_DEFPRIO - The default, minimum priority of the page fill
* worker thread. The priority of the page fill work thread will be boosted
* boosted dynmically so that it matches the priority of the task on behalf
* of which it peforms the fill. This defines the minimum priority that
* boosted dynamically so that it matches the priority of the task on behalf
* of which it performs the fill. This defines the minimum priority that
* will be used. Default: 50.
* CONFIG_PAGING_STACKSIZE - Defines the size of the allocated stack
* for the page fill worker thread. Default: 1024.

View File

@ -67,6 +67,7 @@ static const char *dequote_list[] =
"CONFIG_EXECFUNCS_SYMTAB", /* Symbol table used by exec[l|v] */
"CONFIG_PASS1_BUILDIR", /* Pass1 build directory */
"CONFIG_PASS1_TARGET", /* Pass1 build target */
"CONFIG_PASS1_OBJECT", /* Pass1 build object */
"CONFIG_DEBUG_OPTLEVEL", /* Custom debug level */
/* NxWidgets/NxWM */