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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 72C83C55178 for ; Thu, 5 Nov 2020 21:56:39 +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 EB2E2206F7 for ; Thu, 5 Nov 2020 21:56:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ewX58Vp8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="e1Vtmd+I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB2E2206F7 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=jfSTfMPo8ZwSAPRt+jL9aMC/EeMMuQvIkhPwP2XbJFU=; b=ewX58Vp8NTR2ndWiISSYBGuWb ItdFKGTibmJoJOKvFYd3xV3E3owP8Bd6eKiEP7259ZPIvtmk2MtHIbkF9vtprYqVXmpTNDyqUquxt bi8iDOTus7Svn0NQmyBAnaArdLvWcQjb/F7JCa8TJ/Y9nNuq4drM5S8Kn9ELJFVzWEGGFVOQMS7pU kWZuJj8NWvO4iyMz6GEX2xUPxArIgex3Qv6vzczSk4eLmD2I8C4AooQv4gjaz0YwFkm90JKIK3jes EQ7iT5kE5NVv59Q8hcadLRq9p6nWpGkt4b0l0KG6RGkRnF5cnVKIs3ijBRXFPLwYgAiuMsKQqocv9 iAYhrXG/g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kanED-0000aa-PH; Thu, 05 Nov 2020 21:55:33 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kanEA-0000a0-UN for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 21:55:32 +0000 Received: by mail-pg1-x543.google.com with SMTP id z24so2304193pgk.3 for ; Thu, 05 Nov 2020 13:55:30 -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=W3oSD2X4Ee+VNtkgaLJ1P2CmikRQeSChjJ6u8CjZ9uA=; b=e1Vtmd+IdcYOZoob+Lum7vdjW199hyhsLyOaz6rkggtIk75kxUA448vj7DmktbxJ4M 7AKkK5Nc+5V6Lrbka73k7Pr8fz1o5kZ1oTyNYNVCWwXnq19937DEGNy/VTGnjS32kYeJ 7z4RAjQ+qctPttuZdium23gVJ75Ip5mQdmKTLoCmBFexhuL/tg37JcKvabymMwzFeBQD yUyR3oAu3FB3O3FpxtBWPG70UQIlK7FU2JNU/dM1HzwECjTNVN/JdIcaymARia01syjS OlgCqaj4NwzgXhT7iWHW+qF/GOHeQm40zJCyvsibzovuKITsxOAf7uvbTQmFDdq5mUfh jynQ== 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=W3oSD2X4Ee+VNtkgaLJ1P2CmikRQeSChjJ6u8CjZ9uA=; b=d+zt+JF+oKVgmiHToh5Mh7nZGIpcnfF42vcFbNO3mXC6dKFZ+GEtB+12Wl2uwBINrO XLg+XpdlZuAM8Awx6o4ABFwyc1fhZwqqVpBmXBWHr6plKJaT0YvihxcinoN/q88XfGr7 xuLqrupUzuJejuwN+Cn7GUM6DdLYJjpRe+1fAF2YyUGwixt+UY4ATAW7yToe9mtoRFBK TyMBqJ17uGjK5cvMFdV7uB/B2MFzOb1KL+koV/ZPGNczgj9DySNB4fmQp5UQDiAEmllv lMLpjNyv7cupBQuzZAgoZEs8eOrk1UYKO4yox1x6f+gqQ539nJh/xBoor7ush2mTGjoV Vamg== X-Gm-Message-State: AOAM533WqdbsM5o/YHZoFyTy86DZcTQ9p1FxbDAmlUiiSOP/rK8KgWt5 6S9C9gqK70MRKFevz6cA9gPqag== X-Google-Smtp-Source: ABdhPJw60dMNr+NG1rb/zJu1UFQ0fVWzWSbNTExpAzJbTwNwKDj4nEn8+4oYWnFJzGIxzQPTluCgQQ== X-Received: by 2002:a17:90a:e643:: with SMTP id ep3mr4565875pjb.211.1604613328910; Thu, 05 Nov 2020 13:55:28 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 3sm3721006pfv.92.2020.11.05.13.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 13:55:28 -0800 (PST) Date: Thu, 5 Nov 2020 14:55:26 -0700 From: Mathieu Poirier To: Suzuki K Poulose Subject: Re: [PATCH v3 17/26] coresight: etm4x: Cleanup secure exception level masks Message-ID: <20201105215526.GC3047244@xps15> References: <20201028220945.3826358-1-suzuki.poulose@arm.com> <20201028220945.3826358-19-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201028220945.3826358-19-suzuki.poulose@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_165531_133198_0183382A X-CRM114-Status: GOOD ( 24.12 ) 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: coresight@lists.linaro.org, linux-kernel@vger.kernel.org, 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 Wed, Oct 28, 2020 at 10:09:36PM +0000, Suzuki K Poulose wrote: > We rely on the ETM architecture version to decide whether > Secure EL2 is available on the CPU for excluding the level > for address comparators and viewinst main control register. > We must instead use the TRCDIDR3.EXLEVEL_S field to detect > the supported levels. > > Signed-off-by: Suzuki K Poulose > --- > drivers/hwtracing/coresight/coresight-etm4x-core.c | 13 +++---------- > drivers/hwtracing/coresight/coresight-etm4x.h | 6 ++++-- > 2 files changed, 7 insertions(+), 12 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index a12d58a04c5d..6e3f9cb7de3f 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -733,7 +733,6 @@ static void etm4_init_arch_data(void *info) > * TRCARCHMAJ, bits[11:8] architecture major versin number > */ > drvdata->arch = BMVAL(etmidr1, 4, 11); > - drvdata->config.arch = drvdata->arch; > > /* maximum size of resources */ > etmidr2 = etm4x_relaxed_read32(csa, TRCIDR2); > @@ -749,6 +748,7 @@ static void etm4_init_arch_data(void *info) > drvdata->ccitmin = BMVAL(etmidr3, 0, 11); > /* EXLEVEL_S, bits[19:16] Secure state instruction tracing */ > drvdata->s_ex_level = BMVAL(etmidr3, 16, 19); > + drvdata->config.s_ex_level = drvdata->s_ex_level; > /* EXLEVEL_NS, bits[23:20] Non-secure state instruction tracing */ > drvdata->ns_ex_level = BMVAL(etmidr3, 20, 23); > > @@ -920,16 +920,9 @@ static u64 etm4_get_ns_access_type(struct etmv4_config *config) > static u64 etm4_get_access_type(struct etmv4_config *config) > { > u64 access_type = etm4_get_ns_access_type(config); > - u64 s_hyp = (config->arch & 0x0f) >= 0x4 ? ETM_EXLEVEL_S_HYP : 0; > > - /* > - * EXLEVEL_S, bits[11:8], don't trace anything happening > - * in secure state. > - */ > - access_type |= (ETM_EXLEVEL_S_APP | > - ETM_EXLEVEL_S_OS | > - s_hyp | > - ETM_EXLEVEL_S_MON); > + /* All supported secure ELs are excluded */ > + access_type |= (u64)config->s_ex_level << TRCACATR_EXLEVEL_SHIFT; > > return access_type; > } > diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h > index e7f6b7b16fb7..2ac4ecb0af61 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x.h > +++ b/drivers/hwtracing/coresight/coresight-etm4x.h > @@ -546,6 +546,8 @@ > /* PowerDown Control Register bits */ > #define TRCPDCR_PU BIT(3) > > +#define TRCACATR_EXLEVEL_SHIFT 8 > + > /* secure state access levels - TRCACATRn */ > #define ETM_EXLEVEL_S_APP BIT(8) > #define ETM_EXLEVEL_S_OS BIT(9) > @@ -615,7 +617,7 @@ > * @vmid_mask0: VM ID comparator mask for comparator 0-3. > * @vmid_mask1: VM ID comparator mask for comparator 4-7. > * @ext_inp: External input selection. > - * @arch: ETM architecture version (for arch dependent config). > + * @s_ex_level: Secure ELs where tracing is supported. > */ > struct etmv4_config { > u32 mode; > @@ -659,7 +661,7 @@ struct etmv4_config { > u32 vmid_mask0; > u32 vmid_mask1; > u32 ext_inp; > - u8 arch; > + u8 s_ex_level; Instead of making s_ex_level redundant I suggest to pass a struct etmv4_drvdata to etm4_get_access_type(). More comments to come tomorrow. Thanks, Mathieu > }; > > /** > -- > 2.24.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel