From 15deb1198811f3df3e7adbe4c7701b1915700442 Mon Sep 17 00:00:00 2001 From: Anish Trivedi Date: Mon, 11 Apr 2011 14:49:02 -0500 Subject: ENGR00122019 SAHARA: Add padding around buffers to prevent cache incoherency Added padding of 64 bytes (cache line size for Cortex-A8) around buffers that are used by the hardware to prevent any cache coherency problems that could arise if buffers share a cache line with some other data that is used by the CPU. Signed-off-by: Anish Trivedi --- include/linux/mxc_sahara.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/linux/mxc_sahara.h b/include/linux/mxc_sahara.h index 8e341cce970..244d6920fd5 100644 --- a/include/linux/mxc_sahara.h +++ b/include/linux/mxc_sahara.h @@ -968,7 +968,10 @@ typedef struct fsl_shw_hco_t { /* fsl_shw_hash_context_object */ uint8_t digest_length; /* in bytes */ uint8_t context_length; /* in bytes */ uint8_t context_register_length; /* in bytes */ - uint32_t context[9]; /* largest digest + msg size */ + /* ensure following HW buffers not cached with surrounding fields */ + uint8_t cache_front_pad[64]; /* fill out cache line */ + uint32_t context[9]; /* largest digest + msg size */ + uint8_t cache_back_pad[64]; /* fill out cache line */ } fsl_shw_hco_t; /*! @@ -980,12 +983,12 @@ typedef struct fsl_shw_hmco_t { /* fsl_shw_hmac_context_object */ uint8_t digest_length; /*!< in bytes */ uint8_t context_length; /*!< in bytes */ uint8_t context_register_length; /*!< in bytes */ - uint32_t ongoing_context[9]; /*!< largest digest + msg - size */ - uint32_t inner_precompute[9]; /*!< largest digest + msg - size */ - uint32_t outer_precompute[9]; /*!< largest digest + msg - size */ + /* ensure following HW buffers not cached with surrounding fields */ + uint8_t cache_front_pad[64]; /* fill out cache line */ + uint32_t ongoing_context[9]; /**< largest digest + msg size */ + uint32_t inner_precompute[9]; /**< largest digest + msg size */ + uint32_t outer_precompute[9]; /**< largest digest + msg size */ + uint8_t cache_back_pad[64]; /* fill out cache line */ } fsl_shw_hmco_t; /* REQ-S2LRD-PINTFC-COA-SCCO-001 */ @@ -999,7 +1002,10 @@ typedef struct fsl_shw_scco_t { /* Could put modulus plus 16-octet context in union with arc4 sbox+ptrs... */ fsl_shw_ctr_mod_t modulus_exp; + /* ensure following HW buffers not cached with surrounding fields */ + uint8_t cache_front_pad[64]; /* fill out cache line */ uint8_t context[259]; + uint8_t cache_back_pad[64]; /* fill out cache line */ } fsl_shw_scco_t; /*! @@ -1023,6 +1029,8 @@ typedef struct fsl_shw_acco_t { fsl_shw_hco_t hash_ctx_info; /*!< For running the hash */ } auth_info; /*!< "auth" info struct */ uint8_t unencrypted_mac[16]; /*!< max block size... */ + /* ensure above HW buffer not cached with any following variables */ + uint8_t cache_back_pad[64]; /* fill out cache line */ } fsl_shw_acco_t; /*! -- cgit v1.2.3