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 2DD17C3601E for ; Thu, 10 Apr 2025 11:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eLaWaf4WTpzRBoAENTouydfuolKBwKCilCb3vAcEa38=; b=GYLiBn1boC9ohTQWcGvpHucntL XOEp0kslWCK8DNe61IrqEAPdBx2EX98aSx+HMmh7fWbZjfsXDr44AI7cqqcIA/CgAKaOLDPYVKasB 2L1Go7D82U6tSQY8yO8koylvH3l5gfz3sCljpDrF6uCRI7sQz/1zNVgqlD1J6pOEam5tVuLGASgfJ drYqwYauHByqgtUNa75KaxVbRZpXKJrJRyG+kdeL9zxIwvh3jIIWWVipdItP6cUW/VnKDjGmxxbk/ fRvri/LLBa8I5cX2Y9e5JsAbitmXLFf5yrW7QkLtoqy/NXI/KfAX85rIP7Eh6b2xKz6g47gf/K32t PkDNYfNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u2q8v-0000000AJNe-1tRO; Thu, 10 Apr 2025 11:32:25 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u2pVt-0000000A93x-13Uf for linux-arm-kernel@lists.infradead.org; Thu, 10 Apr 2025 10:52:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 757FB4510A; Thu, 10 Apr 2025 10:52:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2842DC4CEDD; Thu, 10 Apr 2025 10:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744282324; bh=hlovCCmgEdamdT8EztlgaIRBSh8lo89vsjhIHctmVUo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HvZlJF5FsoBTWQN8RX/rjzTGvuLCmCB9WtTN6b5aR+OSHLP1UUvn6+puJt2Io5a+s QmfrbvD0eGcJNsuhUtqyKNtt4ofeqLiTu1hvr7RHN7lxB5Ifx23SG499XfND52AAb3 X1ETe8UexSH6l7Sfh4rfHIHIxDnfo74/vIsn7WtfKddvUdnfH5Qp8WOpSF5ywnaSGN H71D4VA4zbRJH9Eivac8Z90Nu1PvgwSgJ76OR8NM0D3T5wkZMN+k6plK8XCQACnmW+ Ymr0rmZI0/syf6cl+1Q3triaS7KgV72dK98ykoRvHileuHL21SHRg7o2YLR5wOJ6p5 JYFTge5LhpUNg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1u2pVp-004Bdn-Ee; Thu, 10 Apr 2025 11:52:01 +0100 Date: Thu, 10 Apr 2025 11:52:00 +0100 Message-ID: <86jz7sl25r.wl-maz@kernel.org> From: Marc Zyngier To: Ganapatrao Kulkarni Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, darren@os.amperecomputing.com Subject: Re: [PATCH] KVM: arm64: nv: Forward hvc traps if originated from nested VM In-Reply-To: <4d1bdea5-43c3-4ca9-9275-feadf158e86e@os.amperecomputing.com> References: <20250410070743.1072583-1-gankulkarni@os.amperecomputing.com> <86mscolc0b.wl-maz@kernel.org> <4d1bdea5-43c3-4ca9-9275-feadf158e86e@os.amperecomputing.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: gankulkarni@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, darren@os.amperecomputing.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250410_035205_305897_230AEDE2 X-CRM114-Status: GOOD ( 20.59 ) 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 On Thu, 10 Apr 2025 11:20:24 +0100, Ganapatrao Kulkarni wrote: > > > > On 10-04-2025 12:49 pm, Marc Zyngier wrote: > > On Thu, 10 Apr 2025 08:07:43 +0100, > > Ganapatrao Kulkarni wrote: > >> > >> It was discovered while trying selftest(smccc_filter) that the > >> hvc trap is getting forwarded to guest hypervisor even if it is > >> originated from itself. > >> > >> HVC traps from guest hypervisor should be handled by the host > >> hypervisor and traps originating from nested VM should be > >> forwarded. Adding check to forward only if the hvc is trapped > >> from the nested VM. > > > > I disagree. HVC from EL2 must be routed to the same EL2. HVC from EL1 > > must be routed to the EL2 controlling EL1. > > Thanks, Understood, In NV case, hvc has to be forwarded to L1 > irrespective of it origin (L1 or L2). Need to add hvc handler in the > smccc_filter.c for the vm (when run as L1), so that it is handled and > returns with required args set. Why? This test checks under which conditions an HVC/SMC gets routed to userspace. What does it even mean to test HVC if it doesn't make it outside of the guest itself? M. -- Without deviation from the norm, progress is not possible.