From patchwork Mon Sep 28 16:35:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804083 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3F4C139A for ; Mon, 28 Sep 2020 16:39:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 713B62080C for ; Mon, 28 Sep 2020 16:39:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pu5Kq2v+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tKlH6Q2n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 713B62080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0E3KYbG7rQH8du5vFeYkKnNiaQqQuiDZ44GEG93S8Ok=; b=pu5Kq2v+8aPUdv+RJ8eBCAf83 QPMYx6OtlKk2y1Ma458shygCWvRGTeFIcerLHR7sR3pHTK+Q8ESpQF/ApUl5k0eocbCRM8YbipVdr mcefqkoVHEtki0ILaTQNZW1qFq2lfYHzgDOkdV//qnxwVBjY2ejY3XTHmiATMI1LY68QjR6rCx6TQ nEyCOdJjCUtocVEpbh0oawqWYKWvv08D7apKXK0QOGB4TMmGVo/7RMp+9tqPuK378JAOqCWUvfZY6 Vtist+sF+58agfGsSMWsVYCerbhNEI6YM1agJkq/EQXG/U8KqP6QMPosYTOGHmpUeHDQKr+SFTCY4 ZGWo/7VwA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBc-00026K-Nx; Mon, 28 Sep 2020 16:39:36 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7f-0000am-2L for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:37 +0000 Received: by mail-pg1-x541.google.com with SMTP id 197so1318333pge.8 for ; Mon, 28 Sep 2020 09:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D3jVDw2F3FLGmwjOb7HhNx2sSGB+A2r03pvrlXP4qvw=; b=tKlH6Q2nCg7QhIkLFB8DujfYuejxynSpxjKqkvxOVgMyNH8ghIV6R0uITk5iR2YW2T X95Iu2I0Wnzg5WoRN21HX6BLmrHAhLbH35LIkSLgJX9zxxlVjVO1BliH15xURcsj/brO onRaI/htm7LHIVyEx+fJO/KvtdvEx7X5hb1k1dy2rKFZpdRlHfWmcAr4zzp61Nbwj1QG 57cHw3C44dNNmgu4HWA2FJ+PlFECr2bx8GggNMm8q5qNMSBgxVXEjE4nlDD7LV0HPFZe xpmF1jSA+7dJiCe0KWSQLW+Ax/S/vEeIswfyuZnmKwGaSBpGJMigmZe6kviQ7slGmwgS HJBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D3jVDw2F3FLGmwjOb7HhNx2sSGB+A2r03pvrlXP4qvw=; b=KRnGY05JTnH3gM6Zw32vjK2hRNLfFhv+wy4k00rXZpQDntYF/iI3AZvmQJawCOFTnF SyeLM0wkOFAwF6cYvcUGglcXznqq5AfqpX4Qf7Zjyw9isL4lGTityGTQabdGkjLxYqpl 3X6Y8qvMTVfupkZRKyvEyTdXJkvJiQFsdHtlFARejRtRC5HjX2H2r7rhENMCNXIwZmw+ SbwCsBKV/8kOnwtMnVE46Pxw0bwDKgc/zuKk3yVW/A25V4lHJmISL4NPbsRk+Fbbr66h RsOsBOkDBOvEoPU/k5wpW9mCP7BrzMx7lQTB6Mru5/wP+RG7f15536nCtqSyrGbnW+Re u2Aw== X-Gm-Message-State: AOAM533oGHOQobTW9ava8HJqWi2R6nXncw8F1ErNpfR5HlMB0+LwI4hZ ZV4gDMk2gPQZwmH6/+4ik/2LhPZyV+wQXg== X-Google-Smtp-Source: ABdhPJwJ4nykfCh9VS9dkXfNUx8G/MsHHxoNAxTMZpSm9SSuGCOV+t6xwvIqg3LI3qHWjS7GRT2Fbw== X-Received: by 2002:a17:902:7681:b029:d2:88b1:b130 with SMTP id m1-20020a1709027681b02900d288b1b130mr383548pll.20.1601310928915; Mon, 28 Sep 2020 09:35:28 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:28 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 13/25] coresight: tmc: Allow tmc to be built as a module Date: Mon, 28 Sep 2020 10:35:01 -0600 Message-Id: <20200928163513.70169-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200928_123531_208304_294291D2 X-CRM114-Status: GOOD ( 21.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kim Phillips Allow to build coresight-tmc as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - append -core to source file name to allow module to be called coresight-tmc by the Makefile - add an tmc_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 6 ++++- drivers/hwtracing/coresight/Makefile | 6 ++--- .../{coresight-tmc.c => coresight-tmc-core.c} | 25 ++++++++++++++++++- 3 files changed, 32 insertions(+), 5 deletions(-) rename drivers/hwtracing/coresight/{coresight-tmc.c => coresight-tmc-core.c} (95%) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 8fd9887fb03b..fc48ae086746 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -25,7 +25,8 @@ config CORESIGHT_LINKS_AND_SINKS entity at run time to form a complete trace path. config CORESIGHT_LINK_AND_SINK_TMC - bool "Coresight generic TMC driver" + tristate "Coresight generic TMC driver" + depends on CORESIGHT_LINKS_AND_SINKS help This enables support for the Trace Memory Controller driver. @@ -34,6 +35,9 @@ config CORESIGHT_LINK_AND_SINK_TMC complies with the generic implementation of the component without special enhancement or added features. + To compile this driver as a module, choose M here: the + module will be called coresight-tmc. + config CORESIGHT_CATU bool "Coresight Address Translation Unit (CATU) driver" depends on CORESIGHT_LINK_AND_SINK_TMC diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 3f2b057443fb..3dbd49a060dd 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -4,9 +4,9 @@ # obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o \ coresight-platform.o coresight-sysfs.o -obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o \ - coresight-tmc-etf.o \ - coresight-tmc-etr.o +obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o +coresight-tmc-y := coresight-tmc-core.o coresight-tmc-etf.o \ + coresight-tmc-etr.o obj-$(CONFIG_CORESIGHT_SINK_TPIU) += coresight-tpiu.o obj-$(CONFIG_CORESIGHT_SINK_ETBV10) += coresight-etb10.o obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-funnel.o \ diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc-core.c similarity index 95% rename from drivers/hwtracing/coresight/coresight-tmc.c rename to drivers/hwtracing/coresight/coresight-tmc-core.c index 9ca3aaafcfbc..5653e0945c74 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -559,6 +559,21 @@ static void tmc_shutdown(struct amba_device *adev) spin_unlock_irqrestore(&drvdata->spinlock, flags); } +static int __exit tmc_remove(struct amba_device *adev) +{ + struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + /* + * Since misc_open() holds a refcount on the f_ops, which is + * etb fops in this case, device is there until last file + * handler to this device is closed. + */ + misc_deregister(&drvdata->miscdev); + coresight_unregister(drvdata->csdev); + + return 0; +} + static const struct amba_id tmc_ids[] = { CS_AMBA_ID(0x000bb961), /* Coresight SoC 600 TMC-ETR/ETS */ @@ -570,6 +585,8 @@ static const struct amba_id tmc_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, tmc_ids); + static struct amba_driver tmc_driver = { .drv = { .name = "coresight-tmc", @@ -578,6 +595,12 @@ static struct amba_driver tmc_driver = { }, .probe = tmc_probe, .shutdown = tmc_shutdown, + .remove = tmc_remove, .id_table = tmc_ids, }; -builtin_amba_driver(tmc_driver); + +module_amba_driver(tmc_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_DESCRIPTION("Arm CoreSight Trace Memory Controller driver"); +MODULE_LICENSE("GPL v2");