From patchwork Wed Nov 27 14:22:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Liu X-Patchwork-Id: 11264189 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9F311390 for ; Wed, 27 Nov 2019 14:23:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9AA1C20722 for ; Wed, 27 Nov 2019 14:23:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="FWsISVEZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727120AbfK0OXP (ORCPT ); Wed, 27 Nov 2019 09:23:15 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:15498 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726634AbfK0OXP (ORCPT ); Wed, 27 Nov 2019 09:23:15 -0500 X-UUID: 5623eca84e664962893906b9f978bb1d-20191127 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=NhBME09v3vIkyV7lPjd2SdpUbwvFpe5cLCJrE0AJDLc=; b=FWsISVEZgeGOrx7RXH9FxrOyHQF+Ac8LeyYh2C13e8uq3ZmAk8eg2FTdbOHaSGG3faatGbkdjQXY4E0IzcsVByRjLJ5A1vZEKir+qrSkexiQ35jDj941Engs3WRrO39yBt78a8CdBfHRSeDHNoXOsIUbASgX7PJoDGuXE828psY=; X-UUID: 5623eca84e664962893906b9f978bb1d-20191127 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1720118062; Wed, 27 Nov 2019 22:23:10 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Nov 2019 22:22:59 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Nov 2019 22:23:03 +0800 From: Neal Liu To: Matt Mackall , Herbert Xu , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang CC: Neal Liu , Crystal Guo , , , , , , Subject: [PATCH v5 0/3] MediaTek Security random number generator support Date: Wed, 27 Nov 2019 22:22:55 +0800 Message-ID: <1574864578-467-1-git-send-email-neal.liu@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org These patch series introduce a generic rng driver for Trustzone based kernel driver which would like to communicate with ATF SIP services. Patch #1 initials SMC fid table for Mediatek SIP interfaces and adds HWRNG related SMC call. Patch #2..3 adds mtk-sec-rng kernel driver for Trustzone based SoCs. For MediaTek SoCs on ARMv8 with TrustZone enabled, peripherals like entropy sources is not accessible from normal world (linux) and rather accessible from secure world (ATF/TEE) only. This driver aims to provide a generic interface to ATF rng service. changes since v1: - rename mt67xx-rng to mtk-sec-rng since all MediaTek ARMv8 SoCs can reuse this driver. - refine coding style and unnecessary check. changes since v2: - remove unused comments. - remove redundant variable. changes since v3: - add dt-bindings for MediaTek rng with TrustZone enabled. - revise HWRNG SMC call fid. changes since v4: - move bindings to the arm/firmware directory. - revise driver init flow to check more property. Neal Liu (3): soc: mediatek: add SMC fid table for SIP interface dt-bindings: rng: add bindings for MediaTek ARMv8 SoCs hwrng: add mtk-sec-rng driver .../arm/firmware/mediatek,mtk-sec-rng.txt | 18 +++ drivers/char/hw_random/Kconfig | 16 +++ drivers/char/hw_random/Makefile | 1 + drivers/char/hw_random/mtk-sec-rng.c | 103 ++++++++++++++++++ include/linux/soc/mediatek/mtk_sip_svc.h | 33 ++++++ 5 files changed, 171 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/firmware/mediatek,mtk-sec-rng.txt create mode 100644 drivers/char/hw_random/mtk-sec-rng.c create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h