Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2134371rdb; Thu, 7 Dec 2023 21:40:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPWfp+VcFGnidbEGKy0TNB5GgNtjzj8wInpHtrP6QsT0iTrHXxAqPAC0nFtubKNp0Ej0rb X-Received: by 2002:a05:6a00:2d01:b0:6cd:ec0b:61ae with SMTP id fa1-20020a056a002d0100b006cdec0b61aemr3965236pfb.0.1702014008877; Thu, 07 Dec 2023 21:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702014008; cv=none; d=google.com; s=arc-20160816; b=Yx1GrAJnPo/c6KMBcpIV2w/pevhvl0tIIGgSZG0Z2rHPKGNBKLZN0PZe6caey1Is0w 2poGdLjslaPNEuV3f38UXXDX+1I/W6EPzeQmq1btUBZ5dwymn24Xwj0+VGjnL26DRoHs E0iYoTW3LclRivzKVan8NkjW2CG/p7d58LcAqfK23mXgKBkxVkU8Vk9gI6GcmhWTJgNi JTeuQaWENjG2y6+ANW8ObYIl6DJ3bse8IzvChQ5kVZXhkJCWq1QsPv6xglW1PKE0Ln9M z85P5lNryJponlVscg/gJylUSDKoGVx9BigLkZ65qdlQK2jgwr2y2ka6BRKSh9jjDqEz MvWg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cJ03cU0lziXgwO0If0qhZATs2w+STvionEFKerycSsk=; fh=78ZiYAsMqkMiOIWlhjjSgWn2SS9khyeUqw/r/4rUn1M=; b=p4WPBYXoOgQoQNGzs7rhY+5ta9C7rYhfbeR6SP17R+l9ezjzsS1/naGJvPKdJIbVvF gR/KWV/AVOzU432seq7BrQ5QxTRnrsKhF25HUvj6aMr4MhyWv7a5BmD52hrYN9PjxRKY NNDgCnWrnnART9H8nO27QFiwicWzkNMgYv8fGEqwEBgvioIQzAQnCpQoJ9IcfJkuGuWJ Nc0aZcMUkp8OvdMIwrnHCU9rorINTnhvcKGoJIWg4pOtGT93rxkI6ZJMFjfmkShYh+IQ umdPCOld9BTUC75yNgNpey7WK25zRb1HjSUpy5enTwPeu7JaF//JYiAVNRyiugSgYMLi u4RA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id k2-20020a63f002000000b005bdf597ed49si987185pgh.56.2023.12.07.21.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 21:40:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 47EE180EA82B; Thu, 7 Dec 2023 21:40:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229476AbjLHFjx (ORCPT + 99 others); Fri, 8 Dec 2023 00:39:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbjLHFju (ORCPT ); Fri, 8 Dec 2023 00:39:50 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DB8BE171C; Thu, 7 Dec 2023 21:39:56 -0800 (PST) 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 5F10F139F; Thu, 7 Dec 2023 21:40:42 -0800 (PST) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.41.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5D4503F5A1; Thu, 7 Dec 2023 21:39:52 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: Anshuman Khandual , Lorenzo Pieralisi , Sudeep Holla , Mike Leach , James Clark , Maxime Coquelin , Alexandre Torgue , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH V3 01/10] coresight: stm: Extract device name from AMBA pid based table lookup Date: Fri, 8 Dec 2023 11:09:30 +0530 Message-Id: <20231208053939.42901-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231208053939.42901-1-anshuman.khandual@arm.com> References: <20231208053939.42901-1-anshuman.khandual@arm.com> 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 21:40:07 -0800 (PST) Instead of using AMBA private data field, extract the device name from AMBA pid based table lookup using new coresight_get_uci_data_from_amba() helper. Cc: Suzuki K Poulose Cc: Mike Leach Cc: James Clark Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Signed-off-by: Anshuman Khandual --- Changes in V3: - New patch in the series drivers/hwtracing/coresight/coresight-priv.h | 10 ++++++++++ drivers/hwtracing/coresight/coresight-stm.c | 14 +++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 767076e07970..68cbb036cec8 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -221,6 +221,16 @@ static inline void *coresight_get_uci_data(const struct amba_id *id) return uci_id->data; } +static inline void *coresight_get_uci_data_from_amba(const struct amba_id *table, u32 pid) +{ + while (table->mask) { + if ((table->id & table->mask) == pid) + return coresight_get_uci_data(table); + table++; + }; + return NULL; +} + void coresight_release_platform_data(struct coresight_device *csdev, struct device *dev, struct coresight_platform_data *pdata); diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index a1c27c901ad1..9cdca4f86cab 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -804,6 +804,18 @@ static void stm_init_generic_data(struct stm_drvdata *drvdata, drvdata->stm.set_options = stm_generic_set_options; } +#define STM_AMBA_MASK 0xfffff + +static const struct amba_id stm_ids[]; + +static char *stm_csdev_name(struct coresight_device *csdev) +{ + u32 stm_pid = coresight_get_pid(&csdev->access) & STM_AMBA_MASK; + void *uci_data = coresight_get_uci_data_from_amba(stm_ids, stm_pid); + + return uci_data ? (char *)uci_data : "STM"; +} + static int stm_probe(struct amba_device *adev, const struct amba_id *id) { int ret, trace_id; @@ -900,7 +912,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) pm_runtime_put(&adev->dev); dev_info(&drvdata->csdev->dev, "%s initialized\n", - (char *)coresight_get_uci_data(id)); + stm_csdev_name(drvdata->csdev)); return 0; cs_unregister: -- 2.25.1