Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6091018rwd; Mon, 5 Jun 2023 12:55:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6IHjQQCH+6SeOv/Q9o0q55jywTbnnk6myVZFS/179snWpPNnzxST5mCF8qMhtS9XyBqO+E X-Received: by 2002:a05:620a:4917:b0:75e:ba30:8cd3 with SMTP id ed23-20020a05620a491700b0075eba308cd3mr933984qkb.35.1685994929209; Mon, 05 Jun 2023 12:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685994929; cv=none; d=google.com; s=arc-20160816; b=J0a4YRVdGEpX186ow/yiAJadt7Tma2TUKl8KeKqK6t6SeqGTlw1DOeTLg4v4z89Uyt n3YlC0s3Cr5dJTKInMO9VUVsRqLIEOgXuPUqIR+o+XOCs6uFaDCDmpgjSxX16EPD+Ynp Q+BeUhaey2tYVGr7Qx6oFfah6CHRyKWqho48q5Bqnxl22LlW1WJA0bTso5TJd3nR9CBB hXH909CKqNCa5LI+cOXKdjHD4nzzBVORQfo1OHPnR+f+P2zD8No85GRnXga4/QY68Ttn QWT/KjeuRBVJGkPWW94n9QGEGUOXw6aALEV5a8+ArCkYRt6XT1qXLPjRZWjRjDG4Ov2G P1Lw== 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 :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=82nuFTgvyuCdNMh4cUoNyR7h+q8YBDGZLD/ENpdarFg=; b=z6LrEViqQQpzp0pHujML+t4xE5EYmOvoK8/81UBg/tLVGp3CDQKKpjMHb279cgyZmQ VXu/y0P5pm3JH0ZzfjxSYJltA84M/GiSVi8vt6Hxlbs+z4lJ2mmXeB0JwE4N4NxIsmmM q5hEr/AQiN1pYk9x6i1lXecgNwIoJaHj63KRzWjNyff1eEyjkQPRgnEUqV4b5Cxu3zII nItokrTerGphdGxBg25ZGFF5WB8XVx584GRGiHpO3HRElXtmsHqcMoXVQj0hk2Qevw83 YE9OxcvtNzJdvxDDiKuk9lo+IbS/Ilk1P8m8aZmtsPU21a0+sNbPpycHMpFqe+pBU0S8 LiAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r4bX/8q+"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21-20020ae9f215000000b007577e60b9e7si4882751qkg.11.2023.06.05.12.55.13; Mon, 05 Jun 2023 12:55:29 -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=@linaro.org header.s=google header.b="r4bX/8q+"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236220AbjFETvX (ORCPT + 99 others); Mon, 5 Jun 2023 15:51:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236101AbjFETvH (ORCPT ); Mon, 5 Jun 2023 15:51:07 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE9F8120 for ; Mon, 5 Jun 2023 12:50:32 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-33b0cae115bso25213475ab.3 for ; Mon, 05 Jun 2023 12:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685994620; x=1688586620; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=82nuFTgvyuCdNMh4cUoNyR7h+q8YBDGZLD/ENpdarFg=; b=r4bX/8q+XyFRAkjC/h/ZbQa49tzc2xVhtuvXPHNeiHJewTl0iNVmKG0qujmpJ2GVIG qkGZzWnAsCIccXyC5vQIw+KYeH1s7+4AusZLnXLAHTrcZgpSEhr0GTY++gbKjVS3Kw6A UZx8qAFdxPWnfkDEGvtF9ObWmMeHGCZU/fHv1pI8kqkI0WZL6vrcD75nrLgjkKT+O7Qj hK77F1zVl4dT9qo6G7x4lLP6oLLbUnD5Eblsr9hZX1m5D4N4hbahvX7eVIGH3GHH+YOR X1XRqWYgvLdByhxKPXSMjSnOu8WBo5ph8doQcB05nrOYTHtP3P+KtipdMxYI1bPxL/E9 AcYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685994620; x=1688586620; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=82nuFTgvyuCdNMh4cUoNyR7h+q8YBDGZLD/ENpdarFg=; b=jJWL3KZU+GcVV+AXBtaDPSqGjCW639PGmi0NlcP1DWopseqDIhwD8sz4ACTFvcoUjK AJlyMPSm1i7NomfMdwWPEAM19t/h+n8iL7FGY4lFq7xH2dhS/Q+iR8gNpN30Zz27w8VY cUaQUzcNw5motmgCsZ6nAYJkJyf4zxQyueIezjRCF3sc9yolOU05lWkaCOTsW06s6nk+ B+vvU/h4Wsf5AuOg4zxj2JQ9U8tRK6OrE0tgsm5gPZq0LSThWjGphjHER0FCw6nLkpk5 Gz9L26Of5OlGYM6POJm2i1p/19/fwgcSlBHNf+lGQyXrtJjUwrmNfLd3GbUFjO7mDDPr jcgw== X-Gm-Message-State: AC+VfDxzuJ1D2uUlcMlRaIaiu7Waqa5QXp0s3rJv2p0NRfoZ6CmuOz+D SdgmPBwQSMUAVntJsdC92NDr0g== X-Received: by 2002:a92:4a02:0:b0:33b:6cc0:ee6b with SMTP id m2-20020a924a02000000b0033b6cc0ee6bmr55690ilf.13.1685994620037; Mon, 05 Jun 2023 12:50:20 -0700 (PDT) Received: from [172.22.22.28] ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id x12-20020a92060c000000b003350061b57csm2520290ilg.81.2023.06.05.12.50.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jun 2023 12:50:19 -0700 (PDT) Message-ID: Date: Mon, 5 Jun 2023 14:50:18 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Alex Elder Subject: Re: [PATCH v13 20/24] virt: gunyah: Add proxy-scheduled vCPUs To: Elliot Berman , Srinivas Kandagatla , Prakruthi Deepak Heragu , Jonathan Corbet , Catalin Marinas , Will Deacon Cc: Murali Nalajala , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Bagas Sanjaya , Andy Gross , Jassi Brar , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20230509204801.2824351-1-quic_eberman@quicinc.com> <20230509204801.2824351-21-quic_eberman@quicinc.com> Content-Language: en-US In-Reply-To: <20230509204801.2824351-21-quic_eberman@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 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,T_SCC_BODY_TEXT_LINE 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 5/9/23 3:47 PM, Elliot Berman wrote: > Gunyah allows host virtual machines to schedule guest virtual machines > and handle their MMIO accesses. vCPUs are presented to the host as a > Gunyah resource and represented to userspace as a Gunyah VM function. > > Creating the vcpu VM function will create a file descriptor that: > - can run an ioctl: GH_VCPU_RUN to schedule the guest vCPU until the > next interrupt occurs on the host or when the guest vCPU can no > longer be run. > - can be mmap'd to share a gh_vcpu_run structure which can look up the > reason why GH_VCPU_RUN returned and provide return values for MMIO > access. > > Co-developed-by: Prakruthi Deepak Heragu > Signed-off-by: Prakruthi Deepak Heragu > Signed-off-by: Elliot Berman To be honest I have spent less time immersed in the VCPU stuff than I would like. I have looked through this patch today, though, and with the exception of a typo I point out, it looks generally good to me. For now I'm going to give you this; I might take a closer look at a future date when you have updated your code. Acked-by: Alex Elder > --- > Documentation/virt/gunyah/vm-manager.rst | 46 ++- > arch/arm64/gunyah/gunyah_hypercall.c | 28 ++ > drivers/virt/gunyah/Kconfig | 11 + > drivers/virt/gunyah/Makefile | 2 + > drivers/virt/gunyah/gunyah_vcpu.c | 468 +++++++++++++++++++++++ > drivers/virt/gunyah/vm_mgr.c | 4 + > drivers/virt/gunyah/vm_mgr.h | 1 + > include/linux/gunyah.h | 24 ++ > include/uapi/linux/gunyah.h | 128 +++++++ > 9 files changed, 710 insertions(+), 2 deletions(-) > create mode 100644 drivers/virt/gunyah/gunyah_vcpu.c > > diff --git a/Documentation/virt/gunyah/vm-manager.rst b/Documentation/virt/gunyah/vm-manager.rst > index 3b51bab9d793..6789d13fed14 100644 > --- a/Documentation/virt/gunyah/vm-manager.rst > +++ b/Documentation/virt/gunyah/vm-manager.rst > @@ -5,8 +5,7 @@ Virtual Machine Manager > ======================= > > The Gunyah Virtual Machine Manager is a Linux driver to support launching > -virtual machines using Gunyah. It presently supports launching non-proxy > -scheduled Linux-like virtual machines. > +virtual machines using Gunyah. > > Except for some basic information about the location of initial binaries, > most of the configuration about a Gunyah virtual machine is described in the > @@ -98,3 +97,46 @@ GH_VM_START > ~~~~~~~~~~~ > > This ioctl starts the VM. > + > +GH_VM_ADD_FUNCTION > +~~~~~~~~~~~~~~~~~~ > + > +This ioctl registers a Gunyah VM function with the VM manager. The VM function > +is described with a &struct gh_fn_desc.type and some arguments for that type. > +Typically, the function is added before the VM starts, but the function doesn't > +"operate" until the VM starts with `GH_VM_START`_. For example, vCPU ioclts will s/ioclts/ioctls/ > +all return an error until the VM starts because the vCPUs don't exist until the > +VM is started. This allows the VMM to set up all the kernel functions needed for > +the VM *before* the VM starts. > + > +.. kernel-doc:: include/uapi/linux/gunyah.h > + :identifiers: gh_fn_desc gh_fn_type > + . . .