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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 16DE9C433E0 for ; Fri, 8 Jan 2021 01:03:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3F64236F9 for ; Fri, 8 Jan 2021 01:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729784AbhAHBDW (ORCPT ); Thu, 7 Jan 2021 20:03:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729768AbhAHBDV (ORCPT ); Thu, 7 Jan 2021 20:03:21 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA01AC0612F5 for ; Thu, 7 Jan 2021 17:02:40 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id j1so4805776pld.3 for ; Thu, 07 Jan 2021 17:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Dd2tV1nAbb6DFWrXlfS2dcWhKRewQrKs8AwXO16cMcQ=; b=GQ8fK2NkFWRFTISaOVkknrwWAUmz05q7mjAQ5vasikad+4wPS+MAPHZuVckm2kAxrR GxE3TAAAaKgAV56Ty+l31U6U8AtiOKXHvyIG0JvW8dFyhbx5QOD5JIdJeXKHDSB2TacX jRL6vNXUjbKQnyBiB5rAlfJ5KHdT1I593W7KAlZUZNOk1mHsZ2nmwfHOHuD90msHuevV PgxT9YmhWZTqY6sEclfmgKS4QipTsKoYfk6oL4cHjbIKBJ+14fg3TccaeAfEI8C3ats7 QAPyAtuDOZ2YweTWMchQw9IPxOkLeTKF+zVkcqbz1elVkUC08Gl+J3EYTICql5zSiXnp 7c1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Dd2tV1nAbb6DFWrXlfS2dcWhKRewQrKs8AwXO16cMcQ=; b=jLpSqTUSCLDk9qfQMAfI0PUzOTE+v6YLcaRH7K5sgioyMJI4KKQIKJ3xbbe+OpLK2F +PelbGsSaHRkwg7rFdLTeBSMyWFc6AB47yHd1tenGXccvtwsC7mlPwoEa6o48HyVxkx+ /QJ74Oe4pjlZ94BFG8VV/h9iWIdZ75C+MoxwricPRuK3MatCQtOCU/rkAosNyCdOLfPt g1GN7kZWBaslR7XTgzIFf2IMRezehzhWoWJWKXjLf4S+bYu+3eVcO03seJ8/bHDIarDt x2gH+HMgfiLoBt+ejjOh60lNzWlSQfRnvAyIkAIjqfOhViJTfDpzvWZnH6Y8SUsFLQh7 4qkw== X-Gm-Message-State: AOAM530fZDhLlvyUOhK7gj6GQS1fLH9O3yyvNFPsgKMrF24Qa/qNRD0W q/U3YVHQU44qBfCf9aDJoubqkw== X-Google-Smtp-Source: ABdhPJygQsUfEobyUpzUkEtx1NDcLX6rmTb4lQ8ji23E90asx6dR+3uKyqiClJk87UPdfBrejl9jyg== X-Received: by 2002:a17:90b:298:: with SMTP id az24mr1130598pjb.128.1610067760478; Thu, 07 Jan 2021 17:02:40 -0800 (PST) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id b26sm7307722pgm.25.2021.01.07.17.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 17:02:39 -0800 (PST) Date: Thu, 7 Jan 2021 18:02:38 -0700 From: Mathieu Poirier To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, leo.yan@linaro.org, mike.leach@linaro.org, anshuman.khandual@arm.com, Jonathan Zhou , Catalin Marinas , Will Deacon Subject: Re: [PATCH v6 26/26] coresight: Add support for v8.4 SelfHosted tracing Message-ID: <20210108010238.GI43045@xps15> References: <20210107123859.674252-1-suzuki.poulose@arm.com> <20210107123859.674252-27-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210107123859.674252-27-suzuki.poulose@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 07, 2021 at 12:38:59PM +0000, Suzuki K Poulose wrote: > From: Jonathan Zhou > > v8.4 tracing extensions added support for trace filtering controlled > by TRFCR_ELx. This must be programmed to allow tracing at EL1/EL2 and > EL0. The timestamp used is the virtual time. Also enable CONTEXIDR_EL2 > tracing if we are running the kernel at EL2. > > Cc: Catalin Marinas > Cc: Mathieu Poirier > Cc: Mike Leach > Cc: Will Deacon > Signed-off-by: Jonathan Zhou > [ Move the trace filtering setup etm_init_arch_data() and > clean ups] > Signed-off-by: Suzuki K Poulose Reviewed-by: Mathieu Poirier > --- > .../coresight/coresight-etm4x-core.c | 25 +++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index 34a6cdff75e7..6d96f4226bca 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -859,6 +859,30 @@ static bool etm4_init_csdev_access(struct etmv4_drvdata *drvdata, > return false; > } > > +static void cpu_enable_tracing(void) > +{ > + u64 dfr0 = read_sysreg(id_aa64dfr0_el1); > + u64 trfcr; > + > + if (!cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_TRACE_FILT_SHIFT)) > + return; > + > + /* > + * If the CPU supports v8.4 SelfHosted Tracing, enable > + * tracing at the kernel EL and EL0, forcing to use the > + * virtual time as the timestamp. > + */ > + trfcr = (TRFCR_ELx_TS_VIRTUAL | > + TRFCR_ELx_ExTRE | > + TRFCR_ELx_E0TRE); > + > + /* If we are running at EL2, allow tracing the CONTEXTIDR_EL2. */ > + if (is_kernel_in_hyp_mode()) > + trfcr |= TRFCR_EL2_CX; > + > + write_sysreg_s(trfcr, SYS_TRFCR_EL1); > +} > + > static void etm4_init_arch_data(void *info) > { > u32 etmidr0; > @@ -1044,6 +1068,7 @@ static void etm4_init_arch_data(void *info) > /* NUMCNTR, bits[30:28] number of counters available for tracing */ > drvdata->nr_cntr = BMVAL(etmidr5, 28, 30); > etm4_cs_lock(drvdata, csa); > + cpu_enable_tracing(); > } > > static inline u32 etm4_get_victlr_access_type(struct etmv4_config *config) > -- > 2.24.1 > 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=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 6E05CC433E0 for ; Fri, 8 Jan 2021 01:04:51 +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 2407B22DBF for ; Fri, 8 Jan 2021 01:04:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2407B22DBF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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=yQ9Pr3PF2dYAKq8pDZJBs5UfMpKuSNOBbMH8mvMLgwk=; b=Lz4LW3G1YzN5WtEpxBSYMOor6 jyFKZ02xHXFDvfdpDPzR43+6+JNWKtZXPFrt8zR6E7v6jOuxXNQlfmnx5C9mpZ4QorM0b7LSiRISF fSt64t2DnBdgQx97PAKwgjcLHDdYV0nqm00gB5u+TFlA8L29EoSSMK3CO58MW9dYEDT6AgdmvvvEK WjoX3EXeuOF9zver9mZ1j/HZfZ+i3TRijzAElw5khH9py2lYCId3pVE7K2EM02UpprdzI2loI451a pnGCLY6PruTUNEX0WnK0r+31OdhGvALI39we+RYEGIPCPJFvDYwZqyVOC9Bn8M6EEO1h92QEj2EAJ hQQgvqEug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxgAu-0006BG-Un; Fri, 08 Jan 2021 01:02:44 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxgAs-0006Al-I1 for linux-arm-kernel@lists.infradead.org; Fri, 08 Jan 2021 01:02:43 +0000 Received: by mail-pl1-x630.google.com with SMTP id s15so4781289plr.9 for ; Thu, 07 Jan 2021 17:02:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Dd2tV1nAbb6DFWrXlfS2dcWhKRewQrKs8AwXO16cMcQ=; b=GQ8fK2NkFWRFTISaOVkknrwWAUmz05q7mjAQ5vasikad+4wPS+MAPHZuVckm2kAxrR GxE3TAAAaKgAV56Ty+l31U6U8AtiOKXHvyIG0JvW8dFyhbx5QOD5JIdJeXKHDSB2TacX jRL6vNXUjbKQnyBiB5rAlfJ5KHdT1I593W7KAlZUZNOk1mHsZ2nmwfHOHuD90msHuevV PgxT9YmhWZTqY6sEclfmgKS4QipTsKoYfk6oL4cHjbIKBJ+14fg3TccaeAfEI8C3ats7 QAPyAtuDOZ2YweTWMchQw9IPxOkLeTKF+zVkcqbz1elVkUC08Gl+J3EYTICql5zSiXnp 7c1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Dd2tV1nAbb6DFWrXlfS2dcWhKRewQrKs8AwXO16cMcQ=; b=M8mOkhzC7kL4W3dvzx/HBHgnU4uvGiDqEhD9U5aeESExSaWdaT5oI7MCB0GzYLDyl1 Qca1XMaI8m5leB28I25DNxdP2hR5YYm4JGdPbfTzyuRi4F/pSZC5oevuSUNQO1YGTQHD YZkS1Wv0MSHJUxn2PWW2/SoKF7P/yT0U0k51Q+iuMOfeYIoHaTw9cmMgW90aQpf+H3iw oc6E5SUF7VjSpq5ODajDqcB4SNMfHbDeasN/AjlkaRbOCJN3+rnpGy3iqWPe0hAQVO4L jonZqTlE7htcHl3hx1imDcrB357rSkUJB9h2PVYLkRHB28ULK7hr+2wKqjRx/weYXC+i 8dag== X-Gm-Message-State: AOAM531PRANrpyC/PgK/6/ZimhW+RRwh3GxEHEg9xxyyIY9Ct6NyWzG9 YLPC29ZOOLUHnv9nu9yLn7lJ0A== X-Google-Smtp-Source: ABdhPJygQsUfEobyUpzUkEtx1NDcLX6rmTb4lQ8ji23E90asx6dR+3uKyqiClJk87UPdfBrejl9jyg== X-Received: by 2002:a17:90b:298:: with SMTP id az24mr1130598pjb.128.1610067760478; Thu, 07 Jan 2021 17:02:40 -0800 (PST) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id b26sm7307722pgm.25.2021.01.07.17.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 17:02:39 -0800 (PST) Date: Thu, 7 Jan 2021 18:02:38 -0700 From: Mathieu Poirier To: Suzuki K Poulose Subject: Re: [PATCH v6 26/26] coresight: Add support for v8.4 SelfHosted tracing Message-ID: <20210108010238.GI43045@xps15> References: <20210107123859.674252-1-suzuki.poulose@arm.com> <20210107123859.674252-27-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210107123859.674252-27-suzuki.poulose@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210107_200242_639390_4250C487 X-CRM114-Status: GOOD ( 23.51 ) 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: anshuman.khandual@arm.com, Catalin Marinas , coresight@lists.linaro.org, linux-kernel@vger.kernel.org, Jonathan Zhou , leo.yan@linaro.org, Will Deacon , linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org 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 On Thu, Jan 07, 2021 at 12:38:59PM +0000, Suzuki K Poulose wrote: > From: Jonathan Zhou > > v8.4 tracing extensions added support for trace filtering controlled > by TRFCR_ELx. This must be programmed to allow tracing at EL1/EL2 and > EL0. The timestamp used is the virtual time. Also enable CONTEXIDR_EL2 > tracing if we are running the kernel at EL2. > > Cc: Catalin Marinas > Cc: Mathieu Poirier > Cc: Mike Leach > Cc: Will Deacon > Signed-off-by: Jonathan Zhou > [ Move the trace filtering setup etm_init_arch_data() and > clean ups] > Signed-off-by: Suzuki K Poulose Reviewed-by: Mathieu Poirier > --- > .../coresight/coresight-etm4x-core.c | 25 +++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index 34a6cdff75e7..6d96f4226bca 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -859,6 +859,30 @@ static bool etm4_init_csdev_access(struct etmv4_drvdata *drvdata, > return false; > } > > +static void cpu_enable_tracing(void) > +{ > + u64 dfr0 = read_sysreg(id_aa64dfr0_el1); > + u64 trfcr; > + > + if (!cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_TRACE_FILT_SHIFT)) > + return; > + > + /* > + * If the CPU supports v8.4 SelfHosted Tracing, enable > + * tracing at the kernel EL and EL0, forcing to use the > + * virtual time as the timestamp. > + */ > + trfcr = (TRFCR_ELx_TS_VIRTUAL | > + TRFCR_ELx_ExTRE | > + TRFCR_ELx_E0TRE); > + > + /* If we are running at EL2, allow tracing the CONTEXTIDR_EL2. */ > + if (is_kernel_in_hyp_mode()) > + trfcr |= TRFCR_EL2_CX; > + > + write_sysreg_s(trfcr, SYS_TRFCR_EL1); > +} > + > static void etm4_init_arch_data(void *info) > { > u32 etmidr0; > @@ -1044,6 +1068,7 @@ static void etm4_init_arch_data(void *info) > /* NUMCNTR, bits[30:28] number of counters available for tracing */ > drvdata->nr_cntr = BMVAL(etmidr5, 28, 30); > etm4_cs_lock(drvdata, csa); > + cpu_enable_tracing(); > } > > static inline u32 etm4_get_victlr_access_type(struct etmv4_config *config) > -- > 2.24.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel