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 0C76D36138; Wed, 27 Mar 2024 09:04:46 +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=1711530287; cv=none; b=nuz4eCam3+uBpLN/4WjJjGXGGX5ty/1lVy4mfRprhj9gVZscyrLVRshn/Ll6miOI0yf6tVkKiGaWwMQb2vEq4YP+WxrUwAGVZHmD+qqiC6Ii6U5yL6lR2zmn7AAunMeWh0ZjXInv83vO8nsMooobglhghPIWpEdrG3XQ/NCYV1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711530287; c=relaxed/simple; bh=bMyARdE0JIrslD3mQvkVUjwAyfKxGRyE+PhZMbxwV2U=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=NG/k9aLg2wQOM7Z50GsR2EFctRHN6toaMn0MU+J9g1hFOYbkZkG02E+YueWmmGO4qds5EKQWkTRNChHcqEESYyCOlIB9J6QWNUApi0Kyh2wXXA2dXl7RpoGCMszGjNl3tNUnMsVXJYauCGY77nuSPDShazk6aA/3Ef+499BqPbM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OUiODDVL; 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="OUiODDVL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9984EC433F1; Wed, 27 Mar 2024 09:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711530286; bh=bMyARdE0JIrslD3mQvkVUjwAyfKxGRyE+PhZMbxwV2U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OUiODDVLlw4kp8sQulM7X6Hhe6ixfPzarvVsc7FWgAUc7kh2mmGKkENXDNuSprxfE b8fxvRCDeTPEkJZJMMdp1Io+HtWbIPc6S/VKVIaayx/ZRAInsaB3j9TBcVcdQndByt 2gSFIkieb64+pqM2BzlTXk3v4Do6CTKTRVWFfQ5LdYhdjW3tUZ0AFCsGjJF0uPUf+U ItQYq3XPVkiN0X5VhuuagyerDUeiP/upfOp1lF4AtagKUNA5GaRnJgmfsaIJzNHAwq 8+ARNORJ3ypUZEtOS0l/dtYDke35La6swAlQfNn8JZzemYiBdZVZtita3bKOdJb/5w nTdvjIxRm4Yrw== Received: from 213-229-0-18.static.upcbusiness.at ([213.229.0.18] 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 1rpPD9-00GDv7-Sj; Wed, 27 Mar 2024 09:04:44 +0000 Date: Wed, 27 Mar 2024 09:04:42 +0000 Message-ID: <87a5mkrqol.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , James Clark , Anshuman Khandual , Dongli Zhang Subject: Re: [PATCH v2 5/5] KVM: arm64: Exclude FP ownership from kvm_vcpu_arch In-Reply-To: <55f2f1f7-6f23-45f2-ae6c-a1111e3271db@sirena.org.uk> References: <20240322170945.3292593-1-maz@kernel.org> <20240322170945.3292593-6-maz@kernel.org> <87edc0sr7z.wl-maz@kernel.org> <252bc993-e93d-4412-bfc6-13930b80dbd8@sirena.org.uk> <87cyrism0p.wl-maz@kernel.org> <55f2f1f7-6f23-45f2-ae6c-a1111e3271db@sirena.org.uk> 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: kvm@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: 213.229.0.18 X-SA-Exim-Rcpt-To: broonie@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, james.clark@arm.com, anshuman.khandual@arm.com, dongli.zhang@oracle.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 25 Mar 2024 14:57:27 +0000, Mark Brown wrote: > > [1 ] > On Mon, Mar 25, 2024 at 09:23:18AM +0000, Marc Zyngier wrote: > > Mark Brown wrote: > > > > This was referring to the fact that currently when SVE is enabled access > > > to the V registers as V registers via _CORE_REG() is blocked and they > > > can only be accessed as a subset of the Z registers (see the check at > > > the end of core_reg_size_from_offset() in guest.c). > > > But what behaviour do you expect from allowing such a write? Insert in > > place? Or zero the upper bits of the vector, as per R_WKYLB? One is > > wrong, and the other wrecks havoc on unsuspecting userspace. > > It would have to be the former due to the ABI issue I think. No, that's an architecture violation. > > My take on this is that when a VM is S*E aware, only the writes to the > > largest *enabled* registers should take place. This is similar to what > > we do for FP/SIMD: we only allow writes to the V registers, and not to > > Q, D, S, H or B, although that happens by construction. For S*E, > > dropping the write on the floor (or return some error that userspace > > will understand as benign) is the least bad option. > > OK, this does mean that in the case of a SME only guest we'll end up > with registers not just changing size but appearing and disappearing > depending on SVCR.SM. It wasn't clear to me that this was a good idea > from an ABI point of view, it's a level up beyond the size changing > thing and there's a tradeoff with the "model what the architecture does" > model. The registers don't have to disappear, they just have to become WI, just like it is the case today with SVE. Yes, the ABI becomes contextual, but we're past the point where we can treat the various register files as a bag of bits that can be save/restored without any ordering. We already have similar requirements for complex parts of KVM where ordering is required, such as GICv3 and the ITS, and we follow what the architecture requires. The same thing applies for the CPU. M. -- Without deviation from the norm, progress is not possible.