From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF46326A1D0; Thu, 10 Apr 2025 10:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744282324; cv=none; b=BNJMy7MPbYRylQKh2kiiXKXAntZXQSolqS/SwTsZKLgE6xDlJLPE2XjWbHRL+aXHTnG6K36TQwOBoJVsxHeti6IOk9ZAngybOG9BvKOmuG/jwV4EFN7kDZNu/t+vMOnsG9FRC8viTSqpbKHSkbL5fOHt80ON8G8KBYQ/ENSl4cM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744282324; c=relaxed/simple; bh=hlovCCmgEdamdT8EztlgaIRBSh8lo89vsjhIHctmVUo=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=LXAOfjzH4ADEfz/SBde0fLN2dBvb24rklOhYVsZlTnkjk+0QhM27sSBem/7uw1MYn+Szx4DOVnf9FTyez8ZxZRUJGjshf7GwM5ZAKf8hcttZFfBLj9eCThVTe+qN7hR+SVLyASfjp0BouMhDXD11f55LcRNQ8VrZfD2Sv2wCYWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HvZlJF5F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HvZlJF5F" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.