Shelley Chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46515 )
Change subject: mrc_cache: Remove unnecessary data checksum calculation ......................................................................
mrc_cache: Remove unnecessary data checksum calculation
When MRC_SAVE_HASH_IN_TPM is selected, we can just use the TPM hash to verify the MRC_CACHE data. Thus, we don't need to calculate the checksum anymore in this case.
BUG=b:150502246 BRANCH=None TEST=make sure memory training still works on nami
Change-Id: I1db4469da49755805b541f50c7ef2f9cdb749425 Signed-off-by: Shelley Chen shchen@google.com --- M src/drivers/mrc_cache/mrc_cache.c 1 file changed, 10 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/46515/1
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c index 8124b24..068ce9e 100644 --- a/src/drivers/mrc_cache/mrc_cache.c +++ b/src/drivers/mrc_cache/mrc_cache.c @@ -194,18 +194,19 @@ if (md->data_size != data_size) return -1;
- checksum = compute_ip_checksum(data, data_size); + if (hash_idx && CONFIG(MRC_SAVE_HASH_IN_TPM)) { + if (!mrc_cache_verify_hash(hash_idx, data, data_size)) + return -1; + } else { + checksum = compute_ip_checksum(data, data_size);
- if (md->data_checksum != checksum) { - printk(BIOS_ERR, "MRC: data checksum mismatch: %x vs %x\n", - md->data_checksum, checksum); - return -1; + if (md->data_checksum != checksum) { + printk(BIOS_ERR, "MRC: data checksum mismatch: %x vs %x\n", + md->data_checksum, checksum); + return -1; + } }
- if (hash_idx && CONFIG(MRC_SAVE_HASH_IN_TPM) && - !mrc_cache_verify_hash(hash_idx, data, data_size)) - return -1; - return 0; }
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46515 )
Change subject: mrc_cache: Remove unnecessary data checksum calculation ......................................................................
Patch Set 1: Code-Review+2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46515 )
Change subject: mrc_cache: Remove unnecessary data checksum calculation ......................................................................
Patch Set 1: Code-Review+2
Hello build bot (Jenkins), Furquan Shaikh, Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46515
to look at the new patch set (#2).
Change subject: mrc_cache: Remove unnecessary data checksum calculation ......................................................................
mrc_cache: Remove unnecessary data checksum calculation
When MRC_SAVE_HASH_IN_TPM is selected, we can just use the TPM hash to verify the MRC_CACHE data. Thus, we don't need to calculate the checksum anymore in this case.
BUG=b:150502246 BRANCH=None TEST=make sure memory training still works on nami
Change-Id: I1db4469da49755805b541f50c7ef2f9cdb749425 Signed-off-by: Shelley Chen shchen@google.com --- M src/drivers/mrc_cache/mrc_cache.c 1 file changed, 12 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/46515/2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46515 )
Change subject: mrc_cache: Remove unnecessary data checksum calculation ......................................................................
Patch Set 2: Code-Review+2
Julius Werner has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46515 )
Change subject: mrc_cache: Remove unnecessary data checksum calculation ......................................................................
mrc_cache: Remove unnecessary data checksum calculation
When MRC_SAVE_HASH_IN_TPM is selected, we can just use the TPM hash to verify the MRC_CACHE data. Thus, we don't need to calculate the checksum anymore in this case.
BUG=b:150502246 BRANCH=None TEST=make sure memory training still works on nami
Change-Id: I1db4469da49755805b541f50c7ef2f9cdb749425 Signed-off-by: Shelley Chen shchen@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/46515 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Furquan Shaikh furquan@google.com --- M src/drivers/mrc_cache/mrc_cache.c 1 file changed, 12 insertions(+), 11 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c index 1bbb426..3b98dba 100644 --- a/src/drivers/mrc_cache/mrc_cache.c +++ b/src/drivers/mrc_cache/mrc_cache.c @@ -193,18 +193,19 @@ if (md->data_size != data_size) return -1;
- checksum = compute_ip_checksum(data, data_size); - - if (md->data_checksum != checksum) { - printk(BIOS_ERR, "MRC: data checksum mismatch: %x vs %x\n", - md->data_checksum, checksum); - return -1; - } - hash_idx = cr->tpm_hash_index; - if (hash_idx && CONFIG(MRC_SAVE_HASH_IN_TPM) && - !mrc_cache_verify_hash(hash_idx, data, data_size)) - return -1; + if (hash_idx && CONFIG(MRC_SAVE_HASH_IN_TPM)) { + if (!mrc_cache_verify_hash(hash_idx, data, data_size)) + return -1; + } else { + checksum = compute_ip_checksum(data, data_size); + + if (md->data_checksum != checksum) { + printk(BIOS_ERR, "MRC: data checksum mismatch: %x vs %x\n", + md->data_checksum, checksum); + return -1; + } + }
return 0; }