Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46824 )
Change subject: drivers/mrc_cache: Fix size comparison in mrc_cache update ......................................................................
drivers/mrc_cache: Fix size comparison in mrc_cache update
`mrc_cache_needs_update` is comparing the "new size" of the MRC data (minus metadata size) to the size including the metadata, which causes the driver to think the data has changed, and so it will rewrite the MRC cache on every boot. This patch removes the metadata size from the comparison.
BUG=b:171513942 BRANCH=volteer TEST=1) Memory training data gets written the on a boot where the data was wiped out. 2) Memory training data does not get written back on every subsequent boot.
Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org Change-Id: I7280276f71fdaa492c327b2b7ade8e53e7c59f51 --- M src/drivers/mrc_cache/mrc_cache.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/46824/1
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c index 3b98dba..eb43123 100644 --- a/src/drivers/mrc_cache/mrc_cache.c +++ b/src/drivers/mrc_cache/mrc_cache.c @@ -337,10 +337,10 @@ const void *new_data, size_t new_data_size) { void *mapping, *data_mapping; - size_t size = region_device_sz(rdev); + size_t old_data_size = region_device_sz(rdev) - sizeof(struct mrc_metadata); bool need_update = false;
- if (new_data_size != size) + if (new_data_size != old_data_size) return true;
mapping = rdev_mmap_full(rdev);
Shelley Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46824 )
Change subject: drivers/mrc_cache: Fix size comparison in mrc_cache update ......................................................................
Patch Set 1: Code-Review+2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46824 )
Change subject: drivers/mrc_cache: Fix size comparison in mrc_cache update ......................................................................
Patch Set 1: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46824 )
Change subject: drivers/mrc_cache: Fix size comparison in mrc_cache update ......................................................................
drivers/mrc_cache: Fix size comparison in mrc_cache update
`mrc_cache_needs_update` is comparing the "new size" of the MRC data (minus metadata size) to the size including the metadata, which causes the driver to think the data has changed, and so it will rewrite the MRC cache on every boot. This patch removes the metadata size from the comparison.
BUG=b:171513942 BRANCH=volteer TEST=1) Memory training data gets written the on a boot where the data was wiped out. 2) Memory training data does not get written back on every subsequent boot.
Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org Change-Id: I7280276f71fdaa492c327b2b7ade8e53e7c59f51 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46824 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Shelley Chen shchen@google.com Reviewed-by: Furquan Shaikh furquan@google.com --- M src/drivers/mrc_cache/mrc_cache.c 1 file changed, 2 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved Shelley Chen: Looks good to me, approved
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c index 3b98dba..eb43123 100644 --- a/src/drivers/mrc_cache/mrc_cache.c +++ b/src/drivers/mrc_cache/mrc_cache.c @@ -337,10 +337,10 @@ const void *new_data, size_t new_data_size) { void *mapping, *data_mapping; - size_t size = region_device_sz(rdev); + size_t old_data_size = region_device_sz(rdev) - sizeof(struct mrc_metadata); bool need_update = false;
- if (new_data_size != size) + if (new_data_size != old_data_size) return true;
mapping = rdev_mmap_full(rdev);