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 015B2C00140 for ; Tue, 2 Aug 2022 09:25:40 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SBh3X8674ME8BrvBV3O/RasizFrplhdYfy42eFZ0VpM=; b=gx33eo+2YsBVoL lgnwLshOHKjula/CIUimxXKil9I4AlZtrdM6cRU49RI9ZhTEZdXVdPcVHnJ/TvCKxpPOYbO+tJZYG l/5A/2iKZ67KYpLo1mo/5CnyrgeLtllcxZWOeK5PsLDnbruAMuGSaQJ8f3evkBE6BMWfO0OnpaytS 4gm18w41eCMxtsAszdZ42uGgXpVhlf/rpUT76rfNIPEa7CcrDC1cIVFYzBEWeQaD0pXFHWWxR865O jqslAnLlUaYB7mPV7wJYn8QxN3fUX1Alc7bmdEXba0hrjHR3gXcPJtymOv9w58IXSSyN32BV0Rxct CpEs968TqHJRQQRV6v7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIo8b-00CLTW-BL; Tue, 02 Aug 2022 09:24:29 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIo8X-00CLQE-5R for linux-arm-kernel@lists.infradead.org; Tue, 02 Aug 2022 09:24:27 +0000 Received: by mail-lf1-x131.google.com with SMTP id a9so8282284lfm.12 for ; Tue, 02 Aug 2022 02:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=1n1ZKC51PL7oA8qvseMiLtJyJ6uxOwh3lLvNachyl1g=; b=SkPaGq8iz1oHc+v7esobJprt9PJgk67NAJHJdsKvxA4Kb40e4boROTAcUc2xJkDOtP feiZ4DFggiNTTdytEx5RqfqnF9zoj0Ovv/NDSwuP+Qt0gSOM4kTxBz9LaBBmjh3gYcI8 om5PBZP8AbVCWg0xSi5ruxNf2iyyRdZ6CY6rsQhR1zD0h/wCidH1BKH47KOcQMNSiZ1N PDGarGTsjYrWojQ6gq85qllU6HPIBbbsDHui241G6b21VvTZmfSgB3jGRCj7C0tgt98M VyA5lbHDlWTfKlqOFAmu36bhGTfFSSzXVtOIqwgMAJG6jd9t9YyBW54hF1K3wE0OYD3g ZvsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=1n1ZKC51PL7oA8qvseMiLtJyJ6uxOwh3lLvNachyl1g=; b=n6z5kqPP00bP/hot9bBVKBPCnQGKseUU0mfIO82HFopczFB2HfAZ5FFO3yNSo5DVkQ KeCkxKbtb6k9vA52kgJkBz9iHJFPBmzeJ7+yH05HVMtNmy723BGbDlYPrhxkVOsbptZO pjSvd737B1Scvv/tKHbYOK++l5V37mV0C6eq42fQvDBi0fSsdLxEdUaDaRtAWOrjO2dv vz9mkZjox08y7FMoRlZfQiTlzs60r1iP0bbv0fjHmZbGZkzjgfNr4jow8RkNuGx8/+5N iU9/BO1YdJB/ijKpt9UyaOYjTbvcCWJ5/wOg7OeLb3PkJiixBaSEVgtaPpwM8DdR+fh1 hAEQ== X-Gm-Message-State: AJIora/O/ebL8GVud9gcWuix60/A4v80bugY2M2sViIF1SxF5JnePWD1 7g/tDuZlQhlmzX2MsAMQe+UBSQ== X-Google-Smtp-Source: AGRyM1uBK8mjLp2Dc3a0wZ5cXTLENaz5MzrxfwZV1SGtxG45Quj5zu+tMF8YQMQoSC9KIbWP1jib7Q== X-Received: by 2002:a19:f004:0:b0:48a:bf41:1e70 with SMTP id p4-20020a19f004000000b0048abf411e70mr6530388lfc.342.1659432263152; Tue, 02 Aug 2022 02:24:23 -0700 (PDT) Received: from [192.168.1.211] ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id z13-20020a2eb52d000000b0025dc0adf38csm119052ljm.61.2022.08.02.02.24.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Aug 2022 02:24:22 -0700 (PDT) Message-ID: <50230652-c1ae-4ce2-907c-9bdc6b827f8e@linaro.org> Date: Tue, 2 Aug 2022 12:24:21 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2 00/11] Drivers for gunyah hypervisor Content-Language: en-GB To: Elliot Berman , Bjorn Andersson Cc: Murali Nalajala , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Andy Gross , linux-arm-kernel@lists.infradead.org, Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Will Deacon , Catalin Marinas , devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20220801211240.597859-1-quic_eberman@quicinc.com> From: Dmitry Baryshkov In-Reply-To: <20220801211240.597859-1-quic_eberman@quicinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220802_022425_352237_A3678411 X-CRM114-Status: GOOD ( 28.29 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 02/08/2022 00:12, Elliot Berman wrote: > Gunyah is a Type-1 hypervisor independent of any > high-level OS kernel, and runs in a higher CPU privilege level. It does > not depend on any lower-privileged OS kernel/code for its core > functionality. This increases its security and can support a much smaller > trusted computing base than a Type-2 hypervisor. > > Gunyah is an open source hypervisor. The source repo is available at > https://github.com/quic/gunyah-hypervisor. > > The diagram below shows the architecture. > > :: > > Primary VM Secondary VMs Is there any significant difference between Primary VM and other VMs? > +-----+ +-----+ | +-----+ +-----+ +-----+ > | | | | | | | | | | | > EL0 | APP | | APP | | | APP | | APP | | APP | > | | | | | | | | | | | > +-----+ +-----+ | +-----+ +-----+ +-----+ > ---------------------|------------------------- > +--------------+ | +----------------------+ > | | | | | > EL1 | Linux Kernel | | |Linux kernel/Other OS | ... > | | | | | > +--------------+ | +----------------------+ > --------hvc/smc------|------hvc/smc------------ > +----------------------------------------+ > | | > EL2 | Gunyah Hypervisor | > | | > +----------------------------------------+ > > Gunyah provides these following features. > > - Threads and Scheduling: The scheduler schedules virtual CPUs (VCPUs) on > physical CPUs and enables time-sharing of the CPUs. Is the scheduling provided behind the back of the OS or does it require cooperation? > - Memory Management: Gunyah tracks memory ownership and use of all memory > under its control. Memory partitioning between VMs is a fundamental > security feature. > - Interrupt Virtualization: All interrupts are handled in the hypervisor > and routed to the assigned VM. > - Inter-VM Communication: There are several different mechanisms provided > for communicating between VMs. > - Device Virtualization: Para-virtualization of devices is supported using > inter-VM communication. Low level system features and devices such as > interrupt controllers are supported with emulation where required. After reviewing some of the patches from the series, I'd like to understand, what does it provide (and can be provided) to the VMs. I'd like to understand it first, before going deep into the API issues. 1) The hypervisor provides message queues, doorbells and vCPUs Each of resources has it's own capability ID. Why is it called capability? Is it just a misname for the resource ID, or has it any other meaning behind? If it is a capability, who is capable of what? At this moment you create allocate two message queues with fixed IDs for communication with resource manager. Then you use these message queues to organize a console and a pack of tty devices. What other kinds of services does RM provide to the guest OS? Do you expect any other drivers to be calling into the RM? What is the usecase for the doorbells? Who provides doorbells? You mentioned that the RM generates DT overlays. What kind of information goes to the overlay? My current impression of this series is that you have misused the concept of devices. Rather than exporting MSGQs and BELLs as gunyah_devices and then using them from other drivers, I'd suggest turning them into resources provided by the gunyah driver core. I mentioned using the mailbox API for this. Another subsystem that might ring the bell for you is the remoteproc, especially the rproc_subdev. I might be completely wrong about this, but if my in-mind picture of Gunyah is correct, I'd have implemented the gunyah core subsytem as mailbox provider, RM as a separate platform driver consuming these mailboxes and in turn being a remoteproc driver, and consoles as remoteproc subdevices. I can assume that at some point you would like to use Gunyah to boot secondary VMs from the primary VM by calling into RM, etc. Most probably at this moment a VM would be allocated other bells, message queues, etc. If this assumption is correct, them the VM can become a separate device (remoteproc?) in the Linux device tree. I might be wrong in any of the assumptions above. Please feel free to correct me. We can then think about a better API for your usecase. -- With best wishes Dmitry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel