From patchwork Tue Jan 10 12:51:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hejunhao X-Patchwork-Id: 41450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2728617wrt; Tue, 10 Jan 2023 04:57:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXtyNl+vb0lQJBj2ZOH/5krko2jRhDCpUCbj71a7CULhv2Q+ZeLjU598U8j9muunQYv0DTC8 X-Received: by 2002:a05:6402:b14:b0:498:21b3:aeaf with SMTP id bm20-20020a0564020b1400b0049821b3aeafmr9856635edb.1.1673355459301; Tue, 10 Jan 2023 04:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673355459; cv=none; d=google.com; s=arc-20160816; b=RIgMOSwcF0mKPxtJsQskGu/l5dNmnOJOXnpzEBYROqjPBprhFQCXqKXs8ANDdt+6Xf yF/jF3RzdHIZuThXy0dwO8pQTWgsWTs1tAOHAHOVIyvkmQcuWuc0D/vsrCZL2XvK5ggR c+zo/yCrkYWTdk9yXC0g8sriNFASlZCyHm3Mj/amM/FESms7BHIMja4/3SltkUz2bU2A ThWCSW4Z4umzYDLzOITMbOx3QcHfkSiyxsFhjQa6nH1XNdvyFsuu4//QjMPDF6XWXUbm j7EDVSGFqNFfff6GancfPQu8BFsOo0JZRSXXJQCrYqAgQtWgi3pQYpay+QtEVNosfMnp h8vw== 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=3nKc6Rpa3pBUqn+prSZo1CJ7t/X1tlD4KYJiFfsMAxA=; b=ZQttP03dka681dAg2KhZcEYatJr+PDWkSCx5mJczMGGH3aauZtuhnUcR1E3UgAxS/C 1u/WXy9LWmbSGkWzSnQlSuahXwod6wpscRjGtLBRXDijGL9stfL1Emal5BJsCzCf391w FyfB/yiuybu97J4q1r129oVjqr5kc18/HMLo0zdHP9og6vOcOKHaZcMu5w9/p4Uxzk0w Lq26aE2HMYwgVjEUkR+nkHLPpWfL+I5s6TF3yMKqZlvmt9zK9nCDaJCHJtaz5ThLbfO7 HH6cKCikpw9JmOyHktz825bgZJrdTyLITr3XAGK2H3DZtbh/y/O+FREog47X3RGCpwd8 RwPA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a05640211c700b0048c37066651si15172566edw.41.2023.01.10.04.57.14; Tue, 10 Jan 2023 04:57:39 -0800 (PST) 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 S238437AbjAJMv5 (ORCPT + 99 others); Tue, 10 Jan 2023 07:51:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238590AbjAJMv0 (ORCPT ); Tue, 10 Jan 2023 07:51:26 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48C9E5DE6F for ; Tue, 10 Jan 2023 04:51:19 -0800 (PST) Received: from dggpeml500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NrrHp64KfzJrL5; Tue, 10 Jan 2023 20:49:58 +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.2375.34; Tue, 10 Jan 2023 20:51:15 +0800 From: Junhao He To: , , , CC: , , , , , , Subject: [PATCH] coresight: etm4x: Fix accesses to TRCSEQRSTEVR and TRCSEQSTR Date: Tue, 10 Jan 2023 20:51:01 +0800 Message-ID: <20230110125101.10533-1-hejunhao3@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754640373913134925?= X-GMAIL-MSGID: =?utf-8?q?1754640373913134925?= The TRCSEQRSTEVR and TRCSEQSTR register is not implemented if the TRCIDR5.NUMSEQSTATE == 0. Skip accessing the register in such cases. Signed-off-by: Junhao He Reviewed-by: Mike Leach Reviewed-by: Anshuman Khandual --- .../hwtracing/coresight/coresight-etm4x-core.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 80fefaba58ee..c7a65d1524fc 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -424,8 +424,10 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) etm4x_relaxed_write32(csa, config->vipcssctlr, TRCVIPCSSCTLR); for (i = 0; i < drvdata->nrseqstate - 1; i++) etm4x_relaxed_write32(csa, config->seq_ctrl[i], TRCSEQEVRn(i)); - etm4x_relaxed_write32(csa, config->seq_rst, TRCSEQRSTEVR); - etm4x_relaxed_write32(csa, config->seq_state, TRCSEQSTR); + if (drvdata->nrseqstate) { + etm4x_relaxed_write32(csa, config->seq_rst, TRCSEQRSTEVR); + etm4x_relaxed_write32(csa, config->seq_state, TRCSEQSTR); + } etm4x_relaxed_write32(csa, config->ext_inp, TRCEXTINSELR); for (i = 0; i < drvdata->nr_cntr; i++) { etm4x_relaxed_write32(csa, config->cntrldvr[i], TRCCNTRLDVRn(i)); @@ -1631,8 +1633,10 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) for (i = 0; i < drvdata->nrseqstate - 1; i++) state->trcseqevr[i] = etm4x_read32(csa, TRCSEQEVRn(i)); - state->trcseqrstevr = etm4x_read32(csa, TRCSEQRSTEVR); - state->trcseqstr = etm4x_read32(csa, TRCSEQSTR); + if (drvdata->nrseqstate) { + state->trcseqrstevr = etm4x_read32(csa, TRCSEQRSTEVR); + state->trcseqstr = etm4x_read32(csa, TRCSEQSTR); + } state->trcextinselr = etm4x_read32(csa, TRCEXTINSELR); for (i = 0; i < drvdata->nr_cntr; i++) { @@ -1760,8 +1764,10 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata) for (i = 0; i < drvdata->nrseqstate - 1; i++) etm4x_relaxed_write32(csa, state->trcseqevr[i], TRCSEQEVRn(i)); - etm4x_relaxed_write32(csa, state->trcseqrstevr, TRCSEQRSTEVR); - etm4x_relaxed_write32(csa, state->trcseqstr, TRCSEQSTR); + if (drvdata->nrseqstate) { + etm4x_relaxed_write32(csa, state->trcseqrstevr, TRCSEQRSTEVR); + etm4x_relaxed_write32(csa, state->trcseqstr, TRCSEQSTR); + } etm4x_relaxed_write32(csa, state->trcextinselr, TRCEXTINSELR); for (i = 0; i < drvdata->nr_cntr; i++) {