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 209861AF0B4; Thu, 10 Apr 2025 07:19:19 +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=1744269560; cv=none; b=UyAWD9W0cA98qbX9cziMHy+d95XTlJ3DzlereqVkZGCFAYMmoV0oXZGD2jf1IvS2v1yFX2LDCGt5GVbURZc4KC12HpSJgxz9smjHnZGiAolMZAbBzufJBWgyO79p1B0EFjHRImGKaM+O8tRH6xbPNnD/LP5bdMKyK0CVke4kYh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744269560; c=relaxed/simple; bh=NnngEiqjBGBGhYGJlz+WHB7gQgc5fz37Z9qI5ZWYW1M=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=Hlt19L9S9eVMFRKoSfYKyRj0r0J5PEDa9lk6Ytu3OZREKtiaT8lvDb8YntrDmj16h1UQ012MK5KbiwsRm3VyBR7gkIRX6uQXXvlssJSzOI/f2lrPrd/JVt+Khe1L8zRTd5R2G1fZ52A8ksWNEWHJRDZImHNbJNL7clsojWRa6OQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pM+2JjFQ; 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="pM+2JjFQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B424C4CEDD; Thu, 10 Apr 2025 07:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744269559; bh=NnngEiqjBGBGhYGJlz+WHB7gQgc5fz37Z9qI5ZWYW1M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pM+2JjFQ7gMXZ0qjuDbNK9XuRgFbMW5OR9CqgD0NxXh7R4PGBKeTMeBrqMqYtO34s YWHJVI3upigxoQKVW5QGGhbl/hfFhEab9498Die68+hXJnJXCwmP5haAJj5EGv+MvG cDT9v6rscd+eM4tWM36hJb1oY/KZHN0UDTtJA7qA7kiEPVy+K7Im+qbnXpvtuhFyFm mJiJYYJAe+NTwa9lv/E0sELGAF/taVRqnZi4CxyOcxIjdW/nnEuXO7+XOYTg64IIRB W5aLTYi5SKoHwLouUYtwNW1LIadec94Fl4ZALVnoSGm3BcOCNDdVIrpkpM5T2rBH9x PdENWLQ9hzIyg== 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 1u2mBx-00476u-7y; Thu, 10 Apr 2025 08:19:17 +0100 Date: Thu, 10 Apr 2025 08:19:16 +0100 Message-ID: <86mscolc0b.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: <20250410070743.1072583-1-gankulkarni@os.amperecomputing.com> References: <20250410070743.1072583-1-gankulkarni@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 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. In no circumstances should HVC from a NV guest be directly handled by the host hypervisor. That's what SMC is for. Please read the pseudocode for HVC. M. -- Without deviation from the norm, progress is not possible.