Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp651748rwi; Wed, 2 Nov 2022 16:45:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7doEMmJtJfFNYy4AtYa4e5doiUFBZk6WOo3QL/n44h/JnbbrEl3s/l51xvhXa925yTobIs X-Received: by 2002:a05:6402:7c4:b0:462:9bc2:d0d0 with SMTP id u4-20020a05640207c400b004629bc2d0d0mr27677405edy.122.1667432734903; Wed, 02 Nov 2022 16:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667432734; cv=none; d=google.com; s=arc-20160816; b=wGoLEe4v1IXT34Mwtk+lbMJHecPRdh/NSaaPliGXiDm6nEqEGwnVJ/Hc4QbtpeFteP X5mE9+Iu1KOnMbEXXhs5lXDU1HQUcem8/8mZn0rohyqs8g0cq2kuDwbR3+Vq3AQfG/EZ NY4j+idUSHfLhaKnU05c4mvmyvVio5YI2mU8frrb6OKWvkD5DqfpYXFepPkCu39miiRy ARgqGp2u8K8nXt9YbItbfpYASexBEb7Z4yTOKS43WzlIBRuF4YQlF604WtC00TS5LaV+ JCa2byWFCWz/qHOTzNs0WhOI5d5H8CKzADur/dP35RJ5I9bSC+JmSL/fjaj+wl1g6WQc FD8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9JcnpLti/JdGSyuJtGNbEiQSccAd5KuIJvHbf0sd6DU=; b=aigyD7k2C1dAzqnl7oNJIoUAys7RG2qYlOMsL7nlsCSTRdbcSrHj1s9Pjdz8PE5Ebi glruIWdR1COnSnao1JabA0tLjQE0h1kvkMu+5jvD/ukFtOForCYOI+gUsUOSYmexs3oF zzp1vt8Vgoj10+fJhtx93/2PAASeQIkk2fP4McDWqBa3tTubjuXO/8trdgrsYKivjHh6 +GqqoQm2tkoxWdZpjSj2XmfkkIEmw4UFCQIkDqJ7uQPwdppu1RJL5C6kqVptUR7ll3N/ e+GMLJDRvIJS6mARNCsLbQzk7UBJIQasHw3IvIDYq/3/6mw6UEr1NkORsBQyn9YKt1e6 BHig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=SyArAVIK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec42-20020a0564020d6a00b00462e7873c10si13814996edb.337.2022.11.02.16.45.11; Wed, 02 Nov 2022 16:45:34 -0700 (PDT) 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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=SyArAVIK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbiKBXbi (ORCPT + 97 others); Wed, 2 Nov 2022 19:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbiKBXbW (ORCPT ); Wed, 2 Nov 2022 19:31:22 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 881A81D0D3; Wed, 2 Nov 2022 16:24:24 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A2NF4U2013580; Wed, 2 Nov 2022 23:23:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=9JcnpLti/JdGSyuJtGNbEiQSccAd5KuIJvHbf0sd6DU=; b=SyArAVIKcSodDWgTMv/fj1pHQoH+ySPN1ErCr3fHvWMrxxu/zWDS7b/a0AD2pxgVbAIp Hl6C/D/cTv34giYxSv2un66q14MvuRoC5JUmanUQqUPhhisbO10F7fzUkAT6HFUQdSf3 1QzrKwoC+AV53m99ZgNQ0yohZADZXgndckTBWUGMXo5aFJvGKCSwPOxbMX3HFJdxgUM3 tfDdtAHxRcilML64cNoui78gyb2lUjUMgWiZWXKWLxvXVo4etgNPDJr6cB6KmRRwKbNC 37XRIp3PmKhgCHCNJhwShA8XFWyfB42MacGSZjCsJAMcR8tgF2PulotgI/uIuFYRmpWl Gw== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3km22700js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Nov 2022 23:23:22 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2A2NNLLG013848 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 2 Nov 2022 23:23:21 GMT Received: from [10.134.65.5] (10.80.80.8) 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, 2 Nov 2022 16:23:20 -0700 Message-ID: <10525d0d-b887-6960-5fbc-933b91e2e97c@quicinc.com> Date: Wed, 2 Nov 2022 16:23:20 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v6 02/21] dt-bindings: Add binding for gunyah hypervisor Content-Language: en-US To: Jassi Brar CC: Bjorn Andersson , Murali Nalajala , Greg Kroah-Hartman , Krzysztof Kozlowski , Rob Herring , Trilok Soni , "Srivatsa Vaddagiri" , Carl van Schaik , Prakruthi Deepak Heragu , Andy Gross , Dmitry Baryshkov , , "Mark Rutland" , Lorenzo Pieralisi , Sudeep Holla , "Marc Zyngier" , Jonathan Corbet , Will Deacon , Catalin Marinas , Arnd Bergmann , Srinivas Kandagatla , "Amol Maheshwari" , Kalle Valo , , , , References: <20221026185846.3983888-1-quic_eberman@quicinc.com> <20221026185846.3983888-3-quic_eberman@quicinc.com> <4cb58489-cd42-1868-9add-0c360065de23@quicinc.com> <62f7402d-f0e7-8e8a-e1a4-958ddbcf8d8b@quicinc.com> <840d876c-6a09-59cf-fc66-c5752ad22d7e@quicinc.com> From: Elliot Berman In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: k7e7Kmk4_Zody_NtyU4RNyPBpdgg4RcX X-Proofpoint-GUID: k7e7Kmk4_Zody_NtyU4RNyPBpdgg4RcX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-02_15,2022-11-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 adultscore=0 mlxlogscore=831 priorityscore=1501 mlxscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211020155 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 On 11/2/2022 11:24 AM, Jassi Brar wrote: > On Wed, Nov 2, 2022 at 1:06 PM Elliot Berman wrote: >> >> Hi Jassi, >> >> On 11/1/2022 7:01 PM, Jassi Brar wrote: >>> On Tue, Nov 1, 2022 at 7:12 PM Elliot Berman wrote: >>>> >>>> >>>> >>>> On 11/1/2022 2:58 PM, Jassi Brar wrote: >>>>> On Tue, Nov 1, 2022 at 3:35 PM Elliot Berman wrote: >>>>>> >>>>>> >>>>>> >>>>>> On 11/1/2022 9:23 AM, Jassi Brar wrote: >>>>>>> On Mon, Oct 31, 2022 at 10:20 PM Elliot Berman wrote: >>>>>>>> >>>>>>>> Hi Jassi, >>>>>>>> >>>>>>>> On 10/27/2022 7:33 PM, Jassi Brar wrote: >>>>>>>> > On Wed, Oct 26, 2022 at 1:59 PM Elliot Berman >>>>>>>> wrote: >>>>>>>> > ..... >>>>>>>> >> + >>>>>>>> >> + gunyah-resource-mgr@0 { >>>>>>>> >> + compatible = "gunyah-resource-manager-1-0", >>>>>>>> "gunyah-resource-manager"; >>>>>>>> >> + interrupts = , /* TX >>>>>>>> full IRQ */ >>>>>>>> >> + ; /* RX >>>>>>>> empty IRQ */ >>>>>>>> >> + reg = <0x00000000 0x00000000>, <0x00000000 0x00000001>; >>>>>>>> >> + /* TX, RX cap ids */ >>>>>>>> >> + }; >>>>>>>> >> >>>>>>>> > All these resources are used only by the mailbox controller driver. >>>>>>>> > So, this should be the mailbox controller node, rather than the >>>>>>>> > mailbox user.> One option is to load gunyah-resource-manager as a >>>>>>>> module that relies >>>>>>>> > on the gunyah-mailbox provider. That would also avoid the "Allow >>>>>>>> > direct registration to a channel" hack patch. >>>>>>>> >>>>>>>> A message queue to another guest VM wouldn't be known at boot time and >>>>>>>> thus couldn't be described on the devicetree. >>>>>>>> >>>>>>> I think you need to implement of_xlate() ... or please tell me what >>>>>>> exactly you need to specify in the dt. >>>>>> >>>>>> Dynamically created virtual machines can't be known on the dt, so there >>>>>> is nothing to specify in the DT. There couldn't be a devicetree node for >>>>>> the message queue client because that client is only exists once the VM >>>>>> is created by userspace. >>>>>> >>>>> The underlying "physical channel" is the synchronous SMC instruction, >>>>> which remains 1 irrespective of the number of mailbox instances >>>>> created. >>>> >>>> I disagree that the physical channel is the SMC instruction. Regardless >>>> though, there are num_online_cpus() "physical channels" with this >>>> perspective. >>>> >>>>> So basically you are sharing one resource among users. Why doesn't the >>>>> RM request the "smc instruction" channel once and share it among >>>>> users? >>>> >>>> I suppose in this scenario, a single mailbox channel would represent all >>>> message queues? This would cause Linux to serialize *all* message queue >>>> hypercalls. Sorry, I can only think negative implications. >>>> >>>> Error handling needs to move into clients: if a TX message queue becomes >>>> full or an RX message queue becomes empty, then we'll need to return >>>> error back to the client right away. The clients would need to register >>>> for the RTS/RTR interrupts to know when to send/receive messages and >>>> have retry error handling. If the mailbox controller retried for the >>>> clients as currently proposed, then we could get into a scenario where a >>>> message queue could never be ready to send/receive and thus stuck >>>> forever trying to process that message. The effect here would be that >>>> the mailbox controller becomes a wrapper to some SMC instructions that >>>> aren't related at the SMC instruction level. >>>> >>>> A single channel would limit performance of SMP systems because only one >>>> core could send/receive a message. There is no such limitation for >>>> message queues to behave like this. >>>> >>> This is just an illusion. If Gunyah can handle multiple calls from a >>> VM parallely, even with the "bind-client-to-channel" hack you can't >>> make sure different channels run on different cpu cores. If you are >>> ok with that, you could simply populate a mailbox controller with N >>> channels and allocate them in any order the clients ask. >> >> I wanted to make sure I understood the ask here completely. On what >> basis is N chosen? Who would be the mailbox clients? >> > A channel structure is cheap, so any number that is not likely to run > out. Say you have 10 possible users in a VM, set N=16. I know ideally > it should be precise and flexible but the gain in simplicity makes the > trade-off very acceptable. I think I get the direction you are thinking now. N is chosen based off of how many clients there might be. One mailbox controller will represent all message queues and each channel will be one message queue. There are some limitations that might make it more complex to implement than having 1 message queue per controller like I have now. My interpretation is that mailbox controller knows the configuration of its channels before being bound to a client. For dynamically created message queues, the client would need tell the controller about the message queue configuration. I didn't find example where client is providing information about a channel to the controller. 1. need a mechanism to allow the client to provide the gunyah_resources for the channel (i.e. the irqs and cap ids). 2. Still need to have bind-client-to-channel patch since clients aren't real devices and so shouldn't be on DT. Thanks, Elliot