From 79a1e2072d512d943cbac4a96497ff07fc42e834 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Wed, 25 Jan 2017 10:28:48 -0800 Subject: nvmem: do not use malloc for cached buffer With introduction of encryption it is becoming impossible to read NVMEM contents directly from flash. Decrypting the contents each time there is a read request creates a significant performance hit. NVMEM needs to be rearchitecture such that there is no need to run decryption each time NVMEM read is performed. This patch does just that, implementation details are described in the header comment in common/nvmem.c. To reduce memory impact the size of NVMEM is being decreased from 16K to 12K. This is acceptable because eviction objects stored in NVMEM serialized now, which dramatically reduces NVMEM size requirements. The TPM2 NVMEM size definition must be kept in sync. Another optimization this change introduces is bypassing writing into the flash if NVMEM contents did not change, which is verified by examining the hash of the cached storage. A test is added to verify that the new commit scheme works as expected, and the nvmem test is re-introduced to the list of test ran on each 'make buildall'. CQ-DEPEND=CL:433839 BRANCH=none BUG=chrome-os-partner:62260,chrome-os-partner:62421 BUG=chrome-os-partner:62437 TEST=ran the following tests, all succeeded make buildall -j TEST_LIST_HOST=nvmem make runtests tcg test suite corp enroll on reef, reboot a few times, verify that enrollment sticks Change-Id: I177daa3ceb4fd7aac299ca26b4506b863e31b946 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/433184 Reviewed-by: Aaron Durbin --- test/build.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'test/build.mk') diff --git a/test/build.mk b/test/build.mk index ae1304cf59..bd124dacd1 100644 --- a/test/build.mk +++ b/test/build.mk @@ -58,6 +58,7 @@ test-list-host += lightbar test-list-host += math_util test-list-host += motion_lid test-list-host += mutex +test-list-host += nvmem test-list-host += nvmem_vars test-list-host += pingpong test-list-host += power_button -- cgit v1.2.1