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 21D9515ECE2 for ; Fri, 10 May 2024 07:59:36 +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=1715327977; cv=none; b=jzHPOSUX9lmvuFQNwZgjrMOW5aTcUXy6EZgYUyu5Jg7OaNtYQN4ZElxi5mk0ebqh7CXmxY+FMHpsFENhuNmjmz7ezR4qx45FGuFXs9KKOrAEA7FanTgg7tPmWxraHmNJtMJMQymWReEnn9X0TmCFgs7Sub+80zWYhnAsq284Rjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715327977; c=relaxed/simple; bh=DxOvpsgEHZ9pvHQR4+G8L0dbCp083cm20r2+xeSfpQM=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=UvYfkqXANd5GS9mEJtKPM5TM3/+/iLJ4kmyBI/HOZmFGaHQ3Z9/5e9afFx5Qv98lxgmALt1fFE846eNCp394qoOvbv2FP6w9MBROdi6BwRBtSRCO/JJ2FoJnIiqaPYg9wByft1hbgyVUBYxnGJvqFpFvfmuXcRBSJ1WFS8pON7U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FmHdt2Ox; 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="FmHdt2Ox" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82B42C113CC; Fri, 10 May 2024 07:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715327976; bh=DxOvpsgEHZ9pvHQR4+G8L0dbCp083cm20r2+xeSfpQM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FmHdt2OxcsNLCeoC+Es3KRbd6kRFsSwuYusWHKm2HGZsOHo92vtGgGS5qeH7XFXk/ YL0vXnNcGdsClO5+zBGvpdXpPIhBkGRxJKlHTmQY8TzNOlgsMVnPgzFo1bAKYaC2L0 3dTAqK+WB82c0oJi2dJQn5AGsIPB0X4IhIQIHgi9i3cA7BGHOZFW0Dz5rQNvpnyG9i UEPhW1sUAao/hgSUCuQKHQkHVePcGoVS1QWRmdu6bYtZNKutaNE+NwOxY+xs94aE6h 3q00b1IoU/CN3aZoGDZVQUFP71xjbY3vwioflFeDeXxeoCEP9DaGximP1P3x76FyQl TYki84b/5cNAQ== 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 1s5LAD-00C8U8-Vb; Fri, 10 May 2024 08:59:34 +0100 Date: Fri, 10 May 2024 08:59:33 +0100 Message-ID: <86ttj6p062.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Zenghui Yu , kvmarm@lists.linux.dev, will@kernel.org, qperret@google.com, seanjc@google.com, alexandru.elisei@arm.com, catalin.marinas@arm.com, philmd@linaro.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, mark.rutland@arm.com, broonie@kernel.org, joey.gouly@arm.com, rananta@google.com, smostafa@google.com Subject: Re: [PATCH v4 01/30] KVM: arm64: Initialize the kvm host data's fpsimd_state pointer in pKVM In-Reply-To: References: <20240423150538.2103045-1-tabba@google.com> <20240423150538.2103045-2-tabba@google.com> <4ec3be32-476a-14f2-7826-2171df1c9f77@huawei.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.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: tabba@google.com, yuzenghui@huawei.com, kvmarm@lists.linux.dev, will@kernel.org, qperret@google.com, seanjc@google.com, alexandru.elisei@arm.com, catalin.marinas@arm.com, philmd@linaro.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, mark.rutland@arm.com, broonie@kernel.org, joey.gouly@arm.com, rananta@google.com, smostafa@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 10 May 2024 07:44:42 +0100, Fuad Tabba wrote: >=20 > Hi, >=20 > On Fri, May 10, 2024 at 3:40=E2=80=AFAM Zenghui Yu = wrote: > > > > I asked that in protected mode, how do we save the host state? It looks > > to me that we only save it into EL2's private > > kvm_host_data->host_ctxt.fp_regs which the host kernel isn't aware of. > > How can host kernel restore the state for the current task later (e.g., > > for host userspace accesses)? What am I missing? >=20 > What I'm going to say applies only to protected VMs in protected mode, > i.e., non-protected VM's in protected mode use the mechanism above > (kvm_arch_vcpu_load_fp()). >=20 > Also, the upstream code for pKVM isn't complete yet as we're still > upstreaming it, so you not being able to find something is our fault > not yours :) You can find my branch of pKVM, based on the latest > kvmarm/next here [1]. >=20 > For protected VMs, we don't want to lazily save/restore the host's > fpsimd state, because that could leak information to the host that the > protected guest is using fpsimd. Therefore, for protected VMs, the > host fpsimd state is maintained (saved/restored) in hyp (at EL2), > without the host needing to know or do anything about it. But I think that's a regression from the current status. It looks like now that the state is really private to EL2, nothing will restore the FP context on exit, while this was the case before we reworked this. It'd be good to plug this in 6.10, as this is a regression. Thanks, M. --=20 Without deviation from the norm, progress is not possible.