Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1702752ybt; Mon, 15 Jun 2020 07:20:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrTLYgm6N+2yNoe3PpVDHE03PDeczPZD7YcmWK5XVJv/0wT8/CSwjDQXSam6K8g175E0S+ X-Received: by 2002:a17:907:402e:: with SMTP id nr22mr12910587ejb.239.1592230821829; Mon, 15 Jun 2020 07:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592230821; cv=none; d=google.com; s=arc-20160816; b=LjkeLSCr9oqxjHEMj/o66hl1bHmg8uVXuU9qAptNu1NY/NolfddOe4s/pB/AGV/mcQ 2DRK87XjTo36R0jw2jIjEzMjjp6d1hf6NLDJ5cX2oHLHUv0498xmMyf+TVib8e5pPHrB rjvnJG82g/t+U5GMu+Zw9Ae03y7D3S6zBXAzJa219rlnaRJS2zPXYb2NWlPKt6nlUxpJ Gi+ahxzTB6Asg81B4dL4nfipheC1Y+rgjI38nyEL99wWRpPeaZFk6GXgwnYEoLZSUqgq DfcWHYNgB7pwdIPoNi2ogJPDV4plyqa+wnr7eKjNfM7PeDf7aTSLZuOhDpenZOsfKr2y zmVQ== 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=d23D+XiOAYvKfPKTiwLPz84qwZEaZhYOW6O3VLSGI+k=; b=Q9bG4b7TOKuhpj129uS+Fxj2bs7O5s+30cj6DMXzFHi7ncoqJPvKgBddINE3gm4rgI pf/VsI1hp1Gh3G+5NR38ZyLeLUfwFJZRgKsjjUFdTvUqAA+bQihIEvm9F/HtgEpZPd7K EbWIg7ODq06rXdUNoddev8UkP5kdVBGnBQiRPVXbPQmlkOD9ExQme7PpOzO2a2w5FFzk W5dZSZNB3LrCHYqr52emRe+yeWwrijp+OJ5kXekVx8hDwVqy2/JcqxGCDUAwgnA2VM6Q evSiqMQz27A8JI6xvWgENh/djWntqsDaPVHiUIrqvNe+V3UwH3WyAUplaNdbHVHaYZvJ 3VTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="vs9r/A2P"; 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 rn10si9159437ejb.680.2020.06.15.07.19.59; Mon, 15 Jun 2020 07:20:21 -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="vs9r/A2P"; 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 S1730553AbgFOORy (ORCPT + 99 others); Mon, 15 Jun 2020 10:17:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:42660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730042AbgFOORy (ORCPT ); Mon, 15 Jun 2020 10:17:54 -0400 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 09DD820644; Mon, 15 Jun 2020 14:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592230673; bh=4TQGXLtys+5X0Ku9Pe7MEGS5M04KpaAdQGgX7vU0o9w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=vs9r/A2PulQeRjfyJ+v8PHSeItHMR8YRrxshLkIP36o9ou+UYPU48A92+IGpC6VZ5 VZBfWvyz43dQPxf13yNqLQeArDToOGK33IbCXy7XTFQ/Gl+oDh1GJs3sYfy66tz+RA t9Wnv+3AVYOZRueuLSX5O1kRYx7kqybHKUmcEBBI= Received: by mail-ej1-f44.google.com with SMTP id f7so17636037ejq.6; Mon, 15 Jun 2020 07:17:52 -0700 (PDT) X-Gm-Message-State: AOAM533WXqOIfk0nADBahiptEG6M5gtaT+P61gvjegL12mQrOMd0I3CQ Ffq7AvnDZkLQYQjL7hG7ixBO++f48X5BnyiWvg== X-Received: by 2002:a17:906:468e:: with SMTP id a14mr25689164ejr.124.1592230671616; Mon, 15 Jun 2020 07:17:51 -0700 (PDT) MIME-Version: 1.0 References: <1591698261-22639-1-git-send-email-neal.liu@mediatek.com> <1591698261-22639-3-git-send-email-neal.liu@mediatek.com> <1592188994.18525.11.camel@mtkswgap22> In-Reply-To: From: Chun-Kuang Hu Date: Mon, 15 Jun 2020 22:17:40 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] soc: mediatek: devapc: add devapc-mt6873 driver To: Chun-Kuang Hu Cc: Neal Liu , Rob Herring , Matthias Brugger , devicetree@vger.kernel.org, wsd_upstream , linux-kernel , "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 Chun-Kuang Hu =E6=96=BC 2020=E5=B9=B46=E6=9C=8815= =E6=97=A5 =E9=80=B1=E4=B8=80 =E4=B8=8B=E5=8D=8810:14=E5=AF=AB=E9=81=93=EF= =BC=9A > > Hi, Neal: > > Neal Liu =E6=96=BC 2020=E5=B9=B46=E6=9C=8815=E6= =97=A5 =E9=80=B1=E4=B8=80 =E4=B8=8A=E5=8D=8810:43=E5=AF=AB=E9=81=93=EF=BC= =9A > > > > Hi Chun-Kuang, > > > > > > On Sun, 2020-06-14 at 11:26 +0800, Chun-Kuang Hu wrote: > > > Hi, Neal: > > > > > > Neal Liu =E6=96=BC 2020=E5=B9=B46=E6=9C=889= =E6=97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8B=E5=8D=886:25=E5=AF=AB=E9=81=93=EF=BC= =9A > > > > > > > > MT6873 bus frabric provides TrustZone security support and data > > > > protection to prevent slaves from being accessed by unexpected > > > > masters. > > > > The security violations are 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 devapc-mt6873 driver. The violation > > > > information is printed in order to find the murderer. > > > > > > > > Signed-off-by: Neal Liu > > > > --- > > > > > > [snip] > > > > > > > + > > > > + /* 50 */ > > > > + {-1, -1, 50, "OOB_way_en", true}, > > > > + {-1, -1, 51, "OOB_way_en", true}, > > > > + {-1, -1, 52, "OOB_way_en", true}, > > > > + {-1, -1, 53, "OOB_way_en", true}, > > > > + {-1, -1, 54, "OOB_way_en", true}, > > > > + {-1, -1, 55, "OOB_way_en", true}, > > > > + {-1, -1, 56, "Decode_error", true}, > > > > + {-1, -1, 57, "Decode_error", true}, > > > > + {-1, -1, 58, "DISP_PWM", false}, > > > > + {-1, -1, 59, "IMP_IIC_WRAP", false}, > > > > + > > > > + /* 60 */ > > > > + {-1, -1, 60, "DEVICE_APC_PERI_PAR__AO", false}, > > > > + {-1, -1, 61, "DEVICE_APC_PERI_PAR_PDN", false}, > > > > > > You does not process the item whose enable_vio_irq is false, so I > > > think you should remove these items and remove enable_vio_irq because > > > the rest item's enable_vio_irq would always be true. > > > > In some users, they can decide which slaves they want to enable or > > disable violation irq in different product. We remain this property for > > compatibility. > > I think in upstream version, you could still remove enable_vio_irq and > process all items. For downstream case, users could remove items they > does not interest in. > > > > > > > > > > +}; > > > > + > > > > +static struct mtk_device_num mtk6873_devices_num[] =3D { > > > > + {SLAVE_TYPE_INFRA, VIO_SLAVE_NUM_INFRA}, > > > > + {SLAVE_TYPE_PERI, VIO_SLAVE_NUM_PERI}, > > > > + {SLAVE_TYPE_PERI2, VIO_SLAVE_NUM_PERI2}, > > > > + {SLAVE_TYPE_PERI_PAR, VIO_SLAVE_NUM_PERI_PAR}, > > > > +}; > > > > + > > > > +static struct PERIAXI_ID_INFO peri_mi_id_to_master[] =3D { > > > > + {"THERM2", { 0, 0, 0 } }, > > > > + {"SPM", { 0, 1, 0 } }, > > > > + {"CCU", { 0, 0, 1 } }, > > > > + {"THERM", { 0, 1, 1 } }, > > > > + {"SPM_DRAMC", { 1, 1, 0 } }, > > > > > > The bits { 1, 1, 0 } equal to a number 0x3, I thiink you should use a > > > number instead of bits and everything would be more easy. > > > > We would like to keep it because the bit value contains more than 0/1, > > it might be '2' in some cases. '2' means it can be 0 or 1. This totally > > by hardware design & implementation. > > Upstream the patch that has dont-care-bits, otherwise, use a number for t= his. > Even there is dont-care-bits, I have a better way to process it. Here > is an example that has dont-care-bits: > > + {"Tinysys", { 0, 1, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0 } }, > > I could use a { value, mask } pair for this case, > > value =3D 0x0002; /* value for care bits */ > mask =3D 0x3c02; /* mask for care bits */ Sorry, this would be mask =3D 0x3c0f; /* mask for care bits */ > > So the compare statement would be > > if ((bus_id & mask) =3D=3D value) > > So you could get rid of the second for-loop and reduce the processing > time in irq handler. > > Regards, > Chun-Kuang.