Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1700509ybt; Mon, 15 Jun 2020 07:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIoCY8tC6/WTbWy2o61LW5X8aZ8Gctt0g9FvYt0Lw1LQkSunD+Ai+56An3JCgyt6O7yL5d X-Received: by 2002:a50:934e:: with SMTP id n14mr24075161eda.88.1592230629644; Mon, 15 Jun 2020 07:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592230629; cv=none; d=google.com; s=arc-20160816; b=KrUmaOAjp69h5AGoEUA72NMKLY4oRSBNJaI/0Ga85+TiysNkP98IMqb9qzDSNeYpJY vPX0tDBjbOlixcCJ9fIliOFeyFyAbzjGxW+J7OTMPtNW2cBxs46MlG7QjCMedNgaUpAa blfWtuSFRTD8kdQ22qBOzyPU5Wm807OmZyRZ+qeC+kRampxmudnZbvDL1nfWC1IJaHm8 Ig3NhVQr43rCQCOylN28wxq7P1B5praAtqxqpzhyoZQBA1O5fOOJWhrvNEkvHROeFdYV 3VHQJpujAF72y4LGjPJlDYmXG7Y6KuvDXz/Zf0/QsYMnCPxh9+geVMu2BgT6wNQPcPk6 IidQ== 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=I/kc4YqZVrpht+YomAUFB5B0037Krf+0N04e2NvBdfM=; b=qWFSicnQNuHPxZrRT6VfCI2yBmc+Nvn9p4JeOthY8KTbjPS9XEbNzw+/SolUHIXhgu FGOcoUtZ4gw6lM8oPG2TsRnrp/z0vHq9vRvHe+3xuSdgpry5N+g6TfgJNA99cQnvnOb1 YIoHcuCXK6auNWh1QPzM5HxOnbxD2M1ugXX2oII4FffxWtB7HIRmz/qYE54Ui3CjjrxP hkyw/fWJrloWrK4XYhkKbErGv0fAKHNzF8ChE0EJiLu1oeiJ/RPYBwrP39z6kmR1wUGR 5cNAHeNtmdYhdOV66f/6G7G/FmgNi48D3EpeJ3WD5YW/03ibE2JLFN9kbLdjyVhI/Zp6 VxDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AiijIRJ4; 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 o10si10194024ejj.111.2020.06.15.07.16.47; Mon, 15 Jun 2020 07:17:09 -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=AiijIRJ4; 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 S1730456AbgFOOOY (ORCPT + 99 others); Mon, 15 Jun 2020 10:14:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:40882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730412AbgFOOOW (ORCPT ); Mon, 15 Jun 2020 10:14:22 -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 0E3B02078E; Mon, 15 Jun 2020 14:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592230462; bh=JhVFELtq+HwraQ3txLeGpqQa4Z+hkTxpQj+aKFCyq6E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AiijIRJ4UelIyRo8/cpDKwnsCXTi60e0OblHB5dgoqQJFc1umpeUq0T4qsRSY8IQC AQ+DkaMeEuDi9q2oJr3+LU+F6cqqNPWBvfNZErGZ/st/OsfkVeEpi3FddDIr5HQUra /CeyW7hcqNKLdH+vYCM3mgiYQr8OYjr5gVgyKlqg= Received: by mail-ej1-f44.google.com with SMTP id l12so17581077ejn.10; Mon, 15 Jun 2020 07:14:21 -0700 (PDT) X-Gm-Message-State: AOAM533tqcgOhRfp0Dtens97ZjDTRsBJUtmWgXZR2zlfyxWPPiaYU/AV OHoHP9yOJtK0AG4oeIAYEwSxb2DKu00iQdZ5EA== X-Received: by 2002:a17:906:3041:: with SMTP id d1mr26425865ejd.7.1592230460539; Mon, 15 Jun 2020 07:14:20 -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: <1592188994.18525.11.camel@mtkswgap22> From: Chun-Kuang Hu Date: Mon, 15 Jun 2020 22:14:09 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] soc: mediatek: devapc: add devapc-mt6873 driver To: Neal Liu Cc: Chun-Kuang Hu , 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 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 thi= s. 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 */ 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.