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 06DC4C3601E for ; Thu, 10 Apr 2025 07:58:45 +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=ecgAqb7wLdZ9jgAz3JzJBUzlZ/I61n/cxAdNmeoMVk8=; b=Bjde9l1PRX5/kcXIqtA7Fv7CK2 H+KS/wUb7lFeBa5EIt9KOTNHpADa/vVhZyreHmLvIRoWo9RBD5PmfVS/mBtfC72C15KfKujzcy6Gx kiLHczDJXF+vc+/c7R/MFZXerPKtvbBw2l+/sgqmrU0YY7Muah/oXGCmytCC+73dSl97+TfYJgp5s 8J658OnTYuhJdHez8zZxWNllkGJOT6ki2cYVAI80icPBN0H9pOyrLK2Dqsh96Y+Q1vAmnJ4tqz/Ch jI4cOJi7r5+sEqkd0vO97TEpjcGpfmG1rs9TTn/2IETCRjyYGhG/n4O5a5AehptfuCi9B+/ud7Ho4 ZLPAMtRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u2mnx-00000009eH2-2Q0G; Thu, 10 Apr 2025 07:58:33 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u2mC0-00000009WC2-1VCK for linux-arm-kernel@lists.infradead.org; Thu, 10 Apr 2025 07:19:22 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C24515C4A54; Thu, 10 Apr 2025 07:17:02 +0000 (UTC) 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) 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_001920_460431_E0F8D127 X-CRM114-Status: GOOD ( 15.74 ) 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 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.