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.3 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,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 9D1F0C5519F for ; Fri, 20 Nov 2020 10:07:45 +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 0EFD522244 for ; Fri, 20 Nov 2020 10:07:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="js15kl7u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EFD522244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J3x6KakEWQ+bVEnlEOQTSMtflgX2/x4OG3fq1YfRmYU=; b=js15kl7u5yOtl/xchMKYy1iY0 brX1f4QaZe/PCQIWFofwndk2JvI5h4FFD3kTn9pMw01/1CAy4KSCrzQXpSm89tVBLogc1ArbM4crm I3YK6MhPrDkXsEdmAAHlDQ3aFgHREi9ZHifQ1J1EtR/F3w60/SPB6pE94hW2vodoFlQPmx7KD2iBO KCsGyR5hOfIAXkXbnrgRBMueEuLUAWpDTf+pG0wkvfwbpQygzFDC4pUMLb7uU1df7IgqFBCydqVzq ReO6TH1w/8+E6ibtKBzckBe5FCusLFvVUw86QtfSOQj0FQGB2vTYPIv5PwYWNUL55pMPV6swRfQfE oA2COyyWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kg3I6-0002oK-NJ; Fri, 20 Nov 2020 10:05:21 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kg3G3-0001zC-Tm for linux-arm-kernel@lists.infradead.org; Fri, 20 Nov 2020 10:03:13 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D88621042; Fri, 20 Nov 2020 02:03:08 -0800 (PST) Received: from [10.57.53.209] (unknown [10.57.53.209]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D9F7A3F70D; Fri, 20 Nov 2020 02:03:06 -0800 (PST) Subject: Re: [PATCH v4 25/25] coresight: Add support for v8.4 SelfHosted tracing To: Catalin Marinas References: <20201119164547.2982871-1-suzuki.poulose@arm.com> <20201119164547.2982871-26-suzuki.poulose@arm.com> <20201119172243.GF4376@gaia> From: Suzuki K Poulose Message-ID: Date: Fri, 20 Nov 2020 10:03:00 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201119172243.GF4376@gaia> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201120_050312_125657_5A817386 X-CRM114-Status: GOOD ( 21.86 ) 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: mathieu.poirier@linaro.org, anshuman.khandual@arm.com, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Will Deacon , jonathan.zhouwen@huawei.com, mike.leach@linaro.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 11/19/20 5:22 PM, Catalin Marinas wrote: > On Thu, Nov 19, 2020 at 04:45:47PM +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 >> --- >> .../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 1d054d2ab2a0..647685736134 100644 >> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c >> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c >> @@ -760,6 +760,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 (!(dfr0 >> ID_AA64DFR0_TRACE_FILT_SHIFT)) >> + return; > > What if we get a new field at position 44 while the FILT one at 40 is 0? > We should use cpuid_feature_extract_field() here. > Bah, you're right. Sorry for that silly mistake. Thanks for spotting. > BTW, can this function not go in the cpufeature.c code? Yes, this could go there. The only reason for keeping this here was that the ETM is the only Trace component we support. Ideally, this should be performed at enable/disable of the ETM, based on the "config" selected for the session. That way we can be sure that nobody (read, a VM) traces the host kernel/el0 behind our back (even though we would trap the access for now). Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel