Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5636944rwd; Mon, 5 Jun 2023 06:36:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5G/rjsSfmL9gMAnC1TChKuBHil2FfCFxsGr3sNIcvLCRAyzCQc0NLXoQWVvfokuUycRX+F X-Received: by 2002:a05:6a21:33a8:b0:10e:e9a1:35c9 with SMTP id yy40-20020a056a2133a800b0010ee9a135c9mr2830377pzb.60.1685972209863; Mon, 05 Jun 2023 06:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685972209; cv=none; d=google.com; s=arc-20160816; b=j8D0eTLE63NDhiIGsPSN7LSZHFhno7D9c7moRhNIXx/yQ3YnH+2EwbShWyrz8lLWMf zAvNkC8YfmTn2aLrQmFxB8t3GMhIi8C/Dq/tlAIIjY8obxDCDvTjGHd7eYYdIDhwdq7G +hNq3W0dZGA9nWfOMpSptFLgTpoWHFfOmrILqEh1597hBxDhh1nUsxIRN9KKAchoFfKA gIUL2ExuF0KJX3cbJ3Ajr4X1Pa2LN9pc9gh5OnoU/S11K9VdLaMUr/CFPUy6r8pedo0L TdCS87X48Lcy4TECYFPuzquAB4XFXIg/RjmYMvHBvtESQ7vLWcaIeN9TsxdiNvrSaDOK +3Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=okf3F4YnZSvZQB6lsRJ/UNaCYgvo6csXNY/tscdXwfY=; b=oRliFB8aprunoVkjfTKG48auxgptJ2HeZvwMYsstTdAx1YyxqPWf/YBv0bXKbO3ykS SjzCNiahCNu/Zx/9Hd6hluVJM4+QHgz0JLf6+PYYo4TpPhzN9Cs6yoo1CmvgceIE5CnN wh6T1qttDRTiGDnnUjaS/pch6s9zsFXzD8KbD6fPyfzhUAGOzuGC0ktCEvbc4ctxkLuW 0CqbLuTma638+6Disi6hFb2UQkXiTE0nwYu0p+gstT7LgdLJDH6SAL/dOiJjkeuY83zS 19KabYKYVqN+Y0t0HV9L+20Plpy5ddZTGdZJJtreiLF0mW+dtL99X6uYqcbp9yJpfQfC /2WQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a630a4f000000b00542924cbf75si5367998pgk.235.2023.06.05.06.36.33; Mon, 05 Jun 2023 06:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231786AbjFENar (ORCPT + 99 others); Mon, 5 Jun 2023 09:30:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbjFENaq (ORCPT ); Mon, 5 Jun 2023 09:30:46 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F9B6CD for ; Mon, 5 Jun 2023 06:30:43 -0700 (PDT) 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 846C5D75; Mon, 5 Jun 2023 06:31:28 -0700 (PDT) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C152D3F663; Mon, 5 Jun 2023 06:30:41 -0700 (PDT) From: Suzuki K Poulose To: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Suzuki K Poulose , Anshuman Khandual , Rob Herring , frowand.list@gmail.com, linux@armlinux.org.uk, Mike Leach Subject: [PATCH] coresight: etm4x: Match all ETM4 instances based on DEVARCH and DEVTYPE Date: Mon, 5 Jun 2023 14:30:30 +0100 Message-Id: <20230605133031.1827626-1-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Instead of adding the PIDs forever to the list for the new CPUs, let us detect a component to be ETMv4 based on the CoreSight CID, DEVTYPE=PE_TRACE and DEVARCH=ETMv4. This is already done for some of the ETMs. We can extend the PID matching to match the PIDR2:JEDEC, BIT[3], which must be 1 (RA0) always. Link: https://lkml.kernel.org/r/20230317030501.1811905-1-anshuman.khandual@arm.com Cc: Anshuman Khandual Cc: Rob Herring Cc: frowand.list@gmail.com Cc: linux@armlinux.org.uk Cc: Mike Leach Signed-off-by: Suzuki K Poulose --- .../coresight/coresight-etm4x-core.c | 5 +++++ drivers/hwtracing/coresight/coresight-priv.h | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 4c15fae534f3..8a2e24d5686a 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2260,6 +2260,11 @@ static const struct amba_id etm4_ids[] = { CS_AMBA_UCI_ID(0x000cc0af, uci_id_etm4),/* Marvell ThunderX2 */ CS_AMBA_UCI_ID(0x000b6d01, uci_id_etm4),/* HiSilicon-Hip08 */ CS_AMBA_UCI_ID(0x000b6d02, uci_id_etm4),/* HiSilicon-Hip09 */ + /* + * Match all PIDs with ETM4 DEVARCH. No need for adding any of the new + * CPUs to the list here. + */ + CS_AMBA_MATCH_ALL_UCI(uci_id_etm4), {}, }; diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 595ce5862056..72ec36c9232c 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -193,12 +193,27 @@ extern void coresight_remove_cti_ops(void); } /* coresight AMBA ID, full UCI structure: id table entry. */ -#define CS_AMBA_UCI_ID(pid, uci_ptr) \ +#define __CS_AMBA_UCI_ID(pid, m, uci_ptr) \ { \ .id = pid, \ - .mask = 0x000fffff, \ + .mask = m, \ .data = (void *)uci_ptr \ } +#define CS_AMBA_UCI_ID(pid, uci) __CS_AMBA_UCI_ID(pid, 0x000fffff, uci) +/* + * PIDR2[JEDEC], BIT(3) must be 1 (Read As One) to indicate that rest of the + * PIDR1, PIDR2 DES_* fields follow JEDEC encoding for the designer. Use that + * as a match value for blanket matching all devices in the given CoreSight + * device type and architecture. + */ +#define PIDR2_JEDEC BIT(3) +#define PID_PIDR2_JEDEC (PIDR2_JEDEC << 16) +/* + * Match all PIDs in a given CoreSight device type and architecture, defined + * by the uci. + */ +#define CS_AMBA_MATCH_ALL_UCI(uci) \ + __CS_AMBA_UCI_ID(PID_PIDR2_JEDEC, PID_PIDR2_JEDEC, uci) /* extract the data value from a UCI structure given amba_id pointer. */ static inline void *coresight_get_uci_data(const struct amba_id *id) -- 2.34.1