Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3113148pxb; Fri, 4 Feb 2022 01:23:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwP3FoG+AOA43v+2k0DdMufwslGaCWPTJFGqbEdDQMqCwXmc6wnCcfkQaHCIpX2Z8Mj+P/8 X-Received: by 2002:aa7:8745:: with SMTP id g5mr2267086pfo.1.1643966592482; Fri, 04 Feb 2022 01:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643966592; cv=none; d=google.com; s=arc-20160816; b=aM0Ynb6hO/zRgNm/ZWBy70GG09yjVCB8CfhH6XvRxiZCJEt8vcVtw17shnZ7n+1wGg bFx6HCR9EL/+kdPgxb6hYy9K4aMMSmIfydAPO/h7dmjBqoEL1bk32VFqlyvTMLjCOeHY QsFTpCANv+y1MUpC3E8DlKK5a26PzBLg/Gb20+l3JEO6AmkIv7GyvOogBquXWUk4zAZw oQser+obBRCkAslTW0ahch+CuOT+MTxR+3tNMGMQZ0qPY4n4yx2xh30Qd1GFnsfbJplA SrGjxI7Xkk77XNmV3ywtRPdeuCBkf5IBD5ukWe8E9dbx/xAulQwPPTjqmbenqsl/2hAs zLxw== 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=EQVFxnNn3Y/FztLb1EYjxpthHdo0phjicpX0NrGcmWc=; b=TVdYNdHfW2k2qZ83GCWBGJsZk/5wG6S3reSGJQ3bfiok2UDujPOPGcEq/dDiAg1GFp H1NeecAm7RTjC2Z/GWbyhDvxi/I9rdwU8pcjE5g4WiwDtJAlhfY6VUgWaN1bZ9R77PKb MhgBVD3ebp0E8vWu0tVd6dft8OCjLWQROZ2BUDdYf5AekvgujbxoqJBGJKeNvkCCHfS3 qqAeRncomj47S2k7Emg4Lwhtclil306BKmuUnSxLZD0ksKusyMfMsYDLEZdwRhW8BlpE SIqXYAimlMqLK+1IaI1QoH/NxsysU4cOUmWC2LirRH15vcr3nZswPct6mpsn7b8p7DuF xsGw== 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 m12si1367731pfh.279.2022.02.04.01.23.01; Fri, 04 Feb 2022 01:23:12 -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 S237954AbiBAMWT (ORCPT + 99 others); Tue, 1 Feb 2022 07:22:19 -0500 Received: from foss.arm.com ([217.140.110.172]:36126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbiBAMWT (ORCPT ); Tue, 1 Feb 2022 07:22:19 -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 0F814113E; Tue, 1 Feb 2022 04:22:19 -0800 (PST) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CCDC53F73B; Tue, 1 Feb 2022 04:22:17 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , Anshuman Khandual , coresight@lists.linaro.org Subject: [PATCH] coresight: trbe: Move check for kernelspace unmapped at EL0 to probe Date: Tue, 1 Feb 2022 12:22:12 +0000 Message-Id: <20220201122212.3009461-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently with the check present in the module initialisation, it shouts on all the systems irrespective of presence of coresight trace buffer extensions. Similar to Arm SPE perf driver, move the check for kernelspace unmapping when running at EL0 to the device probe instead of module initialisation. 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; + 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; -- 2.25.1