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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 B67C0C47080 for ; Tue, 1 Jun 2021 10:46:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 82E6D60FDC for ; Tue, 1 Jun 2021 10:46:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82E6D60FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=hH70eTEd0kXCVBCWdRc77tZelq7NJxGo9XBM1WutaRA=; b=uG99QbIMrPOzJ3 ruAdSaFiTfdhOhiB/jEgsN41k/VWlJIjgbLMNfw7HHbju2ZxGDMXCU6ysvCxSr7u7izqITRPPDtLp 1oBIyZhHi4zsc4nhe1cR6k/GNTa2JFEA2MVH8xkMoH2Hwpmt7PoLKoiTFh/mk9AsrbvYdnWb7+oHV 0QQPBVpXTy4svfoDN+x5LbWlIsXnB9gF05u5TE33ZLYJmZjQIY1sjGOfZm41tMczbaRd+OhcXx+pj CqxLspQjbJkKx8kGJWicRI0pIGBIxDVU66mm+UnbEq0ktDbTvhxa8tp753Bd01hQsFNe2bmZkdI6s Ii9VqcWlHqJk9qYIf2NQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo1tF-00G2GY-2t; Tue, 01 Jun 2021 10:44:53 +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 1lo1qP-00G0qq-3H for linux-arm-kernel@lists.infradead.org; Tue, 01 Jun 2021 10:41:59 +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 B9CB411FB; Tue, 1 Jun 2021 03:41:55 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 89E093F73D; Tue, 1 Jun 2021 03:41:54 -0700 (PDT) Date: Tue, 1 Jun 2021 11:41:48 +0100 From: Cristian Marussi To: Etienne Carriere Cc: linux-kernel@vger.kernel.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Sudeep Holla , Vincent Guittot Subject: Re: [PATCH v2 4/4] firmware: arm_scmi: add optee transport Message-ID: <20210601104148.GW28060@e120937-lin> References: <20210521134055.24271-1-etienne.carriere@linaro.org> <20210521134055.24271-4-etienne.carriere@linaro.org> <20210527151118.GV28060@e120937-lin> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210601_034157_292971_EEF24B79 X-CRM114-Status: GOOD ( 29.57 ) 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: , 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 Hi Etienne, On Fri, May 28, 2021 at 11:43:24AM +0200, Etienne Carriere wrote: > Hello Christian, > > On Thu, 27 May 2021 at 17:11, Cristian Marussi wrote: > > [snip] > > > + > > > +static struct tee_client_driver optee_scmi_driver = { > > > + .id_table = optee_scmi_id_table, > > > + .driver = { > > > + .name = DRIVER_NAME, > > > + .bus = &tee_bus_type, > > > + .probe = optee_scmi_probe, > > > + .remove = optee_scmi_remove, > > > + }, > > > +}; > > > + > > > +static int __init optee_scmi_init(void) > > > +{ > > > + return driver_register(&optee_scmi_driver.driver); > > > +} > > > + > > > +static void __exit optee_scmi_exit(void) > > > +{ > > > + driver_unregister(&optee_scmi_driver.driver); > > > +} > > > + > > > +module_init(optee_scmi_init); > > > +module_exit(optee_scmi_exit); > > > + > > > > This cannot compile is the full SCMI statck ARM_SCMI_PROTOCOL is configured as =m > > > > /opt/toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > > drivers/firmware/arm_scmi/optee_service.o: in function > > `optee_scmi_init': > > /home/crimar01/ARM/dev/src/pdsw/linux/drivers/firmware/arm_scmi/optee_service.c:515: > > multiple definition of `init_module'; > > drivers/firmware/arm_scmi/driver.o:/home/crimar01/ARM/dev/src/pdsw/linux/drivers/firmware/arm_scmi/driver.c:1593: > > first defined here > > /opt/toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > > drivers/firmware/arm_scmi/optee_service.o: in function > > `optee_scmi_exit': > > /home/crimar01/ARM/dev/src/pdsw/linux/drivers/firmware/arm_scmi/optee_service.c:520: > > multiple definition of `cleanup_module'; > > drivers/firmware/arm_scmi/driver.o:/home/crimar01/ARM/dev/src/pdsw/linux/drivers/firmware/arm_scmi/driver.c:1611: > > first defined here > > /home/crimar01/ARM/dev/src/pdsw/linux/scripts/Makefile.build:449: recipe > > for target 'drivers/firmware/arm_scmi/scmi-module.o' failed > > make[4]: *** [drivers/firmware/arm_scmi/scmi-module.o] Error 1 > > > > > > Indeed it was the same issue we faced in the virtio-scmi series, and it > > derives from the fact that SCMI transports 'driver' are really NOT > > standalone drivers but only extension of the main SCMI module, so you > > cannot have them initialize their stuff using usual kernel module_ machinery. > > > > In order to address this, and avoid a hell of ifdeffery probably, > > in the context of virtio-scmi, I added a couple of transport's > > optionalily provided init/deinit functions so that a transport can provide > > some specific init code and be assured they are called at SCMI stack init, > > so definitely even before the SCMI stack is probed and the selected > > transport used. > > > > This is the patch from the virtio-scmi series: > > > > https://lore.kernel.org/linux-arm-kernel/20210511002040.802226-3-peter.hilber@opensynergy.com/ > > > > which in that context is used like: > > > > +static int __init virtio_scmi_init(void) > > +{ > > + return register_virtio_driver(&virtio_scmi_driver); > > +} > > + > > +static void __exit virtio_scmi_exit(void) > > +{ > > + unregister_virtio_driver(&virtio_scmi_driver); > > +} > > + > > +const struct scmi_desc scmi_virtio_desc = { > > + .init = virtio_scmi_init, > > + .exit = virtio_scmi_exit, > > + .ops = &scmi_virtio_ops, > > > > I'll cleanup further that init/deinit patch and move it out into that bunch > > of SCMI core changes that I'm making (in a separate series) to aid in virtio-scmi > > devel. > > In the meantime for your testing the above lore patch should work fine. > > Thanks for the details, i'll upgrade to the series. > This is the udpated patch above about init/exit now included in that bunch of SCMI core transport changes I'm making: https://lore.kernel.org/linux-arm-kernel/20210601102421.26581-4-cristian.marussi@arm.com/T/#u but there's really no functional change from the one I mentioned above that was part of the virtio-scmi series. Thanks, Cristian > Cheers, > Etienne > > > > > Thanks, > > Cristian > > > > > +MODULE_LICENSE("GPL v2"); > > > +MODULE_AUTHOR("Etienne Carriere "); > > > +MODULE_DESCRIPTION("OP-TEE SCMI transport driver"); > > > -- > > > 2.17.1 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel