From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B928C433E3 for ; Mon, 17 Aug 2020 17:48:53 +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 6935F207FF for ; Mon, 17 Aug 2020 17:48:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dwJulq8D"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S8zRlKNg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6935F207FF 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+linux-arm-kernel=archiver.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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oKBU+JMlzQJWFMx3a8skYYxBq2ouTA/asDx6PdC9HoY=; b=dwJulq8Dx22LAmCfHzX70+SVE rSpTh3MUR92CcJTpTETAHSA8GFbeUi/01RIYtPlSexA3CpPwHN8jZ7dPKDf1etpkbFrxBdhcTuWJq N+OHYpLo7osGztMXK8gNwx2bv7zsw4cvoVIHT2A8GYmzTCgakELTpvy7QOx5hnJH+z8rbM8pCgSGc EHikFj6ixBu9mY9aklv7p6ukfwM+UM0MGlBGjoBhTiVnoTicPOhtVnzr36bWKBIlRWttl+xRPIcTj ZNPE0ati8+UTcqPleB4M3J8CAKLPGjrkoYBqBw/SvYL9FvC33vSD5owhsY/6Ti/ZbpkCpgkfeOn1+ JdoHWc94g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7jEI-0001lF-Iz; Mon, 17 Aug 2020 17:47:31 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7jEF-0001jg-FW for linux-arm-kernel@lists.infradead.org; Mon, 17 Aug 2020 17:47:29 +0000 Received: by mail-pf1-x444.google.com with SMTP id 74so8561535pfx.13 for ; Mon, 17 Aug 2020 10:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xfkIDVSgc2H8d6NAN41u2OTgSDDNeehvF63J8aXXk+Q=; b=S8zRlKNg2cgyX1lRFTbyxS9GNen6HZ3fbfIuflLTahwZ3Y2fN0hRraN7Wlv1Y4hx07 U6N+858SI/dx4gIHEKy6Rc25Z1Upbb78P4venJNXk4eNYKZdWT/EDnM3PmYVNhBk24XO TXBu5DgYF0w4QYvZCQiUzkpjbMWDR3hZSZrBgveI1uXhxsXi8yXQRNfrha8XHWrdDzNG gGfvG0WNo4Nvu8RIqhCp/h6Zk3mtv9rOiPCwc+RZdHoJ8d5ugxP5W/0mOrRKMQBzn6MP o3DJsRxutuBoVc8xASgXR1gPsP42KooFcMWiMSTvVjiCiIBp+SSyER7MBhi7rijoHtKR +0OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xfkIDVSgc2H8d6NAN41u2OTgSDDNeehvF63J8aXXk+Q=; b=EaZmYqTt53BTHKlsMsizVSbyl+Bz/TWgbI/JxSJGNhUo5dE0xgTD+HeCWT/bcSMja2 I/LxYel4EibJ1KePBVjSwVr11KGDzEneiGdn1T0vV9v33Vj07xv903PwwSMlr0wUCeuH yEuuMUG8iE2n7CrJqdUuB+rZppQn/fUats+yqpg53/kd8S8vRSmUSFU2vTe4aAyyfBLX 1sR7TbiRHtHJZLlPHxhUgGoMoxTPQmb4MZxfW/IcK8D0vdvYLPBSjfyALYGg5CjE3KTF H9GldEaIEGa7ayp2cCw6qSqQnl9YsfavoiAHFq9W5MWGGSfjpCBb/MZll2aJvhNOta64 uRkw== X-Gm-Message-State: AOAM532DypnqMfqmj1ASRLHmuUI2+6e7rdzxjavvJMfufLtrX0iug+dL 3Ke4kx2JNWj5jmOXqAZEywo2k+s8zXB6Lw== X-Google-Smtp-Source: ABdhPJxkv4syXAZTxaED7iVgfbktcNVjh6qot8OUlh/3sqD16Sw2o4XJ0RoATQpg9jKZ5LipmmZD7w== X-Received: by 2002:a63:1748:: with SMTP id 8mr10978316pgx.207.1597686445119; Mon, 17 Aug 2020 10:47:25 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id q66sm18323872pjq.17.2020.08.17.10.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 10:47:24 -0700 (PDT) Date: Mon, 17 Aug 2020 11:47:22 -0600 From: Mathieu Poirier To: Tingwei Zhang Subject: Re: [PATCH v8 24/24] coresight: allow the coresight core driver to be built as a module Message-ID: <20200817174722.GG3614061@xps15> References: <20200807111153.7784-1-tingwei@codeaurora.org> <20200807111153.7784-25-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200807111153.7784-25-tingwei@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200817_134727_833054_4EBD0DA5 X-CRM114-Status: GOOD ( 30.54 ) 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: tsoni@codeaurora.org, Sai Prakash Ranjan , Kim Phillips , Mao Jinlong , Suzuki K Poulose , Alexander Shishkin , Greg Kroah-Hartman , coresight@lists.linaro.org, Randy Dunlap , Mian Yousaf Kaukab , Russell King , Leo Yan , linux-arm-kernel@lists.infradead.org, Mike Leach Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 07, 2020 at 07:11:53PM +0800, Tingwei Zhang wrote: > Enhance coresight developer's efficiency to debug coresight drivers. > - Kconfig becomes a tristate, to allow =m > - append -core to source file name to allow module to > be called coresight by the Makefile > - modules can have only one init/exit, so we add the etm_perf > register/unregister function calls to the core init/exit > functions. > - 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 > --- > drivers/hwtracing/coresight/Kconfig | 5 ++- > drivers/hwtracing/coresight/Makefile | 5 ++- > .../{coresight.c => coresight-core.c} | 42 ++++++++++++++----- > .../hwtracing/coresight/coresight-etm-perf.c | 8 +++- > .../hwtracing/coresight/coresight-etm-perf.h | 3 ++ > 5 files changed, 48 insertions(+), 15 deletions(-) > rename drivers/hwtracing/coresight/{coresight.c => coresight-core.c} (98%) > > diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig > index dfe407cde262..c1198245461d 100644 > --- a/drivers/hwtracing/coresight/Kconfig > +++ b/drivers/hwtracing/coresight/Kconfig > @@ -3,7 +3,7 @@ > # Coresight configuration > # > menuconfig CORESIGHT > - bool "CoreSight Tracing Support" > + tristate "CoreSight Tracing Support" > depends on ARM || ARM64 > depends on OF || ACPI > select ARM_AMBA > @@ -15,6 +15,9 @@ menuconfig CORESIGHT > specification and configure the right series of components when a > trace source gets enabled. > > + To compile this driver as a module, choose M here: the > + module will be called coresight. > + > if CORESIGHT > config CORESIGHT_LINKS_AND_SINKS > tristate "CoreSight Link and Sink drivers" > diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile > index 0359d5a1588f..1b35b55bd420 100644 > --- a/drivers/hwtracing/coresight/Makefile > +++ b/drivers/hwtracing/coresight/Makefile > @@ -2,8 +2,9 @@ > # > # Makefile for CoreSight drivers. > # > -obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o \ > - coresight-platform.o coresight-sysfs.o > +obj-$(CONFIG_CORESIGHT) += coresight.o > +coresight-y := coresight-core.o coresight-etm-perf.o coresight-platform.o \ > + coresight-sysfs.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 > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight-core.c > similarity index 98% > rename from drivers/hwtracing/coresight/coresight.c > rename to drivers/hwtracing/coresight/coresight-core.c > index f9566d667261..045416ac962f 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight-core.c > @@ -1462,16 +1462,6 @@ int coresight_timeout(void __iomem *addr, u32 offset, int position, int value) > } > EXPORT_SYMBOL_GPL(coresight_timeout); > > -struct bus_type coresight_bustype = { > - .name = "coresight", > -}; > - > -static int __init coresight_init(void) > -{ > - return bus_register(&coresight_bustype); > -} > -postcore_initcall(coresight_init); > - > /* > * coresight_release_platform_data: Release references to the devices connected > * to the output port of this device. > @@ -1680,3 +1670,35 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict, > return name; > } > EXPORT_SYMBOL_GPL(coresight_alloc_device_name); > + > +struct bus_type coresight_bustype = { > + .name = "coresight", > +}; > + > +static int __init coresight_init(void) > +{ > + int ret; > + > + ret = bus_register(&coresight_bustype); > + if (ret) > + return ret; > + > + ret = etm_perf_init(); > + if (ret) > + bus_unregister(&coresight_bustype); > + > + return ret; > +} > + > +static void __exit coresight_exit(void) > +{ > + etm_perf_exit(); > + bus_unregister(&coresight_bustype); > +} > + > +module_init(coresight_init); > +module_exit(coresight_exit); > + > +MODULE_AUTHOR("Mathieu Poirier "); Pratik deserves credit too. With that: Reviewed-by: Mathieu Poirier I am done reviewing this set. Thank you for the patience, Mathieu > +MODULE_DESCRIPTION("Arm CoreSight tracer driver"); > +MODULE_LICENSE("GPL v2"); > diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c > index 3728c44e5763..668b3ff11576 100644 > --- a/drivers/hwtracing/coresight/coresight-etm-perf.c > +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c > @@ -591,7 +591,7 @@ void etm_perf_del_symlink_sink(struct coresight_device *csdev) > csdev->ea = NULL; > } > > -static int __init etm_perf_init(void) > +int __init etm_perf_init(void) > { > int ret; > > @@ -618,4 +618,8 @@ static int __init etm_perf_init(void) > > return ret; > } > -device_initcall(etm_perf_init); > + > +void __exit etm_perf_exit(void) > +{ > + perf_pmu_unregister(&etm_pmu); > +} > diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h > index 05f89723e282..3e4f2ad5e193 100644 > --- a/drivers/hwtracing/coresight/coresight-etm-perf.h > +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h > @@ -82,4 +82,7 @@ static inline void *etm_perf_sink_config(struct perf_output_handle *handle) > > #endif /* CONFIG_CORESIGHT */ > > +int __init etm_perf_init(void); > +void __exit etm_perf_exit(void); > + > #endif > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel