Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2134452rdb; Thu, 7 Dec 2023 21:40:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHONNZd33wPSzoEYVuNkXUpOrdbAsBthUy8GYdy3XYSFOpES7IyGbd39hyLRlEZGQSblsNE X-Received: by 2002:a05:6a20:3cac:b0:190:24f9:d563 with SMTP id b44-20020a056a203cac00b0019024f9d563mr973513pzj.49.1702014021340; Thu, 07 Dec 2023 21:40:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702014021; cv=none; d=google.com; s=arc-20160816; b=wRyaf1wCWuZQ/RC18RI4wwDCxzWi9wYBZKC+Ytvhb3JOZrSDRLb8bW2ySu/zvw8aUP Enb8QN3q684NDreKp3nYu4uj6OJ+pg6mcMml83hCul46FSM5fjFSdV2N9nWdats956yq FZHqym8WiCg5qjb3P/sOj23LJ+VXU1Vjp77HZj6yNQ4QSnYCWT8Dff9OkFOkRk6CYWVy A6DIAvnSuwK1BNqulAG6NTex8qNG6mxtI7iqBYEcsrP3JF4qJLR0oPZWZ/WIS5ieo2Mi HZsK225Ehq+sgWd7MOAgqtRXo9A7J8NQK0sraX5tY2E8L0+m+Jg2tQE5YG/mWSgXgQb5 Od5w== 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=RVJI/+IqXPck9wu4NZAh/RN0EH/lXxLHlA/rAJzeugA=; fh=78ZiYAsMqkMiOIWlhjjSgWn2SS9khyeUqw/r/4rUn1M=; b=dhZc/LjFLqECir5hpuHrw4lwYaVi8Bbl3wEMuwrwnpMIS2enZuAqzzgveyWaflhza7 Un47d4RnG40YWb+Pn4GOaaWt/l2FeVozY+ZaR2gobEalnWZjF0L+KwsymtwP3NesR+sc ptXVAceJWEn6w0fsW0GkpjqJi2cna0+NY3h8Dr1BUUaETpp0+w5YixrKTJSAsIbpD4Gh CcRHU3j5Bn2n3rbrWjXhYh8fa2bu/yWNtLT7wbhKYfcSNbY4KNkHX0X2drsNUIul9yNp Eq2TChOPSmtfHct6WvyLQQWMdeAgbgGPqTRGbQDvVVjDMnsRFhUWjGl1k7bxqhIPI6kO Zfvg== 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 t7-20020a170902bc4700b001cfb1db54f3si967717plz.431.2023.12.07.21.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 21:40:21 -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 74F2E80E87A2; Thu, 7 Dec 2023 21:40:18 -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 S233358AbjLHFkE (ORCPT + 99 others); Fri, 8 Dec 2023 00:40:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233169AbjLHFjz (ORCPT ); Fri, 8 Dec 2023 00:39:55 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EBA4C1721; Thu, 7 Dec 2023 21:40:01 -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 756A011FB; Thu, 7 Dec 2023 21:40:47 -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 3CBD73F5A1; Thu, 7 Dec 2023 21:39:56 -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 02/10] coresight: tmc: Extract device properties from AMBA pid based table lookup Date: Fri, 8 Dec 2023 11:09:31 +0530 Message-Id: <20231208053939.42901-3-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:18 -0800 (PST) This extracts device properties from AMBA pid based table lookup. This also defers tmc_etr_setup_caps() after the coresight device has been initialized so that pid value can be read. 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 Signed-off-by: Anshuman Khandual --- Changes in V3: - New patch in the series .../hwtracing/coresight/coresight-tmc-core.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c index c106d142e632..ad61d02f5f75 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -362,16 +362,24 @@ static inline bool tmc_etr_has_non_secure_access(struct tmc_drvdata *drvdata) return (auth & TMC_AUTH_NSID_MASK) == 0x3; } +#define TMC_AMBA_MASK 0xfffff + +static const struct amba_id tmc_ids[]; + /* Detect and initialise the capabilities of a TMC ETR */ -static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) +static int tmc_etr_setup_caps(struct device *parent, u32 devid) { int rc; - u32 dma_mask = 0; + u32 tmc_pid, dma_mask = 0; struct tmc_drvdata *drvdata = dev_get_drvdata(parent); + void *dev_caps; if (!tmc_etr_has_non_secure_access(drvdata)) return -EACCES; + tmc_pid = coresight_get_pid(&drvdata->csdev->access) & TMC_AMBA_MASK; + dev_caps = coresight_get_uci_data_from_amba(tmc_ids, tmc_pid); + /* Set the unadvertised capabilities */ tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps); @@ -487,10 +495,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.type = CORESIGHT_DEV_TYPE_SINK; desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_SYSMEM; desc.ops = &tmc_etr_cs_ops; - ret = tmc_etr_setup_caps(dev, devid, - coresight_get_uci_data(id)); - if (ret) - goto out; idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list = &etr_devs; @@ -528,6 +532,9 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) goto out; } + if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) + ret = tmc_etr_setup_caps(dev, devid); + drvdata->miscdev.name = desc.name; drvdata->miscdev.minor = MISC_DYNAMIC_MINOR; drvdata->miscdev.fops = &tmc_fops; -- 2.25.1