Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp807429pxb; Tue, 12 Apr 2022 14:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhES0E+/bU6NB83fi7QVb/ERsG0HCrg5/pJPiQo2YN7EHzEhVPxlW3MlQJkGSGWjuCQPL4 X-Received: by 2002:a17:90a:ba13:b0:1cb:6296:ce41 with SMTP id s19-20020a17090aba1300b001cb6296ce41mr7076700pjr.104.1649797278393; Tue, 12 Apr 2022 14:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649797278; cv=none; d=google.com; s=arc-20160816; b=VR09WJVgy1AJy9laDrHWlAlJ1dMC75cAo+tY0qIUOi0fjbspino7WckQWOMDVczo9d aTIMMm72MsAY/croBodhWpaHjhckZs7Daq5yZIsy9C1PiIVpphP+ybx4OzkibbK9DN9I vJUDKELC+VkbcXcaJI9aDETdQFvwiRcp80V3Yxem3dw3aycJZaDCnERBpOeno5qdqkj0 52x1msqtXIrsnyP7xljlL5ZO1Gr2LP/nvBLSawE+6+8jKpoVG4VvmusPsUioBel3xy7+ 8zyBFczwy9ecS25YOp66wzf6NyoQkLqwJtp3qhWfLZ4kIfo+5HZReCQDgDoHd6B2gyDN iEJQ== 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=yXu2KEOQrQmmf/qE2DwSD4OVXGnj91SlN5UJEVCoaX4=; b=NvG1awWPwY2fjByHTuTfi/Vt2iAYY/cX/3+LXoHBjpdCO+ay/pc4PdSs9T48PbPgWg CGZr0GZSxlQCPsEQSePUy1Y/SrMhglryZAL1QfKvn37hd968+pYN5n9oqX1ARtZKDsY3 77w6d6CINYrVYQLXRTFhDF01iRGLEIKye+ZPAQD+p24bkehCQ2rb+I5rNCNwVTzbQBmQ o/E7JHOVVw0EmUDGxqBqPpE8ixiCFVI1OpslX2hr6LFWxKQggg4jndpE16D2nXnifQha 6HFuZF5nLRA3uDzcN88fSy3xq2auzJZjLKo7jn/gbGkoAeUzjTplj5WQjw8yojhUjZ3u xmAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k1kvR5j2; 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 a20-20020a17090a8c1400b001ca59a7334csi1689249pjo.65.2022.04.12.14.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:01:18 -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=k1kvR5j2; 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 72D4CD7448; Tue, 12 Apr 2022 13:23:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391745AbiDLJgL (ORCPT + 99 others); Tue, 12 Apr 2022 05:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390748AbiDLJZQ (ORCPT ); Tue, 12 Apr 2022 05:25:16 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3225B57B07 for ; Tue, 12 Apr 2022 01:42:12 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id r64so11471679wmr.4 for ; Tue, 12 Apr 2022 01:42:11 -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=yXu2KEOQrQmmf/qE2DwSD4OVXGnj91SlN5UJEVCoaX4=; b=k1kvR5j2afkTP9a2drwU91TqKmsM7sIfsv9Po7Fo9CFf+2X2chyJ6aos8nW69Qua+x dtulxm7VVZ58zjw088Gd4yfWIhpOyh9Do4WHr18sRZmekJRb9q1Pjb5/bBvSZotyo8tK ChxSVd+o8g4+BMvMnn3eg7/eHa+bbZuP4NF8cmf+osIBKcO86m50ATcqrXCReKN9cLKV ewDviUG2ndzjiFPLKw1a+zAFLwH7zr4cM2BEcOuQPgTGqxaAAJ7AE6CW/ZxodqV/RAes q1hdz8du1VmpGa3BWKQkfLTb4swr6DSR/eFpQb6FgJUOZL90gN5eMKI45GZcXKJcQ1jK s1uw== 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=yXu2KEOQrQmmf/qE2DwSD4OVXGnj91SlN5UJEVCoaX4=; b=OHgdA1aebVHzqlGqAlazMBfy1jztvZMNXT+BJY5uwJcAN8uS1CZ3U8B9PQVK80S1+v 3Vk2NNxnDDGIkkZ7Gw3cJQpbgjK+zC5KATf7GyGxS2FEYNTYahUUOROnt3q699Qdhgd0 7CjKLbnnPyDSns6IFZSlJWpE5R7fF0VEneXfS6g40XhRudP16MmvkzR2315cSV8UkUC5 3OQhAJ0iObhg4tniwTbrjvCCY0hEClhmBjhSq9GWg6Qp/T5qvdrduywASE+tJS494QLf 8T+5+tSgfhfxF4EjrwK+baqz8hB4z6sYDxsZTVNzPVLcXCMgbveDzSOkcSfJRwX59zXM P9aQ== X-Gm-Message-State: AOAM533oSpXNUAYGt2akz0bAKgw1xEdF+9G9be78qtf3Ib0Lo1+/gmtf 5DRHwhgqAPzdgyXOi8Osui2/lRDdugF4gQvrMbIpZQ== X-Received: by 2002:a7b:cbc2:0:b0:388:faec:2036 with SMTP id n2-20020a7bcbc2000000b00388faec2036mr3090378wmi.190.1649752930571; Tue, 12 Apr 2022 01:42:10 -0700 (PDT) MIME-Version: 1.0 References: <20220304171913.2292458-1-james.clark@arm.com> <20220304171913.2292458-6-james.clark@arm.com> In-Reply-To: <20220304171913.2292458-6-james.clark@arm.com> From: Mike Leach Date: Tue, 12 Apr 2022 09:41:59 +0100 Message-ID: Subject: Re: [PATCH v3 05/15] coresight: etm4x: Cleanup TRCIDR5 register accesses To: James Clark Cc: suzuki.poulose@arm.com, coresight@lists.linaro.org, Anshuman.Khandual@arm.com, mathieu.poirier@linaro.org, leo.yan@linaro.com, Leo Yan , 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 > --- > .../hwtracing/coresight/coresight-etm4x-core.c | 18 ++++++------------ > drivers/hwtracing/coresight/coresight-etm4x.h | 7 +++++++ > 2 files changed, 13 insertions(+), 12 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index c52ab7f29f41..3f4263117570 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -1188,26 +1188,20 @@ static void etm4_init_arch_data(void *info) > > etmidr5 = etm4x_relaxed_read32(csa, TRCIDR5); > /* NUMEXTIN, bits[8:0] number of external inputs implemented */ > - drvdata->nr_ext_inp = BMVAL(etmidr5, 0, 8); > + drvdata->nr_ext_inp = FIELD_GET(TRCIDR5_NUMEXTIN_MASK, etmidr5); > /* TRACEIDSIZE, bits[21:16] indicates the trace ID width */ > - drvdata->trcid_size = BMVAL(etmidr5, 16, 21); > + drvdata->trcid_size = FIELD_GET(TRCIDR5_TRACEIDSIZE_MASK, etmidr5); > /* ATBTRIG, bit[22] implementation can support ATB triggers? */ > - if (BMVAL(etmidr5, 22, 22)) > - drvdata->atbtrig = true; > - else > - drvdata->atbtrig = false; > + drvdata->atbtrig = !!(etmidr5 & TRCIDR5_ATBTRIG); > /* > * LPOVERRIDE, bit[23] implementation supports > * low-power state override > */ > - if (BMVAL(etmidr5, 23, 23) && (!drvdata->skip_power_up)) > - drvdata->lpoverride = true; > - else > - drvdata->lpoverride = false; > + drvdata->lpoverride = (etmidr5 & TRCIDR5_LPOVERRIDE) && (!drvdata->skip_power_up); > /* NUMSEQSTATE, bits[27:25] number of sequencer states implemented */ > - drvdata->nrseqstate = BMVAL(etmidr5, 25, 27); > + drvdata->nrseqstate = FIELD_GET(TRCIDR5_NUMSEQSTATE_MASK, etmidr5); > /* NUMCNTR, bits[30:28] number of counters available for tracing */ > - drvdata->nr_cntr = BMVAL(etmidr5, 28, 30); > + drvdata->nr_cntr = FIELD_GET(TRCIDR5_NUMCNTR_MASK, etmidr5); > etm4_cs_lock(drvdata, csa); > cpu_detect_trace_filtering(drvdata); > } > diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h > index c9c5fd655196..3b604cde668b 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x.h > +++ b/drivers/hwtracing/coresight/coresight-etm4x.h > @@ -165,6 +165,13 @@ > #define TRCIDR4_NUMCIDC_MASK GENMASK(27, 24) > #define TRCIDR4_NUMVMIDC_MASK GENMASK(31, 28) > > +#define TRCIDR5_NUMEXTIN_MASK GENMASK(8, 0) > +#define TRCIDR5_TRACEIDSIZE_MASK GENMASK(21, 16) > +#define TRCIDR5_ATBTRIG BIT(22) > +#define TRCIDR5_LPOVERRIDE BIT(23) > +#define TRCIDR5_NUMSEQSTATE_MASK GENMASK(27, 25) > +#define TRCIDR5_NUMCNTR_MASK GENMASK(30, 28) > + > /* > * System instructions to access ETM registers. > * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions > -- > 2.28.0 > Reviewed-by: Mike Leach -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK