From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D1BC43461 for ; Mon, 7 Sep 2020 21:03:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 927C820C09 for ; Mon, 7 Sep 2020 21:03:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QDOi/xUK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZqH9MjLY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 927C820C09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j81Vy2pNuVjLNiwpF/lrIi9M1PvlVpXbfZ9rMlZOZ7s=; b=QDOi/xUK+nYkWsidWSCoorqLj 9Btpnm+S/5LWxA/ycGNlul06uhSR469CSk8VuJFCZ0u0OUEMqKmPCnvs0ZbZbb5UykWf16l9tYbCn Vl8M9pGdf0bmtaPUyUCM8UVsepEr08Klox59bt+3bKZQeGcxh9XwkPWShggpvava+lMf3J/NhKJoi IM6e6aig+bI6WTzhGFrsZgnrHo+Ch/kF8tLJ888tvXP4QJGjJQj5Zdd85+Vh+9OzDMA7E3EGXGECA x3czVYxIYrGHIOUUAKGT7sVYH7MJh7fN2nZkputwpVRrluaDnrU3hUohDFpp3XM9kBct0COcrG7BJ eZJgR15Qg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFOG4-0000Mw-HN; Mon, 07 Sep 2020 21:01:00 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFOG1-0000MW-0J for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2020 21:00:58 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D168220C09; Mon, 7 Sep 2020 21:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599512455; bh=DyZyFOVf+59U87DnlGKHeIKisc115H+mLh+maOnSxio=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZqH9MjLYheFyj4hAqAUf1doUVfi5yRdE3xPtHBDS/oYmfYqHk5b5fRZKFdD5LnfZ0 oXN2iCkxdmCyJQXyimo9+7wkyqoWDEFlbUMvOPsGugLqhyLIiHvd++3uTzR0SGaItU 8Bmf7E3Q6fdLOLy3LfjkKDlqTA+Ou7nmrpkf3EFI= Date: Mon, 7 Sep 2020 22:00:50 +0100 From: Will Deacon To: Jonathan Zhou , mathieu.poirier@linaro.org Subject: Re: [PATCH v2] Coresight: etm4x: add support for Self-hosted trace Message-ID: <20200907210050.GA13815@willie-the-truck> References: <1598860966-70616-1-git-send-email-jonathan.zhouwen@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1598860966-70616-1-git-send-email-jonathan.zhouwen@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_170057_216960_8F119EF5 X-CRM114-Status: GOOD ( 23.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shaokun Zhang , Catalin Marinas , linux-arm-kernel@lists.infradead.org, Suzuki K Poulose Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org [+ Mathieu, since he maintains the driver you're changing] On Mon, Aug 31, 2020 at 04:02:46PM +0800, Jonathan Zhou wrote: > ARMv8.4 architecture extension introduces ARMv8.4-Trace, Armv8.4 > Self-hosted Trace Extensions. It provides control of exception > levels and security states. Let's add this feature detection and > enable E1TRE and E0TRE in TRFCR_EL1 if Self-hosted Trace is > supported. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Suzuki K Poulose > Cc: Shaokun Zhang > Signed-off-by: Jonathan Zhou > --- > arch/arm64/include/asm/sysreg.h | 8 ++++++++ > drivers/hwtracing/coresight/coresight-etm4x.c | 23 +++++++++++++++++++++++ > 2 files changed, 31 insertions(+) > > diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h > index 554a7e8ecb07..53da5f326667 100644 > --- a/arch/arm64/include/asm/sysreg.h > +++ b/arch/arm64/include/asm/sysreg.h > @@ -184,6 +184,13 @@ > > #define SYS_ZCR_EL1 sys_reg(3, 0, 1, 2, 0) > > +/* Trace Filter control */ > +#define SYS_TRFCR_EL1 sys_reg(3, 0, 1, 2, 1) > +/* Trace is allowed at EL0 */ > +#define SYS_TRFCR_EL1_E0TRE BIT(0) > +/* Trace is allowed at EL1 */ > +#define SYS_TRFCR_EL1_E1TRE BIT(1) Do we also need to make sure we initialise TRFCR_EL2 correctly for the host? Will (keeping rest of the patch intact for Mathieu) > diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c > index 96425e818fc2..f72b457c2bad 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x.c > @@ -28,6 +28,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -785,6 +786,24 @@ static void etm4_init_arch_data(void *info) > CS_LOCK(drvdata->base); > } > > +static void etm4_init_sysctrl(void *info) > +{ > + u64 sys_trfcr_el1, dfr0; > + int trace_filt; > + > + dfr0 = read_sysreg(id_aa64dfr0_el1); > + > + trace_filt = cpuid_feature_extract_unsigned_field(dfr0, > + ID_AA64DFR0_SELF_HOSTED_SHIFT); > + /* if selfhosted trace implemented, enable trace EL0 as default. */ > + if (trace_filt == 0x1) { > + sys_trfcr_el1 = read_sysreg_s(SYS_TRFCR_EL1); > + write_sysreg_s(sys_trfcr_el1 | SYS_TRFCR_EL1_E0TRE, > + SYS_TRFCR_EL1); > + isb(); > + } > +} > + > static void etm4_set_default_config(struct etmv4_config *config) > { > /* disable all events tracing */ > @@ -1504,6 +1523,10 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) > etm4_init_arch_data, drvdata, 1)) > dev_err(dev, "ETM arch init failed\n"); > > + if (smp_call_function_single(drvdata->cpu, > + etm4_init_sysctrl, drvdata, 1)) > + dev_err(dev, "ETM sysctrl init failed\n"); > + > ret = etm4_pm_setup_cpuslocked(); > cpus_read_unlock(); > > -- > 1.9.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel