Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5497536pxb; Mon, 7 Feb 2022 03:28:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzh3yMztNCTmOgzH41rzAjhJdi1a90EfI0PTQVSCMMdriXItr0Cenh98mjgOae7aCXpvny X-Received: by 2002:a17:906:d553:: with SMTP id cr19mr9546310ejc.700.1644233319260; Mon, 07 Feb 2022 03:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644233319; cv=none; d=google.com; s=arc-20160816; b=WeFqUhOG1yDkxk/4Ele3RyA6EiF+c6YRr8ITe4iGXQEsv8bLBCEEYyiACMOdKpHW2O 0SATuND5lYPGAov+dfrYqPtMrX94a2jniWQ4+e5OZ/Hr+xudZH7hAzh8ZEg75RMRzRR2 aW/UjTriulH8SAR7wx1H5FJJY3wPk/ZIPBMcYe/wfh/ly8G2u/CrsyMnc+5hkj0UzbA0 5FWEC8Yw+RiROFdJeWSbXUogH68UdymGa54V8Ly+c5ucx13K3uztLdTpdKyFUsUWUx1h HsBFQhGtaCpFnE1NCqncxJOfl3qycrOBEDDdY8sKXXqf78DXy3Rxbos5hakf7OoRzJG8 NXRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=4C2K96mKiWiVMqXHyO/CufIyOOs718+oh2rCBjXBx14=; b=nYCpJiL6aLBadcf5gdfSOHzGjpDpu6fBnbDJD6FsPnkDfoEFL3UYdFz+MHsKaoZp3j hm/KpNHWnzQEdEvdNjrTk1CabTcyggbe9p6jVNL76wWSvAVI4wDPcod86P838n50Y/+N KPZusHXByQLssnTJoygLT2o6VRKCU2BpLJndgPpGEfk18XPUPJoKOlvqq4exi4xYkjse xwYGEzMA53sRMQdoaR2ZOShxfhtA93HqZfCI1VFbH2PldjKhTdzTbA5cBM8uOzHAAQib 93UqHYGw6Jz1j/H11ITLi0iNXZDLsinxwPjYyyAQwsenL8/0vsTbW8BUP8Lbm15hTIl9 ++ww== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13si6668415ejh.92.2022.02.07.03.28.14; Mon, 07 Feb 2022 03:28: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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238405AbiBCG0G (ORCPT + 99 others); Thu, 3 Feb 2022 01:26:06 -0500 Received: from foss.arm.com ([217.140.110.172]:53246 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234224AbiBCG0F (ORCPT ); Thu, 3 Feb 2022 01:26:05 -0500 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 2252B113E; Wed, 2 Feb 2022 22:26:05 -0800 (PST) Received: from [10.163.44.35] (unknown [10.163.44.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D5D933F774; Wed, 2 Feb 2022 22:26:02 -0800 (PST) Subject: Re: [PATCH] coresight: trbe: Move check for kernelspace unmapped at EL0 to probe To: Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org References: <20220201122212.3009461-1-sudeep.holla@arm.com> From: Anshuman Khandual Message-ID: <01a43ba2-a633-f215-a688-2bda293b5a47@arm.com> Date: Thu, 3 Feb 2022 11:55:58 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220201122212.3009461-1-sudeep.holla@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/22 5:52 PM, Sudeep Holla wrote: > Currently with the check present in the module initialisation, it shouts > on all the systems irrespective of presence of coresight trace buffer > extensions. IIUC a system with CONFIG_CORESIGHT_TRBE enabled but without a TRBE DT i.e "arm,trace-buffer-extension" complains about kernel space unmapping at EL0 (even though it does not even really have TRBE HW to initialize). > > Similar to Arm SPE perf driver, move the check for kernelspace unmapping > when running at EL0 to the device probe instead of module initialisation. Makes sense. > > Cc: Mathieu Poirier > Cc: Suzuki K Poulose > Cc: Mike Leach > Cc: Leo Yan > Cc: Anshuman Khandual > Cc: coresight@lists.linaro.org > Signed-off-by: Sudeep Holla > --- > drivers/hwtracing/coresight/coresight-trbe.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c > index 276862c07e32..3fe2ce1ba5bf 100644 > --- a/drivers/hwtracing/coresight/coresight-trbe.c > +++ b/drivers/hwtracing/coresight/coresight-trbe.c > @@ -1423,6 +1423,11 @@ static int arm_trbe_device_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > int ret; > Could you please add a similar comment like SPE driver regarding how the TRBE buffer will be inaccessible, if kernel gets unmapped at EL0 and trace capture will terminate. > + if (arm64_kernel_unmapped_at_el0()) { > + pr_err("TRBE wouldn't work if kernel gets unmapped at EL0\n"); > + return -EOPNOTSUPP; > + } > + > drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); > if (!drvdata) > return -ENOMEM; > @@ -1484,11 +1489,6 @@ static int __init arm_trbe_init(void) > { > int ret; > > - if (arm64_kernel_unmapped_at_el0()) { > - pr_err("TRBE wouldn't work if kernel gets unmapped at EL0\n"); > - return -EOPNOTSUPP; > - } > - > ret = platform_driver_register(&arm_trbe_driver); > if (!ret) > return 0; >