Commit 0dc06826 authored by WeiXiong Liao's avatar WeiXiong Liao Committed by Kees Cook

pstore/zone,blk: Add support for pmsg frontend

Add pmsg support to pstore/blk (through pstore/zone). To enable, pmsg_size
must be greater than 0 and a multiple of 4096.
Signed-off-by: default avatarWeiXiong Liao <liaoweixiong@allwinnertech.com>
Link: https://lore.kernel.org/lkml/20200511233229.27745-4-keescook@chromium.org/Co-developed-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/lkml/20200512171932.222102-1-colin.king@canonical.comCo-developed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 17639f67
......@@ -224,3 +224,15 @@ config PSTORE_BLK_MAX_REASON
NOTE that, both Kconfig and module parameters can configure
pstore/blk, but module parameters have priority over Kconfig.
config PSTORE_BLK_PMSG_SIZE
int "Size in Kbytes of pmsg to store"
depends on PSTORE_BLK
depends on PSTORE_PMSG
default 64
help
This just sets size of pmsg (pmsg_size) for pstore/blk. The size is
in KB and must be a multiple of 4.
NOTE that, both Kconfig and module parameters can configure
pstore/blk, but module parameters have priority over Kconfig.
......@@ -27,6 +27,14 @@ module_param(max_reason, int, 0400);
MODULE_PARM_DESC(max_reason,
"maximum reason for kmsg dump (default 2: Oops and Panic)");
#if IS_ENABLED(CONFIG_PSTORE_PMSG)
static long pmsg_size = CONFIG_PSTORE_BLK_PMSG_SIZE;
#else
static long pmsg_size = -1;
#endif
module_param(pmsg_size, long, 0400);
MODULE_PARM_DESC(pmsg_size, "pmsg size in kbytes");
/*
* blkdev - the block device to use for pstore storage
*
......@@ -133,6 +141,7 @@ static int psblk_register_do(struct pstore_device_info *dev)
}
verify_size(kmsg_size, 4096, dev->flags & PSTORE_FLAGS_DMESG);
verify_size(pmsg_size, 4096, dev->flags & PSTORE_FLAGS_PMSG);
#undef verify_size
pstore_zone_info->total_size = dev->total_size;
......
This diff is collapsed.
......@@ -17,6 +17,7 @@ typedef ssize_t (*pstore_zone_write_op)(const char *, size_t, loff_t);
* @kmsg_size: The size of oops/panic zone. Zero means disabled, otherwise,
* it must be multiple of SECTOR_SIZE(512 Bytes).
* @max_reason: Maximum kmsg dump reason to store.
* @pmsg_size: The size of pmsg zone which is the same as @kmsg_size.
* @read: The general read operation. Both of the function parameters
* @size and @offset are relative value to storage.
* On success, the number of bytes should be returned, others
......@@ -33,6 +34,7 @@ struct pstore_zone_info {
unsigned long total_size;
unsigned long kmsg_size;
int max_reason;
unsigned long pmsg_size;
pstore_zone_read_op read;
pstore_zone_write_op write;
pstore_zone_write_op panic_write;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment