Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp17757imm; Tue, 5 Jun 2018 14:12:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLREoNXAAkV4cUJLJkYGebKpe4QSEdowPMTIHTh+9r4wK0mQlg/0tr6oAi+oauues+8mzUw X-Received: by 2002:a63:b34e:: with SMTP id x14-v6mr190372pgt.243.1528233125085; Tue, 05 Jun 2018 14:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528233125; cv=none; d=google.com; s=arc-20160816; b=uHRLk6eiSImK6M2/OVKDbEIFgsTw+XhoARekop04UNdX9VmaivfPk4hDDoU4GugR4L foL0OPjIK3xUK4qiYQJqu0zk0lJBkGa9313hb89RrZnl2NayEp7ZHRmP7w5k2BJrqj+a 2smMJACe0rAK7Yy7Cs5I1iEVfIGhEyELSPzIDxFRT/Dnga90qmmQklYyv7Bb7PB/L2pa shbYvgzY/z+edEqOkxZG3lSjO4i8VrnWIo8GfImrByc/VfIvRSluWHDWtAz194OGT/mv v4xy0ndyn3shAxPWunivM67tg2+Q/wQuoaRI596plWLXfmF8lqUtgQGfPBqMz7hNgfnA oXjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=bKGvj29R8mH4Dy6SFTnYeUW1Nlu6CoFUhO9oywbe82U=; b=tjXkT337qgVxlmVZCjExvvMebDRK0Dd3ZAaEVakVK8JqX775WNO8myXV7ODHGgQqnQ 8cn9gwEZbpeAu03hCnryY+vSPqngQKRVByoHSmTmIW8OYIrN6vlArdDswZ7T4tfoRG8I o8Ji3EAEKsqCywV52vPuvpyR+YL3/b5HrRiFt3zTBYWg0/h2f2puYanhzX7ZqM1AXYcP E0JCs6SvA9yCSxJ1hdQp+GSQTaOQLrC3vSe9OkdkVnGBUYhk8MTxVejZyUaBqM0cuS2X RWS30zOwWWsiYSODI2pWvJfBxvO4zbSdiP3/cdveXSftVBKBeuwnafiZGo+v/m9wUeoH ckfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3-v6si26626650pll.412.2018.06.05.14.11.50; Tue, 05 Jun 2018 14:12:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752663AbeFEVHt (ORCPT + 99 others); Tue, 5 Jun 2018 17:07:49 -0400 Received: from foss.arm.com ([217.140.101.70]:33548 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752600AbeFEVHo (ORCPT ); Tue, 5 Jun 2018 17:07:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B6DB61688; Tue, 5 Jun 2018 14:07:43 -0700 (PDT) Received: from localhost.localdomain (unknown [10.118.17.245]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9FAE93F59D; Tue, 5 Jun 2018 14:07:42 -0700 (PDT) From: Kim Phillips To: Mathieu Poirier Cc: Leo Yan , Suzuki K Poulose , Greg Kroah-Hartman , Alexander Shishkin , Alex Williamson , Andrew Morton , David Howells , Eric Auger , Eric Biederman , Gargi Sharma , Geert Uytterhoeven , Kefeng Wang , Kirill Tkhai , Mike Rapoport , Oleg Nesterov , Pavel Tatashin , Rik van Riel , Robin Murphy , Russell King , Thierry Reding , Todd Kjos , Randy Dunlap , linux-arm-kernel , Linux Kernel Mailing List , Kim Phillips Subject: [PATCH v4 09/14] coresight: allow etm4x to be built as a module Date: Tue, 5 Jun 2018 16:07:05 -0500 Message-Id: <20180605210710.22227-10-kim.phillips@arm.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180605210710.22227-1-kim.phillips@arm.com> References: <20180605210710.22227-1-kim.phillips@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow to build coresight-etm4x 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-etm4x by the Makefile - add an etm4_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 --- drivers/hwtracing/coresight/Kconfig | 5 +++- drivers/hwtracing/coresight/Makefile | 4 +-- ...resight-etm4x.c => coresight-etm4x-core.c} | 25 ++++++++++++++++++- 3 files changed, 30 insertions(+), 4 deletions(-) rename drivers/hwtracing/coresight/{coresight-etm4x.c => coresight-etm4x-core.c} (97%) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 56675e4f5a15..c32673f9177a 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -64,7 +64,7 @@ config CORESIGHT_SOURCE_ETM3X module will be called coresight-etm3x. config CORESIGHT_SOURCE_ETM4X - bool "CoreSight Embedded Trace Macrocell 4.x driver" + tristate "CoreSight Embedded Trace Macrocell 4.x driver" depends on ARM64 select CORESIGHT_LINKS_AND_SINKS help @@ -73,6 +73,9 @@ config CORESIGHT_SOURCE_ETM4X for instruction level tracing. Depending on the implemented version data tracing may also be available. + To compile this driver as a module, choose M here: the + module will be called coresight-etm4x. + config CORESIGHT_DYNAMIC_REPLICATOR tristate "CoreSight Programmable Replicator driver" depends on CORESIGHT_LINKS_AND_SINKS diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index c3281e37e542..1623ed266b04 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -14,8 +14,8 @@ obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-funnel.o \ obj-$(CONFIG_CORESIGHT_SOURCE_ETM3X) += coresight-etm3x.o coresight-etm3x-objs := coresight-etm3x-core.o coresight-etm-cp14.o \ coresight-etm3x-sysfs.o -obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o \ - coresight-etm4x-sysfs.o +obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o +coresight-etm4x-objs := coresight-etm4x-core.o coresight-etm4x-sysfs.o obj-$(CONFIG_CORESIGHT_DYNAMIC_REPLICATOR) += coresight-dynamic-replicator.o obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c similarity index 97% rename from drivers/hwtracing/coresight/coresight-etm4x.c rename to drivers/hwtracing/coresight/coresight-etm4x-core.c index 1d94ebec027b..0f4828c2268c 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1046,6 +1046,20 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit etm4_remove(struct amba_device *adev) +{ + struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + etm_perf_symlink(drvdata->csdev, false); + + cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); + cpuhp_remove_state_nocalls(hp_online); + + coresight_unregister(drvdata->csdev); + + return 0; +} + #define ETM4x_AMBA_ID(pid) \ { \ .id = pid, \ @@ -1061,12 +1075,21 @@ static const struct amba_id etm4_ids[] = { {}, }; +MODULE_DEVICE_TABLE(amba, etm4_ids); + static struct amba_driver etm4x_driver = { .drv = { .name = "coresight-etm4x", + .owner = THIS_MODULE, .suppress_bind_attrs = true, }, .probe = etm4_probe, + .remove = etm4_remove, .id_table = etm4_ids, }; -builtin_amba_driver(etm4x_driver); +module_amba_driver(etm4x_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Program Flow Trace v4 driver"); +MODULE_LICENSE("GPL v2"); -- 2.17.0