Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9683329rwr; Thu, 11 May 2023 20:00:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pZrWZ0ep4iwx3llkowJcb9yUt9TlMFz7wBAXa182sV0GKGC6eb6WtlFkEhJs4As6KH+r6 X-Received: by 2002:a17:903:48e:b0:1a2:a904:c438 with SMTP id jj14-20020a170903048e00b001a2a904c438mr23066520plb.58.1683860426521; Thu, 11 May 2023 20:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683860426; cv=none; d=google.com; s=arc-20160816; b=jmdScJxhMGzMTXq6dVVLXpDpQzT0LOMUcFWGsKtePwccbkUeBXMNarb3sJcgmJtEPJ eHoNnAW1KnEt1nS0+hNdjQ7URgiRxAXAxzspOQOs/CGtpFHYfZZf3PhbqrtWy8hTLp5+ 7vI31wLZmtVnP4vOt0NuXluUcErinvvR2Q0ERxQutr2a1oIxCtkiWvHpxGrhUvwRSjqF CoD7uN4Wg0SbFcexI/oMUCHEN5jPPeIKH0wLUgLQy8TCvGZe9Rw7TJnKB+x8HQ2/35wR OkohActSoA9QaI/A8y3L/fbkgjxVUK9YEsLnQ2hdEL/Ql6TUmcAKnhxPuBGwpiFBL0jE F+hQ== 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=F+90wTPDoJA70i6Hj7zRnMr6ovRXysqvbYjWW3YBFkA=; b=PvmpUHTe8M4lh8lSClm//Rs5/NueRSzv2IZ7dYUhKm3zDwgjY1MVaVfSkZqsZe9jSz k+WlyuYkutEGLJ0K4hCAcoJ7CY1ANbJjgaY6WPwLKq21GdHgS+IVywENt1TOeuJm+VQB 90iWUESn3Q6Y9kRE9J1EV343RG1nmscBEpctKXEPX/giLBv3IKXwGRKfwjsE6xFwAKxO iNCM62SJdRbg+Yx7BOPYedfu0lJGgEg5R3V14YtrAK4OILfXyj4FdDfIKWdpvx2lq1e/ YdZL+bc5SnYEk8WMNVZFvoWBNhNcCVdWyNXNo7FQWlZFvlphf0Vux/0PnA5nFScQD+mC S4ZQ== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a170902d48c00b001add2ba4458si2597511plg.38.2023.05.11.20.00.14; Thu, 11 May 2023 20:00:26 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239664AbjELClV (ORCPT + 99 others); Thu, 11 May 2023 22:41:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233568AbjELClU (ORCPT ); Thu, 11 May 2023 22:41:20 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88497559E; Thu, 11 May 2023 19:41:18 -0700 (PDT) Received: from dggpeml500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QHXxs1czyzLprV; Fri, 12 May 2023 10:38:25 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpeml500002.china.huawei.com (7.185.36.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 12 May 2023 10:41:15 +0800 From: Junhao He To: , , , , CC: , , , , , , , , Subject: [PATCH] coresight: etm4x: fix trctraceid sysfs always invisible Date: Fri, 12 May 2023 10:39:33 +0800 Message-ID: <20230512023933.961-1-hejunhao3@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500002.china.huawei.com (7.185.36.158) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 The trctraceid sysfs interface is current in etm4x mgmt group. Each attr in the mgmt group will call the function is_visible() to check whether the register is implemented. However the trctraceid does not bound to any register. So the trctraceid sysfs will always be invisible. Move it to etmv4 group to fix that. Fixes: df4871204e5d ("coresight: etm4x: Update ETM4 driver to use Trace ID API") Signed-off-by: Junhao He --- .../coresight/coresight-etm4x-sysfs.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index 5e62aa40ecd0..0ea71de0f56b 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -2335,6 +2335,26 @@ static ssize_t ts_source_show(struct device *dev, } static DEVICE_ATTR_RO(ts_source); +/* + * Trace ID allocated dynamically on enable - but also allocate on read + * in case sysfs or perf read before enable to ensure consistent metadata + * information for trace decode + */ +static ssize_t trctraceid_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int trace_id; + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); + + trace_id = etm4_read_alloc_trace_id(drvdata); + if (trace_id < 0) + return trace_id; + + return sysfs_emit(buf, "0x%x\n", trace_id); +} +static DEVICE_ATTR_RO(trctraceid); + static struct attribute *coresight_etmv4_attrs[] = { &dev_attr_nr_pe_cmp.attr, &dev_attr_nr_addr_cmp.attr, @@ -2390,29 +2410,10 @@ static struct attribute *coresight_etmv4_attrs[] = { &dev_attr_vmid_masks.attr, &dev_attr_cpu.attr, &dev_attr_ts_source.attr, + &dev_attr_trctraceid.attr, NULL, }; -/* - * Trace ID allocated dynamically on enable - but also allocate on read - * in case sysfs or perf read before enable to ensure consistent metadata - * information for trace decode - */ -static ssize_t trctraceid_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - int trace_id; - struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); - - trace_id = etm4_read_alloc_trace_id(drvdata); - if (trace_id < 0) - return trace_id; - - return sysfs_emit(buf, "0x%x\n", trace_id); -} -static DEVICE_ATTR_RO(trctraceid); - struct etmv4_reg { struct coresight_device *csdev; u32 offset; @@ -2549,7 +2550,6 @@ static struct attribute *coresight_etmv4_mgmt_attrs[] = { coresight_etm4x_reg(trcpidr3, TRCPIDR3), coresight_etm4x_reg(trcoslsr, TRCOSLSR), coresight_etm4x_reg(trcconfig, TRCCONFIGR), - &dev_attr_trctraceid.attr, coresight_etm4x_reg(trcdevarch, TRCDEVARCH), NULL, }; -- 2.33.0