From patchwork Mon Mar 27 09:49:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Zhang X-Patchwork-Id: 13188977 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 8C42EC7619A for ; Mon, 27 Mar 2023 09:50:58 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=l6xxqeMaikwQoy9rf1LJg/AWhy69et1NQz0pm7bWjsI=; b=4NqYMshVVhfgXz 1eGjB5MBkSl5x+RV2J0rxaw9EG9jMicxM5TnPwSxfc+H6VKMpmzUwC4uDBtHNi08pOOrr04/60E0E hpFEL6NlzutL19D9GeAB/X+iaqEYkkrMQIBu/dqKrfPhRYfZMiY+Cb0Pw60CiWkwS8fwcgmROdVZN /pEF3KIvykmiI1DD6gC11sjE8R8ojriXZD8J1ianqzvla6cm7eAlbtAUN6BLMb4EEilF3RAwKJUuj ZMfrY1cIEEPdlRFC5rE8vlvenXDqJAgQA2TUyPdkmNgOpp+EXO8RKvzDth2Om/wYz/MAj+CRKWW6C OV3oaBTdr4P+3jlLrYsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgjUJ-00AXdU-11; Mon, 27 Mar 2023 09:50:03 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgjUD-00AXb8-2n for linux-arm-kernel@lists.infradead.org; Mon, 27 Mar 2023 09:50:01 +0000 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32R8K3db002800; Mon, 27 Mar 2023 09:49:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=oS+hBJb9vkKxePNAcrapTq00m2jJWTChzFWKxBvsVwk=; b=U8qiaC6wNmWkGRog4KnrhJDMuv9buJd+idOClI4zj4knM5uVbuTsvB74zQVPRGTWVTGI vOonXwKDcjfB8R6VgP0ZEPDg0h9KYYAEopsbudmxPLh2QqHoxJrVvKwRLsTeMF0YbtoG E5AW9U343qtj3tAVEruNJ/bM/zGb5iL0jDwuIIjXAsNFhuFawecZ23rhFHpyWWNHdSF3 L0FESpAC9uWntZ4ucfba6AfRnC8EpJ+Flq0g7/quIwvpWpz6LELx/LaxzGP5RlWf2MXU E5ZC6DoKyJ8Fs0iRhZIzyrjU/E5zUrroWvUR6oICWKERQK8oSGlqHNSrcCaTUF4YIusA 7Q== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pk7h8r6vs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 09:49:49 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32R9nmHr024809 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 09:49:48 GMT Received: from taozha-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 27 Mar 2023 02:49:43 -0700 From: Tao Zhang To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski CC: Tao Zhang , Jinlong Mao , Leo Yan , Greg Kroah-Hartman , , , , , Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Hao Zhang , , Subject: [PATCH] coresight: cti: Check if the CPU activated for the CPU CTI Date: Mon, 27 Mar 2023 17:49:20 +0800 Message-ID: <1679910560-23469-1-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: NkyfZOnNuAnRTYGkD0QAnYDrP5ywxOTu X-Proofpoint-ORIG-GUID: NkyfZOnNuAnRTYGkD0QAnYDrP5ywxOTu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 bulkscore=0 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270080 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230327_024958_028804_971FE5CE X-CRM114-Status: GOOD ( 19.55 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Check whether the CPU corresponding to the CPU CTI is activated. If it is not activated, the CPU CTI node should not exist, and an error will be returned in the initialization function. Signed-off-by: Tao Zhang --- drivers/hwtracing/coresight/coresight-cti-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwtracing/coresight/coresight-cti-core.c index 277c890..aaa83ae 100644 --- a/drivers/hwtracing/coresight/coresight-cti-core.c +++ b/drivers/hwtracing/coresight/coresight-cti-core.c @@ -899,10 +899,12 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) drvdata->config.hw_powered = true; /* set up device name - will depend if cpu bound or otherwise */ - if (drvdata->ctidev.cpu >= 0) + if (drvdata->ctidev.cpu >= 0) { + if (!cpu_active(drvdata->ctidev.cpu)) + return -ENXIO; cti_desc.name = devm_kasprintf(dev, GFP_KERNEL, "cti_cpu%d", drvdata->ctidev.cpu); - else + } else cti_desc.name = coresight_alloc_device_name(&cti_sys_devs, dev); if (!cti_desc.name) return -ENOMEM;