Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp870170lqz; Sun, 31 Mar 2024 03:00:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUi10pF/yHvm2FPDbnWQ07o998oFKpSxcfWmFvSVq0ohjdnWRNgs+6xtaKVWLC9kvduccrvq3dW/Fun+lLSsjyBLcz32YF7S7MVd9ALlA== X-Google-Smtp-Source: AGHT+IHGRkhSUvpl1Pp8AgwGyKsf8W1QsqvztAx8wlP0Uhghknrc4COO2O0UYziUAu8sLZ2lbook X-Received: by 2002:a17:906:4f92:b0:a4e:2ac2:cc67 with SMTP id o18-20020a1709064f9200b00a4e2ac2cc67mr3917702eju.9.1711879258110; Sun, 31 Mar 2024 03:00:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711879258; cv=pass; d=google.com; s=arc-20160816; b=eh7cacui8lZ09gAjn57yPoqJQ8VgWhsc9mXY20vx/BhbrnQCeQjZvlemJFpKWax0Ve qBufeGFsy8FvQXZwYlB7gFiMgX85fQTkO8brOPYBlMh55nlMYnfrvnVlVAdZr+n42iHk UXekA6V16dpBAkhEToxdGq3DrPESaOsBM0PjRctPiW/7dJzYpeMpV8VcoyoGBw58he2S sOBnX4ec7sPZTVbi3DGhw9MGXdG3H16j6BrH+YACwWsAiYCXeQNKSTXDdIAyay7s9G0B gTTAhhQJHdwn7nbSbjm6n7WNZawsCaBUNwhesCTWv+nEH2MPzOOXk6NexxQ7oVE+Tpw4 goJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=q938MEE811z83BFvtZGG0piY9OddVErjEjXvXsKPS3o=; fh=kMCeI7b2dYY7R2wKmvevC0PFz2MMN2cSikVkL3i1HJE=; b=mjtV5l48Zm+365chDNF1oQeKE2nK7bimSOLTmUdMtRfX6sLrVks33zixNuM4FHtQHG Lc7rcF9o9yesHzgxQb2NZFeRpG5kFYHYdBjMmunkG3Lj0OkqV1WjW9ZyqIwfOHhebYk8 l94lMAm3hqIe8dmZc87HeUyEeQRyD+mFVGogkr70WsBP19rrFjSvlCU0gm33LtKimIjI spuHscrHb5dNqEackesqbtniVWSAbG6t6MsqsCQ4Yb5GKW/ZqVTEBFKQVfRhdW9h2Ceo brFZhphqXIn7AkyEt2JwT7/A8rvtUjBEZIvUt3ClPkPpo1yy1Sy4/Rr7Fj6vCUDd2NUw tpeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KmMMF4Fq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-126027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u12-20020a17090626cc00b00a4e1aa04567si3561301ejc.772.2024.03.31.03.00.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 03:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KmMMF4Fq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-126027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C16EC1F21D21 for ; Sun, 31 Mar 2024 10:00:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF2A2762DF; Sun, 31 Mar 2024 10:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KmMMF4Fq" 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 D9F5A1C33; Sun, 31 Mar 2024 10:00:48 +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=1711879249; cv=none; b=MYHpxZ2baLuuXk7FsGlgbEwUH+HAuPp9bbi7hbv7x/XUpDh68/74rZxiXEynQFIh5DFhLLVg7jnwKxSwlGUG/evRsjqJLt77mQT62Ch2KdJkgqGzpLqyJnC2eZxZ1JASoSAeRivoog4wQ2A1txbOaYZg1mf/v5qEWW7P60L9ur0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711879249; c=relaxed/simple; bh=8ZlEK5607Jk4tOKuXpJJJZbQBuqSIL7N3MY76VqKGds=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=tQq5PggapuYJ0UGG0JZQAfZD4QGTMlk6ZJqtF5xLRvsC/wnVcyqPLprYzKCbsnvIrdAwTZUM29Zy62dABUkYeSYjBkSczJ8FvIZZT32HoGhsz3k4bZMoUz0hsi/dTBecJdH/jy0v0T/I0jd9cP65b1yiAqJAjewNCzHSD86q830= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KmMMF4Fq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61394C433F1; Sun, 31 Mar 2024 10:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711879248; bh=8ZlEK5607Jk4tOKuXpJJJZbQBuqSIL7N3MY76VqKGds=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KmMMF4FqWijFeM4Mc1d+9Ubdwa3TgkbMdi6eJ6RH0MAB8zu2AokIMtuynk9zHpst7 sjaOhpoiX/WY/rN5CHXvjADJSyWPVAk6E29IYeTIpMKQgGbS0bjQEdOxCPRzZrHqRo 4I61gRbw7wBV0302LHrINBbf1Qu8jogvvPA2OPYB5Rda+tdjSWwlpUrBL94xa7zCyT sxQ3fdtYh4Ed+8k8UoLlhy5wUCDdk+g9Ee0f7ZkPcpfN1U2bUQTJtR0mIKbmN2Yu8J cWc12qcfmDEeapF4GLr3ETEj5czb7hk7mGI/Lk19OgAijibq+r+28/DKr5RV5kcQ3E ZsOTd8Sgq5fug== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] helo=wait-a-minute.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 1rqrzY-00013r-IH; Sun, 31 Mar 2024 11:00:45 +0100 Date: Sun, 31 Mar 2024 11:00:41 +0100 Message-ID: <87msqesoty.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: Catalin Marinas , Will Deacon , Oliver Upton , James Morse , Suzuki K Poulose , Jonathan Corbet , Shuah Khan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Martin , kvmarm@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v6 1/5] KVM: arm64: Share all userspace hardened thread data with the hypervisor In-Reply-To: <20240329-arm64-2023-dpisa-v6-1-ba42db6c27f3@kernel.org> References: <20240329-arm64-2023-dpisa-v6-0-ba42db6c27f3@kernel.org> <20240329-arm64-2023-dpisa-v6-1-ba42db6c27f3@kernel.org> 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/28.2 (x86_64-pc-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.104.136.29 X-SA-Exim-Rcpt-To: broonie@kernel.org, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, corbet@lwn.net, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave.Martin@arm.com, kvmarm@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 29 Mar 2024 00:13:42 +0000, Mark Brown wrote: > > As part of the lazy FPSIMD state transitioning done by the hypervisor we > currently share the userpsace FPSIMD state in thread->uw.fpsimd_state with > the host. Since this struct is non-extensible userspace ABI we have to keep Using the same representation is just pure convenience, and nothing requires us to use the it in the kernel/hypervisor. > the definition as is but the addition of FPMR in the 2023 dpISA means that > we will want to share more storage with the host. To facilitate this > refactor the current code to share the entire thread->uw rather than just > the one field. So this increase the required sharing with EL2 from 528 bytes to 560. Not a huge deal, but definitely moving in the wrong direction. Is there any plans to add more stuff to this structure that wouldn't be *directly* relevant to the hypervisor? > > The large number of references to fpsimd_state make it very inconvenient > to add an additional wrapper struct. > > Signed-off-by: Mark Brown > --- > arch/arm64/include/asm/kvm_host.h | 3 ++- > arch/arm64/include/asm/processor.h | 2 +- > arch/arm64/kvm/fpsimd.c | 13 ++++++------- > arch/arm64/kvm/hyp/include/hyp/switch.h | 2 +- > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 4 ++-- > 5 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 9e8a496fb284..8a251f0da900 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include > #include > > #define __KVM_HAVE_ARCH_INTC_INITIALIZED > @@ -640,7 +641,7 @@ struct kvm_vcpu_arch { > struct kvm_guest_debug_arch vcpu_debug_state; > struct kvm_guest_debug_arch external_debug_state; > > - struct user_fpsimd_state *host_fpsimd_state; /* hyp VA */ > + struct thread_struct_uw *host_uw; /* hyp VA */ > struct task_struct *parent_task; Well, this is going away, and you know it. M. -- Without deviation from the norm, progress is not possible.