Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4173344pxb; Tue, 10 Nov 2020 09:34:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJylddsMGkGef6Wwx/a9V+6IKa6oWgbYZkiGtQcSjNsMOeB0fjM/PQmfRusf5XYUESJKZ8Un X-Received: by 2002:a05:6402:1750:: with SMTP id v16mr427975edx.241.1605029695156; Tue, 10 Nov 2020 09:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605029695; cv=none; d=google.com; s=arc-20160816; b=kIEqRHgRrsdlppzQz56mnIBMMofIrAL0nEo9jk6SW1L9g23ZiuYcI9IbNz6OmQROr2 42BepJAIpdnSOITlzeeqUDc2rFexGkOyuTnPWhMMGmMI8P0e1w9zo/jrwYkGp62OQI8g HU+v3dr/5YuVfCOSSKPX2po/ag1Dgcs5iwj0V+5qBki36oal0HcTB9lD8rHvhGdPnTjj F9arJ86XIz2lnjH4G+6gfzHWGwp/t5D4Jyh+DU/ZH1/qQYtIVSkpZBU//9YnD0U+UMaQ yGYcvm7l/efbjGBvHrH4UyfiB8rPrldxmATZV9iDUpStuUHcUYB2Gfzj62lRmV7/73qE zUsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9zVnfWT/kePcxqOhf68I33NqWXFBDGvppNuEI4E5rYE=; b=nZGCUvXBwZ2Tpbq9O6Rb4Bg21PQMXtnFdwNbctN+AfTeSRWWXRAzGjUJoNLk11kCgw jFnOOIa2GFxASY9B6A3+W2asifclW2Mc/qHmn4goD+FVyn7bmpa+7RXt+EpwcgPJAKJr Nn9H77a5o9TpsDdTcSxq6NBK5SAB4wIS8gZA9QSw4/mZ8gQQnMRkaMW3UAwuudvAPr1L g13Jri7heiwZDmHr3s3wHOfRBH4f1KtfV3EM3oDwSpgUpVjCAHd6/LBY/h9ml5qn6jmh /zZ/iMNC4rEdt1F208vC21zbCFnWrR6wwFf/cWZ/dfaEOl3DUYxkr3TIyLwkPHWHI3PD EqKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MVfI/mI1"; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si9761066edb.489.2020.11.10.09.34.30; Tue, 10 Nov 2020 09:34:55 -0800 (PST) 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=@linaro.org header.s=google header.b="MVfI/mI1"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726688AbgKJRdH (ORCPT + 99 others); Tue, 10 Nov 2020 12:33:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbgKJRdG (ORCPT ); Tue, 10 Nov 2020 12:33:06 -0500 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EF39C0613CF for ; Tue, 10 Nov 2020 09:33:06 -0800 (PST) Received: by mail-pl1-x642.google.com with SMTP id w11so6821998pll.8 for ; Tue, 10 Nov 2020 09:33:06 -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=9zVnfWT/kePcxqOhf68I33NqWXFBDGvppNuEI4E5rYE=; b=MVfI/mI1n13XgDpXTRyKhljXo8trbSF0QGncs1VQDJW5qSNAad78ZBG85LcQL+gSeL /7cNmB9wC0DWkehgP14dTeRQBWfUQ7FuccWAvvxgj/KsQPQQpQ2BDoPiePLCe2aFUrz5 PzmWtSQBYC7OsgXeHMoGyO0mQI4/15gYwzUT2dv1Emnj6xadhyxbtnhYzWrUDnnRHDT9 1Kf2YQC2rD/XchXkfXxItC4k4twwKXyx5//Um9820CK4hR2RrOB/jIahojm+La/R8+/C TrEOZAyfQNJc8FhO+3dMVULCHdwbJqkwKk3E8ZsXj6vgx7gkBr3gFq6JWUeRRJsgIfuJ fxBA== 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=9zVnfWT/kePcxqOhf68I33NqWXFBDGvppNuEI4E5rYE=; b=t0VUkR3VReMTQ8wkoWiZxgb1qtS7Ke/GywxyhriN2ACr98zEB2MPcRQo4ByOp3rf84 6AACGb3Yb7p8VJUy9RGu12yaK115EKbQbrxui7VvsoOAlcmNjLSkCLotDeSKazfaKXOE kywx4iQrv1g1zt98M9rUN1zcmQY97Tntm0DRZ9T3I3D/ETxKSXkZPtq6p+L1ZecTVsvy IfyAW2/nBZMHS4BbDSWSgInYmmovaKmLTgZxoyr/lphjWQ9OL7UC45hAPmLh2yVZBKFJ ye8N2mBBTl+/LicREGOXI6ZDxgBlshLV61g8RI3QWfliDPnDlKGZLjOdfFPmjaLztg4v B/Rg== X-Gm-Message-State: AOAM531mz6Juk4O9EwxdH9qm84gKcjdeS/jSfMkmV/R+JU5EZx63Nfeb qAKQ6hVMMHDmbWIuqurTgQ1rIA== X-Received: by 2002:a17:902:a402:b029:d6:e257:c71a with SMTP id p2-20020a170902a402b02900d6e257c71amr17088228plq.49.1605029586070; Tue, 10 Nov 2020 09:33:06 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 199sm14528906pgg.18.2020.11.10.09.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 09:33:05 -0800 (PST) Date: Tue, 10 Nov 2020 10:33:03 -0700 From: Mathieu Poirier To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 23/26] coresight: etm4x: Detect system instructions support Message-ID: <20201110173303.GB3429138@xps15> References: <20201028220945.3826358-1-suzuki.poulose@arm.com> <20201028220945.3826358-25-suzuki.poulose@arm.com> <20201109202205.GB3396611@xps15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 09:31:42AM +0000, Suzuki K Poulose wrote: > On 11/9/20 8:22 PM, Mathieu Poirier wrote: > > On Wed, Oct 28, 2020 at 10:09:42PM +0000, Suzuki K Poulose wrote: > > > ETM v4.4 onwards adds support for system instruction access > > > to the ETM. Detect the support on an ETM and switch to using the > > > mode when available. > > > > > > Signed-off-by: Suzuki K Poulose > > > --- > > > .../coresight/coresight-etm4x-core.c | 39 +++++++++++++++++++ > > > 1 file changed, 39 insertions(+) > > > > > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > > > index 4bc2f15b6332..dc537b5612eb 100644 > > > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > > > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > > > @@ -675,6 +675,37 @@ static const struct coresight_ops etm4_cs_ops = { > > > .source_ops = &etm4_source_ops, > > > }; > > > +static inline bool cpu_supports_sysreg_trace(void) > > > +{ > > > + u64 dfr0 = read_sysreg_s(SYS_ID_AA64DFR0_EL1); > > > + > > > + return ((dfr0 >> ID_AA64DFR0_TRACEVER_SHIFT) & 0xfUL) > 0; > > > > I would do: > > > > return ((dfr0 >> ID_AA64DFR0_TRACEVER_SHIFT) & 0xfUL) == 1; > > > > Because any other value than '1' are reserved. > > Correct. However, this is something we follow for all ID features > in the arm64 kernel and is clarified in the Arm ARM (ARM DDI 0487F.a) : > > "D13.1.3 Principles of the ID scheme for fields in ID registers" > > Which guarantees that a (field > n) implies, everything that field == n > is implied. (Well there are exceptions listed in the section, but > TRACEVER is not one of those). So this should cover an old kernel > running on a future CPU, using the features that it understands. > (See feature_matches() in arch/arm64/kernel/cpufeature.c, which is > the fundamental logic to detect a feature). > While I haven't found anything conclusive in cpufeature.c, the documentation is clear on the fact that versions are incremental and build on top of previous ones. We can proceed with the current implementation. > Please let me know if you're OK with the justification. > > Thanks for the review. > > Suzuki