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 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 30A66C3DA49 for ; Fri, 26 Jul 2024 15:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type: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=wv06yKGnK2p+t36zTRY3mo5oyCTDd2Le/wvMjzX2qOU=; b=r1IgjpV6mU43mvdEJsgSaNiKZ4 Wll/TGSz6hNDn3+ir6OX6rkgBI0mFSgFjoBqUNmf8mhcXK62b5XnLIz0wD8CdO/kabFg7/uOCiccJ 8GXyCU1M2zsn5dzMjmROOLedYaCMAYrVlaQaiU7cVZ8EgcRtDhla+uFDMjydkzUtws+x44VVUO6j4 Eqdhn4JLN/Bz+j+/nOt1Qx0girbCYSRI0/ON1JCOxD1hyWmmP0YjljsAGVe31BPgbAwPXt5R96NBV aJaZlUqpdT3ab+LgP/Y+3ITu6CQwTu6+BSJzq82s09msNfRVRBLPlu7pKV3NLXx3HenUAhAsyiwcz obie0iWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXMes-00000004Gd9-2Vhj; Fri, 26 Jul 2024 15:15:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXMeR-00000004GW2-3ewD for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 15:14:38 +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 704FA1007; Fri, 26 Jul 2024 08:14:59 -0700 (PDT) Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A66513F73F; Fri, 26 Jul 2024 08:14:31 -0700 (PDT) Date: Fri, 26 Jul 2024 16:14:29 +0100 From: Cristian Marussi To: Etienne CARRIERE Cc: Cristian Marussi , Peng Fan , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "arm-scmi@vger.kernel.org" , "sudeep.holla@arm.com" , "james.quinlan@broadcom.com" , "f.fainelli@gmail.com" , "vincent.guittot@linaro.org" , "Peng Fan (OSS)" , "michal.simek@amd.com" , "quic_sibis@quicinc.com" , "quic_nkela@quicinc.com" , "ptosi@google.com" , "dan.carpenter@linaro.org" , "souvik.chakravarty@arm.com" Subject: Re: [PATCH 0/8] Make SCMI transport as standalone drivers Message-ID: References: <20240710173153.4060457-1-cristian.marussi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_081436_026262_0E1BDCB1 X-CRM114-Status: GOOD ( 47.91 ) 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 On Tue, Jul 23, 2024 at 01:36:55PM +0000, Etienne CARRIERE wrote: > Hi Cristian, Peng, > Hi Etienne, Thanks for giving this a go on your setup. > On Thursday, July 11, 2024, Cristian Marussi worte: > > On Thu, Jul 11, 2024 at 01:26:16PM +0000, Peng Fan wrote: > > > > Subject: [PATCH 0/8] Make SCMI transport as standalone drivers > > > > > > You may need use V2 here :) > >  > > ...oh damn :P > >  > > > > > > > > Hi all, > > > > > > > > Till now the SCMI transport layer was being built embedded into in the > > > > core SCMI stack. > > > > > > > > Some of these transports, despite being currently part of the main > > > > SCMI module, are indeed also registered with different subsystems like > > > > optee or virtio, and actively probed also by those: this led to a few > > > > awkward and convoluted tricks to properly handle such interactions at > > > > boot time in the SCMI stack. > > > > > > > > Moreover some partner expressed the desire to be able to fully > > > > modularize the transports components. > > > > > > > > This series aim to make all such transports as standalone drivers that > > > > can be optionally loaded as modules. > > > > > > > > In order to do this, at first some new mechanism is introduced to > > > > support this new capability while maintaining, in parallel, the old > > > > legacy embedded transports; then each transport, one by one, is > > > > transitioned to be a standalone driver and finally the old legacy > > > > support for embedded transport is removed. > > > > > > > > Patch [1/8] is a mostly unrelated (but much needed) clean-up from > > > > Peng, which I included in this series to avoid conflicts at merge. > > > > > > > > Patch [2/8] simply collects the existing datagram manipulation helpers > > > > in a pair of function pointers structures, in preparation for later reworks. > > > > > > > > Patch [3/8] adds the bulk of the new logic to the core SCMI stack and > > > > then each existing transport is transitioned to be a standalone driver in > > > > patches 4,5,6,7 while shuffling around the compatibles. (no DT change > > > > is needed of curse for backward compatibility) While doing this I kept > > > > the module authorship in line with the main > > > > author(S) as spitted out by git-blame. > > > > > > > > Finally patch [8/8] removes all the legacy dead code from the core > > > > SCMI stack. > > > > > > > > No new symbol EXPORT has been added. > > > > > > > > The new transport drivers have been tested, as built-in and LKM, as > > > > follows: > > > > > > > > - mailbox on JUNO > > > > - virtio on emulation > > > > - optee on QEMU/optee using Linaro setup > > > > > > > > Exercised using the regular SCMI drivers stack and the SCMI ACS suite, > > > > testing commands, replies, delayed responses and notification. > > > > > > > > Multiple virtual SCMI instances support has been tested too. > > > > > > > > SMC has NOT been tested/exercised at run-time, only compile-tested. > > > > (due to lack of hardware) > > > > > > > > Note that in this new setup, all the probe deferral and retries between > > > > the SCMI core stack and the transports has been removed, since no > > > > more needed. > > > > > > > > Moreover the new drivers have been tested also with a fully > > > > modularized SCMI stack, i.e.: > > > > > > > >   scmi-core.ko + scmi-module.ko + scmi_transport_*.ko [ + vendor > > > > modules ] > > > > > > > > ToBeDone: > > > >  - completely remove any dependency at build time at the Kconfig level > > > > between > > > >    the SCMI core and the transport drivers: so that the transports will be > > > >    dependent only on the related subsystems (optee/virtio/mailbox/smc) > > > >    (easy to be done but maybe it is not worth...) > > > >  - integrate per-platform transport configuration capabilities > > > >    (max_rx_timeout_ms & friends..) > > > > > > > > Based on sudeep/for-next/scmi/updates. > > > > > > > > Any feedback, and especially testing (:D) is welcome. > > > > > > > > > > For the v2 patchset: > > > Tested-by: Peng Fan  #i.MX95-19x19-EVK > > > > >  > > Thanks a lot for the review and testing, > >  > > Cristian > > > I've tested this v2 on stm32mp157c-scmi.dts. Using built-in modules > works perfectly.  I've tweaked my platform setup to test the .ko and > modprobe part. It works ok for the probe part but I faced kernel oops > when unloading scmi-module after transport is loaded, used, then unoaded. > The issue I saw is around calls to info->desc->ops->chan_free in > scmi_cleanup_channels(). I wonder if there are some ops that were not > unregistered when transport driver is unloaded. > You are right, I could reproduce your oops in my QEMU/optee setup. There was a bug in chan_free for optee that pre-dated this series....it is exposed when unloading the scmi-module....I'll post a fix for this as the initial patch of this series V3. Moreover even once that was fixed, there was another bug in the optee_remove of this new transport driver since I was calling the platform_driver_unregister() too late (after the check for channel empty)...as a result when you unload the scmi_transport_optee BEFORE the scmi-module (which is another valid unload sequence option) the core SCMI stack was NOT unbound like for the other transports. Last but not least, I spotted another issue for all of these transport drivers (and related WARN) when finally unloading the scmi-core module (the last one to go) due to a missing device_release...this was easily fixed just by using other platform drivers core helpers...so I refactored more the DEFINE_SCMI_TRANSPORT_DRIVER macros internals... Next week, on top of -rc1, I'll post a v3 with all the fixes I mentioned. Thanks, Cristian