Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp57463pxb; Tue, 12 Apr 2022 16:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb2RvH6B/U4CVjkfNqtQKczbkAPq2rUCB0mKIHngkjcdvCgGFUtRkp3SsDU91N4pNVFRQw X-Received: by 2002:a05:6a00:801:b0:505:ccc3:15bf with SMTP id m1-20020a056a00080100b00505ccc315bfmr6990345pfk.57.1649807001851; Tue, 12 Apr 2022 16:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649807001; cv=none; d=google.com; s=arc-20160816; b=IPaFafYR43uUJ7HfV3jsmm4PtkxVKFCKWWz6Uwejf6ar7z4mUMtAgUoTzz1xEfEUp8 OA1EGz9fVSn1OEWUZlhCaf4caG3dgkW8nH4zxXAJMSWprs1Ykq90cbXbRI/iX6w8KX4R /GV6oMchJe77Ug+Q/HpULvmBbZtzpiAUjEjn0iLa7lAuA7lMLbth7yWxQ3EWngKy8fxE /Bydns7Ui/yjKbTt4q0GiCQbEVb4ssmBubXgT7s2K6fqvkYs0GFqtXEZFbj6xn1nll0J uF2nlItBDk+631v5XdmcvkfvXh/z881Yaqeh4reNom3+RFJHch6svdYvuZ1K30jhJmOt 4kfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=CqvBmP+Qc0+EuRXZjCQaYGdhPsRI95L6d6IBMT4+9C4=; b=G2e/GmaLXp9e4fs+PEbwEi5u3Zr4zcaXGWNKWYqktQ3bUf3NGGYhza2J2gcmJ0fMmY 4Ii4KS4a3frTuykbepDPa39Z+whhuXJzpVH6B7fdjyT4lL9+QL343tlZq8kFHOW0JkFv Bizrxh9YQTBRnKRenEa6bjHq7a8YL91U6vC0adWTg2omgd8M8k55rQiEJ/oi5Ffup2tP 7O9Dhy6nRDkdKkjQTowgE9Kq1e/5EFqSo3BG9mg6tbnUqiN9l9NSe6pPuHtiUBywBL5t 0WZQy4xkZEzgkgpLBwGwOYjXywXekr0MbXL+bG+4Qu0KMOd+03nI2cqBSA4X8JKW6o/o KCbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rsVtHOQa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w191-20020a6382c8000000b003816043ee1asi4181615pgd.15.2022.04.12.16.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rsVtHOQa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 60BFB1C8DB2; Tue, 12 Apr 2022 14:35:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377414AbiDLJfJ (ORCPT + 99 others); Tue, 12 Apr 2022 05:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388634AbiDLJWf (ORCPT ); Tue, 12 Apr 2022 05:22:35 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A9B72662 for ; Tue, 12 Apr 2022 01:29:07 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id i20so13455408wrb.13 for ; Tue, 12 Apr 2022 01:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CqvBmP+Qc0+EuRXZjCQaYGdhPsRI95L6d6IBMT4+9C4=; b=rsVtHOQaJ9doBkbGLUnKPy/TDXrqUhyOrvVYLBBHT4Ful8BQ9j7zk2pqxD+3gI4LEL 1h0vsG1MIP+9vgqB/Ut2B+tAwiNhwV6d2ovlMnv19Ldmd2dkbExOgSnsRYnAIaq273u6 L3pLSzlndrAcmkG4HgL23adAdW2Ed/3DxgUuqhiqKdFvmhrrgWClg2PJG7PuGByShg7/ SaAXQs9vUS7Yc1U5eFciQxMGCyQKLqNZV8L2XNJUOvaAYYT9nfFVSd/1Q57rY/ffZDXL 2O4HkZc1etowuJNkjHzcNLk1LPv39Jr6Kniurdf1mrlQ/4PhdPNCcRtiPLSPEsjygz0B XyvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CqvBmP+Qc0+EuRXZjCQaYGdhPsRI95L6d6IBMT4+9C4=; b=KOr9XmmPkVRZmJdb8E8+FOrWly35345zqFlXj+yiyX+jyAuH10gJmzsE1PCU9QL/Le omvsym9jMNkG9sbgenrt5DvGt989nK7oyVidYOZu67OM27uhIHnbOI5jKzVpdnVJsBLq OyNrhhYbQ3kVo6LzQY7Q/gPlcOQFNVnbqiaoc1NIntfemmHLceEvbI74IJ0BIv0mKzCT /io9Mc16jAYSqvgJbQHT3x828fb5vwDRhy9OZueKnGobr1f0BnuRY9itWUqwNPBjndDQ Bm9COYt+TqQECC9xUfmwa8fDHDXolxvaRoIx9OBVaO+bnRqw7iK+TFQutQVP0QY0i3Nx owDg== X-Gm-Message-State: AOAM531OXmx6QS2/bhp+Q93Ibgh5FXAnDIiScRengRYw0SHEj7zkBiTj kxeo0+RWaIUz/EEqJGoholS/p51h/7wqa4Yysj0T6A== X-Received: by 2002:adf:816b:0:b0:203:7fae:a245 with SMTP id 98-20020adf816b000000b002037faea245mr28603032wrm.619.1649752145967; Tue, 12 Apr 2022 01:29:05 -0700 (PDT) MIME-Version: 1.0 References: <20220304171913.2292458-1-james.clark@arm.com> <20220304171913.2292458-2-james.clark@arm.com> In-Reply-To: <20220304171913.2292458-2-james.clark@arm.com> From: Mike Leach Date: Tue, 12 Apr 2022 09:28:54 +0100 Message-ID: Subject: Re: [PATCH v3 01/15] coresight: etm4x: Cleanup TRCIDR0 register accesses To: James Clark Cc: suzuki.poulose@arm.com, coresight@lists.linaro.org, Anshuman.Khandual@arm.com, leo.yan@linaro.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 4 Mar 2022 at 17:19, James Clark wrote: > > This is a no-op change for style and consistency and has no effect on > the binary output by the compiler. In sysreg.h fields are defined as > the register name followed by the field name and then _MASK. This > allows for grepping for fields by name rather than using magic numbers. > > Signed-off-by: James Clark > --- > .../coresight/coresight-etm4x-core.c | 36 +++++-------------- > drivers/hwtracing/coresight/coresight-etm4x.h | 13 +++++++ > 2 files changed, 21 insertions(+), 28 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index 7f416a12000e..9120390a7613 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -1097,41 +1097,21 @@ static void etm4_init_arch_data(void *info) > etmidr0 = etm4x_relaxed_read32(csa, TRCIDR0); > > /* INSTP0, bits[2:1] P0 tracing support field */ > - if (BMVAL(etmidr0, 1, 2) == 0b11) > - drvdata->instrp0 = true; > - else > - drvdata->instrp0 = false; > - > + drvdata->instrp0 = !!(FIELD_GET(TRCIDR0_INSTP0_MASK, etmidr0) == 0b11); > /* TRCBB, bit[5] Branch broadcast tracing support bit */ > - if (BMVAL(etmidr0, 5, 5)) > - drvdata->trcbb = true; > - else > - drvdata->trcbb = false; > - > + drvdata->trcbb = !!(etmidr0 & TRCIDR0_TRCBB); > /* TRCCOND, bit[6] Conditional instruction tracing support bit */ > - if (BMVAL(etmidr0, 6, 6)) > - drvdata->trccond = true; > - else > - drvdata->trccond = false; > - > + drvdata->trccond = !!(etmidr0 & TRCIDR0_TRCCOND); > /* TRCCCI, bit[7] Cycle counting instruction bit */ > - if (BMVAL(etmidr0, 7, 7)) > - drvdata->trccci = true; > - else > - drvdata->trccci = false; > - > + drvdata->trccci = !!(etmidr0 & TRCIDR0_TRCCCI); > /* RETSTACK, bit[9] Return stack bit */ > - if (BMVAL(etmidr0, 9, 9)) > - drvdata->retstack = true; > - else > - drvdata->retstack = false; > - > + drvdata->retstack = !!(etmidr0 & TRCIDR0_RETSTACK); > /* NUMEVENT, bits[11:10] Number of events field */ > - drvdata->nr_event = BMVAL(etmidr0, 10, 11); > + drvdata->nr_event = FIELD_GET(TRCIDR0_NUMEVENT_MASK, etmidr0); > /* QSUPP, bits[16:15] Q element support field */ > - drvdata->q_support = BMVAL(etmidr0, 15, 16); > + drvdata->q_support = FIELD_GET(TRCIDR0_QSUPP_MASK, etmidr0); > /* TSSIZE, bits[28:24] Global timestamp size field */ > - drvdata->ts_size = BMVAL(etmidr0, 24, 28); > + drvdata->ts_size = FIELD_GET(TRCIDR0_TSSIZE_MASK, etmidr0); > > /* maximum size of resources */ > etmidr2 = etm4x_relaxed_read32(csa, TRCIDR2); > diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h > index 3c4d69b096ca..300741fbc0de 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x.h > +++ b/drivers/hwtracing/coresight/coresight-etm4x.h > @@ -130,6 +130,19 @@ > > #define TRCRSR_TA BIT(12) > > +/* > + * Bit positions of registers that are defined above, in the sysreg.h style > + * of _MASK for multi bit fields and BIT() for single bits. > + */ > +#define TRCIDR0_INSTP0_MASK GENMASK(2, 1) > +#define TRCIDR0_TRCBB BIT(5) > +#define TRCIDR0_TRCCOND BIT(6) > +#define TRCIDR0_TRCCCI BIT(7) > +#define TRCIDR0_RETSTACK BIT(9) > +#define TRCIDR0_NUMEVENT_MASK GENMASK(11, 10) > +#define TRCIDR0_QSUPP_MASK GENMASK(16, 15) > +#define TRCIDR0_TSSIZE_MASK GENMASK(28, 24) > + > /* > * System instructions to access ETM registers. > * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions > -- > 2.28.0 > > _______________________________________________ > CoreSight mailing list -- coresight@lists.linaro.org > To unsubscribe send an email to coresight-leave@lists.linaro.org Reviewed-by: Mike Leach -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK