From 70f2088b41cb540f29fef24acf149746b39822af Mon Sep 17 00:00:00 2001 From: nagendra modadugu Date: Tue, 9 May 2017 18:23:49 -0700 Subject: CR50: enable dcrypto random stalls Clean up a lingering TODO; enable random stalls (NOPs) at ~6% for crypto operations. BRANCH=none BUG=none TEST=TCG tests pass Change-Id: I46b2755d9f501eb4ec98c3184d1e14fbf118c718 Signed-off-by: nagendra modadugu Reviewed-on: https://chromium-review.googlesource.com/501349 Commit-Ready: Nagendra Modadugu Tested-by: Nagendra Modadugu Reviewed-by: Marius Schilder Reviewed-by: Vadim Bendebury Reviewed-by: Paul Scheidt --- chip/g/dcrypto/dcrypto_runtime.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chip/g/dcrypto/dcrypto_runtime.c b/chip/g/dcrypto/dcrypto_runtime.c index 9f4b849a82..12e0832aa7 100644 --- a/chip/g/dcrypto/dcrypto_runtime.c +++ b/chip/g/dcrypto/dcrypto_runtime.c @@ -30,9 +30,12 @@ void dcrypto_init(void) REG_WRITE_MLV(GR_PMU_RST0, GC_PMU_RST0_DCRYPTO0_MASK, GC_PMU_RST0_DCRYPTO0_LSB, 0); - /* Turn off random nops (for accurate measuring here). */ - /* TODO(ngm): enable for production. */ - GREG32(CRYPTO, RAND_STALL_CTL) = 0; + /* Turn off random nops (which are enabled by default). */ + GWRITE_FIELD(CRYPTO, RAND_STALL_CTL, STALL_EN, 0); + /* Configure random nop percentage at 6%. */ + GWRITE_FIELD(CRYPTO, RAND_STALL_CTL, FREQ, 3); + /* Now turn on random nops. */ + GWRITE_FIELD(CRYPTO, RAND_STALL_CTL, STALL_EN, 1); /* Initialize DMEM. */ ptr = GREG32_ADDR(CRYPTO, DMEM_DUMMY); -- cgit v1.2.1