2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 07:04:00 +08:00

pstore update for v5.13-rc1

- Add mem_type property to expand support for >2 memory types (Mukesh Ojha)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmCHBv0ACgkQiXL039xt
 wCYkdQ//f8yGzy0fDYXtoA6Nw+wBC9NE2b1iaZ7WIvTAamcSuay4QGQHXOZZO8tc
 vCJG1parx7aRwPg5zpeYODUTBC6aVxLdRd2Zk46Pahy8XOel+Rr60oqr3LKdPaEW
 xzh+rkRd4uXSI/MjvNuNviiLFSkp7qqb+M3R2Gkto8C3cSVi3OURSPdyvdrAiWan
 29xwwNvxva2cgWvP8GZL9V63piWzqpJWW8Y8Mxc3TMQDqwNczH8xqxfPEoP+jhIV
 WyD+gDlRFxjjohs2pQFxrdrXzIydT9wPH9Qe0h9QmFIXpOLBHMRo56rFy6kbZ1fj
 kAGtbd6//MfVBSBWneNrhocEFEZDK8V/WHvCY1OV9iGgB38wvI290hJqwt92NEyL
 vMg8Bcn4TmlW3LekjQZWzqn0BqHLPVSmOW7mImaO0HA33EpcnwqWqJuWxuyVelAG
 TZ0s0DU30eaquYX26Qi39+EkM7N/YsFc1VD5ejaghNkZrxPpdibTk3BtgKtQN0gT
 9m3E8r+LiVX5RI4H18aW8AjzCE7p/BKfHRqCKyq77era8BhUGEXXmjGIwYDRlRQA
 eS90PJUKBnloLVS88urMkVsaF5MjM8hKOgbc8crxiISoC+fd3pQT1dIwRFGbMsiG
 iJP7bLfkKU/HEaQhWQwXqiaXb/qDWqRL6nrjsrUfW1rnlJ6INfc=
 =j6qi
 -----END PGP SIGNATURE-----

Merge tag 'pstore-v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull pstore update from Kees Cook:

 - Add mem_type property to expand support for >2 memory types (Mukesh Ojha)

* tag 'pstore-v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  pstore: Add mem_type property DT parsing support
This commit is contained in:
Linus Torvalds 2021-04-27 10:08:10 -07:00
commit 288321a9c6
4 changed files with 33 additions and 6 deletions

View File

@ -3,7 +3,7 @@ Ramoops oops/panic logger
Sergiu Iordache <sergiu@chromium.org>
Updated: 17 November 2011
Updated: 10 Feb 2021
Introduction
------------
@ -30,6 +30,8 @@ mapping to pgprot_writecombine. Setting ``mem_type=1`` attempts to use
depends on atomic operations. At least on ARM, pgprot_noncached causes the
memory to be mapped strongly ordered, and atomic operations on strongly ordered
memory are implementation defined, and won't work on many ARMs such as omaps.
Setting ``mem_type=2`` attempts to treat the memory region as normal memory,
which enables full cache on it. This can improve the performance.
The memory area is divided into ``record_size`` chunks (also rounded down to
power of two) and each kmesg dump writes a ``record_size`` chunk of

View File

@ -42,8 +42,14 @@ Optional properties:
- pmsg-size: size in bytes of log buffer reserved for userspace messages
(defaults to 0: disabled)
- unbuffered: if present, use unbuffered mappings to map the reserved region
(defaults to buffered mappings)
- mem-type: if present, sets the type of mapping is to be used to map the
reserved region. mem-type: 0 = write-combined (default), 1 = unbuffered,
2 = cached.
- unbuffered: deprecated, use mem_type instead. If present, and mem_type is
not specified, it is equivalent to mem_type = 1 and uses unbuffered mappings
to map the reserved region (defaults to buffered mappings mem_type = 0). If
both are specified -- "mem_type" overrides "unbuffered".
- max-reason: if present, sets maximum type of kmsg dump reasons to store
(defaults to 2: log Oopses and Panics). This can be set to INT_MAX to

View File

@ -56,7 +56,7 @@ MODULE_PARM_DESC(mem_size,
static unsigned int mem_type;
module_param(mem_type, uint, 0400);
MODULE_PARM_DESC(mem_type,
"set to 1 to try to use unbuffered memory (default 0)");
"memory type: 0=write-combined (default), 1=unbuffered, 2=cached");
static int ramoops_max_reason = -1;
module_param_named(max_reason, ramoops_max_reason, int, 0400);
@ -648,6 +648,10 @@ static int ramoops_parse_dt(struct platform_device *pdev,
pdata->mem_size = resource_size(res);
pdata->mem_address = res->start;
/*
* Setting "unbuffered" is deprecated and will be ignored if
* "mem_type" is also specified.
*/
pdata->mem_type = of_property_read_bool(of_node, "unbuffered");
/*
* Setting "no-dump-oops" is deprecated and will be ignored if
@ -666,6 +670,7 @@ static int ramoops_parse_dt(struct platform_device *pdev,
field = value; \
}
parse_u32("mem-type", pdata->record_size, pdata->mem_type);
parse_u32("record-size", pdata->record_size, 0);
parse_u32("console-size", pdata->console_size, 0);
parse_u32("ftrace-size", pdata->ftrace_size, 0);

View File

@ -396,6 +396,10 @@ void persistent_ram_zap(struct persistent_ram_zone *prz)
persistent_ram_update_header_ecc(prz);
}
#define MEM_TYPE_WCOMBINE 0
#define MEM_TYPE_NONCACHED 1
#define MEM_TYPE_NORMAL 2
static void *persistent_ram_vmap(phys_addr_t start, size_t size,
unsigned int memtype)
{
@ -409,10 +413,20 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size,
page_start = start - offset_in_page(start);
page_count = DIV_ROUND_UP(size + offset_in_page(start), PAGE_SIZE);
if (memtype)
switch (memtype) {
case MEM_TYPE_NORMAL:
prot = PAGE_KERNEL;
break;
case MEM_TYPE_NONCACHED:
prot = pgprot_noncached(PAGE_KERNEL);
else
break;
case MEM_TYPE_WCOMBINE:
prot = pgprot_writecombine(PAGE_KERNEL);
break;
default:
pr_err("invalid mem_type=%d\n", memtype);
return NULL;
}
pages = kmalloc_array(page_count, sizeof(struct page *), GFP_KERNEL);
if (!pages) {