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: 12992845 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 ED7ECC32771 for ; Wed, 28 Sep 2022 19:59:32 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iZ+EeJ6ykUlG9ZpqSysusPjr3cJd6tepvCFE+Np2MW0=; b=vZu5bt1d2d8Aix +G3+npDEbepuh38JMvKm7/t4IcO8Y2QAMyRWzcff7h/Kdsp3W9FqyEFrIhxI5AaLoKbV9DGnQ8Two mZ3YXZSt35F9Y9r7Z1uyjeqN2S3aPW9bdeOHw+FubgFhMwiZtWCzHnLj9oWO/T3R0tfk1qPjUmU2S hNC0+gZQ/IYWZQYLTZ7Xi54fWmLJC0Z1MUE4DZQMwbsk9B5ApC74LKLj+r2ers9vUg4kogkUoXZhm gBPfjI4OH/MV+8o+klOqyHBw1nRGrGUWJCelErGC+X3GfRmf7rjM2Yg5aiEZJAwge7dfv9ROWFD3v A9eAOQJC3d+w6j4OpXbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oddCM-000CHB-OI; Wed, 28 Sep 2022 19:58:26 +0000 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oddBV-000BwG-TX for linux-arm-kernel@lists.infradead.org; Wed, 28 Sep 2022 19:57:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1664395053; x=1695931053; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6oQz+Ilwb7H/uceQOKMBX7gSuoaNnlVyYZlEI3/uvrQ=; b=iD00IqFxk8shrFVAXlg3DgFSFpiTtOTjhjKv0NRXw48euKTe78xM2Ztd +xRUz0hSM1ZIyZAFeSXRLzr+dfnS42LL4V/wmvTudk2fjXUi6rUj6Tfj4 7ruCVkHzU0VGZ0WyNZIBTKkU+ZR8SvRkFlz1UQZkHdXDc/Nwpsj158S1H Y=; 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220928_125734_008024_DACD59F2 X-CRM114-Status: GOOD ( 16.81 ) 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 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));