From: =?UTF-8?q?Horia=20Geant=C4=83?= Subject: [RFC 6/7] crypto: caam - add Queue Interface (QI) backend support Date: Fri, 3 Mar 2017 16:52:12 +0200 Message-ID: <1488552733-20806-7-git-send-email-horia.geanta@nxp.com> References: <1488552733-20806-1-git-send-email-horia.geanta@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: linux-arm-kernel@lists.infradead.org, Claudiu Manoil , Cristian Stoica , Dan Douglass , linux-crypto@vger.kernel.org, Vakul Garg , Vakul Garg , Alexandru Porosanu To: Herbert Xu , Scott Wood , Roy Pledge Return-path: In-Reply-To: <1488552733-20806-1-git-send-email-horia.geanta@nxp.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org List-Id: linux-crypto.vger.kernel.org Q0FBTSBlbmdpbmUgc3VwcG9ydHMgdHdvIGludGVyZmFjZXMgZm9yIGNyeXB0byBqb2Igc3VibWlz c2lvbjoKLWpvYiByaW5nIGludGVyZmFjZSAtIGFscmVhZHkgZXhpc3RpbmcgY2FhbS9qciBkcml2 ZXIKLVF1ZXVlIEludGVyZmFjZSAoUUkpIC0gY2FhbS9xaSBkcml2ZXIgYWRkZWQgaW4gY3VycmVu dCBwYXRjaAoKUUkgaXMgcHJlc2VudCBpbiBDQUFNIGVuZ2luZXMgZm91bmQgb24gRFBBQSBwbGF0 Zm9ybXMuClFJIGdldHMgaXRzIEkvTyAoZnJhbWUgZGVzY3JpcHRvcnMpIGZyb20gUU1hbiAoUXVl dWUgTWFuYWdlcikgcXVldWVzLgoKVGhpcyBwYXRjaCBhZGRzIGEgcGxhdGZvcm0gZGV2aWNlIGZv ciBhY2Nlc3NpbmcgQ0FBTSdzIHF1ZXVlIGludGVyZmFjZS4KVGhlIHJlcXVlc3RzIGFyZSBzdWJt aXR0ZWQgdG8gQ0FBTSB1c2luZy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