Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp544360rwj; Thu, 22 Dec 2022 11:02:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtQ2OKbaAU/Pw4vXhM5nJ97Hj5uCVMZLqF3mEOmbZw2hXEhrCM39gv/hVJgpY0+fL2In9J9 X-Received: by 2002:a17:906:d0d0:b0:7c1:23f2:5b51 with SMTP id bq16-20020a170906d0d000b007c123f25b51mr9255389ejb.60.1671735753992; Thu, 22 Dec 2022 11:02:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671735753; cv=none; d=google.com; s=arc-20160816; b=gSvgvU5+U1QigM7bgetXax0YZzUGoDRvrraqFfWkMFqbtemy+5F+iz6moK2PYBFIkc PUmh91jWG3z6ISRvjGZX15WkNON4YzsA2rOmTuMXc/sGG2AOVrsbC62D7W0dXdJKEPoI CATLtnLUIr9aBBWGUqJF/BdoGRnI1CwCV56LMk9we444xowHkSXY/Y6YOldVq0QmUYZU U3+uCz8L9x6Lx979FIBj1wAVSMY5OkRX6OaBjBIkRq2/OQWE+Y8SL0BT3ypQXqcRwxvM +Bh8BVepH9t5RXKLmQ+MLQEy3vlPLz75F8gHpVB7cJY96ZT/eLhhMmsK+TDCXv6D+/Qp FohA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KAKnCjqZsQkYuO++Rn1pOHJE1AB2OsFHwf8InJrSKmM=; b=mWOq10l4fn4iYoetvR/Lswl8Yp37cwrLZR5POyrHaOnLJKt2XBVnlaq1H7eH9jXTCR qEguso8odbWBMLV3clK8zbrn22PAAX4m/1hxEQEjikp5hv+u9HKmoBIoIjgh8aQKfqDO gVJESXw7MNmdVeIzYhmhCVZg4GAE8skKjvIKWFaffLgGZRXmHOuXeNx0sWE2Nwk8brxm k32M9zS3eGMHrmQT01Pw5pJ7aLJsaypF4r1YaJw6NDyJ+xUOhnoroeTGq8XN5WpO9s3L K8SYR1NZdGyOFplqPxO7H4d3sNSfiD05Flqenbck2Nm/5b9EslFyGv6uD+hJYYeineZ0 QVZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a05640240ca00b0047ed405b4a7si1343439edb.224.2022.12.22.11.02.18; Thu, 22 Dec 2022 11:02:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229840AbiLVSvK (ORCPT + 69 others); Thu, 22 Dec 2022 13:51:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbiLVSvH (ORCPT ); Thu, 22 Dec 2022 13:51:07 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BCF3122B0A for ; Thu, 22 Dec 2022 10:51:05 -0800 (PST) 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 6EE691FB; Thu, 22 Dec 2022 10:51:46 -0800 (PST) Received: from e120937-lin.. (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 130843FA32; Thu, 22 Dec 2022 10:51:03 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, Ludvig.Parsson@axis.com, cristian.marussi@arm.com Subject: [PATCH 0/9] Rework SCMI initialization and probing sequence Date: Thu, 22 Dec 2022 18:50:40 +0000 Message-Id: <20221222185049.737625-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, under some configurations the SCMI core stack, which is now initialized as a whole at the subsys_initcall level, can be dependent on some other Kernel subsystems (like TEE) when some SCMI transport backend like optee is used. This has been reported to lead to some awkward probe loop which, even though successful at the end, leaves a track of errors in the logs coming directly from the core Linux driver model facilities. In order to solve this issue and cleaning up a bit the SCMI stack startup sequence, this small series reviews and reworks the SCMI core stack initialization and probe logic. Basically the SCMI Bus is split into its own module (scmi-core.ko) which is initialized at subsys_initcall, while the SCMI core stack, including its various transport backends (like optee, mailbox, virtio, smc), is kept into a distinct module (scmi-module.ko) which get initialized at module_init. The SCMI driver users initlevel, instead, remains unchanged at module_init. No change is made to the Kconfig: the main ARM_SCMI_PROTOCOL option will now cause both modules to be built. This allows the other possibly needed subsystems to be up and running well before the core SCMI stack and its dependent transport backends, so solving the reported issue. Tested with SCMI transports mailbox/virtio and, in a previous draft, optee, in a number of different load/unload/bind/unbind combinations both as builtin and as LKMs. Applies on v6.1. Any feedback, testing welcome. Thanks, Cristian Cristian Marussi (9): firmware: arm_scmi: Simplify chan_available transport operation firmware: arm_scmi: Use dedicated devices to initialize channels firmware: arm_scmi: Move protocol registration helpers firmware: arm_scmi: Add common notifier helpers firmware: arm_scmi: Refactor protocol device creation firmware: arm_scmi: Move handle get/set helpers firmware: arm_scmi: Refactor device create/destroy helpers firmware: arm_scmi: Introduce a new lifecycle for protocol devices firmware: arm_scmi: Split bus and driver into distinct modules drivers/firmware/arm_scmi/Makefile | 8 +- drivers/firmware/arm_scmi/bus.c | 388 ++++++++++++----- drivers/firmware/arm_scmi/common.h | 25 +- drivers/firmware/arm_scmi/driver.c | 623 ++++++++++++++-------------- drivers/firmware/arm_scmi/mailbox.c | 6 +- drivers/firmware/arm_scmi/optee.c | 6 +- drivers/firmware/arm_scmi/smc.c | 6 +- drivers/firmware/arm_scmi/virtio.c | 4 +- include/linux/scmi_protocol.h | 5 - 9 files changed, 622 insertions(+), 449 deletions(-) -- 2.34.1