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 66342C04FFE for ; Fri, 17 May 2024 17:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bsc0iqczIwbu65SX/geJg0akGklFOrm7O7VQUHOHXT0=; b=iMIpNZEH3oLqQA XNdfNW05ekOLwB7TxejTZpr3OK10qHsnYy7ZtRmhTBLMYWXhoIBwASp4AzRNsMDD5AXobn+izY2M7 qY46wACVHXujqhCAOGPabJ3hRwX3P8H9Yj8dNae5QFHhZwAh1dcVZa3sa6z8NaaxtEbDTXp1oTpbr lBh33oQdtW81bJr/Yh0c0gqfvl28b9lq8p9/WxvBAy/CtvnTM40hJylhHgCImqECYDqKa896Z0EZ1 W0o4worUrVsExMJ5rP/mzqhqVEJ3z0F79vePxnckqhPAW0OQegYrLzQDxS8tkr3Uiev+WveySejDb vDs2rie05HBBQSeNl18A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s81QM-00000008XXi-0b6O; Fri, 17 May 2024 17:31:18 +0000 Received: from out-188.mta0.migadu.com ([91.218.175.188]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s81QC-00000008XUA-1jDu for linux-arm-kernel@lists.infradead.org; Fri, 17 May 2024 17:31:11 +0000 X-Envelope-To: tabba@google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715967059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PauZknEQMacybh/AcgeLdUGz8PBpDzU4I7xOaTQN274=; b=blwCIWlzAe6chjJZYFihbfc2hNxDdnazjj4Qb5FEb6O1snlFySZSjC+P94ySmym51qFkGq 14kR9VRwNp/AtFN7C0vvSorqq6GCOTj1x+F1AQknNwNg1WTyZsMOMHYLMj5b1d+wR2QJYF Uy6muBmTMLW66vDQOCY4o40rG9hECGE= X-Envelope-To: kvmarm@lists.linux.dev X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: maz@kernel.org X-Envelope-To: will@kernel.org X-Envelope-To: qperret@google.com X-Envelope-To: seanjc@google.com X-Envelope-To: alexandru.elisei@arm.com X-Envelope-To: catalin.marinas@arm.com X-Envelope-To: philmd@linaro.org X-Envelope-To: james.morse@arm.com X-Envelope-To: suzuki.poulose@arm.com X-Envelope-To: mark.rutland@arm.com X-Envelope-To: broonie@kernel.org X-Envelope-To: joey.gouly@arm.com X-Envelope-To: rananta@google.com X-Envelope-To: yuzenghui@huawei.com Date: Fri, 17 May 2024 17:30:54 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Fuad Tabba Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, maz@kernel.org, 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, mark.rutland@arm.com, broonie@kernel.org, joey.gouly@arm.com, rananta@google.com, yuzenghui@huawei.com Subject: Re: [PATCH v1 0/7] KVM: arm64: Fix handling of host fpsimd/sve state in protected mode Message-ID: References: <20240517131814.719933-1-tabba@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240517131814.719933-1-tabba@google.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_103108_756604_3BE2D911 X-CRM114-Status: GOOD ( 17.12 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Fuad, On Fri, May 17, 2024 at 02:18:07PM +0100, Fuad Tabba wrote: > With the KVM host data rework [1], handling of fpsimd and sve > state in protected mode is done at hyp. For protected VMs, we > don't want to leak any guest state to the host, including whether > a guest has used fpsimd/sve. > > To complete the work started with the host data rework, in > regards to protected mode, ensure that the host's fpsimd context > and its sve context are restored on guest exit, since the rework > has hidden the fpsimd/sve state from the host. > > This patch series eagerly restores the host fpsimd/sve state on > guest exit when running in protected mode, which happens only if > the guest has used fpsimd/sve. This means that the saving of the > state is lazy, similar to the behavior of KVM in other modes, but > the restoration of the host state is eager. Hmm... Is there any reason why we need to be concerned about preserving host SVE state? The syscall ABI has it that only the first 128 bits of the vector registers are preserved by the kernel, and I see no reason why we couldn't apply a similar restriction to KVM_RUN HVCs into EL2. We'd need to eagerly flush the vector registers on entry to avoid disclosing guest usage of SVE. What you have is certainly correct, I just wonder if we're going out of our way to save/restore 0's for larger VLs. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel