From patchwork Thu Feb 3 19:01:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 12734571 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 00FAFC433F5 for ; Thu, 3 Feb 2022 19:03:53 +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=a6/56NMz7W5+NQ7iOv/C1ClbGY+CQ+v0NIgyn25gC/4=; b=ZfRT/fxlHy5cvs QMeV66eCUDm95dCfSDdzSsZkNIcSLOmjAVu05daDzbE0MlFvQwDkkkYdlZcqen2GhNGBa5+b2LEfD IuRoidXLQLC9wnW7Jo+JEHJslR14TexKkFpQmXWCQugA7D8msT0GRqGB3d0943DPclFj8xJ0LTnJb nqHwqDly6E+OSVGdquZlIcAgiqqWaoLYH4ifdQtJBX/MhIbzDxJzY81fvUs1Kuh4EJO+CYsbM+Eh8 gDQ8nao9j/zOc3WnCHxKOXdXM5+DfZQq2pQBp9qYOHy8K5zQ3gbf96knBJ5LF+FjDyf/NOGzGkmrg VHz7JlC3mrUC8vcTF3QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFhN4-002Yv9-DK; Thu, 03 Feb 2022 19:02:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFhN0-002YuL-Gg for linux-arm-kernel@lists.infradead.org; Thu, 03 Feb 2022 19:02:16 +0000 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 86753147A; Thu, 3 Feb 2022 11:02:13 -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 5006D3F774; Thu, 3 Feb 2022 11:02:12 -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 v2] coresight: trbe: Move check for kernel page table isolation from EL0 to probe Date: Thu, 3 Feb 2022 19:01:59 +0000 Message-Id: <20220203190159.3145272-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_110214_620175_C20C0A11 X-CRM114-Status: GOOD ( 12.54 ) 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 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 kernel page table isolation from EL0 to the device probe stage instead of the module initialisation so that it complains only on the systems that support TRBE. 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 Reviewed-by: Anshuman Khandual --- drivers/hwtracing/coresight/coresight-trbe.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) v1[1]->v2: - Added comment about trace capture being not possible with kernel page table isolation [1] https://lore.kernel.org/r/20220201122212.3009461-1-sudeep.holla@arm.com diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 276862c07e32..3e37a63cb7d2 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -1423,6 +1423,12 @@ static int arm_trbe_device_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; + /* Trace capture is not possible with kernel page table isolation */ + 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 +1490,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;