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 E0AB017083C; Fri, 21 Jun 2024 07:53:35 +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=1718956416; cv=none; b=GrGNv9mP0EEUAh/seIGaB4WQikZMvcOaEQ5MsG+rAGEEEdWj9ruFnV5cU6tQT9ejQq05EwCgBydoYy6y/FYix+KmZPg0SsBXKFCmcylsmlZPLATwJc5Yeavjwl4NE1y+GsSZRij0V9dFo8PQ3nnBw9WJQnx8wtTOWgqo6B18Rr8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718956416; c=relaxed/simple; bh=eWeBwZ8/Lk6nImbfjWKt6XAuHYSDXDTd7xgQ3zt0uuA=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=Prtw/Druw+j04/ONvRy7ym2bbT8g6EWOeioh7ey42lwcKN5xHeUWp3Q/g4ZGVYx0/MB+/zE03/OwMwpfLG0IPyoBIIomUwFM4qDIWbHiJaRt2+Lw4eo5d2xqTcKmNGij+NK/bihxx0IO17Rsxhwhj5VtVXRwFtYn+tDwZDa9rW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tVJlnJCG; 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="tVJlnJCG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79671C2BBFC; Fri, 21 Jun 2024 07:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718956415; bh=eWeBwZ8/Lk6nImbfjWKt6XAuHYSDXDTd7xgQ3zt0uuA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tVJlnJCGU3Ze6y91aA9mNXAeaKUrXYNa2sVodHGKsiRh4ebOIw1qfrUjg1SqtmC7V Bb6ECx/rwVvmajkN/+95vkWcjK5DDb0Qf03sBEEYO14PYePRkjb4FRV2BqQvIYA3Wc y+/jIbcCr0d7hU3OTrZYEoXzuEhQywVCHr0Ks0MlYSYje9ufuEM0J6LylY9RxgZPb2 a7dUPFSwffA4Yu6406bblU23YZcuYwkgS95qvQ88rZuGyziJ9V/ahHxPv2s2c9BNYO ETQwhiHXSXH+ClJG5vttCBYf4kOm3BvHBOHxN2y0GUk4VLaOeHjSRq3d9ZB97ymNC7 jmhYrDCmkg8Kw== 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 1sKZ5R-0062nT-7i; Fri, 21 Jun 2024 08:53:33 +0100 Date: Fri, 21 Jun 2024 08:53:32 +0100 Message-ID: <861q4qk9z7.wl-maz@kernel.org> From: Marc Zyngier To: Shaoqin Huang Cc: Oliver Upton , kvmarm@lists.linux.dev, James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] KVM: arm64: Allow userspace to change ID_AA64PFR1_EL1 In-Reply-To: References: <20240618063808.1040085-1-shahuang@redhat.com> <20240618063808.1040085-2-shahuang@redhat.com> <86ed8uk8cr.wl-maz@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/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=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: shahuang@redhat.com, oliver.upton@linux.dev, kvmarm@lists.linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@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, 21 Jun 2024 07:17:57 +0100, Shaoqin Huang wrote: > > Hi Marc, > > On 6/18/24 15:39, Marc Zyngier wrote: > > On Tue, 18 Jun 2024 07:38:06 +0100, > > Shaoqin Huang wrote: > >> > >> Allow userspace to change the guest-visible value of the register with > >> some severe limitation: > >> > >> - No changes to features not virtualized by KVM (MPAM_frac, RAS_frac) > >> --- > >> arch/arm64/kvm/sys_regs.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > >> index 22b45a15d068..bead81867bce 100644 > >> --- a/arch/arm64/kvm/sys_regs.c > >> +++ b/arch/arm64/kvm/sys_regs.c > >> @@ -2306,7 +2306,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { > >> ID_AA64PFR0_EL1_GIC | > >> ID_AA64PFR0_EL1_AdvSIMD | > >> ID_AA64PFR0_EL1_FP), }, > >> - ID_SANITISED(ID_AA64PFR1_EL1), > >> + ID_WRITABLE(ID_AA64PFR1_EL1, ~(ID_AA64PFR1_EL1_RAS_frac | > >> + ID_AA64PFR1_EL1_MPAM_frac)), > >> ID_UNALLOCATED(4,2), > >> ID_UNALLOCATED(4,3), > >> ID_WRITABLE(ID_AA64ZFR0_EL1, ~ID_AA64ZFR0_EL1_RES0), > > > > This isn't a valid patch. > > > > Furthermore, how about all the other features that may or may not be > > currently handled by KVM? Please see [1] and make sure that all > > existing fields have a known behaviour (a combination of masked, > > preserved, capped, writable or read-only). > > > > I can at least see problems with MTE_frac and MTEX, plus all the other > > things that KVM doesn't know how to save/restore (THE, GCS, NMI...). > > > > What I asked you to handle the whole register, I really meant it. > > I currently only found the BT and SSBS fields can be written without > any unknown behavior. I can only assume you haven't looked hard enough. > > All other fields in the ID_AA64PFR1_EL1 are either not supported by > KVM or the field involved with other register and KVM don't know how > to handle them. Why can't CSV2_frac be writable? Why can't most of the other fields be hidden depending on the VM configuration, as pointed out above? M. -- Without deviation from the norm, progress is not possible.