Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2167105pxa; Mon, 3 Aug 2020 09:05:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy38pLPfPFcFUVIXq0Q2OSv2L0gMPUxmUDfJWHSwPQi3hFVWTsLgC+ZZxJOGaGe5vU/VKr0 X-Received: by 2002:a05:6402:1c07:: with SMTP id ck7mr8170743edb.84.1596470753162; Mon, 03 Aug 2020 09:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596470753; cv=none; d=google.com; s=arc-20160816; b=Clg05R0+hjFEI8PJXgXS3ZU3PPzjKJCPGF5mJ9u0PtalA8jaT/J4MLdfZLBABT723c f8GErgIV99pS+QCXL4eEgTH22qCUiXHNHIMMwGWy40gGlhO9puTiO8GU04sBqdjIfHT5 jFOnE3bbylKYqdvqsPXnNnVbTZWwFlgI+Umv73Q34a0dzuSvBI4uRs+MBR4CVi4nbIaK 4K48JuwQChPWtd48p1l1fFjQSRv4IyMWR8fge3VwAZdPSXGH8W6QXVwjozEwnK2vRXho +aZQJ6X6yQ+cJupc410mi8oa7qj2w9Dn+thTKBF+WAuO/h3TOyLCyvUznjDKu9uI4VJM wW9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=tBOQ3k5nhdoL1vRn5P2g99MLWGuyAinQr5gwNWwN4FE=; b=kw3TRVQLXxYkKR8IO8JMZEgDCX1diwyR5mXkkG6xvgfl5l+fBafoYfvbE8mroxKR8n i5OtjKf0SJCGnoLGyWM4EBg0jDo99yaWXl5GJZb9bYYzZYfaQSh0eRH8fOQaqSeOstAM /NxzWwidl7gJLCJLOYEs+zlYFQGMwInH6rwVN7iHbIvhb8gNidDoLCPxllqxpdddyr8o ahsnXgNOyQ/TICUK6S5MkS6WknNC7osrD5mPcYjJGf8bC8ULtsps3rc6Xcdbd+Dpr4w7 RPBzAC6x/4B1jKxc1ToqvCW51bvGZ5wyJslGSqzQCZNje9OpLwvP6RdddjuJ9qe/L61r oCPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Aex1PHJJ; 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 bo11si7907222edb.541.2020.08.03.09.05.29; Mon, 03 Aug 2020 09:05:53 -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=Aex1PHJJ; 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 S1728367AbgHCQEs (ORCPT + 99 others); Mon, 3 Aug 2020 12:04:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:47588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727824AbgHCQEr (ORCPT ); Mon, 3 Aug 2020 12:04:47 -0400 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 0DF23207FB; Mon, 3 Aug 2020 16:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596470685; bh=/UX1OU9tHTJm7VObpjM87RBY5SlTmYFqwKSYlfihuqs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Aex1PHJJaysd09vlU+np1whABVJWYO/wgGVEovV9wOg6cLl2CSU719BxSEiosliwK wHInjDZVIy8Mkb2GSxlkHKBZx23l5uhEGcX56SdQsqnYYjVkxSXdgN5xk9ZV3BAO+u ZiLZxLktesZol9ClUnGepKSVXZxgvYc2LulD6qic= Received: by mail-ej1-f53.google.com with SMTP id qc22so24397867ejb.4; Mon, 03 Aug 2020 09:04:45 -0700 (PDT) X-Gm-Message-State: AOAM533OvhGiBbd/rAPnHnPjpIPrEL4YZTN8tlWHXI1MZ5KgbS9AmxXQ zyBk+J+JsNuxgLhh11E+/neQjQyEtALsUOyNpg== X-Received: by 2002:a17:906:7492:: with SMTP id e18mr16973100ejl.375.1596470684579; Mon, 03 Aug 2020 09:04:44 -0700 (PDT) MIME-Version: 1.0 References: <1596010690-13178-1-git-send-email-neal.liu@mediatek.com> <1596010690-13178-3-git-send-email-neal.liu@mediatek.com> <1596427295.22971.20.camel@mtkswgap22> In-Reply-To: <1596427295.22971.20.camel@mtkswgap22> From: Chun-Kuang Hu Date: Tue, 4 Aug 2020 00:04:30 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 2/2] soc: mediatek: add mtk-devapc driver To: Neal Liu Cc: Chun-Kuang Hu , Rob Herring , Matthias Brugger , devicetree@vger.kernel.org, wsd_upstream , lkml , "moderated list:ARM/Mediatek SoC support" , Linux ARM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org 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=883=E6=97= =A5 =E9=80=B1=E4=B8=80 =E4=B8=8B=E5=8D=8812:01=E5=AF=AB=E9=81=93=EF=BC=9A > > Hi Chun-Kuang, > > On Sat, 2020-08-01 at 08:12 +0800, Chun-Kuang Hu wrote: > > Hi, Neal: > > > > This patch is for "mediatek,mt6779-devapc", so I think commit title > > should show the SoC ID. > > Okay, I'll change title to 'soc:mediatek: add mt6779 devapc driver'. > > > > > Neal Liu =E6=96=BC 2020=E5=B9=B47=E6=9C=8829=E6= =97=A5 =E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=884:29=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 > > > --- > > > > [snip] > > > > > + > > > +struct mtk_devapc_context { > > > + struct device *dev; > > > + u32 vio_idx_num; > > > + void __iomem *devapc_pd_base; > > > + struct mtk_devapc_vio_info *vio_info; > > > + const struct mtk_devapc_pd_offset *offset; > > > + const struct mtk_devapc_vio_dbgs *vio_dbgs; > > > +}; > > > > I think this structure should separate the constant part. The constant = part is: > > > > struct mtk_devapc_data { > > const u32 vio_idx_num; > > const struct mtk_devapc_pd_offset *offset; /* I would like to > > remove struct mtk_devapc_pd_offset and directly put its member into > > this structure */ > > const struct mtk_devapc_vio_dbgs *vio_dbgs; /* This may disappear *= / > > }; > > > > And the context is: > > > > struct mtk_devapc_context { > > struct device *dev; > > void __iomem *devapc_pd_base; > > const struct mtk_devapc_data *data; > > }; > > > > So when you define this, you would not waste memory to store non-consta= nt data. > > > > static const struct mtk_devapc_data devapc_mt6779 =3D { > > .vio_idx_num =3D 510, > > .offset =3D &mt6779_pd_offset, > > .vio_dbgs =3D &mt6779_vio_dbgs, > > }; > > > > Sorry, I still don't understand why this refactoring will not waste > memory to store non-constant data. Could you explain more details? > To my understanding, we still also have to allocate memory to store dev > & devapc_pd_base. In some situation, it is. You make the non-constant data a global variable. I think the context data should be dynamic allocated. If this driver is not probed, the non-constant data occupy the memory. Regards, Chun-Kuang. > > > Regards, > > Chun-Kuang. > > > > > + > > > +#endif /* __MTK_DEVAPC_H__ */ > > > -- > > > 1.7.9.5 > > > _______________________________________________ > > > Linux-mediatek mailing list > > > Linux-mediatek@lists.infradead.org > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek >