From patchwork Wed Sep 28 19:56:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 610285 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD501C6FA98 for ; Wed, 28 Sep 2022 20:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234443AbiI1UAm (ORCPT ); Wed, 28 Sep 2022 16:00:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234739AbiI1UAR (ORCPT ); Wed, 28 Sep 2022 16:00:17 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC4F64DF; Wed, 28 Sep 2022 12:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1664395175; x=1695931175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6oQz+Ilwb7H/uceQOKMBX7gSuoaNnlVyYZlEI3/uvrQ=; b=aiPeCHsHtkjPsNYRnqcnJT0n4dZ3mHC74j1G/3cO4B9lW90B8itMWJ4b W7VLhKcYLOF5pk6JUmqYpWdXfwVBeSnvo4I42bUZ0990SxH9Zw33Bro4T 8YVLstxbHVtveHTS+jlIk3lfkw4rxMajk4NwI2tleM87aOBoDW+YlnzC+ U=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 28 Sep 2022 12:57:32 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 12:57:32 -0700 Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 28 Sep 2022 12:57:31 -0700 From: Elliot Berman To: Bjorn Andersson CC: Elliot Berman , Murali Nalajala , Trilok Soni , "Srivatsa Vaddagiri" , Carl van Schaik , Andy Gross , Dmitry Baryshkov , Jassi Brar , , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , "Will Deacon" , Catalin Marinas , "Arnd Bergmann" , Greg Kroah-Hartman , , , , Subject: [PATCH v4 13/14] gunyah: rsc_mgr: Add auxiliary devices for console Date: Wed, 28 Sep 2022 12:56:32 -0700 Message-ID: <20220928195633.2348848-14-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220928195633.2348848-1-quic_eberman@quicinc.com> References: <20220928195633.2348848-1-quic_eberman@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01b.na.qualcomm.com (10.46.141.250) Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Gunyah resource manager exposes a concrete functionalities which complicate a single resource manager driver. Use auxiliary bus to help split high level functions for the resource manager and keep the primary resource manager driver focused on the RPC with RM itself. Delegate Resource Manager's console functionality to the auxiliary bus. Signed-off-by: Elliot Berman --- drivers/virt/gunyah/Kconfig | 1 + drivers/virt/gunyah/rsc_mgr.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/virt/gunyah/Kconfig b/drivers/virt/gunyah/Kconfig index 78deed3c4562..610c8586005b 100644 --- a/drivers/virt/gunyah/Kconfig +++ b/drivers/virt/gunyah/Kconfig @@ -17,6 +17,7 @@ config GUNYAH_RESORUCE_MANAGER tristate "Gunyah Resource Manager" select MAILBOX select GUNYAH_MESSAGE_QUEUES + select AUXILIARY_BUS default y help The resource manager (RM) is a privileged application VM supporting diff --git a/drivers/virt/gunyah/rsc_mgr.c b/drivers/virt/gunyah/rsc_mgr.c index 7f7e89a6436b..435fe0149915 100644 --- a/drivers/virt/gunyah/rsc_mgr.c +++ b/drivers/virt/gunyah/rsc_mgr.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -98,6 +99,8 @@ struct gh_rsc_mgr { struct mutex send_lock; struct work_struct recv_work; + + struct auxiliary_device console_adev; }; static struct gh_rsc_mgr *__rsc_mgr; @@ -573,13 +576,31 @@ static int gh_rm_drv_probe(struct platform_device *pdev) __rsc_mgr = rsc_mgr; + rsc_mgr->console_adev.dev.parent = &pdev->dev; + rsc_mgr->console_adev.name = "console"; + ret = auxiliary_device_init(&rsc_mgr->console_adev); + if (ret) + goto err_msgq; + ret = auxiliary_device_add(&rsc_mgr->console_adev); + if (ret) + goto err_console_adev_uninit; + return 0; + +err_console_adev_uninit: + auxiliary_device_uninit(&rsc_mgr->console_adev); +err_msgq: + gunyah_msgq_remove(&rsc_mgr->msgq); + return ret; } static int gh_rm_drv_remove(struct platform_device *pdev) { struct gh_rsc_mgr *rsc_mgr = platform_get_drvdata(pdev); + auxiliary_device_delete(&rsc_mgr->console_adev); + auxiliary_device_uninit(&rsc_mgr->console_adev); + __rsc_mgr = NULL; mbox_free_channel(gunyah_msgq_chan(&rsc_mgr->msgq));