1# Copyright (c) 2018 Laczen
2# Copyright (c) 2024 BayLibre SAS
3
4# SPDX-License-Identifier: Apache-2.0
5
6# Zephyr Memory Storage ZMS
7
8config ZMS
9	bool "Zephyr Memory Storage"
10	depends on FLASH_MAP
11	select CRC
12	help
13	  Enable Zephyr Memory Storage, which is a key-value storage system designed to work with
14	  all types of non-volatile storage technologies.
15	  It supports classical on-chip NOR flash as well as new technologies like RRAM and MRAM.
16
17if ZMS
18
19config ZMS_LOOKUP_CACHE
20	bool "ZMS lookup cache"
21	help
22	  Enable ZMS cache to reduce the ZMS data lookup time.
23	  Each cache entry holds an address of the most recent allocation
24	  table entry (ATE) for all ZMS IDs that fall into that cache position.
25
26config ZMS_LOOKUP_CACHE_SIZE
27	int "ZMS lookup cache size"
28	default 128
29	range 1 65536
30	depends on ZMS_LOOKUP_CACHE
31	help
32	  Number of entries in the ZMS lookup cache.
33	  Every additional entry in cache will use 8 bytes of RAM.
34
35config ZMS_DATA_CRC
36	bool "ZMS data CRC"
37
38config ZMS_CUSTOMIZE_BLOCK_SIZE
39	bool "Customize the size of the buffer used internally for reads and writes"
40	help
41	  ZMS uses an internal buffer to read/write and compare stored data.
42	  Increasing the size of this buffer should be done carefully in order to not
43	  overflow the stack.
44	  Increasing it makes ZMS able to work with storage devices
45	  that have a larger `write-block-size` (which decreases the performance of ZMS).
46
47config ZMS_CUSTOM_BLOCK_SIZE
48	int "ZMS internal buffer size"
49	default 32
50	depends on ZMS_CUSTOMIZE_BLOCK_SIZE
51	help
52	  Changes the internal buffer size of ZMS
53
54config ZMS_LOOKUP_CACHE_FOR_SETTINGS
55	bool "ZMS Storage lookup cache optimized for settings"
56	depends on ZMS_LOOKUP_CACHE && SETTINGS_ZMS
57	help
58	  Enable usage of lookup cache based on hashes to get, the best ZMS performance,
59	  provided that the ZMS is used only for the purpose of providing the settings
60	  backend. This option should NOT be enabled if the ZMS is also written to
61	  directly, outside the settings layer.
62
63config ZMS_NO_DOUBLE_WRITE
64	bool "Avoid writing the same data again in the storage"
65	help
66	  For some memory technologies, write cycles for memory cells are limited and any
67	  unncessary writes should be avoided.
68	  Enable this config to avoid rewriting data in the storage if it already exists.
69	  This option will reduce write performance as it will need to do a research of the
70	  data in the whole storage before any write.
71
72module = ZMS
73module-str = zms
74source "subsys/logging/Kconfig.template.log_config"
75
76endif # ZMS
77