From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750947AbdL3OU0 (ORCPT ); Sat, 30 Dec 2017 09:20:26 -0500 Received: from mail-he1eur01on0074.outbound.protection.outlook.com ([104.47.0.74]:11138 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750828AbdL3OUY (ORCPT ); Sat, 30 Dec 2017 09:20:24 -0500 From: Peng Fan To: Philippe Ombredanne CC: Shawn Guo , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , LKML , Peng Fan , "Sascha Hauer" , Fabio Estevam , "A.s. Dong" Subject: RE: [PATCH V2] ARM: imx: introduce imx_l2c310_write_sec Thread-Topic: [PATCH V2] ARM: imx: introduce imx_l2c310_write_sec Thread-Index: AQHTgWzhR4kF0UOUJkaSgytd6WMH46Nb7s2AgAAAo0A= Date: Sat, 30 Dec 2017 14:20:20 +0000 Message-ID: References: <1514637243-20111-1-git-send-email-peng.fan@nxp.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-originating-ip: [114.217.28.28] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AMSPR04MB312;7:kyr8nwKyRdrzRKttETb8ms3XNMcwIGn0IDRrOdrRU/AtCOb/Ski1iYegGs7lqzOcvRsT1McVEcDASLJdxtk1lSTTKN+vpAakqUryEYLvPRK5U3U5Mh8hG2nQZqyM34WpWGyZ75KUGzhEmgGN8KQnYZ10TWQ7qvl5YR9CJ9GdSthNNXVQzu0eeZUI43eul/oFermetUCR0W9XK/GWuI+NYZIQAzz6fQoLPQVr252Y/KtghRe7fKrrKKNgx1BXiL/t x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(39380400002)(366004)(396003)(376002)(24454002)(199004)(189003)(13464003)(25786009)(3660700001)(105586002)(66066001)(106356001)(8676002)(81156014)(2900100001)(3280700002)(55016002)(9686003)(74316002)(305945005)(478600001)(68736007)(6436002)(33656002)(5660300001)(39060400002)(229853002)(53936002)(14454004)(7736002)(6506007)(6116002)(81166006)(53546011)(97736004)(59450400001)(4326008)(6246003)(76176011)(3846002)(15760500003)(7696005)(5250100002)(2906002)(316002)(99286004)(102836004)(8936002)(2950100002)(6916009)(54906003)(86362001)(575784001);DIR:OUT;SFP:1101;SCL:1;SRVR:AMSPR04MB312;H:DB6PR04MB3221.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 88d923f1-c477-46a2-d6e8-08d54f90752e x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060);SRVR:AMSPR04MB312; x-ms-traffictypediagnostic: AMSPR04MB312: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197)(258649278758335); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501075)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:AMSPR04MB312;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:AMSPR04MB312; x-forefront-prvs: 05373A0663 x-microsoft-antispam-message-info: spOR9FXIejOtmlZCD9E7DBXXcJClWgWudPiQlJZU2Q+DAWCYIntNUBpSnQoww5++iaLqLNVYBaPzvERi/Ynu7w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88d923f1-c477-46a2-d6e8-08d54f90752e X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Dec 2017 14:20:20.1744 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMSPR04MB312 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id vBUEKWiW031135 > -----Original Message----- > From: Philippe Ombredanne [mailto:pombredanne@nexb.com] > Sent: Saturday, December 30, 2017 10:17 PM > To: Peng Fan > Cc: Shawn Guo ; moderated list:ARM/FREESCALE IMX > / MXC ARM ARCHITECTURE ; LKML > ; Peng Fan ; Sascha > Hauer ; Fabio Estevam ; > A.s. Dong > Subject: Re: [PATCH V2] ARM: imx: introduce imx_l2c310_write_sec > > On Sat, Dec 30, 2017 at 1:34 PM, Peng Fan wrote: > > Some PL310 registers could only be wrote in secure world, so introduce > > imx_l2c310_write_sec to support Linux running in non-secure world > > configure PL310. > > > > Signed-off-by: Peng Fan > > Cc: Shawn Guo > > Cc: Sascha Hauer > > Cc: Fabio Estevam > > Cc: Dong Aisheng > > --- > > > > V2: > > Use SPDX Tag > > Use CONFIG_HAVE_ARM_SMCCC to fix build error for armv5. > > Add IS_ENABLED(CONFIG_OPTEE) check when assigning write_sec > > > > arch/arm/mach-imx/system.c | 27 ++++++++++++++++++++++++++- > > include/soc/imx/imx_sip_smc.h | 21 +++++++++++++++++++++ > > 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 > > include/soc/imx/imx_sip_smc.h > > > > diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c > > index c06af650e6b1..2c27e52d8c7d 100644 > > --- a/arch/arm/mach-imx/system.c > > +++ b/arch/arm/mach-imx/system.c > > @@ -23,11 +23,13 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > #include > > #include > > +#include > > > > #include "common.h" > > #include "hardware.h" > > @@ -92,6 +94,22 @@ void __init imx1_reset_init(void __iomem *base) > > #endif > > > > #ifdef CONFIG_CACHE_L2X0 > > +#ifdef CONFIG_HAVE_ARM_SMCCC > > +void imx_l2c310_write_sec(unsigned long val, unsigned int reg) { > > + struct arm_smccc_res res; > > + > > + arm_smccc_smc(IMX_SIP_SMC_L2C310, val, reg, 0, 0, 0, 0, 0, > > + &res); > > + > > + if (res.a0 != 0) > > + pr_err("Failed to write l2c310 0x%x: 0x%lx\n", reg, > > +res.a0); } #else void imx_l2c310_write_sec(unsigned long val, > > +unsigned int reg) { } #endif > > + > > void __init imx_init_l2cache(void) > > { > > void __iomem *l2x0_base; > > @@ -102,6 +120,10 @@ void __init imx_init_l2cache(void) > > if (!np) > > return; > > > > + if (IS_ENABLED(CONFIG_OPTEE) && > > + of_find_compatible_node(NULL, NULL, "linaro,optee-tz")) > > + outer_cache.write_sec = imx_l2c310_write_sec; > > + > > l2x0_base = of_iomap(np, 0); > > if (!l2x0_base) > > goto put_node; > > @@ -117,7 +139,10 @@ void __init imx_init_l2cache(void) > > val &= ~L310_PREFETCH_CTRL_OFFSET_MASK; > > val |= 15; > > > > - writel_relaxed(val, l2x0_base + L310_PREFETCH_CTRL); > > + if (outer_cache.write_sec) > > + outer_cache.write_sec(val, L310_PREFETCH_CTRL); > > + else > > + writel_relaxed(val, l2x0_base + > > + L310_PREFETCH_CTRL); > > } > > > > iounmap(l2x0_base); > > diff --git a/include/soc/imx/imx_sip_smc.h > > b/include/soc/imx/imx_sip_smc.h new file mode 100644 index > > 000000000000..c35ae69e0d2f > > --- /dev/null > > +++ b/include/soc/imx/imx_sip_smc.h > > @@ -0,0 +1,21 @@ > > +/* > > + * Copyright 2017 NXP > > + * > > + * SPDX-License-Identifier: GPL-2.0 > > + */ > > + > > Thanks! but the SPDX tag should be on the first line as its own comment. So this > would come out something like this > > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* Copyright 2017 NXP */ > > or > > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * Copyright 2017 NXP > > + */ > Thanks. I'll correct in V3. Before that, I would like to see if more comments about the code. Then I'll address them all in V3. Thanks, Peng. > > > > +#ifndef __IMX_SIP_SMC_H_ > > +#define __IMX_SIP_SMC_H_ > > + > > +#include > > + > > +#define IMX_SIP_SMC_VAL(func) > ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ > > + ARM_SMCCC_SMC_32, \ > > + ARM_SMCCC_OWNER_SIP, \ > > + (func)) > > + > > +#define IMX_L2C310 0x1 > > + > > +#define IMX_SIP_SMC_L2C310 IMX_SIP_SMC_VAL(IMX_L2C310) > > + > > +#endif > > -- > > 2.14.1 > > > > > > -- > Cordially > Philippe Ombredanne