Received: by 2002:a4f:b056:0:0:0:0:0 with SMTP id m22csp1412508ivi; Fri, 2 Oct 2020 09:28:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzvEgbPXrzFm51/iFOGmagjYfuqM+AH83xH+n+kkIQZiON525GmQkO7uke4SXu9d3eVduc X-Received: by 2002:a17:906:4f8d:: with SMTP id o13mr3067101eju.20.1601656088145; Fri, 02 Oct 2020 09:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601656088; cv=none; d=google.com; s=arc-20160816; b=FNqnaQwvIgxwZI58NbTV4ivTAZp4naj3FrWlfGVj/a30NPdZX97kaPGE2Yo/n/JiR8 ojS6D7xFpZUZiomWt1Rwpmb0Nm+nNYBIPfU9j5y8QVRIyGVKDbdHLgu7F/FTJJmPLvtg lGK6vr0751MiEO462GkqnKE/aRrgAji6w2KTv0LZIx9lsvvsq4rSGOJy7hgzuPATF8yS huWIHVRP6RQ0zeJoubX0lfQcYTnnIQu4zzQKDvJM5S967eJe6h8DGYK2j0MmUpamTzvK hkeXP+Rdi/VeqMbqk4IQqsfxEhX5E7hVCHcI0GbFlsBBHVZFoq5hAOiwJmKLgmKvHbNp eRLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=U5rd8VZWjz547WBHUsgqBwCoqt5VV96vjLgJHP5nUMA=; b=eXC06PFda/WN1DUZQ9C9Xwz59dZN6Ata5GNeVmiArS0ToJYzAgTVqfPDVL+izl8drW XO1OZJSaynqcsXMv1+pYAAFNubYlUUOXR292D0gQBJ7TAQxGXrNEani5P2gP6o6MrEmG 3+hfPwdsYTrBzY0KCUF1g2Jpbs0HQYbelpGM7VZaCPTNQHu4LszzZnXyW6AjEP/Un0C9 /Z1SIDxkp3B80h1ciwTESYETHVQ/gbRN0MWgZ1UH3APImkj6n1uPYGc0YrP3JHlt1ddd 5zx8dDyI34FtTVexuiBNYvv2msswgaCJGqyMv4f9nouEh/b1w2Vrh13411qfXHcZt+z6 WtdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZYOFhNcF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si1986262edj.252.2020.10.02.09.27.45; Fri, 02 Oct 2020 09:28:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZYOFhNcF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388148AbgJBQYY (ORCPT + 99 others); Fri, 2 Oct 2020 12:24:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:53512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726017AbgJBQYY (ORCPT ); Fri, 2 Oct 2020 12:24:24 -0400 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DFD0F206FA; Fri, 2 Oct 2020 16:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601655864; bh=XtQ41aWaPx5+LCDrh/lKMRy5xvIsR4YWuY5PCakwRNQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZYOFhNcFXvip8lefRJnbyFaI5/HwfeDCEj0Me6o8cW0aZDd1ptML2xpAHO5wN2Fzt gANDZaMG7TxBKVsxxs+eHw7SJRzbJeKapSno5Me62+RcoIAs49KXqkdaKPpP8ZwDp2 BkhRqVcJ+A80+E7ygmaqaZ0jcoi1zB63H5w75pag= Received: by mail-ed1-f54.google.com with SMTP id b12so2245591edz.11; Fri, 02 Oct 2020 09:24:23 -0700 (PDT) X-Gm-Message-State: AOAM5315T/swyWw81t001eC4n9lzr4BT3kby/z7Psjw5Pz1KQ+CAzDaH 9E7HFzGVz+Oy7cGwWl+bER4C4yo43USYCEQszg== X-Received: by 2002:aa7:cd56:: with SMTP id v22mr393465edw.49.1601655862471; Fri, 02 Oct 2020 09:24:22 -0700 (PDT) MIME-Version: 1.0 References: <1598497593-15781-1-git-send-email-neal.liu@mediatek.com> <1598497593-15781-3-git-send-email-neal.liu@mediatek.com> In-Reply-To: <1598497593-15781-3-git-send-email-neal.liu@mediatek.com> From: Chun-Kuang Hu Date: Sat, 3 Oct 2020 00:24:11 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 2/2] soc: mediatek: add mt6779 devapc driver To: Neal Liu Cc: Rob Herring , Matthias Brugger , Chun-Kuang Hu , DTML , Linux ARM , "moderated list:ARM/Mediatek SoC support" , lkml , wsd_upstream Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Neal: Neal Liu =E6=96=BC 2020=E5=B9=B48=E6=9C=8827=E6=97= =A5 =E9=80=B1=E5=9B=9B =E4=B8=8A=E5=8D=8811:07=E5=AF=AB=E9=81=93=EF=BC=9A > > MediaTek bus fabric provides TrustZone security support and data > protection to prevent slaves from being accessed by unexpected > masters. > The security violation is logged and sent to the processor for > further analysis or countermeasures. > > Any occurrence of security violation would raise an interrupt, and > it will be handled by mtk-devapc driver. The violation > information is printed in order to find the murderer. > > Signed-off-by: Neal Liu > --- > drivers/soc/mediatek/Kconfig | 9 ++ > drivers/soc/mediatek/Makefile | 1 + > drivers/soc/mediatek/mtk-devapc.c | 305 +++++++++++++++++++++++++++++++= ++++++ > 3 files changed, 315 insertions(+) > create mode 100644 drivers/soc/mediatek/mtk-devapc.c > [snip] > + > +static int mtk_devapc_probe(struct platform_device *pdev) > +{ > + struct device_node *node =3D pdev->dev.of_node; > + struct mtk_devapc_context *ctx; > + u32 devapc_irq; > + int ret; > + > + if (IS_ERR(node)) > + return -ENODEV; > + > + ctx =3D devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); > + if (!ctx) > + return -ENOMEM; > + > + ctx->data =3D of_device_get_match_data(&pdev->dev); > + ctx->dev =3D &pdev->dev; > + > + ctx->infra_base =3D of_iomap(node, 0); > + if (!ctx->infra_base) > + return -EINVAL; > + > + devapc_irq =3D irq_of_parse_and_map(node, 0); > + if (!devapc_irq) > + return -EINVAL; > + > + ctx->infra_clk =3D devm_clk_get(&pdev->dev, "devapc-infra-clock")= ; > + if (IS_ERR(ctx->infra_clk)) > + return -EINVAL; > + > + if (clk_prepare_enable(ctx->infra_clk)) > + return -EINVAL; What would happen if you do not enable this clock? I think this hardware is already initialized in trust zone. Regards, Chun-Kuang. > + > + ret =3D devm_request_irq(&pdev->dev, devapc_irq, > + (irq_handler_t)devapc_violation_irq, > + IRQF_TRIGGER_NONE, "devapc", ctx); > + if (ret) { > + clk_disable_unprepare(ctx->infra_clk); > + return ret; > + } > + > + platform_set_drvdata(pdev, ctx); > + > + start_devapc(ctx); > + > + return 0; > +} > +