Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2689599lqz; Wed, 3 Apr 2024 06:04:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXNUoDkLA3DeLmPKUpOzVp0wilwcUVp4Mzyn9EidIBAgR43quj3hOFE+bj6BUrLmE69AeE1hIDCFlx1rl+VJ5iqLXI0zGGF4AyynebvNA== X-Google-Smtp-Source: AGHT+IENcjKKDkURG2b5Lgwjr7NylZ2sSe1qnqs0BKR2aKe1nYbi6n1rOSzf8RLt69w9hhk6SM1c X-Received: by 2002:a05:6602:640f:b0:7d3:3cc3:75a8 with SMTP id gn15-20020a056602640f00b007d33cc375a8mr3079838iob.9.1712149483907; Wed, 03 Apr 2024 06:04:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712149483; cv=pass; d=google.com; s=arc-20160816; b=GW0GltJ/YF+CuiS1k/ALZ3E+Uz+4pjiGVAg7PcB3ZgOTk8ZH4yYep82uucSUw69G9k Th1s544g/Zr9DprZeYuTX4OdBSWq4OkdieTI0Qoxb2KzkGJVOM3ZE1pUh9WN5jNGAeR6 kVZDwCSZBsMKmExO1RAtBNEsJeBO450nPg2bfVeifisyoHjxSn1BhHw2Et4Vd2V7xvKk 76CBkaR9dtrVcZL3W+cUwUp1Cr3NuRqHNj3A+PwtbjpGJlAoJorDhPCrTgdBoMWQEyJu JE9gujkIb7kMx2h4/uQm42yXVU1UnN+HBC/lA1iJhKPlqedVfDRPX57c40W0XIIUQ0kY bs3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=qRjaZDSFsvSKsieY8dN19AC8cm9VsRA+gmRdC8LHh8w=; fh=88I24WXoIPZl6llBdahtmcDxCS1tt/LKYP2nVaXa/aU=; b=dX9qJI9hAcFh8L7X7jdL0cd+txhCYa8nk84B1LWOaRE5RFxhRaNFy1F/+GMcYNgi1X d4AkSMajRWsrjhDDeEBJaJQ1/LeIdbwKbagxcWN6eniVUJBF7GD27mYwlgFL90JLCZar RgjsTQK48tbgVNralPZ4rlXpDpiUi+F/fF4fPe1vQZOW55bCsaSpJtJJVztefopxCTDO Yp48wfxYnIAXn9l9JeThhNt4emNa6wsL74T+AGC8BkdztW36kTgJa+48icjAXY6AEO4t 7UTwSEY72+pvp8BlvU+pTgdv8Z20/H0YPsutJ/529CVUB5sSp3bLjcF56bzVKF/9DiV6 CfDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-129774-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129774-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c14-20020a631c4e000000b005d29ed61d61si12687332pgm.78.2024.04.03.06.04.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129774-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-129774-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129774-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AE19B28A636 for ; Wed, 3 Apr 2024 13:03:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CA5D148308; Wed, 3 Apr 2024 13:03:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A855D146D4A for ; Wed, 3 Apr 2024 13:03:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712149407; cv=none; b=cQ9LNWo64mgPfoUZZ7a/c+9sgrfyEaOQOYXXdbl6+LmBtDqN3CWy7BXfPVtFo1KbfDk4WLTN7qEkpLFBb+4aQQ5I8n0QKrdmvAFIvE/hlhiyFOrHH/CAPwSnHBtrsetiezwRkqoJsSE4NGvcZHXAn94Tp3b8mNVNz9ox9BGebpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712149407; c=relaxed/simple; bh=kIOhYZcFjaultZWhhUObnw752oNQT7/I+/PK/rbt4Wg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oDHuAViTleXYS+srS+0AOpu3JmE3orba4Kxfnn6xA5dXpWdNhAxBbIx2+jNM99eCHA7doJcvbJAx6nyv6ePclKHnjVRXJvJoUlwm50nCbsIT10wvTbVd8meU9z5+gW5oXi9ZJQP97W3Y00m2RmaZ7OpzsBCQSScoFaR0JdaPA4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3259D1007; Wed, 3 Apr 2024 06:03:56 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 28AB33F7B4; Wed, 3 Apr 2024 06:03:24 -0700 (PDT) Date: Wed, 3 Apr 2024 14:03:21 +0100 From: Sudeep Holla To: Jens Wiklander Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marc Bonnici , Olivier Deprez , Lorenzo Pieralisi , Bertrand Marquis Subject: Re: [PATCH v2] firmware: arm_ffa: support running as a guest in a vm Message-ID: References: <20240325081335.2326979-1-jens.wiklander@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Mar 27, 2024 at 10:23:35AM +0100, Jens Wiklander wrote: > On Tue, Mar 26, 2024 at 4:35 PM Sudeep Holla wrote: > > > > On Mon, Mar 25, 2024 at 09:13:35AM +0100, Jens Wiklander wrote: > > > Add support for running the driver in a guest to a hypervisor. The main > > > difference is introducing notification pending interrupt and that > > > FFA_NOTIFICATION_BITMAP_CREATE doesn't need to be called. > > > > > > The guest may need to use a notification pending interrupt instead of or > > > in addition to the schedule receiver interrupt. > > > > The above statement makes me worry a bit that we are still not on the same > > page about NPI vs SRI. NPI need not exist in addition to SRI. And in v1 > > you did mention you have SRI in the guest as well. Then why do we need > > NPI in addition to that. As part of SRI, the callback ffa_self_notif_handle > > gets registered and will be called as part of SRI handling. What you > > do in notif_pend_irq_handler(), exactly what ffa_self_notif_handle() > > already does. > > That's my understanding of what an NPI handler should do to be able to > receive per-vCPU notifications. > > > > > I am still struggling to understand the usecase here. If you just have > > NPI and no SRI when running the driver in the VM, then it aligns with > > my understanding of possible use-case(not the one you mentioned in v1: > > where FF-A driver in VM will have SRI as OPTEE is the secondary scheduler) > > OP-TEE is not a secondary scheduler. OP-TEE (the SP) is scheduled as > usual by the normal world using direct request. OP-TEE doesn't receive > FF-A notifications and I'm not sure it will ever be needed. > Sorry for my poor choice of words yet again. I meant VM kernel(running as NS virtual endpoint) with OPTEE driver running in it as secondary scheduler. IIUC, there will be another instance of OPTEE driver in the primary scheduler endpoint(i.e. host kernel) and it will take care of running SRI handler ? > > > > If we are supporting NPI or SRI, I think we can see if we can further > > simplify this change, but I want to get to an agreement with usage model > > before we dig into implementation details in this patch. > > The spec doesn't as far as I know explicitly make NPI and SRI mutually > exclusive, it doesn't make sense to use both in all configurations. > I'm trying to be as dynamic as possible when configuring the NPI and > SRI handlers. > Fair enough > If the kernel is a physical endpoint, it's easy, it only uses SRI and > the SPMC will not give an NPI when asked. > Agreed. > If the kernel is a virtual endpoint it might be more complicated since > a VM may need to act as a secondary scheduler. That's not fully > supported in this patch, since it can only schedule itself. SRI is not > used in my current configuration. If a hypervisor injects an SRI I > expect it to filter what's returned by FFA_NOTIFICATION_INFO_GET for > this VM so it doesn't interfere with notifications for other VMs. > OK > In my current configuration, the hypervisor uses NPI to signal pending > notifications to the guest. I do not need a secondary scheduler since > OP-TEE doesn't receive notifications. At a later time, we may have SPs > that need to be scheduled, but that's not a problem I'm trying to > solve here. Understood. I will take a look at the patch with the above information. -- Regards, Sudeep