Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp37645imm; Thu, 30 Aug 2018 06:29:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY5UBWehs5L0ufHD7zOq1OlbGNu9AzYIYl1SvtwYqGYEqSHHH7LjyRFNRwtcT/ggEB5reoe X-Received: by 2002:a62:455b:: with SMTP id s88-v6mr10350957pfa.203.1535635766095; Thu, 30 Aug 2018 06:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535635766; cv=none; d=google.com; s=arc-20160816; b=0/ix2X3+Fa6CbjJLlT9DvC/4kPeUdfcGsw21BcasxZK10ayX/OyqJ1cVQ4VJbqIuxo u8XyJNtjurVaKUiMV4pNCsBY6L0S9ngafWUPb7Y5qlagLowMLbxY5mmauzJ5J9T5cBCw OL5Ud+l5XvSynYvykmlvBCaFOFnrcB5Z0QSrWjV4gbE/En/IzQ2l0kJTmHhZPAGD70dT cVugXggaTFCwZgiubjCx9S4BJ1BkKRVORuts8RCc1PpwmX56i9kr0yyGTzT8cydK8T0S 3kdhClGdjE2556o6UkMk6ZUZGVoJk5kJuOHSXYXAJM4e/NSQk3+0QWEzRqOdzjOFR9hf dRjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:from:cc:to:subject:dkim-signature:dkim-filter :arc-authentication-results; bh=ov/Y6Jp1uR/av87xaYzqcUY9UP5wH73TM0VnDA0e6Z0=; b=dNqMFNJ43R5itveGI0/Er6afx58CWiLobCx8TCgxRjh68q6pRyhEOAYeMgw2MhUnYl V5xdHAjUtEzx2RzyxQ4C3DDLBWh3/OhMsCMYJEnJZI12nBz6AU4VtWEvKhi0fMS7EzkF JKjKJ8j866qP6+qOtQhpUtUQRBXZtqYOh2pohQ1l5Y7KP8QOXNwAwLSWn6HNCbeu3zQu GOQmiuOMotHmWKfHjL+pPOR8ukbWE+zV0xwWM8nB3LYFFYP2FYW1VfcapLq9A1M88Wht hEZRWsWHa0GOzT8Qqn4meRE/i549TbHYF79/CpxaVv/I2lEaUTsutl74e6gv9sEObqax gJQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=W5S0iMII; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si6588386plg.260.2018.08.30.06.29.08; Thu, 30 Aug 2018 06:29:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=W5S0iMII; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729038AbeH3R3o (ORCPT + 99 others); Thu, 30 Aug 2018 13:29:44 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:60174 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728865AbeH3R3o (ORCPT ); Thu, 30 Aug 2018 13:29:44 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180830132734euoutp02bee0180fb97b2e0800fbe8e27af3ff9c~PrH3WieYa2817828178euoutp023 for ; Thu, 30 Aug 2018 13:27:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180830132734euoutp02bee0180fb97b2e0800fbe8e27af3ff9c~PrH3WieYa2817828178euoutp023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1535635654; bh=ov/Y6Jp1uR/av87xaYzqcUY9UP5wH73TM0VnDA0e6Z0=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=W5S0iMIIdOlqtr3/JkvV80N7xu8rPamK+0XIRnuvjtHnGQhXpLljoZYc9bhTvqR6Z 5WPCWxXm4SxZw8ykGAzeMngLM5UO5ysKJanST8XJ0w+Ti+3xx4t/QIVQlN7XwroXBg +vnaq0XsEbGyI+mH8BvoshOybfWkNmUi738qF1Cc= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180830132733eucas1p17177293f264b5d520e1a9fab3d9f40ba~PrH2jubdB2407324073eucas1p1M; Thu, 30 Aug 2018 13:27:33 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 0B.0F.04441.5C0F78B5; Thu, 30 Aug 2018 14:27:33 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180830132732eucas1p12b941ed065276c0cbed6e7b1e01a30dc~PrH1zJtnY2603926039eucas1p1b; Thu, 30 Aug 2018 13:27:32 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180830132732eusmtrp29618bdca321c90eacf00163f7a503698~PrH1yFcZS2986629866eusmtrp2z; Thu, 30 Aug 2018 13:27:32 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-7b-5b87f0c5f167 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4C.41.04128.4C0F78B5; Thu, 30 Aug 2018 14:27:32 +0100 (BST) Received: from [106.120.51.18] (unknown [106.120.51.18]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20180830132732eusmtip2d6eeeb3ed4a8bdd931b1e7ce9f1534be~PrH1b-EpY2315023150eusmtip2a; Thu, 30 Aug 2018 13:27:32 +0000 (GMT) Subject: Re: Locking for HW crypto accelerators To: Krzysztof Kozlowski , smueller@chronox.de Cc: herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org From: Kamil Konieczny Date: Thu, 30 Aug 2018 15:27:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTYRju29nlbLX1OQ1fVApW/nClZhecGVZgsCBIf0TlftTKs010U87x 0oJAxLwFapZpQzPDMtdVWbOpkMxseMdbmKGGmKFhibNgGS23M8l/7+V5nwu8JCFt4AWRKYZM ijao02R8Edf63jUY3r1cqNrv/IAVNUP5XMXNxRDF0NArgWJm2sVRjLbV8BWVfc+5x/nKlbEx jtLS9JGjtHaGKlvMxXyls2VnAi9JdDSZSkvJpujIuEsiXcNyNT9jXnDVVmIR5KIxXgkSkoAP QbO5V1CCRKQUP0HwqfqGr1lF8Lhn1tc4EXSXOrgbJwPt/Rx20YjAPWXisc0Sgt9VdRwPyh9H wsJ4BeGpA3AcvC1b8AoSmAZT+VMvEx9Hw2xrvxfPxaEw0f3Ni9mBz8O7z/XIU4uxH/Tcm/Pi hTgRmhYn+SxPIEzOsVoE3gWtSzWExwRgswAqv5YS7HE2FK3V+mzHw7i1w5faHxYdFgFbh4Db xhIBzoH21/MCligfQe3th75FLHQ5htePyXW1MHjZFsmOT8Ca5TvyjAFLYGLJj/UjgQprFcGO xVBUIGXR4XDf3e9zEAwl7he8ciQzbUpp2pTMtCmZ6b/uA8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n1 Lu2qj7GwlFpWusN5897/G0rNcpQWCJu4r8oXYvu70e/w7SkaPqp2rZISJ67npnscnlBRZcSV rWqqsIrnzWW+maplexz1ZgbtvzB/fjqnQ8lhVcvzTab3n604vS3kdpGbb8EmJZbijERDLeai 4kQABmdu2skCAAA= Message-Id: <20180830132732eucas1p12b941ed065276c0cbed6e7b1e01a30dc~PrH1zJtnY2603926039eucas1p1b@eucas1p1.samsung.com> X-CMS-MailID: 20180830132732eucas1p12b941ed065276c0cbed6e7b1e01a30dc X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20180830130922epcas1p35b0395da64de59107a805c6b99d770c2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180830130922epcas1p35b0395da64de59107a805c6b99d770c2 References: <3053033.se6UkFii4W@tauon.chronox.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30.08.2018 15:09, Krzysztof Kozlowski wrote: > [...] > Thanks Stephan for hints. Let's assume the each of init, update and > final are atomic... but how about the relation between update and > final? I have two concurrent users in user-space but only one HW: > > Process A: Process B: > init() and set_key() > init() and different key > update(some_data) > update(different_data) > final() > final() > > The final() from process A will now produce the result of hashing/CRC > of some_data and different_data (and even maybe mixed with init() for > different key). All because in the meantime process B added its own > data to the HW. > > Best regards, > Krzysztof Can your hardware do export/import ? If yes, you can use workqueue and guard HW with spinlock, as in exynos hash in s5p-sss.c (or see other drivers). -- Best regards, Kamil Konieczny Samsung R&D Institute Poland