From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8F9AC433FE for ; Mon, 3 Oct 2022 09:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uDDybE7ppB8Ha9KiX8qTcwTXpQ0+DXRPvqr43rD/Z60=; b=z8hdT5LF90FrS5 Cox4asLhLQsxbgIHu0VFwoTpkPOwYmUebryyzLo+PvfYaexjitgMBbRGhAEnlX/Qo7nA+d6pmhDO7 bJNGQkujHv7jl4LDPOMS2H9Mz8/uAtPydZzMsqcNmCiV7F/4u0K2R5BZ6YUXJjC5oFdhmyAuy0m0S SjKHgKiLRpqy61UnwYb8PKEi97FwBHacExJsFFiXq7zplOXykUm7H1PdNxiJwrrtj9Wp4mj43az4P M4fsYKbdASN/wv+scja/YA+oPTRPx3pWXQBSEc1NqqOkk2/agi/AXEp24vn/UQC2RowWlMLFKdOgo e/rOra0hMX6ICErZpoOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofHND-004t4z-Au; Mon, 03 Oct 2022 09:04:27 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofHNA-004t1R-9g for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 09:04:26 +0000 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 70A861042; Mon, 3 Oct 2022 02:04:29 -0700 (PDT) Received: from [192.168.4.86] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E27513F792; Mon, 3 Oct 2022 02:04:20 -0700 (PDT) Message-ID: <65e70db9-9f85-7285-0602-f2d29887550a@arm.com> Date: Mon, 3 Oct 2022 10:04:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH v3 03/13] coresight: stm: Update STM driver to use Trace ID API To: Mike Leach , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, quic_jinlmao@quicinc.com References: <20220809223401.24599-1-mike.leach@linaro.org> <20220809223401.24599-4-mike.leach@linaro.org> From: Suzuki K Poulose In-Reply-To: <20220809223401.24599-4-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221003_020424_464249_B2BAD35F X-CRM114-Status: GOOD ( 26.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 09/08/2022 23:33, Mike Leach wrote: > Updates the STM driver to use the trace ID allocation API. > This uses the _system_id calls to allocate an ID on device poll, > and release on device remove. > > The sysfs access to the STMTRACEIDR register has been changed from RW > to RO. Having this value as writable is not appropriate for the new > Trace ID scheme - and had potential to cause errors in the previous > scheme if values clashed with other sources. > > Signed-off-by: Mike Leach > Reviewed-by: Suzuki K Poulose > --- > drivers/hwtracing/coresight/coresight-stm.c | 41 +++++++-------------- > 1 file changed, 14 insertions(+), 27 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c > index bb14a3a8a921..9ef3e923a930 100644 > --- a/drivers/hwtracing/coresight/coresight-stm.c > +++ b/drivers/hwtracing/coresight/coresight-stm.c > @@ -31,6 +31,7 @@ > #include > > #include "coresight-priv.h" > +#include "coresight-trace-id.h" > > #define STMDMASTARTR 0xc04 > #define STMDMASTOPR 0xc08 > @@ -615,24 +616,7 @@ static ssize_t traceid_show(struct device *dev, > val = drvdata->traceid; > return sprintf(buf, "%#lx\n", val); > } > - > -static ssize_t traceid_store(struct device *dev, > - struct device_attribute *attr, > - const char *buf, size_t size) > -{ > - int ret; > - unsigned long val; > - struct stm_drvdata *drvdata = dev_get_drvdata(dev->parent); > - > - ret = kstrtoul(buf, 16, &val); > - if (ret) > - return ret; > - > - /* traceid field is 7bit wide on STM32 */ > - drvdata->traceid = val & 0x7f; > - return size; > -} > -static DEVICE_ATTR_RW(traceid); > +static DEVICE_ATTR_RO(traceid); > > #define coresight_stm_reg(name, offset) \ > coresight_simple_reg32(struct stm_drvdata, name, offset) > @@ -819,14 +803,6 @@ static void stm_init_default_data(struct stm_drvdata *drvdata) > */ > drvdata->stmsper = ~0x0; > > - /* > - * The trace ID value for *ETM* tracers start at CPU_ID * 2 + 0x10 and > - * anything equal to or higher than 0x70 is reserved. Since 0x00 is > - * also reserved the STM trace ID needs to be higher than 0x00 and > - * lowner than 0x10. > - */ > - drvdata->traceid = 0x1; > - > /* Set invariant transaction timing on all channels */ > bitmap_clear(drvdata->chs.guaranteed, 0, drvdata->numsp); > } > @@ -854,7 +830,7 @@ static void stm_init_generic_data(struct stm_drvdata *drvdata, > > static int stm_probe(struct amba_device *adev, const struct amba_id *id) > { > - int ret; > + int ret, trace_id; > void __iomem *base; > struct device *dev = &adev->dev; > struct coresight_platform_data *pdata = NULL; > @@ -938,12 +914,22 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) > goto stm_unregister; > } > > + trace_id = coresight_trace_id_get_system_id(); > + if (trace_id < 0) { The above API returns "INVALID_ID" and not a negative error status. I think it is better to fix the API to return: ret < 0 - If there is any error - Otherwise a positive integer And the users should be kept unaware of which ID is valid or invalid. Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel